[HarfBuzz] Kerning problem solution in JS

Lóránt Pintér lorant.pinter at prezi.com
Wed Oct 17 22:55:40 PDT 2012


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.

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?

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/harfbuzz/attachments/20121018/aa8f843a/attachment.html>


More information about the HarfBuzz mailing list