freetype
[Top][All Lists]
Advanced

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

Re: [ft] Getting width of space


From: David Turner
Subject: Re: [ft] Getting width of space
Date: Mon, 21 May 2007 10:15:36 +0200

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...

hope this helps,

- David Turner
- The FreeType Project  (www.freetype.org)


On Thu, 17 May 2007 17:01:00 +0000 (UTC), "Peter Weilbacher" <address@hidden> 
said:
> I'm very new to fonts and am still trying to find out different ways of 
> doing things and trying to understand FT functionality.
> 
> I use code like this
>  
>    gid = FT_Get_Char_Index(face, 'x');
>    FT_Load_Glyph(face, gid, FT_LOAD_DEFAULT);
>    xWidth = face->glyph->metrics.width;
>  
> successfully to compute the widths of different characters. I tried to 
> do the same for spaces (using ' ' instead of 'x') but that always gives 
> me a width of zero. Why is that and is there a clever way to do that? I 
> tried to use face->glyph->advance.x for spaces instead (which is 
> non-zero) but that gives me a width that seems to be too narrow by at 
> least a factor of 2 for the different fonts I tried.
> -- 
> Greetings,
>    Peter.
> 
> 
> 
> _______________________________________________
> Freetype mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/freetype




reply via email to

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