Custom font fails to show in iOS - ios

I 've a ttf file which symbols inside. It's found in iOS via the .plist file, it's enumerated in [UIFont familyNames] and it's loaded in [UIFont fontWithName].
However the label still shows normal text and numbers, where it should show symbols. Could it there be some incompatibility between my font and iOS?
Best regards.
Edit: I converted the fonts to OTF and it works. What could be the problem with TTF ?

Related

Setting up my downloaded font to bold

I have a label displaying a title in a view, I'm trying to setup my font to bold, I've downloaded and installed this font, it isn't a default font like some fonts that are included in xCode I've tried with some methods but isn't work just work with the default fonts so I want to know if there's a method that I could work with to make this possible, the font that I downloaded and installed is "Gotham Rounded
Thanks
Make sure that your TTF file is added as an embedded resource in your project and its entry is also added in .plist file under supported fonts key Fonts provided by application.
Also your TTF should have the bold interface as well to support bold font display.

Codename One : Text not showing using Roboto or Keep Calm Medium font on iOS

I am using different fonts in my Codename One app. If I include and use Roboto-Bold.ttf or Oswald font from Google fonts or Keep Calm Medium from dafont.com the text is displayed on Android and Codename One Simulator (as reported on this SO question) but NOT on iOS (neither on the device nor on XCode device) although the fonts are packaged in the .ipa generated by Codename One.
I tried with style = PLAIN or BOLD with the same results.
I used font = Font.createTrueTypeFont(fontName, fontFilename ).derive(fontSize, style);
Why are some fonts working while other aren't? Is there any way to know before compilation which fonts are more likely to work on iOS?
iOS and Android use very different approaches to dealing with fonts which we try to simplify with a simple method.
If you define the font in the designer with a UIID we can hide most of that complexity for you but when you load the font dynamically you are exposed to some of that.
Android just loads font files so the file is used and this should work easily like the simulator. iOS needs the fonts to be installed and then loaded by font name (which isn't the file name and isn't very intuitive). This stack overflow question discusses the method of getting the font name on a Mac: How do I get the font name from an otf or ttf file?

Font issue in setting in UILabel iOS

I am using custom fonts in my iOS App. Two of the fonts named quicksand_bold.ttf and quicksand_book.ttf are causing issue. All of the other fonts are working perfectly fine but this QuickSand font is not appearing as the two different types in the fonts,
neither is is showing different styles
both the files have been imported properly and the target is also set for them. Also the names of the fonts are added in the info.plist. Can anyone point out something I am missing or something I should do to get them both work. All the other fonts are working perfectly fine as they should.
UPDATE
Here are the screenshots of the info.plist and the font names from the projects
By getting a hint from #sneha's comment, I checked the names of these two fonts, both were the same. I installed the fonts in my MacBook rather then importing them to my project, restarted my xcode then i found these two in the storyboard with the same name and two different styles (Book and Bold).
For using these fonts programmatically i used NSLog to figure out the names of the font and the names are QuicksandBook-Regular and QuicksandBold-Regular.
So you can programmatically set these as
myLabel.font = [UIFont fontWithName:#"QuicksandBook-Regular" size:12.0];
and
myLabel.font = [UIFont fontWithName:#"QuicksandBold-Regular" size:12.0];

Why does Xcode have fonts that do not show up in UIViews in xib or storyboard?

Trying to style my UILabel, in Attributes Inspector I set the font of my attributed text to Apple Chancery. In the preview window it shows correctly, but in the UIView itself the font is not applying. And when I try running the device just in case, the font still does not show. If I change the font to something else, this "something else" shows. So is there a known problem with iPhone simulators and devices not showing certain fonts that are in fact available in Xcode? I am using Xcode-6
Xcode displays fonts found in the Mac, not on the actual iOS device. Before selecting a font, you should make sure it is available on iOS devices.
Sites such as http://iosfonts.com/ or even trial and error can help.
Apple Chancery is only present in Mac OS X, but you can load ttf programmatically (see Google for the ttf) :
(I don't know if you are allowed to use this font via ttf, see the font license)
Copy the ttf to your Xcode project
Link your UILabel to your source code
Then, set custom font :
[myLabel setFont: [UIFont fontWithName:#"Apple Chancery" size:15]];

Custom font from Google Fonts doesn't work in iOS app

I'm trying to install a custom font (Open Sans from Google Fonts) and I did everything as some tutorials say and no success. I followed these steps and I can't use the custom font:
http://www.practicalentrepreneur.com/how-to-use-a-custom-font-in-xcode-4-5-ios-6-0/
I imported the .tff file to my project
Associated the file with my target
Added the reference in the plist file
Also added the font in the Font Book app
Clean, build and run
When I try to list the available fonts with this command:
NSLog(#"fontFamilies: %#", [UIFont familyNames]);
I don't get my imported font family printed.
I already tried some tips from these questions but nothing works:
xcode custom ttf font not working
Added custom font not working in Xcode
OpenSans font not working in iOS simulator
Custom font in a storyboard?
Thanks!
In the plist file you should insert the font with the name provided in the Font Book app.
In my case, the name of the font in the app is Chalet Comprime Cologne Sixty, but when i call it in code i have to call it like this
label.font = [UIFont fontWithName:#"ChaletComprime-CologneSixty" size:24.0];
So...try looking at the name of your font in the Font Book app.

Resources