diff options
author | Behdad Esfahbod <behdad@gnome.org> | 2007-08-15 20:04:15 +0000 |
---|---|---|
committer | Behdad Esfahbod <behdad@src.gnome.org> | 2007-08-15 20:04:15 +0000 |
commit | 7817c2626c7b9c37ad84b18acbe2331c1a5456b4 (patch) | |
tree | 049f489b670b3946cf00d4e3e1535f4ee8817d4b | |
parent | 12af073c1075f06996353f53e6343e509573d0f2 (diff) | |
download | pango-7817c2626c7b9c37ad84b18acbe2331c1a5456b4.tar.gz |
Bug 467077 – Remove special-case for shape attribute in
2007-08-15 Behdad Esfahbod <behdad@gnome.org>
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
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | pango/pango-layout.c | 50 |
2 files changed, 31 insertions, 29 deletions
@@ -1,5 +1,15 @@ 2007-08-15 Behdad Esfahbod <behdad@gnome.org> + 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 <behdad@gnome.org> + Bug 462420 – Clicking on pixbuf should move the cursor to the position nearest to the click point 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; } |