getMeasuredRectangle method
Measure the Text with a given font.
Implementation
Rectangle<num> getMeasuredRectangle(
String text,
Font font,
Rectangle<num> bounds,
) {
final SizeF size = getTextSizeFromFont(text, font);
final double height = (size.fontHeight * 1.03).ceilToDouble();
final int length =
bounds.width == 1800.0
? 1
: _getLengthOfLines(
size.fontWidth,
bounds.width.toDouble(),
text,
font,
);
final Rectangle<num> result = Rectangle<num>(
0,
0,
size.fontWidth.ceil(),
height * length,
);
return result;
}