cff1: Implement paint_glyph

This commit is contained in:
Matthias Clasen 2022-12-16 23:46:05 -05:00 committed by Behdad Esfahbod
parent 2edd771cf5
commit df89b52130
2 changed files with 23 additions and 0 deletions

View File

@ -553,6 +553,27 @@ bool _get_path (const OT::cff1::accelerator_t *cff, hb_font_t *font, hb_codepoin
return true;
}
bool OT::cff1::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;
}
bool OT::cff1::accelerator_t::get_path (hb_font_t *font, hb_codepoint_t glyph, hb_draw_session_t &draw_session) const
{
#ifdef HB_NO_OT_FONT_CFF

View File

@ -30,6 +30,7 @@
#include "hb-ot-cff-common.hh"
#include "hb-subset-cff1.hh"
#include "hb-draw.hh"
#include "hb-paint.hh"
#define HB_STRING_ARRAY_NAME cff1_std_strings
#define HB_STRING_ARRAY_LIST "hb-ot-cff1-std-str.hh"
@ -1426,6 +1427,7 @@ struct cff1
}
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_seac_components (hb_codepoint_t glyph, hb_codepoint_t *base, hb_codepoint_t *accent) const;
HB_INTERNAL bool get_path (hb_font_t *font, hb_codepoint_t glyph, hb_draw_session_t &draw_session) const;