English 中文(简体)
从外部路径从外部路径装入 TTTF 字体
原标题: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"];

在 cocos2d 中, 我们可以使用 CCLabelBMFont 来做到这一点, 它将文件作为参数, 但使用 CCLabelTFTF 时, 它会使用字体的名称, 而不是文件名称 。

是否有任何办法可以加载外部字体, 不嵌入应用程序, 而是根据需要从某些资源下载?

最佳回答

是的,你可以做到这一点。

只要将字体复制到您的工程中, 并在您的info. plist中添加此引用。 然后您就可以像其它系统字体一样引用字体名称 。

""https://i.sstatic.net/ZvgAo.png" alt="在这里输入图像描述"/ >

问题回答

若我理解你的问题, 或许这篇文章





相关问题
List Contents of Directory in a UITableView

I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...

iPhone NSUserDefaults persistance difficulty

In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Resize UIImage with aspect ratio?

I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...

Allowing interaction with a UIView under another UIView

Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...

热门标签