Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 979
TomSwift Avatar asked Nov 08 '11 16:11

TomSwift


People also ask

How do you type special Unicode characters?

Inserting Unicode characters To insert a Unicode character, type the character code, press ALT, and then press X. For example, to type a dollar symbol ($), type 0024, press ALT, and then press X. For more Unicode character codes, see Unicode character code charts by script.

How do I get Unicode symbols on my iPhone?

Adding a Unicode keyboard To install a Unicode keyboard on your iPhone or iPad, launch the App Store and download the free UniChar app. Then launch Settings, General, Keyboard, Keyboards, Add New Keyboard…, and select UniChar from the options.

Can Unicode represent Emojis?

The Unicode Standard has assigned numbers to represent emojis. Here's how it works. In the Unicode Standard, each emoji is represented as a "code point" (a hexadecimal number) that looks like U+1F063, for example.

How do I get Unicode on Mac?

This is a unique “code point,” or hexadecimal (base 16) number within the Unicode world. on newer Apple keyboards or press Command-Control-spacebar to bring it up.) In the Search field, enter the code point and the corresponding character appears.


1 Answers

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.

like image 110
Nick Lockwood Avatar answered Oct 19 '22 18:10

Nick Lockwood