Index: abi/src/af/gr/win/gr_Win32Graphics.cpp =================================================================== RCS file: /cvsroot/abi/src/af/gr/win/gr_Win32Graphics.cpp,v retrieving revision 1.147 diff -u -3 -r1.147 gr_Win32Graphics.cpp --- abi/src/af/gr/win/gr_Win32Graphics.cpp 3 Jul 2003 12:28:21 -0000 1.147 +++ abi/src/af/gr/win/gr_Win32Graphics.cpp 1 Sep 2003 09:27:38 -0000 @@ -384,30 +384,28 @@ else { int duCharWidths [256]; - int *pCharAdvances = 0; - - if (iLengthOrig > sizeof(duCharWidths)) - pCharAdvances = new int [iLengthOrig]; - else - pCharAdvances = duCharWidths; + int *pCharAdvances; if (pCharWidths) { + if (iLengthOrig > (sizeof(duCharWidths)/sizeof(int)) ) + pCharAdvances = new int [iLengthOrig]; + else + pCharAdvances = duCharWidths; + UT_ASSERT(pCharAdvances != NULL); + // convert width into display units; since we have removed // all 0x200B and 0xFEFF characters, we also have to // remove their entires from the advances UT_sint32 i,j; - for (i = 0, j = 0; i < iLengthOrig; i++,j++) + for (i = 0, j = 0; i < iLengthOrig; i++) { - if(pChars[iCharOffset+i] == 0x200B || pChars[iCharOffset+i] == 0xFEFF - /*|| pChars[iCharOffset+i] == UCS_LIGATURE_PLACEHOLDER*/) - { - j--; - } - else + if(! (pChars[iCharOffset+i] == 0x200B || pChars[iCharOffset+i] == 0xFEFF + /*|| pChars[iCharOffset+i] == UCS_LIGATURE_PLACEHOLDER*/ ) ) { pCharAdvances[j] = tdu (pCharWidths[i]); + j++; } } } @@ -468,7 +466,7 @@ ExtTextOutW(m_hdc, xoff, yoff, 0, NULL, (LPCWSTR) currentChars, iLength, pCharAdvances); } - if (iLengthOrig > sizeof(duCharWidths)) + if (pCharAdvances && (iLengthOrig > (sizeof(duCharWidths)/sizeof(int))) ) delete[] pCharAdvances; }