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.
Related
I have added the font files to my xcode project and have added it to info.plist
Font File
Info.plist
I have also added the membership
Target Membership
I have also added it to my mac font book
Mac Font Book
The custom font is not showing in font list
Font List
I have also tried using attributed text and I have found the font style, the style is used in the example but not on the app.
Attributed Text not showing in app
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.
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];
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 ?
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]];