From: Joaquín Cuenca Abela (cuenca@pacaterie.u-psud.fr)
Date: Sat Aug 03 2002 - 13:49:04 EDT
On Sat, 2002-08-03 at 19:23, Tomas Frydrych wrote:
>
> I have added an extra parameter, UT_sint32 * pCharWidths, to the
> drawChars() function. I has a default value of NULL. This will allow
> us to provide our own character spacing. I need this to fix bug 3768,
> but if it is properly implemented on all our platforms, it will allow us to
> do manual kerning, as well as simplify the justification stuff.
>
> I have modified all the platform files plus fp_TextRun.cpp, but only
> the win32 version is functional.
I've not yet been able to upgrade my tree, but this patch should do the
Xft magic to make that work.
I guess that it should apply with a bit an offset of some lines, but
other than that it should be ok.
The patch also has a little fix to the kind of font used to do our GUI
display.
Cheers,
-- Joaquín Cuenca Abela cuenca@pacaterie.u-psud.fr
--- abi/src/af/gr/unix/gr_UnixGraphics.cpp Sat Aug 3 15:31:43 2002
+++ abi_profile/src/af/gr/unix/gr_UnixGraphics.cpp Sat Aug 3 19:45:43 2002
@@ -320,8 +323,36 @@
int iLength, UT_sint32 xoff, UT_sint32 yoff)
{
#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;
+
+ if (!pCharWidths)
+ XftDrawString32(m_pXftDraw, &m_XftColor, m_pXftFont, xoff, yoff + m_pXftFont->ascent,
+ const_cast<XftChar32*> (pChars + iCharOffset), iLength);
+ else
+ {
+ XftGlyphSpec aGlyphSpec[256];
+ XftGlyphSpec* pGlyphSpec = aGlyphSpec;
+
+ if (iLength > 256)
+ pGlyphSpec = new XftGlyphSpec[iLength];
+
+ pGlyphSpec[0].glyph = (FT_UInt) pChars[iCharOffset];
+ pGlyphSpec[0].x = xoff;
+ pGlyphSpec[0].y = yoff;
+
+ for (int i = 1; i < iLength; ++i)
+ {
+ pGlyphSpec[i].glyph = (FT_UInt) pChars[i + iCharOffset];
+ pGlyphSpec[i].x = (short) (pGlyphSpec[i - 1].x + pCharWidths[i - 1]);
+ pGlyphSpec[i].y = yoff;
+ }
+
+ XftDrawGlyphSpec (m_pXftDraw, &m_XftColor, m_pXftFont, pGlyphSpec, iLength);
+
+ if (pGlyphSpec != aGlyphSpec)
+ delete[] pGlyphSpec;
+ }
#else
if (!m_pFontManager)
return;
@@ -738,7 +769,7 @@
{
// get the font resource
//UT_DEBUGMSG(("GR_UnixGraphics::getGUIFont: getting default font\n"));
- XAP_UnixFont * font = (XAP_UnixFont *) m_pFontManager->getDefaultFont();
+ XAP_UnixFont * font = (XAP_UnixFont *) m_pFontManager->getDefaultFont(GR_Font::FF_Swiss);
UT_ASSERT(font);
// bury it in a new font handle
This archive was generated by hypermail 2.1.4 : Sat Aug 03 2002 - 13:55:11 EDT