summaryrefslogtreecommitdiff
path: root/pango
diff options
context:
space:
mode:
authormsizanoen1 <msizanoen@qtmlabs.xyz>2023-02-13 17:46:02 +0700
committermsizanoen1 <msizanoen@qtmlabs.xyz>2023-02-18 21:06:28 +0700
commitd915ff0eaf43e301c35592376a14778445faa183 (patch)
treeb8b718258421b600bf833469c6354c17d65ef76c /pango
parentc3b796b5b1f46cec16550f1cd0afbc2db10e9415 (diff)
downloadpango-d915ff0eaf43e301c35592376a14778445faa183.tar.gz
shape: Properly detect COLRv1 color fonts
HarfBuzz 7.0.0 introduced 2 new APIs: `hb_ot_color_has_paint` and `hb_ot_color_glyph_has_paint`. Use these APIs to detect the new COLRv1 color font format to ensure compatibility of code relying on the color font detection for rendering with the new font format.
Diffstat (limited to 'pango')
-rw-r--r--pango/shape.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/pango/shape.c b/pango/shape.c
index e666bb3d..acf4be59 100644
--- a/pango/shape.c
+++ b/pango/shape.c
@@ -306,6 +306,11 @@ font_has_color (hb_font_t *font)
face = hb_font_get_face (font);
+#if HB_VERSION_ATLEAST (7, 0, 0)
+ if (hb_ot_color_has_paint (face))
+ return TRUE;
+#endif
+
return hb_ot_color_has_layers (face) ||
hb_ot_color_has_png (face) ||
hb_ot_color_has_svg (face);
@@ -320,6 +325,11 @@ glyph_has_color (hb_font_t *font,
face = hb_font_get_face (font);
+#if HB_VERSION_ATLEAST (7, 0, 0)
+ if (hb_ot_color_glyph_has_paint (face, glyph))
+ return TRUE;
+#endif
+
if (hb_ot_color_glyph_get_layers (face, glyph, 0, NULL, NULL) > 0)
return TRUE;