summaryrefslogtreecommitdiff
path: root/pango
diff options
context:
space:
mode:
authorElliot Lee <sopwith@redhat.com>2000-08-09 02:37:44 +0000
committerElliot Lee <sopwith@src.gnome.org>2000-08-09 02:37:44 +0000
commit6d8b209bb67d3abd57de313548716710e7bfca87 (patch)
treea7332918d861405dce947e3c7e4c495564541de0 /pango
parent0d0b47ba872c90fbad6312c77c12b7380f27ab6c (diff)
downloadpango-6d8b209bb67d3abd57de313548716710e7bfca87.tar.gz
Fix incorrect list rearrangement that caused some segfaults. Pay attention
2000-08-08 Elliot Lee <sopwith@redhat.com> * pango/modules.c: Fix incorrect list rearrangement that caused some segfaults. * pango/pango-layout.c (pango_layout_line_x_to_index): Pay attention to shape attributes (not perfect since the layout of chars inside a shaped run is unknown, but gives start index of the chars in the run).
Diffstat (limited to 'pango')
-rw-r--r--pango/modules.c9
-rw-r--r--pango/pango-layout.c32
2 files changed, 26 insertions, 15 deletions
diff --git a/pango/modules.c b/pango/modules.c
index 5d3f9cb9..c1ab44a5 100644
--- a/pango/modules.c
+++ b/pango/modules.c
@@ -115,12 +115,9 @@ pango_find_map (const char *lang,
* for speed next time around if we had to do
* any failing strcmps.
*/
- if (tmp_list->next)
- tmp_list->next->prev = tmp_list->prev;
- tmp_list->prev->next = tmp_list->next;
- tmp_list->next = maps;
- tmp_list->prev = NULL;
- maps = tmp_list;
+ maps = g_list_remove_link(maps, tmp_list);
+ maps = g_list_prepend(maps, tmp_list->data);
+ g_list_free_1(tmp_list);
}
return map_info->map;
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index 7025083f..3aee5bfd 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -2234,21 +2234,35 @@ pango_layout_line_x_to_index (PangoLayoutLine *line,
{
PangoRectangle logical_rect;
PangoLayoutRun *run = tmp_list->data;
-
- pango_glyph_string_extents (run->glyphs, run->item->analysis.font, NULL, &logical_rect);
+ gboolean shape_set;
+
+ pango_layout_get_item_properties (run->item, NULL, NULL, &logical_rect, &shape_set);
+
+ if (!shape_set)
+ pango_glyph_string_extents (run->glyphs, run->item->analysis.font, NULL, &logical_rect);
if (x_pos >= start_pos && x_pos < start_pos + logical_rect.width)
{
int pos;
-
- pango_glyph_string_x_to_index (run->glyphs,
- line->layout->text + run->item->offset, run->item->length,
- &run->item->analysis,
- x_pos - start_pos,
- &pos, trailing);
if (index)
- *index = pos + run->item->offset;
+ *index = run->item->offset;
+
+ if (shape_set)
+ {
+ *trailing = FALSE;
+ }
+ else
+ {
+ pango_glyph_string_x_to_index (run->glyphs,
+ line->layout->text + run->item->offset, run->item->length,
+ &run->item->analysis,
+ x_pos - start_pos,
+ &pos, trailing);
+
+ if (index)
+ *index += pos;
+ }
return;
}