willSetLineFragmentRect(_:forGlyphRange:usedRect:baselineOffset:)
Called by the typesetter just prior to storing the actual line fragment rectangle location in the layout manager.
Declaration
func willSetLineFragmentRect(_ lineRect: NSRectPointer, forGlyphRange glyphRange: NSRange, usedRect: NSRectPointer, baselineOffset: UnsafeMutablePointer<CGFloat>)Parameters
- lineRect:
The rectangle in which the glyphs in
glyphRangeare laid out. - glyphRange:
The range of the glyphs to lay out.
- usedRect:
The portion of
lineRect, in the NSTextContainer object’s coordinate system, that actually contains glyphs or other marks that are drawn (including the text container’s line fragment padding). TheusedRectmust be equal to or contained withinlineRect. - baselineOffset:
The vertical distance in pixels from the line fragment origin to the baseline on which the glyphs align.
Discussion
Called by the typesetter just prior to calling setLineFragmentRect(_:forGlyphRange:usedRect:baselineOffset:) which stores the actual line fragment rectangle location in the layout manager.
A subclass can override this method to customize the text layout process. For example, it could change the shape of the line fragment rectangle. The subclass is responsible for ensuring that the modified rectangle remains valid (for example, that it lies within the text container).
See Also
Laying out glyphs
layoutGlyphs(in:startingAtGlyphIndex:maxNumberOfLineFragments:nextGlyphIndex:)boundingBox(forControlGlyphAt:for:proposedLineFragment:glyphPosition:characterIndex:)getLineFragmentRect(_:usedRect:forParagraphSeparatorGlyphRange:atProposedOrigin:)getLineFragmentRect(_:usedRect:remaining:forStartingGlyphAt:proposedRect:lineSpacing:paragraphSpacingBefore:paragraphSpacingAfter:)hyphenCharacter(forGlyphAt:)hyphenationFactor(forGlyphAt:)shouldBreakLine(byHyphenatingBeforeCharacterAt:)shouldBreakLine(byWordBeforeCharacterAt:)setHardInvalidation(_:forGlyphRange:)