我正在尝试应用 4MB ttf
文件大小的自定义字体。
当我尝试以编程方式加载字体时,它正在应用于textview中的文本,这需要花费太多时间才能应用。
我尝试在后台线程上应用,也在主线程上应用。但是同时适用于textview的时间。
如何快速加载并应用于textview。
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
paragraphStyle.lineHeightMultiple = lineheight-2;
paragraphStyle.maximumLineHeight = lineheight-2;
paragraphStyle.minimumLineHeight = lineheight-2;
NSString *string = desc.text;
NSDictionary *ats = @{
NSFontAttributeName : [UIFont fontWithName:fontName size:descsize],
NSParagraphStyleAttributeName : paragraphStyle,
NSForegroundColorAttributeName : [UIColor colorWithRed:85.0f/255.0f green:85.0f/255.0f blue:85.0f/255.0f alpha:1.0],
};
desc.attributedText = [[NSAttributedString alloc] initWithString:string attributes:ats];