自定义字体和系统字体的区别?

我正在使用核心文本绘制一个基于内容长度的字符串,我正在使用CTFramesetterCreateWithAttributedString

自定义字体和系统字体之间是否有区别?

我将属性kCTFontAttributeName添加到NSMutableAttributedString 。 每种字体的工作方式都不一样......当我使用systemFont时,它会非常快速地更新视图,但是如果我使用plist中包含的自定义字体,则需要很长时间来更新视图。

    if (self.text != nil)
    {

        self.attributedString = [[NSMutableAttributedString alloc] initWithString:self.text];
        NSRange range = NSMakeRange(0, [self.text length]);
        // Regarding Fixed font
        //        [ self.attributedString addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"TAUN_Elango_Abirami" size:20] range:range];//This is my custom font


        // Regarding custom Font using below code
        if (self.font != nil) {


             //************************* working fine only system font *******************
//            UIFont *fonts = [UIFont systemFontOfSize:24 weight:0];
//            [self.attributedString addAttribute:(NSString *)kCTFontAttributeName
//                                          value:fonts
//                                          range:range];

          //  self.font is a custom font from superclass

            //************************* here i am facing problem *******************
            [self.attributedString addAttribute:(NSString *)kCTFontAttributeName
                                          value:self.font
                                          range:range];
        }
    }

为什么使用Custom UIFont需要更多时间?

链接地址: http://www.djcxy.com/p/81931.html

上一篇: Difference between custom font and system font?

下一篇: Core Text Glyph Positions