in lets-plot-compose/src/desktopMain/kotlin/org/jetbrains/letsPlot/compose/canvas/SkiaContext2d.kt [194:213]
override fun measureText(str: String): TextMetrics {
val skiaFont = skiaFontManager.findFont(contextState.getFont())
val r = skiaFont.measureText(str, fillPaint)
// font.measureText ignores trailing spaces, so we need to use measureTextWidth
val w = skiaFont.measureTextWidth(str)
val textMetrics = TextMetrics(
ascent = r.top.toDouble(),
descent = r.bottom.toDouble(),
bbox = DoubleRectangle.XYWH(
x = r.left,
y = r.top,
width = w,
height = r.height
),
)
return textMetrics
}