[pango/visible-things] cairo: Render tabs
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/visible-things] cairo: Render tabs
- Date: Sun, 7 Jul 2019 21:08:48 +0000 (UTC)
commit 653f1018b866d44d976683fb2631b68352aeb703
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Jul 7 16:45:23 2019 -0400
cairo: Render tabs
When we meet an unknown glyph for 0x09, render
an arrow to indicate a tab.
pango/pangocairo-render.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
---
diff --git a/pango/pangocairo-render.c b/pango/pangocairo-render.c
index e87ad4f4..c18556c8 100644
--- a/pango/pangocairo-render.c
+++ b/pango/pangocairo-render.c
@@ -405,6 +405,31 @@ _pango_cairo_renderer_draw_unknown_glyph (PangoCairoRenderer *crenderer,
cairo_fill (crenderer->cr);
goto done;
}
+ else if (ch == '\t')
+ {
+ double y = cy + hbi->box_descent - 0.5 * hbi->box_height;
+ double width = (double)gi->geometry.width / PANGO_SCALE;
+ double arrow_offset = 0.2 * width;
+ double x = cx + arrow_offset;
+ double arrow_length = width - 2 * arrow_offset;
+ double tip_length = MIN (hbi->digit_width, 0.75 * arrow_length);
+ double tip_width = 3 * hbi->line_width;
+
+ cairo_move_to (crenderer->cr, x - 0.5 * hbi->line_width, y - 0.5 * tip_width);
+ cairo_line_to (crenderer->cr, x + 0.5 * hbi->line_width, y - 0.5 * tip_width);
+ cairo_line_to (crenderer->cr, x + 0.5 * hbi->line_width, y - 0.5 * hbi->line_width);
+ cairo_line_to (crenderer->cr, x + arrow_length - tip_length, y - 0.5 * hbi->line_width);
+ cairo_line_to (crenderer->cr, x + arrow_length - tip_length, y - 0.5 * tip_width);
+ cairo_line_to (crenderer->cr, x + arrow_length, y);
+ cairo_line_to (crenderer->cr, x + arrow_length - tip_length, y + 0.5 * tip_width);
+ cairo_line_to (crenderer->cr, x + arrow_length - tip_length, y + 0.5 * hbi->line_width);
+ cairo_line_to (crenderer->cr, x + 0.5 * hbi->line_width, y + 0.5 * hbi->line_width);
+ cairo_line_to (crenderer->cr, x + 0.5 * hbi->line_width, y + 0.5 * tip_width);
+ cairo_line_to (crenderer->cr, x - 0.5 * hbi->line_width, y + 0.5 * tip_width);
+ 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]