where is STHeitiSC in XIB?Is it deprecated? - ios

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.

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?

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]];

Adding Custom Font to Font List in XIB

How can I add a custom font (by custom i mean, the font that dont exist in xcode) in font selector which comes through XIB?
I have added the font to the bundle and added it to the plist. I can use the font programmatically but I want to use it through XIB.
Xcode uses the fonts installed on the computer. Add the font to your ~/Library/Fonts folder or double click the font and install it using Font Book.
The font selector in Xcode also allows you to type directly into it. I imagine you can type whatever font you want here and it will work at run time if the font is found, but to use it during development I'm pretty sure you need to have it installed.
If you're looking for a WYSIWYG preview of a custom font in Interface Builder, this isn't possible (even in Xcode 5).
Like you mentioned, you may continue to set the font programmatically.

Use iOS 6 font for iOS 5 NIB

I'm using Avenir, which is a font only available in iOS 6, in a project that supports iOS 5. I'm able to change the font when it's referenced in code, but I'm not sure how to change Avenir to Helvetica in the NIB files. Right now everything just defaults to system font, which is semi-acceptable except that all font sizes default to 17 regardless of their specified size in the NIB.
This is a project that has 40+ Nibs, so ideally I can find a solution that doesn't require manually editing each nib and its owner to add UILabel IBOutlets.
Thanks
You could purchase the font and include it in your application. That way you will have consistency with iOS5 and iOS6. I would say that is your easiest solution.
Font
Include custom font in application

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.

Resources