• DR-IT Software
  • Products
  • Documentation
  • Product page
  • Examples
  • API reference
  • Support
Show / Hide Table of Contents

Interface ITextMeasurer

Measures text advance widths and line heights from font metrics. Implement this interface to substitute an alternative font measurement backend (e.g. SkiaSharp, System.Drawing) without affecting the layout engine.

Namespace: DRIT.Document.Export.Pdf
Assembly: DRIT.Document.dll
Syntax
public interface ITextMeasurer

Methods

Ascent(string, double, bool, bool)

Returns the font ascent in points (distance from baseline to top of em-square).

Declaration
double Ascent(string fontName, double sizePt, bool bold, bool italic)
Parameters
Type Name Description
string fontName
double sizePt
bool bold
bool italic
Returns
Type Description
double

LineHeight(string, double, bool, bool)

Returns the natural line height in points (ascender − descender + line gap) for the given font settings.

Declaration
double LineHeight(string fontName, double sizePt, bool bold, bool italic)
Parameters
Type Name Description
string fontName
double sizePt
bool bold
bool italic
Returns
Type Description
double

MeasureWidth(string, string, double, bool, bool)

Returns the total advance width of text in points at the given font settings. Returns a positive value, or 0 when text is empty.

Declaration
double MeasureWidth(string text, string fontName, double sizePt, bool bold, bool italic)
Parameters
Type Name Description
string text
string fontName
double sizePt
bool bold
bool italic
Returns
Type Description
double

StrikeoutOffsetPt(string, double, bool, bool)

Returns the strikeout stroke offset from the baseline in points. Negative values are above the baseline (the typical case).

Declaration
double StrikeoutOffsetPt(string fontName, double sizePt, bool bold, bool italic)
Parameters
Type Name Description
string fontName
double sizePt
bool bold
bool italic
Returns
Type Description
double

StrikeoutThicknessPt(string, double, bool, bool)

Returns the strikeout stroke thickness in points.

Declaration
double StrikeoutThicknessPt(string fontName, double sizePt, bool bold, bool italic)
Parameters
Type Name Description
string fontName
double sizePt
bool bold
bool italic
Returns
Type Description
double

UnderlineOffsetPt(string, double, bool, bool)

Returns the underline stroke offset from the baseline in points. Positive values are below the baseline (the typical case).

Declaration
double UnderlineOffsetPt(string fontName, double sizePt, bool bold, bool italic)
Parameters
Type Name Description
string fontName
double sizePt
bool bold
bool italic
Returns
Type Description
double

UnderlineThicknessPt(string, double, bool, bool)

Returns the underline stroke thickness in points.

Declaration
double UnderlineThicknessPt(string fontName, double sizePt, bool bold, bool italic)
Parameters
Type Name Description
string fontName
double sizePt
bool bold
bool italic
Returns
Type Description
double
Back to top

DR-IT Software documentation

DR-IT Software · Products · Documentation index · Product page · Downloads · Support · Licensing

Generated by DocFX