Custom font for iPad - iOS 3.2 isn't working
Asked Answered
I

2

0

I'm building an iPad-Only application. I need to use a custom font with some labels, so I added them to my project. They appear in my application target for "Copy Bundle Resources". I also added their names to my App's -Info.plist file:

<key>UIAppFonts</key>
<array>
    <string>font1.ttf</string>
    <string>font2.ttf</string>
    <string>font3.ttf</string>
    <string>font4.ttf</string>
</array>

Even so, when I try to set the font of my labels, it seems to just use the default. I haven't been able to figure out how to overcome this issue. Any assistance would be greatly appreciated.


Edit:

- (void)debug {
    NSLog(@"fonts: %@", [UIFont familyNames]);
    UIFont *f1 = [UIFont fontWithName:@"Helvetica" size:20];
    UIFont *f2 = [UIFont fontWithName:@"font1" size:5];
    NSLog(@"f1:%@ f2:%@", f1, f2);
}

And the output: http://pastie.org/1323195

Inspiratory answered 24/11, 2010 at 15:57 Comment(1)
Changing the simulator version to 4.1 from 3.2 causes the same output.Inspiratory
I
0

The solution ended up being to use a different font. I opened the font with FontForge and got this warning:

This font is marked with an FSType of 2 (Restricted License). That means it is not editable without the permission of the legal owner.

This seems to be the cause of my issues. I downloaded a free version of the font I was trying to use (luckily it was available for free) and everything started working perfectly.

Inspiratory answered 24/11, 2010 at 20:41 Comment(0)
F
0

How are you setting the font?

You need to use it as follows....

UIFont *myCustomFont = [UIFont fontWithName:@"font1" size:30];
Fleischman answered 24/11, 2010 at 16:3 Comment(0)
I
0

The solution ended up being to use a different font. I opened the font with FontForge and got this warning:

This font is marked with an FSType of 2 (Restricted License). That means it is not editable without the permission of the legal owner.

This seems to be the cause of my issues. I downloaded a free version of the font I was trying to use (luckily it was available for free) and everything started working perfectly.

Inspiratory answered 24/11, 2010 at 20:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.