Table of Contents

Method GetRecommendedRenderingMode

Namespace
PaintDotNet.DirectWrite
Assembly
PaintDotNet.Windows.dll

GetRecommendedRenderingMode(float, float, TextMeasuringMode, ITextRenderingParameters?)

Determines the recommended rendering mode for the font, using the specified size and rendering parameters.

TextRenderingMode GetRecommendedRenderingMode(float emSize, float pixelsPerDip, TextMeasuringMode measuringMode, ITextRenderingParameters? renderingParameters)

Parameters

emSize float

The logical size of the font in DIP units. A DIP ("device-independent pixel") equals 1/96 inch.

pixelsPerDip float

The number of physical pixels per DIP. For example, if the DPI of the rendering surface is 96, this value is 1.0f. If the DPI is 120, this value is 120.0f/96.

measuringMode TextMeasuringMode

The measuring method that will be used for glyphs in the font. Renderer implementations may choose different rendering modes for different measuring methods, for example TextRenderingMode.Natural for TextMeasuringMode.Natural, TextRenderingMode.GdiClassic for TextMeasuringMode.GdiClassic, and TextRenderingMode.GdiNatural for TextMeasuringMode.GdiNatural.

renderingParameters ITextRenderingParameters

An object that contains rendering settings such as gamma level, enhanced contrast, and ClearType level. This parameter is necessary in case the rendering parameters object overrides the rendering mode.

Returns

TextRenderingMode

A value that indicates the recommended rendering mode to use.

GetRecommendedRenderingMode(float, Vector2Float, in Matrix3x2Float?, bool, OutlineThreshold, TextMeasuringMode, ITextRenderingParameters?)

Determines the recommended text rendering and grid-fit mode to be used based on the font, size, world transform, and measuring mode.

TextRenderingMode GetRecommendedRenderingMode(float emSize, Vector2Float dpi, in Matrix3x2Float? transform, bool isSideways, OutlineThreshold outlineThreshold, TextMeasuringMode measuringMode, ITextRenderingParameters? renderingParameters)

Parameters

emSize float

Logical font size in DIPs.

dpi Vector2Float

Number of pixels per logical inch in the horizontal (X) and vertical (Y) directions.

transform Matrix3x2Float?

A matrix that describes the world transform, or null for identity.

isSideways bool

Specifies whether the font is sideways. true if the font is sideways; otherwise, false.

outlineThreshold OutlineThreshold

A value that specifies the quality of the graphics system's outline rendering, affects the size threshold above which outline rendering is used.

measuringMode TextMeasuringMode

A value that specifies the method used to measure during text layout. For proper glyph spacing, this method returns a rendering mode that is compatible with the specified measuring mode.

renderingParameters ITextRenderingParameters

The rendering parameters object. This parameter is necessary in case the rendering parameters object overrides the rendering mode.

Returns

TextRenderingMode

The recommended rendering mode.

Remarks

Unlike the pixels-per-DIP overload, this one can return NaturalSymmetricDownsampled (which DWrite recommends whenever the DPI scale is >= ~1.8x, i.e. DPI >= ~172.8), so reproducing native high-DPI rasterization requires resolving through this overload.