setGlobalFont method

List<int> setGlobalFont(
  1. PosFontType? font, {
  2. int? maxCharsPerLine,
})

Set global font which will be used instead of the default printer's font (even after resetting)

Implementation

List<int> setGlobalFont(PosFontType? font, {int? maxCharsPerLine}) {
  List<int> bytes = [];
  _font = font;
  if (font != null) {
    _maxCharsPerLine = maxCharsPerLine ?? _getMaxCharsPerLine(font);
    bytes += font == PosFontType.fontB ? cFontB.codeUnits : cFontA.codeUnits;
    _styles = _styles.copyWith(fontType: font);
  }
  return bytes;
}