pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1751833 - in /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font: PDType1Font.java encoding/ZapfDingbatsEncoding.java
Date Thu, 07 Jul 2016 21:22:48 GMT
Author: tilman
Date: Thu Jul  7 21:22:48 2016
New Revision: 1751833

URL: http://svn.apache.org/viewvc?rev=1751833&view=rev
Log:
PDFBOX-3298: added encoding for ZapfDingbats

Added:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/encoding/ZapfDingbatsEncoding.java
      - copied, changed from r1751546, pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/encoding/MacExpertEncoding.java
Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1Font.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1Font.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1Font.java?rev=1751833&r1=1751832&r2=1751833&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1Font.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1Font.java Thu
Jul  7 21:22:48 2016
@@ -47,6 +47,7 @@ import org.apache.pdfbox.util.Matrix;
 
 import static org.apache.pdfbox.pdmodel.font.UniUtil.getUniNameOfCodePoint;
 import org.apache.pdfbox.pdmodel.font.encoding.WinAnsiEncoding;
+import org.apache.pdfbox.pdmodel.font.encoding.ZapfDingbatsEncoding;
 
 /**
  * A PostScript Type 1 Font.
@@ -121,8 +122,16 @@ public class PDType1Font extends PDSimpl
         
         dict.setItem(COSName.SUBTYPE, COSName.TYPE1);
         dict.setName(COSName.BASE_FONT, baseFont);
-        encoding = WinAnsiEncoding.INSTANCE;
-        dict.setItem(COSName.ENCODING, COSName.WIN_ANSI_ENCODING);
+        if ("ZapfDingbats".equals(baseFont))
+        {
+            encoding = ZapfDingbatsEncoding.INSTANCE;
+        }
+        else
+        {
+            encoding = WinAnsiEncoding.INSTANCE;
+            dict.setItem(COSName.ENCODING, COSName.WIN_ANSI_ENCODING);
+        }
+
         // standard 14 fonts may be accessed concurrently, as they are singletons
         codeToBytesMap = new ConcurrentHashMap<Integer,byte[]>();
 

Copied: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/encoding/ZapfDingbatsEncoding.java
(from r1751546, pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/encoding/MacExpertEncoding.java)
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/encoding/ZapfDingbatsEncoding.java?p2=pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/encoding/ZapfDingbatsEncoding.java&p1=pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/encoding/MacExpertEncoding.java&r1=1751546&r2=1751833&rev=1751833&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/encoding/MacExpertEncoding.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/encoding/ZapfDingbatsEncoding.java
Thu Jul  7 21:22:48 2016
@@ -22,7 +22,7 @@ import org.apache.pdfbox.cos.COSName;
 /**
  * This is an interface to a text encoder.
  */
