[HarfBuzz] Kerning problem solution in JS

Behdad Esfahbod behdad at behdad.org
Mon Oct 22 17:08:04 PDT 2012


On 12-10-17 10:55 PM, Lóránt Pintér wrote:
> Hi,
> 
> I just found the source of my problem with kerning. It indeed happens only in
> JavaScript.
> 
> A few functions use int64_t casts when scaling coordinates from font-space to
> user-space. This wreaks havoc on Emscripten, because JavaScript doesn't have
> an integer type big enough to hold a 64-bit integer.

Right...  Have you reported this to emscripten already?  Feel free to mention
me on the bug (@behdad).


> Would it be sufficient to use int32_t in these cases instead? IMO it's not
> likely that (coordinate * scale) is ever going to be larger than 2 billion. Am
> I missing something?

Up to you.  The measure of the scale is up to the application, so we just make
sure any scale works.  It should be easier to fix this in emscripten I think.

behdad

> Here are the problematic lines:
> 
> https://github.com/behdad/harfbuzz/blob/master/src/hb-font-private.hh#L177
> https://github.com/behdad/harfbuzz/blob/master/src/hb-font-private.hh#L182
> https://github.com/behdad/harfbuzz/blob/master/src/hb-font-private.hh#L450
> https://github.com/behdad/harfbuzz/blob/master/src/hb-ot-layout-common-private.hh#L798
> 
> -- 
> Lorant
> 
> 
> 
> _______________________________________________
> HarfBuzz mailing list
> HarfBuzz at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/harfbuzz
> 



More information about the HarfBuzz mailing list