Reputation: 10264
I am trying to embed a custom font in my application.
I have included the Font file in my project
I added the key to the .plist
I added the font to the target
Result of:
NSLog(@"Fonts: %@", [UIFont familyNames]);
Fonts: (
Thonburi,
"Snell Roundhand",
"Academy Engraved LET",
Avenir,
"Marker Felt",
"Geeza Pro",
"Arial Rounded MT Bold",
"Trebuchet MS",
Arial,
Marion,
"Gurmukhi MN",
"Malayalam Sangam MN",
"Bradley Hand",
"Kannada Sangam MN",
"Bodoni 72 Oldstyle",
Cochin,
"Sinhala Sangam MN",
"Hiragino Kaku Gothic ProN",
Papyrus,
Verdana,
"Zapf Dingbats",
"Avenir Next Condensed",
Courier,
"Hoefler Text",
Helvetica,
"Euphemia UCAS",
"Hiragino Mincho ProN",
"Bodoni Ornaments",
"Apple Color Emoji",
Optima,
"Gujarati Sangam MN",
"Devanagari Sangam MN",
"Times New Roman",
Kailasa,
"Telugu Sangam MN",
"Heiti SC",
"Apple SD Gothic Neo",
Futura,
"Bodoni 72",
Baskerville,
"Chalkboard SE",
"Heiti TC",
Copperplate,
"Party LET",
"American Typewriter",
Symbol,
"Avenir Next",
Noteworthy,
"Bangla Sangam MN",
Zapfino,
"Tamil Sangam MN",
Chalkduster,
"Arial Hebrew",
Georgia,
"Helvetica Neue",
"Gill Sans",
Palatino,
"Courier New",
"Oriya Sangam MN",
Didot,
"Bodoni 72 Smallcaps"
)
My font is not listed there, this is the code I am using:
[UIFont fontWithName:@"KozGoPr6N-Regular.ttf" size:self.LabelEmail.font.pointSize];
Using the above code the font's size does not always change, just some of the times.
IE, when I replace self.LabelEmail.font.pointSize with 0.20 the size stays exactly the same, the label is wired up as an IBOutlet from IB and the font is set in IB as 14 points
Upvotes: 2
Views: 2513
Reputation: 22948
[UIFont fontWithName:@"KozGoPr6N-Regular.ttf" size:self.LabelEmail.font.pointSize];
First of all, I'm pretty sure that ".ttf" is not part of the (internal) font name.
The code should look like this:
[UIFont fontWithName:@"KozGoPr6N-Regular" size:self.LabelEmail.font.pointSize];
Second, did you convert this font yourself from OpenType (.otf) to TrueType (.ttf)? (I did a quick search on my machine and this font is present, but it's an OpenType font installed in /Library/Fonts/).
Upvotes: 1