0

How can I import external arabic and english fonts to my iPhone application ?

Volker
  • 4,640
  • 1
  • 23
  • 31
Mhmd Backer Shehadi
  • 559
  • 1
  • 12
  • 30

3 Answers3

4

For importing Custom fonts in your iOS app

  1. Add .TTF or .OTF font that you downloaded in your application.
  2. Modify the plist file i.e. application-info.plist file.
  3. Add the key "Fonts provided by application" in a new row.
  4. and add each .TTF or .OTF file (of font) to each line.

Info.plist Screen Shot

and then in your label or textfield

yourLabel.font = [UIFont fontWithName:@"YOUR_FONT" size:15];
fabian789
  • 8,348
  • 4
  • 45
  • 91
Himanshu Joshi
  • 3,391
  • 1
  • 19
  • 32
1

Add font file in your xcode project.Then add fontfile name in .plist file in "Fonts provided by application"

You can get all the font names with this

  NSArray *familyNames = [[NSArray alloc] initWithArray:[UIFont familyNames]];
    NSArray *fontNames;
    NSInteger indFamily, indFont;
    for (indFamily=0; indFamily<[familyNames count]; ++indFamily)
    {
        NSLog(@"Family name: %@", [familyNames objectAtIndex:indFamily]);
        fontNames = [[NSArray alloc] initWithArray:
                     [UIFont fontNamesForFamilyName:
                      [familyNames objectAtIndex:indFamily]]];
        for (indFont=0; indFont<[fontNames count]; ++indFont)
        {
            NSLog(@"Font name: %@", [fontNames objectAtIndex:indFont]);
        }

    }
Surender Rathore
  • 845
  • 8
  • 18
1

You have to introduce the font names in the info.plist file. You have to write font names like image below

Then you have to use a Global class which is a NSOBject type.

In Globals.h file write

 @interface Globals : NSObject 


{

}

#define         SegoeRegular14         [UIFont fontWithName:@"Segoe UI" size:14];

Now you can use the font anywhere you want

_titleLabel.font = SegoeRegular14;

I hope it will do for you. All the best .

Mahboob Nur
  • 739
  • 2
  • 9
  • 34
  • It would be much nicer to do a [category](https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/CustomizingExistingClasses/CustomizingExistingClasses.html) on `UIFont` and then be able to do `[UIFont sogoeRegularWithSize:14]`. – fabian789 Mar 10 '14 at 12:18
  • SeguiRegular font is not available in the X-Code system font. So in order to add new font its better to implement like this. – Mahboob Nur Mar 10 '14 at 12:51
  • Yes but you could use a category to make the use of the font nicer: https://gist.github.com/anonymous/9464542 – fabian789 Mar 10 '14 at 12:54