public readonly record struct StrutMetricsThe font metrics CSS 2.1 §10.8's strut is made of, in the container's own units.
Remarks
⚠ This store still has no font, and that is the point of this type rather than an exception to it. §10.8 begins every line box with an imaginary zero-width inline box carrying the block container's own font and line height — which is why an empty line is still a line tall, why a short image never makes a line shorter than the text beside it would be, and why line-height on a container does anything at all. Every one of those is arithmetic over five numbers; only producing the five needs a font. So the numbers are a computed value the layer that owns the fonts writes down, exactly as it already writes down a resolved font-size, and Vixen.Ui.Layout stays geometry.
⚠ All-zero means "no strut", and that is the initial value. A tree that never sets one lays out exactly as it did before this type existed: a line is as tall as the boxes on it, and the five font-relative VerticalAlign values fall back to Baseline — see LayoutTree's EffectiveVerticalAlign, which is where that fallback is decided. Refusing them where there is no strut is the same refusal as before and for the same reason: a middle rounded to baseline is half an x-height out and reads as a rendering quirk rather than as a missing feature.
⚠ Ascent/Descent and TextAscent/TextDescent are two different boxes and collapsing them is wrong the moment line-height is not normal. The first pair is the strut's line box — the font's metrics grown (or shrunk) by half the leading — and it is what a line box is at least as tall as. The second is the font's content area, which is what text-top and text-bottom are defined against. With line-height: 2 they differ by half a font size on each side.
Fields and properties (8)
public float AscentHow far the strut's line box reaches above the baseline. Positive.
public float DescentHow far it reaches below. Positive, unlike the font table's sign.
public float TextAscentThe top of the font's content area, above the baseline. Positive.
public float TextDescentThe bottom of it, below the baseline. Positive.
public float XHeightThe font's x-height, which vertical-align: middle takes half of.
public float SubOffsetHow far below the baseline vertical-align: sub lowers a box.
public float SuperOffsetHow far above it vertical-align: super raises one.
public bool HasFontWhether a font ever wrote these numbers down.
Methods (1)
public StrutMetrics(float Ascent, float Descent, float TextAscent, float TextDescent, float XHeight, float SubOffset, float SuperOffset)The font metrics CSS 2.1 §10.8's strut is made of, in the container's own units.
Used by (4)
- InlineStrutTestsVixen.Ui.Layout.Tests
- LayoutStyleVixen.Ui.Layout
- LayoutTreeVixen.Ui.Layout
- UiDocumentVixen.Ui