diff options
author | Simon Steiner <ssteiner@apache.org> | 2020-07-21 13:34:17 +0000 |
---|---|---|
committer | Simon Steiner <ssteiner@apache.org> | 2020-07-21 13:34:17 +0000 |
commit | 2eb9e215bc94a28a5d8f1a1b06b5bf1fd37609f8 (patch) | |
tree | 6403f74eb92a5b6aff7478bbb042f3744a6c0cf4 | |
parent | c020f2f4678ec65ba9591b953faf73c5935c45f2 (diff) | |
download | xmlgraphics-fop-2eb9e215bc94a28a5d8f1a1b06b5bf1fd37609f8.tar.gz xmlgraphics-fop-2eb9e215bc94a28a5d8f1a1b06b5bf1fd37609f8.zip |
FOP-2958: Error when using both AFP truetype and base14 font
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1880107 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | fop-core/src/main/java/org/apache/fop/afp/modca/ActiveEnvironmentGroup.java | 8 | ||||
-rw-r--r-- | fop-core/src/test/java/org/apache/fop/render/afp/AFPTrueTypeTestCase.java | 13 |
2 files changed, 16 insertions, 5 deletions
diff --git a/fop-core/src/main/java/org/apache/fop/afp/modca/ActiveEnvironmentGroup.java b/fop-core/src/main/java/org/apache/fop/afp/modca/ActiveEnvironmentGroup.java index b635347ea..653229c93 100644 --- a/fop-core/src/main/java/org/apache/fop/afp/modca/ActiveEnvironmentGroup.java +++ b/fop-core/src/main/java/org/apache/fop/afp/modca/ActiveEnvironmentGroup.java @@ -283,10 +283,12 @@ public final class ActiveEnvironmentGroup extends AbstractEnvironmentGroup { private MapCodedFont getCurrentMapCodedFont() { int size = mapCodedFonts.size(); if (size > 0) { - return (MapCodedFont)mapCodedFonts.get(size - 1); - } else { - return null; + AbstractStructuredObject font = mapCodedFonts.get(size - 1); + if (font instanceof MapCodedFont) { + return (MapCodedFont) font; + } } + return null; } /** diff --git a/fop-core/src/test/java/org/apache/fop/render/afp/AFPTrueTypeTestCase.java b/fop-core/src/test/java/org/apache/fop/render/afp/AFPTrueTypeTestCase.java index ac3ef803c..f7980ac4e 100644 --- a/fop-core/src/test/java/org/apache/fop/render/afp/AFPTrueTypeTestCase.java +++ b/fop-core/src/test/java/org/apache/fop/render/afp/AFPTrueTypeTestCase.java @@ -82,6 +82,7 @@ public class AFPTrueTypeTestCase { + " <fo:page-sequence master-reference=\"simple\">\n" + " <fo:flow flow-name=\"xsl-region-body\">\n" + " <fo:block font-family=\"Univers\">Univers</fo:block>\n" + + " <fo:block font-family=\"Times\">Times</fo:block>\n" + " </fo:flow>\n" + " </fo:page-sequence>\n" + "</fo:root>"; @@ -99,8 +100,10 @@ public class AFPTrueTypeTestCase { + "BEGIN PAGE_GROUP PGP00001\n" + "BEGIN PAGE PGN00001\n" + "BEGIN ACTIVE_ENVIRONMENT_GROUP AEG00001\n" - + "MAP DATA_RESOURCE Triplets: 0x01,FULLY_QUALIFIED_NAME,FULLY_QUALIFIED_NAME" - + ",OBJECT_CLASSIFICATION,DATA_OBJECT_FONT_DESCRIPTOR,\n" + + "MAP DATA_RESOURCE Triplets: 0x01,FULLY_QUALIFIED_NAME,FULLY_QUALIFIED_NAME,OBJECT_CLASSIFICATION," + + "DATA_OBJECT_FONT_DESCRIPTOR,\n" + + "MAP CODED_FONT Triplets: FULLY_QUALIFIED_NAME,FULLY_QUALIFIED_NAME,CHARACTER_ROTATION," + + "RESOURCE_LOCAL_IDENTIFIER,\n" + "DESCRIPTOR PAGE\n" + "MIGRATION PRESENTATION_TEXT\n" + "END ACTIVE_ENVIRONMENT_GROUP AEG00001\n" @@ -164,6 +167,12 @@ public class AFPTrueTypeTestCase { + " <font-triplet name=\"Univers\" style=\"normal\" weight=\"normal\"/>\n" + " <font-triplet name=\"any\" style=\"normal\" weight=\"normal\"/>\n" + " </font>\n" + + " <font>\n" + + " <afp-font name=\"Times Roman\" type=\"raster\" codepage=\"T1V10500\" encoding=\"Cp500\">\n" + + " <afp-raster-font size=\"12\" characterset=\"C0N200B0\" base14-font=\"TimesRoman\"/>\n" + + " </afp-font>\n" + + " <font-triplet name=\"Times\" style=\"normal\" weight=\"normal\"/>\n" + + " </font>" + " </fonts>\n" + " </renderer>\n" + " </renderers>\n" |