You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2022/01/06 07:27:30 UTC

svn commit: r1896738 - in /pdfbox/branches/2.0/fontbox: pom.xml src/test/java/org/apache/fontbox/pfb/ src/test/java/org/apache/fontbox/pfb/PfbParserTest.java

Author: tilman
Date: Thu Jan  6 07:27:30 2022
New Revision: 1896738

URL: http://svn.apache.org/viewvc?rev=1896738&view=rev
Log:
PDFBOX-5356: add test of PFB font

Added:
    pdfbox/branches/2.0/fontbox/src/test/java/org/apache/fontbox/pfb/
    pdfbox/branches/2.0/fontbox/src/test/java/org/apache/fontbox/pfb/PfbParserTest.java   (with props)
Modified:
    pdfbox/branches/2.0/fontbox/pom.xml

Modified: pdfbox/branches/2.0/fontbox/pom.xml
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/fontbox/pom.xml?rev=1896738&r1=1896737&r2=1896738&view=diff
==============================================================================
--- pdfbox/branches/2.0/fontbox/pom.xml (original)
+++ pdfbox/branches/2.0/fontbox/pom.xml Thu Jan  6 07:27:30 2022
@@ -130,6 +130,18 @@
                       <sha512>cbdd317d16099d24736457eef631353c7830a1a3c132b01f2cdc1e6a0c21a78e3b1fe8479b3f40179e7630a15cc23a093775bb22d521dba39376bb367d497b21</sha512>
                   </configuration>
               </execution>
+              <execution>
+                  <id>PDFBOX-5356</id>
+                  <phase>generate-test-resources</phase>
+                  <goals>
+                      <goal>wget</goal>
+                  </goals>
+                  <configuration>
+                      <url>http://mirrors.ctan.org/fonts/opensans/type1/OpenSans-Regular.pfb</url>
+                      <outputDirectory>${project.build.directory}/fonts</outputDirectory>
+                      <sha512>2787fcecc0feb1c9e6ff0d8de6193658413863e44eaab572751ca7e6c3b369c0a9731f4952cb0821f307760f0422f77c5f0d3fe7df6b054643fb39423e8d70ee</sha512>
+                  </configuration>
+              </execution>
           </executions>
       </plugin>
     </plugins>

Added: pdfbox/branches/2.0/fontbox/src/test/java/org/apache/fontbox/pfb/PfbParserTest.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/fontbox/src/test/java/org/apache/fontbox/pfb/PfbParserTest.java?rev=1896738&view=auto
==============================================================================
--- pdfbox/branches/2.0/fontbox/src/test/java/org/apache/fontbox/pfb/PfbParserTest.java (added)
+++ pdfbox/branches/2.0/fontbox/src/test/java/org/apache/fontbox/pfb/PfbParserTest.java Thu Jan  6 07:27:30 2022
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.fontbox.pfb;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.apache.fontbox.encoding.BuiltInEncoding;
+import org.apache.fontbox.type1.Type1Font;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ *
+ * @author Tilman Hausherr
+ */
+public class PfbParserTest
+{
+    /**
+     * Test parsing a PFB font.
+     *
+     * @throws IOException 
+     */
+    @Test
+    public void testPfb() throws IOException
+    {
+        InputStream is = new FileInputStream("target/fonts/OpenSans-Regular.pfb");
+        Type1Font font = Type1Font.createWithPFB(is);
+        is.close();
+        Assert.assertEquals("1.10", font.getVersion());
+        Assert.assertEquals("OpenSans-Regular", font.getFontName());
+        Assert.assertEquals("Open Sans Regular", font.getFullName());
+        Assert.assertTrue(font.getEncoding() instanceof BuiltInEncoding);
+    }
+}

Propchange: pdfbox/branches/2.0/fontbox/src/test/java/org/apache/fontbox/pfb/PfbParserTest.java
------------------------------------------------------------------------------
    svn:eol-style = native