Re: Pango device units
- From: Owen Taylor <otaylor redhat com>
- To: "Pawel S. Veselov" <Pawel Veselov Sun COM>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Pango device units
- Date: Thu, 28 Aug 2003 16:41:30 -0400
On Thu, 2003-08-28 at 16:20, Pawel S. Veselov wrote:
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).
That's sort of confusing. What it should say is something like:
The size is a fixed point number, with a scale of PANGO_SCALE.
size / PANGO_SCALE gives the font size in points. The conversion
between points and device units.
I'd like to reserve the term "device units" to the dimensions that
refer to distances on a device.
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 ?"
The font doc is a bit confused. Feel free to file a bug,
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 ?
No. 1.2.5 is a maintainence release, no new API. (If it was implemented,
it would be closed! :-)
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 ?
Generally, yes. For the right definition of "the height of the font".
There is an inter-line pad (pango_layout_set_spacing) but no padding
around the whole layout.
Regards,
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]