[英]How to get the Font Name from the Font file?
I have downloaded a Font file from the internet and the name of the font file is nuku1.ttf. 我已经从互联网上下载了一个字体文件,该字体文件的名称为nuku1.ttf。 I have to use that in my application so I activated that by using this. 我必须在应用程序中使用它,因此我通过使用它来激活了它。 CTFontManagerSetAutoActivationSetting(FontPath,2);
. 。 After activating this font file how can get the font name for that file Programmatically? 激活此字体文件后,如何以编程方式获取该文件的字体名称? In other words where the AutoActivated Fonts are stored in mac? 换句话说,自动激活字体存储在Mac中的什么位置?
CTFontManagerSetAutoActivationSetting(FontPath,2);
The CTFontManagerSetAutoActivationSetting
function takes a bundle identifier, not the path to a font. CTFontManagerSetAutoActivationSetting
函数使用包标识符,而不是字体的路径。 (Also, you should use the value names , not hard-coded numeric literals.) (此外,您应该使用值名称 ,而不是硬编码的数字文字。)
To examine a font file, use the CTFontManagerCreateFontDescriptorsFromURL
function to create an array of CTFontDescriptor objects, one for each of the fonts in the file. 要检查字体文件,请使用CTFontManagerCreateFontDescriptorsFromURL
函数创建CTFontDescriptor对象数组,该数组用于文件中的每种字体。 Each descriptor will tell you the font's PostScript name, family name, and display name, among other attributes. 每个描述符将告诉您字体的PostScript名称,系列名称和显示名称以及其他属性。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.