FontMetrics
interface FontMetrics
Platform abstraction over text measurement.
The layout engine consults a FontMetrics before any drawing occurs to decide where lines wrap and how tall each line is. Implementations are thread-safe enough for sequential layout — they are not required to be safe for concurrent use across threads.
Implementations live in androidMain (Paint-backed) and iosMain (NSAttributedString-backed); a fake implementation lives in commonTest for layout unit tests.
Functions
Link copied to clipboard
Measures text rendered with style and returns its dimensions. The result must agree with what the matching PdfCanvas.drawText call would actually produce, otherwise wrapping calculations drift away from the rendered output.