public readonly record struct DecorationMetricsWhere a font wants a decoration line drawn, in design units.
Remarks
Every number here comes out of the face's own tables and none of them is a constant. That is the whole point of the type. Across the twenty-two faces this repository ships, the underline thickness ranges from 20 design units at 2048 per em — under one hundredth of an em — to 184 at the same grid, which is nine per cent of it. A hardcoded hairline looks deliberate in Open Sans and looks like a rendering fault in the Nastaliq face beside it, and no test of a single font can tell the two apart.
⚠ Positive is upwards, as the font grid has it, so an underline offset is negative. The draw list is y-down; Ui's TextRun is where the sign flips, in the same place and for the same reason Place flips a glyph's.
⚠ An offset is the centre of the stem, not its top. The two readings of post.underlinePosition are a genuine disagreement in the wild — the OpenType specification says the top, Apple's says the centre, and FreeType and Skia both take the centre, so the overwhelming majority of shipped fonts were drawn against that reading. Following the majority is what makes a face look like it does everywhere else.
Fields and properties (4)
public int UnderlineOffsetThe centre of the underline stem, relative to the baseline.
public int UnderlineThicknessHow thick that stem is. Always positive.
public int StrikeoutOffsetThe centre of the line-through stem. Positive: it crosses the glyphs.
public int StrikeoutThicknessHow thick that stem is. Always positive.
Methods (1)
public DecorationMetrics(int UnderlineOffset, int UnderlineThickness, int StrikeoutOffset, int StrikeoutThickness)Where a font wants a decoration line drawn, in design units.
Used by (3)
- DecorationMetricsTestsVixen.Ui.Text.Tests
- FontFaceVixen.Ui.Text
- TextRunVixen.Ui