This is patch to bug #1024, titled "All symbols show as boxes in all symbol fonts"
 
The bug is specific to Windows95.
 
Windows95 handle characters differently from WindowsNT. It now displays symbol characters as it should.
 
Gilles Saint-Denis
Index: abi/src/af/gr/win/gr_Win32CharWidths.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/gr/win/gr_Win32CharWidths.cpp,v
retrieving revision 1.3
diff -u -r1.3 gr_Win32CharWidths.cpp
--- abi/src/af/gr/win/gr_Win32CharWidths.cpp    2000/01/27 01:01:12     1.3
+++ abi/src/af/gr/win/gr_Win32CharWidths.cpp    2000/11/07 02:22:54
@@ -68,11 +68,11 @@
        {
                for (k=c0; k<=c1; k++)
                {
-                       // GetCharWidth(hdc,k,k,&w);  // This gives correct width of 
CP1252 char 128-159 but do we need it?
                        SIZE Size;
-                       wchar_t sz1[2];
-                       sz1[0] = k;
-                       GetTextExtentPoint32W(hdc, sz1, 1, &Size);
+                       char str[sizeof(UT_UCSChar)];
+                       int iConverted = WideCharToMultiByte(CP_ACP, NULL, 
+                               (unsigned short*) &k, 1, str, sizeof(str), NULL, NULL);
+                       GetTextExtentPoint32A(hdc, str, iConverted, &Size);
                        setWidth(k,Size.cx);
                }
        }
Index: abi/src/af/gr/win/gr_Win32Graphics.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/gr/win/gr_Win32Graphics.cpp,v
retrieving revision 1.49
diff -u -r1.49 gr_Win32Graphics.cpp
--- abi/src/af/gr/win/gr_Win32Graphics.cpp      2000/07/15 18:39:37     1.49
+++ abi/src/af/gr/win/gr_Win32Graphics.cpp      2000/11/07 02:22:57
@@ -174,7 +174,18 @@
        SetBkMode(m_hdc, TRANSPARENT);          // TODO: remember and reset?
 
        UT_UCSChar currentChar = remapGlyph(Char, UT_FALSE);
-       ExtTextOutW(m_hdc, xoff, yoff, 0, NULL, &currentChar, 1, NULL);
+       if(UT_IsWinNT())
+       {
+               ExtTextOutW(m_hdc, xoff, yoff, 0, NULL, &currentChar, 1, NULL);
+       }
+       else
+       {
+               char str[sizeof(UT_UCSChar)];
+               int iConverted = WideCharToMultiByte(CP_ACP, NULL, 
+                       &currentChar, 1,
+                       str, sizeof(str), NULL, NULL);
+               ExtTextOutA(m_hdc, xoff, yoff, 0, NULL, str, iConverted, NULL);
+       }
 }
 
 void GR_Win32Graphics::drawChars(const UT_UCSChar* pChars,
@@ -188,8 +199,19 @@
        SetBkMode(m_hdc, TRANSPARENT);          // TODO: remember and reset?
 
        // TODO: need remapGlyph() before the following call
-       ExtTextOutW(m_hdc, xoff, yoff, 0, NULL, pChars + iCharOffset, iLength, NULL);
-       //TextOutW(m_hdc, xoff, yoff, pChars + iCharOffset, iLength);
+       if(UT_IsWinNT())
+       {
+               ExtTextOutW(m_hdc, xoff, yoff, 0, NULL, pChars + iCharOffset, iLength, 
+NULL);
+       }
+       else
+       {
+               char* str = new char[iLength * sizeof(UT_UCSChar)];
+               int iConverted = WideCharToMultiByte(CP_ACP, NULL, 
+                       pChars + iCharOffset, iLength, 
+                       str, iLength * sizeof(UT_UCSChar), NULL, NULL);
+               ExtTextOutA(m_hdc, xoff, yoff, 0, NULL, str, iConverted, NULL);
+               delete [] str;
+       }
 }
 
 void GR_Win32Graphics::setFont(GR_Font* pFont)

Reply via email to