Re: Pango device units
- From: "Pawel S. Veselov" <Pawel Veselov Sun COM>
- To: Owen Taylor <otaylor redhat com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Pango device units
- Date: Thu, 28 Aug 2003 12:43:17 -0700
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.
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...
Thanks,
Pawel.
On Wed, Aug 27, 2003 at 11:23:06PM -0400, Owen Taylor wrote:
On Wed, 2003-08-27 at 19:22, Pawel S. Veselov wrote:
Hi,
a quick one.
What's the ratio between pango device units (points)
and the actual number of pixels, and how to figure it out
programatically ?
Pango units are basically a fixed point number - the
scale is given by PANGO_SCALE (1024 as it happens).
What a value of 1.0 * PANGO_SCALE means is up to the
backend - the current backends all treat it as one pixel,
but a Postscript background would probably use 1 point
instead.
There is a PANGO_PIXELS() macro round that more or less
is:
nearest_integer (val / PANGO_SCALE)
To convert from a integer number of pixels to a pango,
just multiple by PANGO_SCALE.
Regards,
Owen
Bye.
--
Pawel S. Veselov [vps] (MTS, Service Provisioning and OMA) __ __(O) _ __
(408) 276-5410 e-mail: Pawel Veselov Sun COM \ V /| || ' \
fax(408) 276-3243 HomePage: http://manticore.2y.net \_/ |_||_|_|_|
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]