<div dir="ltr"><div dir="ltr">On Tue, May 28, 2019 at 11:44 AM Eli Zaretskii <<a href="mailto:eliz@gnu.org">eliz@gnu.org</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">> From: Behdad Esfahbod <<a href="mailto:behdad@behdad.org" target="_blank">behdad@behdad.org</a>><br>
> Date: Mon, 27 May 2019 21:21:10 -0400<br>
> Cc: "<a href="mailto:harfbuzz@lists.freedesktop.org" target="_blank">harfbuzz@lists.freedesktop.org</a>" <<a href="mailto:harfbuzz@lists.freedesktop.org" target="_blank">harfbuzz@lists.freedesktop.org</a>><br>
> <br>
> control those units (if they are under the client program's control).<br>
> <br>
> They are controlled mainly using hb_font_set_scale().<br>
> <br>
> In particular, I get a huge value of x_advance for the letter U+05EA<br>
> HEBREW LETTER TAV when it is followed by U+05BB HEBREW POINT QUBUTS.<br>
> The value of x_advance I get is 1229, which is too large even after<br>
> dividing by 64 (which, btw, I still am not sure is TRT in my case,<br>
> <br>
> FreeType works in 26.6 fixed-point, ie. 64 units per 1.0. That's where the 64 value comes from. And you<br>
> don't see it in your code because hb_ft_font_create* sets that on hb_font for you.<br>
> <br>
> In your Windows code, you should call hb_font_set_scale(). I believe right now you are *not* calling, and you<br>
> get values in the face's UPEM. That's the default scale for fonts. You can get the face UPEM using<br>
> hb_face_get_upem(). <br>
<br>
OK, I figured out how to scale the units from UPEM to pixels for a<br>
given font size, and now I see reasonable results after such scaling.<br>
<br>
However, I think something is still amiss, because I still don't<br>
understand how to determine the values with which to call<br>
hb_font_set_scale. Say I call it with an integer value N, what will<br>
that produce in terms of values of hb_glyph_position_t? Will the<br>
values there be in the 0..N range, where N means the full height of<br>
the em box? If so, how would I then convert those values to pixels --<br>
this conversion will need the font size as well, right? And if so, I<br>
might well leave the values in UPEM units, and convert them to pixels<br>
by hand. I feel that I'm still missing something, since you said "you<br>
should call hb_font_set_scale". So presumably if I call that<br>
function, conversion to pixels will somehow become easier?<br></blockquote><div><br></div><div>You pick what value you want to represent one pixel as. Say, you choose 1024. Then if you want to render at "16px" font size, you set scale to 16*1024. That's all. </div></div><div><br></div>-- <br><div dir="ltr" class="gmail_signature">behdad<br><a href="http://behdad.org/" target="_blank">http://behdad.org/</a></div></div>