pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jahew...@apache.org
Subject svn commit: r1620710 [2/2] - in /pdfbox/branches/no-awt: pdfbox/src/main/java/org/apache/pdfbox/encoding/ pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/ pdfbox/src/main/java/org/apache/pdfbox/rendering/font/ pdfbox/src/test/java/org/apache/pdfbox...
Date Tue, 26 Aug 2014 19:42:56 GMT
Modified: pdfbox/branches/no-awt/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1FontEmbedder.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/no-awt/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1FontEmbedder.java?rev=1620710&r1=1620709&r2=1620710&view=diff
==============================================================================
--- pdfbox/branches/no-awt/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1FontEmbedder.java
(original)
+++ pdfbox/branches/no-awt/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1FontEmbedder.java
Tue Aug 26 19:42:56 2014
@@ -112,11 +112,13 @@ class PDType1FontEmbedder
         int maxWidths = 256;
         List<Integer> widths = new ArrayList<Integer>(maxWidths);
         int zero = 250;
+
         Iterator<CharMetric> iter = listmetric.iterator();
         for (int i = 0; i < maxWidths; i++)
         {
             widths.add(zero);
         }
+
         while (iter.hasNext())
         {
             CharMetric m = iter.next();
@@ -129,42 +131,6 @@ class PDType1FontEmbedder
                 {
                     int width = Math.round(m.getWx());
                     widths.set(n, width);
-                    // germandbls has 2 character codes !! Don't ask me why
-                    // StandardEncoding = 0373 = 251
-                    // WinANSIEncoding = 0337 = 223
-                    if (m.getName().equals("germandbls") && n != 223)
-                    {
-                        widths.set(0337, width);
-                    }
-                }
-            }
-            else
-            {
-                // my AFMPFB-Fonts has no character-codes for german umlauts
-                // so that I've to add them here by hand
-                if (m.getName().equals("adieresis"))
-                {
-                    widths.set(0344, widths.get(encoding.getCode("a")));
-                }
-                else if (m.getName().equals("odieresis"))
-                {
-                    widths.set(0366, widths.get(encoding.getCode("o")));
-                }
-                else if (m.getName().equals("udieresis"))
-                {
-                    widths.set(0374, widths.get(encoding.getCode("u")));
-                }
-                else if (m.getName().equals("Adieresis"))
-                {
-                    widths.set(0304, widths.get(encoding.getCode("A")));
-                }
-                else if (m.getName().equals("Odieresis"))
-                {
-                    widths.set(0326, widths.get(encoding.getCode("O")));
-                }
-                else if (m.getName().equals("Udieresis"))
-                {
-                    widths.set(0334, widths.get(encoding.getCode("U")));
                 }
             }
         }

