Don't call GDI 'A' functions for non-ASCII strings. Bug 378859, r+sr=roc

This commit is contained in:
smontagu@smontagu.org 2007-04-26 07:37:11 -07:00
Родитель 2c4edbd812
Коммит 24d8224dff
1 изменённых файлов: 13 добавлений и 5 удалений

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

@ -592,15 +592,23 @@ gfxWindowsFontGroup::MakeTextRun(const PRUint8 *aString, PRUint32 aLength,
const PRBool isComplex = textRun->IsRightToLeft();
#endif
if (isComplex) {
/* We can only call GDI "A" functions if this is a true 7bit ASCII string,
because they interpret code points from 0x80-0xFF as if they were
in the system code page. */
if (!isComplex && (aParams->mFlags & TEXT_IS_ASCII)) {
InitTextRunGDI(aParams->mContext, textRun,
reinterpret_cast<const char*>(aString), aLength);
}
else {
nsDependentCSubstring cString(reinterpret_cast<const char*>(aString),
reinterpret_cast<const char*>(aString + aLength));
nsAutoString utf16;
AppendASCIItoUTF16(cString, utf16);
InitTextRunUniscribe(aParams->mContext, textRun, utf16.get(), aLength);
} else {
InitTextRunGDI(aParams->mContext, textRun,
reinterpret_cast<const char*>(aString), aLength);
if (isComplex) {
InitTextRunUniscribe(aParams->mContext, textRun, utf16.get(), aLength);
} else {
InitTextRunGDI(aParams->mContext, textRun, utf16.get(), aLength);
}
}
return textRun;