• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Leopard's Font Collection based on user's language
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Leopard's Font Collection based on user's language


  • Subject: Re: Leopard's Font Collection based on user's language
  • From: Aki Inoue <email@hidden>
  • Date: Fri, 15 Feb 2008 10:53:27 -0800

Duh. In the clear light of morning I can see that com.apple.UserFonts does not refer to fonts in the user's Library/ Fonts folder, but rather to fonts appropriate for the user's language preference. I guess the name of the collection can be obtained like this:
I'm glad that you found about this 8-).

NSString *languageCode = [[NSLocale preferredLanguages] objectAtIndex:0];
NSLocale *locale = [NSLocale currentLocale];
NSString *collectionDisplayName = [locale displayNameForKey:NSLocaleLanguageCode value:];
Actually the locale used to dynamically construct the collection is based on the user interface language, not on the regional locale returned from +currentLocale.

So, you should do:
NSArray *preferredLanguages = [NSLocale preferredLanguage];
NSString *language = ((0 == [preferredLanguages count]) ? @"en" : [preferredLanguages objectAtIndex:0]);
NSLocale *locale = [[NSLocale alloc] initWithLocaleIdentifier:language];


NSString *collectionDisplayName = [locale displayNameForKey:NSLocaleLanguageCode value:language];
[locale release];


We do have plans to enhance NSFontManager API to make the info more easily accessible.
Enhancement requests from 3rd developers don't hurt as usual, though.


Thank you,

Aki

On Feb 15, 2008, at 8:22 AM, Ross Carter wrote:


On Feb 14, 2008, at 8:58 PM, Ross Carter wrote:

Leopard added a new font collection to the font manager panel: a collection comprising fonts appropriate for the user's language setting. (E.g., my collections are now All Fonts, English, Favorites, etc.)

NSFontManager's collectionNames method does not return a name for that collection. Is there any way to retrieve that collection's contents, perhaps by using fontDescriptorsInCollection:theSecretCollectionName ?


Duh. In the clear light of morning I can see that com.apple.UserFonts does not refer to fonts in the user's Library/ Fonts folder, but rather to fonts appropriate for the user's language preference. I guess the name of the collection can be obtained like this:


NSString *languageCode = [[NSLocale preferredLanguages] objectAtIndex:0];
NSLocale *locale = [NSLocale currentLocale];
NSString *collectionDisplayName = [locale displayNameForKey:NSLocaleLanguageCode value:];


Sorry for the noise.

Ross
_______________________________________________

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

_______________________________________________

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


References: 
 >Leopard's Font Collection based on user's language (From: Ross Carter <email@hidden>)
 >Re: Leopard's Font Collection based on user's language (From: Ross Carter <email@hidden>)

  • Prev by Date: Re: Uncaught exceptions thrown by Cocoa documented anywhere?
  • Next by Date: Re: In-loop releasing of objects does not free memory?
  • Previous by thread: Re: Leopard's Font Collection based on user's language
  • Next by thread: 10.5.2 broke my open panel code!
  • Index(es):
    • Date
    • Thread