Re: Pango device units



Owen,

On Thu, Aug 28, 2003 at 04:02:52PM -0400, Owen Taylor wrote:
On Thu, 2003-08-28 at 15:43, Pawel S. Veselov wrote:
Owen,
Yeah, I'm aware of PANGO_SCALE being a multiplier between device
units and pango units, but it doesn't seem to me that the device
units are actually pixels. If I set a font, say "Sans 10" for
pango layout, or call the pango_font_description_set_size(desc, 10),
the pango_layout_get_pixel_size() returns like 14 for the height.
Oh, you mean "it doesn't seem to me that the device units are
actually points". The points <=> device units conversion isn't 
something that is available at the current time.,

Hmm, from pango_font_description_set_size() doc:

size : the size for the font description in pango units. There are PANGO_SCALE
Pango units in one device unit (device unit is a point, for font sizes).

from pango_layout_get_pixel_size() doc:

Determines the logical width and height of a PangoLayout in device units.
(pango_layout_get_size() returns the width and height in thousandths of a
device unit.) This is simply a convenience function around
pango_layout_get_extents().

Either doc is wrong, or the question still should sound "what's the
device unit (point) <=> pixel conversion ?"

pango_font_description() also says that SIZE is size in points...

http://mail.gnome.org/archives/gtk-i18n-list/2003-August/msg00001.html 
(Includes how to get it if you know you are using Xft2, and
are willing to have a bunch of hacky code)

http://bugzilla.gnome.org/show_bug.cgi?id=119081

Yeah, that sounds like a work around. I wasn't aware that scaling will
be different for X/Xft backends... Was the 119081 implemented in the
pango that just got out ?

Basically, what I'm trying to do is to figure the largest font size
while fitting text in a box... If I keep scaling down until
pango_layout_get_pixel_size() returns the height I need, the
text becomes extremely small and unreadable...
No, I don't understand that. pango_layout_get_pixel_size()
returns how big the layout is in pixels.

Well, doc says it still device units, but it looks like those are actually
pixels. Anyway, am I right in the assumption that if a single line is rendered
into the layout, the height of the layout will be the height of the font ?
Does pango add any paddings ?

Thanks !
    Pawel.

[ skipped ]



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]