measureText method
Measure the text
dimension.
Implementation
@override
PTextMetric measureText(String text, PFont font) {
var textStyle = font.toTextStyle();
var textSpan = TextSpan(text: text, style: textStyle);
final textPainterBlock =
TextPainter(text: textSpan, textDirection: TextDirection.ltr)
..layout(minWidth: 0, maxWidth: double.infinity);
var sizeBlock = textPainterBlock.size;
return PTextMetric(sizeBlock.width, sizeBlock.height);
}