[pango/visible-things: 24/35] wip: cairo: render visible space differently



commit 828741d57b2879044d826ea65a124feffe980afa
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Jul 7 15:45:14 2019 -0400

    wip: cairo: render visible space differently
    
    Instead of a [SPC] hex box, just render a
    centered dot, as is commonly used to indicate
    space.

 pango/pangocairo-font.c   |  6 +++---
 pango/pangocairo-render.c | 11 +++++++++++
 2 files changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/pango/pangocairo-font.c b/pango/pangocairo-font.c
index 3bf83857..a49d14d4 100644
--- a/pango/pangocairo-font.c
+++ b/pango/pangocairo-font.c
@@ -720,7 +720,9 @@ _pango_cairo_font_private_get_glyph_extents_missing (PangoCairoFontPrivate *cf_p
   gunichar ch;
   gint rows, cols;
 
-  if (glyph == (0x20 | PANGO_GLYPH_UNKNOWN_FLAG))
+  ch = glyph & ~PANGO_GLYPH_UNKNOWN_FLAG;
+
+  if (ch == 0x20 || ch == 0x2423)
     {
       get_space_extents (cf_priv, ink_rect, logical_rect);
       return;
@@ -733,8 +735,6 @@ _pango_cairo_font_private_get_glyph_extents_missing (PangoCairoFontPrivate *cf_p
       return;
     }
 
-  ch = glyph & ~PANGO_GLYPH_UNKNOWN_FLAG;
-
   if (G_UNLIKELY (glyph == PANGO_GLYPH_INVALID_INPUT || ch > 0x10FFFF))
     {
       rows = hbi->rows;
diff --git a/pango/pangocairo-render.c b/pango/pangocairo-render.c
index 99250591..e87ad4f4 100644
--- a/pango/pangocairo-render.c
+++ b/pango/pangocairo-render.c
@@ -394,6 +394,17 @@ _pango_cairo_renderer_draw_unknown_glyph (PangoCairoRenderer *crenderer,
       rows = hbi->rows;
       cols = 1;
     }
+  else if (ch == 0x2423)
+    {
+      double x = cx + 0.5 *((double)gi->geometry.width / PANGO_SCALE);
+      double y = cy + hbi->box_descent - 0.5 * hbi->box_height;
+
+      cairo_new_sub_path (crenderer->cr);
+      cairo_arc (crenderer->cr, x, y, hbi->line_width, 0, 2 * G_PI);
+      cairo_close_path (crenderer->cr);
+      cairo_fill (crenderer->cr);
+      goto done;
+    }
   else if ((name = pango_get_ignorable_size (ch, &rows, &cols)))
     {
       /* nothing else to do */


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