---
title: "drawStrikethrough(forGlyphRange:strikethroughType:baselineOffset:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nslayoutmanager/drawstrikethrough(forglyphrange:strikethroughtype:baselineoffset:linefragmentrect:linefragmentglyphrange:containerorigin:)"
---

# drawStrikethrough(forGlyphRange:strikethroughType:baselineOffset:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:)

Draws a strikethrough for the specified glyphs.

## Declaration

```swift
func drawStrikethrough(forGlyphRange glyphRange: NSRange, strikethroughType strikethroughVal: NSUnderlineStyle, baselineOffset: CGFloat, 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 doc://com.apple.appkit/documentation/AppKit/NSLayoutManager/lineFragmentRect(forGlyphAt:effectiveRange:)).
- `strikethroughVal`: The style of strikethrough to draw. This value is a mask derived from the value for doc://com.apple.documentation/documentation/Foundation/NSAttributedString/Key/underlineStyle—for example, (NSUnderlinePatternDash | NSUnderlineStyleThick). Subclasses can define custom strikethrough styles.
- `baselineOffset`: Indicates how far above the text baseline the underline should be drawn.
- `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

Discussion This method is invoked automatically by strikethroughGlyphRange(_:strikethroughType:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:); you should rarely need to invoke it directly. This method’s strikethroughVal parameter does not take account of any setting forNSUnderlineByWordMask because that’s taken care of by underlineGlyphRange(_:underlineType:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:).

## See Also

### Drawing

- [drawBackground(forGlyphRange:at:)](appkit/nslayoutmanager/drawbackground(forglyphrange:at:).md)
- [drawGlyphs(forGlyphRange:at:)](appkit/nslayoutmanager/drawglyphs(forglyphrange:at:).md)
- [drawUnderline(forGlyphRange:underlineType:baselineOffset:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:)](appkit/nslayoutmanager/drawunderline(forglyphrange:underlinetype:baselineoffset:linefragmentrect:linefragmentglyphrange:containerorigin:).md)
- [fillBackgroundRectArray(_:count:forCharacterRange:color:)](appkit/nslayoutmanager/fillbackgroundrectarray(_:count:forcharacterrange:color:).md)
- [showCGGlyphs(_:positions:count:font:textMatrix:attributes:in:)](appkit/nslayoutmanager/showcgglyphs(_:positions:count:font:textmatrix:attributes:in:).md)
- [strikethroughGlyphRange(_:strikethroughType:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:)](appkit/nslayoutmanager/strikethroughglyphrange(_:strikethroughtype:linefragmentrect:linefragmentglyphrange:containerorigin:).md)
- [underlineGlyphRange(_:underlineType:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:)](appkit/nslayoutmanager/underlineglyphrange(_:underlinetype:linefragmentrect:linefragmentglyphrange:containerorigin:).md)
