freetype
[Top][All Lists]
Advanced

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

Re: glyph info


From: crusius_at_stanford . edu
Subject: Re: glyph info
Date: Sat, 07 Oct 2000 12:50:28 -0700

In reply to Werner LEMBERG <address@hidden>
>
>> >On a per-glyph basis, the field face->glyph->linearHoriAdvance
>> >(after a call to FT_Load_Glyph) contains the advance width in
>> >original font units if the flag FT_LOAD_UNSCALED_LINEAR has been
>> >used.  Together with face->units_per_EM you should be able to do
>> >what you want.
>> 
>> that flag does not seem to exist (although it is mentioned in the
>> documentation).  are you talking about FT_LOAD_NO_SCALE instead?  if
>> i use that flag i always get linearHoriAdvance=0 for cmr10.pfb...
>> the horiAdvance seems to be correct for the font, though.
>
>Sorry, it should be FT_LOAD_LINEAR_DESIGN.  I'll fix the
>documentation.

ok! now i think i have the code right, but for some reason i can't get
the linearHoriAdvance. Here's the code that loads the glyph:

---------------------------------------------------------------
if(curr_font->glyphs[ch]==0)
{
  if(FT_Load_Glyph(curr_font->face,ch,FT_LOAD_LINEAR_DESIGN) ||
      FT_Get_Glyph(curr_font->face->glyph,curr_font->glyphs+ch))
  { ... error }
  if(FT_Glyph_To_Bitmap(curr_font->glyphs+ch,ft_render_mode_normal,0,1))
  { ... error }
  
if(((FT_BitmapGlyph)(curr_font->glyphs[ch]))->bitmap.pixel_mode!=ft_pixel_mode_grays)
  { ... error }
  curr_font->advance[ch]=curr_font->face->glyph->linearHoriAdvance;
  debug && printf("Glyph %d@@%d: advance=%d, (%dx%d) %d-grays bitmap.\n",
      ch,curr_font->number,curr_font->advance[ch],
      ((FT_BitmapGlyph)(curr_font->glyphs[ch]))->bitmap.width,
      ((FT_BitmapGlyph)(curr_font->glyphs[ch]))->bitmap.rows,
      ((FT_BitmapGlyph)(curr_font->glyphs[ch]))->bitmap.num_grays
      );
}
---------------------------------------------------------------

and here's a sample from the debugging output:

---------------------------------------------------------------
Font 0: scale=655360, design=655360, file=cmr10.
Loaded font from file /usr/share/texmf/fonts/type1/bluesky/cm/cmr10.pfb, 
scalable.
Glyph address@hidden: advance=0, (3x10) 256-grays bitmap.
Glyph address@hidden: advance=0, (9x10) 256-grays bitmap.
Glyph address@hidden: advance=0, (7x11) 256-grays bitmap.
Glyph address@hidden: advance=0, (5x6) 256-grays bitmap.
---------------------------------------------------------------

any clues?

--
Cesar Augusto Rorato Crusius    __o      __o      __o      __o      __o    
Stanford University           _`\<,    _`\<,    _`\<,    _`\<,    _`\<,    
e-mail:address@hidden    (_)/(_)  (_)/(_)  (_)/(_)  (_)/(_)  (_)/(_)   
www.stanford.edu/~crusius
                                       o      _     _         _
   __o      __o      __o      __o     /\_   _ \\o  (_)\__/o  (_)
 _`\<,    _`\<,    _`\<,    _`\<,    _>(_) (_)/<_    \_| \   _|/' \/
(_)/(_)  (_)/(_)  (_)/(_)  (_)/(_)  (_)        (_)   (_)    (_)'  _\o_

He who sacrifices functionality for ease of use
Loses both and deserves neither



reply via email to

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