Table of Contents

Method DrawText

Namespace
PaintDotNet.Direct2D1
Assembly
PaintDotNet.Windows.dll

DrawText(string, ITextFormat, RectFloat, IDeviceBrush, DrawTextOptions, TextMeasuringMode)

Draws the specified text using the format information provided by an ITextFormat object.

void DrawText(string text, ITextFormat textFormat, RectFloat layoutRect, IDeviceBrush defaultFillBrush, DrawTextOptions options = DrawTextOptions.EnableColorFont, TextMeasuringMode measuringMode = TextMeasuringMode.Natural)

Parameters

text string

The text to draw.

textFormat ITextFormat

An object that describes formatting details of the text to draw, such as the font, the font size, and flow direction.

layoutRect RectFloat

The size and position of the area in which the text is drawn.

defaultFillBrush IDeviceBrush

The brush used to paint the text.

options DrawTextOptions

A value that indicates whether the text should be snapped to pixel boundaries, whether the text should be clipped to the layout rectangle, and whether colored glyphs are enabled.

measuringMode TextMeasuringMode

A value that indicates how glyph metrics are used to measure text when it is formatted.

Remarks

DrawText(string, ITextFormat, RectFloat, IDeviceBrush?, ISvgGlyphStyle?, int, DrawTextOptions, TextMeasuringMode)

Draws the text within the given layout rectangle.
By default, this method performs baseline snapping and renders color versions of glyphs in color fonts.

void DrawText(string text, ITextFormat textFormat, RectFloat layoutRect, IDeviceBrush? defaultFillBrush, ISvgGlyphStyle? svgGlyphStyle, int colorPaletteIndex = 0, DrawTextOptions options = DrawTextOptions.EnableColorFont, TextMeasuringMode measuringMode = TextMeasuringMode.Natural)

Parameters

text string

The text to draw.

textFormat ITextFormat

An object that describes formatting details of the text to draw, such as the font, the font size, and flow direction.

layoutRect RectFloat

The size and position of the area in which the text is drawn.

defaultFillBrush IDeviceBrush

The brush used to paint the text.

svgGlyphStyle ISvgGlyphStyle

Values for context-fill, context-stroke, and context-value that are used when rendering SVG glyphs.

colorPaletteIndex int

The index used to select a color palette within a color font.

options DrawTextOptions

A value that indicates whether the text should be snapped to pixel boundaries, whether the text should be clipped to the layout rectangle, and whether colored glyphs are enabled.

measuringMode TextMeasuringMode

A value that indicates how glyph metrics are used to measure text when it is formatted.