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:38 UTC
svn commit: r1896739 - in /pdfbox/trunk/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:38 2022
New Revision: 1896739
URL: http://svn.apache.org/viewvc?rev=1896739&view=rev
Log:
PDFBOX-5356: add test of PFB font
Added:
pdfbox/trunk/fontbox/src/test/java/org/apache/fontbox/pfb/
pdfbox/trunk/fontbox/src/test/java/org/apache/fontbox/pfb/PfbParserTest.java (with props)
Modified:
pdfbox/trunk/fontbox/pom.xml
Modified: pdfbox/trunk/fontbox/pom.xml
URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/pom.xml?rev=1896739&r1=1896738&r2=1896739&view=diff
==============================================================================
--- pdfbox/trunk/fontbox/pom.xml (original)
+++ pdfbox/trunk/fontbox/pom.xml Thu Jan 6 07:27:38 2022
@@ -1,133 +1,145 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.pdfbox</groupId>
- <artifactId>pdfbox-parent</artifactId>
- <version>3.0.0-SNAPSHOT</version>
- <relativePath>../parent/pom.xml</relativePath>
- </parent>
-
- <artifactId>fontbox</artifactId>
- <packaging>bundle</packaging>
-
- <name>Apache FontBox</name>
- <description>
- The Apache FontBox library is an open source Java tool to obtain low level information
- from font files. FontBox is a subproject of Apache PDFBox.
- </description>
-
- <inceptionYear>2008</inceptionYear>
- <url>http://pdfbox.apache.org/</url>
-
- <dependencies>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </dependency>
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter</artifactId>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Automatic-Module-Name>org.apache.fontbox</Automatic-Module-Name>
- </instructions>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.rat</groupId>
- <artifactId>apache-rat-plugin</artifactId>
- <configuration>
- <excludes>
- <exclude>src/main/resources/org/apache/fontbox/cmap/*</exclude>
- <exclude>src/main/resources/org/apache/fontbox/unicode/*</exclude>
- <exclude>src/test/resources/afm/*</exclude>
- </excludes>
- </configuration>
- </plugin>
- <!-- download test files from JIRA and keep them in repository cache -->
- <plugin>
- <groupId>com.googlecode.maven-download-plugin</groupId>
- <artifactId>download-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>PDFBOX-4038</id>
- <phase>generate-test-resources</phase>
- <goals>
- <goal>wget</goal>
- </goals>
- <configuration>
- <url>https://issues.apache.org/jira/secure/attachment/12684264/SourceSansProBold.otf</url>
- <outputDirectory>${project.build.directory}/pdfs</outputDirectory>
- <sha512>28a044a2685fbc8da7810d9ac7b6b93a95542d504d7d8e671f009b8ebb2f5b70c974be7ea78974b188d8e6ab17d65b08f276c054927857315d5aad26f6fe36fc</sha512>
- </configuration>
- </execution>
- <execution>
- <id>PDFBOX-3997</id>
- <phase>generate-test-resources</phase>
- <goals>
- <goal>wget</goal>
- </goals>
- <configuration>
- <url>https://issues.apache.org/jira/secure/attachment/12896461/NotoEmoji-Regular.ttf</url>
- <outputDirectory>${project.build.directory}/pdfs</outputDirectory>
- <sha512>51b01ab0794be9f92c59679f6d56d4ce09ed959daeb9ec945bb837eb15a82ab302e83b29aab1972ac9cb648f7196a5f5ff4488a4622b36bedbc9cd0cab6dc3de</sha512>
- </configuration>
- </execution>
- <execution>
- <id>PDFBOX-3379</id>
- <phase>generate-test-resources</phase>
- <goals>
- <goal>wget</goal>
- </goals>
- <configuration>
- <url>https://issues.apache.org/jira/secure/attachment/12809395/DejaVuSansMono.ttf</url>
- <outputDirectory>${project.build.directory}/pdfs</outputDirectory>
- <sha512>1af1ce3e6d34a0b89c93072d8646e92cceb45b276389d2dd0d84457ec1193394d2bcc49bf3ce99c9c6b2658cd1337fc40ee5c61957f74cd45dbc3d51b6aef417</sha512>
- </configuration>
- </execution>
- <execution>
- <id>PDFBOX-5328</id>
- <phase>generate-test-resources</phase>
- <goals>
- <goal>wget</goal>
- </goals>
- <configuration>
- <url>https://issues.apache.org/jira/secure/attachment/13036376/NotoSansSC-Regular.otf</url>
- <outputDirectory>${project.build.directory}/pdfs</outputDirectory>
- <sha512>cbdd317d16099d24736457eef631353c7830a1a3c132b01f2cdc1e6a0c21a78e3b1fe8479b3f40179e7630a15cc23a093775bb22d521dba39376bb367d497b21</sha512>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
-</project>
-
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.pdfbox</groupId>
+ <artifactId>pdfbox-parent</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ <relativePath>../parent/pom.xml</relativePath>
+ </parent>
+
+ <artifactId>fontbox</artifactId>
+ <packaging>bundle</packaging>
+
+ <name>Apache FontBox</name>
+ <description>
+ The Apache FontBox library is an open source Java tool to obtain low level information
+ from font files. FontBox is a subproject of Apache PDFBox.
+ </description>
+
+ <inceptionYear>2008</inceptionYear>
+ <url>http://pdfbox.apache.org/</url>
+
+ <dependencies>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Automatic-Module-Name>org.apache.fontbox</Automatic-Module-Name>
+ </instructions>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.rat</groupId>
+ <artifactId>apache-rat-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <exclude>src/main/resources/org/apache/fontbox/cmap/*</exclude>
+ <exclude>src/main/resources/org/apache/fontbox/unicode/*</exclude>
+ <exclude>src/test/resources/afm/*</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ <!-- download test files from JIRA and keep them in repository cache -->
+ <plugin>
+ <groupId>com.googlecode.maven-download-plugin</groupId>
+ <artifactId>download-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>PDFBOX-4038</id>
+ <phase>generate-test-resources</phase>
+ <goals>
+ <goal>wget</goal>
+ </goals>
+ <configuration>
+ <url>https://issues.apache.org/jira/secure/attachment/12684264/SourceSansProBold.otf</url>
+ <outputDirectory>${project.build.directory}/pdfs</outputDirectory>
+ <sha512>28a044a2685fbc8da7810d9ac7b6b93a95542d504d7d8e671f009b8ebb2f5b70c974be7ea78974b188d8e6ab17d65b08f276c054927857315d5aad26f6fe36fc</sha512>
+ </configuration>
+ </execution>
+ <execution>
+ <id>PDFBOX-3997</id>
+ <phase>generate-test-resources</phase>
+ <goals>
+ <goal>wget</goal>
+ </goals>
+ <configuration>
+ <url>https://issues.apache.org/jira/secure/attachment/12896461/NotoEmoji-Regular.ttf</url>
+ <outputDirectory>${project.build.directory}/pdfs</outputDirectory>
+ <sha512>51b01ab0794be9f92c59679f6d56d4ce09ed959daeb9ec945bb837eb15a82ab302e83b29aab1972ac9cb648f7196a5f5ff4488a4622b36bedbc9cd0cab6dc3de</sha512>
+ </configuration>
+ </execution>
+ <execution>
+ <id>PDFBOX-3379</id>
+ <phase>generate-test-resources</phase>
+ <goals>
+ <goal>wget</goal>
+ </goals>
+ <configuration>
+ <url>https://issues.apache.org/jira/secure/attachment/12809395/DejaVuSansMono.ttf</url>
+ <outputDirectory>${project.build.directory}/pdfs</outputDirectory>
+ <sha512>1af1ce3e6d34a0b89c93072d8646e92cceb45b276389d2dd0d84457ec1193394d2bcc49bf3ce99c9c6b2658cd1337fc40ee5c61957f74cd45dbc3d51b6aef417</sha512>
+ </configuration>
+ </execution>
+ <execution>
+ <id>PDFBOX-5328</id>
+ <phase>generate-test-resources</phase>
+ <goals>
+ <goal>wget</goal>
+ </goals>
+ <configuration>
+ <url>https://issues.apache.org/jira/secure/attachment/13036376/NotoSansSC-Regular.otf</url>
+ <outputDirectory>${project.build.directory}/pdfs</outputDirectory>
+ <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>
+ </build>
+
+</project>
+
Added: pdfbox/trunk/fontbox/src/test/java/org/apache/fontbox/pfb/PfbParserTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/src/test/java/org/apache/fontbox/pfb/PfbParserTest.java?rev=1896739&view=auto
==============================================================================
--- pdfbox/trunk/fontbox/src/test/java/org/apache/fontbox/pfb/PfbParserTest.java (added)
+++ pdfbox/trunk/fontbox/src/test/java/org/apache/fontbox/pfb/PfbParserTest.java Thu Jan 6 07:27:38 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.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+/**
+ *
+ * @author Tilman Hausherr
+ */
+class PfbParserTest
+{
+ /**
+ * Test parsing a PFB font.
+ *
+ * @throws IOException
+ */
+ @Test
+ void testPfb() throws IOException
+ {
+ InputStream is = new FileInputStream("target/fonts/OpenSans-Regular.pfb");
+ Type1Font font = Type1Font.createWithPFB(is);
+ is.close();
+ Assertions.assertEquals("1.10", font.getVersion());
+ Assertions.assertEquals("OpenSans-Regular", font.getFontName());
+ Assertions.assertEquals("Open Sans Regular", font.getFullName());
+ Assertions.assertTrue(font.getEncoding() instanceof BuiltInEncoding);
+ }
+}
Propchange: pdfbox/trunk/fontbox/src/test/java/org/apache/fontbox/pfb/PfbParserTest.java
------------------------------------------------------------------------------
svn:eol-style = native