Package: anjuta
Version: 2.0.1-1
Severity: normal
Tags: experimental patch

The experimental package has the same bug as #322996: the font rendering is 
messed up. A backport of the fix from CVS is attached. (Too bad that 2.0 is not 
that usable yet, imo).
--- ./PlatGTK.cxx	2005-09-30 19:07:21.000000000 +0200
+++ /usr/src/gnome-cvs/anjuta-bak/scintilla/PlatGTK.cxx	2005-08-04 16:59:56.000000000 +0200
@@ -1250,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);
@@ -1264,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);
@@ -1273,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) {
@@ -1288,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);
@@ -1302,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 ) {
@@ -1317,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) {

Reply via email to