From 23c60fd9b293f09461926f47cdd0779af766aff8 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 17 Dec 2022 01:04:23 -0500 Subject: [PATCH] sbix: Implement paint_glyph --- src/hb-ot-color-sbix-table.hh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/hb-ot-color-sbix-table.hh b/src/hb-ot-color-sbix-table.hh index 1d1d2e89d..d874e790b 100644 --- a/src/hb-ot-color-sbix-table.hh +++ b/src/hb-ot-color-sbix-table.hh @@ -30,6 +30,7 @@ #include "hb-open-type.hh" #include "hb-ot-layout-common.hh" +#include "hb-paint.hh" /* * sbix -- Standard Bitmap Graphics @@ -231,6 +232,24 @@ struct sbix num_glyphs, available_ppem); } + bool paint_glyph (hb_font_t *font, hb_codepoint_t glyph, hb_paint_funcs_t *funcs, void *data) const + { + if (!has_data ()) + return false; + + int x_offset = 0, y_offset = 0; + unsigned int strike_ppem = 0; + hb_blob_t *blob = reference_png (font, glyph, &x_offset, &y_offset, &strike_ppem); + + if (blob == hb_blob_get_empty ()) + return false; + + funcs->image (data, glyph); + + hb_blob_destroy (blob); + return true; + } + private: const SBIXStrike &choose_strike (hb_font_t *font) const