getTextWidth method
Calculates the width of the given text in pixels.
Args: text (String): The text to calculate the width for.
Returns: int: The width of the text in pixels.
Implementation
int getTextWidth(String text) {
var width = 0;
for (final char in text.runes) {
width += (_charWidthMapping[char] ?? 25) + charSpacing;
}
return width;
}