PeachDrawing.Core

PeachDrawing.Core

TextMeasurement Class

Measures a run of text against a Typeface at a size - the one measurement algorithm every backend’s own MeasureString(string, Font, Nullable<ShapeSettings>) needs, so it lives here once rather than once per backend. Line breaks split the run; each line is shaped as one run (so GSUB ligatures merge the way painting’s own shaping does) and its glyph advances (GPOS kerning included) summed.

public static class TextMeasurement

Inheritance System.Object → TextMeasurement

Fields  
BoldEmphasis The fraction of the em size a line widens by, per character, to simulate bold on a face with no real bold of its own (the 2% figure XPS 1.0’s own documentation gives for the same synthesis).
ItalicSkewAngleSinus The sine of the angle a regular face is sheared by to simulate italic (20 degrees), when a font needs faux-italic synthesis and declares no explicit oblique angle of its own.
Methods  
Measure(string, Typeface, double, SyntheticStyle, ShapeSettings) Measures text set in typeface at size.