Difference between custom font and system font?

I am using core text to draw a string based on content length and I am using CTFramesetterCreateWithAttributedString

Is there any difference between a custom font and the system font?

I am adding attribute kCTFontAttributeName to NSMutableAttributedString . Each font is not working the same way... When I use systemFont it updates the view very quickly, but if I use the custom font included in plist, it's taking a long time to update the view.

    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];
        }
    }

Why is it taking more time when I use Custom UIFont ?

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

上一篇: 如何绘制梯形(或圆形)的文字?

下一篇: 自定义字体和系统字体的区别?