[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ft] Freetype 2.4.4 -> freetype 2.4.12: FT_Get_Advance changed behav
From: |
Werner LEMBERG |
Subject: |
Re: [ft] Freetype 2.4.4 -> freetype 2.4.12: FT_Get_Advance changed behaviour? |
Date: |
Mon, 03 Jun 2013 09:05:49 +0200 (CEST) |
> I've reduced my code to the attached program (which is still a bit
> convoluted - sorry!). [...]
Thanks. There was a serious bug in FT_Get_Advance which has been
fixed in version 2.4.9: According to the documentation, the returned
advance value is either in 16.16 format or in font units. Before the
fix this was true only if it was possible to quickly retrieve the
advance value, which is not the case for hinted TT fonts. You
probably hadn't noticed that you circumvented the bug by using the
26.6 format, together with undoing the wrong double scaling,
right? :-)
The fix is rather simple (see below) if you want to stay with
computing everything in 26.6 format.
Werner
======================================================================
--- textlayouttext.cpp.orig 2013-06-03 08:59:04.000000000 +0200
+++ textlayouttext.cpp 2013-06-03 08:59:28.000000000 +0200
@@ -148,7 +148,7 @@
// get character width of current character
_TL_ActivateFontSize(glyphs[i].font,glyphs[i].size);
FT_Get_Advance(TL_Globals.fonts[glyphs[i].font].face,glyphs[i].glyph,FT_LOAD_DEFAULT,&advance);
-
advance=(FT_Fixed)(64*advance/(float)TL_Globals.fonts[glyphs[i].font].face->size->metrics.x_scale);
+ advance>>=10;
width+=advance;
// check whether this is the first character in the string/line