Re: Getting displayName out of font file
Re: Getting displayName out of font file
- Subject: Re: Getting displayName out of font file
- From: Eric Dolecki <email@hidden>
- Date: Fri, 26 Feb 2016 23:23:03 +0000 (UTC)
I've used that dump fonts method before there was iosfonts.com to help. I haven't tried that in agrees but seems like it should do the trick.
Sent from Outlook on my phone.
On Fri, Feb 26, 2016 at 11:23 AM -0800, "Alex Zavatone" <email@hidden> wrote:
Hopefully, one of these will help.
#pragma mark - Font Util
//
- (void)dumpFonts {
for (NSString* family in [UIFont familyNames]) {
NSLog(@"Font Family = %@", family);
for (NSString* name in [UIFont fontNamesForFamilyName: family]) {
NSLog(@"Font Name = %@", name);
}
}
}
// Ye olde schoole codee
- (void)dumpFontsx {
// List all fonts on iPhone
NSArray *familyNames = [[NSArray alloc] initWithArray:[UIFont familyNames]];
NSArray *fontNames;
NSInteger indFamily, indFont;
for (indFamily=0; indFamily<[familyNames count]; ++indFamily)
{
NSLog(@"Family name: %@", [familyNames objectAtIndex:indFamily]);
fontNames = [[NSArray alloc] initWithArray:
[UIFont fontNamesForFamilyName:
[familyNames objectAtIndex:indFamily]]];
for (indFont=0; indFont<[fontNames count]; ++indFont)
{
NSLog(@" Font name: %@", [fontNames objectAtIndex:indFont]);
}
}
}
On Feb 26, 2016, at 2:17 PM, Alex Zavatone wrote:
> I've got this somewhere for iOS, I think. Give me a sec and I'll dig it up.
>
> On Feb 26, 2016, at 5:16 AM, Gerriet M. Denkmann wrote:
>
>> I have a file “Some Font.ttf” and I want to know the displayName of this font, which might be “Some-Font” or “Nice Font” or anything else.
>> Or nil if this is not a well-formatted font file.
>> I do NOT want to install the font nor do anything with it.
>>
>> Short of reverse-engeneering the ttf format (which probably would be rather too much): is there a way to get this?
>>
>> Ideally I would line to do:
>> NSFont *font = [ NSFont fontFromFilePath: @“/path/to/Some Font.ttf” ];
>> NSString *displayName = font.displayName; // font.fontName would probably also do
>>
>> but this seems not to exist.
>>
>> 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
_______________________________________________
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