Re: How to find unencoded characters
Re: How to find unencoded characters
- Subject: Re: How to find unencoded characters
- From: Matt Gough <email@hidden>
- Date: Tue, 01 Mar 2011 08:59:06 +0000
>> But as the font name "LastResort" is nowhere documented (or is it?), Apple is free to change it to "LionsLastResort" this summer.
http://developer.apple.com/fonts/LastResortFont/
I doubt they'd rename it, seems they just extend it as necessary:
http://en.wikipedia.org/wiki/Fallback_font#Apple.27s_LastResort_font
Matt
On 1 Mar 2011, at 08:49, Gerriet M. Denkmann wrote:
>
> On 28 Feb 2011, at 19:36, email@hidden wrote:
>
>> There are quite a few characters, which OS X cannot print.
>> E.g. ›« ≈ 0x2b809 (CJK Unified Ideographs Extension D)
>>
>> I would like to have a function or method like:
>> BOOL myComputerCanDisplayThisUnicodeCodePoint( unsigned int codePoint);
>>
>> How can I get this information?
>
> To answer my own question: this code seems to work:
>
> + (BOOL)weCanDisplayTheFirstCharacterIn: (NSString *)aString ;
> {
> NSRange oneChar = [ aString rangeOfComposedCharacterSequenceAtIndex: 0 ];
> NSString *firstChar = [ aString substringWithRange: oneChar ];
> NSMutableAttributedString *attributedString = [ [ NSMutableAttributedString alloc ] initWithString: firstChar ];
> [ attributedString fixFontAttributeInRange: NSMakeRange(0,1) ];
> NSFont *aFont = [ attributedString attribute: NSFontAttributeName atIndex: 0 effectiveRange: NULL ];
> NSString *fontName = [aFont fontName];
> [ attributedString release ];
> //NSLog(@"%s \"%@\" → %@",__FUNCTION__, firstChar, fontName);
> BOOL weCan = ![ fontName isEqualToString: @"LastResort" ];
> return weCan;
> }
>
> But as the font name "LastResort" is nowhere documented (or is it?), Apple is free to change it to "LionsLastResort" this summer.
> Also, this method does not look too efficient.
>
> So: is there an efficient, non-hackish way to get this information?
>
> 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
_______________________________________________
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