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];
Related
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 '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 ?
I am trying to use a custom font called Hartland in my project. This font has two types: Hartland regular and Hartland bold.
On my iPhone 5s, the available font names are "HartlandRegular" and "HartlandLight"
But on my iPhone 4s the font names are "HartlandBold" and "HartlandRegular"
Even stranger, the font name "HartlandRegular" for one phone is the bold version on the other. To my knowledge I have successfully installed the fonts, but the names are inconsistent on different devices
Why are the fonts getting different names and how can I fix this?
I believe your issue actually has more to do with the latest iOS. You should be able to select the correct font using the interface builder - on older versions of xcode and iOS you used to have to set this with code.
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]];
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.