From 81bf08927361ae57563b02774523f7ce83903ea1 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 18 Dec 2022 13:15:49 -0700 Subject: [PATCH] [hb-view] Use color render callback if HB_DRAW >= 2 --- util/helper-cairo-user.hh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/util/helper-cairo-user.hh b/util/helper-cairo-user.hh index a48a472ef..e223e5ef0 100644 --- a/util/helper-cairo-user.hh +++ b/util/helper-cairo-user.hh @@ -314,12 +314,24 @@ get_cairo_paint_funcs (void) #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 render_glyph (cairo_scaled_font_t *scaled_font, unsigned long glyph, cairo_t *cr, 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_cairo_user_data_key));