How can I choose font depending upon Locale.
How can I choose font depending upon Locale.
- Subject: How can I choose font depending upon Locale.
- From: Symadept <email@hidden>
- Date: Sat, 28 Nov 2009 10:54:08 +0800
Hi,
My client has given me a custom TTF font only for English. So my intention
is to load that TTF only for English and for other languages it should
fallback to the available System font.
I am doing the following steps:
1. Registering fonts with my app.
Copying into Resources folder and add to my project.
2. Loading the font with name.
NSMutableDictionary * aTitleAttributes = [[[NSMutableDictionary alloc]
initWithObjectsAndKeys:
[NSFont fontWithName:CP_FONT_NAME size:[NSFont systemFontSize]],
NSFontAttributeName,
aParagraphStyle, NSParagraphStyleAttributeName,
nil] autorelease];
my But this results into another problem, since I am loading the fonts in
this way for all the languges, my localization text looks english. Hence I
think I should have some condition like
NSFont *font = nil;
If (currentLocaleIsEnglish()) {
/// font to load my custom TTF
}
Then use [NSFont fontwithName:font ...]
So can anybody help me to realize whatever I am doing is right with
registering the font with App. If so how can I register my font only for
English version. Because for other locales this font is not available then
NSFont::fontWithName will return nil and automatically fallsback to the
SystemFont and hence my locale shall be shown properly.
Otherwise I have to have a condition like what I mentioned above, which is a
crude way of doing. If so how can I write such an API for finding
currentLocale Is English?
Regards
Mustafa
_______________________________________________
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