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


git-svn-id: svn://10.0.0.236/trunk@116648 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
ftang%netscape.com 2002-03-15 15:44:26 +00:00
parent b1421a820e
commit f4d40c1ae2

View File

@ -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--) {