The problem was that the fill up loop was using the modified len
value (len changes when the input text is converted to UTF-8), rather
than the original len value which is also the length of the output
array. Committed to CVS with patch also attached.
Neil
Index: PlatGTK.cxx
===================================================================
RCS file: /cvsroot/scintilla/scintilla/gtk/PlatGTK.cxx,v
retrieving revision 1.104
diff -u -r1.104 PlatGTK.cxx
--- PlatGTK.cxx 18 Jul 2005 01:00:55 -0000 1.104
+++ PlatGTK.cxx 4 Aug 2005 04:33:19 -0000
@@ -1258,6 +1258,7 @@
if (font_.GetID()) {
int totalWidth = 0;
#ifdef USE_PANGO
+ const int lenPositions = len;
if (PFont(font_)->pfd) {
if (len == 1) {
int width = PFont(font_)->CharWidth(*s, et);
@@ -1272,6 +1273,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,7 +1283,10 @@
positions[i++] = position;
}
}
+ while (i < lenPositions)
+ positions[i++] = PANGO_PIXELS(pos.x + pos.width);
pango_layout_iter_free (iter);
+ PLATFORM_ASSERT(i == lenPositions);
} else {
int positionsCalculated = 0;
if (et == dbcs) {
@@ -1296,6 +1301,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,8 +1316,11 @@
utfIndex += UTF8CharLength(utfForm+utfIndex);
}
}
+ while (i < lenPositions)
+ positions[i++] = PANGO_PIXELS(pos.x + pos.width);
pango_layout_iter_free (iter);
delete []utfForm;
+ PLATFORM_ASSERT(i == lenPositions);
}
}
if (positionsCalculated < 1 ) {
@@ -1325,16 +1334,20 @@
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 < lenPositions)
+ positions[i++] = PANGO_PIXELS(pos.x + pos.width);
pango_layout_iter_free(iter);
if (useGFree) {
g_free(utfForm);
} else {
delete []utfForm;
}
+ PLATFORM_ASSERT(i == lenPositions);
}
}
if (len == 1) {_______________________________________________
Scintilla-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scintilla-interest