text method

List<int> text(
  1. String text, {
  2. PosStyles styles = const PosStyles(),
  3. int linesAfter = 0,
  4. bool containsChinese = false,
  5. int? maxCharsPerLine,
})

Implementation

List<int> text(
  String text, {
  PosStyles styles = const PosStyles(),
  int linesAfter = 0,
  bool containsChinese = false,
  int? maxCharsPerLine,
}) {
  List<int> bytes = [];
  if (!containsChinese) {
    bytes += _text(
      _encode(text, isKanji: containsChinese),
      styles: styles,
      isKanji: containsChinese,
      maxCharsPerLine: maxCharsPerLine,
    );
    // Ensure at least one line break after the text
    bytes += emptyLines(linesAfter + 1);
  } else {
    bytes += _mixedKanji(text, styles: styles, linesAfter: linesAfter);
  }
  return bytes;
}