How can I import external arabic and english fonts to my iPhone application ?
Asked
Active
Viewed 461 times
0
-
Do you mean use custom fonts in iOS app? – Toseef Khilji Mar 10 '14 at 09:49
-
you want to add font on xCode, right? – Nirmalsinh Rathod Mar 10 '14 at 09:50
3 Answers
4
For importing Custom fonts in your iOS app
- Add
.TTF
or.OTF
font that you downloaded in your application. - Modify the
plist
file i.e.application-info.plist
file. - Add the key "Fonts provided by application" in a new row.
- and add each
.TTF
or.OTF
file (of font) to each line.
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.
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