diff options
-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" |