[hb-view] Use color render callback if HB_DRAW >= 2

This commit is contained in:
Behdad Esfahbod 2022-12-18 13:15:49 -07:00
parent c65f580b93
commit 81bf089273
1 changed files with 12 additions and 0 deletions

View File

@ -314,12 +314,24 @@ get_cairo_paint_funcs (void)
#endif #endif
static cairo_status_t
render_color_glyph (cairo_scaled_font_t *scaled_font,
unsigned long glyph,
cairo_t *cr,
cairo_text_extents_t *extents);
static cairo_status_t static cairo_status_t
render_glyph (cairo_scaled_font_t *scaled_font, render_glyph (cairo_scaled_font_t *scaled_font,
unsigned long glyph, unsigned long glyph,
cairo_t *cr, cairo_t *cr,
cairo_text_extents_t *extents) cairo_text_extents_t *extents)
{ {
#ifdef HAVE_CAIRO_USER_FONT_FACE_SET_RENDER_COLOR_GLYPH_FUNC
static char *p = getenv ("HB_DRAW");
if (p && atoi (p) >= 2)
return render_color_glyph (scaled_font, glyph, cr, extents);
#endif
hb_font_t *font = (hb_font_t *) (cairo_font_face_get_user_data (cairo_scaled_font_get_font_face (scaled_font), hb_font_t *font = (hb_font_t *) (cairo_font_face_get_user_data (cairo_scaled_font_get_font_face (scaled_font),
&_hb_font_cairo_user_data_key)); &_hb_font_cairo_user_data_key));