I am showing an NSAttributed row column using Core Text. It is working fine. When using the system font, it is displayed without any delays both in the simulator and on the device. But when using a custom font, it takes longer to display content on the device. But in the simulator, the result is quick.
- (void)updateAttributedString { // Existing Code 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) { CTFontRef font = [self createCTFont]; [self.attributedString addAttribute:(NSString *)kCTFontAttributeName value:(__bridge id)font range:range]; CFRelease(font); } } } - (CTFontRef)createCTFont; { CTFontRef font = CTFontCreateWithName((CFStringRef)self.fontName, self.pointSize, NULL); return font; }
If I add the following line of code,
[self.attributedString addAttribute:(NSString *)kCTFontAttributeName value:(__bridge id)font range:range];
the display of the attribute string in the device is slower. But in the simulator it is fast. If I do not add this piece of code, the text will be displayed quickly both in the simulator and on the device.
source share