Archived
1

Layout Improvements (New Fonts)

This commit is contained in:
Kim Wittenburg
2014-11-25 17:48:42 +01:00
parent 66d06cc0f1
commit 8b0f8109c8
10 changed files with 73 additions and 55 deletions

View File

@@ -45,20 +45,21 @@
}
#pragma mark Properties
- (NSFont *)font
{
return self.usesSmallSize ? self.smallFont : self.normalFont;
}
- (CGFloat)fontSize
{
return self.usesSmallSize ? self.smallFontSize : self.normalFontSize;
}
- (NSFont *)normalFont
- (NSFont *)normalFontWithSize:(CGFloat)size
{
return [NSFont fontWithName:@"CMU Serif"
size:self.fontSize];
size:size];
}
- (NSFont *)specialFontWithSize:(CGFloat)size
{
return [NSFont fontWithName:@"CMU Sans Serif Oblique"
size:size];
}
- (CGFloat)contextInferredFontSize
{
return self.usesSmallSize ? self.smallFontSize : self.normalFontSize;
}
- (CGFloat)normalFontSize
@@ -66,17 +67,16 @@
return 18.0;
}
- (NSFont *)smallFont
{
return [NSFont fontWithName:@"CMU Serif"
size:self.smallFontSize];
}
- (CGFloat)smallFontSize
{
return 12.0;
}
- (NSFont *)font
{
return [self normalFontWithSize:self.contextInferredFontSize];
}
#pragma mark Cache Tree
// Querying and Storing Caches
- (BOOL)hasCacheForElementAtIndex:(NSUInteger)index
@@ -154,7 +154,7 @@
attributes:@{NSFontAttributeName: font}];
CFAttributedStringRef attributedString = CFBridgingRetain(text);
CTLineRef line = CTLineCreateWithAttributedString(attributedString);
CFRelease(attributedString); // TODO: Is this release appropriate?
CFRelease(attributedString);
return line;
}