[pango/fix-spaceless-fonts] Fix handling of space-less fonts




commit a0b5b6bb1ee81b25f2880b66b1764df466c5f9b1
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Dec 16 08:40:07 2021 -0500

    Fix handling of space-less fonts
    
    HarfBuzz knows how to synthesize spaces, we just
    need to tickle it in the right way.
    
    Fixes: #641

 pango/shape.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
---
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;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]