ImageTextMeasurer Class

Measures the texts of a chart with the fonts of Meziantou.Framework.Imaging: the widths are the ones TextLayout draws.

public sealed class ImageTextMeasurer : ITextMeasurer
Implements

Constructors

NameDescription
ImageTextMeasurer(Font, Font?)Initializes a new instance of the ImageTextMeasurer class.

ImageTextMeasurer(Font, Font?)

ImageTextMeasurer.cs

Initializes a new instance of the ImageTextMeasurer class.

public ImageTextMeasurer(Font regular, Font? bold = null)

Parameters

regular Font
The font of the regular texts.
bold Font?
The font of the bold texts, or null for regular.

Properties

NameDescription
FontFamilyGets the family name of the regular font.

Gets the family name of the regular font.

public string FontFamily { get; }

Property value

string

Methods

NameDescription
Measure(string, ChartFont)Measures a line of text.

Measure(string, ChartFont)

ImageTextMeasurer.cs

Measures a line of text.

public TextMetrics Measure(string text, ChartFont font)

Parameters

text string
The text, on one line.
font ChartFont
The size and the weight of the font.

Returns

TextMetrics The dimensions of the text.