Instance Method

drawUnderlineForGlyphRange:underlineType:baselineOffset:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:

Draws underlining for the glyphs in a given range.

Declaration

iOS, tvOS
- (void)drawUnderlineForGlyphRange:(NSRange)glyphRange underlineType:(NSUnderlineStyle)underlineVal baselineOffset:(CGFloat)baselineOffset lineFragmentRect:(CGRect)lineRect lineFragmentGlyphRange:(NSRange)lineGlyphRange containerOrigin:(CGPoint)containerOrigin;
macOS
- (void)drawUnderlineForGlyphRange:(NSRange)glyphRange underlineType:(NSUnderlineStyle)underlineVal baselineOffset:(CGFloat)baselineOffset lineFragmentRect:(NSRect)lineRect lineFragmentGlyphRange:(NSRange)lineGlyphRange containerOrigin:(NSPoint)containerOrigin;

Parameters

glyphRange

A range of glyphs, which must belong to a single line fragment rectangle (as returned by lineFragmentRectForGlyphAtIndex:effectiveRange:).

underlineVal

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

baselineOffset

Specifies the distance from the bottom of the bounding box of the specified glyphs in the specified range to their baseline.

lineRect

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

lineGlyphRange

The range of all glyphs within lineRect.

containerOrigin

The origin of the lineRectNSTextContainer in its NSTextView.

Discussion

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

See Also

Drawing

- drawBackgroundForGlyphRange:atPoint:

Draws background marks for the given glyph range, which must lie completely within a single text container.

- drawGlyphsForGlyphRange:atPoint:

Draws the glyphs in the given glyph range, which must lie completely within a single text container.

- fillBackgroundRectArray:count:forCharacterRange:color:

Fills background rectangles with a color.

- showCGGlyphs:positions:count:font:matrix:attributes:inContext:

Renders the glyphs at the specified positions and attributes into the graphicsContext.

Deprecated
- strikethroughGlyphRange:strikethroughType:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:

Calculates and draws strikethrough for the glyphs in the given range.

- underlineGlyphRange:underlineType:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:

Calculates subranges to be underlined for the glyphs in a given range and draws the underlining as appropriate.