ITextMeasurer Interface

Measures text, so the layout of a chart or a diagram (margins, label rotation, truncation, wrapping) fits the font that draws it.

public interface ITextMeasurer

Properties

NameDescription
FontFamilyGets the font family the measured text is drawn with, as a CSS font-family value.
FontsGets the fonts the text is measured with, or null when the measurer does not have font files (for instance, the metrics of AfmTextMeasurer). A chart or a diagram sets them as the fonts of its scene (Scene.Fonts), so the renderers draw the text with the fonts that measured it.

FontFamily

Gets the font family the measured text is drawn with, as a CSS font-family value.

string FontFamily { get; }

Property value

string

Gets the fonts the text is measured with, or null when the measurer does not have font files (for instance, the metrics of AfmTextMeasurer). A chart or a diagram sets them as the fonts of its scene (Scene.Fonts), so the renderers draw the text with the fonts that measured it.

public SceneFontCollection? Fonts { get; }

Property value

SceneFontCollection?

Methods

NameDescription
Measure(string, SceneFont)Measures a line of text.
Measure(string, SceneFont, double, double)Measures a line of text with a letter spacing and a word spacing (SceneText.LetterSpacing, SceneText.WordSpacing), as the renderers draw it.

Measure overloads

Measure(string, SceneFont)

Measures a line of text.

TextMetrics Measure(string text, SceneFont font)
Parameters
text string
The text, on one line.
font SceneFont
The size, the weight and the style of the font.
Returns

TextMetrics The dimensions of the text.

Measure(string, SceneFont, double, double)

ITextMeasurer.cs

Measures a line of text with a letter spacing and a word spacing (SceneText.LetterSpacing, SceneText.WordSpacing), as the renderers draw it.

public TextMetrics Measure(string text, SceneFont font, double letterSpacing, double wordSpacing)
Parameters
text string
The text, on one line.
font SceneFont
The size, the weight and the style of the font.
letterSpacing double
The space added after each character, in pixels.
wordSpacing double
The space added after each space (U+0020 and U+00A0), in pixels.
Returns

TextMetrics The dimensions of the text: its width includes the spacing.

Remarks

The default implementation adds the spacing after each grapheme cluster to ITextMeasurer.Measure. The measurers that shape the text measure it as the renderers draw it with a letter spacing: without the optional ligatures, and with the spacing after each cluster of glyphs.