I need to install a new font and use it iPhone.I did the following steps:
Install a Font in Fonts Folder.
Add Font in iPhone project file. test.otf.
Added font name "Fonts provided by application" in Plist file.
I check this font TextEdit. It is working fine, it is not affect in Interface Builder.
If i double click the Label to edit text, font is assigned and displaying with font but it is not displaying in normal mode.
It will not displayed in interface builder. You need to assign that font by code. Something like below.
[UIFont fontWithName:#"Your Font Name" size:20];
Hope this help.
Related
I install above fonts & fonts have added successfully in my Mac System.
I added .ttf font file in .plist for above Fonts as shown in image but font style still not appears correct.
Can any one suggest what kind of mistake I am making OR there is any other issue?
Thanks
The font name is not the same as the font file name, you should see the correct font name in the Font Book(you can search this in Finder), and call the method with the correct font name.
For example:
yourLabel.font = [UIFont fontWithName:#"Capira" size:15];
Need to add Ubuntu Font through .xib , i Mean it should be like in the list for Example Font:Custom Family:Helvetica Style:Regular , Family Should be 'Ubuntu'
OR
Can We Change the system Default Font To Ubuntu.
This behavior is not possible via XIB
If you want to add your custom font through xib --> font property means, it is not possible. But, if you want a label or textfield or etc., with your custom font means we achieve this by sub-classing the respective control i.e, overriding the awakeFromNib. And you need to add your custom font in the .plist file of your project under the key "Fonts provided by application". Like this..
I'm trying to use this font in my app. I've added it to the plist and to the project, but for some reason it is not loading on the label. I've tried to verify the font in the project with:
NSLog(#"DK Crayon Crumble: %#",
[UIFont fontNamesForFamilyName:#"DK Crayon Crumble"]);
But I'm getting this output:
DK Crayon Crumble: ( )
I found the problem. For some reason Xcode it was not copying the font file to the bundle package.
The convention with the built-in fonts (you can select them in Interface Builder) is that you eliminate the spaces and add the attributes after a hyphen, such as
#"HelveticaNeue-Bold"
for Helvetica Neue, Bold.
I don't know the exact name of your font but if you follow this scheme, it should work.
Some times the fonts are visible in the project file but are not actually
added to the target to do so
click on the project's name -> click on target -> Build Phases, go to
'Copy Bundle Ressources', if the concerned font(.ttf extension) file is not there add it to the list.
Clean your Project and run you should be able to see the font.
Maybe the problem is that the name of font is with space. Remove spaces, in real file name, add it again to your plist and try again with code:
[UIFont fontNamesForFamilyName:#"DKCrayonCrumble"];
This link help you to set font:
set custom font
So I'm having a couple of problems actually. The first is that I want to use a "Font Suitcase" file as a custom font in an iOS app and haven't been able to get it to work. Not only that, but I haven't been able to properly use a .ttf file either. Here are the steps that I've taken to try and make it work:
Imported the file into my supporting files in xCode.
Added the file name, e.g. "badaboom.TTF" into the Info.plist file
Called UIFont *myFont = [UIFont fontWithName:#"Badaboom" size:20.0];
I also used the code found here to see if the font was even being loaded and it doesn't appear either. This applies for both ttf and font suitcase files.
Any idea what I'm doing wrong?
Thanks,
Pete
You have to add your fonts as resources.
So do the following steps:
Go to your project settings
Select your target
Go to Build Phases
Add the custom font to Copy Bundle Resources
With this and the code you posted you should now be able to load custom fonts
Double click on the TTF file in Finder. Look at the title bar. The name inside preview has to be exactly the same as what is in your quote [UIFont fontWithName:#"" size:20.0];
It's case sensitive.
I want to add a non-system font to my iPhone/iPad app.
I have added the font file to the project and also added the font to the UIAppFonts property of the info.plist.
To load the font I'm using fontWithName of UIFont. But the name of the font does not seem to be the file name, with or without extension, nor the name that appears in Font Book.
UIFont* font = [UIFont fontWithName:#"What goes here?" size:10];
Where do I find out the name of the font?
UIFont's +familyNames and then +fontNamesForFamilyName: should do the trick.
If you open the ttf file in Font Book on your Mac, the title of the window is the name iOS uses too. (In my case, AvantGarde Bk BT)