From 2eb9e215bc94a28a5d8f1a1b06b5bf1fd37609f8 Mon Sep 17 00:00:00 2001 From: Simon Steiner Date: Tue, 21 Jul 2020 13:34:17 +0000 Subject: 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 --- .../org/apache/fop/afp/modca/ActiveEnvironmentGroup.java | 8 +++++--- .../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 { + " \n" + " \n" + " Univers\n" + + " Times\n" + " \n" + " \n" + ""; @@ -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 { + " \n" + " \n" + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " " + " \n" + " \n" + " \n" -- cgit v1.2.3