summaryrefslogtreecommitdiff
path: root/pango
diff options
context:
space:
mode:
authorJan Alexander Steffens (heftig) <jan.steffens@gmail.com>2020-02-11 03:51:19 +0100
committerJan Alexander Steffens (heftig) <jan.steffens@gmail.com>2020-02-11 04:35:36 +0100
commitc579c0a9c8ec198e5e85881c57393c67f0e85757 (patch)
tree812488a722e5403027a657c279bad3f34d14e3fb /pango
parent077f96dd8984fc4e3530309177e174cb7f725250 (diff)
downloadpango-c579c0a9c8ec198e5e85881c57393c67f0e85757.tar.gz
Use shape flags for tab width
We need to apply the right shape flags to the tab width calculation, otherwise (when glyph positions get rounded, which is the default) our tab width will be slightly off from what 8 spaces normally produce. https://gitlab.gnome.org/GNOME/pango/issues/425
Diffstat (limited to 'pango')
-rw-r--r--pango/pango-layout.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index 44d59367..643f5623 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -3061,6 +3061,10 @@ ensure_tab_width (PangoLayout *layout)
PangoAttrIterator *iter;
PangoFontDescription *font_desc = pango_font_description_copy_static (pango_context_get_font_description (layout->context));
PangoLanguage *language;
+ PangoShapeFlags shape_flags = PANGO_SHAPE_NONE;
+
+ if (pango_context_get_round_glyph_positions (layout->context))
+ shape_flags |= PANGO_SHAPE_ROUND_POSITIONS;
layout_attrs = pango_layout_get_effective_attributes (layout);
iter = pango_attr_list_get_iterator (layout_attrs);
@@ -3089,7 +3093,7 @@ ensure_tab_width (PangoLayout *layout)
pango_attr_list_unref (tmp_attrs);
item = items->data;
- pango_shape (" ", 8, &item->analysis, glyphs);
+ pango_shape_with_flags (" ", 8, " ", 8, &item->analysis, glyphs, shape_flags);
pango_item_free (item);
g_list_free (items);