<div dir="ltr">Okay, I've sorted this out now :)<div><br></div><div>The default FreeType implementation doesn't take the font scale into account when setting up the hb_font, so I have to do that myself. I must've just been getting away with it on the v_offset somehow (I did apply the scale myself afterwards, and it was somehow precise enough).</div><div><br></div><div>The reason I was seeing issues before when trying to apply the scale is because I wasn't doing it in 16.16 space so was losing precision.</div><div><br></div><div>// <span style="font-family:monospace,monospace">InFontScale is a float, where 1.0 is the default scale</span></div><div><div><font face="monospace, monospace">const FT_Long FixedFontScale = static_cast<FT_Long>(InFontScale * 65536);</font></div><div><font face="monospace, monospace">HarfBuzzFTFont->x_scale = FT_MulFix(HarfBuzzFTFont->x_scale, FixedFontScale);</font></div><div><font face="monospace, monospace">HarfBuzzFTFont->y_scale = FT_MulFix(HarfBuzzFTFont->y_scale, FixedFontScale);</font></div></div><div><br></div><div>-Jamie.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 8 May 2017 at 21:31, Jamie Dale <span dir="ltr"><<a href="mailto:jamiedale88+harfbuzz@gmail.com" target="_blank">jamiedale88+harfbuzz@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">The scale applied to the <font face="monospace, monospace">hb_font</font> seems to affect how badly this breaks (it's currently less bad, but still broken).<div><br></div><div>It is possible that I was just never setting the <font face="monospace, monospace">hb_font</font> scale correctly as I was handling scaling internally from my user-data and ignoring the font setting.<span class="HOEnZb"><font color="#888888"><div><br></div><div>-Jamie.</div></font></span></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On 8 May 2017 at 21:15, Jamie Dale <span dir="ltr"><<a href="mailto:jamiedale88+harfbuzz@gmail.com" target="_blank">jamiedale88+harfbuzz@gmail.<wbr>com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Something is definitely causing it to change when the font is scaled though:<div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"> Scale | x_offset</font></div><div><font face="monospace, monospace">~0.666 |  2141</font></div><div><font face="monospace, monospace">~0.832 |  340</font></div><div><font face="monospace, monospace">~1.000 | -1461</font></div><div><font face="monospace, monospace">~1.165 | -3262</font></div><div><font face="monospace, monospace">~1.332 | -5063</font></div><span class="m_9180954232222335794HOEnZb"><font color="#888888"><div><br></div><div>-Jamie.</div></font></span></div><div class="m_9180954232222335794HOEnZb"><div class="m_9180954232222335794h5"><div class="gmail_extra"><br><div class="gmail_quote">On 8 May 2017 at 20:45, Jamie Dale <span dir="ltr"><<a href="mailto:jamiedale88+harfbuzz@gmail.com" target="_blank">jamiedale88+harfbuzz@gmail.co<wbr>m</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hey all,<div><br></div><div>I'm running HarfBuzz 1.2.4 with a modified <font face="monospace, monospace">hb_font</font> implementation based on the FreeType implementation in the vanilla version.</div><div><br></div><div>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 <font face="monospace, monospace">FT_Set_Transform</font>).</div><div><br></div><div>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 <font face="monospace, monospace">hb_glyph_position_t::x_off<wbr>set</font> was coming back wrong once the text was scaled (weirdly this same issue doesn't seem to affect <font face="monospace, monospace">hb_glyph_position_t::y_<wbr>offset</font>).</div><div><br></div><div>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).</div><div><br></div><div>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.</div><div><br></div><div>I do notice that there's no FreeType override for the <font face="monospace, monospace">set_glyph_h_origin_func</font> from <font face="monospace, monospace">hb_font</font>. Could that be the issue?</div><div><br></div><div>The Thai text being used is ฝึ (U+0E1D, U+0E36) and the font is Tahoma (available in Windows).</div><div><br></div><div>Has anyone else attempted something like this?</div><div><br></div><div>Thanks,</div><div>Jamie.</div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>