summaryrefslogtreecommitdiff
path: root/pango/shape.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-12-18 01:07:42 +0000
committerMatthias Clasen <mclasen@redhat.com>2021-12-18 01:07:42 +0000
commit4eb4b83af55ed3a2b4f957d776885b5f543a435e (patch)
treee184e40e75c7623e01016ece6c5736c6edb47d7f /pango/shape.c
parent6390bd6230b030218d3ea70ef39ea8f2938840fa (diff)
parente4323aed09eb62b5be6a80167592cbe34da4b52f (diff)
downloadpango-4eb4b83af55ed3a2b4f957d776885b5f543a435e.tar.gz
Merge branch 'more-space-tweaks' into 'main'
shape: More tweaks to space handling See merge request GNOME/pango!557
Diffstat (limited to 'pango/shape.c')
-rw-r--r--pango/shape.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/pango/shape.c b/pango/shape.c
index 90334cc1..30bceb80 100644
--- a/pango/shape.c
+++ b/pango/shape.c
@@ -137,12 +137,24 @@ 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.
+ /* HarfBuzz knows how to synthesize other spaces from 0x20, so never
+ * replace them with unknown glyphs, just tell HarfBuzz that we don't
+ * have a glyph.
+ *
+ * For 0x20, on the other hand, we need to pretend that we have a glyph
+ * and rely on our glyph extents code to provide a reasonable width for
+ * PANGO_GET_UNKNOWN_WIDTH (0x20).
*/
if (g_unichar_type (unicode) == G_UNICODE_SPACE_SEPARATOR)
- return FALSE;
+ {
+ if (unicode == 0x20)
+ {
+ *glyph = PANGO_GET_UNKNOWN_GLYPH (0x20);
+ return TRUE;
+ }
+
+ return FALSE;
+ }
*glyph = PANGO_GET_UNKNOWN_GLYPH (unicode);