From: j.m.maurer (j.m.maurer@student.utwente.nl)
Date: Fri Aug 23 2002 - 14:25:10 EDT
Tested and it works fine now...
===
Use the pCharWidths to position individual characters. Patch by Joaquín
Cuenca Abela
CVS:
----------------------------------------------------------------------
CVS: Enter Log. Lines beginning with `CVS:' are removed automatically
CVS:
CVS: Committing in .
CVS:
CVS: Modified Files:
CVS: gr/unix/gr_UnixGraphics.cpp
CVS:
---------------------------------------------------------------------
Op vr 23-08-2002, om 19:55 schreef Joaquín Cuenca Abela:
> 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 - 14:28:06 EDT