PeachDrawing.Text

PeachDrawing.Text.Outlines.GlyphOutline

GlyphOutline.Crossings(double, double) Method

Finds where the glyph’s ink lies across a horizontal band: the horizontal ranges that are painted somewhere between two heights. It is what CSS text-decoration-skip-ink needs to interrupt a line where it would run through a descender.

public System.Collections.Generic.IReadOnlyList<(double Start,double End)> Crossings(double bandLow, double bandHigh);

Parameters

bandLow System.Double

The lower edge of the band, in design units, y up.

bandHigh System.Double

The upper edge of the band; a band that is not above bandLow yields nothing.

Returns

System.Collections.Generic.IReadOnlyList<<System.Double,System.Double>>
The painted ranges, left to right and merged.

Remarks

The outline is flattened and sampled with a handful of scanlines across the band, each resolved by the nonzero winding rule the glyph is filled with, so the counter of an o comes back as a gap between ranges and not as ink. A sampled result can miss a sliver thinner than the spacing of the scanlines, which costs a slightly short gap in a decoration and never a wrong one.