2

I just added a new font in my project and follow the steps below, but it doesn't recognized when running in simulator and also in device.

http://i.imgur.com/JgqeuEF.png

I JUST DID THESE STEPS TO ENSURE THAT THE FONT WILL IDENTIFY BUT NO CHANCE

  • Add Font file in my project in Xcode
  • Also add in plist file using the key - "Fonts provided by application” with type “Array”

http://i.imgur.com/ePVWUdZ.png

  • Making sure that it is included as Resources in my bundle

http ://i.imgur .com/Rs10jHq.png

  • Font names also log when I put this snippet to really check:

    for (NSString* family in [UIFont familyNames])
    {
        NSLog(@"%@", family);
    
        for (NSString* name in [UIFont fontNamesForFamilyName: family])
        {
            NSLog(@"  %@", name);
        }
    }
    

So, what am I missing?

Jaffer Wilson
  • 7,029
  • 10
  • 62
  • 139
Pepeng Hapon
  • 357
  • 1
  • 17
  • Your post seems to contradict itself. You say the font isn't recognized but you also claim the font shows up in the log with the code you posted. Which is it? Where are you actually having an issue? – rmaddy Jul 03 '15 at 04:30
  • you can see in simulator in the first screenshot that the font is not the same as in storyboard – Pepeng Hapon Jul 03 '15 at 04:32
  • @PepengHapon I face this same issue with custom fonts. Remove for wR X hR and run it, it is working with same fonts in all device. But we set different size custom fonts for different size devices in xib or storyboard, it is not working.. – DharaParekh Jul 03 '15 at 05:30
  • Just Assign the font to that text in code. for example `titleLabel.font = [UIFont fontWithName:@"Roboto condensed" size:17.0];` – Balaji Ramakrishnan Jul 03 '15 at 05:36
  • I face this same problem from last 20 days, but no result found. This issue is only with custom fonts. So, I set fonts programmatically 1. Create object of label or button and IBOutlet it 2. put condition for different devices and set fonts in that condition like this if (g_IS_IPAD) cell.textLabel.font = [UIFont fontWithName:@"Montserrat-Bold" size:20]; – DharaParekh Jul 03 '15 at 05:38
  • @rmaddy do you know any solution for that using xib or story board not programmatically. – DharaParekh Jul 03 '15 at 05:40
  • If you anyone get the solution for this... Please post answer in this – DharaParekh Jul 03 '15 at 05:40

2 Answers2

2

@DharaParekh - I've found a solution for this one enter image description here

Source: Custom Font Sizing in XCode6 Size Classes Not Working Properly w/ Custom Fonts

Community
  • 1
  • 1
Pepeng Hapon
  • 357
  • 1
  • 17
0
for (NSString* family in [UIFont familyNames])
{
    NSLog(@"%@", family);

    for (NSString* name in [UIFont fontNamesForFamilyName: family])
    {
        NSLog(@"  %@", name); //copy the fontname which you want 
    }
}

I think you need to copy the font name and past here.

titleLabel.font = [UIFont fontWithName:@"" size:17.0]; 

and its work.

Daxesh Nagar
  • 1,405
  • 14
  • 22