diff --git a/src/OT/glyf/glyf.hh b/src/OT/glyf/glyf.hh index e0c92f0c9..9c343ea6b 100644 --- a/src/OT/glyf/glyf.hh +++ b/src/OT/glyf/glyf.hh @@ -13,6 +13,7 @@ #include "SubsetGlyph.hh" #include "loca.hh" #include "path-builder.hh" +#include "hb-paint.hh" namespace OT { @@ -332,6 +333,27 @@ struct glyf_accelerator_t return glyph_for_gid (gid).get_extents_without_var_scaled (font, *this, extents); } + bool paint_glyph (hb_font_t *font, hb_codepoint_t gid, hb_paint_funcs_t *funcs, void *data) const + { + int xscale, yscale; + unsigned int upem; + + hb_font_get_scale (font, &xscale, &yscale); + upem = hb_face_get_upem (hb_font_get_face (font)); + + funcs->push_transform (data, xscale/(float)upem, 0, + 0, yscale/(float)upem, + 0, 0); + + funcs->push_clip_glyph (data, gid); + funcs->color (data, 0xffff, 1.); + funcs->pop_clip (data); + + funcs->pop_transform (data); + + return false; + } + const glyf_impl::Glyph glyph_for_gid (hb_codepoint_t gid, bool needs_padding_removal = false) const {