gpt4 book ai didi

objective-c - 激活字体时参数错误

转载 作者:行者123 更新时间:2023-12-03 16:43:52 24 4
gpt4 key购买 nike

我必须在 Mac OSX 10.5 中激活字体。为此,我提到了ATS 。我这样编码。

    NSString *filePath =  @"/Users/userName/Desktop/Fonts/Impasto.otf";
CFURLRef url = (CFURLRef)[NSURL fileURLWithPath:filePath];
OSStatus status = ATSFontSetAutoActivationSettingForApplication(kATSFontAutoActivationEnabled,url);
if(status == paramErr)
{
NSLog(@"parameter error");
}

但是我收到此代码的参数错误。我无法理解我在这里做错了什么。

最佳答案

免责声明:我只是解释文档,我没有 ATS 的实际经验。

来自 ATSFontSetAutoActivationSettingForApplication 的文档:

Sets the auto-activation setting for the specified application bundle.

然后是第二个参数:

A valid file URL for an application. Pass NULL to specify the current process.

我将其理解为:该方法激活给定应用程序包中的所有字体。您可以传递 (CFURLRef)[[NSBundle mainBundle] bundleURL] 或简单地传递 NULL。要激活 bundle 之外的字体,您可能需要 ATSFontActivateFromFileReference

关于objective-c - 激活字体时参数错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7938157/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com