From 9a344e38e465ca9badcb2b1a382c28b88794e073 Mon Sep 17 00:00:00 2001 From: zobbe Date: Tue, 24 May 2022 19:29:15 +0200 Subject: [PATCH] Add support for bigger font sizes --- .../escposprinter/EscPosPrinterCommands.java | 5 +++++ .../textparser/PrinterTextParser.java | 5 +++++ .../textparser/PrinterTextParserColumn.java | 15 +++++++++++++++ 3 files changed, 25 insertions(+) diff --git a/escposprinter/src/main/java/com/dantsu/escposprinter/EscPosPrinterCommands.java b/escposprinter/src/main/java/com/dantsu/escposprinter/EscPosPrinterCommands.java index de5874a..e6107f5 100644 --- a/escposprinter/src/main/java/com/dantsu/escposprinter/EscPosPrinterCommands.java +++ b/escposprinter/src/main/java/com/dantsu/escposprinter/EscPosPrinterCommands.java @@ -44,6 +44,11 @@ public class EscPosPrinterCommands { public static final byte[] TEXT_SIZE_DOUBLE_HEIGHT = new byte[]{0x1D, 0x21, 0x01}; public static final byte[] TEXT_SIZE_DOUBLE_WIDTH = new byte[]{0x1D, 0x21, 0x10}; public static final byte[] TEXT_SIZE_BIG = new byte[]{0x1D, 0x21, 0x11}; + public static final byte[] TEXT_SIZE_BIG_2 = new byte[]{0x1D, 0x21, 0x22}; + public static final byte[] TEXT_SIZE_BIG_3 = new byte[]{0x1D, 0x21, 0x33}; + public static final byte[] TEXT_SIZE_BIG_4 = new byte[]{0x1D, 0x21, 0x44}; + public static final byte[] TEXT_SIZE_BIG_5 = new byte[]{0x1D, 0x21, 0x55}; + public static final byte[] TEXT_SIZE_BIG_6 = new byte[]{0x1D, 0x21, 0x66}; public static final byte[] TEXT_UNDERLINE_OFF = new byte[]{0x1B, 0x2D, 0x00}; public static final byte[] TEXT_UNDERLINE_ON = new byte[]{0x1B, 0x2D, 0x01}; diff --git a/escposprinter/src/main/java/com/dantsu/escposprinter/textparser/PrinterTextParser.java b/escposprinter/src/main/java/com/dantsu/escposprinter/textparser/PrinterTextParser.java index 22db0f3..3b7b3ab 100644 --- a/escposprinter/src/main/java/com/dantsu/escposprinter/textparser/PrinterTextParser.java +++ b/escposprinter/src/main/java/com/dantsu/escposprinter/textparser/PrinterTextParser.java @@ -43,6 +43,11 @@ public class PrinterTextParser { public static final String ATTR_FORMAT_TEXT_FONT_SIZE = "size"; public static final String ATTR_FORMAT_TEXT_FONT_SIZE_BIG = "big"; + public static final String ATTR_FORMAT_TEXT_FONT_SIZE_BIG_2 = "big-2"; + public static final String ATTR_FORMAT_TEXT_FONT_SIZE_BIG_3 = "big-3"; + public static final String ATTR_FORMAT_TEXT_FONT_SIZE_BIG_4 = "big-4"; + public static final String ATTR_FORMAT_TEXT_FONT_SIZE_BIG_5 = "big-5"; + public static final String ATTR_FORMAT_TEXT_FONT_SIZE_BIG_6 = "big-6"; public static final String ATTR_FORMAT_TEXT_FONT_SIZE_TALL = "tall"; public static final String ATTR_FORMAT_TEXT_FONT_SIZE_WIDE = "wide"; public static final String ATTR_FORMAT_TEXT_FONT_SIZE_NORMAL = "normal"; diff --git a/escposprinter/src/main/java/com/dantsu/escposprinter/textparser/PrinterTextParserColumn.java b/escposprinter/src/main/java/com/dantsu/escposprinter/textparser/PrinterTextParserColumn.java index c5f1ccb..a8d523c 100644 --- a/escposprinter/src/main/java/com/dantsu/escposprinter/textparser/PrinterTextParserColumn.java +++ b/escposprinter/src/main/java/com/dantsu/escposprinter/textparser/PrinterTextParserColumn.java @@ -167,6 +167,21 @@ public PrinterTextParserColumn(PrinterTextParserLine textParserLine, String text case PrinterTextParser.ATTR_FORMAT_TEXT_FONT_SIZE_BIG: textParser.addTextSize(EscPosPrinterCommands.TEXT_SIZE_BIG); break; + case PrinterTextParser.ATTR_FORMAT_TEXT_FONT_SIZE_BIG_2: + textParser.addTextSize(EscPosPrinterCommands.TEXT_SIZE_BIG_2); + break; + case PrinterTextParser.ATTR_FORMAT_TEXT_FONT_SIZE_BIG_3: + textParser.addTextSize(EscPosPrinterCommands.TEXT_SIZE_BIG_3); + break; + case PrinterTextParser.ATTR_FORMAT_TEXT_FONT_SIZE_BIG_4: + textParser.addTextSize(EscPosPrinterCommands.TEXT_SIZE_BIG_4); + break; + case PrinterTextParser.ATTR_FORMAT_TEXT_FONT_SIZE_BIG_5: + textParser.addTextSize(EscPosPrinterCommands.TEXT_SIZE_BIG_5); + break; + case PrinterTextParser.ATTR_FORMAT_TEXT_FONT_SIZE_BIG_6: + textParser.addTextSize(EscPosPrinterCommands.TEXT_SIZE_BIG_6); + break; } } else { textParser.addTextSize(textParser.getLastTextSize());