I'm developing a game and I would like to use a custom font in my app. I'm using SpriteKit for it, if that's important. I've tried using this https://github.com/deni2s/IBCustomFonts but I cannot get it to work with this font http://www.fontspace.com/freaky-fonts/emulogic
I've tried various things, and I've registered the font on the info.plist of the app... Does anyone know what's going on?
You can download fonts from the App Store app , then use them in documents you create on iPhone. After you download an app containing fonts from the App Store, open the app to install the fonts. To manage installed fonts, go to Settings > General, then tap Fonts.
In Pages, tap the paintbrush icon at the top and select the name of the current font from the formatting pane at the bottom. Browse through the list of fonts and you should see both the built-in system fonts and the custom fonts you installed. Tap the font you want to use and then close the formatting pane.
iOS 7 uses Helvetica Neue Ultralight font but you can also download the font icons.
First of all I'm assuming that SpriteKit doesn't make any difference.
Finally, you would like to list all your fonts when the app starts just to see useable name for your font. You will do that with this little piece of code:
NSArray *fontFamilies = [UIFont familyNames]; for (int i = 0; i < [fontFamilies count]; i++) { NSString *fontFamily = [fontFamilies objectAtIndex:i]; NSArray *fontNames = [UIFont fontNamesForFamilyName:[fontFamilies objectAtIndex:i]]; NSLog (@"%@: %@", fontFamily, fontNames); }
Search for your font in printed results, for example, I would search for "Josefin" and I would see that actual font name is "JosefinSansStd-Light". After that you only need to use that font by:
UIFont *customFont = [UIFont fontWithName:@"JosefinSansStd-Light" size:20];
In iOS8 you add your fonts directly to the project and they are visible in the interface builder. Modify your code to account for this but programmatically setting font for iOS7 and selecting it in xCode6 interface builder. PS. Interface builder in xCode6 gives you the correct font name that you can copy-paste into the code below.
#define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending) if(SYSTEM_VERSION_LESS_THAN(@"8.0")) { UIFont *customFont = [UIFont fontWithName:@"OpenSans-Light" size:32]; self.registerLabel.font = customFont; }
Hope this helps, cheers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With