mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Add ability to customize NSLayoutManager and NSTextStorage when created in the ASTextKitContext
This commit is contained in:
@@ -91,15 +91,20 @@ struct ASTextKitAttributes {
|
||||
*/
|
||||
CGFloat currentScaleFactor;
|
||||
/**
|
||||
A pointer to a function that that returns a custom layout manager subclass. If nil, defaults to NSLayoutManager.
|
||||
An optional block that returns a custom layout manager subclass. If nil, defaults to NSLayoutManager.
|
||||
*/
|
||||
NSLayoutManager *(*layoutManagerFactory)(void);
|
||||
NSLayoutManager * (^layoutManagerCreationBlock)(void);
|
||||
|
||||
/**
|
||||
An optional delegate for the NSLayoutManager
|
||||
*/
|
||||
id<NSLayoutManagerDelegate> layoutManagerDelegate;
|
||||
|
||||
/**
|
||||
An optional block that returns a custom NSTextStorage for the layout manager.
|
||||
*/
|
||||
NSTextStorage * (^textStorageCreationBlock)(NSAttributedString *attributedString);
|
||||
|
||||
/**
|
||||
We provide an explicit copy function so we can use aggregate initializer syntax while providing copy semantics for
|
||||
the NSObjects inside.
|
||||
@@ -119,8 +124,9 @@ struct ASTextKitAttributes {
|
||||
shadowRadius,
|
||||
pointSizeScaleFactors,
|
||||
currentScaleFactor,
|
||||
layoutManagerFactory,
|
||||
layoutManagerCreationBlock,
|
||||
layoutManagerDelegate,
|
||||
textStorageCreationBlock,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -133,7 +139,8 @@ struct ASTextKitAttributes {
|
||||
&& shadowRadius == other.shadowRadius
|
||||
&& [pointSizeScaleFactors isEqualToArray:other.pointSizeScaleFactors]
|
||||
&& currentScaleFactor == currentScaleFactor
|
||||
&& layoutManagerFactory == other.layoutManagerFactory
|
||||
&& layoutManagerCreationBlock == other.layoutManagerCreationBlock
|
||||
&& textStorageCreationBlock == other.textStorageCreationBlock
|
||||
&& CGSizeEqualToSize(shadowOffset, other.shadowOffset)
|
||||
&& _objectsEqual(exclusionPaths, other.exclusionPaths)
|
||||
&& _objectsEqual(avoidTailTruncationSet, other.avoidTailTruncationSet)
|
||||
|
||||
Reference in New Issue
Block a user