text method
Implementation
void text(String text, {PrintTextStyle? style}) {
BitmapFont textFont = font;
PrintAlign align = PrintAlign.left;
if (style != null) {
textFont = _getFont(style);
align = style.align;
}
int xPosition = margin.left;
if (align == PrintAlign.center) {
xPosition = ((paperSize.width - textFont.getMetrics(text).width) / 2)
.round();
} else if (align == PrintAlign.right) {
xPosition =
(paperSize.width - textFont.getMetrics(text).width - margin.width)
.round();
}
drawString(
utilImage,
text,
font: textFont,
x: xPosition,
y: runningHeight,
color: textColor,
);
runningHeight += textFont.lineHeight + 10;
}