`//配置参数
CGFloat fontSize = (CGFloat)[Flo_CommonManger fontSize];
NSString *fontName = [Flo_CommonManger Manager_getFontName];
CTFontRef fontRef = CTFontCreateWithName((CFStringRef)fontName, fontSize, NULL);
CGFloat lineSpace = [Flo_ReaderDataSource shareInstance].lineSpace;
CTTextAlignment aligment = kCTTextAlignmentJustified;
const CFIndex kNumberOfSettings = 5;
CTParagraphStyleSetting theSettings[kNumberOfSettings] = {
{kCTParagraphStyleSpecifierLineSpacingAdjustment,sizeof(CGFloat),&lineSpace},
{kCTParagraphStyleSpecifierMaximumLineSpacing,sizeof(CGFloat),&lineSpace},
{kCTParagraphStyleSpecifierMinimumLineSpacing,sizeof(CGFloat),&lineSpace},
{kCTParagraphStyleSpecifierParagraphSpacing,sizeof(CGFloat),&lineSpace},
{kCTParagraphStyleSpecifierAlignment,sizeof(aligment),&aligment}
};
CTParagraphStyleRef paragraphRef = CTParagraphStyleCreate(theSettings, kNumberOfSettings);
NSInteger theme = [Flo_CommonManger Manager_getThemeColor];
UIColor *textColor = [Flo_CommonTool gainCurrentThemeColorWithTheme:theme withAlpha:1.0];
NSMutableDictionary *ctdic = [NSMutableDictionary dictionary];
ctdic[(id)kCTForegroundColorAttributeName] = (id)textColor.CGColor;
ctdic[(id)kCTFontAttributeName] = (__bridge id)fontRef;
ctdic[(id)kCTParagraphStyleAttributeName] = (__bridge id)paragraphRef;
`
网友评论