summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2007-08-07 18:40:05 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2007-08-07 18:40:05 +0000
commit6b4992d80ff3277b2f39948948eb2c31229e1706 (patch)
treed27ed2b1aecac19b4e7b7cdf963d4cfca2dc859d
parentba509b999343fa28c01806f76c92eae61aff58fd (diff)
downloadpango-6b4992d80ff3277b2f39948948eb2c31229e1706.tar.gz
Bug 464183 – Minimum tab width enforcement in pango-layout breaks
2007-08-07 Behdad Esfahbod <behdad@gnome.org> Bug 464183 – Minimum tab width enforcement in pango-layout breaks TabArray positions Patch by David Trowbridge * pango/pango-layout.c (get_tab_pos), (shape_tab): Don't enforce any minimum space between tabs if tab-array is set on the layout. svn path=/trunk/; revision=2390
-rw-r--r--ChangeLog9
-rw-r--r--pango/pango-layout.c19
2 files changed, 25 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 2ce78874..a0fd5743 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2007-08-07 Behdad Esfahbod <behdad@gnome.org>
+
+ Bug 464183 – Minimum tab width enforcement in pango-layout breaks
+ TabArray positions
+ Patch by David Trowbridge
+
+ * pango/pango-layout.c (get_tab_pos), (shape_tab): Don't enforce any
+ minimum space between tabs if tab-array is set on the layout.
+
2007-08-01 Behdad Esfahbod <behdad@gnome.org>
* pango/Makefile.am:
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index 5ed398a6..843e4fde 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -2818,11 +2818,14 @@ ensure_tab_width (PangoLayout *layout)
* all tabs are left-aligned.
*/
static int
-get_tab_pos (PangoLayout *layout, int index)
+get_tab_pos (PangoLayout *layout, int index, gboolean *is_default)
{
gint n_tabs;
gboolean in_pixels;
+ if (is_default)
+ *is_default = FALSE;
+
if (layout->tabs)
{
n_tabs = pango_tab_array_get_size (layout->tabs);
@@ -2883,6 +2886,9 @@ get_tab_pos (PangoLayout *layout, int index)
{
/* No tab array set, so use default tab width
*/
+ if (is_default)
+ *is_default = FALSE;
+
return layout->tab_width * index;
}
}
@@ -2930,8 +2936,15 @@ shape_tab (PangoLayoutLine *line,
for (i=0;;i++)
{
- int tab_pos = get_tab_pos (line->layout, i);
- if (tab_pos >= current_width + space_width)
+ gboolean is_default;
+ int tab_pos = get_tab_pos (line->layout, i, &is_default);
+ /* Make sure there is at least a space-width of space between
+ * tab-aligned text and the text before it. However, only do
+ * this if no tab array is set on the layout, ie. using default
+ * tab positions. If use has set tab positions, respect it to
+ * the pixel.
+ */
+ if (tab_pos >= current_width + (is_default ? space_width : 0))
{
glyphs->glyphs[0].geometry.width = tab_pos - current_width;
break;