diff --git a/src/hb-ot-cff2-table.cc b/src/hb-ot-cff2-table.cc index d530fc2ee..a6bdfac8a 100644 --- a/src/hb-ot-cff2-table.cc +++ b/src/hb-ot-cff2-table.cc @@ -143,6 +143,27 @@ bool OT::cff2::accelerator_t::get_extents (hb_font_t *font, return true; } +bool OT::cff2::accelerator_t::paint_glyph (hb_font_t *font, hb_codepoint_t glyph, 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, glyph); + funcs->color (data, 0xffff, 1.); + funcs->pop_clip (data); + + funcs->pop_transform (data); + + return false; +} + struct cff2_path_param_t { cff2_path_param_t (hb_font_t *font_, hb_draw_session_t &draw_session_) diff --git a/src/hb-ot-cff2-table.hh b/src/hb-ot-cff2-table.hh index 9081930bb..ddfe2d7c9 100644 --- a/src/hb-ot-cff2-table.hh +++ b/src/hb-ot-cff2-table.hh @@ -30,6 +30,7 @@ #include "hb-ot-cff-common.hh" #include "hb-subset-cff2.hh" #include "hb-draw.hh" +#include "hb-paint.hh" namespace CFF { @@ -516,6 +517,7 @@ struct cff2 HB_INTERNAL bool get_extents (hb_font_t *font, hb_codepoint_t glyph, hb_glyph_extents_t *extents) const; + HB_INTERNAL bool paint_glyph (hb_font_t *font, hb_codepoint_t glyph, hb_paint_funcs_t *funcs, void *data) const; HB_INTERNAL bool get_path (hb_font_t *font, hb_codepoint_t glyph, hb_draw_session_t &draw_session) const; };