Move the workaround for Windows displaying right-to-left presentation forms as left-to-right into Windows-specific code. Bug 204272, r+sr=rbs, a=chofmann

This commit is contained in:
smontagu%smontagu.org 2005-06-23 08:03:24 +00:00
Родитель 45e4a30d0f
Коммит 76833c170d
2 изменённых файлов: 10 добавлений и 17 удалений

Просмотреть файл

@ -62,6 +62,7 @@
#include "nsAutoBuffer.h"
#define DEFAULT_TTF_SYMBOL_ENCODING "windows-1252"
#define IS_RTL_PRESENTATION_FORM(c) ((0xfb1d <= (c)) && ((c)<= 0xfefc))
#define NOT_SETUP 0x33
static PRBool gIsWIN95OR98 = NOT_SETUP;
@ -3979,7 +3980,8 @@ nsFontMetricsWin::ResolveBackwards(HDC aDC,
if (currFont == mLoadedFonts[firstFont]) {
while (currChar > lastChar &&
(currFont->HasGlyph(*currChar)) &&
!CCMAP_HAS_CHAR_EXT(gIgnorableCCMapExt, *currChar))
!CCMAP_HAS_CHAR_EXT(gIgnorableCCMapExt, *currChar) &&
!IS_RTL_PRESENTATION_FORM(*currChar))
--currChar;
fontSwitch.mFontWin = currFont;
if (!(*aFunc)(&fontSwitch, currChar+1, firstChar - currChar, aData))
@ -4014,11 +4016,13 @@ nsFontMetricsWin::ResolveBackwards(HDC aDC,
lastCharLen = 1;
}
if (nextFont != currFont ||
/* render right-to-left characters outside the BMP one by one, because
Windows doesn't reorder them.
/* render Hebrew and Arabic presentation forms and right-to-left
characters outside the BMP one by one, because Windows doesn't reorder
them.
XXX If a future version of Uniscribe corrects this, we will need to make a
run-time check and set a rendering hint accordingly */
codepoint > 0xFFFF) {
codepoint > 0xFFFF ||
IS_RTL_PRESENTATION_FORM(codepoint)) {
// We have a substring that can be represented with the same font, and
// we are about to switch fonts, it is time to notify our caller.
fontSwitch.mFontWin = currFont;

Просмотреть файл

@ -961,31 +961,23 @@ nsBidiPresUtils::CalculateCharType(PRInt32& aOffset,
{
PRBool strongTypeFound = PR_FALSE;
PRBool inFERange = PR_FALSE;
PRInt32 offset;
nsCharType charType;
aCharType = eCharType_OtherNeutral;
for (offset = aOffset; offset < aCharTypeLimit; offset++) {
// Make sure we give RTL chartype to all that stuff that would be classified
// Make sure we give RTL chartype to all characters that would be classified
// as Right-To-Left by a bidi platform.
// (May differ from the UnicodeData, eg we set RTL chartype to some NSM's,
// and set LTR chartype to FE-ranged Arabic.)
// (May differ from the UnicodeData, eg we set RTL chartype to some NSMs.)
if (IS_HEBREW_CHAR(mBuffer[offset]) ) {
charType = eCharType_RightToLeft;
}
else if (IS_ARABIC_ALPHABETIC(mBuffer[offset]) ) {
charType = eCharType_RightToLeftArabic;
}
else if (IS_FE_CHAR(mBuffer[offset]) ) {
charType = eCharType_LeftToRight;
inFERange = PR_TRUE;
}
else {
// IBMBIDI - Egypt - Start
mBidiEngine->GetCharTypeAt(offset, &charType);
// IBMBIDI - Egypt - End
}
if (!CHARTYPE_IS_WEAK(charType) ) {
@ -1017,9 +1009,6 @@ nsBidiPresUtils::CalculateCharType(PRInt32& aOffset,
aCharType = charType;
}
}
if (inFERange) {
aPrevCharType = eCharType_RightToLeftArabic;
}
aOffset = offset;
}