Re: fonts in gtk-2.0/pango



On 29 Jul 2002, Sven Neumann wrote:

> Allin Cottrell <cottrell wfu edu> writes:
>
> > (1) The pango font metrics apparatus fails to return correct metrics
> > for a known monospaced font (e.g. Lucida Typewriter).  The only
> > function for getting the width of a character directly (i.e. short of
> > creating a pango layout and measuring its size in pixels) is the
> > "approximate" char_width function.  In the Lucida Typewriter case,
> > where no "approximation" is called for since every glyph has the exact
> > same width, the value returned is out by 14 percent (8 instead of the
> > correct 7 pixel width on my system).  This is just not good enough,
> > for purposes such as sizing windows that are to hold a given length of
> > line in monospaced characters.  It is a marked regression from the old
> > GdkFont mechanism, which gave accurate metrics with a single function
> > call.
>
> please note that pango_font_metrics_get_approximate_char_width()
> returns the approximate glyph advance, not the approximate glyph
> width. The function is probably badly named but it seems that the
> return value is reasonable if you take this into consideration.

Actually, no.  It was the glyph advance that I was interested in, and
I assumed that was what the function was returning.  But the value is
wrong: it is given as 8 by
pango_font_metrics_get_approximate_char_width() while in fact it is 7.
This is for Lucidatypewriter 10, where the glyphs themselves are
of various widths but are all padded to give an advance of 7 pixels.

Allin Cottrell.




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