[util] Fix argument order and root transform PNGs

This commit is contained in:
Behdad Esfahbod 2022-12-18 12:51:26 -07:00
parent 529dc40d7d
commit 7accbe97d8
3 changed files with 13 additions and 8 deletions

View File

@ -944,11 +944,15 @@ struct CBDT
if (unlikely (blob == hb_blob_get_empty ()))
return false;
if (unlikely (!get_extents (font, glyph, &extents)))
if (unlikely (!hb_font_get_glyph_extents (font, glyph, &extents)))
return false;
funcs->push_root_transform (data, font);
funcs->image (data, blob, HB_PAINT_IMAGE_FORMAT_PNG, &extents);
funcs->pop_root_transform (data);
hb_blob_destroy (blob);
return true;
}

View File

@ -245,11 +245,15 @@ struct sbix
if (blob == hb_blob_get_empty ())
return false;
if (!get_extents (font, glyph, &extents))
if (!hb_font_get_glyph_extents (font, glyph, &extents))
return false;
funcs->push_root_transform (data, font);
funcs->image (data, blob, HB_PAINT_IMAGE_FORMAT_PNG, &extents);
funcs->pop_root_transform (data);
hb_blob_destroy (blob);
return true;
}

View File

@ -123,9 +123,10 @@ read_blob (void *closure,
return CAIRO_STATUS_SUCCESS;
}
#include <stdio.h>
void
hb_cairo_paint_glyph_image (hb_font_t *font,
cairo_t *cr,
hb_cairo_paint_glyph_image (cairo_t *cr,
hb_font_t *font,
hb_blob_t *blob,
hb_tag_t format,
hb_glyph_extents_t *extents)
@ -146,10 +147,6 @@ hb_cairo_paint_glyph_image (hb_font_t *font,
cairo_matrix_t matrix = {(double) width, 0, 0, (double) height, 0, 0};
cairo_pattern_set_matrix (pattern, &matrix);
hb_position_t x_scale, y_scale;
hb_font_get_scale (font, &x_scale, &y_scale);
cairo_scale (cr, +1./x_scale, -1./y_scale);
cairo_translate (cr, extents->x_bearing, extents->y_bearing);
cairo_scale (cr, extents->width, extents->height);
cairo_set_source (cr, pattern);