Objective-c font names are different on different devices - ios

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.

Related

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?

where is STHeitiSC in XIB?Is it deprecated?

I try to custom fonts like I used to do in XIB,after upgrade Xcode to 7 ,
I cannot find STHeitiSC in the font list?
Is it deprecated?
Sadly, it is no longer a supported IB font. See my issues with it here : Xcode 7 iOS9 font no longer recognized
This font is usually reserved and intended only for Chinese text. However, you can still import the font to your project, add it to your plist and perform accordingly as any other custom font would.

Customize system fonts with size and attributes for iOS

In my app I need to support iOS since iOS 7. As you know iOS 9 uses new system font "San-Francisco".
Is it possible some how to use system font (to make native font for operation system) with setting size and attributes like Light, Medium, Bold, Italic, etc?
I found only one solution to hard code font name as for iOS 9 use "San-Francisco" and for less use "HelveticaNueue".
Maybe some one know a better solution.

Custom font rendering in iOS versus Mac OS X

I'm trying to render a simple UITextView in a custom font in my iOS app. This font is for the Urdu language and I specifically need the stylized look of the characters.
I'm certain that I've followed all requisite steps correctly (the .ttf file's target membership, info.plist entry, finding out and using the right font name etc.), since I confirmed this by logging:
NSLog(#"%#", poem.font.fontName);
where *poem is my UITextView.
The strange thing is that when I install this font on my Mac and type in the same text in text-edit, the font renders as it should.
Mac OS screenshot:
Simulator/iOS Device screenshot:
Any explanation?
You can simply use UITextView, but instead of using the text property, use the attributedText property to set the text. That should do the trick, in iOS 7+.
If you want to support iOS 6 or earlier, use CoreText.

Papyrus font exists on iPad but not iPhone

My app uses papyrus font.
In the iPad simulator it works perfectly. In both of the iPhone simulators (standard and retina) it doesn't seem to have this font. It just uses a stock system font.
I have just tested on both an iPhone and an iPad, and the results identical to the simulator.
What is the deal here? is there any workaround? Can I package this font with the app? If so, how?
As a related issue, this papyrus font refuses to display unusual characters. I require for example ∫ and ŋ. These get displayed in a stock system font. I guess the font doesn't have symbols for extended Unicode characters... what is my best bet?
The iPhone and iPad ship with different sets of fonts, which is a bit strange. If you want to bundle this font with your app, you will need to obtain a licence to do so from one of the foundries that distribute it.
As for other characters, you're correct---the Papyrus font only supports characters used in European languages. If you don't like the system's default fall-back font, you will need to supply another.

Resources