Table of Contents

Method Measure

Namespace
DocWright.Fonts
Assembly
DocWright.Fonts.dll

Measure(ReadOnlySpan<char>, in FontKey, Twips, IConversionDiagnostics?)

Measures a run with a logical font key and returns immutable per-cluster advances.

public TextMeasurement Measure(ReadOnlySpan<char> text, in FontKey key, Twips sizeTwips, IConversionDiagnostics? diagnostics = null)

Parameters

text ReadOnlySpan<char>

The text to measure.

key FontKey

The logical font request.

sizeTwips Twips

The em size in twips.

diagnostics IConversionDiagnostics

The diagnostics sink, or null to discard diagnostics.

Returns

TextMeasurement

The immutable measurement result.

Measure(ReadOnlySpan<char>, in FontKey, Twips, ClusterAdvanceBuffer, IConversionDiagnostics?)

Measures a run with a logical font key into a caller-provided reusable buffer.

public TextLineMetrics Measure(ReadOnlySpan<char> text, in FontKey key, Twips sizeTwips, ClusterAdvanceBuffer output, IConversionDiagnostics? diagnostics = null)

Parameters

text ReadOnlySpan<char>

The text to measure.

key FontKey

The logical font request.

sizeTwips Twips

The em size in twips.

output ClusterAdvanceBuffer

The output buffer receiving per-cluster advances (cleared first).

diagnostics IConversionDiagnostics

The diagnostics sink, or null to discard diagnostics.

Returns

TextLineMetrics

The aggregate line metrics.

Exceptions

ArgumentNullException

output is null.

ArgumentOutOfRangeException

sizeTwips is negative.

Measure(ReadOnlySpan<char>, FontFace, Twips, Twips, ClusterAdvanceBuffer)

Measures a run against an already resolved face into a reusable buffer.

public TextLineMetrics Measure(ReadOnlySpan<char> text, FontFace face, Twips sizeTwips, Twips kerningThreshold, ClusterAdvanceBuffer output)

Parameters

text ReadOnlySpan<char>

The text to measure.

face FontFace

The concrete face.

sizeTwips Twips

The em size in twips.

kerningThreshold Twips

The minimum size at which kerning applies; zero disables kerning.

output ClusterAdvanceBuffer

The output buffer receiving per-cluster advances (cleared first).

Returns

TextLineMetrics

The aggregate line metrics.

Exceptions

ArgumentNullException

face or output is null.

ArgumentOutOfRangeException

sizeTwips is negative.