pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From le...@apache.org
Subject svn commit: r1603490 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDType1Font.java
Date Wed, 18 Jun 2014 15:42:01 GMT
Author: lehmi
Date: Wed Jun 18 15:42:00 2014
New Revision: 1603490

URL: http://svn.apache.org/r1603490
Log:
PDFBOX-2145: avoid NPE when initializing AFM_MAP

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=1603490&r1=1603489&r2=1603490&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 Wed
Jun 18 15:42:00 2014
@@ -96,36 +96,36 @@ public class PDType1Font extends PDSimpl
     private static Map<String, FontMetric> getAdobeFontMetrics()
     {
         Map<String, FontMetric> metrics = new HashMap<String, FontMetric>();
-        addMetric("Courier-Bold");
-        addMetric("Courier-BoldOblique");
-        addMetric("Courier");
-        addMetric("Courier-Oblique");
-        addMetric("Helvetica");
-        addMetric("Helvetica-Bold");
-        addMetric("Helvetica-BoldOblique");
-        addMetric("Helvetica-Oblique");
-        addMetric("Symbol");
-        addMetric("Times-Bold");
-        addMetric("Times-BoldItalic");
-        addMetric("Times-Italic");
-        addMetric("Times-Roman");
-        addMetric("ZapfDingbats");
+        addMetric(metrics, "Courier-Bold");
+        addMetric(metrics, "Courier-BoldOblique");
+        addMetric(metrics, "Courier");
+        addMetric(metrics, "Courier-Oblique");
+        addMetric(metrics, "Helvetica");
+        addMetric(metrics, "Helvetica-Bold");
+        addMetric(metrics, "Helvetica-BoldOblique");
+        addMetric(metrics, "Helvetica-Oblique");
+        addMetric(metrics, "Symbol");
+        addMetric(metrics, "Times-Bold");
+        addMetric(metrics, "Times-BoldItalic");
+        addMetric(metrics, "Times-Italic");
+        addMetric(metrics, "Times-Roman");
+        addMetric(metrics, "ZapfDingbats");
         
         // PDFBOX-239
-        addMetric("Arial", "Helvetica");
-        addMetric("Arial,Bold", "Helvetica-Bold");
-        addMetric("Arial,Italic", "Helvetica-Oblique");
-        addMetric("Arial,BoldItalic", "Helvetica-BoldOblique");
+        addMetric(metrics, "Arial", "Helvetica");
+        addMetric(metrics, "Arial,Bold", "Helvetica-Bold");
+        addMetric(metrics, "Arial,Italic", "Helvetica-Oblique");
+        addMetric(metrics, "Arial,BoldItalic", "Helvetica-BoldOblique");
 
         return Collections.unmodifiableMap(metrics);
     }
 
-    private static void addMetric(String name)
+    private static void addMetric(Map<String, FontMetric> metrics, String name)
     {
-        addMetric(name, name);
+        addMetric(metrics, name, name);
     }
     
-    private static void addMetric(String name, String prefix)
+    private static void addMetric(Map<String, FontMetric> metrics, String name, String
prefix)
     {
         try
         {
@@ -137,7 +137,7 @@ public class PDType1Font extends PDSimpl
                 {
                     AFMParser parser = new AFMParser(afmStream);
                     FontMetric metric = parser.parse();
-                    AFM_MAP.put(name, metric);
+                    metrics.put(name, metric);
                 }
                 finally
                 {



Mime
View raw message