in Skia, SkFontMetrics provides underline information:
SkScalar fUnderlineThickness; //!< underline thickness
SkScalar fUnderlinePosition; //!< distance from baseline to top of stroke, typically positive
We use these two scalars to draw underlined text (simply draw a line according to these two scalars) with Skia.
Since our drawing API is cross-platform and becomes implemented by Skia as well as by CanvasKit, we need to draw underlined text using CanvasKit, too. However, CanvasKit does not provide this information:
export interface FontMetrics {
ascent: number; // suggested space above the baseline. < 0
descent: number; // suggested space below the baseline. > 0
leading: number; // suggested spacing between descent of previous line and ascent of next line.
bounds?: Rect; // smallest rect containing all glyphs (relative to 0,0)
}
Could FontMetrics interface be extended to provide these two metrics? Is there a workaround to approximate them from font size, ascent and descent?
Thank you for any answer.
Michael