Attached Files | japanesePrinters.diff [^] (126,301 bytes) 2020-04-16 10:06 [Show Content] [Hide Content]diff --git a/project/openbravohw.properties b/project/openbravohw.properties
--- a/project/openbravohw.properties
+++ b/project/openbravohw.properties
@@ -1,5 +1,5 @@
# ************************************************************************************
-# * Copyright (C) 2012-2018 Openbravo S.L.U.
+# * Copyright (C) 2012-2019 Openbravo S.L.U.
# * Licensed under the Openbravo Commercial License version 1.0
# * You may obtain a copy of the License at http://www.openbravo.com/legal/obcl.html
# * or in the legal folder of this module distribution.
@@ -23,6 +23,7 @@
## Receipt printers ##
machine.printer = usb
+# machine.printer.blockfile = unicodeblocksJapanese.xml
# machine.printer.2 = printer\:(Default),standard
## Receipt printer images ##
diff --git a/project/src/META-INF/unicodeblocksJapanese.xml b/project/src/META-INF/unicodeblocksJapanese.xml
new file mode 100644
--- /dev/null
+++ b/project/src/META-INF/unicodeblocksJapanese.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<unicodeblocks>
+ <block name="CJK_UNIFIED_IDEOGRAPHS" codetable="GB2312" command=""/>
+ <block name="HANGUL_SYLLABLES" codetable="MS949" command=""/>
+ <block name="HANGUL_COMPATIBILITY_JAMO" codetable="MS949" command=""/>
+ <block name="HANGUL_JAMO" codetable="MS949" command=""/>
+ <block name="HANGUL_JAMO_EXTENDED_A" codetable="MS949" command=""/>
+ <block name="HANGUL_JAMO_EXTENDED_B" codetable="MS949" command=""/>
+ <block name="CYRILLIC" codetable="Cp855" command="1B 74 22"/>
+ <block name="GREEK" codetable="ISO8859_7" command="1B 74 0F"/>
+ <block name="CJK_UNIFIED_IDEOGRAPHS" codetable="SJIS" command="1C 26 1c 43 01"/>
+ <block name="KATAKANA" codetable="SJIS" command="1C 26 1C 43 01"/>
+ <block name="HIRAGANA" codetable="SJIS" command="1C 26 1C 43 01"/>
+ <!-- <block name="ARABIC" codetable="Cp864" command="1B 74 25"/> -->
+ <!-- <block name="HEBREW" codetable="Cp862" command="1B 74 24"/> -->
+</unicodeblocks>
\ No newline at end of file
diff --git a/project/src/com/openbravo/pos/printer/DeviceTicket.java b/project/src/com/openbravo/pos/printer/DeviceTicket.java
--- a/project/src/com/openbravo/pos/printer/DeviceTicket.java
+++ b/project/src/com/openbravo/pos/printer/DeviceTicket.java
@@ -1,6 +1,6 @@
/*
************************************************************************************
- * Copyright (C) 2012-2018 Openbravo S.L.U.
+ * Copyright (C) 2012-2019 Openbravo S.L.U.
* Licensed under the Openbravo Commercial License version 1.0
* You may obtain a copy of the License at http://www.openbravo.com/legal/obcl.html
* or in the legal folder of this module distribution.
@@ -91,7 +91,7 @@
DeviceFiscalPrinter fiscal;
try {
- hwconfig.setParameters(sFiscalType, sFiscalParam1, sFiscalParam2);
+ hwconfig.setParameters(sFiscalType, sFiscalParam1, sFiscalParam2, null);
fiscal = findDeviceFiscal(hwserviceloader, sFiscalType, hwconfig, sFiscalIndex);
} catch (Exception e) {
logger.log(Level.WARNING, e.getMessage(), e);
@@ -120,7 +120,7 @@
}
try {
- hwconfig.setParameters(sDisplayType, sDisplayParam1, sDisplayParam2);
+ hwconfig.setParameters(sDisplayType, sDisplayParam1, sDisplayParam2, null);
m_devicedisplay = findDeviceDisplay(hwserviceloader, sDisplayType, hwconfig);
// } catch (InvocationTargetException e) {
// } catch (ClassNotFoundException e) {
@@ -142,6 +142,7 @@
int iPrinterIndex = 1;
String sPrinterIndex = Integer.toString(iPrinterIndex);
String sprinter = config.getProperty("machine.printer");
+ String blockFile = config.getProperty("machine.printer.blockfile");
while (sprinter != null && !"".equals(sprinter)) {
@@ -160,7 +161,7 @@
}
try {
- hwconfig.setParameters(sPrinterType, sPrinterParam1, sPrinterParam2);
+ hwconfig.setParameters(sPrinterType, sPrinterParam1, sPrinterParam2, blockFile);
printer = findDevicePrinter(hwserviceloader, sPrinterType, hwconfig, sPrinterIndex);
// } catch (InvocationTargetException e) {
@@ -181,6 +182,7 @@
iPrinterIndex++;
sPrinterIndex = Integer.toString(iPrinterIndex);
sprinter = config.getProperty("machine.printer." + sPrinterIndex);
+ blockFile = config.getProperty("machine.printer." + sPrinterIndex + "blockfile");
}
// The scale
@@ -189,7 +191,7 @@
String sScaleParam1 = sd.nextToken(',');
String sScaleParam2 = sd.nextToken(Character.MIN_VALUE);
try {
- hwconfig.setParameters(sScaleType, sScaleParam1, sScaleParam2);
+ hwconfig.setParameters(sScaleType, sScaleParam1, sScaleParam2, null);
devicescale = findDeviceScale(hwserviceloader, sScaleType, hwconfig);
// } catch (InvocationTargetException e) {
// } catch (ClassNotFoundException e) {
@@ -209,7 +211,7 @@
String paymentParam1 = sd.nextToken(',');
String paymentParam2 = sd.nextToken(Character.MIN_VALUE);
try {
- hwconfig.setParameters(paymentType, paymentParam1, paymentParam2);
+ hwconfig.setParameters(paymentType, paymentParam1, paymentParam2, null);
devicepayment = findDevicePayment(paymentserviceloader, paymentType, hwconfig);
// } catch (InvocationTargetException e) {
// } catch (ClassNotFoundException e) {
diff --git a/project/src/com/openbravo/pos/printer/escpos/DevicePrinterPlain.java b/project/src/com/openbravo/pos/printer/escpos/DevicePrinterPlain.java
--- a/project/src/com/openbravo/pos/printer/escpos/DevicePrinterPlain.java
+++ b/project/src/com/openbravo/pos/printer/escpos/DevicePrinterPlain.java
@@ -1,6 +1,6 @@
/*
************************************************************************************
- * Copyright (C) 2012-2014 Openbravo S.L.U.
+ * Copyright (C) 2012-2019 Openbravo S.L.U.
* Licensed under the Openbravo Commercial License version 1.0
* You may obtain a copy of the License at http://www.openbravo.com/legal/obcl.html
* or in the legal folder of this module distribution.
@@ -11,86 +11,92 @@
import java.awt.image.BufferedImage;
+import javax.print.attribute.PrintRequestAttributeSet;
import javax.swing.JComponent;
-import com.openbravo.pos.printer.*;
-import javax.print.attribute.PrintRequestAttributeSet;
+import com.openbravo.pos.printer.DevicePrinter;
+import com.openbravo.pos.printer.TicketPrinterException;
+
+public class DevicePrinterPlain implements DevicePrinter {
+
+ private static final byte[] NEW_LINE = { 0x0D, 0x0A }; // Print and carriage return
-public class DevicePrinterPlain implements DevicePrinter {
-
- private static final byte[] NEW_LINE = {0x0D, 0x0A}; // Print and carriage return
-
- private PrinterWritter out;
- private UnicodeTranslator trans;
-
- // Creates new TicketPrinter
- public DevicePrinterPlain(PrinterWritter CommOutputPrinter) throws TicketPrinterException {
+ private PrinterWritter out;
+ private UnicodeTranslator trans;
+
+ // Creates new TicketPrinter
+ public DevicePrinterPlain(PrinterWritter CommOutputPrinter, UnicodeTranslatorStar trans)
+ throws TicketPrinterException {
+
+ out = CommOutputPrinter;
+ this.trans = trans; // The star translator stands for the 437 int char page
+ }
- out = CommOutputPrinter;
- trans = new UnicodeTranslatorStar(); // The star translator stands for the 437 int char page
- }
-
- public int getPrinterType() {
- return DevicePrinter.TYPE_NONE;
- }
- public String getPrinterName() {
- return "Plain printer";
- }
- public String getPrinterDescription() {
- return out.getDescription();
- }
- public JComponent getPrinterComponent() {
- return null;
- }
- public void reset() {
- }
- public String getSystemName() {
- return "";
- }
+ public int getPrinterType() {
+ return DevicePrinter.TYPE_NONE;
+ }
+
+ public String getPrinterName() {
+ return "Plain printer";
+ }
- @Override
- public PrintRequestAttributeSet getSystemAttributes() {
- throw new UnsupportedOperationException("Not a printer: " + getPrinterName());
- }
+ public String getPrinterDescription() {
+ return out.getDescription();
+ }
+
+ public JComponent getPrinterComponent() {
+ return null;
+ }
+
+ public void reset() {
+ }
+
+ public String getSystemName() {
+ return "";
+ }
- public void beginReceipt() {
- }
-
- public void printImage(BufferedImage image) {
- }
-
- public void printBarCode(String type, String position, String code) {
- if (! DevicePrinter.POSITION_NONE.equals(position)) {
- out.write(code);
- out.write(NEW_LINE);
- }
- }
-
- public void beginLine(int iTextSize) {
- }
-
- public void printText(int iStyle, String sText) {
- out.write(trans.transString(sText));
+ @Override
+ public PrintRequestAttributeSet getSystemAttributes() {
+ throw new UnsupportedOperationException("Not a printer: " + getPrinterName());
+ }
+
+ public void beginReceipt() {
+ }
+
+ public void printImage(BufferedImage image) {
+ }
+
+ public void printBarCode(String type, String position, String code) {
+ if (!DevicePrinter.POSITION_NONE.equals(position)) {
+ out.write(code);
+ out.write(NEW_LINE);
}
-
- public void endLine() {
- out.write(NEW_LINE);
- }
-
- public void endReceipt() {
- out.write(NEW_LINE);
- out.write(NEW_LINE);
- out.write(NEW_LINE);
- out.write(NEW_LINE);
- out.write(NEW_LINE);
- out.commit();
- }
-
- public void openDrawer() {
- }
+ }
+
+ public void beginLine(int iTextSize) {
+ }
+
+ public void printText(int iStyle, String sText) {
+ out.write(trans.transString(sText));
+ }
+
+ public void endLine() {
+ out.write(NEW_LINE);
+ }
- public String checkDrawerStatus() {
- return DevicePrinter.DRAWER_NOTAVAILABLE;
- }
+ public void endReceipt() {
+ out.write(NEW_LINE);
+ out.write(NEW_LINE);
+ out.write(NEW_LINE);
+ out.write(NEW_LINE);
+ out.write(NEW_LINE);
+ out.commit();
+ }
+
+ public void openDrawer() {
+ }
+
+ public String checkDrawerStatus() {
+ return DevicePrinter.DRAWER_NOTAVAILABLE;
+ }
}
-
diff --git a/project/src/com/openbravo/pos/printer/escpos/USBDevicePrinterEpson.java b/project/src/com/openbravo/pos/printer/escpos/USBDevicePrinterEpson.java
--- a/project/src/com/openbravo/pos/printer/escpos/USBDevicePrinterEpson.java
+++ b/project/src/com/openbravo/pos/printer/escpos/USBDevicePrinterEpson.java
@@ -1,6 +1,6 @@
/*
************************************************************************************
- * Copyright (C) 2014-2018 Openbravo S.L.U.
+ * Copyright (C) 2014-2019 Openbravo S.L.U.
* Licensed under the Openbravo Commercial License version 1.0
* You may obtain a copy of the License at http://www.openbravo.com/legal/obcl.html
* or in the legal folder of this module distribution.
@@ -22,7 +22,7 @@
public DevicePrinter build(USBDeviceID<DevicePrinter> id, HardwareConfig hwconfig)
throws TicketPrinterException {
return new DevicePrinterESCPOS(new PrinterWritterUSB(id), new CodesEpson(),
- new UnicodeTranslatorInt(), hwconfig.getConfigProperty("qr.quality"),
- hwconfig.getConfigProperty("qr.size"));
+ new UnicodeTranslatorInt(hwconfig.getBlockFile()),
+ hwconfig.getConfigProperty("qr.quality"), hwconfig.getConfigProperty("qr.size"));
}
}
diff --git a/project/src/com/openbravo/pos/printer/escpos/USBDevicePrinterIthaca.java b/project/src/com/openbravo/pos/printer/escpos/USBDevicePrinterIthaca.java
--- a/project/src/com/openbravo/pos/printer/escpos/USBDevicePrinterIthaca.java
+++ b/project/src/com/openbravo/pos/printer/escpos/USBDevicePrinterIthaca.java
@@ -1,6 +1,6 @@
/*
************************************************************************************
- * Copyright (C) 2014-2018 Openbravo S.L.U.
+ * Copyright (C) 2014-2019 Openbravo S.L.U.
* Licensed under the Openbravo Commercial License version 1.0
* You may obtain a copy of the License at http://www.openbravo.com/legal/obcl.html
* or in the legal folder of this module distribution.
@@ -22,7 +22,7 @@
public DevicePrinter build(USBDeviceID<DevicePrinter> id, HardwareConfig hwconfig)
throws TicketPrinterException {
return new DevicePrinterESCPOS(new PrinterWritterUSB(id), new CodesIthaca(),
- new UnicodeTranslatorInt(), hwconfig.getConfigProperty("qr.quality"),
- hwconfig.getConfigProperty("qr.size"));
+ new UnicodeTranslatorInt(hwconfig.getBlockFile()),
+ hwconfig.getConfigProperty("qr.quality"), hwconfig.getConfigProperty("qr.size"));
}
}
diff --git a/project/src/com/openbravo/pos/printer/escpos/USBDevicePrinterNCR.java b/project/src/com/openbravo/pos/printer/escpos/USBDevicePrinterNCR.java
--- a/project/src/com/openbravo/pos/printer/escpos/USBDevicePrinterNCR.java
+++ b/project/src/com/openbravo/pos/printer/escpos/USBDevicePrinterNCR.java
@@ -1,6 +1,6 @@
/*
************************************************************************************
- * Copyright (C) 2017 Openbravo S.L.U.
+ * Copyright (C) 2017-2019 Openbravo S.L.U.
* Licensed under the Openbravo Commercial License version 1.0
* You may obtain a copy of the License at http://www.openbravo.com/legal/obcl.html
* or in the legal folder of this module distribution.
@@ -11,13 +11,17 @@
import com.openbravo.pos.printer.DevicePrinter;
import com.openbravo.pos.printer.TicketPrinterException;
+import com.openbravo.pos.service.HardwareConfig;
/**
*
* @author adrian
*/
public class USBDevicePrinterNCR implements USBDeviceBuilder<DevicePrinter> {
- @Override public DevicePrinter build(USBDeviceID<DevicePrinter> id) throws TicketPrinterException {
- return new DevicePrinterESCPOS(new PrinterWritterUSB(id), new CodesNCR(), new UnicodeTranslatorInt());
- }
+ @Override
+ public DevicePrinter build(USBDeviceID<DevicePrinter> id, HardwareConfig hwconfig)
+ throws TicketPrinterException {
+ return new DevicePrinterESCPOS(new PrinterWritterUSB(id), new CodesNCR(),
+ new UnicodeTranslatorInt(hwconfig.getBlockFile()));
+ }
}
diff --git a/project/src/com/openbravo/pos/printer/escpos/USBDevicePrinterPlain.java b/project/src/com/openbravo/pos/printer/escpos/USBDevicePrinterPlain.java
--- a/project/src/com/openbravo/pos/printer/escpos/USBDevicePrinterPlain.java
+++ b/project/src/com/openbravo/pos/printer/escpos/USBDevicePrinterPlain.java
@@ -1,6 +1,6 @@
/*
************************************************************************************
- * Copyright (C) 2014 Openbravo S.L.U.
+ * Copyright (C) 2014-2019 Openbravo S.L.U.
* Licensed under the Openbravo Commercial License version 1.0
* You may obtain a copy of the License at http://www.openbravo.com/legal/obcl.html
* or in the legal folder of this module distribution.
@@ -11,13 +11,17 @@
import com.openbravo.pos.printer.DevicePrinter;
import com.openbravo.pos.printer.TicketPrinterException;
+import com.openbravo.pos.service.HardwareConfig;
/**
*
* @author adrian
*/
public class USBDevicePrinterPlain implements USBDeviceBuilder<DevicePrinter> {
- @Override public DevicePrinter build(USBDeviceID<DevicePrinter> id) throws TicketPrinterException {
- return new DevicePrinterPlain(new PrinterWritterUSB(id));
- }
+ @Override
+ public DevicePrinter build(USBDeviceID<DevicePrinter> id, HardwareConfig hwconfig)
+ throws TicketPrinterException {
+ return new DevicePrinterPlain(new PrinterWritterUSB(id), new UnicodeTranslatorStar(
+ hwconfig.getBlockFile()));
+ }
}
diff --git a/project/src/com/openbravo/pos/printer/escpos/USBDevicePrinterStar.java b/project/src/com/openbravo/pos/printer/escpos/USBDevicePrinterStar.java
--- a/project/src/com/openbravo/pos/printer/escpos/USBDevicePrinterStar.java
+++ b/project/src/com/openbravo/pos/printer/escpos/USBDevicePrinterStar.java
@@ -1,6 +1,6 @@
/*
************************************************************************************
- * Copyright (C) 2014-2018 Openbravo S.L.U.
+ * Copyright (C) 2014-2019 Openbravo S.L.U.
* Licensed under the Openbravo Commercial License version 1.0
* You may obtain a copy of the License at http://www.openbravo.com/legal/obcl.html
* or in the legal folder of this module distribution.
@@ -22,7 +22,7 @@
public DevicePrinter build(USBDeviceID<DevicePrinter> id, HardwareConfig hwconfig)
throws TicketPrinterException {
return new DevicePrinterESCPOS(new PrinterWritterUSB(id), new CodesStar(),
- new UnicodeTranslatorStar(), hwconfig.getConfigProperty("qr.quality"),
- hwconfig.getConfigProperty("qr.size"));
+ new UnicodeTranslatorStar(hwconfig.getBlockFile()),
+ hwconfig.getConfigProperty("qr.quality"), hwconfig.getConfigProperty("qr.size"));
}
}
\ No newline at end of file
diff --git a/project/src/com/openbravo/pos/printer/escpos/USBDevicePrinterSurePOS.java b/project/src/com/openbravo/pos/printer/escpos/USBDevicePrinterSurePOS.java
--- a/project/src/com/openbravo/pos/printer/escpos/USBDevicePrinterSurePOS.java
+++ b/project/src/com/openbravo/pos/printer/escpos/USBDevicePrinterSurePOS.java
@@ -1,6 +1,6 @@
/*
************************************************************************************
- * Copyright (C) 2014-2018 Openbravo S.L.U.
+ * Copyright (C) 2014-2019 Openbravo S.L.U.
* Licensed under the Openbravo Commercial License version 1.0
* You may obtain a copy of the License at http://www.openbravo.com/legal/obcl.html
* or in the legal folder of this module distribution.
@@ -22,7 +22,7 @@
public DevicePrinter build(USBDeviceID<DevicePrinter> id, HardwareConfig hwconfig)
throws TicketPrinterException {
return new DevicePrinterESCPOS(new PrinterWritterUSB(id), new CodesSurePOS(),
- new UnicodeTranslatorSurePOS(), hwconfig.getConfigProperty("qr.quality"),
- hwconfig.getConfigProperty("qr.size"));
+ new UnicodeTranslatorSurePOS(hwconfig.getBlockFile()),
+ hwconfig.getConfigProperty("qr.quality"), hwconfig.getConfigProperty("qr.size"));
}
}
diff --git a/project/src/com/openbravo/pos/printer/escpos/USBDevicePrinterTMU220.java b/project/src/com/openbravo/pos/printer/escpos/USBDevicePrinterTMU220.java
--- a/project/src/com/openbravo/pos/printer/escpos/USBDevicePrinterTMU220.java
+++ b/project/src/com/openbravo/pos/printer/escpos/USBDevicePrinterTMU220.java
@@ -1,6 +1,6 @@
/*
************************************************************************************
- * Copyright (C) 2014-2018 Openbravo S.L.U.
+ * Copyright (C) 2014-2019 Openbravo S.L.U.
* Licensed under the Openbravo Commercial License version 1.0
* You may obtain a copy of the License at http://www.openbravo.com/legal/obcl.html
* or in the legal folder of this module distribution.
@@ -22,7 +22,7 @@
public DevicePrinter build(USBDeviceID<DevicePrinter> id, HardwareConfig hwconfig)
throws TicketPrinterException {
return new DevicePrinterESCPOS(new PrinterWritterUSB(id), new CodesTMU220(),
- new UnicodeTranslatorInt(), hwconfig.getConfigProperty("qr.quality"),
- hwconfig.getConfigProperty("qr.size"));
+ new UnicodeTranslatorInt(hwconfig.getBlockFile()),
+ hwconfig.getConfigProperty("qr.quality"), hwconfig.getConfigProperty("qr.size"));
}
}
diff --git a/project/src/com/openbravo/pos/printer/escpos/USBDevicePrinterWincor.java b/project/src/com/openbravo/pos/printer/escpos/USBDevicePrinterWincor.java
--- a/project/src/com/openbravo/pos/printer/escpos/USBDevicePrinterWincor.java
+++ b/project/src/com/openbravo/pos/printer/escpos/USBDevicePrinterWincor.java
@@ -1,6 +1,6 @@
/*
************************************************************************************
- * Copyright (C) 2015-2018 Openbravo S.L.U.
+ * Copyright (C) 2015-2019 Openbravo S.L.U.
* Licensed under the Openbravo Commercial License version 1.0
* You may obtain a copy of the License at http://www.openbravo.com/legal/obcl.html
* or in the legal folder of this module distribution.
@@ -22,7 +22,7 @@
public DevicePrinter build(USBDeviceID<DevicePrinter> id, HardwareConfig hwconfig)
throws TicketPrinterException {
return new DevicePrinterESCPOSWincor(new PrinterWritterUSB(id), new CodesWincor(),
- new UnicodeTranslatorIntWincor(), hwconfig.getConfigProperty("qr.quality"),
- hwconfig.getConfigProperty("qr.size"));
+ new UnicodeTranslatorIntWincor(hwconfig.getBlockFile()),
+ hwconfig.getConfigProperty("qr.quality"), hwconfig.getConfigProperty("qr.size"));
}
}
diff --git a/project/src/com/openbravo/pos/printer/escpos/UnicodeTranslator.java b/project/src/com/openbravo/pos/printer/escpos/UnicodeTranslator.java
--- a/project/src/com/openbravo/pos/printer/escpos/UnicodeTranslator.java
+++ b/project/src/com/openbravo/pos/printer/escpos/UnicodeTranslator.java
@@ -1,6 +1,6 @@
/*
************************************************************************************
- * Copyright (C) 2012-2018 Openbravo S.L.U.
+ * Copyright (C) 2012-2019 Openbravo S.L.U.
* Licensed under the Openbravo Commercial License version 1.0
* You may obtain a copy of the License at http://www.openbravo.com/legal/obcl.html
* or in the legal folder of this module distribution.
@@ -17,9 +17,11 @@
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
+
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
+
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
@@ -28,98 +30,106 @@
public abstract class UnicodeTranslator {
- private static final Logger logger = Logger.getLogger(UnicodeTranslator.class.getName());
- private static final Map<Character.UnicodeBlock, UnicodeBlockInfo> unicodeBlocks = new HashMap<Character.UnicodeBlock, UnicodeBlockInfo>();
+ private static final Logger logger = Logger.getLogger(UnicodeTranslator.class.getName());
+ private final Map<Character.UnicodeBlock, UnicodeBlockInfo> unicodeBlocks = new HashMap<Character.UnicodeBlock, UnicodeBlockInfo>();
- static {
- // Load unicode blocks information from all resources /META-INF/unicodeblocks.xml
- try {
- Enumeration<URL> enumurl = UnicodeTranslator.class.getClassLoader().getResources("META-INF/unicodeblocks.xml");
+ UnicodeTranslator() {
+ this("unicodeblocks.xml");
+ }
+
+ UnicodeTranslator(String blockFile) {
+ // Load unicode blocks information from all resources /META-INF/unicodeblocks.xml
+ try {
+ Enumeration<URL> enumurl = UnicodeTranslator.class.getClassLoader().getResources(
+ "META-INF/" + blockFile);
- while (enumurl.hasMoreElements()) {
- URL url = enumurl.nextElement();
- try {
- SAXParserFactory spf = SAXParserFactory.newInstance();
- SAXParser sp = spf.newSAXParser();
- sp.parse(url.openStream(), new DefaultHandler() {
- @Override
- public void startElement(String uri, String localName, String qName, Attributes attributes) {
- if ("block".equals(qName)) {
- Character.UnicodeBlock block = Character.UnicodeBlock.forName(attributes.getValue("name"));
- String codetable = attributes.getValue("codetable");
- byte[] command = StringUtils.hex2byte(attributes.getValue("command").replaceAll("\\s", ""));
- unicodeBlocks.put(block, new UnicodeBlockInfo(block, codetable, command));
- }
- }
- });
- } catch (ParserConfigurationException ex) {
- logger.log(Level.WARNING, "Cannot load unicode block from: " + url.toString(), ex);
- } catch (SAXException ex) {
- logger.log(Level.WARNING, "Cannot load unicode block from: " + url.toString(), ex);
- } catch (IOException ex) {
- logger.log(Level.WARNING, "Cannot load unicode block from: " + url.toString(), ex);
- }
+ while (enumurl.hasMoreElements()) {
+ URL url = enumurl.nextElement();
+ try {
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+ SAXParser sp = spf.newSAXParser();
+ sp.parse(url.openStream(), new DefaultHandler() {
+ @Override
+ public void startElement(String uri, String localName, String qName,
+ Attributes attributes) {
+ if ("block".equals(qName)) {
+ Character.UnicodeBlock block = Character.UnicodeBlock.forName(attributes
+ .getValue("name"));
+ String codetable = attributes.getValue("codetable");
+ byte[] command = StringUtils.hex2byte(attributes.getValue("command").replaceAll(
+ "\\s", ""));
+ unicodeBlocks.put(block, new UnicodeBlockInfo(block, codetable, command));
+ }
}
+ });
+ } catch (ParserConfigurationException ex) {
+ logger.log(Level.WARNING, "Cannot load unicode block from: " + url.toString(), ex);
+ } catch (SAXException ex) {
+ logger.log(Level.WARNING, "Cannot load unicode block from: " + url.toString(), ex);
} catch (IOException ex) {
- logger.log(Level.WARNING, "Cannot list unicode blocks from: /META-INF/unicodeblocks.xml", ex);
+ logger.log(Level.WARNING, "Cannot load unicode block from: " + url.toString(), ex);
}
+ }
+ } catch (IOException ex) {
+ logger.log(Level.WARNING, "Cannot list unicode blocks from: /META-INF/unicodeblocks.xml", ex);
}
-
- private byte[] currentCodeTable = new byte[0];
+ }
- public final byte[] transString(String s) {
+ private byte[] currentCodeTable = new byte[0];
- if (s == null) {
- return null;
- } else {
- byte[] result = new byte[0];
+ public final byte[] transString(String s) {
- for (int i = 0; i < s.length(); i++) {
- char c = s.charAt(i);
- Character.UnicodeBlock block = Character.UnicodeBlock.of(c);
- UnicodeBlockInfo blockinfo = unicodeBlocks.get(block);
- if (blockinfo == null) {
- // Generic or not supported. fallback
- result = appendCodeTable(result, getCodeTable(c));
- result = append(result, new byte[]{transChar(c)});
- } else {
- // Supported charset
- byte[] charsetseq = blockinfo.getCodeTableCommand();
- if (charsetseq != null) {
- result = appendCodeTable(result, charsetseq);
- }
- try {
- result = append(result, String.valueOf(c).getBytes(blockinfo.getCodeTable()));
- } catch (UnsupportedEncodingException ex) {
- throw new RuntimeException(ex);
- }
- }
- }
- return result;
- }
- }
+ if (s == null) {
+ return null;
+ } else {
+ byte[] result = new byte[0];
- private byte[] appendCodeTable(byte[] result, byte[] codetable) {
- if (!Arrays.equals(codetable, currentCodeTable)) {
- currentCodeTable = codetable;
- return append(result, currentCodeTable);
+ for (int i = 0; i < s.length(); i++) {
+ char c = s.charAt(i);
+ Character.UnicodeBlock block = Character.UnicodeBlock.of(c);
+ UnicodeBlockInfo blockinfo = unicodeBlocks.get(block);
+ if (blockinfo == null) {
+ // Generic or not supported. fallback
+ result = appendCodeTable(result, getCodeTable(c));
+ result = append(result, new byte[] { transChar(c) });
} else {
- return result;
+ // Supported charset
+ byte[] charsetseq = blockinfo.getCodeTableCommand();
+ if (charsetseq != null) {
+ result = appendCodeTable(result, charsetseq);
+ }
+ try {
+ result = append(result, String.valueOf(c).getBytes(blockinfo.getCodeTable()));
+ } catch (UnsupportedEncodingException ex) {
+ throw new RuntimeException(ex);
+ }
}
+ }
+ return result;
}
+ }
- private byte[] append(byte[] result, byte[] append) {
- byte[] temp = new byte[result.length + append.length];
- System.arraycopy(result, 0, temp, 0, result.length);
- System.arraycopy(append, 0, temp, result.length, append.length);
- return temp;
+ private byte[] appendCodeTable(byte[] result, byte[] codetable) {
+ if (!Arrays.equals(codetable, currentCodeTable)) {
+ currentCodeTable = codetable;
+ return append(result, currentCodeTable);
+ } else {
+ return result;
}
+ }
- public abstract byte[] getCodeTable();
+ private byte[] append(byte[] result, byte[] append) {
+ byte[] temp = new byte[result.length + append.length];
+ System.arraycopy(result, 0, temp, 0, result.length);
+ System.arraycopy(append, 0, temp, result.length, append.length);
+ return temp;
+ }
- public byte[] getCodeTable(char sChar) {
- return getCodeTable();
- };
+ public abstract byte[] getCodeTable();
- public abstract byte transChar(char sChar);
+ public byte[] getCodeTable(char sChar) {
+ return getCodeTable();
+ };
+
+ public abstract byte transChar(char sChar);
}
diff --git a/project/src/com/openbravo/pos/printer/escpos/UnicodeTranslatorEur.java b/project/src/com/openbravo/pos/printer/escpos/UnicodeTranslatorEur.java
--- a/project/src/com/openbravo/pos/printer/escpos/UnicodeTranslatorEur.java
+++ b/project/src/com/openbravo/pos/printer/escpos/UnicodeTranslatorEur.java
@@ -1,6 +1,6 @@
/*
************************************************************************************
- * Copyright (C) 2012 Openbravo S.L.U.
+ * Copyright (C) 2012-2019 Openbravo S.L.U.
* Licensed under the Openbravo Commercial License version 1.0
* You may obtain a copy of the License at http://www.openbravo.com/legal/obcl.html
* or in the legal folder of this module distribution.
@@ -10,42 +10,64 @@
package com.openbravo.pos.printer.escpos;
public class UnicodeTranslatorEur extends UnicodeTranslator {
-
- /** Creates a new instance of UnicodeTranslatorEur */
- public UnicodeTranslatorEur() {
- }
-
- public byte[] getCodeTable() {
- return ESCPOS.CODE_TABLE_13;
+
+ /** Creates a new instance of UnicodeTranslatorEur */
+ public UnicodeTranslatorEur() {
+ super();
+ }
+
+ public UnicodeTranslatorEur(String blockFile) {
+ super(blockFile);
+ }
+
+ public byte[] getCodeTable() {
+ return ESCPOS.CODE_TABLE_13;
+ }
+
+ public byte transChar(char sChar) {
+ if ((sChar >= 0x0000) && (sChar < 0x0080)) {
+ return (byte) sChar;
+ } else {
+ switch (sChar) {
+ case '\u00e1':
+ return -0x60; // a acute
+ case '\u00e9':
+ return -0x7E; // e acute
+ case '\u00ed':
+ return -0x5F; // i acute
+ case '\u00f3':
+ return -0x5E; // o acute
+ case '\u00fa':
+ return -0x5D; // u acute
+ case '\u00fc':
+ return -0x7F; // u dieresis
+ case '\u00f1':
+ return -0x5C; // n tilde
+ case '\u00d1':
+ return -0x5B; // N tilde
+
+ case '\u00c1':
+ return 0x41; // A acute
+ case '\u00c9':
+ return 0x45; // E acute
+ case '\u00cd':
+ return 0x49; // I acute
+ case '\u00d3':
+ return 0x4F; // O acute
+ case '\u00da':
+ return 0x55; // U acute
+ case '\u00dc':
+ return -0x66; // U dieresis
+ case '\u00bf':
+ return -0x58; // abrir interrogacion
+ case '\u00a1':
+ return -0x53; // abrir admiracion
+ case '\u20ac':
+ return -0x12; // Euro Sign
+
+ default:
+ return 0x3F; // ? Not valid character.
+ }
}
-
- public byte transChar(char sChar) {
- if ((sChar >= 0x0000) && (sChar < 0x0080)) {
- return (byte) sChar;
- } else {
- switch (sChar) {
- case '\u00e1': return -0x60; // a acute
- case '\u00e9': return -0x7E; // e acute
- case '\u00ed': return -0x5F; // i acute
- case '\u00f3': return -0x5E; // o acute
- case '\u00fa': return -0x5D; // u acute
- case '\u00fc': return -0x7F; // u dieresis
- case '\u00f1': return -0x5C; // n tilde
- case '\u00d1': return -0x5B; // N tilde
-
- case '\u00c1': return 0x41; // A acute
- case '\u00c9': return 0x45; // E acute
- case '\u00cd': return 0x49; // I acute
- case '\u00d3': return 0x4F; // O acute
- case '\u00da': return 0x55; // U acute
- case '\u00dc': return -0x66; // U dieresis
- case '\u00bf': return -0x58; // abrir interrogacion
- case '\u00a1': return -0x53; // abrir admiracion
- case '\u20ac': return -0x12; // Euro Sign
-
-
- default: return 0x3F; // ? Not valid character.
- }
- }
- }
+ }
}
diff --git a/project/src/com/openbravo/pos/printer/escpos/UnicodeTranslatorInt.java b/project/src/com/openbravo/pos/printer/escpos/UnicodeTranslatorInt.java
--- a/project/src/com/openbravo/pos/printer/escpos/UnicodeTranslatorInt.java
+++ b/project/src/com/openbravo/pos/printer/escpos/UnicodeTranslatorInt.java
@@ -1,6 +1,6 @@
/*
************************************************************************************
- * Copyright (C) 2012-2017 Openbravo S.L.U.
+ * Copyright (C) 2012-2019 Openbravo S.L.U.
* Licensed under the Openbravo Commercial License version 1.0
* You may obtain a copy of the License at http://www.openbravo.com/legal/obcl.html
* or in the legal folder of this module distribution.
@@ -13,413 +13,715 @@
import java.nio.charset.Charset;
public class UnicodeTranslatorInt extends UnicodeTranslator {
-
- /** Creates a new instance of UnicodeTranslatorInt */
- public UnicodeTranslatorInt() {
- }
-
- public byte[] getCodeTable() {
- return ESCPOS.CODE_TABLE_13;
+
+ /** Creates a new instance of UnicodeTranslatorInt */
+ public UnicodeTranslatorInt() {
+ super();
+ }
+
+ public UnicodeTranslatorInt(String blockFile) {
+ super(blockFile);
+ }
+
+ public byte[] getCodeTable() {
+ return ESCPOS.CODE_TABLE_13;
+ }
+
+ public byte[] getCodeTable(char sChar) {
+
+ if (sChar >= '\u0600' && sChar <= '\u06FF') { // Arabic Unicode Block
+ return ESCPOS.CODE_TABLE_1256;
}
-
- public byte[] getCodeTable(char sChar) {
-
- if (sChar >= '\u0600' && sChar <= '\u06FF') { // Arabic Unicode Block
- return ESCPOS.CODE_TABLE_1256;
- }
- switch (sChar) {
- // ----- Vietnamise Codes -----//
- // ----- Lowercase: CodeTable 30 ----- //
- case '\u0103': return ESCPOS.CODE_TABLE_30; // Character: ă
- case '\u01a1': return ESCPOS.CODE_TABLE_30; // Character: ơ
- case '\u01b0': return ESCPOS.CODE_TABLE_30; // Character: ư
- case '\u0111': return ESCPOS.CODE_TABLE_30; // Character: đ
- case '\u1ea3': return ESCPOS.CODE_TABLE_30; // Character: ả
- case '\u00e3': return ESCPOS.CODE_TABLE_30; // Character: ã
- case '\u1ea1': return ESCPOS.CODE_TABLE_30; // Character: ạ
- case '\u1eb1': return ESCPOS.CODE_TABLE_30; // Character: ằ
- case '\u1eb3': return ESCPOS.CODE_TABLE_30; // Character: ẳ
- case '\u1eb5': return ESCPOS.CODE_TABLE_30; // Character: ẵ
- case '\u1eaf': return ESCPOS.CODE_TABLE_30; // Character: ắ
- case '\u1eb7': return ESCPOS.CODE_TABLE_30; // Character: ặ
- case '\u1ea7': return ESCPOS.CODE_TABLE_30; // Character: ầ
- case '\u1ea9': return ESCPOS.CODE_TABLE_30; // Character: ẩ
- case '\u1eab': return ESCPOS.CODE_TABLE_30; // Character: ẫ
- case '\u1ea5': return ESCPOS.CODE_TABLE_30; // Character: ấ
- case '\u1ead': return ESCPOS.CODE_TABLE_30; // Character: ậ
- case '\u1ebb': return ESCPOS.CODE_TABLE_30; // Character: ẻ
- case '\u1ebd': return ESCPOS.CODE_TABLE_30; // Character: ẽ
- case '\u1eb9': return ESCPOS.CODE_TABLE_30; // Character: ẹ
- case '\u1ec1': return ESCPOS.CODE_TABLE_30; // Character: ề
- case '\u1ec3': return ESCPOS.CODE_TABLE_30; // Character: ể
- case '\u1ec5': return ESCPOS.CODE_TABLE_30; // Character: ễ
- case '\u1ebf': return ESCPOS.CODE_TABLE_30; // Character: ế
- case '\u1ec7': return ESCPOS.CODE_TABLE_30; // Character: ệ
- case '\u1ec9': return ESCPOS.CODE_TABLE_30; // Character: ỉ
- case '\u0129': return ESCPOS.CODE_TABLE_30; // Character: ĩ
- case '\u1ecb': return ESCPOS.CODE_TABLE_30; // Character: ị
- case '\u1ecf': return ESCPOS.CODE_TABLE_30; // Character: ỏ
- case '\u00f5': return ESCPOS.CODE_TABLE_30; // Character: õ
- case '\u1ecd': return ESCPOS.CODE_TABLE_30; // Character: ọ
- case '\u1ed3': return ESCPOS.CODE_TABLE_30; // Character: ồ
- case '\u1ed5': return ESCPOS.CODE_TABLE_30; // Character: ổ
- case '\u1ed7': return ESCPOS.CODE_TABLE_30; // Character: ỗ
- case '\u1ed1': return ESCPOS.CODE_TABLE_30; // Character: ố
- case '\u1ed9': return ESCPOS.CODE_TABLE_30; // Character: ộ
- case '\u1edd': return ESCPOS.CODE_TABLE_30; // Character: ờ
- case '\u1edf': return ESCPOS.CODE_TABLE_30; // Character: ở
- case '\u1ee1': return ESCPOS.CODE_TABLE_30; // Character: ỡ
- case '\u1edb': return ESCPOS.CODE_TABLE_30; // Character: ớ
- case '\u1ee3': return ESCPOS.CODE_TABLE_30; // Character: ợ
- case '\u1ee7': return ESCPOS.CODE_TABLE_30; // Character: ủ
- case '\u0169': return ESCPOS.CODE_TABLE_30; // Character: ũ
- case '\u1ee5': return ESCPOS.CODE_TABLE_30; // Character: ụ
- case '\u1eeb': return ESCPOS.CODE_TABLE_30; // Character: ừ
- case '\u1eed': return ESCPOS.CODE_TABLE_30; // Character: ử
- case '\u1eef': return ESCPOS.CODE_TABLE_30; // Character: ữ
- case '\u1ee9': return ESCPOS.CODE_TABLE_30; // Character: ứ
- case '\u1ef1': return ESCPOS.CODE_TABLE_30; // Character: ự
- case '\u1ef3': return ESCPOS.CODE_TABLE_30; // Character: ỳ
- case '\u1ef7': return ESCPOS.CODE_TABLE_30; // Character: ỷ
- case '\u1ef9': return ESCPOS.CODE_TABLE_30; // Character: ỹ
- case '\u1ef5': return ESCPOS.CODE_TABLE_30; // Character: ỵ
+ switch (sChar) {
+ // ----- Vietnamise Codes -----//
+ // ----- Lowercase: CodeTable 30 ----- //
+ case '\u0103':
+ return ESCPOS.CODE_TABLE_30; // Character: ă
+ case '\u01a1':
+ return ESCPOS.CODE_TABLE_30; // Character: ơ
+ case '\u01b0':
+ return ESCPOS.CODE_TABLE_30; // Character: ư
+ case '\u0111':
+ return ESCPOS.CODE_TABLE_30; // Character: đ
+ case '\u1ea3':
+ return ESCPOS.CODE_TABLE_30; // Character: ả
+ case '\u00e3':
+ return ESCPOS.CODE_TABLE_30; // Character: ã
+ case '\u1ea1':
+ return ESCPOS.CODE_TABLE_30; // Character: ạ
+ case '\u1eb1':
+ return ESCPOS.CODE_TABLE_30; // Character: ằ
+ case '\u1eb3':
+ return ESCPOS.CODE_TABLE_30; // Character: ẳ
+ case '\u1eb5':
+ return ESCPOS.CODE_TABLE_30; // Character: ẵ
+ case '\u1eaf':
+ return ESCPOS.CODE_TABLE_30; // Character: ắ
+ case '\u1eb7':
+ return ESCPOS.CODE_TABLE_30; // Character: ặ
+ case '\u1ea7':
+ return ESCPOS.CODE_TABLE_30; // Character: ầ
+ case '\u1ea9':
+ return ESCPOS.CODE_TABLE_30; // Character: ẩ
+ case '\u1eab':
+ return ESCPOS.CODE_TABLE_30; // Character: ẫ
+ case '\u1ea5':
+ return ESCPOS.CODE_TABLE_30; // Character: ấ
+ case '\u1ead':
+ return ESCPOS.CODE_TABLE_30; // Character: ậ
+ case '\u1ebb':
+ return ESCPOS.CODE_TABLE_30; // Character: ẻ
+ case '\u1ebd':
+ return ESCPOS.CODE_TABLE_30; // Character: ẽ
+ case '\u1eb9':
+ return ESCPOS.CODE_TABLE_30; // Character: ẹ
+ case '\u1ec1':
+ return ESCPOS.CODE_TABLE_30; // Character: ề
+ case '\u1ec3':
+ return ESCPOS.CODE_TABLE_30; // Character: ể
+ case '\u1ec5':
+ return ESCPOS.CODE_TABLE_30; // Character: ễ
+ case '\u1ebf':
+ return ESCPOS.CODE_TABLE_30; // Character: ế
+ case '\u1ec7':
+ return ESCPOS.CODE_TABLE_30; // Character: ệ
+ case '\u1ec9':
+ return ESCPOS.CODE_TABLE_30; // Character: ỉ
+ case '\u0129':
+ return ESCPOS.CODE_TABLE_30; // Character: ĩ
+ case '\u1ecb':
+ return ESCPOS.CODE_TABLE_30; // Character: ị
+ case '\u1ecf':
+ return ESCPOS.CODE_TABLE_30; // Character: ỏ
+ case '\u00f5':
+ return ESCPOS.CODE_TABLE_30; // Character: õ
+ case '\u1ecd':
+ return ESCPOS.CODE_TABLE_30; // Character: ọ
+ case '\u1ed3':
+ return ESCPOS.CODE_TABLE_30; // Character: ồ
+ case '\u1ed5':
+ return ESCPOS.CODE_TABLE_30; // Character: ổ
+ case '\u1ed7':
+ return ESCPOS.CODE_TABLE_30; // Character: ỗ
+ case '\u1ed1':
+ return ESCPOS.CODE_TABLE_30; // Character: ố
+ case '\u1ed9':
+ return ESCPOS.CODE_TABLE_30; // Character: ộ
+ case '\u1edd':
+ return ESCPOS.CODE_TABLE_30; // Character: ờ
+ case '\u1edf':
+ return ESCPOS.CODE_TABLE_30; // Character: ở
+ case '\u1ee1':
+ return ESCPOS.CODE_TABLE_30; // Character: ỡ
+ case '\u1edb':
+ return ESCPOS.CODE_TABLE_30; // Character: ớ
+ case '\u1ee3':
+ return ESCPOS.CODE_TABLE_30; // Character: ợ
+ case '\u1ee7':
+ return ESCPOS.CODE_TABLE_30; // Character: ủ
+ case '\u0169':
+ return ESCPOS.CODE_TABLE_30; // Character: ũ
+ case '\u1ee5':
+ return ESCPOS.CODE_TABLE_30; // Character: ụ
+ case '\u1eeb':
+ return ESCPOS.CODE_TABLE_30; // Character: ừ
+ case '\u1eed':
+ return ESCPOS.CODE_TABLE_30; // Character: ử
+ case '\u1eef':
+ return ESCPOS.CODE_TABLE_30; // Character: ữ
+ case '\u1ee9':
+ return ESCPOS.CODE_TABLE_30; // Character: ứ
+ case '\u1ef1':
+ return ESCPOS.CODE_TABLE_30; // Character: ự
+ case '\u1ef3':
+ return ESCPOS.CODE_TABLE_30; // Character: ỳ
+ case '\u1ef7':
+ return ESCPOS.CODE_TABLE_30; // Character: ỷ
+ case '\u1ef9':
+ return ESCPOS.CODE_TABLE_30; // Character: ỹ
+ case '\u1ef5':
+ return ESCPOS.CODE_TABLE_30; // Character: ỵ
+
+ // ----- Uppercase: CodeTable 31 ----- //
+ case '\u0102':
+ return ESCPOS.CODE_TABLE_31; // Character: Ă
+ case '\u0110':
+ return ESCPOS.CODE_TABLE_31; // Character: Đ
+ case '\u01a0':
+ return ESCPOS.CODE_TABLE_31; // Character: Ơ
+ case '\u01af':
+ return ESCPOS.CODE_TABLE_31; // Character: Ư
+ case '\u1ea2':
+ return ESCPOS.CODE_TABLE_31; // Character: Ả
+ case '\u00c3':
+ return ESCPOS.CODE_TABLE_31; // Character: Ã
+ case '\u1ea0':
+ return ESCPOS.CODE_TABLE_31; // Character: Ạ
+ case '\u1eb0':
+ return ESCPOS.CODE_TABLE_31; // Character: Ằ
+ case '\u1eb2':
+ return ESCPOS.CODE_TABLE_31; // Character: Ằ
+ case '\u1eb4':
+ return ESCPOS.CODE_TABLE_31; // Character: Ẵ
+ case '\u1eae':
+ return ESCPOS.CODE_TABLE_31; // Character: Ắ
+ case '\u1eb6':
+ return ESCPOS.CODE_TABLE_31; // Character: Ặ
+ case '\u1ea6':
+ return ESCPOS.CODE_TABLE_31; // Character: Ầ
+ case '\u1ea8':
+ return ESCPOS.CODE_TABLE_31; // Character: Ẩ
+ case '\u1eaa':
+ return ESCPOS.CODE_TABLE_31; // Character: Ẫ
+ case '\u1ea4':
+ return ESCPOS.CODE_TABLE_31; // Character: Ấ
+ case '\u1eac':
+ return ESCPOS.CODE_TABLE_31; // Character: Ậ
+ case '\u1eba':
+ return ESCPOS.CODE_TABLE_31; // Character: Ẻ
+ case '\u1ebc':
+ return ESCPOS.CODE_TABLE_31; // Character: Ẽ
+ case '\u1eb8':
+ return ESCPOS.CODE_TABLE_31; // Character: Ẹ
+ case '\u1ec0':
+ return ESCPOS.CODE_TABLE_31; // Character: Ề
+ case '\u1ec2':
+ return ESCPOS.CODE_TABLE_31; // Character: Ể
+ case '\u1ec4':
+ return ESCPOS.CODE_TABLE_31; // Character: Ễ
+ case '\u1ebe':
+ return ESCPOS.CODE_TABLE_31; // Character: Ế
+ case '\u1ec6':
+ return ESCPOS.CODE_TABLE_31; // Character: Ệ
+ case '\u1ec8':
+ return ESCPOS.CODE_TABLE_31; // Character: Ỉ
+ case '\u0128':
+ return ESCPOS.CODE_TABLE_31; // Character: Ĩ
+ case '\u1eca':
+ return ESCPOS.CODE_TABLE_31; // Character: Ị
+ case '\u1ece':
+ return ESCPOS.CODE_TABLE_31; // Character: Ỏ
+ case '\u00d5':
+ return ESCPOS.CODE_TABLE_31; // Character: Õ
+ case '\u1ecc':
+ return ESCPOS.CODE_TABLE_31; // Character: Ọ
+ case '\u1ed2':
+ return ESCPOS.CODE_TABLE_31; // Character: Ồ
+ case '\u1ed4':
+ return ESCPOS.CODE_TABLE_31; // Character: Ổ
+ case '\u1ed6':
+ return ESCPOS.CODE_TABLE_31; // Character: Ỗ
+ case '\u1ed0':
+ return ESCPOS.CODE_TABLE_31; // Character: Ố
+ case '\u1ed8':
+ return ESCPOS.CODE_TABLE_31; // Character: Ộ
+ case '\u1edc':
+ return ESCPOS.CODE_TABLE_31; // Character: Ờ
+ case '\u1ede':
+ return ESCPOS.CODE_TABLE_31; // Character: Ở
+ case '\u1ee0':
+ return ESCPOS.CODE_TABLE_31; // Character: Ỡ
+ case '\u1eda':
+ return ESCPOS.CODE_TABLE_31; // Character: Ớ
+ case '\u1ee2':
+ return ESCPOS.CODE_TABLE_31; // Character: Ợ
+ case '\u1ee6':
+ return ESCPOS.CODE_TABLE_31; // Character: Ủ
+ case '\u0168':
+ return ESCPOS.CODE_TABLE_31; // Character: Ũ
+ case '\u1ee4':
+ return ESCPOS.CODE_TABLE_31; // Character: Ụ
+ case '\u1eea':
+ return ESCPOS.CODE_TABLE_31; // Character: Ừ
+ case '\u1eec':
+ return ESCPOS.CODE_TABLE_31; // Character: Ử
+ case '\u1eee':
+ return ESCPOS.CODE_TABLE_31; // Character: Ữ
+ case '\u1ee8':
+ return ESCPOS.CODE_TABLE_31; // Character: Ứ
+ case '\u1ef0':
+ return ESCPOS.CODE_TABLE_31; // Character: Ự
+ case '\u1ef2':
+ return ESCPOS.CODE_TABLE_31; // Character: Ỳ
+ case '\u1ef6':
+ return ESCPOS.CODE_TABLE_31; // Character: Ỷ
+ case '\u1ef8':
+ return ESCPOS.CODE_TABLE_31; // Character: Ỹ
+ case '\u1ef4':
+ return ESCPOS.CODE_TABLE_31; // Character: Ỵ
+ default:
+ return ESCPOS.CODE_TABLE_13; // ? Not valid character.
+ }
+ }
- // ----- Uppercase: CodeTable 31 ----- //
- case '\u0102': return ESCPOS.CODE_TABLE_31; // Character: Ă
- case '\u0110': return ESCPOS.CODE_TABLE_31; // Character: Đ
- case '\u01a0': return ESCPOS.CODE_TABLE_31; // Character: Ơ
- case '\u01af': return ESCPOS.CODE_TABLE_31; // Character: Ư
- case '\u1ea2': return ESCPOS.CODE_TABLE_31; // Character: Ả
- case '\u00c3': return ESCPOS.CODE_TABLE_31; // Character: Ã
- case '\u1ea0': return ESCPOS.CODE_TABLE_31; // Character: Ạ
- case '\u1eb0': return ESCPOS.CODE_TABLE_31; // Character: Ằ
- case '\u1eb2': return ESCPOS.CODE_TABLE_31; // Character: Ằ
- case '\u1eb4': return ESCPOS.CODE_TABLE_31; // Character: Ẵ
- case '\u1eae': return ESCPOS.CODE_TABLE_31; // Character: Ắ
- case '\u1eb6': return ESCPOS.CODE_TABLE_31; // Character: Ặ
- case '\u1ea6': return ESCPOS.CODE_TABLE_31; // Character: Ầ
- case '\u1ea8': return ESCPOS.CODE_TABLE_31; // Character: Ẩ
- case '\u1eaa': return ESCPOS.CODE_TABLE_31; // Character: Ẫ
- case '\u1ea4': return ESCPOS.CODE_TABLE_31; // Character: Ấ
- case '\u1eac': return ESCPOS.CODE_TABLE_31; // Character: Ậ
- case '\u1eba': return ESCPOS.CODE_TABLE_31; // Character: Ẻ
- case '\u1ebc': return ESCPOS.CODE_TABLE_31; // Character: Ẽ
- case '\u1eb8': return ESCPOS.CODE_TABLE_31; // Character: Ẹ
- case '\u1ec0': return ESCPOS.CODE_TABLE_31; // Character: Ề
- case '\u1ec2': return ESCPOS.CODE_TABLE_31; // Character: Ể
- case '\u1ec4': return ESCPOS.CODE_TABLE_31; // Character: Ễ
- case '\u1ebe': return ESCPOS.CODE_TABLE_31; // Character: Ế
- case '\u1ec6': return ESCPOS.CODE_TABLE_31; // Character: Ệ
- case '\u1ec8': return ESCPOS.CODE_TABLE_31; // Character: Ỉ
- case '\u0128': return ESCPOS.CODE_TABLE_31; // Character: Ĩ
- case '\u1eca': return ESCPOS.CODE_TABLE_31; // Character: Ị
- case '\u1ece': return ESCPOS.CODE_TABLE_31; // Character: Ỏ
- case '\u00d5': return ESCPOS.CODE_TABLE_31; // Character: Õ
- case '\u1ecc': return ESCPOS.CODE_TABLE_31; // Character: Ọ
- case '\u1ed2': return ESCPOS.CODE_TABLE_31; // Character: Ồ
- case '\u1ed4': return ESCPOS.CODE_TABLE_31; // Character: Ổ
- case '\u1ed6': return ESCPOS.CODE_TABLE_31; // Character: Ỗ
- case '\u1ed0': return ESCPOS.CODE_TABLE_31; // Character: Ố
- case '\u1ed8': return ESCPOS.CODE_TABLE_31; // Character: Ộ
- case '\u1edc': return ESCPOS.CODE_TABLE_31; // Character: Ờ
- case '\u1ede': return ESCPOS.CODE_TABLE_31; // Character: Ở
- case '\u1ee0': return ESCPOS.CODE_TABLE_31; // Character: Ỡ
- case '\u1eda': return ESCPOS.CODE_TABLE_31; // Character: Ớ
- case '\u1ee2': return ESCPOS.CODE_TABLE_31; // Character: Ợ
- case '\u1ee6': return ESCPOS.CODE_TABLE_31; // Character: Ủ
- case '\u0168': return ESCPOS.CODE_TABLE_31; // Character: Ũ
- case '\u1ee4': return ESCPOS.CODE_TABLE_31; // Character: Ụ
- case '\u1eea': return ESCPOS.CODE_TABLE_31; // Character: Ừ
- case '\u1eec': return ESCPOS.CODE_TABLE_31; // Character: Ử
- case '\u1eee': return ESCPOS.CODE_TABLE_31; // Character: Ữ
- case '\u1ee8': return ESCPOS.CODE_TABLE_31; // Character: Ứ
- case '\u1ef0': return ESCPOS.CODE_TABLE_31; // Character: Ự
- case '\u1ef2': return ESCPOS.CODE_TABLE_31; // Character: Ỳ
- case '\u1ef6': return ESCPOS.CODE_TABLE_31; // Character: Ỷ
- case '\u1ef8': return ESCPOS.CODE_TABLE_31; // Character: Ỹ
- case '\u1ef4': return ESCPOS.CODE_TABLE_31; // Character: Ỵ
- default: return ESCPOS.CODE_TABLE_13; // ? Not valid character.
- }
- }
-
- public byte transChar(char sChar) {
- if ((sChar >= 0x0000) && (sChar < 0x0080)) {
- return (byte) sChar;
- } else if (sChar >= '\u0600' && sChar <= '\u06FF') { // Arabic Unicode Block
- return Charset.forName("Cp1256").encode(CharBuffer.wrap(new char[] {sChar})).get(0);
- } else {
- switch (sChar) {
- // ----- Vietnamise Codes -----//
- // ----- Lowercase: CodeTable 30 ----- //
- case '\u0103': return (byte) -0x58; // Character: ă
- case '\u01a1': return (byte) -0x54; // Character: ơ
- case '\u01b0': return (byte) -0x53; // Character: ư
- case '\u0111': return (byte) -0x52; // Character: đ
- case '\u1ea3': return (byte) -0x4A; // Character: ả
- case '\u00e3': return (byte) -0x49; // Character: ã
- case '\u1ea1': return (byte) -0x47; // Character: ạ
- case '\u1eb1': return (byte) -0x45; // Character: ằ
- case '\u1eb3': return (byte) -0x44; // Character: ẳ
- case '\u1eb5': return (byte) -0x43; // Character: ẵ
- case '\u1eaf': return (byte) -0x42; // Character: ắ
- case '\u1eb7': return (byte) -0x3A; // Character: ặ
- case '\u1ea7': return (byte) -0x39; // Character: ầ
- case '\u1ea9': return (byte) -0x38; // Character: ẩ
- case '\u1eab': return (byte) -0x37; // Character: ẫ
- case '\u1ea5': return (byte) -0x36; // Character: ấ
- case '\u1ead': return (byte) -0x35; // Character: ậ
- case '\u1ebb': return (byte) -0x32; // Character: ẻ
- case '\u1ebd': return (byte) -0x31; // Character: ẽ
- case '\u1eb9': return (byte) -0x2F; // Character: ẹ
- case '\u1ec1': return (byte) -0x2E; // Character: ề
- case '\u1ec3': return (byte) -0x2D; // Character: ể
- case '\u1ec5': return (byte) -0x2C; // Character: ễ
- case '\u1ebf': return (byte) -0x2B; // Character: ế
- case '\u1ec7': return (byte) -0x2A; // Character: ệ
- case '\u1ec9': return (byte) -0x28; // Character: ỉ
- case '\u0129': return (byte) -0x24; // Character: ĩ
- case '\u1ecb': return (byte) -0x22; // Character: ị
- case '\u1ecf': return (byte) -0x1F; // Character: ỏ
- case '\u00f5': return (byte) -0x1E; // Character: õ
- case '\u1ecd': return (byte) -0x1C; // Character: ọ
- case '\u1ed3': return (byte) -0x1B; // Character: ồ
- case '\u1ed5': return (byte) -0x1A; // Character: ổ
- case '\u1ed7': return (byte) -0x19; // Character: ỗ
- case '\u1ed1': return (byte) -0x18; // Character: ố
- case '\u1ed9': return (byte) -0x17; // Character: ộ
- case '\u1edd': return (byte) -0x16; // Character: ờ
- case '\u1edf': return (byte) -0x15; // Character: ở
- case '\u1ee1': return (byte) -0x14; // Character: ỡ
- case '\u1edb': return (byte) -0x13; // Character: ớ
- case '\u1ee3': return (byte) -0x12; // Character: ợ
- case '\u1ee7': return (byte) -0x0F; // Character: ủ
- case '\u0169': return (byte) -0x0E; // Character: ũ
- case '\u1ee5': return (byte) -0x0C; // Character: ụ
- case '\u1eeb': return (byte) -0x0B; // Character: ừ
- case '\u1eed': return (byte) -0x0A; // Character: ử
- case '\u1eef': return (byte) -0x09; // Character: ữ
- case '\u1ee9': return (byte) -0x08; // Character: ứ
- case '\u1ef1': return (byte) -0x07; // Character: ự
- case '\u1ef3': return (byte) -0x06; // Character: ỳ
- case '\u1ef7': return (byte) -0x05; // Character: ỷ
- case '\u1ef9': return (byte) -0x04; // Character: ỹ
- case '\u1ef5': return (byte) -0x02; // Character: ỵ
-
- // ----- Uppercase: CodeTable 31 ----- //
- case '\u0102': return (byte) -0x5F; // Character: Ă
- case '\u0110': return (byte) -0x59; // Character: Đ
- case '\u01a0': return (byte) -0x54; // Character: Ơ
- case '\u01af': return (byte) -0x53; // Character: Ư
- case '\u1ea2': return (byte) -0x4A; // Character: Ả
- case '\u00c3': return (byte) -0x49; // Character: Ã
- case '\u1ea0': return (byte) -0x47; // Character: Ạ
- case '\u1eb0': return (byte) -0x45; // Character: Ằ
- case '\u1eb2': return (byte) -0x44; // Character: Ằ
- case '\u1eb4': return (byte) -0x43; // Character: Ẵ
- case '\u1eae': return (byte) -0x42; // Character: Ắ
- case '\u1eb6': return (byte) -0x3A; // Character: Ặ
- case '\u1ea6': return (byte) -0x39; // Character: Ầ
- case '\u1ea8': return (byte) -0x38; // Character: Ẩ
- case '\u1eaa': return (byte) -0x37; // Character: Ẫ
- case '\u1ea4': return (byte) -0x36; // Character: Ấ
- case '\u1eac': return (byte) -0x35; // Character: Ậ
- case '\u1eba': return (byte) -0x32; // Character: Ẻ
- case '\u1ebc': return (byte) -0x31; // Character: Ẽ
- case '\u1eb8': return (byte) -0x2F; // Character: Ẹ
- case '\u1ec0': return (byte) -0x2E; // Character: Ề
- case '\u1ec2': return (byte) -0x2D; // Character: Ể
- case '\u1ec4': return (byte) -0x2C; // Character: Ễ
- case '\u1ebe': return (byte) -0x2B; // Character: Ế
- case '\u1ec6': return (byte) -0x2A; // Character: Ệ
- case '\u1ec8': return (byte) -0x28; // Character: Ỉ
- case '\u0128': return (byte) -0x24; // Character: Ĩ
- case '\u1eca': return (byte) -0x22; // Character: Ị
- case '\u1ece': return (byte) -0x1F; // Character: Ỏ
- case '\u00d5': return (byte) -0x1E; // Character: Õ
- case '\u1ecc': return (byte) -0x1C; // Character: Ọ
- case '\u1ed2': return (byte) -0x1B; // Character: Ồ
- case '\u1ed4': return (byte) -0x1A; // Character: Ổ
- case '\u1ed6': return (byte) -0x19; // Character: Ỗ
- case '\u1ed0': return (byte) -0x18; // Character: Ố
- case '\u1ed8': return (byte) -0x17; // Character: Ộ
- case '\u1edc': return (byte) -0x16; // Character: Ờ
- case '\u1ede': return (byte) -0x15; // Character: Ở
- case '\u1ee0': return (byte) -0x14; // Character: Ỡ
- case '\u1eda': return (byte) -0x13; // Character: Ớ
- case '\u1ee2': return (byte) -0x12; // Character: Ợ
- case '\u1ee6': return (byte) -0x0F; // Character: Ủ
- case '\u0168': return (byte) -0x0E; // Character: Ũ
- case '\u1ee4': return (byte) -0x0C; // Character: Ụ
- case '\u1eea': return (byte) -0x0B; // Character: Ừ
- case '\u1eec': return (byte) -0x0A; // Character: Ử
- case '\u1eee': return (byte) -0x09; // Character: Ữ
- case '\u1ee8': return (byte) -0x08; // Character: Ứ
- case '\u1ef0': return (byte) -0x07; // Character: Ự
- case '\u1ef2': return (byte) -0x06; // Character: Ỳ
- case '\u1ef6': return (byte) -0x05; // Character: Ỷ
- case '\u1ef8': return (byte) -0x04; // Character: Ỹ
- case '\u1ef4': return (byte) -0x02; // Character: Ỵ
- // ----- END Vietnamese Characters -----//
- case '\u00c7': return -0x80;
- case '\u00fc': return -0x7F; // u dieresis
- case '\u00e2': return -0x7D;
- case '\u00e4': return -0x7C;
- case '\u00e0': return -0x7B;
- case '\u00E5': return -0x7A; // ao
- case '\u00e7': return -0x79;
- case '\u00ea': return -0x78;
- case '\u00eb': return -0x77;
- case '\u00e8': return -0x76;
- case '\u00ef': return -0x75;
- case '\u00ee': return -0x74;
- case '\u00ec': return -0x73;
- case '\u00c4': return -0x72;
- case '\u00C5': return -0x71; // Ao
-
- case '\u00c9': return -0x70; // E acute
- case '\u00E6': return -0x6F; // ae
- case '\u00C6': return -0x6E; // AE
- case '\u00f4': return -0x6D;
- case '\u00f6': return -0x6C;
- case '\u00f2': return -0x6B;
- case '\u00fb': return -0x6A;
- case '\u00f9': return -0x69;
- case '\u00ff': return -0x68;
- case '\u00d6': return -0x67;
- case '\u00dc': return -0x66; // U dieresis
- case '\u00F8': return -0x65; // o/
- case '\u00A3': return -0x64; // L- Libra esterlina
- case '\u00D8': return -0x63; // O/
- case '\u00D7': return -0x62; // X
-// case '': return -0x61; // f
-
- case '\u00e1': return -0x60; // a acute
- case '\u00e9': return -0x7E; // e acute
- case '\u00ed': return -0x5F; // i acute
- case '\u00f3': return -0x5E; // o acute
- case '\u00fa': return -0x5D; // u acute
- case '\u00f1': return -0x5C; // n tilde
- case '\u00d1': return -0x5B; // N tilde
- case '\u00aa': return -0x5A;
- case '\u00ba': return -0x59;
- case '\u00bf': return -0x58; // abrir interrogacion
- case '\u00AE': return -0x57; // (R) Registrado
- case '\u00ac': return -0x56; // Not sign
- case '\u00BD': return -0x55; // 1/2
- case '\u00BC': return -0x54; // 1/4
- case '\u00a1': return -0x53; // abrir admiracion
- case '\u00AB': return -0x52; // <<
- case '\u00BB': return -0x51; // >>
-
- case '\u2591': return -0x50; // Light shade
- case '\u2592': return -0x4F; // Medium shade
- case '\u2593': return -0x4E; // Dark shade
- case '\u2502': return -0x4D; // BOX DRAWINGS LIGHT VERTICAL
- case '\u2524': return -0x4C; // BOX DRAWINGS LIGHT VERTICAL AND LEFT
- case '\u00c1': return -0x4B; // A acute
- case '\u00c2': return -0x4A;
- case '\u00c0': return -0x49;
- case '\u00A9': return -0x48; // (c) Copyright
- case '\u2563': return -0x47; // BOX DRAWINGS DOUBLE VERTICAL AND LEFT
- case '\u2551': return -0x46; // BOX DRAWINGS DOUBLE VERTICAL
- case '\u2557': return -0x45; // BOX DRAWINGS DOUBLE DOWN AND LEFT
- case '\u255D': return -0x44; // BOX DRAWINGS DOUBLE UP AND LEFT
- case '\u00A2': return -0x43; // Cent Sign
- case '\u00A5': return -0x42; // Yen Sign
- case '\u2510': return -0x41; // BOX DRAWINGS LIGHT DOWN AND LEFT
-
- case '\u2514': return -0x40; // BOX DRAWINGS LIGHT UP ANDRIGHT
-// case '': return -0x3F; //
-// case '': return -0x3E; //
-// case '': return -0x3D; //
-// case '': return -0x3C; //
-// case '': return -0x3B; //
-// case '': return -0x3A; //
-// case '': return -0x39; //
-// case '': return -0x38; //
-// case '': return -0x37; //
-// case '': return -0x36; //
-// case '': return -0x35; //
-// case '': return -0x34; //
-// case '': return -0x33; //
-// case '': return -0x32; //
-// case '': return -0x31; //
-
-// case '': return -0x30; //
-// case '': return -0x2F; //
- case '\u00ca': return -0x2E; //
- case '\u00cb': return -0x2D; //
- case '\u00c8': return -0x2C; //
- case '\u20ac': return -0x2B; // Euro Sign
- case '\u00cd': return -0x2A; // I acute
- case '\u00ce': return -0x29; //
- case '\u00cf': return -0x28; //
-// case '': return -0x27; //
-// case '': return -0x26; //
-// case '': return -0x25; //
-// case '': return -0x24; //
- case '|': return -0x23; //
- case '\u00cc': return -0x22; //
-// case '': return -0x21; //
-
- case '\u00d3': return -0x20; // O acute
-// case '': return -0x1F; //
- case '\u00d4': return -0x1E; //
- case '\u00d2': return -0x1D; //
-// case '': return -0x1C; //
-// case '': return -0x1B; //
-// case '': return -0x1A; //
-// case '': return -0x19; //
-// case '': return -0x18; //
- case '\u00da': return -0x17; // U acute
- case '\u00db': return -0x16; //
- case '\u00d9': return -0x15; //
- case '\u00fd': return -0x14; //
- case '\u00dd': return -0x13; //
-// case '': return -0x12; //
- case '\u00b4': return -0x11; //
-
-// case '': return -0x10; //
-// case '': return -0x0F; //
-// case '': return -0x0E; //
-// case '': return -0x0D; //
-// case '': return -0x0C; //
-// case '': return -0x0B; //
-// case '': return -0x0A; //
-// case '': return -0x09; //
-// case '': return -0x08; //
- case '\u00a8': return -0x07; //
-// case '': return -0x06; //
-// case '': return -0x05; //
-// case '': return -0x04; //
-// case '': return -0x03; //
-// case '': return -0x02; //
- // case ' ': return -0x01; // SP
-
- default: return 0x3F; // ? Not valid character.
-
-// Old translation
-// case '\u00aa' : return (byte) 0xA6;
-// case '\u00ba' : return (byte) 0xA7;
-// case '\u00a1' : return (byte) 0xAD;
-// case '\u00bf' : return (byte) 0xA8;
-// case '\u00b7' : return (byte) 0xF9;
-// case '\u00f1' : return (byte) 0xA4;
-// case '\u00d1' : return (byte) 0xA5;
-// case '\u00e1' : return (byte) 0xA0;
-// case '\u00c1' : return (byte) 0x86;
-// case '\u00e9' : return (byte) 0x82;
-// case '\u00c9' : return (byte) 0x90;
-// case '\u00ed' : return (byte) 0xA1;
-// case '\u00cd' : return (byte) 0x8B;
-// case '\u00f3' : return (byte) 0xA2;
-// case '\u00d3' : return (byte) 0x9F;
-// case '\u00fa' : return (byte) 0xA3;
-// case '\u00da' : return (byte) 0x96;
-// case '\u00fc' : return (byte) 0x81;
-// case '\u00dc' : return (byte) 0x9A;
-// default: return (byte) sChar;
- }
- }
- }
+ public byte transChar(char sChar) {
+ if ((sChar >= 0x0000) && (sChar < 0x0080)) {
+ return (byte) sChar;
+ } else if (sChar >= '\u0600' && sChar <= '\u06FF') { // Arabic Unicode Block
+ return Charset.forName("Cp1256").encode(CharBuffer.wrap(new char[] { sChar })).get(0);
+ } else {
+ switch (sChar) {
+ // ----- Vietnamise Codes -----//
+ // ----- Lowercase: CodeTable 30 ----- //
+ case '\u0103':
+ return (byte) -0x58; // Character: ă
+ case '\u01a1':
+ return (byte) -0x54; // Character: ơ
+ case '\u01b0':
+ return (byte) -0x53; // Character: ư
+ case '\u0111':
+ return (byte) -0x52; // Character: đ
+ case '\u1ea3':
+ return (byte) -0x4A; // Character: ả
+ case '\u00e3':
+ return (byte) -0x49; // Character: ã
+ case '\u1ea1':
+ return (byte) -0x47; // Character: ạ
+ case '\u1eb1':
+ return (byte) -0x45; // Character: ằ
+ case '\u1eb3':
+ return (byte) -0x44; // Character: ẳ
+ case '\u1eb5':
+ return (byte) -0x43; // Character: ẵ
+ case '\u1eaf':
+ return (byte) -0x42; // Character: ắ
+ case '\u1eb7':
+ return (byte) -0x3A; // Character: ặ
+ case '\u1ea7':
+ return (byte) -0x39; // Character: ầ
+ case '\u1ea9':
+ return (byte) -0x38; // Character: ẩ
+ case '\u1eab':
+ return (byte) -0x37; // Character: ẫ
+ case '\u1ea5':
+ return (byte) -0x36; // Character: ấ
+ case '\u1ead':
+ return (byte) -0x35; // Character: ậ
+ case '\u1ebb':
+ return (byte) -0x32; // Character: ẻ
+ case '\u1ebd':
+ return (byte) -0x31; // Character: ẽ
+ case '\u1eb9':
+ return (byte) -0x2F; // Character: ẹ
+ case '\u1ec1':
+ return (byte) -0x2E; // Character: ề
+ case '\u1ec3':
+ return (byte) -0x2D; // Character: ể
+ case '\u1ec5':
+ return (byte) -0x2C; // Character: ễ
+ case '\u1ebf':
+ return (byte) -0x2B; // Character: ế
+ case '\u1ec7':
+ return (byte) -0x2A; // Character: ệ
+ case '\u1ec9':
+ return (byte) -0x28; // Character: ỉ
+ case '\u0129':
+ return (byte) -0x24; // Character: ĩ
+ case '\u1ecb':
+ return (byte) -0x22; // Character: ị
+ case '\u1ecf':
+ return (byte) -0x1F; // Character: ỏ
+ case '\u00f5':
+ return (byte) -0x1E; // Character: õ
+ case '\u1ecd':
+ return (byte) -0x1C; // Character: ọ
+ case '\u1ed3':
+ return (byte) -0x1B; // Character: ồ
+ case '\u1ed5':
+ return (byte) -0x1A; // Character: ổ
+ case '\u1ed7':
+ return (byte) -0x19; // Character: ỗ
+ case '\u1ed1':
+ return (byte) -0x18; // Character: ố
+ case '\u1ed9':
+ return (byte) -0x17; // Character: ộ
+ case '\u1edd':
+ return (byte) -0x16; // Character: ờ
+ case '\u1edf':
+ return (byte) -0x15; // Character: ở
+ case '\u1ee1':
+ return (byte) -0x14; // Character: ỡ
+ case '\u1edb':
+ return (byte) -0x13; // Character: ớ
+ case '\u1ee3':
+ return (byte) -0x12; // Character: ợ
+ case '\u1ee7':
+ return (byte) -0x0F; // Character: ủ
+ case '\u0169':
+ return (byte) -0x0E; // Character: ũ
+ case '\u1ee5':
+ return (byte) -0x0C; // Character: ụ
+ case '\u1eeb':
+ return (byte) -0x0B; // Character: ừ
+ case '\u1eed':
+ return (byte) -0x0A; // Character: ử
+ case '\u1eef':
+ return (byte) -0x09; // Character: ữ
+ case '\u1ee9':
+ return (byte) -0x08; // Character: ứ
+ case '\u1ef1':
+ return (byte) -0x07; // Character: ự
+ case '\u1ef3':
+ return (byte) -0x06; // Character: ỳ
+ case '\u1ef7':
+ return (byte) -0x05; // Character: ỷ
+ case '\u1ef9':
+ return (byte) -0x04; // Character: ỹ
+ case '\u1ef5':
+ return (byte) -0x02; // Character: ỵ
+
+ // ----- Uppercase: CodeTable 31 ----- //
+ case '\u0102':
+ return (byte) -0x5F; // Character: Ă
+ case '\u0110':
+ return (byte) -0x59; // Character: Đ
+ case '\u01a0':
+ return (byte) -0x54; // Character: Ơ
+ case '\u01af':
+ return (byte) -0x53; // Character: Ư
+ case '\u1ea2':
+ return (byte) -0x4A; // Character: Ả
+ case '\u00c3':
+ return (byte) -0x49; // Character: Ã
+ case '\u1ea0':
+ return (byte) -0x47; // Character: Ạ
+ case '\u1eb0':
+ return (byte) -0x45; // Character: Ằ
+ case '\u1eb2':
+ return (byte) -0x44; // Character: Ằ
+ case '\u1eb4':
+ return (byte) -0x43; // Character: Ẵ
+ case '\u1eae':
+ return (byte) -0x42; // Character: Ắ
+ case '\u1eb6':
+ return (byte) -0x3A; // Character: Ặ
+ case '\u1ea6':
+ return (byte) -0x39; // Character: Ầ
+ case '\u1ea8':
+ return (byte) -0x38; // Character: Ẩ
+ case '\u1eaa':
+ return (byte) -0x37; // Character: Ẫ
+ case '\u1ea4':
+ return (byte) -0x36; // Character: Ấ
+ case '\u1eac':
+ return (byte) -0x35; // Character: Ậ
+ case '\u1eba':
+ return (byte) -0x32; // Character: Ẻ
+ case '\u1ebc':
+ return (byte) -0x31; // Character: Ẽ
+ case '\u1eb8':
+ return (byte) -0x2F; // Character: Ẹ
+ case '\u1ec0':
+ return (byte) -0x2E; // Character: Ề
+ case '\u1ec2':
+ return (byte) -0x2D; // Character: Ể
+ case '\u1ec4':
+ return (byte) -0x2C; // Character: Ễ
+ case '\u1ebe':
+ return (byte) -0x2B; // Character: Ế
+ case '\u1ec6':
+ return (byte) -0x2A; // Character: Ệ
+ case '\u1ec8':
+ return (byte) -0x28; // Character: Ỉ
+ case '\u0128':
+ return (byte) -0x24; // Character: Ĩ
+ case '\u1eca':
+ return (byte) -0x22; // Character: Ị
+ case '\u1ece':
+ return (byte) -0x1F; // Character: Ỏ
+ case '\u00d5':
+ return (byte) -0x1E; // Character: Õ
+ case '\u1ecc':
+ return (byte) -0x1C; // Character: Ọ
+ case '\u1ed2':
+ return (byte) -0x1B; // Character: Ồ
+ case '\u1ed4':
+ return (byte) -0x1A; // Character: Ổ
+ case '\u1ed6':
+ return (byte) -0x19; // Character: Ỗ
+ case '\u1ed0':
+ return (byte) -0x18; // Character: Ố
+ case '\u1ed8':
+ return (byte) -0x17; // Character: Ộ
+ case '\u1edc':
+ return (byte) -0x16; // Character: Ờ
+ case '\u1ede':
+ return (byte) -0x15; // Character: Ở
+ case '\u1ee0':
+ return (byte) -0x14; // Character: Ỡ
+ case '\u1eda':
+ return (byte) -0x13; // Character: Ớ
+ case '\u1ee2':
+ return (byte) -0x12; // Character: Ợ
+ case '\u1ee6':
+ return (byte) -0x0F; // Character: Ủ
+ case '\u0168':
+ return (byte) -0x0E; // Character: Ũ
+ case '\u1ee4':
+ return (byte) -0x0C; // Character: Ụ
+ case '\u1eea':
+ return (byte) -0x0B; // Character: Ừ
+ case '\u1eec':
+ return (byte) -0x0A; // Character: Ử
+ case '\u1eee':
+ return (byte) -0x09; // Character: Ữ
+ case '\u1ee8':
+ return (byte) -0x08; // Character: Ứ
+ case '\u1ef0':
+ return (byte) -0x07; // Character: Ự
+ case '\u1ef2':
+ return (byte) -0x06; // Character: Ỳ
+ case '\u1ef6':
+ return (byte) -0x05; // Character: Ỷ
+ case '\u1ef8':
+ return (byte) -0x04; // Character: Ỹ
+ case '\u1ef4':
+ return (byte) -0x02; // Character: Ỵ
+ // ----- END Vietnamese Characters -----//
+ case '\u00c7':
+ return -0x80;
+ case '\u00fc':
+ return -0x7F; // u dieresis
+ case '\u00e2':
+ return -0x7D;
+ case '\u00e4':
+ return -0x7C;
+ case '\u00e0':
+ return -0x7B;
+ case '\u00E5':
+ return -0x7A; // ao
+ case '\u00e7':
+ return -0x79;
+ case '\u00ea':
+ return -0x78;
+ case '\u00eb':
+ return -0x77;
+ case '\u00e8':
+ return -0x76;
+ case '\u00ef':
+ return -0x75;
+ case '\u00ee':
+ return -0x74;
+ case '\u00ec':
+ return -0x73;
+ case '\u00c4':
+ return -0x72;
+ case '\u00C5':
+ return -0x71; // Ao
+
+ case '\u00c9':
+ return -0x70; // E acute
+ case '\u00E6':
+ return -0x6F; // ae
+ case '\u00C6':
+ return -0x6E; // AE
+ case '\u00f4':
+ return -0x6D;
+ case '\u00f6':
+ return -0x6C;
+ case '\u00f2':
+ return -0x6B;
+ case '\u00fb':
+ return -0x6A;
+ case '\u00f9':
+ return -0x69;
+ case '\u00ff':
+ return -0x68;
+ case '\u00d6':
+ return -0x67;
+ case '\u00dc':
+ return -0x66; // U dieresis
+ case '\u00F8':
+ return -0x65; // o/
+ case '\u00A3':
+ return -0x64; // L- Libra esterlina
+ case '\u00D8':
+ return -0x63; // O/
+ case '\u00D7':
+ return -0x62; // X
+ // case '': return -0x61; // f
+
+ case '\u00e1':
+ return -0x60; // a acute
+ case '\u00e9':
+ return -0x7E; // e acute
+ case '\u00ed':
+ return -0x5F; // i acute
+ case '\u00f3':
+ return -0x5E; // o acute
+ case '\u00fa':
+ return -0x5D; // u acute
+ case '\u00f1':
+ return -0x5C; // n tilde
+ case '\u00d1':
+ return -0x5B; // N tilde
+ case '\u00aa':
+ return -0x5A;
+ case '\u00ba':
+ return -0x59;
+ case '\u00bf':
+ return -0x58; // abrir interrogacion
+ case '\u00AE':
+ return -0x57; // (R) Registrado
+ case '\u00ac':
+ return -0x56; // Not sign
+ case '\u00BD':
+ return -0x55; // 1/2
+ case '\u00BC':
+ return -0x54; // 1/4
+ case '\u00a1':
+ return -0x53; // abrir admiracion
+ case '\u00AB':
+ return -0x52; // <<
+ case '\u00BB':
+ return -0x51; // >>
+
+ case '\u2591':
+ return -0x50; // Light shade
+ case '\u2592':
+ return -0x4F; // Medium shade
+ case '\u2593':
+ return -0x4E; // Dark shade
+ case '\u2502':
+ return -0x4D; // BOX DRAWINGS LIGHT VERTICAL
+ case '\u2524':
+ return -0x4C; // BOX DRAWINGS LIGHT VERTICAL AND LEFT
+ case '\u00c1':
+ return -0x4B; // A acute
+ case '\u00c2':
+ return -0x4A;
+ case '\u00c0':
+ return -0x49;
+ case '\u00A9':
+ return -0x48; // (c) Copyright
+ case '\u2563':
+ return -0x47; // BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+ case '\u2551':
+ return -0x46; // BOX DRAWINGS DOUBLE VERTICAL
+ case '\u2557':
+ return -0x45; // BOX DRAWINGS DOUBLE DOWN AND LEFT
+ case '\u255D':
+ return -0x44; // BOX DRAWINGS DOUBLE UP AND LEFT
+ case '\u00A2':
+ return -0x43; // Cent Sign
+ case '\u00A5':
+ return -0x42; // Yen Sign
+ case '\u2510':
+ return -0x41; // BOX DRAWINGS LIGHT DOWN AND LEFT
+
+ case '\u2514':
+ return -0x40; // BOX DRAWINGS LIGHT UP ANDRIGHT
+ // case '': return -0x3F; //
+ // case '': return -0x3E; //
+ // case '': return -0x3D; //
+ // case '': return -0x3C; //
+ // case '': return -0x3B; //
+ // case '': return -0x3A; //
+ // case '': return -0x39; //
+ // case '': return -0x38; //
+ // case '': return -0x37; //
+ // case '': return -0x36; //
+ // case '': return -0x35; //
+ // case '': return -0x34; //
+ // case '': return -0x33; //
+ // case '': return -0x32; //
+ // case '': return -0x31; //
+
+ // case '': return -0x30; //
+ // case '': return -0x2F; //
+ case '\u00ca':
+ return -0x2E; //
+ case '\u00cb':
+ return -0x2D; //
+ case '\u00c8':
+ return -0x2C; //
+ case '\u20ac':
+ return -0x2B; // Euro Sign
+ case '\u00cd':
+ return -0x2A; // I acute
+ case '\u00ce':
+ return -0x29; //
+ case '\u00cf':
+ return -0x28; //
+ // case '': return -0x27; //
+ // case '': return -0x26; //
+ // case '': return -0x25; //
+ // case '': return -0x24; //
+ case '|':
+ return -0x23; //
+ case '\u00cc':
+ return -0x22; //
+ // case '': return -0x21; //
+
+ case '\u00d3':
+ return -0x20; // O acute
+ // case '': return -0x1F; //
+ case '\u00d4':
+ return -0x1E; //
+ case '\u00d2':
+ return -0x1D; //
+ // case '': return -0x1C; //
+ // case '': return -0x1B; //
+ // case '': return -0x1A; //
+ // case '': return -0x19; //
+ // case '': return -0x18; //
+ case '\u00da':
+ return -0x17; // U acute
+ case '\u00db':
+ return -0x16; //
+ case '\u00d9':
+ return -0x15; //
+ case '\u00fd':
+ return -0x14; //
+ case '\u00dd':
+ return -0x13; //
+ // case '': return -0x12; //
+ case '\u00b4':
+ return -0x11; //
+
+ // case '': return -0x10; //
+ // case '': return -0x0F; //
+ // case '': return -0x0E; //
+ // case '': return -0x0D; //
+ // case '': return -0x0C; //
+ // case '': return -0x0B; //
+ // case '': return -0x0A; //
+ // case '': return -0x09; //
+ // case '': return -0x08; //
+ case '\u00a8':
+ return -0x07; //
+ // case '': return -0x06; //
+ // case '': return -0x05; //
+ // case '': return -0x04; //
+ // case '': return -0x03; //
+ // case '': return -0x02; //
+ // case ' ': return -0x01; // SP
+
+ default:
+ return 0x3F; // ? Not valid character.
+
+ // Old translation
+ // case '\u00aa' : return (byte) 0xA6;
+ // case '\u00ba' : return (byte) 0xA7;
+ // case '\u00a1' : return (byte) 0xAD;
+ // case '\u00bf' : return (byte) 0xA8;
+ // case '\u00b7' : return (byte) 0xF9;
+ // case '\u00f1' : return (byte) 0xA4;
+ // case '\u00d1' : return (byte) 0xA5;
+ // case '\u00e1' : return (byte) 0xA0;
+ // case '\u00c1' : return (byte) 0x86;
+ // case '\u00e9' : return (byte) 0x82;
+ // case '\u00c9' : return (byte) 0x90;
+ // case '\u00ed' : return (byte) 0xA1;
+ // case '\u00cd' : return (byte) 0x8B;
+ // case '\u00f3' : return (byte) 0xA2;
+ // case '\u00d3' : return (byte) 0x9F;
+ // case '\u00fa' : return (byte) 0xA3;
+ // case '\u00da' : return (byte) 0x96;
+ // case '\u00fc' : return (byte) 0x81;
+ // case '\u00dc' : return (byte) 0x9A;
+ // default: return (byte) sChar;
+ }
+ }
+ }
}
diff --git a/project/src/com/openbravo/pos/printer/escpos/UnicodeTranslatorIntWincor.java b/project/src/com/openbravo/pos/printer/escpos/UnicodeTranslatorIntWincor.java
--- a/project/src/com/openbravo/pos/printer/escpos/UnicodeTranslatorIntWincor.java
+++ b/project/src/com/openbravo/pos/printer/escpos/UnicodeTranslatorIntWincor.java
@@ -1,6 +1,6 @@
/*
************************************************************************************
- * Copyright (C) 2016 Openbravo S.L.U.
+ * Copyright (C) 2016-2019 Openbravo S.L.U.
* Licensed under the Openbravo Commercial License version 1.0
* You may obtain a copy of the License at http://www.openbravo.com/legal/obcl.html
* or in the legal folder of this module distribution.
@@ -12,6 +12,11 @@
public class UnicodeTranslatorIntWincor extends UnicodeTranslatorInt {
public UnicodeTranslatorIntWincor() {
+ super();
+ }
+
+ public UnicodeTranslatorIntWincor(String blockFile) {
+ super(blockFile);
}
public byte[] getCodeTable() {
diff --git a/project/src/com/openbravo/pos/printer/escpos/UnicodeTranslatorStar.java b/project/src/com/openbravo/pos/printer/escpos/UnicodeTranslatorStar.java
--- a/project/src/com/openbravo/pos/printer/escpos/UnicodeTranslatorStar.java
+++ b/project/src/com/openbravo/pos/printer/escpos/UnicodeTranslatorStar.java
@@ -1,6 +1,6 @@
/*
************************************************************************************
- * Copyright (C) 2012 Openbravo S.L.U.
+ * Copyright (C) 2012-2019 Openbravo S.L.U.
* Licensed under the Openbravo Commercial License version 1.0
* You may obtain a copy of the License at http://www.openbravo.com/legal/obcl.html
* or in the legal folder of this module distribution.
@@ -11,157 +11,189 @@
public class UnicodeTranslatorStar extends UnicodeTranslator {
- /** Creates a UnicodeTranslatorStar instance of UnicodeTranslatorInt */
- public UnicodeTranslatorStar() {
- }
+ /** Creates a UnicodeTranslatorStar instance of UnicodeTranslatorInt */
+ public UnicodeTranslatorStar() {
+ super();
+ }
- public byte[] getCodeTable() {
- return new byte[] {0x1B, 0x1D, 0x74, 0x01}; // Select code page 437
- }
+ public UnicodeTranslatorStar(String blockFile) {
+ super(blockFile);
+ }
+
+ public byte[] getCodeTable() {
+ return new byte[] { 0x1B, 0x1D, 0x74, 0x01 }; // Select code page 437
+ }
- public byte transChar(char sChar) {
- if ((sChar >= 0x0000) && (sChar < 0x0080)) {
- return (byte) sChar;
- } else {
- switch (sChar) {
- case '\u00c1': return 0x41; // A acute
- case '\u00c9': return 0x45; // E acute
- case '\u00cd': return 0x49; // I acute
- case '\u00d3': return 0x4F; // O acute
- case '\u00da': return 0x55; // U acute
-
+ public byte transChar(char sChar) {
+ if ((sChar >= 0x0000) && (sChar < 0x0080)) {
+ return (byte) sChar;
+ } else {
+ switch (sChar) {
+ case '\u00c1':
+ return 0x41; // A acute
+ case '\u00c9':
+ return 0x45; // E acute
+ case '\u00cd':
+ return 0x49; // I acute
+ case '\u00d3':
+ return 0x4F; // O acute
+ case '\u00da':
+ return 0x55; // U acute
- case '\u00C7': return -0x80; // 0x80 : C cedilla
- case '\u00FC': return -0x7F; // 0x81 : u dieresis
- case '\u00E9': return -0x7E; // 0x82 : e acute
-// case '\u0000': return -0x7D; // 0x83 :
- case '\u00E4': return -0x7C; // 0x84 : a dieresis
-// case '\u0000': return -0x7B; // 0x85 :
- case '\u00E5': return -0x7A; // 0x86 : a circle
- case '\u00E7': return -0x79; // 0x87 : c cedilla
-// case '\u0000': return -0x78; // 0x88 :
-// case '\u0000': return -0x77; // 0x89 :
-// case '\u0000': return -0x76; // 0x8A :
-// case '\u0000': return -0x75; // 0x8B :
-// case '\u0000': return -0x74; // 0x8C :dieresis
-// case '\u0000': return -0x73; // 0x8D :
- case '\u00C4': return -0x72; // 0x8E : A dieresis
- case '\u00C5': return -0x71; // 0x8F : A circle
-// case '\u0000': return -0x70; // 0x90 :
-// case '\u0000': return -0x6F; // 0x91 :
-// case '\u0000': return -0x6E; // 0x92 :
-// case '\u0000': return -0x6D; // 0x93 :
- case '\u00F6': return -0x6C; // 0x94 : o dieresis
-// case '\u0000': return -0x6B; // 0x95 :
-// case '\u0000': return -0x6A; // 0x96 :
-// case '\u0000': return -0x69; // 0x97 :
-// case '\u0000': return -0x68; // 0x98 :
- case '\u00D6': return -0x67; // 0x99 : O dieresis
- case '\u00DC': return -0x66; // 0x9A : U dieresesis
-// case '\u0000': return -0x65; // 0x9B :
- case '\u00A3': return -0x64; // 0x9C : Pound currency
- case '\u00A5': return -0x63; // 0x9D : Yen currency
-// case '\u0000': return -0x62; // 0x9E :
-// case '\u0000': return -0x61; // 0x9F :
- case '\u00E1': return -0x60; // 0xA0 : a acute
- case '\u00ED': return -0x5F; // 0xA1 : i acute
- case '\u00F3': return -0x5E; // 0xA2 : o acute
- case '\u00FA': return -0x5D; // 0xA3 : u acute
- case '\u00F1': return -0x5C; // 0xA4 : n tilde
- case '\u00D1': return -0x5B; // 0xA5 : N tilde
-// case '\u0000': return -0x5A; // 0xA6 :
-// case '\u0000': return -0x59; // 0xA7 :
- case '\u00BF': return -0x58; // 0xA8 : open ?
-// case '\u0000': return -0x57; // 0xA9 :
-// case '\u0000': return -0x56; // 0xAA :
-// case '\u0000': return -0x55; // 0xAB :
-// case '\u0000': return -0x54; // 0xAC :
- case '\u00A1': return -0x53; // 0xAD : open !
-// case '\u0000': return -0x52; // 0xAE :
-// case '\u0000': return -0x51; // 0xAF :
-// case '\u0000': return -0x50; // 0xB0 :
-// case '\u0000': return -0x4F; // 0xB1 :
-// case '\u0000': return -0x4E; // 0xB2 :
-// case '\u0000': return -0x4D; // 0xB3 :
-// case '\u0000': return -0x4C; // 0xB4 :
-// case '\u0000': return -0x4B; // 0xB5 :
-// case '\u0000': return -0x4A; // 0xB6 :
-// case '\u0000': return -0x49; // 0xB7 :
-// case '\u0000': return -0x48; // 0xB8 :
-// case '\u0000': return -0x47; // 0xB9 :
-// case '\u0000': return -0x46; // 0xBA :
-// case '\u0000': return -0x45; // 0xBB :
-// case '\u0000': return -0x44; // 0xBC :
-// case '\u0000': return -0x43; // 0xBD :
-// case '\u0000': return -0x42; // 0xBE :
-// case '\u0000': return -0x41; // 0xBF :
-// case '\u0000': return -0x40; // 0xC0 :
-// case '\u0000': return -0x3F; // 0xC1 :
-// case '\u0000': return -0x3E; // 0xC2 :
-// case '\u0000': return -0x3D; // 0xC3 :
-// case '\u0000': return -0x3C; // 0xC4 :
-// case '\u0000': return -0x3B; // 0xC5 :
-// case '\u0000': return -0x3A; // 0xC6 :
-// case '\u0000': return -0x39; // 0xC7 :
-// case '\u0000': return -0x38; // 0xC8 :
-// case '\u0000': return -0x37; // 0xC9 :
-// case '\u0000': return -0x36; // 0xCA :
-// case '\u0000': return -0x35; // 0xCB :
-// case '\u0000': return -0x34; // 0xCC :
-// case '\u0000': return -0x33; // 0xCD :
-// case '\u0000': return -0x32; // 0xCE :
-// case '\u0000': return -0x31; // 0xCF :
-// case '\u0000': return -0x30; // 0xD0 :
-// case '\u0000': return -0x2F; // 0xD1 :
-// case '\u0000': return -0x2E; // 0xD2 :
-// case '\u0000': return -0x2D; // 0xD3 :
-// case '\u0000': return -0x2C; // 0xD4 :
-// case '\u0000': return -0x2B; // 0xD5 :
-// case '\u0000': return -0x2A; // 0xD6 :
-// case '\u0000': return -0x29; // 0xD7 :
-// case '\u0000': return -0x28; // 0xD8 :
-// case '\u0000': return -0x27; // 0xD9 :
-// case '\u0000': return -0x26; // 0xDA :
-// case '\u0000': return -0x25; // 0xDB :
-// case '\u0000': return -0x24; // 0xDC :
-// case '\u0000': return -0x23; // 0xDD :
-// case '\u0000': return -0x22; // 0xDE :
-// case '\u0000': return -0x21; // 0xDF :
-// case '\u0000': return -0x20; // 0xE0 :
-// case '\u0000': return -0x2F; // 0xE1 :
-// case '\u0000': return -0x1E; // 0xE2 :
-// case '\u0000': return -0x1D; // 0xE3 :
-// case '\u0000': return -0x1C; // 0xE4 :
-// case '\u0000': return -0x1B; // 0xE5 :
-// case '\u0000': return -0x1A; // 0xE6 :
-// case '\u0000': return -0x19; // 0xE7 :
-// case '\u0000': return -0x18; // 0xE8 :
-// case '\u0000': return -0x17; // 0xE9 :
-// case '\u0000': return -0x16; // 0xEA :
-// case '\u0000': return -0x15; // 0xEB :
-// case '\u0000': return -0x14; // 0xEC :
-// case '\u0000': return -0x13; // 0xED :
- case '\u20AC': return -0x12; // 0xEE : euro sign
-// case '\u0000': return -0x11; // 0xEF :
-// case '\u0000': return -0x10; // 0xF0 :
-// case '\u0000': return -0x0F; // 0xF1 :
-// case '\u0000': return -0x0E; // 0xF2 :
-// case '\u0000': return -0x0D; // 0xF3 :
-// case '\u0000': return -0x0C; // 0xF4 :
-// case '\u0000': return -0x0B; // 0xF5 :
-// case '\u0000': return -0x0A; // 0xF6 :
-// case '\u0000': return -0x09; // 0xF7 :
-// case '\u0000': return -0x08; // 0xF8 :
-// case '\u0000': return -0x07; // 0xF9 :
-// case '\u0000': return -0x06; // 0xFA :
-// case '\u0000': return -0x05; // 0xFB :
-// case '\u0000': return -0x04; // 0xFC :
-// case '\u0000': return -0x03; // 0xFD :
-// case '\u0000': return -0x02; // 0xFE :
-// case '\u0000': return -0x01; // 0xFF :
- default: return 0x3F; // ? Not valid character.
+ case '\u00C7':
+ return -0x80; // 0x80 : C cedilla
+ case '\u00FC':
+ return -0x7F; // 0x81 : u dieresis
+ case '\u00E9':
+ return -0x7E; // 0x82 : e acute
+ // case '\u0000': return -0x7D; // 0x83 :
+ case '\u00E4':
+ return -0x7C; // 0x84 : a dieresis
+ // case '\u0000': return -0x7B; // 0x85 :
+ case '\u00E5':
+ return -0x7A; // 0x86 : a circle
+ case '\u00E7':
+ return -0x79; // 0x87 : c cedilla
+ // case '\u0000': return -0x78; // 0x88 :
+ // case '\u0000': return -0x77; // 0x89 :
+ // case '\u0000': return -0x76; // 0x8A :
+ // case '\u0000': return -0x75; // 0x8B :
+ // case '\u0000': return -0x74; // 0x8C :dieresis
+ // case '\u0000': return -0x73; // 0x8D :
+ case '\u00C4':
+ return -0x72; // 0x8E : A dieresis
+ case '\u00C5':
+ return -0x71; // 0x8F : A circle
+ // case '\u0000': return -0x70; // 0x90 :
+ // case '\u0000': return -0x6F; // 0x91 :
+ // case '\u0000': return -0x6E; // 0x92 :
+ // case '\u0000': return -0x6D; // 0x93 :
+ case '\u00F6':
+ return -0x6C; // 0x94 : o dieresis
+ // case '\u0000': return -0x6B; // 0x95 :
+ // case '\u0000': return -0x6A; // 0x96 :
+ // case '\u0000': return -0x69; // 0x97 :
+ // case '\u0000': return -0x68; // 0x98 :
+ case '\u00D6':
+ return -0x67; // 0x99 : O dieresis
+ case '\u00DC':
+ return -0x66; // 0x9A : U dieresesis
+ // case '\u0000': return -0x65; // 0x9B :
+ case '\u00A3':
+ return -0x64; // 0x9C : Pound currency
+ case '\u00A5':
+ return -0x63; // 0x9D : Yen currency
+ // case '\u0000': return -0x62; // 0x9E :
+ // case '\u0000': return -0x61; // 0x9F :
+ case '\u00E1':
+ return -0x60; // 0xA0 : a acute
+ case '\u00ED':
+ return -0x5F; // 0xA1 : i acute
+ case '\u00F3':
+ return -0x5E; // 0xA2 : o acute
+ case '\u00FA':
+ return -0x5D; // 0xA3 : u acute
+ case '\u00F1':
+ return -0x5C; // 0xA4 : n tilde
+ case '\u00D1':
+ return -0x5B; // 0xA5 : N tilde
+ // case '\u0000': return -0x5A; // 0xA6 :
+ // case '\u0000': return -0x59; // 0xA7 :
+ case '\u00BF':
+ return -0x58; // 0xA8 : open ?
+ // case '\u0000': return -0x57; // 0xA9 :
+ // case '\u0000': return -0x56; // 0xAA :
+ // case '\u0000': return -0x55; // 0xAB :
+ // case '\u0000': return -0x54; // 0xAC :
+ case '\u00A1':
+ return -0x53; // 0xAD : open !
+ // case '\u0000': return -0x52; // 0xAE :
+ // case '\u0000': return -0x51; // 0xAF :
+ // case '\u0000': return -0x50; // 0xB0 :
+ // case '\u0000': return -0x4F; // 0xB1 :
+ // case '\u0000': return -0x4E; // 0xB2 :
+ // case '\u0000': return -0x4D; // 0xB3 :
+ // case '\u0000': return -0x4C; // 0xB4 :
+ // case '\u0000': return -0x4B; // 0xB5 :
+ // case '\u0000': return -0x4A; // 0xB6 :
+ // case '\u0000': return -0x49; // 0xB7 :
+ // case '\u0000': return -0x48; // 0xB8 :
+ // case '\u0000': return -0x47; // 0xB9 :
+ // case '\u0000': return -0x46; // 0xBA :
+ // case '\u0000': return -0x45; // 0xBB :
+ // case '\u0000': return -0x44; // 0xBC :
+ // case '\u0000': return -0x43; // 0xBD :
+ // case '\u0000': return -0x42; // 0xBE :
+ // case '\u0000': return -0x41; // 0xBF :
+ // case '\u0000': return -0x40; // 0xC0 :
+ // case '\u0000': return -0x3F; // 0xC1 :
+ // case '\u0000': return -0x3E; // 0xC2 :
+ // case '\u0000': return -0x3D; // 0xC3 :
+ // case '\u0000': return -0x3C; // 0xC4 :
+ // case '\u0000': return -0x3B; // 0xC5 :
+ // case '\u0000': return -0x3A; // 0xC6 :
+ // case '\u0000': return -0x39; // 0xC7 :
+ // case '\u0000': return -0x38; // 0xC8 :
+ // case '\u0000': return -0x37; // 0xC9 :
+ // case '\u0000': return -0x36; // 0xCA :
+ // case '\u0000': return -0x35; // 0xCB :
+ // case '\u0000': return -0x34; // 0xCC :
+ // case '\u0000': return -0x33; // 0xCD :
+ // case '\u0000': return -0x32; // 0xCE :
+ // case '\u0000': return -0x31; // 0xCF :
+ // case '\u0000': return -0x30; // 0xD0 :
+ // case '\u0000': return -0x2F; // 0xD1 :
+ // case '\u0000': return -0x2E; // 0xD2 :
+ // case '\u0000': return -0x2D; // 0xD3 :
+ // case '\u0000': return -0x2C; // 0xD4 :
+ // case '\u0000': return -0x2B; // 0xD5 :
+ // case '\u0000': return -0x2A; // 0xD6 :
+ // case '\u0000': return -0x29; // 0xD7 :
+ // case '\u0000': return -0x28; // 0xD8 :
+ // case '\u0000': return -0x27; // 0xD9 :
+ // case '\u0000': return -0x26; // 0xDA :
+ // case '\u0000': return -0x25; // 0xDB :
+ // case '\u0000': return -0x24; // 0xDC :
+ // case '\u0000': return -0x23; // 0xDD :
+ // case '\u0000': return -0x22; // 0xDE :
+ // case '\u0000': return -0x21; // 0xDF :
+ // case '\u0000': return -0x20; // 0xE0 :
+ // case '\u0000': return -0x2F; // 0xE1 :
+ // case '\u0000': return -0x1E; // 0xE2 :
+ // case '\u0000': return -0x1D; // 0xE3 :
+ // case '\u0000': return -0x1C; // 0xE4 :
+ // case '\u0000': return -0x1B; // 0xE5 :
+ // case '\u0000': return -0x1A; // 0xE6 :
+ // case '\u0000': return -0x19; // 0xE7 :
+ // case '\u0000': return -0x18; // 0xE8 :
+ // case '\u0000': return -0x17; // 0xE9 :
+ // case '\u0000': return -0x16; // 0xEA :
+ // case '\u0000': return -0x15; // 0xEB :
+ // case '\u0000': return -0x14; // 0xEC :
+ // case '\u0000': return -0x13; // 0xED :
+ case '\u20AC':
+ return -0x12; // 0xEE : euro sign
+ // case '\u0000': return -0x11; // 0xEF :
+ // case '\u0000': return -0x10; // 0xF0 :
+ // case '\u0000': return -0x0F; // 0xF1 :
+ // case '\u0000': return -0x0E; // 0xF2 :
+ // case '\u0000': return -0x0D; // 0xF3 :
+ // case '\u0000': return -0x0C; // 0xF4 :
+ // case '\u0000': return -0x0B; // 0xF5 :
+ // case '\u0000': return -0x0A; // 0xF6 :
+ // case '\u0000': return -0x09; // 0xF7 :
+ // case '\u0000': return -0x08; // 0xF8 :
+ // case '\u0000': return -0x07; // 0xF9 :
+ // case '\u0000': return -0x06; // 0xFA :
+ // case '\u0000': return -0x05; // 0xFB :
+ // case '\u0000': return -0x04; // 0xFC :
+ // case '\u0000': return -0x03; // 0xFD :
+ // case '\u0000': return -0x02; // 0xFE :
+ // case '\u0000': return -0x01; // 0xFF :
+ default:
+ return 0x3F; // ? Not valid character.
- }
- }
+ }
}
+ }
}
diff --git a/project/src/com/openbravo/pos/printer/escpos/UnicodeTranslatorSurePOS.java b/project/src/com/openbravo/pos/printer/escpos/UnicodeTranslatorSurePOS.java
--- a/project/src/com/openbravo/pos/printer/escpos/UnicodeTranslatorSurePOS.java
+++ b/project/src/com/openbravo/pos/printer/escpos/UnicodeTranslatorSurePOS.java
@@ -1,6 +1,6 @@
/*
************************************************************************************
- * Copyright (C) 2012 Openbravo S.L.U.
+ * Copyright (C) 2012-2019 Openbravo S.L.U.
* Licensed under the Openbravo Commercial License version 1.0
* You may obtain a copy of the License at http://www.openbravo.com/legal/obcl.html
* or in the legal folder of this module distribution.
@@ -10,180 +10,269 @@
package com.openbravo.pos.printer.escpos;
public class UnicodeTranslatorSurePOS extends UnicodeTranslator {
-
- /** Creates a new instance of UnicodeTranslatorInt */
- public UnicodeTranslatorSurePOS() {
- }
-
- public byte[] getCodeTable() {
- return new byte[] {0x02}; // Multilingual International 858
+
+ /** Creates a new instance of UnicodeTranslatorInt */
+ public UnicodeTranslatorSurePOS() {
+ super();
+ }
+
+ public UnicodeTranslatorSurePOS(String blockFile) {
+ super(blockFile);
+ }
+
+ public byte[] getCodeTable() {
+ return new byte[] { 0x02 }; // Multilingual International 858
+ }
+
+ public byte transChar(char sChar) {
+ if ((sChar >= 0x0000) && (sChar < 0x0080)) {
+ return (byte) sChar;
+ } else {
+ switch (sChar) {
+ case '\u00c7':
+ return -0x80;
+ case '\u00fc':
+ return -0x7F; // u dieresis
+ case '\u00e2':
+ return -0x7D;
+ case '\u00e4':
+ return -0x7C;
+ case '\u00e0':
+ return -0x7B;
+ case '\u00E5':
+ return -0x7A; // ao
+ case '\u00e7':
+ return -0x79;
+ case '\u00ea':
+ return -0x78;
+ case '\u00eb':
+ return -0x77;
+ case '\u00e8':
+ return -0x76;
+ case '\u00ef':
+ return -0x75;
+ case '\u00ee':
+ return -0x74;
+ case '\u00ec':
+ return -0x73;
+ case '\u00c4':
+ return -0x72;
+ case '\u00C5':
+ return -0x71; // Ao
+
+ case '\u00c9':
+ return -0x70; // E acute
+ case '\u00E6':
+ return -0x6F; // ae
+ case '\u00C6':
+ return -0x6E; // AE
+ case '\u00f4':
+ return -0x6D;
+ case '\u00f6':
+ return -0x6C;
+ case '\u00f2':
+ return -0x6B;
+ case '\u00fb':
+ return -0x6A;
+ case '\u00f9':
+ return -0x69;
+ case '\u00ff':
+ return -0x68;
+ case '\u00d6':
+ return -0x67;
+ case '\u00dc':
+ return -0x66; // U dieresis
+ case '\u00F8':
+ return -0x65; // o/
+ case '\u00A3':
+ return -0x64; // L- Libra esterlina
+ case '\u00D8':
+ return -0x63; // O/
+ case '\u00D7':
+ return -0x62; // X
+ // case '': return -0x61; // f
+
+ case '\u00e1':
+ return -0x60; // a acute
+ case '\u00e9':
+ return -0x7E; // e acute
+ case '\u00ed':
+ return -0x5F; // i acute
+ case '\u00f3':
+ return -0x5E; // o acute
+ case '\u00fa':
+ return -0x5D; // u acute
+ case '\u00f1':
+ return -0x5C; // n tilde
+ case '\u00d1':
+ return -0x5B; // N tilde
+ case '\u00aa':
+ return -0x5A;
+ case '\u00ba':
+ return -0x59;
+ case '\u00bf':
+ return -0x58; // abrir interrogacion
+ case '\u00AE':
+ return -0x57; // (R) Registrado
+ case '\u00ac':
+ return -0x56; // Not sign
+ case '\u00BD':
+ return -0x55; // 1/2
+ case '\u00BC':
+ return -0x54; // 1/4
+ case '\u00a1':
+ return -0x53; // abrir admiracion
+ case '\u00AB':
+ return -0x52; // <<
+ case '\u00BB':
+ return -0x51; // >>
+
+ case '\u2591':
+ return -0x50; // Light shade
+ case '\u2592':
+ return -0x4F; // Medium shade
+ case '\u2593':
+ return -0x4E; // Dark shade
+ case '\u2502':
+ return -0x4D; // BOX DRAWINGS LIGHT VERTICAL
+ case '\u2524':
+ return -0x4C; // BOX DRAWINGS LIGHT VERTICAL AND LEFT
+ case '\u00c1':
+ return -0x4B; // A acute
+ case '\u00c2':
+ return -0x4A;
+ case '\u00c0':
+ return -0x49;
+ case '\u00A9':
+ return -0x48; // (c) Copyright
+ case '\u2563':
+ return -0x47; // BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+ case '\u2551':
+ return -0x46; // BOX DRAWINGS DOUBLE VERTICAL
+ case '\u2557':
+ return -0x45; // BOX DRAWINGS DOUBLE DOWN AND LEFT
+ case '\u255D':
+ return -0x44; // BOX DRAWINGS DOUBLE UP AND LEFT
+ case '\u00A2':
+ return -0x43; // Cent Sign
+ case '\u00A5':
+ return -0x42; // Yen Sign
+ case '\u2510':
+ return -0x41; // BOX DRAWINGS LIGHT DOWN AND LEFT
+
+ case '\u2514':
+ return -0x40; // BOX DRAWINGS LIGHT UP ANDRIGHT
+ // case '': return -0x3F; //
+ // case '': return -0x3E; //
+ // case '': return -0x3D; //
+ // case '': return -0x3C; //
+ // case '': return -0x3B; //
+ // case '': return -0x3A; //
+ // case '': return -0x39; //
+ // case '': return -0x38; //
+ // case '': return -0x37; //
+ // case '': return -0x36; //
+ // case '': return -0x35; //
+ // case '': return -0x34; //
+ // case '': return -0x33; //
+ // case '': return -0x32; //
+ // case '': return -0x31; //
+
+ // case '': return -0x30; //
+ // case '': return -0x2F; //
+ case '\u00ca':
+ return -0x2E; //
+ case '\u00cb':
+ return -0x2D; //
+ case '\u00c8':
+ return -0x2C; //
+ case '\u20ac':
+ return (byte) 0xD5; // Euro Sign
+ case '\u00cd':
+ return -0x2A; // I acute
+ case '\u00ce':
+ return -0x29; //
+ case '\u00cf':
+ return -0x28; //
+ // case '': return -0x27; //
+ // case '': return -0x26; //
+ // case '': return -0x25; //
+ // case '': return -0x24; //
+ case '|':
+ return -0x23; //
+ case '\u00cc':
+ return -0x22; //
+ // case '': return -0x21; //
+
+ case '\u00d3':
+ return -0x20; // O acute
+ // case '': return -0x1F; //
+ case '\u00d4':
+ return -0x1E; //
+ case '\u00d2':
+ return -0x1D; //
+ // case '': return -0x1C; //
+ // case '': return -0x1B; //
+ // case '': return -0x1A; //
+ // case '': return -0x19; //
+ // case '': return -0x18; //
+ case '\u00da':
+ return -0x17; // U acute
+ case '\u00db':
+ return -0x16; //
+ case '\u00d9':
+ return -0x15; //
+ case '\u00fd':
+ return -0x14; //
+ case '\u00dd':
+ return -0x13; //
+ // case '': return -0x12; //
+ case '\u00b4':
+ return -0x11; //
+
+ // case '': return -0x10; //
+ // case '': return -0x0F; //
+ // case '': return -0x0E; //
+ // case '': return -0x0D; //
+ // case '': return -0x0C; //
+ // case '': return -0x0B; //
+ // case '': return -0x0A; //
+ // case '': return -0x09; //
+ // case '': return -0x08; //
+ case '\u00a8':
+ return -0x07; //
+ // case '': return -0x06; //
+ // case '': return -0x05; //
+ // case '': return -0x04; //
+ // case '': return -0x03; //
+ // case '': return -0x02; //
+ // case ' ': return -0x01; // SP
+
+ default:
+ return 0x3F; // ? Not valid character.
+
+ // Old translation
+ // case '\u00aa' : return (byte) 0xA6;
+ // case '\u00ba' : return (byte) 0xA7;
+ // case '\u00a1' : return (byte) 0xAD;
+ // case '\u00bf' : return (byte) 0xA8;
+ // case '\u00b7' : return (byte) 0xF9;
+ // case '\u00f1' : return (byte) 0xA4;
+ // case '\u00d1' : return (byte) 0xA5;
+ // case '\u00e1' : return (byte) 0xA0;
+ // case '\u00c1' : return (byte) 0x86;
+ // case '\u00e9' : return (byte) 0x82;
+ // case '\u00c9' : return (byte) 0x90;
+ // case '\u00ed' : return (byte) 0xA1;
+ // case '\u00cd' : return (byte) 0x8B;
+ // case '\u00f3' : return (byte) 0xA2;
+ // case '\u00d3' : return (byte) 0x9F;
+ // case '\u00fa' : return (byte) 0xA3;
+ // case '\u00da' : return (byte) 0x96;
+ // case '\u00fc' : return (byte) 0x81;
+ // case '\u00dc' : return (byte) 0x9A;
+ // default: return (byte) sChar;
+ }
}
-
- public byte transChar(char sChar) {
- if ((sChar >= 0x0000) && (sChar < 0x0080)) {
- return (byte) sChar;
- } else {
- switch (sChar) {
- case '\u00c7': return -0x80;
- case '\u00fc': return -0x7F; // u dieresis
- case '\u00e2': return -0x7D;
- case '\u00e4': return -0x7C;
- case '\u00e0': return -0x7B;
- case '\u00E5': return -0x7A; // ao
- case '\u00e7': return -0x79;
- case '\u00ea': return -0x78;
- case '\u00eb': return -0x77;
- case '\u00e8': return -0x76;
- case '\u00ef': return -0x75;
- case '\u00ee': return -0x74;
- case '\u00ec': return -0x73;
- case '\u00c4': return -0x72;
- case '\u00C5': return -0x71; // Ao
-
- case '\u00c9': return -0x70; // E acute
- case '\u00E6': return -0x6F; // ae
- case '\u00C6': return -0x6E; // AE
- case '\u00f4': return -0x6D;
- case '\u00f6': return -0x6C;
- case '\u00f2': return -0x6B;
- case '\u00fb': return -0x6A;
- case '\u00f9': return -0x69;
- case '\u00ff': return -0x68;
- case '\u00d6': return -0x67;
- case '\u00dc': return -0x66; // U dieresis
- case '\u00F8': return -0x65; // o/
- case '\u00A3': return -0x64; // L- Libra esterlina
- case '\u00D8': return -0x63; // O/
- case '\u00D7': return -0x62; // X
-// case '': return -0x61; // f
-
- case '\u00e1': return -0x60; // a acute
- case '\u00e9': return -0x7E; // e acute
- case '\u00ed': return -0x5F; // i acute
- case '\u00f3': return -0x5E; // o acute
- case '\u00fa': return -0x5D; // u acute
- case '\u00f1': return -0x5C; // n tilde
- case '\u00d1': return -0x5B; // N tilde
- case '\u00aa': return -0x5A;
- case '\u00ba': return -0x59;
- case '\u00bf': return -0x58; // abrir interrogacion
- case '\u00AE': return -0x57; // (R) Registrado
- case '\u00ac': return -0x56; // Not sign
- case '\u00BD': return -0x55; // 1/2
- case '\u00BC': return -0x54; // 1/4
- case '\u00a1': return -0x53; // abrir admiracion
- case '\u00AB': return -0x52; // <<
- case '\u00BB': return -0x51; // >>
-
- case '\u2591': return -0x50; // Light shade
- case '\u2592': return -0x4F; // Medium shade
- case '\u2593': return -0x4E; // Dark shade
- case '\u2502': return -0x4D; // BOX DRAWINGS LIGHT VERTICAL
- case '\u2524': return -0x4C; // BOX DRAWINGS LIGHT VERTICAL AND LEFT
- case '\u00c1': return -0x4B; // A acute
- case '\u00c2': return -0x4A;
- case '\u00c0': return -0x49;
- case '\u00A9': return -0x48; // (c) Copyright
- case '\u2563': return -0x47; // BOX DRAWINGS DOUBLE VERTICAL AND LEFT
- case '\u2551': return -0x46; // BOX DRAWINGS DOUBLE VERTICAL
- case '\u2557': return -0x45; // BOX DRAWINGS DOUBLE DOWN AND LEFT
- case '\u255D': return -0x44; // BOX DRAWINGS DOUBLE UP AND LEFT
- case '\u00A2': return -0x43; // Cent Sign
- case '\u00A5': return -0x42; // Yen Sign
- case '\u2510': return -0x41; // BOX DRAWINGS LIGHT DOWN AND LEFT
-
- case '\u2514': return -0x40; // BOX DRAWINGS LIGHT UP ANDRIGHT
-// case '': return -0x3F; //
-// case '': return -0x3E; //
-// case '': return -0x3D; //
-// case '': return -0x3C; //
-// case '': return -0x3B; //
-// case '': return -0x3A; //
-// case '': return -0x39; //
-// case '': return -0x38; //
-// case '': return -0x37; //
-// case '': return -0x36; //
-// case '': return -0x35; //
-// case '': return -0x34; //
-// case '': return -0x33; //
-// case '': return -0x32; //
-// case '': return -0x31; //
-
-// case '': return -0x30; //
-// case '': return -0x2F; //
- case '\u00ca': return -0x2E; //
- case '\u00cb': return -0x2D; //
- case '\u00c8': return -0x2C; //
- case '\u20ac': return (byte) 0xD5; // Euro Sign
- case '\u00cd': return -0x2A; // I acute
- case '\u00ce': return -0x29; //
- case '\u00cf': return -0x28; //
-// case '': return -0x27; //
-// case '': return -0x26; //
-// case '': return -0x25; //
-// case '': return -0x24; //
- case '|': return -0x23; //
- case '\u00cc': return -0x22; //
-// case '': return -0x21; //
-
- case '\u00d3': return -0x20; // O acute
-// case '': return -0x1F; //
- case '\u00d4': return -0x1E; //
- case '\u00d2': return -0x1D; //
-// case '': return -0x1C; //
-// case '': return -0x1B; //
-// case '': return -0x1A; //
-// case '': return -0x19; //
-// case '': return -0x18; //
- case '\u00da': return -0x17; // U acute
- case '\u00db': return -0x16; //
- case '\u00d9': return -0x15; //
- case '\u00fd': return -0x14; //
- case '\u00dd': return -0x13; //
-// case '': return -0x12; //
- case '\u00b4': return -0x11; //
-
-// case '': return -0x10; //
-// case '': return -0x0F; //
-// case '': return -0x0E; //
-// case '': return -0x0D; //
-// case '': return -0x0C; //
-// case '': return -0x0B; //
-// case '': return -0x0A; //
-// case '': return -0x09; //
-// case '': return -0x08; //
- case '\u00a8': return -0x07; //
-// case '': return -0x06; //
-// case '': return -0x05; //
-// case '': return -0x04; //
-// case '': return -0x03; //
-// case '': return -0x02; //
- // case ' ': return -0x01; // SP
-
- default: return 0x3F; // ? Not valid character.
-
-// Old translation
-// case '\u00aa' : return (byte) 0xA6;
-// case '\u00ba' : return (byte) 0xA7;
-// case '\u00a1' : return (byte) 0xAD;
-// case '\u00bf' : return (byte) 0xA8;
-// case '\u00b7' : return (byte) 0xF9;
-// case '\u00f1' : return (byte) 0xA4;
-// case '\u00d1' : return (byte) 0xA5;
-// case '\u00e1' : return (byte) 0xA0;
-// case '\u00c1' : return (byte) 0x86;
-// case '\u00e9' : return (byte) 0x82;
-// case '\u00c9' : return (byte) 0x90;
-// case '\u00ed' : return (byte) 0xA1;
-// case '\u00cd' : return (byte) 0x8B;
-// case '\u00f3' : return (byte) 0xA2;
-// case '\u00d3' : return (byte) 0x9F;
-// case '\u00fa' : return (byte) 0xA3;
-// case '\u00da' : return (byte) 0x96;
-// case '\u00fc' : return (byte) 0x81;
-// case '\u00dc' : return (byte) 0x9A;
-// default: return (byte) sChar;
- }
- }
- }
+ }
}
diff --git a/project/src/com/openbravo/pos/service/BasicHardwareService.java b/project/src/com/openbravo/pos/service/BasicHardwareService.java
--- a/project/src/com/openbravo/pos/service/BasicHardwareService.java
+++ b/project/src/com/openbravo/pos/service/BasicHardwareService.java
@@ -1,6 +1,6 @@
/*
************************************************************************************
- * Copyright (C) 2012 - 2018 Openbravo S.L.U.
+ * Copyright (C) 2012 - 2019 Openbravo S.L.U.
* Licensed under the Openbravo Commercial License version 1.0
* You may obtain a copy of the License at http://www.openbravo.com/legal/obcl.html
* or in the legal folder of this module distribution.
@@ -130,38 +130,39 @@
return USBDeviceList.discoverDevicePrinter(hwconfig);
} else if ("epson".equals(type)) {
return new DevicePrinterESCPOS(hwconfig.createPrinterWritter(), new CodesEpson(),
- new UnicodeTranslatorInt(), hwconfig.getConfigProperty("qr.quality"),
- hwconfig.getConfigProperty("qr.size"));
+ new UnicodeTranslatorInt(hwconfig.getBlockFile()),
+ hwconfig.getConfigProperty("qr.quality"), hwconfig.getConfigProperty("qr.size"));
} else if ("wincor".equals(type)) {
return new DevicePrinterESCPOS(hwconfig.createPrinterWritter(), new CodesWincor(),
- new UnicodeTranslatorInt(), hwconfig.getConfigProperty("qr.quality"),
- hwconfig.getConfigProperty("qr.size"));
+ new UnicodeTranslatorInt(hwconfig.getBlockFile()),
+ hwconfig.getConfigProperty("qr.quality"), hwconfig.getConfigProperty("qr.size"));
} else if ("tmu220".equals(type)) {
return new DevicePrinterESCPOS(hwconfig.createPrinterWritter(), new CodesTMU220(),
- new UnicodeTranslatorInt(), hwconfig.getConfigProperty("qr.quality"),
- hwconfig.getConfigProperty("qr.size"));
+ new UnicodeTranslatorInt(hwconfig.getBlockFile()),
+ hwconfig.getConfigProperty("qr.quality"), hwconfig.getConfigProperty("qr.size"));
} else if ("star".equals(type)) {
return new DevicePrinterESCPOS(hwconfig.createPrinterWritter(), new CodesStar(),
- new UnicodeTranslatorStar(), hwconfig.getConfigProperty("qr.quality"),
- hwconfig.getConfigProperty("qr.size"));
+ new UnicodeTranslatorStar(hwconfig.getBlockFile()),
+ hwconfig.getConfigProperty("qr.quality"), hwconfig.getConfigProperty("qr.size"));
} else if ("ithaca".equals(type)) {
return new DevicePrinterESCPOS(hwconfig.createPrinterWritter(), new CodesIthaca(),
- new UnicodeTranslatorInt(), hwconfig.getConfigProperty("qr.quality"),
- hwconfig.getConfigProperty("qr.size"));
+ new UnicodeTranslatorInt(hwconfig.getBlockFile()),
+ hwconfig.getConfigProperty("qr.quality"), hwconfig.getConfigProperty("qr.size"));
} else if ("surepos".equals(type)) {
return new DevicePrinterESCPOS(hwconfig.createPrinterWritter(), new CodesSurePOS(),
- new UnicodeTranslatorSurePOS(), hwconfig.getConfigProperty("qr.quality"),
- hwconfig.getConfigProperty("qr.size"));
+ new UnicodeTranslatorSurePOS(hwconfig.getBlockFile()),
+ hwconfig.getConfigProperty("qr.quality"), hwconfig.getConfigProperty("qr.size"));
} else if ("ncr".equals(type)) {
return new DevicePrinterESCPOS(hwconfig.createPrinterWritter(), new CodesNCR(),
- new UnicodeTranslatorInt(), hwconfig.getConfigProperty("qr.quality"),
- hwconfig.getConfigProperty("qr.size"));
+ new UnicodeTranslatorInt(hwconfig.getBlockFile()),
+ hwconfig.getConfigProperty("qr.quality"), hwconfig.getConfigProperty("qr.size"));
} else if ("plain".equals(type)) {
- return new DevicePrinterPlain(hwconfig.createPrinterWritter());
+ return new DevicePrinterPlain(hwconfig.createPrinterWritter(), new UnicodeTranslatorStar(
+ hwconfig.getBlockFile()));
} else if ("th200i".equals(type)) {
return new DevicePrinterESCPOS(hwconfig.createPrinterWritter(), new CodesTH200i(),
- new UnicodeTranslatorInt(), hwconfig.getConfigProperty("qr.quality"),
- hwconfig.getConfigProperty("qr.size"));
+ new UnicodeTranslatorInt(hwconfig.getBlockFile()),
+ hwconfig.getConfigProperty("qr.quality"), hwconfig.getConfigProperty("qr.size"));
} else if ("javapos".equals(type)) {
String encoding = hwconfig.getConfigProperty("javapos.text.encoding");
String imgformat = hwconfig.getConfigProperty("javapos.image.format");
diff --git a/project/src/com/openbravo/pos/service/HardwareConfig.java b/project/src/com/openbravo/pos/service/HardwareConfig.java
--- a/project/src/com/openbravo/pos/service/HardwareConfig.java
+++ b/project/src/com/openbravo/pos/service/HardwareConfig.java
@@ -1,6 +1,6 @@
/*
************************************************************************************
- * Copyright (C) 2012-2014 Openbravo S.L.U.
+ * Copyright (C) 2012-2019 Openbravo S.L.U.
* Licensed under the Openbravo Commercial License version 1.0
* You may obtain a copy of the License at http://www.openbravo.com/legal/obcl.html
* or in the legal folder of this module distribution.
@@ -18,9 +18,15 @@
*/
public interface HardwareConfig {
- public String getDeviceType();
- public String getParameter1();
- public String getParameter2();
- public String getConfigProperty(String prop);
- public PrinterWritter createPrinterWritter() throws TicketPrinterException;
+ public String getDeviceType();
+
+ public String getParameter1();
+
+ public String getParameter2();
+
+ public String getBlockFile();
+
+ public String getConfigProperty(String prop);
+
+ public PrinterWritter createPrinterWritter() throws TicketPrinterException;
}
diff --git a/project/src/com/openbravo/pos/service/HardwareConfigInst.java b/project/src/com/openbravo/pos/service/HardwareConfigInst.java
--- a/project/src/com/openbravo/pos/service/HardwareConfigInst.java
+++ b/project/src/com/openbravo/pos/service/HardwareConfigInst.java
@@ -1,6 +1,6 @@
/*
************************************************************************************
- * Copyright (C) 2012-2014 Openbravo S.L.U.
+ * Copyright (C) 2012-2019 Openbravo S.L.U.
* Licensed under the Openbravo Commercial License version 1.0
* You may obtain a copy of the License at http://www.openbravo.com/legal/obcl.html
* or in the legal folder of this module distribution.
@@ -32,6 +32,7 @@
private String devicetype;
private String param1;
private String param2;
+ private String blockFile;
private final AppConfig config;
@@ -41,10 +42,11 @@
this.config = config;
}
- public void setParameters(String devicetype, String param1, String param2) {
+ public void setParameters(String devicetype, String param1, String param2, String blockFile) {
this.devicetype = devicetype;
this.param1 = param1;
this.param2 = param2;
+ this.blockFile = blockFile;
}
public String getDeviceType() {
@@ -59,6 +61,10 @@
return param2;
}
+ public String getBlockFile() {
+ return blockFile;
+ }
+
public String getConfigProperty(String prop) {
return config.getProperty(prop);
}
@@ -69,11 +75,10 @@
if (pw == null) {
if ("serial".equals(param1) || "rxtx".equals(param1)) {
StringParser p = new StringParser(param2);
- pw = new PrinterWritterRXTX(p.nextToken(','), parseInt(p.nextToken(','), 9600),
- parseInt(p.nextToken(','), SerialPort.DATABITS_8),
- parseInt(p.nextToken(','), SerialPort.STOPBITS_1),
- parseInt(p.nextToken(','), SerialPort.PARITY_NONE),
- parseInt(p.nextToken(','), SerialPort.FLOWCONTROL_NONE));
+ pw = new PrinterWritterRXTX(p.nextToken(','), parseInt(p.nextToken(','), 9600), parseInt(
+ p.nextToken(','), SerialPort.DATABITS_8), parseInt(p.nextToken(','),
+ SerialPort.STOPBITS_1), parseInt(p.nextToken(','), SerialPort.PARITY_NONE), parseInt(
+ p.nextToken(','), SerialPort.FLOWCONTROL_NONE));
m_apool.put(skey, pw);
} else if ("file".equals(param1)) {
pw = new PrinterWritterFile(param2);
diff --git a/project/src/com/openbravo/poshw/AppConfig.java b/project/src/com/openbravo/poshw/AppConfig.java
--- a/project/src/com/openbravo/poshw/AppConfig.java
+++ b/project/src/com/openbravo/poshw/AppConfig.java
@@ -1,6 +1,6 @@
/*
************************************************************************************
- * Copyright (C) 2012-2018 Openbravo S.L.U.
+ * Copyright (C) 2012-2019 Openbravo S.L.U.
* Licensed under the Openbravo Commercial License version 1.0
* You may obtain a copy of the License at http://www.openbravo.com/legal/obcl.html
* or in the legal folder of this module distribution.
@@ -100,8 +100,11 @@
m_propsconfig.setProperty("printers.virtualizeports", "false");
m_propsconfig.setProperty("machine.printer", "usb");
+ m_propsconfig.setProperty("machine.printer.blockfile", "unicodeblocks.xml");
m_propsconfig.setProperty("machine.printer.2", "");
+ m_propsconfig.setProperty("machine.printer.2.blockfile", "unicodeblocks.xml");
m_propsconfig.setProperty("machine.printer.3", "");
+ m_propsconfig.setProperty("machine.printer.3.blockfile", "unicodeblocks.xml");
m_propsconfig.setProperty("machine.display", "usb");
m_propsconfig.setProperty("machine.scale", "screen");
@@ -186,8 +189,11 @@
s.append("\n## Receipt printers ##\n");
printProperty(s, "machine.printer");
+ printProperty(s, "machine.printer.blockfile");
printProperty(s, "machine.printer.2");
+ printProperty(s, "machine.printer.2.blockfile");
printProperty(s, "machine.printer.3");
+ printProperty(s, "machine.printer.3.blockfile");
s.append("\n## Receipt printer images ##\n");
printProperty(s, "images.folder");
|