Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Load TTF font from external path

I was wondering that how to load a TTF font from a absolute file path, not relative, which is usually done with [UIFont fontWithName:@"xyz"];

In cocos2d we can do it by using CCLabelBMFont that takes file as parameter, but when use CCLabelTTF it takes the name of font, not the file name.

Is there any workaround to load an external font not embedded with the application but downloaded from some resource as per need ?

like image 714
iphonic Avatar asked Dec 28 '22 00:12

iphonic


1 Answers

Yes, you can do this.

Just copy the font to your project and add this reference in your info.plist. Then you can reference the font name just like any other system font.

enter image description here

like image 102
Bill Burgess Avatar answered Jan 08 '23 01:01

Bill Burgess