-public class MacExpertEncoding extends Encoding
+public class ZapfDingbatsEncoding extends Encoding
 {
 
     private static final int CHAR_CODE = 0;
@@ -31,185 +31,208 @@ public class MacExpertEncoding extends E
     /**
      * Table of octal character codes and their corresponding names.
      */
-    private static final Object[][] MAC_EXPERT_ENCODING_TABLE = {
-        {0276, "AEsmall"},
-        {0207, "Aacutesmall"},
-        {0211, "Acircumflexsmall"},
-        {047, "Acutesmall"},
-        {0212, "Adieresissmall"},
-        {0210, "Agravesmall"},
-        {0214, "Aringsmall"},
-        {0141, "Asmall"},
-        {0213, "Atildesmall"},
-        {0363, "Brevesmall"},
-        {0142, "Bsmall"},
-        {0256, "Caronsmall"},
-        {0215, "Ccedillasmall"},
-        {0311, "Cedillasmall"},
-        {0136, "Circumflexsmall"},
-        {0143, "Csmall"},
-        {0254, "Dieresissmall"},
-        {0372, "Dotaccentsmall"},
-        {0144, "Dsmall"},
-        {0216, "Eacutesmall"},
-        {0220, "Ecircumflexsmall"},
-        {0221, "Edieresissmall"},
-        {0217, "Egravesmall"},
-        {0145, "Esmall"},
-        {0104, "Ethsmall"},
-        {0146, "Fsmall"},
-        {0140, "Gravesmall"},
-        {0147, "Gsmall"},
-        {0150, "Hsmall"},
-        {042, "Hungarumlautsmall"},
-        {0222, "Iacutesmall"},
-        {0224, "Icircumflexsmall"},
-        {0225, "Idieresissmall"},
-        {0223, "Igravesmall"},
-        {0151, "Ismall"},
-        {0152, "Jsmall"},
-        {0153, "Ksmall"},
-        {0302, "Lslashsmall"},
-        {0154, "Lsmall"},
-        {0364, "Macronsmall"},
-        {0155, "Msmall"},
-        {0156, "Nsmall"},
-        {0226, "Ntildesmall"},
-        {0317, "OEsmall"},
-        {0227, "Oacutesmall"},
-        {0231, "Ocircumflexsmall"},
-        {0232, "Odieresissmall"},
-        {0362, "Ogoneksmall"},
-        {0230, "Ogravesmall"},
-        {0277, "Oslashsmall"},
-        {0157, "Osmall"},
-        {0233, "Otildesmall"},
-        {0160, "Psmall"},
-        {0161, "Qsmall"},
-        {0373, "Ringsmall"},
-        {0162, "Rsmall"},
-        {0247, "Scaronsmall"},
-        {0163, "Ssmall"},
-        {0271, "Thornsmall"},
-        {0176, "Tildesmall"},
-        {0164, "Tsmall"},
-        {0234, "Uacutesmall"},
-        {0236, "Ucircumflexsmall"},
-        {0237, "Udieresissmall"},
-        {0235, "Ugravesmall"},
-        {0165, "Usmall"},
-        {0166, "Vsmall"},
-        {0167, "Wsmall"},
-        {0170, "Xsmall"},
-        {0264, "Yacutesmall"},
-        {0330, "Ydieresissmall"},
-        {0171, "Ysmall"},
-        {0275, "Zcaronsmall"},
-        {0172, "Zsmall"},
-        {046, "ampersandsmall"},
-        {0201, "asuperior"},
-        {0365, "bsuperior"},
-        {0251, "centinferior"},
-        {043, "centoldstyle"},
-        {0202, "centsuperior"},
-        {072, "colon"},
-        {0173, "colonmonetary"},
-        {054, "comma"},
-        {0262, "commainferior"},
-        {0370, "commasuperior"},
-        {0266, "dollarinferior"},
-        {044, "dollaroldstyle"},
-        {045, "dollarsuperior"},
-        {0353, "dsuperior"},
-        {0245, "eightinferior"},
-        {070, "eightoldstyle"},
-        {0241, "eightsuperior"},
-        {0344, "esuperior"},
-        {0326, "exclamdownsmall"},
-        {041, "exclamsmall"},
-        {0126, "ff"},
-        {0131, "ffi"},
-        {0132, "ffl"},
-        {0127, "fi"},
-        {0320, "figuredash"},
-        {0114, "fiveeighths"},
-        {0260, "fiveinferior"},
-        {065, "fiveoldstyle"},
-        {0336, "fivesuperior"},
-        {0130, "fl"},
-        {0242, "fourinferior"},
-        {064, "fouroldstyle"},
-        {0335, "foursuperior"},
-        {057, "fraction"},
-        {055, "hyphen"},
-        {0137, "hypheninferior"},
-        {0321, "hyphensuperior"},
-        {0351, "isuperior"},
-        {0361, "lsuperior"},
-        {0367, "msuperior"},
-        {0273, "nineinferior"},
-        {071, "nineoldstyle"},
-        {0341, "ninesuperior"},
-        {0366, "nsuperior"},
-        {053, "onedotenleader"},
-        {0112, "oneeighth"},
-        {0174, "onefitted"},
-        {0110, "onehalf"},
-        {0301, "oneinferior"},
-        {061, "oneoldstyle"},
-        {0107, "onequarter"},
-        {0332, "onesuperior"},
-        {0116, "onethird"},
-        {0257, "osuperior"},
-        {0133, "parenleftinferior"},
-        {050, "parenleftsuperior"},
-        {0135, "parenrightinferior"},
-        {051, "parenrightsuperior"},
-        {056, "period"},
-        {0263, "periodinferior"},
-        {0371, "periodsuperior"},
-        {0300, "questiondownsmall"},
-        {077, "questionsmall"},
-        {0345, "rsuperior"},
-        {0175, "rupiah"},
-        {073, "semicolon"},
-        {0115, "seveneighths"},
-        {0246, "seveninferior"},
-        {067, "sevenoldstyle"},
-        {0340, "sevensuperior"},
-        {0244, "sixinferior"},
-        {066, "sixoldstyle"},
-        {0337, "sixsuperior"},
+    private static final Object[][] ZAPFDINGBATS_ENCODING_TABLE = {
         {040, "space"},
-        {0352, "ssuperior"},
-        {0113, "threeeighths"},
-        {0243, "threeinferior"},
-        {063, "threeoldstyle"},
-        {0111, "threequarters"},
-        {075, "threequartersemdash"},
-        {0334, "threesuperior"},
-        {0346, "tsuperior"},
-        {052, "twodotenleader"},
-        {0252, "twoinferior"},
-        {062, "twooldstyle"},
-        {0333, "twosuperior"},
-        {0117, "twothirds"},
-        {0274, "zeroinferior"},
-        {060, "zerooldstyle"},
-        {0342, "zerosuperior"}
+        {041, "a1"},
+        {042, "a2"},
+        {043, "a202"},
+        {044, "a3"},
+        {045, "a4"},
+        {046, "a5"},
+        {047, "a119"},
+        {050, "a118"},
+        {051, "a117"},
+        {052, "a11"},
+        {053, "a12"},
+        {054, "a13"},
+        {055, "a14"},
+        {056, "a15"},
+        {057, "a16"},
+        {060, "a105"},
+        {061, "a17"},
+        {062, "a18"},
+        {063, "a19"},
+        {064, "a20"},
+        {065, "a21"},
+        {066, "a22"},
+        {067, "a23"},
+        {070, "a24"},
+        {071, "a25"},
+        {072, "a26"},
+        {073, "a27"},
+        {074, "a28"},
+        {075, "a6"},
+        {076, "a7"},
+        {077, "a8"},
+        {0100, "a9"},
+        {0101, "a10"},
+        {0102, "a29"},
+        {0103, "a30"},
+        {0104, "a31"},
+        {0105, "a32"},
+        {0106, "a33"},
+        {0107, "a34"},
+        {0110, "a35"},
+        {0111, "a36"},
+        {0112, "a37"},
+        {0113, "a38"},
+        {0114, "a39"},
+        {0115, "a40"},
+        {0116, "a41"},
+        {0117, "a42"},
+        {0120, "a43"},
+        {0121, "a44"},
+        {0122, "a45"},
+        {0123, "a46"},
+        {0124, "a47"},
+        {0125, "a48"},
+        {0126, "a49"},
+        {0127, "a50"},
+        {0130, "a51"},
+        {0131, "a52"},
+        {0132, "a53"},
+        {0133, "a54"},
+        {0134, "a55"},
+        {0135, "a56"},
+        {0136, "a57"},
+        {0137, "a58"},
+        {0140, "a59"},
+        {0141, "a60"},
+        {0142, "a61"},
+        {0143, "a62"},
+        {0144, "a63"},
+        {0145, "a64"},
+        {0146, "a65"},
+        {0147, "a66"},
+        {0150, "a67"},
+        {0151, "a68"},
+        {0152, "a69"},
+        {0153, "a70"},
+        {0154, "a71"},
+        {0155, "a72"},
+        {0156, "a73"},
+        {0157, "a74"},
+        {0160, "a203"},
+        {0161, "a75"},
+        {0162, "a204"},
+        {0163, "a76"},
+        {0164, "a77"},
+        {0165, "a78"},
+        {0166, "a79"},
+        {0167, "a81"},
+        {0170, "a82"},
+        {0171, "a83"},
+        {0172, "a84"},
+        {0173, "a97"},
+        {0174, "a98"},
+        {0175, "a99"},
+        {0176, "a100"},
+        {0241, "a101"},
+        {0242, "a102"},
+        {0243, "a103"},
+        {0244, "a104"},
+        {0245, "a106"},
+        {0246, "a107"},
+        {0247, "a108"},
+        {0250, "a112"},
+        {0251, "a111"},
+        {0252, "a110"},
+        {0253, "a109"},
+        {0254, "a120"},
+        {0255, "a121"},
+        {0256, "a122"},
+        {0257, "a123"},
+        {0260, "a124"},
+        {0261, "a125"},
+        {0262, "a126"},
+        {0263, "a127"},
+        {0264, "a128"},
+        {0265, "a129"},
+        {0266, "a130"},
+        {0267, "a131"},
+        {0270, "a132"},
+        {0271, "a133"},
+        {0272, "a134"},
+        {0273, "a135"},
+        {0274, "a136"},
+        {0275, "a137"},
+        {0276, "a138"},
+        {0277, "a139"},
+        {0300, "a140"},
+        {0301, "a141"},
+        {0302, "a142"},
+        {0303, "a143"},
+        {0304, "a144"},
+        {0305, "a145"},
+        {0306, "a146"},
+        {0307, "a147"},
+        {0310, "a148"},
+        {0311, "a149"},
+        {0312, "a150"},
+        {0313, "a151"},
+        {0314, "a152"},
+        {0315, "a153"},
+        {0316, "a154"},
+        {0317, "a155"},
+        {0320, "a156"},
+        {0321, "a157"},
+        {0322, "a158"},
+        {0323, "a159"},
+        {0324, "a160"},
+        {0325, "a161"},
+        {0326, "a163"},
+        {0327, "a164"},
+        {0330, "a196"},
+        {0331, "a165"},
+        {0332, "a192"},
+        {0333, "a166"},
+        {0334, "a167"},
+        {0335, "a168"},
+        {0336, "a169"},
+        {0337, "a170"},
+        {0340, "a171"},
+        {0341, "a172"},
+        {0342, "a173"},
+        {0343, "a162"},
+        {0344, "a174"},
+        {0345, "a175"},
+        {0346, "a176"},
+        {0347, "a177"},
+        {0350, "a178"},
+        {0351, "a179"},
+        {0352, "a193"},
+        {0353, "a180"},
+        {0354, "a199"},
+        {0355, "a181"},
+        {0356, "a200"},
+        {0357, "a182"},
+        {0361, "a201"},
+        {0362, "a183"},
+        {0363, "a184"},
+        {0364, "a197"},
+        {0365, "a185"},
+        {0366, "a194"},
+        {0367, "a198"},
+        {0370, "a186"},
+        {0371, "a195"},
+        {0372, "a187"},
+        {0373, "a188"},
+        {0374, "a189"},
+        {0375, "a190"},
+        {0376, "a191"}
     };
     
     /**
      * Singleton instance of this class.
      */
-    public static final MacExpertEncoding INSTANCE = new MacExpertEncoding();
+    public static final ZapfDingbatsEncoding INSTANCE = new ZapfDingbatsEncoding();
 
     /**
      * Constructor.
      */
-    public MacExpertEncoding()
+    public ZapfDingbatsEncoding()
     {
-        for (Object[] encodingEntry : MAC_EXPERT_ENCODING_TABLE)
+        for (Object[] encodingEntry : ZAPFDINGBATS_ENCODING_TABLE)
         {
             add((Integer) encodingEntry[CHAR_CODE], encodingEntry[CHAR_NAME].toString());
         }
@@ -218,12 +241,12 @@ public class MacExpertEncoding extends E
     @Override
     public COSBase getCOSObject()
     {
-        return COSName.MAC_EXPERT_ENCODING;
+        return COSName.getPDFName("ZapfDingbatsEncoding");
     }
 
     @Override
     public String getEncodingName()
     {
-        return "MacExpertEncoding";
+        return "ZapfDingbatsEncoding";
     }
 }



Mime
View raw message