Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

iPad Custom Font Issue

BrianSlickBrianSlick Treadmill Desk NinjaPosts: 10,640Tutorial Authors, Registered Users @ @ @ @ @ @ @ @
edited November 2010 in iOS SDK Development
Client has provided some custom font files for an iPad app. I have:

- Added them to the project
fonts_in_project.png

- Included them in info.plist
fonts_in_plist.png

- Declared some constants
#define kClanProNarrowBoldFontName @";ClanPro-NarrowBold"
#define kClanProNarrowBookFontName @";ClanPro-NarrowBook"
#define kClanProNarrowMediumFontName @";ClanPro-NarrowMedium"
#define kClanProNarrowThinFontName @";ClanPro-NarrowThin"

- And built a sample table
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:

ipad_display.png

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

The same fonts displayed in Mail on my Mac:

mail_display.png

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:
NSArray *array = [UIFont fontNamesForFamilyName:@";ClanPro"];
NSLog(@";array is: %@";, [array description]);

...which results in:
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:
...cell 0x4919760 "ClanPro-NarrowBook" (font [B]0x491a550[/B])
...cell 0x4b4a9c0 "ClanPro-NarrowMedium" (font [B]0x491a550[/B])
...cell 0x4b4ade0 "ClanPro-NarrowBold" (font 0x4b4b180)
...cell 0x491fe40 "ClanPro-NarrowThin" (font [B]0x491a550[/B])

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?
Post edited by BrianSlick on
Professional iOS App Development. Available for hire.
BriTer Ideas LLC - WWW | Facebook | Twitter | LinkedIn

BTIKit | BTICoreDataKit | SlickShopper 2 | Leave a PayPal donation
·

Replies

  • BrianSlickBrianSlick Treadmill Desk Ninja Posts: 10,640Tutorial Authors, Registered Users @ @ @ @ @ @ @ @
    edited September 2010
    Well, I guess I'll give this one more shot before I try cocoa-dev.
    Professional iOS App Development. Available for hire.
    BriTer Ideas LLC - WWW | Facebook | Twitter | LinkedIn

    BTIKit | BTICoreDataKit | SlickShopper 2 | Leave a PayPal donation
    ·
  • dalsondalson Posts: 171Registered Users
    edited September 2010
    BrianSlick wrote: »
    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.
    ·
  • OSCOSC Posts: 1New Users
    edited September 2010
    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.
    ·
  • FontanoFontano Posts: 150Registered Users
    edited November 2010
    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.

    <br />
    -) No matter what forum you join, you always start as a newbie. Even if you own the board.<br />
    -) There is no stupid question, if you think it is stupid don't answer it and it will fall of the screen<br />
    -) If you post some helpful sol
    ·
  • BrianSlickBrianSlick Treadmill Desk Ninja Posts: 10,640Tutorial Authors, Registered Users @ @ @ @ @ @ @ @
    edited November 2010
    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.
    Professional iOS App Development. Available for hire.
    BriTer Ideas LLC - WWW | Facebook | Twitter | LinkedIn

    BTIKit | BTICoreDataKit | SlickShopper 2 | Leave a PayPal donation
    ·
  • andresousaandresousa Posts: 1New Users
    Open Font Book application. If you installed the fonts yourself, go to user, look for the fonts you want and use the PostScript name of the font in your xcode project.

    It should work even for different font variations of the same family.
    ·
  • BrianSlickBrianSlick Treadmill Desk Ninja Posts: 10,640Tutorial Authors, Registered Users @ @ @ @ @ @ @ @
    Wow, so you posted in a thread that hasn't been touched in 2 1/2 years, and yet didn't bother providing any new information. Awesome.
    Professional iOS App Development. Available for hire.
    BriTer Ideas LLC - WWW | Facebook | Twitter | LinkedIn

    BTIKit | BTICoreDataKit | SlickShopper 2 | Leave a PayPal donation
    ·
Sign In or Register to comment.