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:
-
frame
property -
glyphRuns
property -
ascent
property -
descent
property -
leading
property -
trailingWhitespaceWidth
property -
underlineOffset
property -
lineHeight
property -
paragraphStyle
property -
textBlocks
property -
attachments
property -
baselineOrigin
property -
writingDirectionIsRightToLeft
property -
stringLocationOffset
property -
– isHorizontalRule
Creating Variants
DTRichText Methods
Properties
ascent
The ascent (height above the baseline) of the receiver
@property (nonatomic, assign) CGFloat ascent
Declared In
DTCoreTextLayoutLine.h
attachments
The text attachments occuring in glyph runs of the receiver.
@property (nonatomic, readonly) NSArray *attachments
Declared In
DTCoreTextLayoutLine.h
baselineOrigin
The baseline origin of the receiver
@property (nonatomic, assign) CGPoint baselineOrigin
Declared In
DTCoreTextLayoutLine.h
descent
The descent (height below the baseline) of the receiver
@property (nonatomic, readonly) CGFloat descent
Declared In
DTCoreTextLayoutLine.h
frame
The frame of the receiver relative to the layout frame
@property (nonatomic, assign) CGRect frame
Declared In
DTCoreTextLayoutLine.h
glyphRuns
The glyph runs that the line contains.
@property (nonatomic, readonly) NSArray *glyphRuns
Declared In
DTCoreTextLayoutLine.h
leading
The leading (additional space above the ascent) of the receiver
@property (nonatomic, readonly) CGFloat leading
Declared In
DTCoreTextLayoutLine.h
lineHeight
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 lineHeight
Declared In
DTCoreTextLayoutLine.h
paragraphStyle
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 *paragraphStyle
Declared In
DTCoreTextLayoutLine.h
stringLocationOffset
The offset to modify internal string location to get actual location
@property (nonatomic, readonly) NSInteger stringLocationOffset
Declared In
DTCoreTextLayoutLine.h
textBlocks
The text blocks that the receiver belongs to.
@property (nonatomic, readonly) NSArray *textBlocks
Declared In
DTCoreTextLayoutLine.h
trailingWhitespaceWidth
The width of the traling whitespace of the receiver
@property (nonatomic, readonly) CGFloat trailingWhitespaceWidth
Declared In
DTCoreTextLayoutLine.h
Instance Methods
adjustStringRangeToStartAtIndex:
Modifies the internal string range to begin at a given index
- (void)adjustStringRangeToStartAtIndex:(NSInteger)index
Parameters
- 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.h
drawInContext:
Draws the receiver in a given graphics context
- (void)drawInContext:(CGContextRef)context
Parameters
- context
The graphics context to draw into
Declared In
DTCoreTextLayoutLine.h
frameOfGlyphAtIndex:
Determines the frame of a specific glyph
- (CGRect)frameOfGlyphAtIndex:(NSInteger)index
Parameters
- index
The index of the glyph
Return Value
The frame of the glyph
Declared In
DTCoreTextLayoutLine.h
frameOfGlyphsWithRange:
The frame of a number of glyphs with a given range
- (CGRect)frameOfGlyphsWithRange:(NSRange)range
Parameters
- range
The range
Return Value
The rectangle containing the result
Declared In
DTCoreTextLayoutLine.h
glyphRunsWithRange:
Retrieves the glyphRuns with a given range
- (NSArray *)glyphRunsWithRange:(NSRange)range
Parameters
- range
The range
Return Value
An array of glyph runs
Declared In
DTCoreTextLayoutLine.h
imageBoundsInContext:
The bounds of an image encompassing the entire run.
- (CGRect)imageBoundsInContext:(CGContextRef)context
Parameters
- context
The graphics context used for the measurement
Return Value
The rectangle containing the result
Declared In
DTCoreTextLayoutLine.h
initWithLine:
Creates a layout line from a given CTLine
- (id)initWithLine:(CTLineRef)line
Parameters
- line
The Core Text line to wrap
Return Value
A prepared layout line
Declared In
DTCoreTextLayoutLine.h
initWithLine:stringLocationOffset:
Creates a layout line from a given CTLine
- (id)initWithLine:(CTLineRef)line stringLocationOffset:(NSInteger)stringLocationOffset
Parameters
- 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.h
isHorizontalRule
Method to efficiently determine if the receiver is a horizontal rule.
- (BOOL)isHorizontalRule
Discussion
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.h
justifiedLineWithFactor:justificationWidth:
Creates a version of the receiver that is justified to the given width.
- (DTCoreTextLayoutLine *)justifiedLineWithFactor:(CGFloat)justificationFactor justificationWidth:(CGFloat)justificationWidth
Parameters
- justificationFactor
Full or partial justification. When set to
1.0
or 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 to0
or 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.h
newPathWithGlyphs
Creates a CGPath
containing the shapes of all glyphs in the line
- (CGPathRef)newPathWithGlyphs
Declared In
DTCoreTextLayoutLine.h
numberOfGlyphs
The number of glyphs the receiver consists of
- (NSInteger)numberOfGlyphs
Return Value
the number of glyphs
Declared In
DTCoreTextLayoutLine.h
offsetForStringIndex:
Determins the graphical offset for a given string index
- (CGFloat)offsetForStringIndex:(NSInteger)index
Parameters
- index
The string index
Return Value
The offset
Declared In
DTCoreTextLayoutLine.h
stringIndexForPosition:
Determines the string index that is closest to a given point
- (NSInteger)stringIndexForPosition:(CGPoint)position
Parameters
- position
The position to determine the string index for
Return Value
The string index
Declared In
DTCoreTextLayoutLine.h