summaryrefslogtreecommitdiff
path: root/pango/shape.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-12-16 08:40:07 -0500
committerMatthias Clasen <mclasen@redhat.com>2021-12-16 15:53:28 -0500
commitb420d022a2979c2e86b465bca0c7d603dd136108 (patch)
tree670624574a5423e2d3076b3695179096e173fcde /pango/shape.c
parenta11ce3c81b66e87d535b99728fa5ee22afa42b11 (diff)
downloadpango-fix-spaceless-fonts.tar.gz
Fix handling of space-less fontsfix-spaceless-fonts
HarfBuzz knows how to synthesize spaces, we just need to tickle it in the right way. Test included. Update affected tests. Fixes: #641
Diffstat (limited to 'pango/shape.c')
-rw-r--r--pango/shape.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/pango/shape.c b/pango/shape.c
index 45c979f2..d0140d5e 100644
--- a/pango/shape.c
+++ b/pango/shape.c
@@ -137,10 +137,18 @@ pango_hb_font_get_nominal_glyph (hb_font_t *font,
if (hb_font_get_nominal_glyph (context->parent, unicode, glyph))
return TRUE;
+ /* HarfBuzz knows how to synthesize spaces, so never replace them
+ * with unknown glyphs, but we do need to tell HarfBuzz that the
+ * font does not have a glyph.
+ */
+ if (g_unichar_type (unicode) == G_UNICODE_SPACE_SEPARATOR)
+ return FALSE;
+
*glyph = PANGO_GET_UNKNOWN_GLYPH (unicode);
/* We draw our own invalid-Unicode shape, so prevent HarfBuzz
- * from using REPLACEMENT CHARACTER. */
+ * from using REPLACEMENT CHARACTER.
+ */
if (unicode > 0x10FFFF)
return TRUE;