DTCoreTextGlyphRun Class Reference
| Inherits from | NSObject |
| Declared in | DTCoreTextGlyphRun.h |
Overview
This class is an Objective-C wrapper around CTRun and represents a glyph run. That is, a number of characters from the original NSAttributedString that share the same characteristics and attributes.
Editor-related extensions to
Tasks
Creating Glyph Runs
Drawing
Getting Information
-
– frameOfGlyphAtIndex: -
– imageBoundsInContext: -
– stringRange -
– stringIndices -
frameproperty -
numberOfGlyphsproperty -
attributesproperty -
hyperlinkproperty -
– isTrailingWhitespace -
ascentproperty -
descentproperty -
leadingproperty -
widthproperty -
writingDirectionIsRightToLeftproperty -
attachmentproperty
DTRichText Methods
Properties
ascent
The ascent (height above the baseline) of the receiver
@property (nonatomic, readonly) CGFloat ascentDeclared In
DTCoreTextGlyphRun.hattachment
The text attachment of the receiver, or nil if there is none
@property (nonatomic, readonly) DTTextAttachment *attachmentDeclared In
DTCoreTextGlyphRun.hattributes
The Core Text attributes that are shared by all gylphs of the receiver
@property (nonatomic, readonly) NSDictionary *attributesDeclared In
DTCoreTextGlyphRun.hdescent
The descent (height below the baseline) of the receiver
@property (nonatomic, readonly) CGFloat descentDeclared In
DTCoreTextGlyphRun.hframe
The frame rectangle of the glyph run, relative to the layout frame coordinate system
@property (nonatomic, readonly) CGRect frameDeclared In
DTCoreTextGlyphRun.hhyperlink
Returns YES if the receiver is part of a hyperlink, NO otherwise
@property (nonatomic, assign, readonly, getter=isHyperlink) BOOL hyperlinkDeclared In
DTCoreTextGlyphRun.hleading
The leading (additional space above the ascent) of the receiver
@property (nonatomic, readonly) CGFloat leadingDeclared In
DTCoreTextGlyphRun.hnumberOfGlyphs
The number of glyphs that the receiver is made up of
@property (nonatomic, readonly) NSInteger numberOfGlyphsDeclared In
DTCoreTextGlyphRun.hInstance Methods
adjustStringRangeToStartAtIndex:
Modifies the internal string range to begin at a given index
- (void)adjustStringRangeToStartAtIndex:(NSInteger)indexParameters
- index
The new starting string index to set
Discussion
This is needed because due to incremental merging the string indices might change
Declared In
DTRichTextCategories.hdrawDecorationInContext:
Draws the receiver’s decoration into the given context with the position that it derives from the layout line it belongs to. Decoration is background highlighting, underline and strike-through.
- (void)drawDecorationInContext:(CGContextRef)contextParameters
- context
The graphics context to draw into
Declared In
DTCoreTextGlyphRun.hdrawInContext:
Draws the receiver into the given context with the position that it derives from the layout line it belongs to.
- (void)drawInContext:(CGContextRef)contextParameters
- context
The graphics context to draw into
See Also
- drawDecorationInContext: for drawing the receiver’s decoration
Declared In
DTCoreTextGlyphRun.hframeOfGlyphAtIndex:
Determines the frame of a specific glyph
- (CGRect)frameOfGlyphAtIndex:(NSInteger)indexParameters
- index
The index of the glyph
Return Value
The frame of the glyph
Declared In
DTCoreTextGlyphRun.himageBoundsInContext:
The bounds of an image encompassing the entire run.
- (CGRect)imageBoundsInContext:(CGContextRef)contextParameters
- context
The graphics context used for the measurement
Return Value
The rectangle containing the result
Declared In
DTCoreTextGlyphRun.hinitWithRun:layoutLine:offset:
Creates a new glyph run from a CTRun, belonging to a given layout line and with a given offset from the left line origin.
- (id)initWithRun:(CTRunRef)run layoutLine:(DTCoreTextLayoutLine *)layoutLine offset:(CGFloat)offsetParameters
- run
The Core Text glyph run to wrap
- layoutLine
The layout line that this glyph run belongs to
- offset
The offset from the left line origin to place the glyph run at
Return Value
An initialized DTCoreTextGlyphRun
Declared In
DTCoreTextGlyphRun.hisTrailingWhitespace
Returns YES if the receiver represents trailing whitespace in a line.
- (BOOL)isTrailingWhitespaceDiscussion
This can be used to avoid drawing of background color, strikeout or underline for empty trailing white space glyph runs.
Declared In
DTCoreTextGlyphRun.hnewPathWithGlyphs
Creates a CGPath containing the shapes of all glyphs in the receiver
- (CGPathRef)newPathWithGlyphsDeclared In
DTCoreTextGlyphRun.h