Question mark in place of font icon for some font codes

久未见 提交于 2019-12-24 07:14:10

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/41299467/question-mark-in-place-of-font-icon-for-some-font-codes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!