From d1c00c047030226b6b5255cc4b7cdeb738ee0ccc Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 24 Apr 2023 13:24:47 -0600 Subject: [PATCH] [COLR] Respect HB_NO_PAINT Fixes https://github.com/harfbuzz/harfbuzz/issues/4204 --- src/OT/Color/COLR/COLR.hh | 4 ++++ src/hb-ot-font.cc | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/OT/Color/COLR/COLR.hh b/src/OT/Color/COLR/COLR.hh index 9f30b66e7..191812f48 100644 --- a/src/OT/Color/COLR/COLR.hh +++ b/src/OT/Color/COLR/COLR.hh @@ -2213,6 +2213,7 @@ struct COLR return nullptr; } +#ifndef HB_NO_PAINT bool get_extents (hb_font_t *font, hb_codepoint_t glyph, hb_glyph_extents_t *extents) const { @@ -2251,6 +2252,7 @@ struct COLR return ret; } +#endif bool has_paint_for_glyph (hb_codepoint_t glyph) const @@ -2274,6 +2276,7 @@ struct COLR instancer); } +#ifndef HB_NO_PAINT bool paint_glyph (hb_font_t *font, hb_codepoint_t glyph, hb_paint_funcs_t *funcs, void *data, unsigned int palette_index, hb_color_t foreground, bool clip = true) const { @@ -2360,6 +2363,7 @@ struct COLR return false; } +#endif protected: HBUINT16 version; /* Table version number (starts at 0). */ diff --git a/src/hb-ot-font.cc b/src/hb-ot-font.cc index 8fda0b4ac..06f7092a5 100644 --- a/src/hb-ot-font.cc +++ b/src/hb-ot-font.cc @@ -413,7 +413,7 @@ hb_ot_get_glyph_extents (hb_font_t *font, if (ot_face->sbix->get_extents (font, glyph, extents)) return true; if (ot_face->CBDT->get_extents (font, glyph, extents)) return true; #endif -#if !defined(HB_NO_COLOR) +#if !defined(HB_NO_COLOR) && !defined(HB_NO_PAINT) if (ot_face->COLR->get_extents (font, glyph, extents)) return true; #endif if (ot_face->glyf->get_extents (font, glyph, extents)) return true;