[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]

[XaraXtreme-dev] Line spacing and character width fixes



Find attached below a patch to fix text line spacing and the widths of 
characters with codes > 127.

ftfonts.cpp:
Negate descender value, which seems to be what the Kernel expects.

fontbase.cpp:
Enabled char width computation for characters outside the standard 
cache range.

Martin
Index: wxOil/fontbase.cpp
===================================================================
--- wxOil/fontbase.cpp	(Revision 771)
+++ wxOil/fontbase.cpp	(Arbeitskopie)
@@ -1074,10 +1074,11 @@
 				CharWidth = mpFontMetricsData[CacheEntry].GetFontEmWidth();
 			else
 			{
-				INT32 TempCharWidth = 0;
-				if (TextManager::GetCharWidth(pDC, ch, ch, &TempCharWidth)==FALSE)
+#ifdef __WXGTK__
+				// FTFontMan returns the scaled character width already
+				if (FTFontMan::GetCharWidth(FontDesc, ch, ch, &CharWidth)==FALSE)
+#endif
 					return FALSE;
-				CharWidth = MulDiv(TempCharWidth, DefaultHeight, DesignSize);
 			}
 		}
 	}
Index: wxOil/ftfonts.cpp
===================================================================
--- wxOil/ftfonts.cpp	(Revision 771)
+++ wxOil/ftfonts.cpp	(Arbeitskopie)
@@ -923,7 +923,7 @@
 	// get the design size
 	INT32 DesignSize = pFreeTypeFace->units_per_EM;
 	*pAscent = ScaleToDefaultHeight(pFreeTypeFace->ascender, DesignSize);
-	*pDescent = ScaleToDefaultHeight(pFreeTypeFace->descender, DesignSize);
+	*pDescent = ScaleToDefaultHeight(-pFreeTypeFace->descender, DesignSize);
 	TRACEUSER("wuerthne", _T("returning ascent = %d, descent = %d"), *pAscent, *pDescent);
 	pango_fc_font_unlock_face(pPangoFcFont);
 	return TRUE;