Skip to content

Commit

Permalink
fix sans serif TextureGroup#1579
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffersonsetiawan committed Sep 10, 2019
1 parent c9e4469 commit 4d012b7
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions Source/TextKit/ASTextKitCoreTextAdditions.m
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,9 @@ BOOL ASAttributeWithNameIsUnsupportedCoreTextAttribute(NSString *attributeName)

// kCTFontAttributeName -> NSFontAttributeName
if ([coreTextKey isEqualToString:(NSString *)kCTFontAttributeName]) {
// Its reference type, CTFontRef, is toll-free bridged with UIFont in iOS and NSFont in OS X
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]) {
Expand Down

0 comments on commit 4d012b7

Please sign in to comment.