From 7817c2626c7b9c37ad84b18acbe2331c1a5456b4 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 15 Aug 2007 20:04:15 +0000 Subject: =?UTF-8?q?Bug=20467077=20=E2=80=93=20Remove=20special-case=20for?= =?UTF-8?q?=20shape=20attribute=20in?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2007-08-15 Behdad Esfahbod Bug 467077 – Remove special-case for shape attribute in pango_layout_line_index_to_x() * pango/pango-layout.c (pango_layout_line_index_to_x): Remove special-casing for shape-attribute runs. It all works because pango_glyph_string_index_to_x() is perfectly correct to run on glyphs returned by _pango_shape_shape(). svn path=/trunk/; revision=2403 --- ChangeLog | 10 ++++++++++ pango/pango-layout.c | 50 +++++++++++++++++++++----------------------------- 2 files changed, 31 insertions(+), 29 deletions(-) diff --git a/ChangeLog b/ChangeLog index a0a2269b..28df3077 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2007-08-15 Behdad Esfahbod + + Bug 467077 – Remove special-case for shape attribute in + pango_layout_line_index_to_x() + + * pango/pango-layout.c (pango_layout_line_index_to_x): Remove + special-casing for shape-attribute runs. It all works because + pango_glyph_string_index_to_x() is perfectly correct to run on glyphs + returned by _pango_shape_shape(). + 2007-08-15 Behdad Esfahbod Bug 462420 – Clicking on pixbuf should move the cursor to the position diff --git a/pango/pango-layout.c b/pango/pango-layout.c index dd5c850e..04d56a5a 100644 --- a/pango/pango-layout.c +++ b/pango/pango-layout.c @@ -1364,44 +1364,36 @@ pango_layout_line_index_to_x (PangoLayoutLine *line, if (run->item->offset <= index && run->item->offset + run->item->length > index) { - if (properties.shape_set) + int offset = g_utf8_pointer_to_offset (layout->text, layout->text + index); + if (trailing) { - if (x_pos) - *x_pos = width + (trailing > 0 ? pango_glyph_string_get_width (run->glyphs) : 0); + while (index < line->start_index + line->length && + offset + 1 < layout->n_chars && + !layout->log_attrs[offset + 1].is_cursor_position) + { + offset++; + index = g_utf8_next_char (layout->text + index) - layout->text; + } } else { - int offset = g_utf8_pointer_to_offset (layout->text, layout->text + index); - if (trailing) - { - while (index < line->start_index + line->length && - offset + 1 < layout->n_chars && - !layout->log_attrs[offset + 1].is_cursor_position) - { - offset++; - index = g_utf8_next_char (layout->text + index) - layout->text; - } - } - else + while (index > line->start_index && + !layout->log_attrs[offset].is_cursor_position) { - while (index > line->start_index && - !layout->log_attrs[offset].is_cursor_position) - { - offset--; - index = g_utf8_prev_char (layout->text + index) - layout->text; - } - + offset--; + index = g_utf8_prev_char (layout->text + index) - layout->text; } - pango_glyph_string_index_to_x (run->glyphs, - layout->text + run->item->offset, - run->item->length, - &run->item->analysis, - index - run->item->offset, trailing, x_pos); - if (x_pos) - *x_pos += width; } + pango_glyph_string_index_to_x (run->glyphs, + layout->text + run->item->offset, + run->item->length, + &run->item->analysis, + index - run->item->offset, trailing, x_pos); + if (x_pos) + *x_pos += width; + return; } -- cgit v1.2.1