[HarfBuzz] hb_glyph_position_t::x_offset and scaled FreeType fonts

Jamie Dale jamiedale88+harfbuzz at gmail.com
Mon May 8 20:15:30 UTC 2017

Something is definitely causing it to change when the font is scaled though:

 Scale | x_offset
~0.666 |  2141
~0.832 |  340
~1.000 | -1461
~1.165 | -3262
~1.332 | -5063


On 8 May 2017 at 20:45, Jamie Dale <jamiedale88+harfbuzz at gmail.com> wrote:

> Hey all,
> I'm running HarfBuzz 1.2.4 with a modified hb_font implementation based
> on the FreeType implementation in the vanilla version.
> One of the differences is that I pass through the FreeType scale as
> user-data and apply it when getting the metrics from FreeType (via
> FT_Set_Transform).
> We've been running with this for a while, and haven't noticed any issues
> until today when we tried it with some Thai text and found that the
> hb_glyph_position_t::x_offset was coming back wrong once the text was
> scaled (weirdly this same issue doesn't seem to affect
> hb_glyph_position_t::y_offset).
> When the scale is 1, everything is fine, but when the scale is <1 the
> glyph is too far right (suggesting that the offset is too large), and when
> the scale is >1 the glyph is too far left (suggesting that the offset is
> too small).
> That would suggest to me that the value I'm getting back hasn't been
> scaled appropriately for the actual FreeType glyph. Unfortunately I'm not
> familiar enough with how HarfBuzz calculates that value to know where that
> lack of scale is happening.
> I do notice that there's no FreeType override for the
> set_glyph_h_origin_func from hb_font. Could that be the issue?
> The Thai text being used is ฝึ (U+0E1D, U+0E36) and the font is Tahoma
> (available in Windows).
> Has anyone else attempted something like this?
> Thanks,
> Jamie.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/harfbuzz/attachments/20170508/28e099cf/attachment.html>

More information about the HarfBuzz mailing list