Misaligned baseline in Arabic with iOS system font - ios

I have a UILabel with Arabic text which contains the word اسماً, last character is the letter Alef with the mark Fathah. This mark is somehow causing the word to be misaligned vertically with the rest of the text.
When removing the mark, the word is back to correct baseline
The font is iOS system font, this doesn't happen with the Ariel font.

This is an issue with the iOS system font.
I've opened a new project to test it and added only a UITextField with an Arabic string which includes the char اً as the placeholder and it had the same behaviour.
This has been fixed on iOS 11.

Related

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.. :)

UILabel Only Supports Certain Unicode Characters

My app uses unicode characters. These characters (not the actual codes) are pasted directly into a PLIST file and then imported.
Some of them are not appearing correctly in UILabel and UIButton
When I print them to the log in Xcode they appear normal, but when displayed on the iPhone/Simulator some of the characters turn into an "alien in a box".
See image for example of problem (screenshot from UIButton titles)
My guess is that the font you are using does not define these characters. Select a font (or build one into your app) that includes the characters you need.

Core Text newline character artifact with custom font

When I draw NSAttributedString in UILabel when there is a custom font involved, quote character is inserted with each newline ('\n') character.
This issue does not appear with standard / build-in iOS fonts, yet it is enough to have just 1 character with custom one and bum...
Tested with multiple custom fonts, iOS6 and iOS7 so it is not just 'this one custom font' issue.
Example with built-in fonts only - everything OK:
But just style any part of the text with custom font - and here we go:

kasra not displayed on iOS

When I write arabic text containing the letter kasra (unicode character 0x650, phonetic equivalent i) to a button, the kasra is not displayed. Thus, the word mumkin appears as mumkn. If I inspect the NSString in Xcode, the kasra is present, but the kasra is not displayed in the iPhone simulator or on a real iPad. The other two short vowels (fatha and damma) are displayed correctly.
The arabic letter kasra (unicode character 0x650) is missing from all of the built-in IOS7 fonts that i have tried.
The solution was to build a different font into my app- I used AGA-Rasheeq-Bold.
This may be a bug. I just tried it in the storyboard editor and it does not seem to work. I created a string in the MAC Notes application, copied and pasted. It displays correctly in the left hand properties panel, but not in the button itself. Could you provide the exact Unicode string? You may need to open a bug report with Apple.
I can confirm that it works correctly in a Label field, but not a Button (IOS 6.1 and Xcode 4.6.3)
Try attributed text. This seems to work around the issue.

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