[HarfBuzz] harfbuzz-ng bug in gpos coordinate calc

Jonathan Kew jonathan at jfkew.plus.com
Tue May 18 05:17:00 PDT 2010


Hi Behdad,

I think we've uncovered a bug in the processing of coordinate values in GPOS. In a number of places, there's code such as

    if (format & xPlacement) glyph_pos->x_offset  += _hb_16dot16_mul_round (x_scale, get_short (values++));

which is supposed to read a value (in font units) from the table and convert it to 16.16 pixel coordinates. (Note that x_scale here is am hb_16dot16_t value.) However, the _hb_16dot16_mul_round macro is wrong for this operation; it is designed to multiply together *two* 16.16 values and give a 16.16 result.

The attached patch should fix this by replacing _hb_16dot16_mul_round with _hb_16dot16_mul_short, which is actually just a multiply operation; the macro could be dropped altogether, but if you want to keep it for documentation purposes, that should be fine too.

JK

-------------- next part --------------
A non-text attachment was scrubbed...
Name: gpos-coords-patch.diff
Type: application/octet-stream
Size: 5932 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/harfbuzz/attachments/20100518/e74d1fab/attachment.obj>
-------------- next part --------------




More information about the HarfBuzz mailing list