Instance Method

strikethroughGlyphRange(_:strikethroughType:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:)

Calculates and draws strikethrough for the specified glyphs.

Declaration

iOS, Mac Catalyst, tvOS
func strikethroughGlyphRange(_ glyphRange: NSRange, strikethroughType strikethroughVal: NSUnderlineStyle, lineFragmentRect lineRect: CGRect, lineFragmentGlyphRange lineGlyphRange: NSRange, containerOrigin: CGPoint)
macOS
func strikethroughGlyphRange(_ glyphRange: NSRange, strikethroughType strikethroughVal: NSUnderlineStyle, lineFragmentRect lineRect: NSRect, lineFragmentGlyphRange lineGlyphRange: NSRange, containerOrigin: NSPoint)

Parameters

glyphRange

The range of glyphs for which to draw a strikethrough. The range must belong to a single line fragment rectangle (as returned by lineFragmentRect(forGlyphAt:effectiveRange:)).

strikethroughVal

The style of underlining to draw. This value is a mask derived from the value for underlineStyle—for example, (NSUnderlinePatternDash | NSUnderlineStyleThick | NSUnderlineByWordMask). Subclasses can define custom underlining styles.

lineRect

The line fragment rectangle containing the glyphs to draw strikethrough for.

lineGlyphRange

The range of all glyphs within lineRect.

containerOrigin

The origin of the line fragment rectangle’s NSTextContainer in its NSTextView.

Discussion

This method determines which glyphs actually need to have a strikethrough drawn based on strikethroughVal. After determining which glyphs to draw strikethrough on, this method invokes drawStrikethrough(forGlyphRange:strikethroughType:baselineOffset:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:) for each contiguous range of glyphs that requires it.

See Also

Drawing

func drawBackground(forGlyphRange: NSRange, at: CGPoint)

Draws background marks for the specified glyphs, which must lie completely within a single text container.

func drawGlyphs(forGlyphRange: NSRange, at: CGPoint)

Draws the specified glyphs, which must lie completely within a single text container.

func underlineGlyphRange(NSRange, underlineType: NSUnderlineStyle, lineFragmentRect: CGRect, lineFragmentGlyphRange: NSRange, containerOrigin: CGPoint)

Calculates subranges to be underlined for the specified glyphs and draws the underlining as appropriate.

Glyph Attributes

Attributes that are used only inside the glyph generation machinery, but must also be shared between components.