CoreText:CTFont中的'kern'子表无效 [英] CoreText: Invalid 'kern' Subtable In CTFont

查看:190
本文介绍了CoreText:CTFont中的'kern'子表无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用应用于CATextLayer的自定义字体。我正在使用此处的教程和示例代码。 http:// www。 freetimestudios.com/2010/09/13/custom-fonts-on-the-ipad-and-ios-4/

I am using a custom font applied to a CATextLayer. I am using the tutorial and sample code found here. http://www.freetimestudios.com/2010/09/13/custom-fonts-on-the-ipad-and-ios-4/

然而,每隔一段时间,我收到以下错误。没有什么特别可以触发它。有人可以说明这意味着什么吗?要检查什么?

However, every so often, I get the following error. Nothing in particular seems to trigger it. Can someone shed some light as to what this means? What to check for?

CoreText: Invalid 'kern' Subtable In CTFont <name: Intellect, size: 20.000000, matrix: 0x0>
CTFontDescriptor <attributes: <CFDictionary 0xac07a80 [0x38295d98]>{type = mutable, count = 1, capacity = 3, pairs = (
    0 : <CFString 0x3833f750 [0x38295d98]>{contents = "NSFontNameAttribute"} = <CFString 0x159af0 [0x38295d98]>{contents = "Intellect"}



<我使用以下代码加载字体。此代码取自上面链接中的项目。

I load the font using the following code. This code is taken from the project in the link above.

- (CTFontRef)newCustomFontWithName:(NSString *)fontName
                            ofType:(NSString *)type
                        attributes:(NSDictionary *)attributes
{
    NSString *fontPath = [[NSBundle mainBundle] pathForResource:fontName ofType:type];

    NSData *data = [[NSData alloc] initWithContentsOfFile:fontPath];
    CGDataProviderRef fontProvider = CGDataProviderCreateWithCFData((CFDataRef)data);
    [data release];

    CGFontRef cgFont = CGFontCreateWithDataProvider(fontProvider);
    CGDataProviderRelease(fontProvider);

    CTFontDescriptorRef fontDescriptor = CTFontDescriptorCreateWithAttributes((CFDictionaryRef)attributes);
    CTFontRef font = CTFontCreateWithGraphicsFont(cgFont, 0, NULL, fontDescriptor);
    CFRelease(fontDescriptor);
    CGFontRelease(cgFont);
    return font;
}


推荐答案

验证已安装的字体显示在那里是字体kern值的问题。这就是造成这个问题的原因。

Validating the installed font showed there was a problem with the fonts "kern" values. This was what was causing the problem.

这篇关于CoreText:CTFont中的'kern'子表无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