From ddee4cff5a5e0aa8c9e3c3c9dbd9c65a21d82c32 Mon Sep 17 00:00:00 2001 From: "ftang%netscape.com" Date: Fri, 10 Feb 2006 22:49:25 +0000 Subject: [PATCH] fix 130443 . r=nhotta sr=sfraser a=asa cast the hash value to FMFontFamily instead of fondid (short) on carbon and get the correct script code from it by using the right api --- widget/src/mac/nsDeviceContextMac.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/widget/src/mac/nsDeviceContextMac.cpp b/widget/src/mac/nsDeviceContextMac.cpp index 3daf6e00d6bd..6b3c0cd32151 100644 --- a/widget/src/mac/nsDeviceContextMac.cpp +++ b/widget/src/mac/nsDeviceContextMac.cpp @@ -1147,10 +1147,23 @@ EnumerateFont(nsHashKey *aKey, void *aData, void* closure) EnumerateFontInfo* info = (EnumerateFontInfo*) closure; PRUnichar** array = info->mArray; int j = info->mCount; - + PRBool match = PR_FALSE; +#if TARGET_CARBON + // we need to match the cast of FMFontFamily in nsDeviceContextMac :: InitFontInfoList() + FMFontFamily fontFamily = (FMFontFamily) aData; + TextEncoding fontEncoding; + OSStatus status = ::FMGetFontFamilyTextEncoding(fontFamily, &fontEncoding); + if (noErr == status) { + ScriptCode script; + status = ::RevertTextEncodingToScriptInfo(fontEncoding, &script, nsnull, nsnull); + match = ((noErr == status) && (script == info->mScript)); + } +#else short fondID = (short) aData; ScriptCode script = ::FontToScript(fondID); - if(script == info->mScript) { + match = (script == info->mScript) ; +#endif + if (match) { PRUnichar* str = ToNewUnicode(((FontNameKey*)aKey)->mString); if (!str) { for (j = j - 1; j >= 0; j--) {