Fix sbix glyph extents
* The ‘height’ needs to be negated since the API returns “distance from top to bottom side”. * Similarly, the ‘y_offset‘ needs to be added to the height to get the ‘y_bearing’, since sbix’s offset is “the point in the glyph relative to its lower-left corner which corresponds to the origin” while ‘y_bearing’ is the “top side of glyph from origin”. With these changes the sbix glyph metrics return values similar to other tables, as they were otherwise unusable.
This commit is contained in:
parent
759f3bd486
commit
c9796d15e1
|
@ -235,9 +235,9 @@ struct sbix
|
|||
const PNGHeader &png = *blob->as<PNGHeader>();
|
||||
|
||||
extents->x_bearing = x_offset;
|
||||
extents->y_bearing = y_offset;
|
||||
extents->y_bearing = png.IHDR.height + y_offset;
|
||||
extents->width = png.IHDR.width;
|
||||
extents->height = png.IHDR.height;
|
||||
extents->height = -png.IHDR.height;
|
||||
|
||||
/* Convert to font units. */
|
||||
if (strike_ppem)
|
||||
|
|
|
@ -426,9 +426,9 @@ test_hb_ot_color_png (void)
|
|||
g_assert (strncmp (data + 1, "PNG", 3) == 0);
|
||||
hb_font_get_glyph_extents (sbix_font, 1, &extents);
|
||||
g_assert_cmpint (extents.x_bearing, ==, 0);
|
||||
g_assert_cmpint (extents.y_bearing, ==, 0);
|
||||
g_assert_cmpint (extents.y_bearing, ==, 800);
|
||||
g_assert_cmpint (extents.width, ==, 800);
|
||||
g_assert_cmpint (extents.height, ==, 800);
|
||||
g_assert_cmpint (extents.height, ==, -800);
|
||||
hb_blob_destroy (blob);
|
||||
hb_font_destroy (sbix_font);
|
||||
|
||||
|
|
Binary file not shown.
|
@ -1 +1,2 @@
|
|||
../fonts/ee39587d13b2afa5499cc79e45780aa79293bbd4.ttf:--font-funcs=ot --show-extents:U+1F42F:[gid1=0+2963<0,2179,2963,-2789>]
|
||||
../fonts/fcbaa518d3cce441ed37ae3b1fed6a19e9b54efd.ttf:--font-funcs=ot --show-extents:U+1F600:[gid4=0+2550<0,1898,2555,-2405>]
|
||||
|
|
Loading…
Reference in New Issue