bug 629386 - avoid using GDI font table loading for symbol fonts and italic faces in Arabic locales. r=jdaggett a=blocking2.0
authorJonathan Kew <jfkthame@gmail.com>
Thu, 03 Feb 2011 12:12:10 +0000
changeset 61840 f911fba0ea0bc71b96d788e42b4d2c96e05958ba
parent 61839 094a7967e1713423cf2d6c907ce4e54cf0819fd1
child 61841 02b5151b2a191b0e10074fb4ccf92f2a58d27404
push idunknown
push userunknown
push dateunknown
reviewersjdaggett, blocking2
bugs629386
milestone2.0b12pre
bug 629386 - avoid using GDI font table loading for symbol fonts and italic faces in Arabic locales. r=jdaggett a=blocking2.0
gfx/thebes/gfxDWriteFontList.cpp
--- a/gfx/thebes/gfxDWriteFontList.cpp
+++ b/gfx/thebes/gfxDWriteFontList.cpp
@@ -256,23 +256,47 @@ gfxDWriteFontEntry::IsSymbolFont()
 {
     if (mFont) {
         return mFont->IsSymbolFont();
     } else {
         return PR_FALSE;
     }
 }
 
+static bool
+UsingArabicScriptSystemLocale()
+{
+    LANGID langid = PRIMARYLANGID(::GetSystemDefaultLangID());
+    switch (langid) {
+    case LANG_ARABIC:
+    case LANG_DARI:
+    case LANG_PASHTO:
+    case LANG_PERSIAN:
+    case LANG_SINDHI:
+    case LANG_UIGHUR:
+    case LANG_URDU:
+        return true;
+    default:
+        return false;
+    }
+}
+
 nsresult
 gfxDWriteFontEntry::GetFontTable(PRUint32 aTableTag,
                                  FallibleTArray<PRUint8> &aBuffer)
 {
     gfxDWriteFontList *pFontList = gfxDWriteFontList::PlatformFontList();
 
-    if (mFont && pFontList->UseGDIFontTableAccess()) {
+    // don't use GDI table loading for symbol fonts or for
+    // italic fonts in Arabic-script system locales because of
+    // potential cmap discrepancies, see bug 629386
+    if (mFont && pFontList->UseGDIFontTableAccess() &&
+        !(mItalic && UsingArabicScriptSystemLocale()) &&
+        !mFont->IsSymbolFont())
+    {
         LOGFONTW logfont = { 0 };
         if (!InitLogFont(mFont, &logfont))
             return NS_ERROR_FAILURE;
 
         AutoDC dc;
         AutoSelectFont font(dc.GetDC(), &logfont);
         if (font.IsValid()) {
             PRInt32 tableSize =