From: Joaquín Cuenca Abela (cuenca@pacaterie.u-psud.fr)
Date: Fri Aug 23 2002 - 13:55:40 EDT
This patch uses the pCharWidths to position individual characters.  I.e.
like the last one that I sent to the list, but it it prints 'a' when the
user types 'a' (glyph indexes, char indexes... bah, all that indexes
look the same one).
Please commit it.
Cheers,
-- Joaquín Cuenca Abela cuenca@pacaterie.u-psud.fr
--- abi/src/af/gr/unix/gr_UnixGraphics.cpp	Sun Aug  4 10:07:13 2002
+++ abi4/src/af/gr/unix/gr_UnixGraphics.cpp	Thu Aug 22 20:16:33 2002
@@ -317,8 +317,38 @@
                                                                 int * pCharWidths)
 {
 #ifdef USE_XFT
-	XftDrawString32(m_pXftDraw, &m_XftColor, m_pXftFont, xoff, yoff + m_pXftFont->ascent,
-					const_cast<XftChar32*> (pChars + iCharOffset), iLength);
+	if (iLength == 0)
+		return;
+	
+	yoff += m_pXftFont->ascent;
+	
+	if (!pCharWidths)
+		XftDrawString32(m_pXftDraw, &m_XftColor, m_pXftFont, xoff, yoff,
+						const_cast<XftChar32*> (pChars + iCharOffset), iLength);
+	else
+	{
+		XftCharSpec aCharSpec[256];
+		XftCharSpec* pCharSpec = aCharSpec;
+		
+		if (iLength > 256)
+			pCharSpec = new XftCharSpec[iLength];
+
+		pCharSpec[0].ucs4 = (FT_UInt) pChars[iCharOffset];
+		pCharSpec[0].x = xoff;
+		pCharSpec[0].y = yoff;
+
+		for (int i = 1; i < iLength; ++i)
+		{
+			pCharSpec[i].ucs4 = (FT_UInt) pChars[i + iCharOffset];
+			pCharSpec[i].x = (short) (pCharSpec[i - 1].x + pCharWidths[i - 1]);
+			pCharSpec[i].y = yoff;
+		}
+		
+		XftDrawCharSpec (m_pXftDraw, &m_XftColor, m_pXftFont, pCharSpec, iLength);
+
+		if (pCharSpec != aCharSpec)
+			delete[] pCharSpec;
+	}
 #else
         if (!m_pFontManager)
                 return;
This archive was generated by hypermail 2.1.4 : Fri Aug 23 2002 - 13:58:28 EDT