Hello Albert,

You're not giving a lot of details here, but:

- you're not using glyph->metrics.horiBearingX at all, while
  you should be comparing the glyph's xmax with its advance
  (i.e. horiBearingX+width to horiAdvance)

  horiBearingX should also be used for positioning the glyphs

- even when positioning with horiBearingX, it's perfectly ok
  for some glyphs to have an advance smaller than the xmax
  (e.g. most italic fonts). It really depends on the design
  of the font

- in case you haven't read the documentation, be aware that
  the glyph metrics are *not* transformed when using
  FT_Set_Transform()

- since you call FT_Render_Glyph to generate a bitmap, you'd
  better use glyph->bitmap_left and glyph->bitmap_top, as well
  as glyph->bitmap.width and glyph->bitmap.rows to position
  it correctly.

  these will correspond to the transformed glyph.

I don't know if this helps,

Regards,

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


On Mon, 4 Dec 2006 20:52:55 +0100, "Albert Torras" <[EMAIL PROTECTED]> said:
> Hi,
> 
> I work with freetype 2.1.10 crosscompiled for ARM and it works quite
> fine.
> 
> However, I have some problems with horiAdvance... It happens that
> sometimes
> the face->glyph->metrics.width is a higher value than face->glyph->
> metrics.horiAdvance,
> and it produces the overlapping of strings, because I increment the pen
> position according to the value of horiAdvance.
> 
> I can't understand why this happens.
> 
> An example of the code used is pasted below:
> 
>       *// 90ยบ clockwise rotation*
>       matrix.xx = (FT_Fixed) ( 0 * 0x10000L);
>       matrix.xy = (FT_Fixed) ( 1 * 0x10000L);
>       matrix.yx = (FT_Fixed) ( -1 * 0x10000L);
>       matrix.yy = (FT_Fixed) ( 0 * 0x10000L);
> 
>       *// Loop*
>       *for* (n=0; n < strlen(text); n++) {
> 
>               FT_Set_Transform(face, &matrix, &pen);
>       
>               */* retrieve glyph index from character code */*
>               glyph_index = FT_Get_Char_Index( face, text[n] );
> 
>               */* load glyph image into the slot (erase previous one) */*
>               FT_Load_Glyph( face, glyph_index, FT_LOAD_DEFAULT );
> 
>               */* convert to an anti-aliased bitmap */*
>               FT_Render_Glyph( face->glyph, FT_RENDER_MODE_NORMAL );
> 
>               printf("\nWidth: %d     Advance:
> %d\n",face->glyph->metrics.width,face->glyph->metrics.horiAdvance);
> 
>       }
> 
> 
> And here are some of the results I get from printf...
> 
> Width: 576     Advance: 576     OK!
> Width: 640     Advance: 576     Not OK
> Width: 576     Advance: 512     Not OK
> Width: 192     Advance: 256     OK
> Width: 576     Advance: 512     Not OK
> 
> 
> Does anybody know why??
> 
> Thanks a lot for your help.
> Albert


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

Reply via email to