freetype
[Top][All Lists]
Advanced

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

Re: [ft] Getting width of space


From: Peter Weilbacher
Subject: Re: [ft] Getting width of space
Date: Mon, 21 May 2007 11:47:01 +0200 (CEST)

On Mon, 21 May 2007, David Turner wrote:

glyph->metrics.width corresponds to the actual width of the glyph. In the case 
of any
"spacing" character, this is normally 0.

what you really want is the horizontal advance, try face->glyph->horiAdvance 
instead.
If you don't understand what I mean, try reading the "Glyph Conventions" 
document on
the FreeType web site...

I guess you mean face->glyph->metrics.horiAdvance (because face->glyph->linearHoriAdvance is there but seems to give something completely different, even with >> 16). horiAdvance seems to be the same as advance.x for several fonts I tried. Unfortunately it is not always easy to relate properties in the documentation with structure members in the API...

That leaves the second of my original questions. advance.x = horiAdvance for a space seems awfully small to me. For MS Arial I get

   'm': width=576, horiAdvance=640, advance.x=640
   'n': width=384, horiAdvance=448, advance.x=448
   'x': width=384, horiAdvance=384, advance.x=384
   'i': width=128, horiAdvance=192, advance.x=192
   '.': width=128, horiAdvance=192, advance.x=192
   ' ': width=  0, horiAdvance=192, advance.x=192

When I use those advances t draw continuous text it is very hard to discriminate where words start and end. When I look at nicely layouted text (LaTeX) it seems to me that the space between words is about the same as the width of the x character but not as narrow as the i or the dot as the above numbers seem to apply. I therefore used 2*advance.x but that seems kind of wrong...

   Peter.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]