PeachDrawing

PeachDrawing.RasterCanvas

RasterCanvas.GetInkCrossings(string, Font, PaintPoint, double, double, double, Nullable<ShapeSettings>) Method

The horizontal ranges in which str’s glyph ink crosses the horizontal band between bandTop and bandBottom — what text-decoration-skip-ink (CSS Text Decoration 4 §2.5) removes from an underline or overline drawn through that band.

public override System.Collections.Generic.IReadOnlyList<PeachDrawing.Core.InkSpan>? GetInkCrossings(string str, PeachDrawing.Core.Font font, PeachDrawing.Core.PaintPoint origin, double bandTop, double bandBottom, double letterSpacing=0.0, System.Nullable<PeachDrawing.Text.Shaping.ShapeSettings> features=null);

Parameters

str System.String

the run whose ink is measured

font Font

the font the run is drawn with

origin PaintPoint

the run’s origin, in user-space units — the <i>same</i> point DrawString(string, Font, PaintColor, PaintPoint, Size, double, FontPalette, Nullable<ShapeSettings>) paints the run from, not its baseline. The implementation places the baseline from the font’s own metrics exactly as the text-drawing path does, so the ink is measured where it is drawn rather than where a rounded ascent would put it.

bandTop System.Double

the band’s upper edge, in user-space y (smaller than bandBottom)

bandBottom System.Double

the band’s lower edge

letterSpacing System.Double

extra advance between glyphs (same units as origin)

features System.Nullable<ShapeSettings>

which GSUB features to apply when shaping str

Returns

System.Collections.Generic.IReadOnlyList<InkSpan>
the crossings, left to right and already merged, or null when the ink is unknown

Remarks

Virtual rather than abstract, and returning null by default, so a backend with no glyph outlines to consult — including every test-only Canvas mock — needs no implementation and degrades to skipping nothing. auto is defined as UA discretion, so declining to skip is conformant; all silently does not skip either, which is the same accepted limitation a font with no decodable outlines has.

Returns null, not an empty list, when no ink information is available at all — the caller cannot otherwise tell that apart from a run that genuinely crosses nothing.

Each glyph contributes at most one range, spanning everything it puts in the band — so a glyph whose ink is in several pieces there (the two sides of an o, the separate dots of an ellipsis) yields one range covering the whole letter rather than one per piece. CSS Text Decoration 4 leaves this skip shape to the UA (§2.10.5 Shaping Interruptions), explicitly naming “whether to show the line within enclosed areas of a glyph” as a UA choice and warning that following each contour can strand “typographically-awkward wisps of underline”; this is also what Chrome and Firefox do.