freetype
[Top][All Lists]
Advanced

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

Re: Size of Space in Truetype Fonts


From: David Turner
Subject: Re: Size of Space in Truetype Fonts
Date: Wed, 28 Jun 2000 23:56:20 +0200

Hi Jason,

> 
> Hi All,
> 
> Sorry to ask such a silly question but what is the correct way to determine
> the size (in pixels) of spaces when rendering truetype text?  I tried:
> 
>                         cursor += face->size->metrics.x_ppem;
> 
> but it seems to be a little large.
> 
Yes, it doesn't correspond to the space's advance width, which depends
on the font (unlike the x_ppem which only depends on what you ask in
FT_Set_Char_Sizes or FT_Set_Pixel_Sizes)

The best way is simply to use something like:

   glyph_index = FT_Get_Char_Index( face, 32 );   /* get glyph index for space 
*/
   error = FT_Load_Glyph( face, glyph_index, FT_LOAD_DEFAULT );
   space_advance = face->glyph->metrics.horiAdvance;

Hope this helps :-)

- David

> Thanks!
> 
> {
>    Jason Gaiser                                 phone:  (858) 824-3078
>    Wind River Doctor Design Services    fax: (858) 824-3178
>    address@hidden                   http://www.doctordesign.com
> }



reply via email to

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