I am new to objective c. I am working on keyboard for Amharic language. But i am facing some problem, iOS doese not suport Amharic language character. When I assign these Amharic language character (ወርትብቹኢኦፕ ) to my label title or button title it become boxes. I dont know that how to solve this issue. Help me any one please.
问题:
回答1:
From other question and similar, best solution is:
You cannot add the custom fonts from there, instead of that, you have to create an IBOutlet and add the font programmatically
so: 1)Drag and drop ttf font file in your resources folder and add in info.plist:
<key>UIAppFonts</key>
<array>
<string>AmharicFontFile.ttf</string>
</array>
or by clicks in Xcode:
I)in plist file (projectView, click on info.plist)
II)create new row called "Fonts provided by application"
III)than create new item, ie:
item0 | AmharicFontFile.ttf
than in code:
UIFont *font = [UIFont fontWithName:@"Amharic" size:20];
[label setFont:font];
where "Amharic" is font name (not just filename without extension, but could be the same)
回答2:
Xcode defaults button labels to the system font. If your system font does not support the glyphs in language X, you need to set the button's font to a font that does.
If no built in font supports language X, then you'll need to license a font that does and include it in your bundle.
回答3:
My guess is that MacOS supports this language, but iOS does not. if the current font (e.g. the system font) does not have a certain character, it looks for a 'fallback' font that has the desired characters. If iOS doesn't have a localization for this language, it's likely Apple left away the font for this language to save space.
I presume the text looks OK in Interface Builder and in the simulator, but not on the device(1)? Or does it only look right in TextEdit, and both IB and the simulator don't show them right(2)? In either case, you will probably have to license and install a custom font that contains the desired characters and include it with your app.
1) The simulator and IB are both really Mac applications that just pretend to be iOS, so behave differently than a real iOS device. So it could be that they have access to all fonts on your Mac, while on the device there are actually fewer fonts.
2) However, the simulator and IB make some effort to simulate a real iOS device, so if it doesn't work there either, but works in a real Mac app like TextEdit, someone was extra smart and filters the font list.