summaryrefslogtreecommitdiff
path: root/pango/pango-layout.c
diff options
context:
space:
mode:
Diffstat (limited to 'pango/pango-layout.c')
-rw-r--r--pango/pango-layout.c30
1 files changed, 21 insertions, 9 deletions
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,