ios label with attributed text fonts not displaying correctly - ios

labels in xcode aren't correctly displaying some fonts even though attributed text is selected...
In storyboards I have some labels that I changed the text from "plain" to "attributed" but the fonts I wont to use wont display correctly - instead xcode, or whatever is controlling it, displays what seems to be a fall-back font.
Any workaround?
Reasons why?
I'm trying to use schoolhouse cursive b (and yes it does show up in the list of fonts)...

The iOS Devices don't have the font schoolhouse cursive b preinstalled:
Font list iOS7
Font list iOS6
If you want to add a custom font, have a look at this answer.

Related

iOS - SymbolSet Font Icons not working

I purchased the font icon bundle from https://symbolset.com
I copied the ss-social-regular.tff into the project.
In info.plist, I added ss-social-regular.tff under Font provided by application.
In my view controller, I created a UILabel in code, set the font as "ss-social-regular", and set the text as #"\uF610". (this is the Facebook icon. i got U+F610 by hovering over the icon in Font Book)
The result is a box with a question mark inside.
I've tried many different variations for the string set to label text, but none have worked.

UITextView fix character width

My problem is that I have to two UITextView displaying different Text, but always the same number of characters. I could not find a way to set a fix character-width and space width in UITextView/NSAtrrStr/UIFont.
Is there a way to do that?
thanks
As far as I know, Courier New is the only fixed-width font shipped with iOS.
Also, you can always import custom fonts to your xcode project which you know are fixed-width. Here is how: Embed Custom Font in iOS

Chinese font cut off in iOS app with custom font

We're currently localizing our iPhone app to various languages, one of them being Chinese. Throughout the app we use Menlo as font, but now when iOS has to display Chinese characters those are cut off at the top. I guess this is because Menlo does not feature these characters and thus iOS has to fall back to the system font for Chinese which has a different line height?
What is the recommended approach here?
If you are using a custom table cell try to increase the height of the textView.
If you are using default tableview cell you can try setting the font size to 0, the text should be auto-sized as appropriate.
Hope this helps.. :)

Where Can I Find Sprite Kit Available fonts?

I am experimenting with the new iOS 7 SpriteKit.
This line of code is taken from apple class reference and can be found in their sample project as well.
SKLabelNode *label = [SKLabelNode labelNodeWithFontNamed:#"Chalkduster"];
In this line the Chalkduster font is used.
I understand it's a bitmap font but how do I know what other font name I can use to replace Chalkduster?
You can also view the available fonts within Xcode itself by going to your storyboard file. You create a label there, go to the label's Attributes Inspector (the slider icon in the Utilities bar), select Font -> Custom, then scroll through the Family section to view the font list.
And here is how you would use a custom font of your own. Make sure you go through steps 1-5, then you should be able to use your custom font using [SKLabelNode labelNodeWithFontNamed:#"Font Name Here"].
Here is a list of iOS 7 installed fonts
I found that there is a very useful website showing all the available fonts on iOS. It’s iosfonts.com. The website shows how given font looks like, its name and its code name as well as the iOS version when specific font was added.
You can also log all the font names that are available as described here:
How to log names of all available fonts in iOS project.

iOS5 fancy icons (emoji?) for special unicode chars - not what I want

I've always thought it was great that I could use simple iconic unicode characters in a string when I needed an arrow or a bullet or whatever. The glyphs would render in the same color as the rest of the string with a nice simple and clean icons. I could preview how they'd look by using the Mac's "Special Characters" dialog on the Edit menu in XCode.
In iOS5, these glyphs render in full color and aren't simple and clean. I believe these are Emoji icons?
I'm looking for an explanation of this change, and ideally how to force iOS5 to revert to the iOS2 - iOS4 behavior.
Here's an example: #"← left arrow, right arrow β†’ airplane ✈";
Edit:
Apparently the NSString UIKit extensions for rendering text (drawAtPoint: / drawInRect:) don't exhibit this behavior. So perhaps it is a UILabel thing? Specifically I've noticed it inside a UISegmentControl segment button, and in a UILabel.
This isn't a bug, it's down to the font used. When you use a character in a string that isn't available in the chosen font, iOS automatically substitutes a glyph from another font.
The system font (Helvetica) doesn't have those characters in it, so I'm guessing that Apple have have changed the list of fallback fonts so that Emoji ranks above whatever it was using previously for the fallback for those characters.
To fix it, find a font that a) has the version of the characters you want in it, and b) is available on iPhone, and set your label to use that instead of the default system font.
Alternatively, you could just make a UILabel subclass and override the drawRect method so it uses the drawAtPoint/drawInRect methods to draw the string.

Resources