Hi Neil,
On Tue, 2005-08-02 at 20:48 +1000, Neil Hodgson wrote:
> >
> > Related bug report:
> > http://bugzilla.gnome.org/show_bug.cgi?id=311846
>
> The patch breaks selection on this 3 character UTF-8 Japanese
Thanks for pointing out the bug. Here is a better patch.
Regards,
-Naba
--- PlatGTK.cxx 2005-07-18 06:30:55.000000000 +0530
+++ PlatGTK.cxx 2005-08-03 11:43:38.000017192 +0530
@@ -1272,6 +1272,7 @@
// Simple and direct as UTF-8 is native Pango encoding
pango_layout_set_text(layout, s, len);
PangoLayoutIter *iter = pango_layout_get_iter (layout);
+ pango_layout_iter_get_cluster_extents(iter, NULL, &pos);
int i = 0;
while (pango_layout_iter_next_cluster (iter)) {
pango_layout_iter_get_cluster_extents(iter, NULL, &pos);
@@ -1281,6 +1282,8 @@
positions[i++] = position;
}
}
+ while (i < len)
+ positions[i++] = PANGO_PIXELS (pos.x + pos.width);
pango_layout_iter_free (iter);
} else {
int positionsCalculated = 0;
@@ -1296,6 +1299,7 @@
int i = 0;
int utfIndex = 0;
PangoLayoutIter *iter = pango_layout_get_iter (layout);
+ pango_layout_iter_get_cluster_extents(iter, NULL, &pos);
while (pango_layout_iter_next_cluster (iter)) {
pango_layout_iter_get_cluster_extents (iter, NULL, &pos);
int position = PANGO_PIXELS(pos.x);
@@ -1310,6 +1314,8 @@
utfIndex += UTF8CharLength(utfForm+utfIndex);
}
}
+ while (i < len)
+ positions[i++] = PANGO_PIXELS (pos.x + pos.width);
pango_layout_iter_free (iter);
delete []utfForm;
}
@@ -1325,10 +1331,13 @@
pango_layout_set_text(layout, utfForm, len);
int i = 0;
PangoLayoutIter *iter = pango_layout_get_iter (layout);
+ pango_layout_iter_get_cluster_extents(iter, NULL, &pos);
while (pango_layout_iter_next_cluster (iter)) {
pango_layout_iter_get_cluster_extents(iter, NULL, &pos);
positions[i++] = PANGO_PIXELS(pos.x);
}
+ while (i < len)
+ positions[i++] = PANGO_PIXELS(pos.x + pos.width);
pango_layout_iter_free(iter);
if (useGFree) {
g_free(utfForm);
_______________________________________________
Scintilla-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scintilla-interest