Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 09-21-2010, 02:38 PM   #1 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default iPad Custom Font Issue

Client has provided some custom font files for an iPad app. I have:

- Added them to the project


- Included them in info.plist


- Declared some constants
Code:
#define kClanProNarrowBoldFontName @"ClanPro-NarrowBold"
#define kClanProNarrowBookFontName @"ClanPro-NarrowBook"
#define kClanProNarrowMediumFontName @"ClanPro-NarrowMedium"
#define kClanProNarrowThinFontName @"ClanPro-NarrowThin"
- And built a sample table

Code:
switch ([indexPath row])
{
   case 0:
      [[cell textLabel] setText:kClanProNarrowBoldFontName];
      [[cell textLabel] setFont:[UIFont fontWithName:kClanProNarrowBoldFontName size:18.0]];
      break;
   case 1:
      [[cell textLabel] setText:kClanProNarrowBookFontName];
      [[cell textLabel] setFont:[UIFont fontWithName:kClanProNarrowBookFontName size:18.0]];
      break;
   case 2:
      [[cell textLabel] setText:kClanProNarrowMediumFontName];
      [[cell textLabel] setFont:[UIFont fontWithName:kClanProNarrowMediumFontName size:18.0]];
      break;
   case 3:
      [[cell textLabel] setText:kClanProNarrowThinFontName];
      [[cell textLabel] setFont:[UIFont fontWithName:kClanProNarrowThinFontName size:18.0]];
      break;
   case 4:
      [[cell textLabel] setText:@"Normal"];
      break;
   default:
      break;
}
However, this is the result:



The result is the same in the simulator and on the device.

The same fonts displayed in Mail on my Mac:



As you can see, the four fonts are distinct. But for some reason, the iPad is displaying 3 of them the same. And the font has been applied, but the line weight is not correct.

I have shared these font files with another developer, and he observed the same results. So I do not currently have a reason to believe it is an issue with setup, file names, etc.

In order to verify that the font names are correct, I did this:

Code:
NSArray *array = [UIFont fontNamesForFamilyName:@"ClanPro"];
NSLog(@"array is: %@", [array description]);
...which results in:

Code:
array is: (
    "ClanPro-NarrowBook",
    "ClanPro-NarrowBold",
    "ClanPro-NarrowMedium",
    "ClanPro-NarrowThin"
)
...which is the same as the strings I'm already using. So no apparent issue there. And the OS clearly knows that I have four distinct styles in this font family.

The other developer conducted a test of the UIFont objects that get created, and here is what he found:

Code:
...cell 0x4919760 "ClanPro-NarrowBook" (font 0x491a550)
...cell 0x4b4a9c0 "ClanPro-NarrowMedium" (font 0x491a550)
...cell 0x4b4ade0 "ClanPro-NarrowBold" (font 0x4b4b180)
...cell 0x491fe40 "ClanPro-NarrowThin" (font 0x491a550)
3 of them are the same object. This would explain why 3 of them display the same.

However, that doesn't help me with what to do about it. Mail, FontBook, etc. everything on my Mac shows 4 distinct fonts. This would suggest that either the font files themselves are fine, or Mac OS is more lenient about what it can handle. What can I do to get them to display correctly on the iPad?
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.

Last edited by BrianSlick; 09-21-2010 at 02:43 PM.
BrianSlick is offline   Reply With Quote
Old 09-22-2010, 07:39 PM   #2 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

Well, I guess I'll give this one more shot before I try cocoa-dev.
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 09-22-2010, 08:55 PM   #3 (permalink)
Registered Member
 
Join Date: Jul 2009
Posts: 171
dalson is on a distinguished road
Default

Quote:
Originally Posted by BrianSlick View Post
Well, I guess I'll give this one more shot before I try cocoa-dev.
Wish I could help out. Please report back if you find anything out.
dalson is offline   Reply With Quote
Old 09-23-2010, 04:59 AM   #4 (permalink)
OSC
Registered Member
 
Join Date: Sep 2010
Posts: 1
OSC is on a distinguished road
Default

Not really sure if this would help.
But after a couple of days of experimenting.
I've found that it's a limitation that only 2 variants of a single font face is supported.
OSC is offline   Reply With Quote
Old 11-02-2010, 03:43 PM   #5 (permalink)
Tylenol is my friend
 
Join Date: Oct 2008
Location: Midwest
Posts: 150
Fontano is on a distinguished road
Default

Did you happen to find anything out about this.

I just ran into the identical issue today as well, with a different font family, but 4... with the identical results.
__________________
-----
-) No matter what forum you join, you always start as a newbie. Even if you own the board.
-) There is no stupid question, if you think it is stupid don't answer it and it will fall of the screen
-) If you post some helpful solution, then that could lead to more helpful solutions. Soon, it is a chain reaction and then the forum becomes a monumental programming resource.
Fontano is offline   Reply With Quote
Old 11-02-2010, 07:27 PM   #6 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

No solution found at this point. I tried renaming a couple of the font files, but that did not work. I've been getting away with using only 2 of the fonts so far.
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Reply

Bookmarks

Tags
ipad, uifont

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 347
14 members and 333 guests
2ndSegment, cgokey, djohnson, Domele, Hamad, linkmx, markuschow, mistergreen2011, Objective Zero, pungs, revg, Sloshmonster, v1n2e7t
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,655
Threads: 94,116
Posts: 402,889
Top Poster: BrianSlick (7,990)
Welcome to our newest member, pungs
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 11:04 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0