fUnderlinePosition, fUnderlineThickness missing in CanvasKit

53 views
Skip to first unread message

Micha

unread,
Mar 4, 2026, 8:30:24 AMMar 4
to skia-discuss
Hi all,
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

bungeman

unread,
Mar 10, 2026, 1:26:04 PMMar 10
to skia-discuss

Micha

unread,
Mar 11, 2026, 4:06:17 AMMar 11
to skia-discuss
Thank you a lot,
that was very fast. I guess this fix will be available in the next official CanvasKit npm release?
Then we'll upgrade and use the new metrics provided.

Michael.

William Candillon

unread,
Mar 16, 2026, 10:19:31 AMMar 16
to skia-discuss
I would also +1 a new CanvasKit release if possible. The new immutable Path API while available in CanvasKit, hasn't been published yet.

Kind regards,

William

bungeman

unread,
Mar 20, 2026, 3:00:39 PM (11 days ago) Mar 20
to skia-discuss
CanvasKit version 0.41.0 has been published.
Reply all
Reply to author
Forward
0 new messages