[ot-color] Make PNGHeader reading actually work

This commit is contained in:
Ebrahim Byagowi 2018-10-29 00:03:01 +03:30 committed by Behdad Esfahbod
parent 632e9af862
commit 307d61867a
2 changed files with 5 additions and 5 deletions

View File

@ -198,7 +198,7 @@ struct sbix
struct PNGHeader
{
HBUINT8 header[9];
HBUINT8 header[16];
HBUINT32 width;
HBUINT32 height;
};
@ -209,7 +209,7 @@ struct sbix
hb_glyph_extents_t *extents) const
{
if (likely (sbix_len == 0))
return hb_blob_get_empty ();
return false;
int x_offset, y_offset;
hb_blob_t *blob = reference_blob_for_glyph (glyph, x_ppem, y_ppem,
@ -221,7 +221,7 @@ struct sbix
extents->x_bearing = x_offset;
extents->y_bearing = y_offset;
const PNGHeader &header = *blob->as<PNGHeader>();
extents->width = header.width + 100;
extents->width = header.width;
extents->height = header.height;
hb_blob_destroy (blob);

View File

@ -427,8 +427,8 @@ test_hb_ot_color_png (void)
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.width, ==, 3501);
g_assert_cmpint (extents.height, ==, 20992);
g_assert_cmpint (extents.width, ==, 300);
g_assert_cmpint (extents.height, ==, 300);
hb_blob_destroy (blob);
hb_font_destroy (sbix_font);