summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2006-09-13 20:31:02 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2006-09-13 20:31:02 +0000
commitfdd5f89f6623c17468490708d876165953706ab3 (patch)
tree8e86acd9a94c1a704bdd51ce6776cade2261395f
parent746b43849920999848ba907ba14e583b4a16d64d (diff)
downloadpango-fdd5f89f6623c17468490708d876165953706ab3.tar.gz
Part of Bug 355782 – Misaligned extents in pango
2006-09-13 Behdad Esfahbod <behdad@gnome.org> Part of Bug 355782 – Misaligned extents in pango * pango/pango-layout.c (pango_layout_get_extents_internal), (pango_layout_get_extents), (pango_layout_iter_copy), (pango_layout_get_iter), (pango_layout_iter_get_line_extents): Add a new internal member layout_width to PangoLayoutIter. Set it up in pango_layout_get_extents_internal and use in pango_layout_iter_get_line_extents to fix misalignment of ink link extents.
-rw-r--r--ChangeLog12
-rw-r--r--pango/pango-layout.c30
2 files changed, 33 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 022f8180..b391d3d1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
2006-09-13 Behdad Esfahbod <behdad@gnome.org>
+ Part of Bug 355782 – Misaligned extents in pango
+
+ * pango/pango-layout.c (pango_layout_get_extents_internal),
+ (pango_layout_get_extents), (pango_layout_iter_copy),
+ (pango_layout_get_iter), (pango_layout_iter_get_line_extents):
+ Add a new internal member layout_width to PangoLayoutIter. Set it up
+ in pango_layout_get_extents_internal and use in
+ pango_layout_iter_get_line_extents to fix misalignment of ink link
+ extents.
+
+2006-09-13 Behdad Esfahbod <behdad@gnome.org>
+
"Thou shalt not touch code that does not fit in thy brain."
* pango/pango-layout.c (update_cluster): Add cluster_start_index
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index 0375de95..7b17c73d 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -101,6 +101,9 @@ struct _PangoLayoutIter
/* visual position of current character within the cluster */
int character_position;
+
+ /* the real width of layout */
+ int layout_width;
};
typedef struct _PangoLayoutLinePrivate PangoLayoutLinePrivate;
@@ -2059,7 +2062,8 @@ static void
pango_layout_get_extents_internal (PangoLayout *layout,
PangoRectangle *ink_rect,
PangoRectangle *logical_rect,
- GSList **line_extents)
+ GSList **line_extents,
+ int *real_width)
{
GSList *line_list;
int y_offset = 0;
@@ -2076,12 +2080,14 @@ pango_layout_get_extents_internal (PangoLayout *layout,
*/
width = layout->width;
- /* If one of the lines of the layout is not left aligned, then we need
- * the width of the width to calculate line x-offsets; this requires
- * looping through the lines for layout->auto_dir.
- */
- if (layout->auto_dir)
+ if (real_width)
+ need_width = TRUE;
+ else if (layout->auto_dir)
{
+ /* If one of the lines of the layout is not left aligned, then we need
+ * the width of the width to calculate line x-offsets; this requires
+ * looping through the lines for layout->auto_dir.
+ */
line_list = layout->lines;
while (line_list)
{
@@ -2211,6 +2217,9 @@ pango_layout_get_extents_internal (PangoLayout *layout,
if (line_extents)
*line_extents = g_slist_reverse (*line_extents);
+
+ if (real_width)
+ *real_width = width;
}
/**
@@ -2238,7 +2247,7 @@ pango_layout_get_extents (PangoLayout *layout,
{
g_return_if_fail (layout != NULL);
- pango_layout_get_extents_internal (layout, ink_rect, logical_rect, NULL);
+ pango_layout_get_extents_internal (layout, ink_rect, logical_rect, NULL, NULL);
}
/**
@@ -4663,6 +4672,8 @@ pango_layout_iter_copy (PangoLayoutIter *iter)
new->cluster_num_chars = iter->cluster_num_chars;
new->character_position = iter->character_position;
+ new->layout_width = iter->layout_width;
+
return new;
}
@@ -4722,7 +4733,8 @@ pango_layout_get_iter (PangoLayout *layout)
pango_layout_get_extents_internal (layout,
NULL,
&iter->logical_rect,
- &iter->line_extents);
+ &iter->line_extents,
+ &iter->layout_width);
iter->line_extents_link = iter->line_extents;
@@ -5237,7 +5249,7 @@ pango_layout_iter_get_line_extents (PangoLayoutIter *iter,
if (ink_rect)
{
get_line_extents_layout_coords (iter->layout, iter->line,
- iter->logical_rect.width,
+ iter->layout_width,
ext->logical_rect.y,
NULL,
ink_rect,