[pango/ligature-caret-rtl-fixes: 5/6] pango-viewer: Number carets




commit b6c22482edca791ca6916b5f49f5f658f818ce8b
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Aug 27 10:33:24 2021 -0400

    pango-viewer: Number carets
    
    When showing caret positions, put a little number
    next to them to indicate the order.

 utils/viewer-pangocairo.c | 7 +++++++
 1 file changed, 7 insertions(+)
---
diff --git a/utils/viewer-pangocairo.c b/utils/viewer-pangocairo.c
index fa53d9fb..4b27c7e5 100644
--- a/utils/viewer-pangocairo.c
+++ b/utils/viewer-pangocairo.c
@@ -456,9 +456,16 @@ render_callback (PangoLayout *layout,
                                                      &x);
                       x += rect.x;
 
+                      cairo_set_source_rgba (cr, 1.0, 0.0, 1.0, 0.5);
                       cairo_arc (cr, x / PANGO_SCALE, y / PANGO_SCALE, 3.0, 0, 2*G_PI);
                       cairo_close_path (cr);
                       cairo_fill (cr);
+
+                      char *s = g_strdup_printf ("%d", i + trailing);
+                      cairo_set_source_rgb (cr, 0, 0, 0);
+                      cairo_move_to (cr, x / PANGO_SCALE - 5, y / PANGO_SCALE + 15);
+                      cairo_show_text (cr, s);
+                      g_free (s);
                    }
 
                   if (i < run->item->num_chars)


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