fillBackgroundRectArray(_:count:forCharacterRange:color:)
Fills background rectangles with a color.
Declaration
func fillBackgroundRectArray(_ rectArray: UnsafePointer<NSRect>, count rectCount: Int, forCharacterRange charRange: NSRange, color: NSColor)Parameters
- rectArray:
The array of rectangles to fill.
- rectCount:
The number of rectangles in
rectArray. - charRange:
The range of characters whose background rectangles are filled.
- color:
The fill color.
Discussion
This is the primitive method used by drawBackground(forGlyphRange:at:), providing a finer-grained override point for actually filling rectangles with a particular background color for a background color attribute, a selected or marked range highlight, a block decoration, or any other rectangle fill needed by that method. As with showPackedGlyphs:length:glyphRange:atPoint:font:color:printingAdjustment:, the charRange and color parameters are passed in merely for informational purposes; the color is already set in the graphics state. If for any reason you modify it, you must restore it before returning from this method.
This method operates in terms of character ranges, because the relevant attributes are expressed on characters, and they don’t always lie on glyph boundaries—for example, when one character of an “fi” ligature is highlighted.
You should never call this method, but you might override it. The default implementation simply fills the rectangles in the specified array. The graphics operation used for this fill is controlled by a link check; for compatibility reasons, it is NSCompositeCopy for applications linked prior to OS X v10.6 and NSCompositeSourceOver for applications linked on macOS 10.6 or later. Applications can control the operation used, or modify the drawing, by overriding this method in an NSLayoutManager subclass.
See Also
Drawing
drawBackground(forGlyphRange:at:)drawGlyphs(forGlyphRange:at:)drawStrikethrough(forGlyphRange:strikethroughType:baselineOffset:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:)drawUnderline(forGlyphRange:underlineType:baselineOffset:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:)showCGGlyphs(_:positions:count:font:textMatrix:attributes:in:)strikethroughGlyphRange(_:strikethroughType:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:)underlineGlyphRange(_:underlineType:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:)