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
This commit is contained in:
ftang%netscape.com 2002-03-15 15:44:26 +00:00
parent 31a2b0d114
commit 5721260a5e

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