Fix serif-font bug and round font in avatar placeholders

This commit is contained in:
Ilya Laktyushin
2019-10-23 15:33:52 +04:00
parent f721a92605
commit 61f71dfcb2
31 changed files with 137 additions and 43 deletions

View File

@@ -69,15 +69,7 @@ NSDictionary *NSAttributedStringAttributesForCoreTextAttributes(NSDictionary *co
// kCTFontAttributeName -> NSFontAttributeName
if ([coreTextKey isEqualToString:(NSString *)kCTFontAttributeName]) {
CTFontRef coreTextFont = (__bridge CTFontRef)coreTextValue;
NSString *fontName = (__bridge_transfer NSString *)CTFontCopyPostScriptName(coreTextFont);
CGFloat fontSize = CTFontGetSize(coreTextFont);
UIFont *font = [UIFont fontWithName:fontName size:fontSize];
ASDisplayNodeCAssertNotNil(font, @"unable to load font %@ with size %f", fontName, fontSize);
if (font == nil) {
// Gracefully fail if we were unable to load the font.
font = [UIFont systemFontOfSize:fontSize];
}
cleanAttributes[NSFontAttributeName] = font;
cleanAttributes[NSFontAttributeName] = (__bridge UIFont *)coreTextFont;
}
// kCTKernAttributeName -> NSKernAttributeName
else if ([coreTextKey isEqualToString:(NSString *)kCTKernAttributeName]) {