WAKStringDrawing.h [plain text]
#ifndef WAKStringDrawing_h
#define WAKStringDrawing_h
#import <CoreGraphics/CoreGraphics.h>
#import <Foundation/Foundation.h>
#import <GraphicsServices/GraphicsServices.h>
typedef enum {
WebEllipsisStyleNone = 0, WebEllipsisStyleHead = 1,
WebEllipsisStyleTail = 2,
WebEllipsisStyleCenter = 3,
WebEllipsisStyleClip = 4, WebEllipsisStyleWordWrap = 5, WebEllipsisStyleCharacterWrap = 6, } WebEllipsisStyle;
typedef enum {
WebTextAlignmentLeft = 0,
WebTextAlignmentCenter = 1,
WebTextAlignmentRight = 2,
} WebTextAlignment;
@protocol WebTextRenderingAttributes
@property(nonatomic, readonly) GSFontRef font; @property(nonatomic, readonly) CGFloat lineSpacing;
@property(nonatomic, readonly) WebEllipsisStyle ellipsisStyle; @property(nonatomic, readonly) CGFloat letterSpacing; @property(nonatomic, readonly) WebTextAlignment alignment; @property(nonatomic, readonly) BOOL includeEmoji; @property(nonatomic, readwrite) CGRect truncationRect;
@end
@interface NSString (WebStringDrawing)
+ (void)_web_setWordRoundingEnabled:(BOOL)flag;
+ (BOOL)_web_wordRoundingEnabled;
+ (void)_web_setAscentRoundingEnabled:(BOOL)flag;
+ (BOOL)_web_ascentRoundingEnabled;
- (CGSize)_web_drawAtPoint:(CGPoint)point withFont:(GSFontRef)font;
- (CGSize)_web_sizeWithFont:(GSFontRef)font;
- (CGSize)_web_sizeWithFont:(GSFontRef)font forWidth:(float)width ellipsis:(WebEllipsisStyle)ellipsisStyle;
- (CGSize)_web_sizeWithFont:(GSFontRef)font forWidth:(float)width ellipsis:(WebEllipsisStyle)ellipsisStyle letterSpacing:(float)letterSpacing;
- (CGSize)_web_sizeWithFont:(GSFontRef)font forWidth:(float)width ellipsis:(WebEllipsisStyle)ellipsisStyle letterSpacing:(float)letterSpacing resultRange:(NSRange *)resultRangeOut;
- (CGSize)_web_drawAtPoint:(CGPoint)point forWidth:(float)width withFont:(GSFontRef)font ellipsis:(WebEllipsisStyle)ellipsisStyle;
- (CGSize)_web_drawAtPoint:(CGPoint)point forWidth:(float)width withFont:(GSFontRef)font ellipsis:(WebEllipsisStyle)ellipsisStyle letterSpacing:(float)letterSpacing;
- (CGSize)_web_drawAtPoint:(CGPoint)point forWidth:(float)width withFont:(GSFontRef)font ellipsis:(WebEllipsisStyle)ellipsisStyle letterSpacing:(float)letterSpacing includeEmoji:(BOOL)includeEmoji;
- (CGSize)_web_drawInRect:(CGRect)rect withFont:(GSFontRef)font ellipsis:(WebEllipsisStyle)ellipsisStyle alignment:(WebTextAlignment)alignment;
- (CGSize)_web_drawInRect:(CGRect)rect withFont:(GSFontRef)font ellipsis:(WebEllipsisStyle)ellipsisStyle alignment:(WebTextAlignment)alignment lineSpacing:(int)lineSpacing;
- (CGSize)_web_drawInRect:(CGRect)rect withFont:(GSFontRef)font ellipsis:(WebEllipsisStyle)ellipsisStyle alignment:(WebTextAlignment)alignment lineSpacing:(int)lineSpacing includeEmoji:(BOOL)includeEmoj truncationRect:(CGRect *)truncationRect;
- (CGSize)_web_sizeInRect:(CGRect)rect withFont:(GSFontRef)font ellipsis:(WebEllipsisStyle)ellipsisStyle;
- (CGSize)_web_sizeInRect:(CGRect)rect withFont:(GSFontRef)font ellipsis:(WebEllipsisStyle)ellipsisStyle lineSpacing:(int)lineSpacing;
- (NSString *)_web_securedStringIncludingLastCharacter:(BOOL)includingLastCharacter;
- (NSString *)_web_stringForWidth:(float)width withFont:(GSFontRef)font ellipsis:(WebEllipsisStyle)ellipsisStyle letterSpacing:(float)letterSpacing includeEmoji:(BOOL)includeEmoji;
- (CGSize)_web_sizeForWidth:(CGFloat)width withAttributes:(id <WebTextRenderingAttributes>)attributes;
- (CGSize)_web_drawAtPoint:(CGPoint)point forWidth:(CGFloat)width withAttributes:(id <WebTextRenderingAttributes>)attributes;
- (CGSize)_web_sizeInRect:(CGRect)rect withAttributes:(id <WebTextRenderingAttributes>)attributes;
- (CGSize)_web_drawInRect:(CGRect)rect withAttributes:(id <WebTextRenderingAttributes>)attributes;
@end
#endif // WAKStringDrawing_h