Hi Michael,

is the current non-bidi win32 version working? The bidi one is not 
(nothing apearing on the screen); I would not be suprised if that 
was caused by that patch of mine. Could you check the non-bidi 
build, and if it does not work just revert those changes?

Thanks Tomas
> done!
> 
> Cheers!
> 
> Michael D. Pritchett
> 
> ----- Original Message -----
> From: "Tomas Frydrych" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, October 19, 2001 6:12 PM
> Subject: patch: win32 handling of zerow width spaces
> 
> 
> >
> > could please one of the Win32 developers look over this tiny patch
> > and commit it? The purpose of this is to ensure that zero-width
> > spaces (0x200B and 0xFEFF) get handled correctly. In MS fonts
> > these map to the undefined character and display as squares; we
> > want them ignored instead. (This is needed for the Arabic glyph
> > shaping engine, the xp bits and Unix stuff are already in place.)
> >
> > Thanks in advance
> >
> > Tomas
> >
> >
> 
> 
> ----------------------------------------------------------------------------
> ----
> 
> 
> > --- gr_Win32CharWidths.cpp Sat Jan 13 14:50:58 2001
> > +++ gr_Win32CharWidths.cpp.fixed Fri Oct 19 23:52:26 2001
> > @@ -67,8 +67,13 @@
> >   {
> >   for (k=c0; k<=c1; k++)
> >   {
> > - GetCharWidth32W(hdc,k,k,&w);
> > - setWidth(k,w);
> > + if(k == 0x200B || k == 0xFEFF)
> > + setWidth(k,0);
> > + else
> > + {
> > + GetCharWidth32W(hdc,k,k,&w);
> > + setWidth(k,w);
> > + }
> >   }
> >   }
> >   else
> > @@ -96,11 +101,16 @@
> >   // Unicode font and default character sets
> >   for (k=c0; k<=c1; k++)
> >   {
> > - SIZE Size;
> > - wchar_t sz1[2];
> > - sz1[0] = k;
> > - GetTextExtentPoint32W(hdc, sz1, 1, &Size);
> > - setWidth(k,Size.cx);
> > + if(k == 0x200B || k == 0xFEFF)
> > + setWidth(k,0);
> > + else
> > + {
> > + SIZE Size;
> > + wchar_t sz1[2];
> > + sz1[0] = k;
> > + GetTextExtentPoint32W(hdc, sz1, 1, &Size);
> > + setWidth(k,Size.cx);
> > + }
> >   }
> >   }
> >   }
> > --- gr_Win32Graphics.cpp Sat Oct 20 00:04:48 2001
> > +++ gr_Win32Graphics.cpp.fixed Fri Oct 19 23:54:00 2001
> > @@ -246,6 +246,8 @@
> >
> >   UT_UCSChar currentChar = remapGlyph(Char, false);
> >
> > + if(currentChar == 0x200B || currentChar == 0xFEFF)
> > + return;
> >   // Windows NT and Windows 95 support the Unicode Font file.
> >   // All of the Unicode glyphs can be rendered if the glyph is found in
> >   // the font file. However, Windows 95 does  not support the Unicode
> > @@ -273,11 +275,12 @@
> >  }
> >
> >  void GR_Win32Graphics::drawChars(const UT_UCSChar* pChars,
> > - int iCharOffset, int iLength,
> > + int iCharOffset, int iLengthOrig,
> >   UT_sint32 xoff, UT_sint32 yoff)
> >  {
> >   UT_ASSERT(pChars);
> > -
> > + // iLength can be modified by _remapGlyphs
> > + int iLength = iLengthOrig;
> >   HFONT hFont = GR_Win32Font::Acq::getHFONT(*m_pFont);
> >   SelectObject(m_hdc, hFont);
> >   SetTextAlign(m_hdc, TA_LEFT | TA_TOP);
> > @@ -313,7 +316,7 @@
> >
> >  }
> >
> > -UT_UCSChar* GR_Win32Graphics::_remapGlyphs(const UT_UCSChar* pChars, int
> iCharOffset, int iLength)
> > +UT_UCSChar* GR_Win32Graphics::_remapGlyphs(const UT_UCSChar* pChars, int
> iCharOffset, int &iLength)
> >  {
> >
> >   if (iLength > (int)m_remapBufferSize)
> > @@ -323,10 +326,15 @@
> >   m_remapBufferSize = iLength;
> >   }
> >
> > - for (int i = 0; i < iLength; ++i)
> > +    // Need to handle zero-width spaces correctly
> > + for (int i = 0, int j = 0; i < iLength; ++i, ++j)
> >   {
> > - m_remapBuffer[i] = remapGlyph(pChars[iCharOffset + i], false);
> > + m_remapBuffer[j] = remapGlyph(pChars[iCharOffset + i], false);
> > + if(m_remapBuffer[j] == 0x200B || m_remapBuffer[i] == 0xFEFF)
> > + j--;
> >   }
> > +
> > + iLength -= (i - j);
> >
> >   return m_remapBuffer;
> >  }
> > --- gr_Win32Graphics.h Sat Oct 20 00:04:50 2001
> > +++ gr_Win32Graphics.h.fixed Fri Oct 19 23:22:06 2001
> > @@ -174,7 +174,7 @@
> >
> >  private:
> >   void _constructorCommonCode(HDC);
> > - UT_UCSChar* _remapGlyphs(const UT_UCSChar* pChars, int iCharOffset, int
> iLength);
> > + UT_UCSChar* _remapGlyphs(const UT_UCSChar* pChars, int iCharOffset, int
> &iLength);
> >
> >   DWORD m_clrXorPen;
> >   HPEN m_hXorPen;
> >
> 



*********************************************
[EMAIL PROTECTED] / www.frydrych.net
PGP keys:  http://www.frydrych.net/contact.html

Reply via email to