[pango/visible-things] fc: Make all spaces visible



commit 21b4826b517e2d97595ea1240b46fa0e9fdd64e9
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Jul 8 14:07:27 2019 -0400

    fc: Make all spaces visible
    
    When showing spaces, turn all codepoints in the
    Zs category into unknown glyphs to be rendered.
    This has the side-effect of making all visible
    spaces have the same width, but maybe that is ok.

 pango/pangofc-shape.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/pango/pangofc-shape.c b/pango/pangofc-shape.c
index 73558d16..17c67907 100644
--- a/pango/pangofc-shape.c
+++ b/pango/pangofc-shape.c
@@ -99,9 +99,15 @@ pango_fc_hb_font_get_nominal_glyph (hb_font_t *font, void *font_data,
 
   if (context->shape_flags & PANGO_SHAPE_SHOW_SPACE)
     {
-      if (unicode == 0x20)
+      if (g_unichar_type (unicode) == G_UNICODE_SPACE_SEPARATOR)
         {
-          *glyph = PANGO_GET_UNKNOWN_GLYPH (0x2423);
+          /* Replace 0x20 by visible space, since we
+           * don't draw a hex box for 0x20
+           */
+          if (unicode == 0x20)
+            *glyph = PANGO_GET_UNKNOWN_GLYPH (0x2423);
+          else
+            *glyph = PANGO_GET_UNKNOWN_GLYPH (unicode);
           return TRUE;
         }
     }


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