I’ve discovered an apparent problem in FontToScript under Sierra (which may 
date back to El Capitan, but I haven’t tested that yet). 

Apparently the 15 Sierra system font families listed below that used to be 
reported as having a script code of smRoman (i.e., 0) are now being reported 
instead as smCyrillic (i.e., 7):

Arial
Arial Bold
Marion Bold
Marion Italic
Marion Regular
Microsoft Sans Serif
Phosphate Inline
Phosphate Solid
Tahoma
Tahoma Bold
Thonburi
Thonburi Bold
Thonburi Light
Times New Roman
Times New Roman Bold

Based on some old inconclusive and tangentially related discussions here I 
tried replacing FontToScript with this instead:

ScriptCode myFontToScript(FMFontFamily fontID)
{
    OSStatus        err __attribute__((unused));
    ScriptCode      thecode = 0;
    TextEncoding    encoding = kTextEncodingMacRoman;
        
    if (!(err = FMGetFontFamilyTextEncoding(fontID, &encoding))) {
        thecode = encoding;
        err = RevertTextEncodingToScriptInfo(encoding, &thecode, NULL, NULL);
    }
    return thecode;
}

While it threw no errors alas myFontToScript only correctly reported the code 
as smRoman for Arial and Times New Roman. The other 11 families’ script code is 
reported as smCyrillic via both methods.

Unfortunately this renders them pretty much useless for editable text in a 
Carbon app under a non-Cyrillic language, because when you click in a run of 
one of them FontToScript tricks your text engine into thinking it uses a 
different script than the keyboard, triggering a switch to a Latin font 
(frequently the application font (i.e., Geneva)).

So, can anyone suggest another way to skin this cat?

Thanks in advance,
-Mark
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/carbon-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to