From e6c5a616aaf081d0603a6f6e74be66d89c2b1832 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 17 Dec 2022 02:13:38 -0500 Subject: [PATCH] SVG Implement paint-glyph --- src/hb-ot-color-svg-table.hh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/hb-ot-color-svg-table.hh b/src/hb-ot-color-svg-table.hh index fc649f100..427af9945 100644 --- a/src/hb-ot-color-svg-table.hh +++ b/src/hb-ot-color-svg-table.hh @@ -26,6 +26,8 @@ #define HB_OT_COLOR_SVG_TABLE_HH #include "hb-open-type.hh" +#include "hb-blob.hh" +#include "hb-paint.hh" /* * SVG -- SVG (Scalable Vector Graphics) @@ -91,8 +93,26 @@ struct SVG bool has_data () const { return table->has_data (); } + bool paint_glyph (hb_font_t *font HB_UNUSED, hb_codepoint_t glyph, hb_paint_funcs_t *funcs, void *data) const + { + if (!has_data ()) + return false; + + hb_blob_t *blob = reference_blob_for_glyph (glyph); + + if (blob == hb_blob_get_empty ()) + return false; + + funcs->image (data, glyph); + + hb_blob_destroy (blob); + return true; + } + private: hb_blob_ptr_t table; + public: + DEFINE_SIZE_STATIC (sizeof (hb_blob_ptr_t)); }; const SVGDocumentIndexEntry &get_glyph_entry (hb_codepoint_t glyph_id) const