Re: Controlled Font Substitution
Re: Controlled Font Substitution
- Subject: Re: Controlled Font Substitution
- From: "Gerriet M. Denkmann" <email@hidden>
- Date: Thu, 4 Dec 2008 23:11:43 +0700
On 4 Dec 2008, at 01:34, Aki Inoue wrote:
Mac OS X ships with Thonburi as the Thai system font, and that's the
font usually you get for Thai character substitution.
Yes. And Thonburi is much more readable than Lucida Grande, which was
used on Tiger.
The font substitution system is applying sophisticated algorithm to
closely match font traits, and it appears it's causing the random
fallback.
The most sophisticated algorithm cannot work correctly if supplied
with wrong data:
starting from Monaco (a mono spaced font) it probably should look for
another mono spaced font containing Thai characters.
But the Apple supplied Ayuthaya font, which looks very much like a
mono spaced font to me, has no NSFontMonoSpaceTrait set, and returns
isFixedPitch = NO.
In the meantime, if you want to control the font substitution
behavior, you can create fonts with NSFontDescriptor that has custom
NSFontCascadeListAttribute.
I added the following:
CGFloat size = [ font pointSize ];
NSFontDescriptor *fode2 = [ NSFontDescriptor fontDescriptorWithName:
@"Ayuthaya" size: size ];
NSArray *fodArray = [ NSArray arrayWithObject: fode2 ];
NSDictionary *fodDict = [ NSDictionary dictionaryWithObject: fodArray
forKey: NSFontCascadeListAttribute ];
NSFontDescriptor *fode1 = [ font fontDescriptor ];
NSFontDescriptor *fode0 = [ fode1 fontDescriptorByAddingAttributes:
fodDict ];
font = [ NSFont fontWithDescriptor: fode0 size: size ];
and now my app displays readable mono spaced Thai characters.
Thank you very much!
But Console.app and Terminal.app were still using UPC-Angsana.
So I moved the font from ~/Library/Fonts to /ibrary/Fonts which
obviously changed the order in which fonts were searched.
Now both Console.app and Terminal.app create nice and readable Thai
characters.
Kind regards,
Gerriet.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden