DTCoreTextLayoutLine Class Reference
| Inherits from | NSObject |
| Declared in | DTCoreTextLayoutLine.h |
Overview
This class represents one layouted line and contains a number of glyph runs.
Editor-related extensions to
Tasks
Creating Layout Lines
Drawing Layout Lines
Getting Information about Layout Lines
-
– stringRange -
– numberOfGlyphs -
– frameOfGlyphAtIndex: -
– glyphRunsWithRange: -
– frameOfGlyphsWithRange: -
– imageBoundsInContext: -
– stringIndices -
– offsetForStringIndex: -
– stringIndexForPosition: -
frameproperty -
glyphRunsproperty -
ascentproperty -
descentproperty -
leadingproperty -
trailingWhitespaceWidthproperty -
underlineOffsetproperty -
lineHeightproperty -
paragraphStyleproperty -
textBlocksproperty -
attachmentsproperty -
baselineOriginproperty -
writingDirectionIsRightToLeftproperty -
stringLocationOffsetproperty -
– isHorizontalRule
Creating Variants
DTRichText Methods
Properties
ascent
The ascent (height above the baseline) of the receiver
@property (nonatomic, assign) CGFloat ascentDeclared In
DTCoreTextLayoutLine.hattachments
The text attachments occuring in glyph runs of the receiver.
@property (nonatomic, readonly) NSArray *attachmentsDeclared In
DTCoreTextLayoutLine.hbaselineOrigin
The baseline origin of the receiver
@property (nonatomic, assign) CGPoint baselineOriginDeclared In
DTCoreTextLayoutLine.hdescent
The descent (height below the baseline) of the receiver
@property (nonatomic, readonly) CGFloat descentDeclared In
DTCoreTextLayoutLine.hframe
The frame of the receiver relative to the layout frame
@property (nonatomic, assign) CGRect frameDeclared In
DTCoreTextLayoutLine.hglyphRuns
The glyph runs that the line contains.
@property (nonatomic, readonly) NSArray *glyphRunsDeclared In
DTCoreTextLayoutLine.hleading
The leading (additional space above the ascent) of the receiver
@property (nonatomic, readonly) CGFloat leadingDeclared In
DTCoreTextLayoutLine.hlineHeight
The line height of the line. This is determined by getting the maximum font size of all glyph runs of the receiver.
@property (nonatomic, readonly) CGFloat lineHeightDeclared In
DTCoreTextLayoutLine.hparagraphStyle
The paragraph style of the paragraph this line belongs to. All lines in a paragraph are supposed to have the same paragraph style, so this takes the paragraph style of the first glyph run
@property (nonatomic, readonly) DTCoreTextParagraphStyle *paragraphStyleDeclared In
DTCoreTextLayoutLine.hstringLocationOffset
The offset to modify internal string location to get actual location
@property (nonatomic, readonly) NSInteger stringLocationOffsetDeclared In
DTCoreTextLayoutLine.htextBlocks
The text blocks that the receiver belongs to.
@property (nonatomic, readonly) NSArray *textBlocksDeclared In
DTCoreTextLayoutLine.htrailingWhitespaceWidth
The width of the traling whitespace of the receiver
@property (nonatomic, readonly) CGFloat trailingWhitespaceWidthDeclared In
DTCoreTextLayoutLine.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.hdrawInContext:
Draws the receiver in a given graphics context
- (void)drawInContext:(CGContextRef)contextParameters
- context
The graphics context to draw into
Declared In
DTCoreTextLayoutLine.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
DTCoreTextLayoutLine.hframeOfGlyphsWithRange:
The frame of a number of glyphs with a given range
- (CGRect)frameOfGlyphsWithRange:(NSRange)rangeParameters
- range
The range
Return Value
The rectangle containing the result
Declared In
DTCoreTextLayoutLine.hglyphRunsWithRange:
Retrieves the glyphRuns with a given range
- (NSArray *)glyphRunsWithRange:(NSRange)rangeParameters
- range
The range
Return Value
An array of glyph runs
Declared In
DTCoreTextLayoutLine.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
DTCoreTextLayoutLine.hinitWithLine:
Creates a layout line from a given CTLine
- (id)initWithLine:(CTLineRef)lineParameters
- line
The Core Text line to wrap
Return Value
A prepared layout line
Declared In
DTCoreTextLayoutLine.hinitWithLine:stringLocationOffset:
Creates a layout line from a given CTLine
- (id)initWithLine:(CTLineRef)line stringLocationOffset:(NSInteger)stringLocationOffsetParameters
- line
The Core Text line to wrap
- stringLocationOffset
Offset to modify internal string location to get actual location
Return Value
A prepared layout line
Declared In
DTCoreTextLayoutLine.hisHorizontalRule
Method to efficiently determine if the receiver is a horizontal rule.
- (BOOL)isHorizontalRuleDiscussion
Note: This is used to shortcut drawing of text lines and to allow a horizontal rule line have an “endlessly wide” width so that it gets picked up by [DTCoreTextLayoutFrame linesVisibleInRect:].
Declared In
DTCoreTextLayoutLine.hjustifiedLineWithFactor:justificationWidth:
Creates a version of the receiver that is justified to the given width.
- (DTCoreTextLayoutLine *)justifiedLineWithFactor:(CGFloat)justificationFactor justificationWidth:(CGFloat)justificationWidthParameters
- justificationFactor
Full or partial justification. When set to
1.0or greater, full justification is performed. If this parameter is set to less than1.0, varying degrees of partial justification are performed. If it is set to0or less, no justification is performed.
- justificationWidth
The width to which the resultant line is justified. If justificationWidth is less than the actual width of the line, then negative justification is performed (that is, glyphs are squeezed together).
Declared In
DTCoreTextLayoutLine.hnewPathWithGlyphs
Creates a CGPath containing the shapes of all glyphs in the line
- (CGPathRef)newPathWithGlyphsDeclared In
DTCoreTextLayoutLine.hnumberOfGlyphs
The number of glyphs the receiver consists of
- (NSInteger)numberOfGlyphsReturn Value
the number of glyphs
Declared In
DTCoreTextLayoutLine.hoffsetForStringIndex:
Determins the graphical offset for a given string index
- (CGFloat)offsetForStringIndex:(NSInteger)indexParameters
- index
The string index
Return Value
The offset
Declared In
DTCoreTextLayoutLine.hstringIndexForPosition:
Determines the string index that is closest to a given point
- (NSInteger)stringIndexForPosition:(CGPoint)positionParameters
- position
The position to determine the string index for
Return Value
The string index
Declared In
DTCoreTextLayoutLine.h