[ot-color] Make PNGHeader reading actually work
This commit is contained in:
parent
632e9af862
commit
307d61867a
|
@ -198,7 +198,7 @@ struct sbix
|
||||||
|
|
||||||
struct PNGHeader
|
struct PNGHeader
|
||||||
{
|
{
|
||||||
HBUINT8 header[9];
|
HBUINT8 header[16];
|
||||||
HBUINT32 width;
|
HBUINT32 width;
|
||||||
HBUINT32 height;
|
HBUINT32 height;
|
||||||
};
|
};
|
||||||
|
@ -209,7 +209,7 @@ struct sbix
|
||||||
hb_glyph_extents_t *extents) const
|
hb_glyph_extents_t *extents) const
|
||||||
{
|
{
|
||||||
if (likely (sbix_len == 0))
|
if (likely (sbix_len == 0))
|
||||||
return hb_blob_get_empty ();
|
return false;
|
||||||
|
|
||||||
int x_offset, y_offset;
|
int x_offset, y_offset;
|
||||||
hb_blob_t *blob = reference_blob_for_glyph (glyph, x_ppem, y_ppem,
|
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->x_bearing = x_offset;
|
||||||
extents->y_bearing = y_offset;
|
extents->y_bearing = y_offset;
|
||||||
const PNGHeader &header = *blob->as<PNGHeader>();
|
const PNGHeader &header = *blob->as<PNGHeader>();
|
||||||
extents->width = header.width + 100;
|
extents->width = header.width;
|
||||||
extents->height = header.height;
|
extents->height = header.height;
|
||||||
hb_blob_destroy (blob);
|
hb_blob_destroy (blob);
|
||||||
|
|
||||||
|
|
|
@ -427,8 +427,8 @@ test_hb_ot_color_png (void)
|
||||||
hb_font_get_glyph_extents (sbix_font, 1, &extents);
|
hb_font_get_glyph_extents (sbix_font, 1, &extents);
|
||||||
g_assert_cmpint (extents.x_bearing, ==, 0);
|
g_assert_cmpint (extents.x_bearing, ==, 0);
|
||||||
g_assert_cmpint (extents.y_bearing, ==, 0);
|
g_assert_cmpint (extents.y_bearing, ==, 0);
|
||||||
g_assert_cmpint (extents.width, ==, 3501);
|
g_assert_cmpint (extents.width, ==, 300);
|
||||||
g_assert_cmpint (extents.height, ==, 20992);
|
g_assert_cmpint (extents.height, ==, 300);
|
||||||
hb_blob_destroy (blob);
|
hb_blob_destroy (blob);
|
||||||
hb_font_destroy (sbix_font);
|
hb_font_destroy (sbix_font);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue