Hi, at the moment i am doing

FT_Load_Glyph(face, ...)
FT_Render_Glyph(slot, ...)
int x = -slot->bitmap_left;
int y = slot->bitmap_top;
int w = slot->bitmap.width;
int h = slot->bitmap.rows;

I would like to get a rough idea of x, y, w, h before calling FT_Render_Glyph 
so that if certain conditions are met i don't need to render the glyph

What i have been doing is 

FT_Load_Glyph(face, ...)
FT_Glyph_Metrics *glyphMetrics = &(face->glyph->metrics);
int x = round(-glyphMetrics->horiBearingX / 64.0);
int y = round(glyphMetrics->horiBearingY / 64.0);
int w = round(glyphMetrics->width / 64.0);
int h = round(glyphMetrics->height / 64.0);

That code works fine for most of the fonts i tried but now i have encountered 
a case in which 
 round(-glyphMetrics->horiBearingX / 64.0);
is -2 and 
 -slot->bitmap_left;
is 26

So my question is, is my code totally wrong in the sense that what I am trying 
to calculate is not possible without actually rendering the glyph?

Or is it possible and i'm just missing something in my "guessing" code?

Thanks for the help,
  Albert

_______________________________________________
Freetype-devel mailing list
Freetype-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/freetype-devel

Reply via email to