Question mark in place of font icon for some font codes - ios

I have custom font icon TTF file downloaded to the device. I also have mappings for font icon name and its font code.
A question mark is being displayed instead of font icon for some of the font code. The font code points are received from server in decimal number format. I am doing this to display font icon:
unichar decimal = [iconMap.fontCode unsignedShortValue];//fontCode is an NSNumber
NSString *charStr = [NSString stringWithFormat:#"%C", decimal];
[self.button setTitle:charStr forState:UIControlStateNormal];
Everything works fine I see the font icons but for some font code I am seeing a question mark.
In my font icon TTF file there are 369 icons ranging from font code E800 to E9A7.
Font icons are displayed correctly for font code range E800 to
E902.
But for font icons for font code range E903 to E9A7 are
displayed as question mark.
Edit : Setting direct string literal like #"\uE903" to the label also displays a question mark.
Note : I verified that all the icons (font code ranging from E800 to E9A7) are present in font icon TTF file.
I don't know what is the issue here? Please help.

Sorry, it's my bad.
I did not notice a TTF file was already added in project. The file which I was downloading from server was not getting created since name of TTF files were same. The TTF file that was already added to project was missing icons for range E903 to E9A7 and this outdated font icon file was getting used.
I was verifying the TTF file which I was downloading and it was up to date and contained all font icons. So I deleted old TTF file from project and made sure that newly downloaded file gets saved to disk correctly.
Now I can see the icons correctly.

Related

How to allow all arabic characters to be shown on UITextVIew?

if i have this arabic text: "لِلَّهِ" it looks very weird only Apple devices.
but if i paste the same exact text for example in a google chrome textfield it shows this (which is correct):
What can i do so my UITextView allows all characters regardless of which language/word it is?
You can always download any font you like and just import it into your app. To do that upload .ttf files to project > register fonts in Info.plist file ("Fonts provided by application")
I always use googleFonts to find suitable font for me
I had to change the font to an arabic font style you can download on the web.

How to use multiple Icomoon font same iOS Project?

My project already has a icommon font file. I missed the .json file to retrieve the font. Unable to add another font icomoon font in that project. It overrides the previous font.
I tried generate icomoon font with different font name it works.
To change the Font name in icomoon please refer the image below.

Icon font not displaying on iOS 12

I have an issue with an icon font not displaying on iOS 12 (it works perfectly fine on iOS <= 11). A few more details on what I've found and how we use the font:
1) The font is properly included in the project and it appears when NSlogging [UIFont familyNames] and [UIFont fontNamesForFamilyName:iconFontFamilyName]
2) I'm accessing the icons using the \u notation: label.text = #"\uXXXX". When XXXX does NOT exist in the font, the app displays the "question-mark-in-a-square", indicating (correctly) that the code does not exist. However, if the code DOES exist in the font, then the app displays nothing at all - the respective element appears blank.
Is there something we're missing here?
In summary, the issue is most likely with Icomoon's font generation; specifically the types of cmap encoding subtables. I would suggest two actions:
Test this hypothesis by using a font conversion tool (such as https://onlinefontconverter.com) to convert your ttf file to otf (which is also supported by iOS).
If your glyph displays then continue to use your new otf file while raising the issue with IcoMoon directly.
I remember having a similar issue when playing around with on-device font generation in my MinimumRubber project. I found that careful choice of platform identifier and platform-specific encoding identifier were required for both UILabel and UITextView to display the glyph. It does not surprise me that Apple has refactored this area of code

Custom Icon Font in Swift

I would like to use an custom icon font for my application, so ill added the font "simple-line-icons.ttf" into my info.plist - and now i can choose it from interface builder.
When ill set the text from a label to the unicode text, like:
dateIconLabel.text = "\u{e01c}"
It shows me an icon, but not the icon from the icon set as expected.
Its an colored icon, and i dont use any colered icon sets here.
The font is definitive correct, and the unicode should work too (copied from the original css file).
Something strange is, that when ill print out all fonts for my application, the icon font is not there (but its in my list in IB).
print(UIFont.familyNames())
Any help would be greatly appreciated.
Make sure that the icon font is added to the correct target. When I added the font to my app it was not added to any target. So the icon font was not installed in the app and the system was using a default font.
You could still select the font in IB because you probably installed the font on your mac.
Add the font to the info.plist
use:UIAppFonts (Raw Value) or "Fonts Provided by application" as the key,
and the font name example Icon-Font.ttf
Validate that the font file name and font name correspond by opening ttf in font book

Custom Font Issue in iOS

In my app, I used custom fonts. It works fine for UILabels, etc...
But the Title is cut from top for Button.
"See the S"
What is happening and how can I resolve this??
try setting button.contentEdgeInsets property to align the title within the button, if it is an issue of misligned baseline of the font you can do this
button.titleLabel.baselineAdjustment = UIBaselineAdjustmentAlignCenters
a few steps:
Include your fonts in your XCode project
Make sure that they’re included in the target
Double check that your fonts are included as Resources in your bundle
Include your iOS custom fonts in your application plist
Find the name of the font
Use UIFont and specify the name of the font
detail for this:
http://codewithchris.com/common-mistakes-with-adding-custom-fonts-to-your-ios-app/
thanks!
In my case it was the font file that was corrupted.
Try to open the ttf file in your mac, select the 'S' and see if the frame that appears cuts off the letter.
My solution was to change the ttf file.

Resources