I want to use HelveticaNeue-UltraLight in my ios application. I\'m adding the font file as a resource to my project and adding the \"Fonts provided by application\" key in t
In order to use custom fonts in iOS, just add your fonts by drag & drop to your project. Mention the array of font names with extension in Info.plist with key "Fonts provided by application". Then print all font family names using below code :
for (NSString* family in [UIFont familyNames])
{
DebugLog(@"FONT FAMILY: %@", family);
for (NSString *name in [UIFont fontNamesForFamilyName: family])
{
DebugLog(@" %@", name);
}
}
Console print :
Arial Hebrew ArialHebrew-Bold ArialHebrew-Light ArialHebrew
Calibri Calibri-Bold Calibri
Georgia Georgia-BoldItalic Georgia-Bold Georgia-Italic Georgia
Then from console, you will get the actual font-names (As above). Use below code to create font -
In core text :
CTFontRef fontRef = CTFontCreateWithName((CFStringRef)fontName, fontSize, NULL);
In UIKit :
UIFont *font = [UIFont fontWithName:fontName size:10];
Note : here fontName = @"Calibri-Bold" is without extension.