PSPDFWord
Objective-C
@interface PSPDFWord : NSObject <NSCopying, NSSecureCoding>
Swift
class Word : NSObject, NSCopying, NSSecureCoding
Represents a word. Formed out of (usually) multiple glyphs.
-
Unavailable
Not the designated initializer
Undocumented
Declaration
Objective-C
PSPDF_EMPTY_INIT_UNAVAILABLE
-
Unavailable
Not the designated initializer
Undocumented
Declaration
Objective-C
PSPDF_EMPTY_INIT_UNAVAILABLE
-
Convenience initializer to create a
PSPDFWord
. The initializer will fail if there are no glyphs inglyphs
.Declaration
Objective-C
- (nullable instancetype)initWithGlyphs: (nonnull NSArray<PSPDFGlyph *> *)wordGlyphs frame:(CGRect)frame;
Swift
convenience init?(glyphs wordGlyphs: [PSPDFGlyph], frame: CGRect)
Parameters
wordGlyphs
The glyphs that are a part of the text block that is being instantiated.
frame
The frame of the word. Pass in
CGRectNull
if you want the frame to be calculated from the values inglyphs
. -
Designated initializer. The initializer will fail if the range of text is invalid (
NSNotFound
for its location/length). Note that theglyphs
array will be empty when using this initializer.Declaration
Objective-C
- (nullable instancetype)initWithRange:(NSRange)textRange text:(nonnull NSString *)text frame:(CGRect)frame;
Swift
init?(range textRange: NSRange, text: String, frame: CGRect)
Parameters
textRange
The range of text (in
PSPDFTextParser.text
) that the receiver is representing.text
-
Returns the content of the word (all glyphs merged together)
Declaration
Objective-C
@property (nonatomic, readonly) NSString *_Nonnull stringValue;
Swift
var stringValue: String { get }
-
All glyphs merged together in the smallest possible bounding box. As an optimization, only the first and last glyph will be used for frame calculations.
Declaration
Objective-C
@property (nonatomic) CGRect frame;
Swift
var frame: CGRect { get set }
-
The range of glyphs (in
PSPDFTextParser.glyphs
) that the receiver is representing. ReturnsPSPDFInvalidGlyphRange
if the receiver does not have any glyphs.Declaration
Objective-C
@property (nonatomic, readonly) NSRange range;
Swift
var range: NSRange { get }
-
Set to YES if this is the last word on a textBlock.
Declaration
Objective-C
@property (nonatomic) BOOL lineBreaker;
Swift
var lineBreaker: Bool { get set }