FROM : Aki Inoue
DATE : Fri Aug 04 19:07:50 2006
Fredrik,
It's unclear your intention here. The font's fullname (accessible
via -displayName) is coming from an independent entry in the font's
name database independent from other names such as family names. In
other words, font designers are free to have names that don't conform
to the rule you're using here to derive the font name (and there are
tons of irregular fonts out there).
What's your intended use of the derived name ?
Aki
On Aug 4, 2006, at 7:18 AM, Fredrik Olsson wrote:
> Shawn Erickson skrev:
>>
>> On Aug 4, 2006, at 6:35 AM, Fredrik Olsson wrote:
>>
>>> displayName for NSFont instances returns a localized name (As the
>>> docs says). I have tried to use NSFontDescriptor to get the non-
>>> localized name (As in English), but none of the font attributes I
>>> have tried gives an obvious answer.
>>>
>>> Am I peeking the right places, or should I take the result of
>>> fontName and run it through some localizer forcing it to english,
>>> and how would I do that?
>>
>> It isn't clear exactly what you want but did you look at the
>> following?
>>
>> -[NSFont familyName] or -[NSFont fontName]
>>
> Yes I did, hey boh do not give quite what I want. displayName can
> forexample give "Arial Fet" (Localized to Swedish) when I expect
> "Arial
> Bold". I am no font expert, but it looks to me that displayName
> returns
> the fonts family and optionally append face if present.
>
> So I whipped up this little solution:
>
> - (id)_plainFontNameForFont:(NSFont *)font
> {
> NSString *family = [font familyName];
> NSString *face = [[font fontDescriptor]
> objectForKey:NSFontFaceAttribute];
> if (face) {
> return [NSString stringWithFormat:@"%@ %@", family, face, nil];
> }
> return family;
> }
>
> Is this a legal solution, or does it just happen to work on the test
> cases I have came up with?
>
>
> // Fredrik Olsson
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (<email_removed>)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>
> This email sent to <email_removed>
DATE : Fri Aug 04 19:07:50 2006
Fredrik,
It's unclear your intention here. The font's fullname (accessible
via -displayName) is coming from an independent entry in the font's
name database independent from other names such as family names. In
other words, font designers are free to have names that don't conform
to the rule you're using here to derive the font name (and there are
tons of irregular fonts out there).
What's your intended use of the derived name ?
Aki
On Aug 4, 2006, at 7:18 AM, Fredrik Olsson wrote:
> Shawn Erickson skrev:
>>
>> On Aug 4, 2006, at 6:35 AM, Fredrik Olsson wrote:
>>
>>> displayName for NSFont instances returns a localized name (As the
>>> docs says). I have tried to use NSFontDescriptor to get the non-
>>> localized name (As in English), but none of the font attributes I
>>> have tried gives an obvious answer.
>>>
>>> Am I peeking the right places, or should I take the result of
>>> fontName and run it through some localizer forcing it to english,
>>> and how would I do that?
>>
>> It isn't clear exactly what you want but did you look at the
>> following?
>>
>> -[NSFont familyName] or -[NSFont fontName]
>>
> Yes I did, hey boh do not give quite what I want. displayName can
> forexample give "Arial Fet" (Localized to Swedish) when I expect
> "Arial
> Bold". I am no font expert, but it looks to me that displayName
> returns
> the fonts family and optionally append face if present.
>
> So I whipped up this little solution:
>
> - (id)_plainFontNameForFont:(NSFont *)font
> {
> NSString *family = [font familyName];
> NSString *face = [[font fontDescriptor]
> objectForKey:NSFontFaceAttribute];
> if (face) {
> return [NSString stringWithFormat:@"%@ %@", family, face, nil];
> }
> return family;
> }
>
> Is this a legal solution, or does it just happen to work on the test
> cases I have came up with?
>
>
> // Fredrik Olsson
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (<email_removed>)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>
> This email sent to <email_removed>
| Related mails | Author | Date |
|---|---|---|
| Fredrik Olsson | Aug 4, 15:35 | |
| Shawn Erickson | Aug 4, 15:54 | |
| Fredrik Olsson | Aug 4, 16:18 | |
| Shawn Erickson | Aug 4, 16:22 | |
| Shawn Erickson | Aug 4, 16:26 | |
| Aki Inoue | Aug 4, 19:07 | |
| Fredrik Olsson | Aug 7, 08:35 | |
| Aki Inoue | Aug 7, 21:30 |






Cocoa mail archive

