Question mark in place of font icon for some font codes

1k views Asked by At

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.

enter image description here

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.

1

There are 1 answers

0
dev gr On

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.