OfficeTextMeasurer
OfficeIMO.Drawing
Deterministic, zero-dependency text measurer for Office layout estimates.
Inheritance
- object
- OfficeTextMeasurer
Remarks
This measurer intentionally does not call operating-system font APIs. It provides stable Office-oriented estimates for layout decisions such as autofit and wrapping.
Usage
Explore 1 API references to this type
This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.
Returned or exposed by 1
- Method OfficeTextMeasurer.Create
Methods
public static OfficeTextMeasurer Create(OfficeFontInfo? fallbackFontInfo = null) #Creates a deterministic text measurer.
Parameters
- fallbackFontInfo OfficeIMO.Drawing.OfficeFontInfo? = null
Returns
OfficeTextMeasurerpublic OfficeTextMeasurementStyle CreateDefaultStyle(double dpi) #Creates a style from the measurer fallback font and a DPI value.
Parameters
- dpi double
Returns
OfficeTextMeasurementStylepublic OfficeTextMeasurementStyle CreateStyle(OfficeFontInfo fontInfo) #Creates a style from a font descriptor using the default DPI.
Parameters
- fontInfo OfficeIMO.Drawing.OfficeFontInfo
Returns
OfficeTextMeasurementStylepublic OfficeTextMeasurementStyle CreateStyle(OfficeFontInfo fontInfo, double dpi) #Creates a style from a font descriptor and DPI value.
Parameters
- fontInfo OfficeIMO.Drawing.OfficeFontInfo
- dpi double
Returns
OfficeTextMeasurementStylepublic OfficeTextMetrics Measure(string? text, OfficeTextMeasurementStyle style) #Measures text width and line metrics for the supplied style.
Parameters
- text string?
- style OfficeIMO.Drawing.OfficeTextMeasurementStyle
Returns
OfficeTextMetricspublic double MeasureLineHeight(OfficeTextMeasurementStyle style) #Measures a single-line text height in pixels for the supplied style.
Parameters
- style OfficeIMO.Drawing.OfficeTextMeasurementStyle
Returns
doublepublic double MeasureLineHeightOrDefault(string? text, OfficeTextMeasurementStyle style, double fallback) #Measures line height or returns the provided fallback when text is empty.
Parameters
- text string?
- style OfficeIMO.Drawing.OfficeTextMeasurementStyle
- fallback double
Returns
doublepublic double MeasureWidth(string? text, OfficeTextMeasurementStyle style) #Measures text width in pixels for the supplied style.
Parameters
- text string?
- style OfficeIMO.Drawing.OfficeTextMeasurementStyle
Returns
doublepublic double MeasureWidthOrDefault(string? text, OfficeTextMeasurementStyle style, double fallback) #Measures text width or returns the provided fallback when text cannot be measured.
Parameters
- text string?
- style OfficeIMO.Drawing.OfficeTextMeasurementStyle
- fallback double
Returns
double