willSetLineFragmentRect(_:forGlyphRange:usedRect:baselineOffset:)
Notifies subclasses that the typesetter is about to set a new line fragment.
Declaration
func willSetLineFragmentRect(_ lineRect: UnsafeMutablePointer<NSRect>, forGlyphRange glyphRange: NSRange, usedRect: UnsafeMutablePointer<NSRect>, baselineOffset: UnsafeMutablePointer<CGFloat>)Discussion
The typesetter calls this method before calling setLineFragmentRect(_:forGlyphRange:usedRect:), which stores the actual line fragment rectangle location in the layout manager.
The lineRect argument is the rectangle in which the glyphs in glyphRange are laid out. The usedRect argument indicates 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). The usedRect must be equal to or contained within lineRect. The baselineOffset argument is the vertical distance in pixels from the line fragment origin to the baseline on which the glyphs align.
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
boundingBox(forControlGlyphAt:for:proposedLineFragment:glyphPosition:characterIndex:)getLineFragmentRect(_:usedRect:forParagraphSeparatorGlyphRange:atProposedOrigin:)hyphenCharacter(forGlyphAt:)hyphenationFactor(forGlyphAt:)shouldBreakLine(byHyphenatingBeforeCharacterAt:)shouldBreakLine(byWordBeforeCharacterAt:)setHardInvalidation(_:forGlyphRange:)