Author: ssteiner
Date: Mon Nov 27 10:43:26 2017
New Revision: 1816422
URL: http://svn.apache.org/viewvc?rev=1816422&view=rev
Log:
FOP-2759: NPE converting OTF to Type1
Modified:
xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/fonts/truetype/OFFontLoader.java
xmlgraphics/fop/trunk/fop-core/src/test/java/org/apache/fop/fonts/truetype/OTFToType1TestCase.java
Modified:
xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/fonts/truetype/OFFontLoader.java
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/fonts/truetype/OFFontLoader.java?rev=1816422&r1=1816421&r2=1816422&view=diff
==============================================================================
---
xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/fonts/truetype/OFFontLoader.java
(original)
+++
xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/fonts/truetype/OFFontLoader.java
Mon Nov 27 10:43:26 2017
@@ -182,7 +182,7 @@ public class OFFontLoader extends FontLo
returnFont.setWeight(otf.getWeightClass());
if (isCid) {
if (otf instanceof OTFFile) {
- if (((OTFFile) otf).isType1() && embeddingMode ==
EmbeddingMode.SUBSET) {
+ if (((OTFFile) otf).isType1() && embeddingMode ==
EmbeddingMode.SUBSET && !embedAsType1) {
multiFont.setFontType(FontType.TYPE1C);
copyGlyphMetricsSingleByte(otf);
}
Modified:
xmlgraphics/fop/trunk/fop-core/src/test/java/org/apache/fop/fonts/truetype/OTFToType1TestCase.java
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/fop-core/src/test/java/org/apache/fop/fonts/truetype/OTFToType1TestCase.java?rev=1816422&r1=1816421&r2=1816422&view=diff
==============================================================================
---
xmlgraphics/fop/trunk/fop-core/src/test/java/org/apache/fop/fonts/truetype/OTFToType1TestCase.java
(original)
+++
xmlgraphics/fop/trunk/fop-core/src/test/java/org/apache/fop/fonts/truetype/OTFToType1TestCase.java
Mon Nov 27 10:43:26 2017
@@ -34,6 +34,7 @@ import org.apache.fop.fonts.CustomFont;
import org.apache.fop.fonts.EmbeddingMode;
import org.apache.fop.fonts.EncodingMode;
import org.apache.fop.fonts.FontLoader;
+import org.apache.fop.fonts.FontType;
import org.apache.fop.fonts.FontUris;
public class OTFToType1TestCase {
@@ -47,13 +48,23 @@ public class OTFToType1TestCase {
Assert.assertEquals(t1.getFontName(), "AlexBrush-Regular.0");
}
+ @Test
+ public void testFontType() throws IOException {
+ CustomFont t1 =
getRealFont("test/resources/fonts/otf/SourceSansProBold.otf");
+ Assert.assertEquals(t1.getFontType(), FontType.TYPE1);
+ }
+
private Type1Font getFont(String s) throws IOException {
+ InputStream is =
((CFFToType1Font)getRealFont(s)).getInputStreams().get(0);
+ return Type1Font.createWithPFB(is);
+ }
+
+ private CustomFont getRealFont(String s) throws IOException {
InternalResourceResolver rr =
ResourceResolverFactory.createDefaultInternalResourceResolver(
new File(".").toURI());
CustomFont realFont = FontLoader.loadFont(new FontUris(new
File(s).toURI(), null), null, true,
EmbeddingMode.SUBSET, EncodingMode.AUTO, true, true, rr,
false, true);
realFont.mapChar('d');
- InputStream is = ((CFFToType1Font)realFont).getInputStreams().get(0);
- return Type1Font.createWithPFB(is);
+ return realFont;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]