5 // Copyright (C) 2005, 2006, 2007, 2008, Apple Inc. All rights reserved.
8 #import <CoreGraphics/CoreGraphics.h>
9 #import <Foundation/Foundation.h>
10 #import <GraphicsServices/GraphicsServices.h>
13 // The order of the enum items is important, and it is used for >= comparisions
14 WebEllipsisStyleNone
= 0, // Old style, no truncation. Doesn't respect the "width" passed to it. Left in for compatability.
15 WebEllipsisStyleHead
= 1,
16 WebEllipsisStyleTail
= 2,
17 WebEllipsisStyleCenter
= 3,
18 WebEllipsisStyleClip
= 4, // Doesn't really clip, but instad truncates at the last character.
19 WebEllipsisStyleWordWrap
= 5, // Truncates based on the width/height passed to it.
20 WebEllipsisStyleCharacterWrap
= 6, // For "drawAtPoint", it is just like WebEllipsisStyleClip, since it doesn't really clip, but truncates at the last character
24 WebTextAlignmentLeft
= 0,
25 WebTextAlignmentCenter
= 1,
26 WebTextAlignmentRight
= 2,
29 @interface
NSString (WebStringDrawing
)
31 + (void)_web_setWordRoundingEnabled
:(BOOL
)flag
;
32 + (BOOL
)_web_wordRoundingEnabled
;
34 - (CGSize
)_web_drawAtPoint
:(CGPoint
)point withFont
:(GSFontRef
)font
;
36 - (CGSize
)_web_sizeWithFont
:(GSFontRef
)font
;
38 // Size after applying ellipsis style and clipping to width.
39 - (CGSize
)_web_sizeWithFont
:(GSFontRef
)font forWidth
:(float)width ellipsis
:(WebEllipsisStyle
)ellipsisStyle
;
40 - (CGSize
)_web_sizeWithFont
:(GSFontRef
)font forWidth
:(float)width ellipsis
:(WebEllipsisStyle
)ellipsisStyle letterSpacing
:(float)letterSpacing
;
42 // Draw text to fit width. Clip or apply ellipsis according to style.
43 - (CGSize
)_web_drawAtPoint
:(CGPoint
)point forWidth
:(float)width withFont
:(GSFontRef
)font ellipsis
:(WebEllipsisStyle
)ellipsisStyle
;
44 - (CGSize
)_web_drawAtPoint
:(CGPoint
)point forWidth
:(float)width withFont
:(GSFontRef
)font ellipsis
:(WebEllipsisStyle
)ellipsisStyle letterSpacing
:(float)letterSpacing
;
45 - (CGSize
)_web_drawAtPoint
:(CGPoint
)point forWidth
:(float)width withFont
:(GSFontRef
)font ellipsis
:(WebEllipsisStyle
)ellipsisStyle letterSpacing
:(float)letterSpacing includeEmoji
:(BOOL
)includeEmoji
;
47 // Wrap and clip to rect.
48 - (CGSize
)_web_drawInRect
:(CGRect
)rect withFont
:(GSFontRef
)font ellipsis
:(WebEllipsisStyle
)ellipsisStyle alignment
:(WebTextAlignment
)alignment
;
49 - (CGSize
)_web_drawInRect
:(CGRect
)rect withFont
:(GSFontRef
)font ellipsis
:(WebEllipsisStyle
)ellipsisStyle alignment
:(WebTextAlignment
)alignment lineSpacing
:(int)lineSpacing
;
50 - (CGSize
)_web_drawInRect
:(CGRect
)rect withFont
:(GSFontRef
)font ellipsis
:(WebEllipsisStyle
)ellipsisStyle alignment
:(WebTextAlignment
)alignment lineSpacing
:(int)lineSpacing includeEmoji
:(BOOL
)includeEmoji
;
51 - (CGSize
)_web_sizeInRect
:(CGRect
)rect withFont
:(GSFontRef
)font ellipsis
:(WebEllipsisStyle
)ellipsisStyle
;
52 - (CGSize
)_web_sizeInRect
:(CGRect
)rect withFont
:(GSFontRef
)font ellipsis
:(WebEllipsisStyle
)ellipsisStyle lineSpacing
:(int)lineSpacing
;
54 // Determine the secured version of this string
55 - (NSString
*)_web_securedStringIncludingLastCharacter
:(BOOL
)includingLastCharacter
;