I've added a custom TTF font to my iOS universal app (put .ttf file into resources, add the font file name to the info.plist as indicated on other threads here and the Apple dev forum).
I see the font applied to the UILabel's where I set it to, but there's a spacing problem: it appears as if there is a space character typed in between each glyph. When I install the same .ttf file on my mac and use it in an app like TextEdit, there is no such spacing issue.
Any ideas? Could this be a .ttf problem? What parameter would I adjust? Can anyone recommend a TTF editor for the mac?
Or is this a iOS TTF issue perhaps? I really hope I don't have to delve into CoreText and subclass UILabel in order to get this to work (but if I do, any code samples would be appreciated).
thanks for any help!
Looks like it was just a widely-spaced font.
Related
I used Mac OS Font Book to export fonts from it. I got 2 fonts files: Font Suitcase and PostScriptType.
Then I want to use these fonts in my iOS application, but to do that I need to convert them to, for example, ttf. But how?
May be someone faced this problem?
Important:
I don't need advices how to use custom fonts (such as ttf), I need advice how to use Font Suitcase and PostScriptType of fonts (may be how to convert it to ttf)
This solution doesn't require Fondu or Rosetta, but it does involve a little cut-and-paste into macOS's Terminal app.
Pretty simple, and free. And it works on macOS Mojave.
https://sittingduck.co.nz/2013/11/unpacking-the-suitcase/
Try to use these steps.
1) Add your custom font files into your project using Xcode as a resource
2) Add a key to your Info.plist file called "Fonts provided by application".
3) Make this key an array
4) For each font you have, enter the full name of your font file (including the extension) as items to the UIAppFonts array
5) Save Info.plist
6) Now in your application you can simply call [UIFont fontWithName:#"CustomFontName" size:12] to get the custom font to use with your UILabels etc…
Also: Make sure the fonts are in your Copy Bundle Resources.
I'm making an app which uses a custom font (Rockwell.ttf). I have done everything correctly and it works when I am using for UILabels (text only), however, when I try to use it with a UILabel that contains numbers, the font does not work with the numbers.
In finder when I open up the .ttf it shows the text as well as the numbers but as soon as I import it into Xcode, the numbers dissapear and I'm left only with the text! Please help.
try with some other .ttf fonts and check if they show the numbers. This way you can will be able to identify if the problem is with the .ttf font or with the iOS :)
I'm trying to use a custom font (Sassoon Infant) in Xcode. Despite looking at the numerous posts here on this issue, i haven't been able to resolve the problem.
These are the steps i have taken so far.
Added font to resources
Added font to Font Book
Added SassoonInfantCom-Regular.ttf to Fonts Provided by Application
Tried using fontWithName:#"Sassoon Infant Com", the name in Font Book
Also tried just #"Sassoon"
The font name is not showing up in IB either under the dropdown font menu. The above seems to work for most people but i can't get it working. Anyone have any ideas?
Remove the extension .otf / .ttf from the file and the plist.
Also make sure you are editing the correct plist file for the "Fonts provided by application property"! I spent two days trying everything to make some custom fonts work. Then I realised I was editing the APPTest-info.plist (which is in the resources folder of the Tests folder in XCODE) instead of editing the APP-info.plist file!
In my defence, both files are really close to each other in the files navigator in Xcode... ;-)
I just added it into the bundle and did this
myLabel.font = [UIFont fontWithName:#"MyCustomFont" size:19];
MyCustomFont being a .ttf file.
Hope this helps.
Make sure that the font is added to your target. Select the font and check the target membership in the left Xcode sidebar.
Make sure that you got the correct font name. Open the font in "Font Book" and see its name.
I have a UILabel that I've placed in IB. In the inspector I have changed the font to "Papyrus". When I launch the app in the simulator, the font is not Papyrus. How can I change the font?
You can add custom fonts but you need to add them into your .plist file under the key "Fonts provided by application" to a new row.
Fonts must be added to the Resources of the project and TTF and OpenType fonts are supported.
I believe this is only available in iOS 3.2 or later.
Thanks
Not all fonts listed in IB are available on the iPhone as standard. Papyrus is one of those not available on the iPhone.
More here:
http://ajnaware.wordpress.com/2008/10/24/list-of-fonts-available-on-the-iphone/
You can add custom fonts to the iPhone, but I'd think hard before doing that -- if you're putting a weird looking font onto normal UI items, ask yourself if it actually looks any good! I've seen some real eyesore apps where someone thought it would be cute to put some crime against typography on all the UI controls.
Is it possible to use UIButtons with my own true type font? I found the FontLabel open source that can use ttf with UILabels, but unfortunately I can't set my UIButton's titleLabel to a created FontLabel. Can someone offer a simple solution to this? Or should I just not be using UIButtons altogether and instead use something else? I feel like I'm missing something obvious because I can't imagine there wouldn't be some truetype functionality in some default button offering.
As of the 3.2 SDK, you can include your own ttf fonts in your app. Just include the font file in your bundle and add the UIAppFonts key to your info.plist. (http://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html#//apple_ref/doc/uid/TP40009252-SW18)
You should then be able to create the font as you would any built-in font and use it as the font for your button's label.
For those of you having this problem and looking for a workaround, this worked for me (link to a question I posed and later answered):
Advice on Debugging a UIAppFonts Issue on iPad