General improvements

- Refactor naming of ASEnvironmentCollection to ASEnvironmentState
- Remove struct pointers
- Move ASEnvironmentStatePropagation to a enum class
- Move merge functions to pure functions
- Move ASLayoutOptionsForwarding and ASLayoutableExtensibility into ASLayoutSpec and ASDisplayNode
- Remove ASLayoutableSetValuesForLayoutable and move into explicit classes (ASDisplayNode, ASTextNode)
This commit is contained in:
Michael Schneider
2016-03-31 20:43:20 -07:00
parent 65b4961802
commit 4e757f0969
13 changed files with 281 additions and 309 deletions
+6
View File
@@ -364,6 +364,12 @@ static NSArray *DefaultLinkAttributeNames = @[ NSLinkAttributeName ];
}
_attributedString = ASCleanseAttributedStringOfCoreTextAttributes(attributedString);
if (_attributedString.length > 0) {
CGFloat screenScale = ASScreenScale();
self.ascender = round([[_attributedString attribute:NSFontAttributeName atIndex:0 effectiveRange:NULL] ascender] * screenScale)/screenScale;
self.descender = round([[_attributedString attribute:NSFontAttributeName atIndex:_attributedString.length - 1 effectiveRange:NULL] descender] * screenScale)/screenScale;
}
// Sync the truncation string with attributes from the updated _attributedString
// Without this, the size calculation of the text with truncation applied will