【发布时间】:2019-11-11 05:13:22
【问题描述】:
在一个 AudioUnit 插件中,我使用的是 NSFont。
NSFontManager* fontManager = [NSFontManager sharedFontManager];
NSFont* nativefont = [fontManager fontWithFamily:[NSString stringWithCString: fontFamilyName.c_str() encoding: NSUTF8StringEncoding ] traits:fontTraits weight:5 size:fontSize ];
NSMutableParagraphStyle* style = [[NSMutableParagraphStyle alloc] init];
[style setAlignment : NSTextAlignmentLeft];
NSMutableDictionary* native2 = [[NSMutableDictionary alloc] initWithObjectsAndKeys:
nativefont, NSFontAttributeName,
style, NSParagraphStyleAttributeName,
nil];
// .. later
void someFunction(NSMutableDictionary* native2)
{
float lineGap = [native2[NSFontAttributeName] leading];
编译器说(关于最后一行):assigning to 'float' from in compatible type 'NSCollectionLayoutSpacing * _Nullable'
注意:这只是在切换到 Xcode 11.1 后最近才失败,在旧版本的 XCode 上它构建得很好。任何帮助表示赞赏。
【问题讨论】:
标签: cocoa nsmutabledictionary nsfont