Modified: pdfbox/branches/no-awt/pdfbox/src/main/java/org/apache/pdfbox/rendering/font/Type1Glyph2D.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/no-awt/pdfbox/src/main/java/org/apache/pdfbox/rendering/font/Type1Glyph2D.java?rev=1620710&r1=1620709&r2=1620710&view=diff
==============================================================================
--- pdfbox/branches/no-awt/pdfbox/src/main/java/org/apache/pdfbox/rendering/font/Type1Glyph2D.java
(original)
+++ pdfbox/branches/no-awt/pdfbox/src/main/java/org/apache/pdfbox/rendering/font/Type1Glyph2D.java
Tue Aug 26 19:42:56 2014
@@ -24,6 +24,7 @@ import java.util.Map;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.pdfbox.encoding.Encoding;
+import org.apache.pdfbox.encoding.GlyphList;
 import org.apache.pdfbox.pdmodel.font.PDType1Equivalent;
 
 /**
@@ -101,7 +102,7 @@ public class Type1Glyph2D implements Gly
                 else
                 {
                     // try unicode name
-                    String unicodes = Encoding.getCharacterForName(name);
+                    String unicodes = GlyphList.toUnicode(name);
                     if (unicodes != null)
                     {
                         if (unicodes.length() == 1)

Modified: pdfbox/branches/no-awt/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/font/TestTTFParser.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/no-awt/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/font/TestTTFParser.java?rev=1620710&r1=1620709&r2=1620710&view=diff
==============================================================================
--- pdfbox/branches/no-awt/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/font/TestTTFParser.java
(original)
+++ pdfbox/branches/no-awt/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/font/TestTTFParser.java
Tue Aug 26 19:42:56 2014
@@ -25,6 +25,7 @@ import org.apache.fontbox.ttf.PostScript
 import org.apache.fontbox.ttf.TTFParser;
 import org.apache.fontbox.ttf.TrueTypeFont;
 import org.apache.pdfbox.encoding.Encoding;
+import org.apache.pdfbox.encoding.GlyphList;
 import org.apache.pdfbox.encoding.WinAnsiEncoding;
 import org.junit.Assert;
 import org.junit.Test;
@@ -93,27 +94,27 @@ public class TestTTFParser
                         || "product".equals(name) || "integral".equals(name) || "Omega".equals(name)
                         || "radical".equals(name) || "tilde".equals(name))
                 {
-                    Assert.assertTrue(enc.getNameForCharacter((char) charCode).startsWith(name));
+                    Assert.assertTrue(GlyphList.unicodeToName((char) charCode).startsWith(name));
                 }
                 else if ("bar".equals(name))
                 {
-                    Assert.assertTrue(enc.getNameForCharacter((char) charCode).endsWith(name));
+                    Assert.assertTrue(GlyphList.unicodeToName((char) charCode).endsWith(name));
                 }
                 else if ("sfthyphen".equals(name))
                 {
-                    Assert.assertEquals("softhyphen", enc.getNameForCharacter((char) charCode));
+                    Assert.assertEquals("softhyphen", GlyphList.unicodeToName((char) charCode));
                 }
-                else if ("periodcentered".equals(name) && !enc.getNameForCharacter((char)
charCode).equals(name))
+                else if ("periodcentered".equals(name) && !GlyphList.unicodeToName((char)
charCode).equals(name))
                 {
-                    Assert.assertEquals("bulletoperator", enc.getNameForCharacter((char)
charCode));
+                    Assert.assertEquals("bulletoperator", GlyphList.unicodeToName((char)
charCode));
                 }
                 else if ("fraction".equals(name))
                 {
-                    Assert.assertEquals("divisionslash", enc.getNameForCharacter((char) charCode));
+                    Assert.assertEquals("divisionslash", GlyphList.unicodeToName((char) charCode));
                 }
                 else if ("mu".equals(name))
                 {
-                    Assert.assertEquals("mu1", enc.getNameForCharacter((char) charCode));
+                    Assert.assertEquals("mu1", GlyphList.unicodeToName((char) charCode));
                 }
                 else if ("pi".equals(name))
                 {
@@ -121,7 +122,7 @@ public class TestTTFParser
                 }
                 else
                 {
-                    Assert.assertEquals(enc.getNameForCharacter((char) charCode), name);
+                    Assert.assertEquals(GlyphList.unicodeToName((char) charCode), name);
                 }
             }
         }

Modified: pdfbox/branches/no-awt/preflight/src/main/java/org/apache/pdfbox/preflight/font/container/TrueTypeContainer.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/no-awt/preflight/src/main/java/org/apache/pdfbox/preflight/font/container/TrueTypeContainer.java?rev=1620710&r1=1620709&r2=1620710&view=diff
==============================================================================
--- pdfbox/branches/no-awt/preflight/src/main/java/org/apache/pdfbox/preflight/font/container/TrueTypeContainer.java
(original)
+++ pdfbox/branches/no-awt/preflight/src/main/java/org/apache/pdfbox/preflight/font/container/TrueTypeContainer.java
Tue Aug 26 19:42:56 2014
@@ -29,6 +29,7 @@ import org.apache.fontbox.ttf.CMAPEncodi
 import org.apache.fontbox.ttf.CMAPTable;
 import org.apache.fontbox.ttf.TrueTypeFont;
 import org.apache.pdfbox.encoding.Encoding;
+import org.apache.pdfbox.encoding.GlyphList;
 import org.apache.pdfbox.pdmodel.font.PDTrueTypeFont;
 import org.apache.pdfbox.preflight.PreflightConstants;
 import org.apache.pdfbox.preflight.font.util.GlyphException;
@@ -161,7 +162,8 @@ public class TrueTypeContainer extends F
         if (cmap.getPlatformEncodingId() == 1 && cmap.getPlatformId() == 3)
         {
             Encoding fontEncoding = this.trueTypeFont.getEncoding();
-            String character = fontEncoding.getCharacter(cid);
+            String name = fontEncoding.getName(cid);
+            String character = GlyphList.toUnicode(name);
             if (character == null)
             {
                 return notFoundGlyphID;



Mime
View raw message