Re: Absolute font sizes
- From: Owen Taylor <otaylor redhat com>
- To: Behdad Esfahbod <behdad behdad org>
- Cc: gtk-devel-list gnome org, Tim Janik <timj imendio com>, Kristian Rietveld <kris imendio com>
- Subject: Re: Absolute font sizes
- Date: Tue, 31 Oct 2006 16:59:43 -0500
On Tue, 2006-10-31 at 15:46 -0500, Behdad Esfahbod wrote:
> On Tue, 2006-10-31 at 12:02 +0100, Kristian Rietveld wrote:
> > Hey Behdad,
>
> Hey Kris,
>
> > We noticed this week that nothing in GTK+ currently checks whether the
> > font size returned by pango_font_description_get_size() is absolute or not.
>
> This is a very unfortunate side effect of the fact that absolute size
> was added in a much later version than normal sizes. And indeed a
> horrible API design choice to add
> pango_font_description_get_size_is_absolute() instead of
> pango_font_description_get_absolute_size().
And .. how would you implement the latter? :-)
> Now the confusing parts are:
>
> - For PS/PDF, a device unit is one point. This is ok as long as you
> don't mess up with the fontmap resolution which takes a default of 72
> for PS/PDF backends, but if you confuse them and set something like
> 300dpi or 600dpi, god knows what happens :)
>
> - All the stuff above completely ignores any scale you may have on
> your PangoContext. That's not very common though.
>
>
> > I hope you can enlighten us, so the backends can be brought in sync and
> > GTK+ be fixed :)
>
> I think the Pango uses are fine. GTK+ never uses
> pango_font_description_set_absolute_size(). That's good. But I see one
> can set a font_desc property on a texttag, and that may have absolute
> size. Also, in other places, GTK+ creates a font description from an
> string. Until very recently that always generated non-absolute font
> descriptions, but (in 1.14 I guess) I added ability to parse sizes like
> 18px to result in font descriptions with absolute sizes. So, you want
> to check that.
BTW, if you want to size things to match a font description, the best
way to do that is:
pango_context_get_metrics()
I can't think of many cases in which you want to take a font description
and try to figure out what the specified font size is in pixels.
- Owen
[
Date Prev][Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]