diff options
author | Glenn Adams <gadams@apache.org> | 2016-03-03 09:49:26 +0000 |
---|---|---|
committer | Glenn Adams <gadams@apache.org> | 2016-03-03 09:49:26 +0000 |
commit | c8cde713f54ca731f4a7f3bfaef8af9e8a1b9262 (patch) | |
tree | f553e13b28bd90fd2067bf390509f9290260d330 /src | |
parent | 82804d6ffcb68841cd7adf9740469f3a79c372c8 (diff) | |
download | xmlgraphics-fop-c8cde713f54ca731f4a7f3bfaef8af9e8a1b9262.tar.gz xmlgraphics-fop-c8cde713f54ca731f4a7f3bfaef8af9e8a1b9262.zip |
Transition source to standard maven hierarchy (initial).
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/maven@1733433 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
2717 files changed, 53303 insertions, 0 deletions
diff --git a/src/java/META-INF/services/org.apache.fop.events.EventExceptionManager$ExceptionFactory b/src/main/java/META-INF/services/org.apache.fop.events.EventExceptionManager$ExceptionFactory index 13540a4db..13540a4db 100644 --- a/src/java/META-INF/services/org.apache.fop.events.EventExceptionManager$ExceptionFactory +++ b/src/main/java/META-INF/services/org.apache.fop.events.EventExceptionManager$ExceptionFactory diff --git a/src/java/META-INF/services/org.apache.fop.fo.ElementMapping b/src/main/java/META-INF/services/org.apache.fop.fo.ElementMapping index 6f4374a93..6f4374a93 100644 --- a/src/java/META-INF/services/org.apache.fop.fo.ElementMapping +++ b/src/main/java/META-INF/services/org.apache.fop.fo.ElementMapping diff --git a/src/java/META-INF/services/org.apache.fop.fo.FOEventHandler b/src/main/java/META-INF/services/org.apache.fop.fo.FOEventHandler index fdd42f993..fdd42f993 100644 --- a/src/java/META-INF/services/org.apache.fop.fo.FOEventHandler +++ b/src/main/java/META-INF/services/org.apache.fop.fo.FOEventHandler diff --git a/src/java/META-INF/services/org.apache.fop.render.ImageHandler b/src/main/java/META-INF/services/org.apache.fop.render.ImageHandler index 9066913ad..9066913ad 100644 --- a/src/java/META-INF/services/org.apache.fop.render.ImageHandler +++ b/src/main/java/META-INF/services/org.apache.fop.render.ImageHandler diff --git a/src/java/META-INF/services/org.apache.fop.render.Renderer b/src/main/java/META-INF/services/org.apache.fop.render.Renderer index 2bf59a805..2bf59a805 100644 --- a/src/java/META-INF/services/org.apache.fop.render.Renderer +++ b/src/main/java/META-INF/services/org.apache.fop.render.Renderer diff --git a/src/java/META-INF/services/org.apache.fop.render.XMLHandler b/src/main/java/META-INF/services/org.apache.fop.render.XMLHandler index e6dbdbd18..e6dbdbd18 100644 --- a/src/java/META-INF/services/org.apache.fop.render.XMLHandler +++ b/src/main/java/META-INF/services/org.apache.fop.render.XMLHandler diff --git a/src/java/META-INF/services/org.apache.fop.render.intermediate.IFDocumentHandler b/src/main/java/META-INF/services/org.apache.fop.render.intermediate.IFDocumentHandler index 8364155b6..8364155b6 100644 --- a/src/java/META-INF/services/org.apache.fop.render.intermediate.IFDocumentHandler +++ b/src/main/java/META-INF/services/org.apache.fop.render.intermediate.IFDocumentHandler diff --git a/src/java/META-INF/services/org.apache.fop.util.ContentHandlerFactory b/src/main/java/META-INF/services/org.apache.fop.util.ContentHandlerFactory index cabf917eb..cabf917eb 100644 --- a/src/java/META-INF/services/org.apache.fop.util.ContentHandlerFactory +++ b/src/main/java/META-INF/services/org.apache.fop.util.ContentHandlerFactory diff --git a/src/java/META-INF/services/org.apache.fop.util.text.AdvancedMessageFormat$Function b/src/main/java/META-INF/services/org.apache.fop.util.text.AdvancedMessageFormat$Function index 375130f2a..375130f2a 100644 --- a/src/java/META-INF/services/org.apache.fop.util.text.AdvancedMessageFormat$Function +++ b/src/main/java/META-INF/services/org.apache.fop.util.text.AdvancedMessageFormat$Function diff --git a/src/java/META-INF/services/org.apache.fop.util.text.AdvancedMessageFormat$ObjectFormatter b/src/main/java/META-INF/services/org.apache.fop.util.text.AdvancedMessageFormat$ObjectFormatter index 9e3860b31..9e3860b31 100644 --- a/src/java/META-INF/services/org.apache.fop.util.text.AdvancedMessageFormat$ObjectFormatter +++ b/src/main/java/META-INF/services/org.apache.fop.util.text.AdvancedMessageFormat$ObjectFormatter diff --git a/src/java/META-INF/services/org.apache.fop.util.text.AdvancedMessageFormat$PartFactory b/src/main/java/META-INF/services/org.apache.fop.util.text.AdvancedMessageFormat$PartFactory index 1647fb8d5..1647fb8d5 100644 --- a/src/java/META-INF/services/org.apache.fop.util.text.AdvancedMessageFormat$PartFactory +++ b/src/main/java/META-INF/services/org.apache.fop.util.text.AdvancedMessageFormat$PartFactory diff --git a/src/java/META-INF/services/org.apache.xmlgraphics.image.loader.spi.ImageConverter b/src/main/java/META-INF/services/org.apache.xmlgraphics.image.loader.spi.ImageConverter index 045f6515f..045f6515f 100644 --- a/src/java/META-INF/services/org.apache.xmlgraphics.image.loader.spi.ImageConverter +++ b/src/main/java/META-INF/services/org.apache.xmlgraphics.image.loader.spi.ImageConverter diff --git a/src/java/META-INF/services/org.apache.xmlgraphics.image.loader.spi.ImageLoaderFactory b/src/main/java/META-INF/services/org.apache.xmlgraphics.image.loader.spi.ImageLoaderFactory index 9e0bd6048..9e0bd6048 100644 --- a/src/java/META-INF/services/org.apache.xmlgraphics.image.loader.spi.ImageLoaderFactory +++ b/src/main/java/META-INF/services/org.apache.xmlgraphics.image.loader.spi.ImageLoaderFactory diff --git a/src/java/META-INF/services/org.apache.xmlgraphics.image.loader.spi.ImagePreloader b/src/main/java/META-INF/services/org.apache.xmlgraphics.image.loader.spi.ImagePreloader index 5644f2259..5644f2259 100644 --- a/src/java/META-INF/services/org.apache.xmlgraphics.image.loader.spi.ImagePreloader +++ b/src/main/java/META-INF/services/org.apache.xmlgraphics.image.loader.spi.ImagePreloader diff --git a/src/java/org/apache/fop/ResourceEventProducer.java b/src/main/java/org/apache/fop/ResourceEventProducer.java index 994656287..994656287 100644 --- a/src/java/org/apache/fop/ResourceEventProducer.java +++ b/src/main/java/org/apache/fop/ResourceEventProducer.java diff --git a/src/java/org/apache/fop/ResourceEventProducer.xml b/src/main/java/org/apache/fop/ResourceEventProducer.xml index d9b337dae..d9b337dae 100644 --- a/src/java/org/apache/fop/ResourceEventProducer.xml +++ b/src/main/java/org/apache/fop/ResourceEventProducer.xml diff --git a/src/java/org/apache/fop/Version.java b/src/main/java/org/apache/fop/Version.java index a8903c74e..a8903c74e 100644 --- a/src/java/org/apache/fop/Version.java +++ b/src/main/java/org/apache/fop/Version.java diff --git a/src/java/org/apache/fop/accessibility/Accessibility.java b/src/main/java/org/apache/fop/accessibility/Accessibility.java index 88ec6dbdd..88ec6dbdd 100644 --- a/src/java/org/apache/fop/accessibility/Accessibility.java +++ b/src/main/java/org/apache/fop/accessibility/Accessibility.java diff --git a/src/java/org/apache/fop/accessibility/AccessibilityEventProducer.java b/src/main/java/org/apache/fop/accessibility/AccessibilityEventProducer.java index 50430dd19..50430dd19 100644 --- a/src/java/org/apache/fop/accessibility/AccessibilityEventProducer.java +++ b/src/main/java/org/apache/fop/accessibility/AccessibilityEventProducer.java diff --git a/src/java/org/apache/fop/accessibility/AccessibilityEventProducer.xml b/src/main/java/org/apache/fop/accessibility/AccessibilityEventProducer.xml index bb76a95a1..bb76a95a1 100644 --- a/src/java/org/apache/fop/accessibility/AccessibilityEventProducer.xml +++ b/src/main/java/org/apache/fop/accessibility/AccessibilityEventProducer.xml diff --git a/src/java/org/apache/fop/accessibility/DummyStructureTreeEventHandler.java b/src/main/java/org/apache/fop/accessibility/DummyStructureTreeEventHandler.java index be1177635..be1177635 100644 --- a/src/java/org/apache/fop/accessibility/DummyStructureTreeEventHandler.java +++ b/src/main/java/org/apache/fop/accessibility/DummyStructureTreeEventHandler.java diff --git a/src/java/org/apache/fop/accessibility/StructureTree2SAXEventAdapter.java b/src/main/java/org/apache/fop/accessibility/StructureTree2SAXEventAdapter.java index 0b8073e57..0b8073e57 100644 --- a/src/java/org/apache/fop/accessibility/StructureTree2SAXEventAdapter.java +++ b/src/main/java/org/apache/fop/accessibility/StructureTree2SAXEventAdapter.java diff --git a/src/java/org/apache/fop/accessibility/StructureTreeElement.java b/src/main/java/org/apache/fop/accessibility/StructureTreeElement.java index ebed2c8ff..ebed2c8ff 100644 --- a/src/java/org/apache/fop/accessibility/StructureTreeElement.java +++ b/src/main/java/org/apache/fop/accessibility/StructureTreeElement.java diff --git a/src/java/org/apache/fop/accessibility/StructureTreeEventHandler.java b/src/main/java/org/apache/fop/accessibility/StructureTreeEventHandler.java index 53c27130c..53c27130c 100644 --- a/src/java/org/apache/fop/accessibility/StructureTreeEventHandler.java +++ b/src/main/java/org/apache/fop/accessibility/StructureTreeEventHandler.java diff --git a/src/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverter.java b/src/main/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverter.java index 4614a7005..4614a7005 100644 --- a/src/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverter.java +++ b/src/main/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverter.java diff --git a/src/java/org/apache/fop/accessibility/fo/StructureTreeEventTrigger.java b/src/main/java/org/apache/fop/accessibility/fo/StructureTreeEventTrigger.java index 8def8a4d4..8def8a4d4 100644 --- a/src/java/org/apache/fop/accessibility/fo/StructureTreeEventTrigger.java +++ b/src/main/java/org/apache/fop/accessibility/fo/StructureTreeEventTrigger.java diff --git a/src/java/org/apache/fop/afp/AFPBorderPainter.java b/src/main/java/org/apache/fop/afp/AFPBorderPainter.java index f80a269a2..f80a269a2 100644 --- a/src/java/org/apache/fop/afp/AFPBorderPainter.java +++ b/src/main/java/org/apache/fop/afp/AFPBorderPainter.java diff --git a/src/java/org/apache/fop/afp/AFPConstants.java b/src/main/java/org/apache/fop/afp/AFPConstants.java index 49b671e66..49b671e66 100644 --- a/src/java/org/apache/fop/afp/AFPConstants.java +++ b/src/main/java/org/apache/fop/afp/AFPConstants.java diff --git a/src/java/org/apache/fop/afp/AFPDataObjectFactory.java b/src/main/java/org/apache/fop/afp/AFPDataObjectFactory.java index 17114ebbe..17114ebbe 100644 --- a/src/java/org/apache/fop/afp/AFPDataObjectFactory.java +++ b/src/main/java/org/apache/fop/afp/AFPDataObjectFactory.java diff --git a/src/java/org/apache/fop/afp/AFPDataObjectInfo.java b/src/main/java/org/apache/fop/afp/AFPDataObjectInfo.java index b93056f02..b93056f02 100644 --- a/src/java/org/apache/fop/afp/AFPDataObjectInfo.java +++ b/src/main/java/org/apache/fop/afp/AFPDataObjectInfo.java diff --git a/src/java/org/apache/fop/afp/AFPDitheredRectanglePainter.java b/src/main/java/org/apache/fop/afp/AFPDitheredRectanglePainter.java index a953718bd..a953718bd 100644 --- a/src/java/org/apache/fop/afp/AFPDitheredRectanglePainter.java +++ b/src/main/java/org/apache/fop/afp/AFPDitheredRectanglePainter.java diff --git a/src/java/org/apache/fop/afp/AFPEventProducer.java b/src/main/java/org/apache/fop/afp/AFPEventProducer.java index 58f3855b2..58f3855b2 100644 --- a/src/java/org/apache/fop/afp/AFPEventProducer.java +++ b/src/main/java/org/apache/fop/afp/AFPEventProducer.java diff --git a/src/java/org/apache/fop/afp/AFPEventProducer.xml b/src/main/java/org/apache/fop/afp/AFPEventProducer.xml index e17a4ea40..e17a4ea40 100644 --- a/src/java/org/apache/fop/afp/AFPEventProducer.xml +++ b/src/main/java/org/apache/fop/afp/AFPEventProducer.xml diff --git a/src/java/org/apache/fop/afp/AFPGraphics2D.java b/src/main/java/org/apache/fop/afp/AFPGraphics2D.java index f6db94458..f6db94458 100644 --- a/src/java/org/apache/fop/afp/AFPGraphics2D.java +++ b/src/main/java/org/apache/fop/afp/AFPGraphics2D.java diff --git a/src/java/org/apache/fop/afp/AFPGraphicsObjectInfo.java b/src/main/java/org/apache/fop/afp/AFPGraphicsObjectInfo.java index cd8c7c303..cd8c7c303 100644 --- a/src/java/org/apache/fop/afp/AFPGraphicsObjectInfo.java +++ b/src/main/java/org/apache/fop/afp/AFPGraphicsObjectInfo.java diff --git a/src/java/org/apache/fop/afp/AFPImageObjectInfo.java b/src/main/java/org/apache/fop/afp/AFPImageObjectInfo.java index 4a08d865d..4a08d865d 100644 --- a/src/java/org/apache/fop/afp/AFPImageObjectInfo.java +++ b/src/main/java/org/apache/fop/afp/AFPImageObjectInfo.java diff --git a/src/java/org/apache/fop/afp/AFPLineDataInfo.java b/src/main/java/org/apache/fop/afp/AFPLineDataInfo.java index a0fddb6db..a0fddb6db 100644 --- a/src/java/org/apache/fop/afp/AFPLineDataInfo.java +++ b/src/main/java/org/apache/fop/afp/AFPLineDataInfo.java diff --git a/src/java/org/apache/fop/afp/AFPObjectAreaInfo.java b/src/main/java/org/apache/fop/afp/AFPObjectAreaInfo.java index 1ecffc2df..1ecffc2df 100644 --- a/src/java/org/apache/fop/afp/AFPObjectAreaInfo.java +++ b/src/main/java/org/apache/fop/afp/AFPObjectAreaInfo.java diff --git a/src/java/org/apache/fop/afp/AFPPaintingState.java b/src/main/java/org/apache/fop/afp/AFPPaintingState.java index 349ecc2dc..349ecc2dc 100644 --- a/src/java/org/apache/fop/afp/AFPPaintingState.java +++ b/src/main/java/org/apache/fop/afp/AFPPaintingState.java diff --git a/src/java/org/apache/fop/afp/AFPRectanglePainter.java b/src/main/java/org/apache/fop/afp/AFPRectanglePainter.java index 8b598008a..8b598008a 100644 --- a/src/java/org/apache/fop/afp/AFPRectanglePainter.java +++ b/src/main/java/org/apache/fop/afp/AFPRectanglePainter.java diff --git a/src/java/org/apache/fop/afp/AFPResourceInfo.java b/src/main/java/org/apache/fop/afp/AFPResourceInfo.java index 548f871c2..548f871c2 100644 --- a/src/java/org/apache/fop/afp/AFPResourceInfo.java +++ b/src/main/java/org/apache/fop/afp/AFPResourceInfo.java diff --git a/src/java/org/apache/fop/afp/AFPResourceLevel.java b/src/main/java/org/apache/fop/afp/AFPResourceLevel.java index 8516521bb..8516521bb 100644 --- a/src/java/org/apache/fop/afp/AFPResourceLevel.java +++ b/src/main/java/org/apache/fop/afp/AFPResourceLevel.java diff --git a/src/java/org/apache/fop/afp/AFPResourceLevelDefaults.java b/src/main/java/org/apache/fop/afp/AFPResourceLevelDefaults.java index aea97cb7d..aea97cb7d 100644 --- a/src/java/org/apache/fop/afp/AFPResourceLevelDefaults.java +++ b/src/main/java/org/apache/fop/afp/AFPResourceLevelDefaults.java diff --git a/src/java/org/apache/fop/afp/AFPResourceManager.java b/src/main/java/org/apache/fop/afp/AFPResourceManager.java index f5910d7d9..f5910d7d9 100644 --- a/src/java/org/apache/fop/afp/AFPResourceManager.java +++ b/src/main/java/org/apache/fop/afp/AFPResourceManager.java diff --git a/src/java/org/apache/fop/afp/AFPStreamer.java b/src/main/java/org/apache/fop/afp/AFPStreamer.java index 6a4ce41f8..6a4ce41f8 100644 --- a/src/java/org/apache/fop/afp/AFPStreamer.java +++ b/src/main/java/org/apache/fop/afp/AFPStreamer.java diff --git a/src/java/org/apache/fop/afp/AFPTextDataInfo.java b/src/main/java/org/apache/fop/afp/AFPTextDataInfo.java index 51cb20b04..51cb20b04 100644 --- a/src/java/org/apache/fop/afp/AFPTextDataInfo.java +++ b/src/main/java/org/apache/fop/afp/AFPTextDataInfo.java diff --git a/src/java/org/apache/fop/afp/AFPUnitConverter.java b/src/main/java/org/apache/fop/afp/AFPUnitConverter.java index 3195ba70f..3195ba70f 100644 --- a/src/java/org/apache/fop/afp/AFPUnitConverter.java +++ b/src/main/java/org/apache/fop/afp/AFPUnitConverter.java diff --git a/src/java/org/apache/fop/afp/AbstractAFPPainter.java b/src/main/java/org/apache/fop/afp/AbstractAFPPainter.java index a2a128be5..a2a128be5 100644 --- a/src/java/org/apache/fop/afp/AbstractAFPPainter.java +++ b/src/main/java/org/apache/fop/afp/AbstractAFPPainter.java diff --git a/src/java/org/apache/fop/afp/BorderPaintingInfo.java b/src/main/java/org/apache/fop/afp/BorderPaintingInfo.java index 4917c7bc0..4917c7bc0 100644 --- a/src/java/org/apache/fop/afp/BorderPaintingInfo.java +++ b/src/main/java/org/apache/fop/afp/BorderPaintingInfo.java diff --git a/src/java/org/apache/fop/afp/Completable.java b/src/main/java/org/apache/fop/afp/Completable.java index e1fc764dd..e1fc764dd 100644 --- a/src/java/org/apache/fop/afp/Completable.java +++ b/src/main/java/org/apache/fop/afp/Completable.java diff --git a/src/java/org/apache/fop/afp/DataStream.java b/src/main/java/org/apache/fop/afp/DataStream.java index e9e574a6f..e9e574a6f 100644 --- a/src/java/org/apache/fop/afp/DataStream.java +++ b/src/main/java/org/apache/fop/afp/DataStream.java diff --git a/src/java/org/apache/fop/afp/Factory.java b/src/main/java/org/apache/fop/afp/Factory.java index 00816e4b5..00816e4b5 100644 --- a/src/java/org/apache/fop/afp/Factory.java +++ b/src/main/java/org/apache/fop/afp/Factory.java diff --git a/src/java/org/apache/fop/afp/GrayScaleColorConverter.java b/src/main/java/org/apache/fop/afp/GrayScaleColorConverter.java index c7daf20c6..c7daf20c6 100644 --- a/src/java/org/apache/fop/afp/GrayScaleColorConverter.java +++ b/src/main/java/org/apache/fop/afp/GrayScaleColorConverter.java diff --git a/src/java/org/apache/fop/afp/PaintingInfo.java b/src/main/java/org/apache/fop/afp/PaintingInfo.java index e53f28306..e53f28306 100644 --- a/src/java/org/apache/fop/afp/PaintingInfo.java +++ b/src/main/java/org/apache/fop/afp/PaintingInfo.java diff --git a/src/java/org/apache/fop/afp/RectanglePaintingInfo.java b/src/main/java/org/apache/fop/afp/RectanglePaintingInfo.java index 64503d0b8..64503d0b8 100644 --- a/src/java/org/apache/fop/afp/RectanglePaintingInfo.java +++ b/src/main/java/org/apache/fop/afp/RectanglePaintingInfo.java diff --git a/src/java/org/apache/fop/afp/Startable.java b/src/main/java/org/apache/fop/afp/Startable.java index 62995d4d5..62995d4d5 100644 --- a/src/java/org/apache/fop/afp/Startable.java +++ b/src/main/java/org/apache/fop/afp/Startable.java diff --git a/src/java/org/apache/fop/afp/Streamable.java b/src/main/java/org/apache/fop/afp/Streamable.java index cd731ab47..cd731ab47 100644 --- a/src/java/org/apache/fop/afp/Streamable.java +++ b/src/main/java/org/apache/fop/afp/Streamable.java diff --git a/src/java/org/apache/fop/afp/StructuredData.java b/src/main/java/org/apache/fop/afp/StructuredData.java index 4b9deedf7..4b9deedf7 100644 --- a/src/java/org/apache/fop/afp/StructuredData.java +++ b/src/main/java/org/apache/fop/afp/StructuredData.java diff --git a/src/java/org/apache/fop/afp/apps/FontPatternExtractor.java b/src/main/java/org/apache/fop/afp/apps/FontPatternExtractor.java index 478c7dcd7..478c7dcd7 100644 --- a/src/java/org/apache/fop/afp/apps/FontPatternExtractor.java +++ b/src/main/java/org/apache/fop/afp/apps/FontPatternExtractor.java diff --git a/src/java/org/apache/fop/afp/fonts/AFPBase12FontCollection.java b/src/main/java/org/apache/fop/afp/fonts/AFPBase12FontCollection.java index 2d7dd3694..2d7dd3694 100644 --- a/src/java/org/apache/fop/afp/fonts/AFPBase12FontCollection.java +++ b/src/main/java/org/apache/fop/afp/fonts/AFPBase12FontCollection.java diff --git a/src/java/org/apache/fop/afp/fonts/AFPFont.java b/src/main/java/org/apache/fop/afp/fonts/AFPFont.java index 720914bf4..720914bf4 100644 --- a/src/java/org/apache/fop/afp/fonts/AFPFont.java +++ b/src/main/java/org/apache/fop/afp/fonts/AFPFont.java diff --git a/src/java/org/apache/fop/afp/fonts/AFPFontAttributes.java b/src/main/java/org/apache/fop/afp/fonts/AFPFontAttributes.java index de7f7f5be..de7f7f5be 100644 --- a/src/java/org/apache/fop/afp/fonts/AFPFontAttributes.java +++ b/src/main/java/org/apache/fop/afp/fonts/AFPFontAttributes.java diff --git a/src/java/org/apache/fop/afp/fonts/AFPFontCollection.java b/src/main/java/org/apache/fop/afp/fonts/AFPFontCollection.java index 0854d04a1..0854d04a1 100644 --- a/src/java/org/apache/fop/afp/fonts/AFPFontCollection.java +++ b/src/main/java/org/apache/fop/afp/fonts/AFPFontCollection.java diff --git a/src/java/org/apache/fop/afp/fonts/AFPFontInfo.java b/src/main/java/org/apache/fop/afp/fonts/AFPFontInfo.java index 8e865d4e5..8e865d4e5 100644 --- a/src/java/org/apache/fop/afp/fonts/AFPFontInfo.java +++ b/src/main/java/org/apache/fop/afp/fonts/AFPFontInfo.java diff --git a/src/java/org/apache/fop/afp/fonts/AFPPageFonts.java b/src/main/java/org/apache/fop/afp/fonts/AFPPageFonts.java index 2d1fec1ab..2d1fec1ab 100644 --- a/src/java/org/apache/fop/afp/fonts/AFPPageFonts.java +++ b/src/main/java/org/apache/fop/afp/fonts/AFPPageFonts.java diff --git a/src/java/org/apache/fop/afp/fonts/AbstractOutlineFont.java b/src/main/java/org/apache/fop/afp/fonts/AbstractOutlineFont.java index 2eaedc0c3..2eaedc0c3 100644 --- a/src/java/org/apache/fop/afp/fonts/AbstractOutlineFont.java +++ b/src/main/java/org/apache/fop/afp/fonts/AbstractOutlineFont.java diff --git a/src/java/org/apache/fop/afp/fonts/CharacterSet.java b/src/main/java/org/apache/fop/afp/fonts/CharacterSet.java index 593b40592..593b40592 100644 --- a/src/java/org/apache/fop/afp/fonts/CharacterSet.java +++ b/src/main/java/org/apache/fop/afp/fonts/CharacterSet.java diff --git a/src/java/org/apache/fop/afp/fonts/CharacterSetBuilder.java b/src/main/java/org/apache/fop/afp/fonts/CharacterSetBuilder.java index 39d2be845..39d2be845 100644 --- a/src/java/org/apache/fop/afp/fonts/CharacterSetBuilder.java +++ b/src/main/java/org/apache/fop/afp/fonts/CharacterSetBuilder.java diff --git a/src/java/org/apache/fop/afp/fonts/CharacterSetOrientation.java b/src/main/java/org/apache/fop/afp/fonts/CharacterSetOrientation.java index 6860e93a8..6860e93a8 100644 --- a/src/java/org/apache/fop/afp/fonts/CharacterSetOrientation.java +++ b/src/main/java/org/apache/fop/afp/fonts/CharacterSetOrientation.java diff --git a/src/java/org/apache/fop/afp/fonts/CharacterSetType.java b/src/main/java/org/apache/fop/afp/fonts/CharacterSetType.java index 060d949ac..060d949ac 100644 --- a/src/java/org/apache/fop/afp/fonts/CharacterSetType.java +++ b/src/main/java/org/apache/fop/afp/fonts/CharacterSetType.java diff --git a/src/java/org/apache/fop/afp/fonts/CharactersetEncoder.java b/src/main/java/org/apache/fop/afp/fonts/CharactersetEncoder.java index 983c308cd..983c308cd 100644 --- a/src/java/org/apache/fop/afp/fonts/CharactersetEncoder.java +++ b/src/main/java/org/apache/fop/afp/fonts/CharactersetEncoder.java diff --git a/src/java/org/apache/fop/afp/fonts/DoubleByteFont.java b/src/main/java/org/apache/fop/afp/fonts/DoubleByteFont.java index b023b48a6..b023b48a6 100644 --- a/src/java/org/apache/fop/afp/fonts/DoubleByteFont.java +++ b/src/main/java/org/apache/fop/afp/fonts/DoubleByteFont.java diff --git a/src/java/org/apache/fop/afp/fonts/FontRuntimeException.java b/src/main/java/org/apache/fop/afp/fonts/FontRuntimeException.java index 20bbc9d5b..20bbc9d5b 100644 --- a/src/java/org/apache/fop/afp/fonts/FontRuntimeException.java +++ b/src/main/java/org/apache/fop/afp/fonts/FontRuntimeException.java diff --git a/src/java/org/apache/fop/afp/fonts/FopCharacterSet.java b/src/main/java/org/apache/fop/afp/fonts/FopCharacterSet.java index 9d53cc7ea..9d53cc7ea 100644 --- a/src/java/org/apache/fop/afp/fonts/FopCharacterSet.java +++ b/src/main/java/org/apache/fop/afp/fonts/FopCharacterSet.java diff --git a/src/java/org/apache/fop/afp/fonts/IntegerKeyStore.java b/src/main/java/org/apache/fop/afp/fonts/IntegerKeyStore.java index 7e73b5b9f..7e73b5b9f 100644 --- a/src/java/org/apache/fop/afp/fonts/IntegerKeyStore.java +++ b/src/main/java/org/apache/fop/afp/fonts/IntegerKeyStore.java diff --git a/src/java/org/apache/fop/afp/fonts/OutlineFont.java b/src/main/java/org/apache/fop/afp/fonts/OutlineFont.java index fc2332ce9..fc2332ce9 100644 --- a/src/java/org/apache/fop/afp/fonts/OutlineFont.java +++ b/src/main/java/org/apache/fop/afp/fonts/OutlineFont.java diff --git a/src/java/org/apache/fop/afp/fonts/RasterFont.java b/src/main/java/org/apache/fop/afp/fonts/RasterFont.java index b587ef3cd..b587ef3cd 100644 --- a/src/java/org/apache/fop/afp/fonts/RasterFont.java +++ b/src/main/java/org/apache/fop/afp/fonts/RasterFont.java diff --git a/src/java/org/apache/fop/afp/fonts/package.html b/src/main/java/org/apache/fop/afp/fonts/package.html index 74f8bf450..74f8bf450 100644 --- a/src/java/org/apache/fop/afp/fonts/package.html +++ b/src/main/java/org/apache/fop/afp/fonts/package.html diff --git a/src/java/org/apache/fop/afp/goca/AbstractGraphicsCoord.java b/src/main/java/org/apache/fop/afp/goca/AbstractGraphicsCoord.java index d9836f682..d9836f682 100644 --- a/src/java/org/apache/fop/afp/goca/AbstractGraphicsCoord.java +++ b/src/main/java/org/apache/fop/afp/goca/AbstractGraphicsCoord.java diff --git a/src/java/org/apache/fop/afp/goca/AbstractGraphicsDrawingOrder.java b/src/main/java/org/apache/fop/afp/goca/AbstractGraphicsDrawingOrder.java index 0d8f793c0..0d8f793c0 100644 --- a/src/java/org/apache/fop/afp/goca/AbstractGraphicsDrawingOrder.java +++ b/src/main/java/org/apache/fop/afp/goca/AbstractGraphicsDrawingOrder.java diff --git a/src/java/org/apache/fop/afp/goca/AbstractGraphicsDrawingOrderContainer.java b/src/main/java/org/apache/fop/afp/goca/AbstractGraphicsDrawingOrderContainer.java index 5bd05fd4b..5bd05fd4b 100644 --- a/src/java/org/apache/fop/afp/goca/AbstractGraphicsDrawingOrderContainer.java +++ b/src/main/java/org/apache/fop/afp/goca/AbstractGraphicsDrawingOrderContainer.java diff --git a/src/java/org/apache/fop/afp/goca/GraphicsAreaBegin.java b/src/main/java/org/apache/fop/afp/goca/GraphicsAreaBegin.java index 19a5a8f2d..19a5a8f2d 100644 --- a/src/java/org/apache/fop/afp/goca/GraphicsAreaBegin.java +++ b/src/main/java/org/apache/fop/afp/goca/GraphicsAreaBegin.java diff --git a/src/java/org/apache/fop/afp/goca/GraphicsAreaEnd.java b/src/main/java/org/apache/fop/afp/goca/GraphicsAreaEnd.java index 12f14bfa4..12f14bfa4 100644 --- a/src/java/org/apache/fop/afp/goca/GraphicsAreaEnd.java +++ b/src/main/java/org/apache/fop/afp/goca/GraphicsAreaEnd.java diff --git a/src/java/org/apache/fop/afp/goca/GraphicsBox.java b/src/main/java/org/apache/fop/afp/goca/GraphicsBox.java index eb2af6650..eb2af6650 100644 --- a/src/java/org/apache/fop/afp/goca/GraphicsBox.java +++ b/src/main/java/org/apache/fop/afp/goca/GraphicsBox.java diff --git a/src/java/org/apache/fop/afp/goca/GraphicsChainedSegment.java b/src/main/java/org/apache/fop/afp/goca/GraphicsChainedSegment.java index 5a5bab771..5a5bab771 100644 --- a/src/java/org/apache/fop/afp/goca/GraphicsChainedSegment.java +++ b/src/main/java/org/apache/fop/afp/goca/GraphicsChainedSegment.java diff --git a/src/java/org/apache/fop/afp/goca/GraphicsCharacterString.java b/src/main/java/org/apache/fop/afp/goca/GraphicsCharacterString.java index d41adf867..d41adf867 100644 --- a/src/java/org/apache/fop/afp/goca/GraphicsCharacterString.java +++ b/src/main/java/org/apache/fop/afp/goca/GraphicsCharacterString.java diff --git a/src/java/org/apache/fop/afp/goca/GraphicsData.java b/src/main/java/org/apache/fop/afp/goca/GraphicsData.java index ed406b06e..ed406b06e 100644 --- a/src/java/org/apache/fop/afp/goca/GraphicsData.java +++ b/src/main/java/org/apache/fop/afp/goca/GraphicsData.java diff --git a/src/java/org/apache/fop/afp/goca/GraphicsEndProlog.java b/src/main/java/org/apache/fop/afp/goca/GraphicsEndProlog.java index d20ff5b29..d20ff5b29 100644 --- a/src/java/org/apache/fop/afp/goca/GraphicsEndProlog.java +++ b/src/main/java/org/apache/fop/afp/goca/GraphicsEndProlog.java diff --git a/src/java/org/apache/fop/afp/goca/GraphicsFillet.java b/src/main/java/org/apache/fop/afp/goca/GraphicsFillet.java index 766f0e6be..766f0e6be 100644 --- a/src/java/org/apache/fop/afp/goca/GraphicsFillet.java +++ b/src/main/java/org/apache/fop/afp/goca/GraphicsFillet.java diff --git a/src/java/org/apache/fop/afp/goca/GraphicsFullArc.java b/src/main/java/org/apache/fop/afp/goca/GraphicsFullArc.java index d6de8df17..d6de8df17 100644 --- a/src/java/org/apache/fop/afp/goca/GraphicsFullArc.java +++ b/src/main/java/org/apache/fop/afp/goca/GraphicsFullArc.java diff --git a/src/java/org/apache/fop/afp/goca/GraphicsImage.java b/src/main/java/org/apache/fop/afp/goca/GraphicsImage.java index 3b1dafeea..3b1dafeea 100644 --- a/src/java/org/apache/fop/afp/goca/GraphicsImage.java +++ b/src/main/java/org/apache/fop/afp/goca/GraphicsImage.java diff --git a/src/java/org/apache/fop/afp/goca/GraphicsLine.java b/src/main/java/org/apache/fop/afp/goca/GraphicsLine.java index a2ff57a39..a2ff57a39 100644 --- a/src/java/org/apache/fop/afp/goca/GraphicsLine.java +++ b/src/main/java/org/apache/fop/afp/goca/GraphicsLine.java diff --git a/src/java/org/apache/fop/afp/goca/GraphicsSetArcParameters.java b/src/main/java/org/apache/fop/afp/goca/GraphicsSetArcParameters.java index 12c1c8e49..12c1c8e49 100644 --- a/src/java/org/apache/fop/afp/goca/GraphicsSetArcParameters.java +++ b/src/main/java/org/apache/fop/afp/goca/GraphicsSetArcParameters.java diff --git a/src/java/org/apache/fop/afp/goca/GraphicsSetCharacterSet.java b/src/main/java/org/apache/fop/afp/goca/GraphicsSetCharacterSet.java index 98cebad54..98cebad54 100644 --- a/src/java/org/apache/fop/afp/goca/GraphicsSetCharacterSet.java +++ b/src/main/java/org/apache/fop/afp/goca/GraphicsSetCharacterSet.java diff --git a/src/java/org/apache/fop/afp/goca/GraphicsSetCurrentPosition.java b/src/main/java/org/apache/fop/afp/goca/GraphicsSetCurrentPosition.java index f89210e2a..f89210e2a 100644 --- a/src/java/org/apache/fop/afp/goca/GraphicsSetCurrentPosition.java +++ b/src/main/java/org/apache/fop/afp/goca/GraphicsSetCurrentPosition.java diff --git a/src/java/org/apache/fop/afp/goca/GraphicsSetFractionalLineWidth.java b/src/main/java/org/apache/fop/afp/goca/GraphicsSetFractionalLineWidth.java index 529001676..529001676 100644 --- a/src/java/org/apache/fop/afp/goca/GraphicsSetFractionalLineWidth.java +++ b/src/main/java/org/apache/fop/afp/goca/GraphicsSetFractionalLineWidth.java diff --git a/src/java/org/apache/fop/afp/goca/GraphicsSetLineType.java b/src/main/java/org/apache/fop/afp/goca/GraphicsSetLineType.java index 837ec2164..837ec2164 100644 --- a/src/java/org/apache/fop/afp/goca/GraphicsSetLineType.java +++ b/src/main/java/org/apache/fop/afp/goca/GraphicsSetLineType.java diff --git a/src/java/org/apache/fop/afp/goca/GraphicsSetLineWidth.java b/src/main/java/org/apache/fop/afp/goca/GraphicsSetLineWidth.java index ca8812f14..ca8812f14 100644 --- a/src/java/org/apache/fop/afp/goca/GraphicsSetLineWidth.java +++ b/src/main/java/org/apache/fop/afp/goca/GraphicsSetLineWidth.java diff --git a/src/java/org/apache/fop/afp/goca/GraphicsSetMix.java b/src/main/java/org/apache/fop/afp/goca/GraphicsSetMix.java index 6551470cc..6551470cc 100644 --- a/src/java/org/apache/fop/afp/goca/GraphicsSetMix.java +++ b/src/main/java/org/apache/fop/afp/goca/GraphicsSetMix.java diff --git a/src/java/org/apache/fop/afp/goca/GraphicsSetPatternSymbol.java b/src/main/java/org/apache/fop/afp/goca/GraphicsSetPatternSymbol.java index a4c91efce..a4c91efce 100644 --- a/src/java/org/apache/fop/afp/goca/GraphicsSetPatternSymbol.java +++ b/src/main/java/org/apache/fop/afp/goca/GraphicsSetPatternSymbol.java diff --git a/src/java/org/apache/fop/afp/goca/GraphicsSetProcessColor.java b/src/main/java/org/apache/fop/afp/goca/GraphicsSetProcessColor.java index f5808bda6..f5808bda6 100644 --- a/src/java/org/apache/fop/afp/goca/GraphicsSetProcessColor.java +++ b/src/main/java/org/apache/fop/afp/goca/GraphicsSetProcessColor.java diff --git a/src/java/org/apache/fop/afp/goca/package.html b/src/main/java/org/apache/fop/afp/goca/package.html index 539be8d13..539be8d13 100644 --- a/src/java/org/apache/fop/afp/goca/package.html +++ b/src/main/java/org/apache/fop/afp/goca/package.html diff --git a/src/java/org/apache/fop/afp/ioca/BandImage.java b/src/main/java/org/apache/fop/afp/ioca/BandImage.java index 892355d4f..892355d4f 100644 --- a/src/java/org/apache/fop/afp/ioca/BandImage.java +++ b/src/main/java/org/apache/fop/afp/ioca/BandImage.java diff --git a/src/java/org/apache/fop/afp/ioca/IDEStructureParameter.java b/src/main/java/org/apache/fop/afp/ioca/IDEStructureParameter.java index 8256f986f..8256f986f 100644 --- a/src/java/org/apache/fop/afp/ioca/IDEStructureParameter.java +++ b/src/main/java/org/apache/fop/afp/ioca/IDEStructureParameter.java diff --git a/src/java/org/apache/fop/afp/ioca/ImageCellPosition.java b/src/main/java/org/apache/fop/afp/ioca/ImageCellPosition.java index 216d8bcd5..216d8bcd5 100644 --- a/src/java/org/apache/fop/afp/ioca/ImageCellPosition.java +++ b/src/main/java/org/apache/fop/afp/ioca/ImageCellPosition.java diff --git a/src/java/org/apache/fop/afp/ioca/ImageContent.java b/src/main/java/org/apache/fop/afp/ioca/ImageContent.java index 516d4f715..516d4f715 100644 --- a/src/java/org/apache/fop/afp/ioca/ImageContent.java +++ b/src/main/java/org/apache/fop/afp/ioca/ImageContent.java diff --git a/src/java/org/apache/fop/afp/ioca/ImageInputDescriptor.java b/src/main/java/org/apache/fop/afp/ioca/ImageInputDescriptor.java index fa77abefa..fa77abefa 100644 --- a/src/java/org/apache/fop/afp/ioca/ImageInputDescriptor.java +++ b/src/main/java/org/apache/fop/afp/ioca/ImageInputDescriptor.java diff --git a/src/java/org/apache/fop/afp/ioca/ImageOutputControl.java b/src/main/java/org/apache/fop/afp/ioca/ImageOutputControl.java index 8e7ff750c..8e7ff750c 100644 --- a/src/java/org/apache/fop/afp/ioca/ImageOutputControl.java +++ b/src/main/java/org/apache/fop/afp/ioca/ImageOutputControl.java diff --git a/src/java/org/apache/fop/afp/ioca/ImageRasterData.java b/src/main/java/org/apache/fop/afp/ioca/ImageRasterData.java index 3243ddad7..3243ddad7 100644 --- a/src/java/org/apache/fop/afp/ioca/ImageRasterData.java +++ b/src/main/java/org/apache/fop/afp/ioca/ImageRasterData.java diff --git a/src/java/org/apache/fop/afp/ioca/ImageRasterPattern.java b/src/main/java/org/apache/fop/afp/ioca/ImageRasterPattern.java index 9a5d4b402..9a5d4b402 100644 --- a/src/java/org/apache/fop/afp/ioca/ImageRasterPattern.java +++ b/src/main/java/org/apache/fop/afp/ioca/ImageRasterPattern.java diff --git a/src/java/org/apache/fop/afp/ioca/ImageSegment.java b/src/main/java/org/apache/fop/afp/ioca/ImageSegment.java index 96afa1136..96afa1136 100644 --- a/src/java/org/apache/fop/afp/ioca/ImageSegment.java +++ b/src/main/java/org/apache/fop/afp/ioca/ImageSegment.java diff --git a/src/java/org/apache/fop/afp/ioca/ImageSizeParameter.java b/src/main/java/org/apache/fop/afp/ioca/ImageSizeParameter.java index 6700462ec..6700462ec 100644 --- a/src/java/org/apache/fop/afp/ioca/ImageSizeParameter.java +++ b/src/main/java/org/apache/fop/afp/ioca/ImageSizeParameter.java diff --git a/src/java/org/apache/fop/afp/ioca/Tile.java b/src/main/java/org/apache/fop/afp/ioca/Tile.java index 3e9d3d5ff..3e9d3d5ff 100644 --- a/src/java/org/apache/fop/afp/ioca/Tile.java +++ b/src/main/java/org/apache/fop/afp/ioca/Tile.java diff --git a/src/java/org/apache/fop/afp/ioca/TilePosition.java b/src/main/java/org/apache/fop/afp/ioca/TilePosition.java index 41d4351f4..41d4351f4 100644 --- a/src/java/org/apache/fop/afp/ioca/TilePosition.java +++ b/src/main/java/org/apache/fop/afp/ioca/TilePosition.java diff --git a/src/java/org/apache/fop/afp/ioca/TileSize.java b/src/main/java/org/apache/fop/afp/ioca/TileSize.java index 33bb4bcd3..33bb4bcd3 100644 --- a/src/java/org/apache/fop/afp/ioca/TileSize.java +++ b/src/main/java/org/apache/fop/afp/ioca/TileSize.java diff --git a/src/java/org/apache/fop/afp/ioca/TileTOC.java b/src/main/java/org/apache/fop/afp/ioca/TileTOC.java index 9fbbcfdcc..9fbbcfdcc 100644 --- a/src/java/org/apache/fop/afp/ioca/TileTOC.java +++ b/src/main/java/org/apache/fop/afp/ioca/TileTOC.java diff --git a/src/java/org/apache/fop/afp/ioca/package.html b/src/main/java/org/apache/fop/afp/ioca/package.html index 34e0bc19d..34e0bc19d 100644 --- a/src/java/org/apache/fop/afp/ioca/package.html +++ b/src/main/java/org/apache/fop/afp/ioca/package.html diff --git a/src/java/org/apache/fop/afp/modca/AbstractAFPObject.java b/src/main/java/org/apache/fop/afp/modca/AbstractAFPObject.java index 2c612092e..2c612092e 100644 --- a/src/java/org/apache/fop/afp/modca/AbstractAFPObject.java +++ b/src/main/java/org/apache/fop/afp/modca/AbstractAFPObject.java diff --git a/src/java/org/apache/fop/afp/modca/AbstractDataObject.java b/src/main/java/org/apache/fop/afp/modca/AbstractDataObject.java index db4bf23a1..db4bf23a1 100644 --- a/src/java/org/apache/fop/afp/modca/AbstractDataObject.java +++ b/src/main/java/org/apache/fop/afp/modca/AbstractDataObject.java diff --git a/src/java/org/apache/fop/afp/modca/AbstractDescriptor.java b/src/main/java/org/apache/fop/afp/modca/AbstractDescriptor.java index 0b87f45fc..0b87f45fc 100644 --- a/src/java/org/apache/fop/afp/modca/AbstractDescriptor.java +++ b/src/main/java/org/apache/fop/afp/modca/AbstractDescriptor.java diff --git a/src/java/org/apache/fop/afp/modca/AbstractEnvironmentGroup.java b/src/main/java/org/apache/fop/afp/modca/AbstractEnvironmentGroup.java index 6b193c072..6b193c072 100644 --- a/src/java/org/apache/fop/afp/modca/AbstractEnvironmentGroup.java +++ b/src/main/java/org/apache/fop/afp/modca/AbstractEnvironmentGroup.java diff --git a/src/java/org/apache/fop/afp/modca/AbstractNamedAFPObject.java b/src/main/java/org/apache/fop/afp/modca/AbstractNamedAFPObject.java index f92a26851..f92a26851 100644 --- a/src/java/org/apache/fop/afp/modca/AbstractNamedAFPObject.java +++ b/src/main/java/org/apache/fop/afp/modca/AbstractNamedAFPObject.java diff --git a/src/java/org/apache/fop/afp/modca/AbstractPageObject.java b/src/main/java/org/apache/fop/afp/modca/AbstractPageObject.java index 575697790..575697790 100644 --- a/src/java/org/apache/fop/afp/modca/AbstractPageObject.java +++ b/src/main/java/org/apache/fop/afp/modca/AbstractPageObject.java diff --git a/src/java/org/apache/fop/afp/modca/AbstractResourceEnvironmentGroupContainer.java b/src/main/java/org/apache/fop/afp/modca/AbstractResourceEnvironmentGroupContainer.java index 6e753b1e0..6e753b1e0 100644 --- a/src/java/org/apache/fop/afp/modca/AbstractResourceEnvironmentGroupContainer.java +++ b/src/main/java/org/apache/fop/afp/modca/AbstractResourceEnvironmentGroupContainer.java diff --git a/src/java/org/apache/fop/afp/modca/AbstractResourceGroupContainer.java b/src/main/java/org/apache/fop/afp/modca/AbstractResourceGroupContainer.java index 667faca80..667faca80 100644 --- a/src/java/org/apache/fop/afp/modca/AbstractResourceGroupContainer.java +++ b/src/main/java/org/apache/fop/afp/modca/AbstractResourceGroupContainer.java diff --git a/src/java/org/apache/fop/afp/modca/AbstractStructuredObject.java b/src/main/java/org/apache/fop/afp/modca/AbstractStructuredObject.java index e848583b5..e848583b5 100644 --- a/src/java/org/apache/fop/afp/modca/AbstractStructuredObject.java +++ b/src/main/java/org/apache/fop/afp/modca/AbstractStructuredObject.java diff --git a/src/java/org/apache/fop/afp/modca/AbstractTripletStructuredObject.java b/src/main/java/org/apache/fop/afp/modca/AbstractTripletStructuredObject.java index d840e2077..d840e2077 100644 --- a/src/java/org/apache/fop/afp/modca/AbstractTripletStructuredObject.java +++ b/src/main/java/org/apache/fop/afp/modca/AbstractTripletStructuredObject.java diff --git a/src/java/org/apache/fop/afp/modca/ActiveEnvironmentGroup.java b/src/main/java/org/apache/fop/afp/modca/ActiveEnvironmentGroup.java index 48eaa0a40..48eaa0a40 100644 --- a/src/java/org/apache/fop/afp/modca/ActiveEnvironmentGroup.java +++ b/src/main/java/org/apache/fop/afp/modca/ActiveEnvironmentGroup.java diff --git a/src/java/org/apache/fop/afp/modca/AxisOrientation.java b/src/main/java/org/apache/fop/afp/modca/AxisOrientation.java index a017fe5e3..a017fe5e3 100644 --- a/src/java/org/apache/fop/afp/modca/AxisOrientation.java +++ b/src/main/java/org/apache/fop/afp/modca/AxisOrientation.java diff --git a/src/java/org/apache/fop/afp/modca/ContainerDataDescriptor.java b/src/main/java/org/apache/fop/afp/modca/ContainerDataDescriptor.java index 38c60d7b6..38c60d7b6 100644 --- a/src/java/org/apache/fop/afp/modca/ContainerDataDescriptor.java +++ b/src/main/java/org/apache/fop/afp/modca/ContainerDataDescriptor.java diff --git a/src/java/org/apache/fop/afp/modca/Document.java b/src/main/java/org/apache/fop/afp/modca/Document.java index 69aed97ef..69aed97ef 100644 --- a/src/java/org/apache/fop/afp/modca/Document.java +++ b/src/main/java/org/apache/fop/afp/modca/Document.java diff --git a/src/java/org/apache/fop/afp/modca/GraphicsDataDescriptor.java b/src/main/java/org/apache/fop/afp/modca/GraphicsDataDescriptor.java index 5fa3b70a9..5fa3b70a9 100644 --- a/src/java/org/apache/fop/afp/modca/GraphicsDataDescriptor.java +++ b/src/main/java/org/apache/fop/afp/modca/GraphicsDataDescriptor.java diff --git a/src/java/org/apache/fop/afp/modca/GraphicsObject.java b/src/main/java/org/apache/fop/afp/modca/GraphicsObject.java index 434d4f838..434d4f838 100644 --- a/src/java/org/apache/fop/afp/modca/GraphicsObject.java +++ b/src/main/java/org/apache/fop/afp/modca/GraphicsObject.java diff --git a/src/java/org/apache/fop/afp/modca/IMImageObject.java b/src/main/java/org/apache/fop/afp/modca/IMImageObject.java index a0fa763dc..a0fa763dc 100644 --- a/src/java/org/apache/fop/afp/modca/IMImageObject.java +++ b/src/main/java/org/apache/fop/afp/modca/IMImageObject.java diff --git a/src/java/org/apache/fop/afp/modca/ImageDataDescriptor.java b/src/main/java/org/apache/fop/afp/modca/ImageDataDescriptor.java index f11201c88..f11201c88 100644 --- a/src/java/org/apache/fop/afp/modca/ImageDataDescriptor.java +++ b/src/main/java/org/apache/fop/afp/modca/ImageDataDescriptor.java diff --git a/src/java/org/apache/fop/afp/modca/ImageObject.java b/src/main/java/org/apache/fop/afp/modca/ImageObject.java index 2452a9c15..2452a9c15 100644 --- a/src/java/org/apache/fop/afp/modca/ImageObject.java +++ b/src/main/java/org/apache/fop/afp/modca/ImageObject.java diff --git a/src/java/org/apache/fop/afp/modca/IncludeObject.java b/src/main/java/org/apache/fop/afp/modca/IncludeObject.java index 90b8ad664..90b8ad664 100644 --- a/src/java/org/apache/fop/afp/modca/IncludeObject.java +++ b/src/main/java/org/apache/fop/afp/modca/IncludeObject.java diff --git a/src/java/org/apache/fop/afp/modca/IncludePageOverlay.java b/src/main/java/org/apache/fop/afp/modca/IncludePageOverlay.java index a45eba3ed..a45eba3ed 100644 --- a/src/java/org/apache/fop/afp/modca/IncludePageOverlay.java +++ b/src/main/java/org/apache/fop/afp/modca/IncludePageOverlay.java diff --git a/src/java/org/apache/fop/afp/modca/IncludePageSegment.java b/src/main/java/org/apache/fop/afp/modca/IncludePageSegment.java index c6eceafea..c6eceafea 100644 --- a/src/java/org/apache/fop/afp/modca/IncludePageSegment.java +++ b/src/main/java/org/apache/fop/afp/modca/IncludePageSegment.java diff --git a/src/java/org/apache/fop/afp/modca/IncludedResourceObject.java b/src/main/java/org/apache/fop/afp/modca/IncludedResourceObject.java index 8bfcf4624..8bfcf4624 100644 --- a/src/java/org/apache/fop/afp/modca/IncludedResourceObject.java +++ b/src/main/java/org/apache/fop/afp/modca/IncludedResourceObject.java diff --git a/src/java/org/apache/fop/afp/modca/InterchangeSet.java b/src/main/java/org/apache/fop/afp/modca/InterchangeSet.java index 35919af15..35919af15 100644 --- a/src/java/org/apache/fop/afp/modca/InterchangeSet.java +++ b/src/main/java/org/apache/fop/afp/modca/InterchangeSet.java diff --git a/src/java/org/apache/fop/afp/modca/InvokeMediumMap.java b/src/main/java/org/apache/fop/afp/modca/InvokeMediumMap.java index 59d9253cf..59d9253cf 100644 --- a/src/java/org/apache/fop/afp/modca/InvokeMediumMap.java +++ b/src/main/java/org/apache/fop/afp/modca/InvokeMediumMap.java diff --git a/src/java/org/apache/fop/afp/modca/MapCodedFont.java b/src/main/java/org/apache/fop/afp/modca/MapCodedFont.java index 38533652c..38533652c 100644 --- a/src/java/org/apache/fop/afp/modca/MapCodedFont.java +++ b/src/main/java/org/apache/fop/afp/modca/MapCodedFont.java diff --git a/src/java/org/apache/fop/afp/modca/MapContainerData.java b/src/main/java/org/apache/fop/afp/modca/MapContainerData.java index 8411592aa..8411592aa 100644 --- a/src/java/org/apache/fop/afp/modca/MapContainerData.java +++ b/src/main/java/org/apache/fop/afp/modca/MapContainerData.java diff --git a/src/java/org/apache/fop/afp/modca/MapDataResource.java b/src/main/java/org/apache/fop/afp/modca/MapDataResource.java index c7aa758cf..c7aa758cf 100644 --- a/src/java/org/apache/fop/afp/modca/MapDataResource.java +++ b/src/main/java/org/apache/fop/afp/modca/MapDataResource.java diff --git a/src/java/org/apache/fop/afp/modca/MapImageObject.java b/src/main/java/org/apache/fop/afp/modca/MapImageObject.java index cf3551c07..cf3551c07 100644 --- a/src/java/org/apache/fop/afp/modca/MapImageObject.java +++ b/src/main/java/org/apache/fop/afp/modca/MapImageObject.java diff --git a/src/java/org/apache/fop/afp/modca/MapPageOverlay.java b/src/main/java/org/apache/fop/afp/modca/MapPageOverlay.java index cde2e031d..cde2e031d 100644 --- a/src/java/org/apache/fop/afp/modca/MapPageOverlay.java +++ b/src/main/java/org/apache/fop/afp/modca/MapPageOverlay.java diff --git a/src/java/org/apache/fop/afp/modca/MapPageSegment.java b/src/main/java/org/apache/fop/afp/modca/MapPageSegment.java index 81d6f4724..81d6f4724 100644 --- a/src/java/org/apache/fop/afp/modca/MapPageSegment.java +++ b/src/main/java/org/apache/fop/afp/modca/MapPageSegment.java diff --git a/src/java/org/apache/fop/afp/modca/MaximumSizeExceededException.java b/src/main/java/org/apache/fop/afp/modca/MaximumSizeExceededException.java index 6d1c74156..6d1c74156 100644 --- a/src/java/org/apache/fop/afp/modca/MaximumSizeExceededException.java +++ b/src/main/java/org/apache/fop/afp/modca/MaximumSizeExceededException.java diff --git a/src/java/org/apache/fop/afp/modca/NoOperation.java b/src/main/java/org/apache/fop/afp/modca/NoOperation.java index f662116e6..f662116e6 100644 --- a/src/java/org/apache/fop/afp/modca/NoOperation.java +++ b/src/main/java/org/apache/fop/afp/modca/NoOperation.java diff --git a/src/java/org/apache/fop/afp/modca/ObjectAreaDescriptor.java b/src/main/java/org/apache/fop/afp/modca/ObjectAreaDescriptor.java index 6ab2ea734..6ab2ea734 100644 --- a/src/java/org/apache/fop/afp/modca/ObjectAreaDescriptor.java +++ b/src/main/java/org/apache/fop/afp/modca/ObjectAreaDescriptor.java diff --git a/src/java/org/apache/fop/afp/modca/ObjectAreaPosition.java b/src/main/java/org/apache/fop/afp/modca/ObjectAreaPosition.java index 016d74107..016d74107 100644 --- a/src/java/org/apache/fop/afp/modca/ObjectAreaPosition.java +++ b/src/main/java/org/apache/fop/afp/modca/ObjectAreaPosition.java diff --git a/src/java/org/apache/fop/afp/modca/ObjectContainer.java b/src/main/java/org/apache/fop/afp/modca/ObjectContainer.java index 288e5aad0..288e5aad0 100644 --- a/src/java/org/apache/fop/afp/modca/ObjectContainer.java +++ b/src/main/java/org/apache/fop/afp/modca/ObjectContainer.java diff --git a/src/java/org/apache/fop/afp/modca/ObjectEnvironmentGroup.java b/src/main/java/org/apache/fop/afp/modca/ObjectEnvironmentGroup.java index 359f68602..359f68602 100644 --- a/src/java/org/apache/fop/afp/modca/ObjectEnvironmentGroup.java +++ b/src/main/java/org/apache/fop/afp/modca/ObjectEnvironmentGroup.java diff --git a/src/java/org/apache/fop/afp/modca/Overlay.java b/src/main/java/org/apache/fop/afp/modca/Overlay.java index 2793e93f5..2793e93f5 100644 --- a/src/java/org/apache/fop/afp/modca/Overlay.java +++ b/src/main/java/org/apache/fop/afp/modca/Overlay.java diff --git a/src/java/org/apache/fop/afp/modca/PageDescriptor.java b/src/main/java/org/apache/fop/afp/modca/PageDescriptor.java index b18c835e3..b18c835e3 100644 --- a/src/java/org/apache/fop/afp/modca/PageDescriptor.java +++ b/src/main/java/org/apache/fop/afp/modca/PageDescriptor.java diff --git a/src/java/org/apache/fop/afp/modca/PageGroup.java b/src/main/java/org/apache/fop/afp/modca/PageGroup.java index 7d472a2cd..7d472a2cd 100644 --- a/src/java/org/apache/fop/afp/modca/PageGroup.java +++ b/src/main/java/org/apache/fop/afp/modca/PageGroup.java diff --git a/src/java/org/apache/fop/afp/modca/PageObject.java b/src/main/java/org/apache/fop/afp/modca/PageObject.java index 5c76e0736..5c76e0736 100644 --- a/src/java/org/apache/fop/afp/modca/PageObject.java +++ b/src/main/java/org/apache/fop/afp/modca/PageObject.java diff --git a/src/java/org/apache/fop/afp/modca/PageSegment.java b/src/main/java/org/apache/fop/afp/modca/PageSegment.java index 50c3a642c..50c3a642c 100644 --- a/src/java/org/apache/fop/afp/modca/PageSegment.java +++ b/src/main/java/org/apache/fop/afp/modca/PageSegment.java diff --git a/src/java/org/apache/fop/afp/modca/PreprocessPresentationObject.java b/src/main/java/org/apache/fop/afp/modca/PreprocessPresentationObject.java index db0bac905..db0bac905 100644 --- a/src/java/org/apache/fop/afp/modca/PreprocessPresentationObject.java +++ b/src/main/java/org/apache/fop/afp/modca/PreprocessPresentationObject.java diff --git a/src/java/org/apache/fop/afp/modca/PresentationEnvironmentControl.java b/src/main/java/org/apache/fop/afp/modca/PresentationEnvironmentControl.java index a2ebe22f6..a2ebe22f6 100644 --- a/src/java/org/apache/fop/afp/modca/PresentationEnvironmentControl.java +++ b/src/main/java/org/apache/fop/afp/modca/PresentationEnvironmentControl.java diff --git a/src/java/org/apache/fop/afp/modca/PresentationTextData.java b/src/main/java/org/apache/fop/afp/modca/PresentationTextData.java index c0934b1e5..c0934b1e5 100644 --- a/src/java/org/apache/fop/afp/modca/PresentationTextData.java +++ b/src/main/java/org/apache/fop/afp/modca/PresentationTextData.java diff --git a/src/java/org/apache/fop/afp/modca/PresentationTextDescriptor.java b/src/main/java/org/apache/fop/afp/modca/PresentationTextDescriptor.java index bd20ee368..bd20ee368 100644 --- a/src/java/org/apache/fop/afp/modca/PresentationTextDescriptor.java +++ b/src/main/java/org/apache/fop/afp/modca/PresentationTextDescriptor.java diff --git a/src/java/org/apache/fop/afp/modca/PresentationTextObject.java b/src/main/java/org/apache/fop/afp/modca/PresentationTextObject.java index f4d4d93ed..f4d4d93ed 100644 --- a/src/java/org/apache/fop/afp/modca/PresentationTextObject.java +++ b/src/main/java/org/apache/fop/afp/modca/PresentationTextObject.java diff --git a/src/java/org/apache/fop/afp/modca/Registry.java b/src/main/java/org/apache/fop/afp/modca/Registry.java index fe0a42790..fe0a42790 100644 --- a/src/java/org/apache/fop/afp/modca/Registry.java +++ b/src/main/java/org/apache/fop/afp/modca/Registry.java diff --git a/src/java/org/apache/fop/afp/modca/ResourceEnvironmentGroup.java b/src/main/java/org/apache/fop/afp/modca/ResourceEnvironmentGroup.java index db254273e..db254273e 100644 --- a/src/java/org/apache/fop/afp/modca/ResourceEnvironmentGroup.java +++ b/src/main/java/org/apache/fop/afp/modca/ResourceEnvironmentGroup.java diff --git a/src/java/org/apache/fop/afp/modca/ResourceGroup.java b/src/main/java/org/apache/fop/afp/modca/ResourceGroup.java index 2218998a0..2218998a0 100644 --- a/src/java/org/apache/fop/afp/modca/ResourceGroup.java +++ b/src/main/java/org/apache/fop/afp/modca/ResourceGroup.java diff --git a/src/java/org/apache/fop/afp/modca/ResourceObject.java b/src/main/java/org/apache/fop/afp/modca/ResourceObject.java index 6f97bed93..6f97bed93 100644 --- a/src/java/org/apache/fop/afp/modca/ResourceObject.java +++ b/src/main/java/org/apache/fop/afp/modca/ResourceObject.java diff --git a/src/java/org/apache/fop/afp/modca/Rotation.java b/src/main/java/org/apache/fop/afp/modca/Rotation.java index a307e1cf9..a307e1cf9 100644 --- a/src/java/org/apache/fop/afp/modca/Rotation.java +++ b/src/main/java/org/apache/fop/afp/modca/Rotation.java diff --git a/src/java/org/apache/fop/afp/modca/StreamedResourceGroup.java b/src/main/java/org/apache/fop/afp/modca/StreamedResourceGroup.java index ed9c82194..ed9c82194 100644 --- a/src/java/org/apache/fop/afp/modca/StreamedResourceGroup.java +++ b/src/main/java/org/apache/fop/afp/modca/StreamedResourceGroup.java diff --git a/src/java/org/apache/fop/afp/modca/TagLogicalElement.java b/src/main/java/org/apache/fop/afp/modca/TagLogicalElement.java index ea30154d5..ea30154d5 100644 --- a/src/java/org/apache/fop/afp/modca/TagLogicalElement.java +++ b/src/main/java/org/apache/fop/afp/modca/TagLogicalElement.java diff --git a/src/java/org/apache/fop/afp/modca/package.html b/src/main/java/org/apache/fop/afp/modca/package.html index 572743558..572743558 100644 --- a/src/java/org/apache/fop/afp/modca/package.html +++ b/src/main/java/org/apache/fop/afp/modca/package.html diff --git a/src/java/org/apache/fop/afp/modca/triplets/AbstractTriplet.java b/src/main/java/org/apache/fop/afp/modca/triplets/AbstractTriplet.java index 5cd136ab2..5cd136ab2 100644 --- a/src/java/org/apache/fop/afp/modca/triplets/AbstractTriplet.java +++ b/src/main/java/org/apache/fop/afp/modca/triplets/AbstractTriplet.java diff --git a/src/java/org/apache/fop/afp/modca/triplets/AttributeQualifierTriplet.java b/src/main/java/org/apache/fop/afp/modca/triplets/AttributeQualifierTriplet.java index 2f924d585..2f924d585 100644 --- a/src/java/org/apache/fop/afp/modca/triplets/AttributeQualifierTriplet.java +++ b/src/main/java/org/apache/fop/afp/modca/triplets/AttributeQualifierTriplet.java diff --git a/src/java/org/apache/fop/afp/modca/triplets/AttributeValueTriplet.java b/src/main/java/org/apache/fop/afp/modca/triplets/AttributeValueTriplet.java index 2ba34d40e..2ba34d40e 100644 --- a/src/java/org/apache/fop/afp/modca/triplets/AttributeValueTriplet.java +++ b/src/main/java/org/apache/fop/afp/modca/triplets/AttributeValueTriplet.java diff --git a/src/java/org/apache/fop/afp/modca/triplets/CommentTriplet.java b/src/main/java/org/apache/fop/afp/modca/triplets/CommentTriplet.java index ee48f86be..ee48f86be 100644 --- a/src/java/org/apache/fop/afp/modca/triplets/CommentTriplet.java +++ b/src/main/java/org/apache/fop/afp/modca/triplets/CommentTriplet.java diff --git a/src/java/org/apache/fop/afp/modca/triplets/DescriptorPositionTriplet.java b/src/main/java/org/apache/fop/afp/modca/triplets/DescriptorPositionTriplet.java index cff6400af..cff6400af 100644 --- a/src/java/org/apache/fop/afp/modca/triplets/DescriptorPositionTriplet.java +++ b/src/main/java/org/apache/fop/afp/modca/triplets/DescriptorPositionTriplet.java diff --git a/src/java/org/apache/fop/afp/modca/triplets/EncodingTriplet.java b/src/main/java/org/apache/fop/afp/modca/triplets/EncodingTriplet.java index 03b0bedf4..03b0bedf4 100644 --- a/src/java/org/apache/fop/afp/modca/triplets/EncodingTriplet.java +++ b/src/main/java/org/apache/fop/afp/modca/triplets/EncodingTriplet.java diff --git a/src/java/org/apache/fop/afp/modca/triplets/ExtendedResourceLocalIdentifierTriplet.java b/src/main/java/org/apache/fop/afp/modca/triplets/ExtendedResourceLocalIdentifierTriplet.java index af9452fcb..af9452fcb 100644 --- a/src/java/org/apache/fop/afp/modca/triplets/ExtendedResourceLocalIdentifierTriplet.java +++ b/src/main/java/org/apache/fop/afp/modca/triplets/ExtendedResourceLocalIdentifierTriplet.java diff --git a/src/java/org/apache/fop/afp/modca/triplets/FullyQualifiedNameTriplet.java b/src/main/java/org/apache/fop/afp/modca/triplets/FullyQualifiedNameTriplet.java index 581d215b8..581d215b8 100644 --- a/src/java/org/apache/fop/afp/modca/triplets/FullyQualifiedNameTriplet.java +++ b/src/main/java/org/apache/fop/afp/modca/triplets/FullyQualifiedNameTriplet.java diff --git a/src/java/org/apache/fop/afp/modca/triplets/MappingOptionTriplet.java b/src/main/java/org/apache/fop/afp/modca/triplets/MappingOptionTriplet.java index 2f19eca83..2f19eca83 100644 --- a/src/java/org/apache/fop/afp/modca/triplets/MappingOptionTriplet.java +++ b/src/main/java/org/apache/fop/afp/modca/triplets/MappingOptionTriplet.java diff --git a/src/java/org/apache/fop/afp/modca/triplets/MeasurementUnitsTriplet.java b/src/main/java/org/apache/fop/afp/modca/triplets/MeasurementUnitsTriplet.java index b04c6d43c..b04c6d43c 100644 --- a/src/java/org/apache/fop/afp/modca/triplets/MeasurementUnitsTriplet.java +++ b/src/main/java/org/apache/fop/afp/modca/triplets/MeasurementUnitsTriplet.java diff --git a/src/java/org/apache/fop/afp/modca/triplets/ObjectAreaSizeTriplet.java b/src/main/java/org/apache/fop/afp/modca/triplets/ObjectAreaSizeTriplet.java index 1b1aa5b88..1b1aa5b88 100644 --- a/src/java/org/apache/fop/afp/modca/triplets/ObjectAreaSizeTriplet.java +++ b/src/main/java/org/apache/fop/afp/modca/triplets/ObjectAreaSizeTriplet.java diff --git a/src/java/org/apache/fop/afp/modca/triplets/ObjectByteExtentTriplet.java b/src/main/java/org/apache/fop/afp/modca/triplets/ObjectByteExtentTriplet.java index 3aaa6969a..3aaa6969a 100644 --- a/src/java/org/apache/fop/afp/modca/triplets/ObjectByteExtentTriplet.java +++ b/src/main/java/org/apache/fop/afp/modca/triplets/ObjectByteExtentTriplet.java diff --git a/src/java/org/apache/fop/afp/modca/triplets/ObjectClassificationTriplet.java b/src/main/java/org/apache/fop/afp/modca/triplets/ObjectClassificationTriplet.java index a93e56d70..a93e56d70 100644 --- a/src/java/org/apache/fop/afp/modca/triplets/ObjectClassificationTriplet.java +++ b/src/main/java/org/apache/fop/afp/modca/triplets/ObjectClassificationTriplet.java diff --git a/src/java/org/apache/fop/afp/modca/triplets/PresentationSpaceMixingRulesTriplet.java b/src/main/java/org/apache/fop/afp/modca/triplets/PresentationSpaceMixingRulesTriplet.java index b93ec5477..b93ec5477 100644 --- a/src/java/org/apache/fop/afp/modca/triplets/PresentationSpaceMixingRulesTriplet.java +++ b/src/main/java/org/apache/fop/afp/modca/triplets/PresentationSpaceMixingRulesTriplet.java diff --git a/src/java/org/apache/fop/afp/modca/triplets/PresentationSpaceResetMixingTriplet.java b/src/main/java/org/apache/fop/afp/modca/triplets/PresentationSpaceResetMixingTriplet.java index cecd40910..cecd40910 100644 --- a/src/java/org/apache/fop/afp/modca/triplets/PresentationSpaceResetMixingTriplet.java +++ b/src/main/java/org/apache/fop/afp/modca/triplets/PresentationSpaceResetMixingTriplet.java diff --git a/src/java/org/apache/fop/afp/modca/triplets/ResourceObjectTypeTriplet.java b/src/main/java/org/apache/fop/afp/modca/triplets/ResourceObjectTypeTriplet.java index a6d83f83b..a6d83f83b 100644 --- a/src/java/org/apache/fop/afp/modca/triplets/ResourceObjectTypeTriplet.java +++ b/src/main/java/org/apache/fop/afp/modca/triplets/ResourceObjectTypeTriplet.java diff --git a/src/java/org/apache/fop/afp/modca/triplets/Triplet.java b/src/main/java/org/apache/fop/afp/modca/triplets/Triplet.java index 7234645f8..7234645f8 100644 --- a/src/java/org/apache/fop/afp/modca/triplets/Triplet.java +++ b/src/main/java/org/apache/fop/afp/modca/triplets/Triplet.java diff --git a/src/java/org/apache/fop/afp/modca/triplets/package.html b/src/main/java/org/apache/fop/afp/modca/triplets/package.html index 99ae55a45..99ae55a45 100644 --- a/src/java/org/apache/fop/afp/modca/triplets/package.html +++ b/src/main/java/org/apache/fop/afp/modca/triplets/package.html diff --git a/src/java/org/apache/fop/afp/package.html b/src/main/java/org/apache/fop/afp/package.html index d67498159..d67498159 100644 --- a/src/java/org/apache/fop/afp/package.html +++ b/src/main/java/org/apache/fop/afp/package.html diff --git a/src/java/org/apache/fop/afp/parser/MODCAParser.java b/src/main/java/org/apache/fop/afp/parser/MODCAParser.java index d0d0eced9..d0d0eced9 100644 --- a/src/java/org/apache/fop/afp/parser/MODCAParser.java +++ b/src/main/java/org/apache/fop/afp/parser/MODCAParser.java diff --git a/src/java/org/apache/fop/afp/parser/UnparsedStructuredField.java b/src/main/java/org/apache/fop/afp/parser/UnparsedStructuredField.java index 0e2eeeb0c..0e2eeeb0c 100644 --- a/src/java/org/apache/fop/afp/parser/UnparsedStructuredField.java +++ b/src/main/java/org/apache/fop/afp/parser/UnparsedStructuredField.java diff --git a/src/java/org/apache/fop/afp/ptoca/LineDataInfoProducer.java b/src/main/java/org/apache/fop/afp/ptoca/LineDataInfoProducer.java index cf00674fb..cf00674fb 100644 --- a/src/java/org/apache/fop/afp/ptoca/LineDataInfoProducer.java +++ b/src/main/java/org/apache/fop/afp/ptoca/LineDataInfoProducer.java diff --git a/src/java/org/apache/fop/afp/ptoca/PtocaBuilder.java b/src/main/java/org/apache/fop/afp/ptoca/PtocaBuilder.java index 084ba5daa..084ba5daa 100644 --- a/src/java/org/apache/fop/afp/ptoca/PtocaBuilder.java +++ b/src/main/java/org/apache/fop/afp/ptoca/PtocaBuilder.java diff --git a/src/java/org/apache/fop/afp/ptoca/PtocaConstants.java b/src/main/java/org/apache/fop/afp/ptoca/PtocaConstants.java index c53b97fd0..c53b97fd0 100644 --- a/src/java/org/apache/fop/afp/ptoca/PtocaConstants.java +++ b/src/main/java/org/apache/fop/afp/ptoca/PtocaConstants.java diff --git a/src/java/org/apache/fop/afp/ptoca/PtocaProducer.java b/src/main/java/org/apache/fop/afp/ptoca/PtocaProducer.java index 5f29bef96..5f29bef96 100644 --- a/src/java/org/apache/fop/afp/ptoca/PtocaProducer.java +++ b/src/main/java/org/apache/fop/afp/ptoca/PtocaProducer.java diff --git a/src/java/org/apache/fop/afp/ptoca/TextDataInfoProducer.java b/src/main/java/org/apache/fop/afp/ptoca/TextDataInfoProducer.java index 4af21b12b..4af21b12b 100644 --- a/src/java/org/apache/fop/afp/ptoca/TextDataInfoProducer.java +++ b/src/main/java/org/apache/fop/afp/ptoca/TextDataInfoProducer.java diff --git a/src/java/org/apache/fop/afp/ptoca/TransparentDataControlSequence.java b/src/main/java/org/apache/fop/afp/ptoca/TransparentDataControlSequence.java index 4b4276880..4b4276880 100644 --- a/src/java/org/apache/fop/afp/ptoca/TransparentDataControlSequence.java +++ b/src/main/java/org/apache/fop/afp/ptoca/TransparentDataControlSequence.java diff --git a/src/java/org/apache/fop/afp/ptoca/package.html b/src/main/java/org/apache/fop/afp/ptoca/package.html index 7520e1cb2..7520e1cb2 100644 --- a/src/java/org/apache/fop/afp/ptoca/package.html +++ b/src/main/java/org/apache/fop/afp/ptoca/package.html diff --git a/src/java/org/apache/fop/afp/svg/AFPBridgeContext.java b/src/main/java/org/apache/fop/afp/svg/AFPBridgeContext.java index 183a07ab6..183a07ab6 100644 --- a/src/java/org/apache/fop/afp/svg/AFPBridgeContext.java +++ b/src/main/java/org/apache/fop/afp/svg/AFPBridgeContext.java diff --git a/src/java/org/apache/fop/afp/svg/AFPFontFamilyResolver.java b/src/main/java/org/apache/fop/afp/svg/AFPFontFamilyResolver.java index a8217088b..a8217088b 100644 --- a/src/java/org/apache/fop/afp/svg/AFPFontFamilyResolver.java +++ b/src/main/java/org/apache/fop/afp/svg/AFPFontFamilyResolver.java diff --git a/src/java/org/apache/fop/afp/svg/AFPImageElementBridge.java b/src/main/java/org/apache/fop/afp/svg/AFPImageElementBridge.java index 89b2c83dc..89b2c83dc 100644 --- a/src/java/org/apache/fop/afp/svg/AFPImageElementBridge.java +++ b/src/main/java/org/apache/fop/afp/svg/AFPImageElementBridge.java diff --git a/src/java/org/apache/fop/afp/svg/AFPTextElementBridge.java b/src/main/java/org/apache/fop/afp/svg/AFPTextElementBridge.java index d7de961e7..d7de961e7 100644 --- a/src/java/org/apache/fop/afp/svg/AFPTextElementBridge.java +++ b/src/main/java/org/apache/fop/afp/svg/AFPTextElementBridge.java diff --git a/src/java/org/apache/fop/afp/svg/AFPTextHandler.java b/src/main/java/org/apache/fop/afp/svg/AFPTextHandler.java index 00831c985..00831c985 100644 --- a/src/java/org/apache/fop/afp/svg/AFPTextHandler.java +++ b/src/main/java/org/apache/fop/afp/svg/AFPTextHandler.java diff --git a/src/java/org/apache/fop/afp/svg/AFPTextPainter.java b/src/main/java/org/apache/fop/afp/svg/AFPTextPainter.java index 971a381f4..971a381f4 100644 --- a/src/java/org/apache/fop/afp/svg/AFPTextPainter.java +++ b/src/main/java/org/apache/fop/afp/svg/AFPTextPainter.java diff --git a/src/java/org/apache/fop/afp/svg/package.html b/src/main/java/org/apache/fop/afp/svg/package.html index bd24b246f..bd24b246f 100644 --- a/src/java/org/apache/fop/afp/svg/package.html +++ b/src/main/java/org/apache/fop/afp/svg/package.html diff --git a/src/java/org/apache/fop/afp/util/AFPResourceAccessor.java b/src/main/java/org/apache/fop/afp/util/AFPResourceAccessor.java index f760e6c7c..f760e6c7c 100644 --- a/src/java/org/apache/fop/afp/util/AFPResourceAccessor.java +++ b/src/main/java/org/apache/fop/afp/util/AFPResourceAccessor.java diff --git a/src/java/org/apache/fop/afp/util/AFPResourceUtil.java b/src/main/java/org/apache/fop/afp/util/AFPResourceUtil.java index 7972d7c76..7972d7c76 100644 --- a/src/java/org/apache/fop/afp/util/AFPResourceUtil.java +++ b/src/main/java/org/apache/fop/afp/util/AFPResourceUtil.java diff --git a/src/java/org/apache/fop/afp/util/BinaryUtils.java b/src/main/java/org/apache/fop/afp/util/BinaryUtils.java index 2b4197b36..2b4197b36 100644 --- a/src/java/org/apache/fop/afp/util/BinaryUtils.java +++ b/src/main/java/org/apache/fop/afp/util/BinaryUtils.java diff --git a/src/java/org/apache/fop/afp/util/CubicBezierApproximator.java b/src/main/java/org/apache/fop/afp/util/CubicBezierApproximator.java index e5980c3dd..e5980c3dd 100644 --- a/src/java/org/apache/fop/afp/util/CubicBezierApproximator.java +++ b/src/main/java/org/apache/fop/afp/util/CubicBezierApproximator.java diff --git a/src/java/org/apache/fop/afp/util/DTDEntityResolver.java b/src/main/java/org/apache/fop/afp/util/DTDEntityResolver.java index 2df7346c7..2df7346c7 100644 --- a/src/java/org/apache/fop/afp/util/DTDEntityResolver.java +++ b/src/main/java/org/apache/fop/afp/util/DTDEntityResolver.java diff --git a/src/java/org/apache/fop/afp/util/StringUtils.java b/src/main/java/org/apache/fop/afp/util/StringUtils.java index 26dfc5c1a..26dfc5c1a 100644 --- a/src/java/org/apache/fop/afp/util/StringUtils.java +++ b/src/main/java/org/apache/fop/afp/util/StringUtils.java diff --git a/src/java/org/apache/fop/afp/util/StructuredFieldReader.java b/src/main/java/org/apache/fop/afp/util/StructuredFieldReader.java index 6180da67a..6180da67a 100644 --- a/src/java/org/apache/fop/afp/util/StructuredFieldReader.java +++ b/src/main/java/org/apache/fop/afp/util/StructuredFieldReader.java diff --git a/src/java/org/apache/fop/afp/util/package.html b/src/main/java/org/apache/fop/afp/util/package.html index 525bdbe2a..525bdbe2a 100644 --- a/src/java/org/apache/fop/afp/util/package.html +++ b/src/main/java/org/apache/fop/afp/util/package.html diff --git a/src/java/org/apache/fop/apps/EnvironmentProfile.java b/src/main/java/org/apache/fop/apps/EnvironmentProfile.java index 1a585353e..1a585353e 100644 --- a/src/java/org/apache/fop/apps/EnvironmentProfile.java +++ b/src/main/java/org/apache/fop/apps/EnvironmentProfile.java diff --git a/src/java/org/apache/fop/apps/EnvironmentalProfileFactory.java b/src/main/java/org/apache/fop/apps/EnvironmentalProfileFactory.java index 922ecff4b..922ecff4b 100644 --- a/src/java/org/apache/fop/apps/EnvironmentalProfileFactory.java +++ b/src/main/java/org/apache/fop/apps/EnvironmentalProfileFactory.java diff --git a/src/java/org/apache/fop/apps/FOPException.java b/src/main/java/org/apache/fop/apps/FOPException.java index ef84cc5fa..ef84cc5fa 100644 --- a/src/java/org/apache/fop/apps/FOPException.java +++ b/src/main/java/org/apache/fop/apps/FOPException.java diff --git a/src/java/org/apache/fop/apps/FOUserAgent.java b/src/main/java/org/apache/fop/apps/FOUserAgent.java index 6434ce36e..6434ce36e 100644 --- a/src/java/org/apache/fop/apps/FOUserAgent.java +++ b/src/main/java/org/apache/fop/apps/FOUserAgent.java diff --git a/src/java/org/apache/fop/apps/Fop.java b/src/main/java/org/apache/fop/apps/Fop.java index f7b1c39b1..f7b1c39b1 100644 --- a/src/java/org/apache/fop/apps/Fop.java +++ b/src/main/java/org/apache/fop/apps/Fop.java diff --git a/src/java/org/apache/fop/apps/FopConfParser.java b/src/main/java/org/apache/fop/apps/FopConfParser.java index 01e43ed29..01e43ed29 100644 --- a/src/java/org/apache/fop/apps/FopConfParser.java +++ b/src/main/java/org/apache/fop/apps/FopConfParser.java diff --git a/src/java/org/apache/fop/apps/FopFactory.java b/src/main/java/org/apache/fop/apps/FopFactory.java index d9c9708eb..d9c9708eb 100644 --- a/src/java/org/apache/fop/apps/FopFactory.java +++ b/src/main/java/org/apache/fop/apps/FopFactory.java diff --git a/src/java/org/apache/fop/apps/FopFactoryBuilder.java b/src/main/java/org/apache/fop/apps/FopFactoryBuilder.java index b1fd5e979..b1fd5e979 100644 --- a/src/java/org/apache/fop/apps/FopFactoryBuilder.java +++ b/src/main/java/org/apache/fop/apps/FopFactoryBuilder.java diff --git a/src/java/org/apache/fop/apps/FopFactoryConfig.java b/src/main/java/org/apache/fop/apps/FopFactoryConfig.java index d3ea3127f..d3ea3127f 100644 --- a/src/java/org/apache/fop/apps/FopFactoryConfig.java +++ b/src/main/java/org/apache/fop/apps/FopFactoryConfig.java diff --git a/src/java/org/apache/fop/apps/FormattingResults.java b/src/main/java/org/apache/fop/apps/FormattingResults.java index e55d51195..e55d51195 100644 --- a/src/java/org/apache/fop/apps/FormattingResults.java +++ b/src/main/java/org/apache/fop/apps/FormattingResults.java diff --git a/src/java/org/apache/fop/apps/MimeConstants.java b/src/main/java/org/apache/fop/apps/MimeConstants.java index 33030e22f..33030e22f 100644 --- a/src/java/org/apache/fop/apps/MimeConstants.java +++ b/src/main/java/org/apache/fop/apps/MimeConstants.java diff --git a/src/java/org/apache/fop/apps/PageSequenceResults.java b/src/main/java/org/apache/fop/apps/PageSequenceResults.java index 241f4a5f9..241f4a5f9 100644 --- a/src/java/org/apache/fop/apps/PageSequenceResults.java +++ b/src/main/java/org/apache/fop/apps/PageSequenceResults.java diff --git a/src/java/org/apache/fop/apps/io/InternalResourceResolver.java b/src/main/java/org/apache/fop/apps/io/InternalResourceResolver.java index af0a26478..af0a26478 100644 --- a/src/java/org/apache/fop/apps/io/InternalResourceResolver.java +++ b/src/main/java/org/apache/fop/apps/io/InternalResourceResolver.java diff --git a/src/java/org/apache/fop/apps/io/ResourceResolverFactory.java b/src/main/java/org/apache/fop/apps/io/ResourceResolverFactory.java index 28b8c8b12..28b8c8b12 100644 --- a/src/java/org/apache/fop/apps/io/ResourceResolverFactory.java +++ b/src/main/java/org/apache/fop/apps/io/ResourceResolverFactory.java diff --git a/src/java/org/apache/fop/apps/io/package.html b/src/main/java/org/apache/fop/apps/io/package.html index d631dc998..d631dc998 100644 --- a/src/java/org/apache/fop/apps/io/package.html +++ b/src/main/java/org/apache/fop/apps/io/package.html diff --git a/src/java/org/apache/fop/apps/package.html b/src/main/java/org/apache/fop/apps/package.html index 2bf75de3f..2bf75de3f 100644 --- a/src/java/org/apache/fop/apps/package.html +++ b/src/main/java/org/apache/fop/apps/package.html diff --git a/src/java/org/apache/fop/area/AbstractOffDocumentItem.java b/src/main/java/org/apache/fop/area/AbstractOffDocumentItem.java index bdec281d4..bdec281d4 100644 --- a/src/java/org/apache/fop/area/AbstractOffDocumentItem.java +++ b/src/main/java/org/apache/fop/area/AbstractOffDocumentItem.java diff --git a/src/java/org/apache/fop/area/Area.java b/src/main/java/org/apache/fop/area/Area.java index 895367c19..895367c19 100644 --- a/src/java/org/apache/fop/area/Area.java +++ b/src/main/java/org/apache/fop/area/Area.java diff --git a/src/java/org/apache/fop/area/AreaEventProducer.java b/src/main/java/org/apache/fop/area/AreaEventProducer.java index da7c0acc1..da7c0acc1 100644 --- a/src/java/org/apache/fop/area/AreaEventProducer.java +++ b/src/main/java/org/apache/fop/area/AreaEventProducer.java diff --git a/src/java/org/apache/fop/area/AreaEventProducer.xml b/src/main/java/org/apache/fop/area/AreaEventProducer.xml index 576007eb9..576007eb9 100644 --- a/src/java/org/apache/fop/area/AreaEventProducer.xml +++ b/src/main/java/org/apache/fop/area/AreaEventProducer.xml diff --git a/src/java/org/apache/fop/area/AreaTreeHandler.java b/src/main/java/org/apache/fop/area/AreaTreeHandler.java index fda5ad07b..fda5ad07b 100644 --- a/src/java/org/apache/fop/area/AreaTreeHandler.java +++ b/src/main/java/org/apache/fop/area/AreaTreeHandler.java diff --git a/src/java/org/apache/fop/area/AreaTreeModel.java b/src/main/java/org/apache/fop/area/AreaTreeModel.java index baa30245e..baa30245e 100644 --- a/src/java/org/apache/fop/area/AreaTreeModel.java +++ b/src/main/java/org/apache/fop/area/AreaTreeModel.java diff --git a/src/java/org/apache/fop/area/AreaTreeObject.java b/src/main/java/org/apache/fop/area/AreaTreeObject.java index 02d81ef0a..02d81ef0a 100644 --- a/src/java/org/apache/fop/area/AreaTreeObject.java +++ b/src/main/java/org/apache/fop/area/AreaTreeObject.java diff --git a/src/java/org/apache/fop/area/AreaTreeParser.java b/src/main/java/org/apache/fop/area/AreaTreeParser.java index 640f04335..640f04335 100644 --- a/src/java/org/apache/fop/area/AreaTreeParser.java +++ b/src/main/java/org/apache/fop/area/AreaTreeParser.java diff --git a/src/java/org/apache/fop/area/BeforeFloat.java b/src/main/java/org/apache/fop/area/BeforeFloat.java index 37f7332a0..37f7332a0 100644 --- a/src/java/org/apache/fop/area/BeforeFloat.java +++ b/src/main/java/org/apache/fop/area/BeforeFloat.java diff --git a/src/java/org/apache/fop/area/Block.java b/src/main/java/org/apache/fop/area/Block.java index 565146415..565146415 100644 --- a/src/java/org/apache/fop/area/Block.java +++ b/src/main/java/org/apache/fop/area/Block.java diff --git a/src/java/org/apache/fop/area/BlockParent.java b/src/main/java/org/apache/fop/area/BlockParent.java index fa599f31a..fa599f31a 100644 --- a/src/java/org/apache/fop/area/BlockParent.java +++ b/src/main/java/org/apache/fop/area/BlockParent.java diff --git a/src/java/org/apache/fop/area/BlockViewport.java b/src/main/java/org/apache/fop/area/BlockViewport.java index d33a060e4..d33a060e4 100644 --- a/src/java/org/apache/fop/area/BlockViewport.java +++ b/src/main/java/org/apache/fop/area/BlockViewport.java diff --git a/src/java/org/apache/fop/area/BodyRegion.java b/src/main/java/org/apache/fop/area/BodyRegion.java index df7e914b7..df7e914b7 100644 --- a/src/java/org/apache/fop/area/BodyRegion.java +++ b/src/main/java/org/apache/fop/area/BodyRegion.java diff --git a/src/java/org/apache/fop/area/BookmarkData.java b/src/main/java/org/apache/fop/area/BookmarkData.java index 495fd1901..495fd1901 100644 --- a/src/java/org/apache/fop/area/BookmarkData.java +++ b/src/main/java/org/apache/fop/area/BookmarkData.java diff --git a/src/java/org/apache/fop/area/CTM.java b/src/main/java/org/apache/fop/area/CTM.java index 80172be8b..80172be8b 100644 --- a/src/java/org/apache/fop/area/CTM.java +++ b/src/main/java/org/apache/fop/area/CTM.java diff --git a/src/java/org/apache/fop/area/CachedRenderPagesModel.java b/src/main/java/org/apache/fop/area/CachedRenderPagesModel.java index e5c6f5b2b..e5c6f5b2b 100644 --- a/src/java/org/apache/fop/area/CachedRenderPagesModel.java +++ b/src/main/java/org/apache/fop/area/CachedRenderPagesModel.java diff --git a/src/java/org/apache/fop/area/DestinationData.java b/src/main/java/org/apache/fop/area/DestinationData.java index 1dffb3b92..1dffb3b92 100644 --- a/src/java/org/apache/fop/area/DestinationData.java +++ b/src/main/java/org/apache/fop/area/DestinationData.java diff --git a/src/java/org/apache/fop/area/Footnote.java b/src/main/java/org/apache/fop/area/Footnote.java index cbf8f80fa..cbf8f80fa 100644 --- a/src/java/org/apache/fop/area/Footnote.java +++ b/src/main/java/org/apache/fop/area/Footnote.java diff --git a/src/java/org/apache/fop/area/IDTracker.java b/src/main/java/org/apache/fop/area/IDTracker.java index 58d6a2e43..58d6a2e43 100644 --- a/src/java/org/apache/fop/area/IDTracker.java +++ b/src/main/java/org/apache/fop/area/IDTracker.java diff --git a/src/java/org/apache/fop/area/LineArea.java b/src/main/java/org/apache/fop/area/LineArea.java index 8639b8201..8639b8201 100644 --- a/src/java/org/apache/fop/area/LineArea.java +++ b/src/main/java/org/apache/fop/area/LineArea.java diff --git a/src/java/org/apache/fop/area/LinkResolver.java b/src/main/java/org/apache/fop/area/LinkResolver.java index a300bffa9..a300bffa9 100644 --- a/src/java/org/apache/fop/area/LinkResolver.java +++ b/src/main/java/org/apache/fop/area/LinkResolver.java diff --git a/src/java/org/apache/fop/area/MainReference.java b/src/main/java/org/apache/fop/area/MainReference.java index 9778db87f..9778db87f 100644 --- a/src/java/org/apache/fop/area/MainReference.java +++ b/src/main/java/org/apache/fop/area/MainReference.java diff --git a/src/java/org/apache/fop/area/NormalFlow.java b/src/main/java/org/apache/fop/area/NormalFlow.java index 3daf2dafd..3daf2dafd 100644 --- a/src/java/org/apache/fop/area/NormalFlow.java +++ b/src/main/java/org/apache/fop/area/NormalFlow.java diff --git a/src/java/org/apache/fop/area/OffDocumentExtensionAttachment.java b/src/main/java/org/apache/fop/area/OffDocumentExtensionAttachment.java index c8d653bd0..c8d653bd0 100644 --- a/src/java/org/apache/fop/area/OffDocumentExtensionAttachment.java +++ b/src/main/java/org/apache/fop/area/OffDocumentExtensionAttachment.java diff --git a/src/java/org/apache/fop/area/OffDocumentItem.java b/src/main/java/org/apache/fop/area/OffDocumentItem.java index c2c0a3f68..c2c0a3f68 100644 --- a/src/java/org/apache/fop/area/OffDocumentItem.java +++ b/src/main/java/org/apache/fop/area/OffDocumentItem.java diff --git a/src/java/org/apache/fop/area/Page.java b/src/main/java/org/apache/fop/area/Page.java index 71de13852..71de13852 100644 --- a/src/java/org/apache/fop/area/Page.java +++ b/src/main/java/org/apache/fop/area/Page.java diff --git a/src/java/org/apache/fop/area/PageSequence.java b/src/main/java/org/apache/fop/area/PageSequence.java index 124476602..124476602 100644 --- a/src/java/org/apache/fop/area/PageSequence.java +++ b/src/main/java/org/apache/fop/area/PageSequence.java diff --git a/src/java/org/apache/fop/area/PageViewport.java b/src/main/java/org/apache/fop/area/PageViewport.java index f1cd95721..f1cd95721 100644 --- a/src/java/org/apache/fop/area/PageViewport.java +++ b/src/main/java/org/apache/fop/area/PageViewport.java diff --git a/src/java/org/apache/fop/area/RegionReference.java b/src/main/java/org/apache/fop/area/RegionReference.java index a22bb5b06..a22bb5b06 100644 --- a/src/java/org/apache/fop/area/RegionReference.java +++ b/src/main/java/org/apache/fop/area/RegionReference.java diff --git a/src/java/org/apache/fop/area/RegionViewport.java b/src/main/java/org/apache/fop/area/RegionViewport.java index 36984b610..36984b610 100644 --- a/src/java/org/apache/fop/area/RegionViewport.java +++ b/src/main/java/org/apache/fop/area/RegionViewport.java diff --git a/src/java/org/apache/fop/area/RenderPagesModel.java b/src/main/java/org/apache/fop/area/RenderPagesModel.java index b94a32b4b..b94a32b4b 100644 --- a/src/java/org/apache/fop/area/RenderPagesModel.java +++ b/src/main/java/org/apache/fop/area/RenderPagesModel.java diff --git a/src/java/org/apache/fop/area/Resolvable.java b/src/main/java/org/apache/fop/area/Resolvable.java index 3ab3ef309..3ab3ef309 100644 --- a/src/java/org/apache/fop/area/Resolvable.java +++ b/src/main/java/org/apache/fop/area/Resolvable.java diff --git a/src/java/org/apache/fop/area/SideFloat.java b/src/main/java/org/apache/fop/area/SideFloat.java index af653efbf..af653efbf 100644 --- a/src/java/org/apache/fop/area/SideFloat.java +++ b/src/main/java/org/apache/fop/area/SideFloat.java diff --git a/src/java/org/apache/fop/area/Span.java b/src/main/java/org/apache/fop/area/Span.java index e0f8633be..e0f8633be 100644 --- a/src/java/org/apache/fop/area/Span.java +++ b/src/main/java/org/apache/fop/area/Span.java diff --git a/src/java/org/apache/fop/area/Trait.java b/src/main/java/org/apache/fop/area/Trait.java index 2d733022e..2d733022e 100644 --- a/src/java/org/apache/fop/area/Trait.java +++ b/src/main/java/org/apache/fop/area/Trait.java diff --git a/src/java/org/apache/fop/area/Viewport.java b/src/main/java/org/apache/fop/area/Viewport.java index a92d826cc..a92d826cc 100644 --- a/src/java/org/apache/fop/area/Viewport.java +++ b/src/main/java/org/apache/fop/area/Viewport.java diff --git a/src/java/org/apache/fop/area/inline/AbstractTextArea.java b/src/main/java/org/apache/fop/area/inline/AbstractTextArea.java index c2c4fe67b..c2c4fe67b 100644 --- a/src/java/org/apache/fop/area/inline/AbstractTextArea.java +++ b/src/main/java/org/apache/fop/area/inline/AbstractTextArea.java diff --git a/src/java/org/apache/fop/area/inline/Anchor.java b/src/main/java/org/apache/fop/area/inline/Anchor.java index 8ad663111..8ad663111 100644 --- a/src/java/org/apache/fop/area/inline/Anchor.java +++ b/src/main/java/org/apache/fop/area/inline/Anchor.java diff --git a/src/java/org/apache/fop/area/inline/BasicLinkArea.java b/src/main/java/org/apache/fop/area/inline/BasicLinkArea.java index 68af92319..68af92319 100644 --- a/src/java/org/apache/fop/area/inline/BasicLinkArea.java +++ b/src/main/java/org/apache/fop/area/inline/BasicLinkArea.java diff --git a/src/java/org/apache/fop/area/inline/Container.java b/src/main/java/org/apache/fop/area/inline/Container.java index 3d0060007..3d0060007 100644 --- a/src/java/org/apache/fop/area/inline/Container.java +++ b/src/main/java/org/apache/fop/area/inline/Container.java diff --git a/src/java/org/apache/fop/area/inline/FilledArea.java b/src/main/java/org/apache/fop/area/inline/FilledArea.java index 786b0265d..786b0265d 100644 --- a/src/java/org/apache/fop/area/inline/FilledArea.java +++ b/src/main/java/org/apache/fop/area/inline/FilledArea.java diff --git a/src/java/org/apache/fop/area/inline/ForeignObject.java b/src/main/java/org/apache/fop/area/inline/ForeignObject.java index cc0e0b0ad..cc0e0b0ad 100644 --- a/src/java/org/apache/fop/area/inline/ForeignObject.java +++ b/src/main/java/org/apache/fop/area/inline/ForeignObject.java diff --git a/src/java/org/apache/fop/area/inline/Image.java b/src/main/java/org/apache/fop/area/inline/Image.java index e6e355254..e6e355254 100644 --- a/src/java/org/apache/fop/area/inline/Image.java +++ b/src/main/java/org/apache/fop/area/inline/Image.java diff --git a/src/java/org/apache/fop/area/inline/InlineArea.java b/src/main/java/org/apache/fop/area/inline/InlineArea.java index 1733f7b3d..1733f7b3d 100644 --- a/src/java/org/apache/fop/area/inline/InlineArea.java +++ b/src/main/java/org/apache/fop/area/inline/InlineArea.java diff --git a/src/java/org/apache/fop/area/inline/InlineBlockParent.java b/src/main/java/org/apache/fop/area/inline/InlineBlockParent.java index f2a7fecee..f2a7fecee 100644 --- a/src/java/org/apache/fop/area/inline/InlineBlockParent.java +++ b/src/main/java/org/apache/fop/area/inline/InlineBlockParent.java diff --git a/src/java/org/apache/fop/area/inline/InlineParent.java b/src/main/java/org/apache/fop/area/inline/InlineParent.java index 2e03f4d80..2e03f4d80 100644 --- a/src/java/org/apache/fop/area/inline/InlineParent.java +++ b/src/main/java/org/apache/fop/area/inline/InlineParent.java diff --git a/src/java/org/apache/fop/area/inline/InlineViewport.java b/src/main/java/org/apache/fop/area/inline/InlineViewport.java index e111bdd9d..e111bdd9d 100644 --- a/src/java/org/apache/fop/area/inline/InlineViewport.java +++ b/src/main/java/org/apache/fop/area/inline/InlineViewport.java diff --git a/src/java/org/apache/fop/area/inline/Leader.java b/src/main/java/org/apache/fop/area/inline/Leader.java index ff8ba12b0..ff8ba12b0 100644 --- a/src/java/org/apache/fop/area/inline/Leader.java +++ b/src/main/java/org/apache/fop/area/inline/Leader.java diff --git a/src/java/org/apache/fop/area/inline/ResolvedPageNumber.java b/src/main/java/org/apache/fop/area/inline/ResolvedPageNumber.java index cbef88b7e..cbef88b7e 100644 --- a/src/java/org/apache/fop/area/inline/ResolvedPageNumber.java +++ b/src/main/java/org/apache/fop/area/inline/ResolvedPageNumber.java diff --git a/src/java/org/apache/fop/area/inline/Space.java b/src/main/java/org/apache/fop/area/inline/Space.java index b097e4349..b097e4349 100644 --- a/src/java/org/apache/fop/area/inline/Space.java +++ b/src/main/java/org/apache/fop/area/inline/Space.java diff --git a/src/java/org/apache/fop/area/inline/SpaceArea.java b/src/main/java/org/apache/fop/area/inline/SpaceArea.java index be7b61a9f..be7b61a9f 100644 --- a/src/java/org/apache/fop/area/inline/SpaceArea.java +++ b/src/main/java/org/apache/fop/area/inline/SpaceArea.java diff --git a/src/java/org/apache/fop/area/inline/TextArea.java b/src/main/java/org/apache/fop/area/inline/TextArea.java index 5a1b31c98..5a1b31c98 100644 --- a/src/java/org/apache/fop/area/inline/TextArea.java +++ b/src/main/java/org/apache/fop/area/inline/TextArea.java diff --git a/src/java/org/apache/fop/area/inline/UnresolvedPageNumber.java b/src/main/java/org/apache/fop/area/inline/UnresolvedPageNumber.java index 2d5845718..2d5845718 100644 --- a/src/java/org/apache/fop/area/inline/UnresolvedPageNumber.java +++ b/src/main/java/org/apache/fop/area/inline/UnresolvedPageNumber.java diff --git a/src/java/org/apache/fop/area/inline/WordArea.java b/src/main/java/org/apache/fop/area/inline/WordArea.java index 24cc9478c..24cc9478c 100644 --- a/src/java/org/apache/fop/area/inline/WordArea.java +++ b/src/main/java/org/apache/fop/area/inline/WordArea.java diff --git a/src/java/org/apache/fop/area/inline/package.html b/src/main/java/org/apache/fop/area/inline/package.html index 064a17d0c..064a17d0c 100644 --- a/src/java/org/apache/fop/area/inline/package.html +++ b/src/main/java/org/apache/fop/area/inline/package.html diff --git a/src/java/org/apache/fop/area/package.html b/src/main/java/org/apache/fop/area/package.html index c0f096e11..c0f096e11 100644 --- a/src/java/org/apache/fop/area/package.html +++ b/src/main/java/org/apache/fop/area/package.html diff --git a/src/java/org/apache/fop/cli/AreaTreeInputHandler.java b/src/main/java/org/apache/fop/cli/AreaTreeInputHandler.java index 72dd6c2f8..72dd6c2f8 100644 --- a/src/java/org/apache/fop/cli/AreaTreeInputHandler.java +++ b/src/main/java/org/apache/fop/cli/AreaTreeInputHandler.java diff --git a/src/java/org/apache/fop/cli/CommandLineOptions.java b/src/main/java/org/apache/fop/cli/CommandLineOptions.java index 6932333ea..6932333ea 100644 --- a/src/java/org/apache/fop/cli/CommandLineOptions.java +++ b/src/main/java/org/apache/fop/cli/CommandLineOptions.java diff --git a/src/java/org/apache/fop/cli/IFInputHandler.java b/src/main/java/org/apache/fop/cli/IFInputHandler.java index f01252cb2..f01252cb2 100644 --- a/src/java/org/apache/fop/cli/IFInputHandler.java +++ b/src/main/java/org/apache/fop/cli/IFInputHandler.java diff --git a/src/java/org/apache/fop/cli/ImageInputHandler.java b/src/main/java/org/apache/fop/cli/ImageInputHandler.java index 71c5b0073..71c5b0073 100644 --- a/src/java/org/apache/fop/cli/ImageInputHandler.java +++ b/src/main/java/org/apache/fop/cli/ImageInputHandler.java diff --git a/src/java/org/apache/fop/cli/InputHandler.java b/src/main/java/org/apache/fop/cli/InputHandler.java index 5b9d2fd77..5b9d2fd77 100644 --- a/src/java/org/apache/fop/cli/InputHandler.java +++ b/src/main/java/org/apache/fop/cli/InputHandler.java diff --git a/src/java/org/apache/fop/cli/Main.java b/src/main/java/org/apache/fop/cli/Main.java index b4c294e6e..b4c294e6e 100644 --- a/src/java/org/apache/fop/cli/Main.java +++ b/src/main/java/org/apache/fop/cli/Main.java diff --git a/src/java/org/apache/fop/cli/image2fo.xsl b/src/main/java/org/apache/fop/cli/image2fo.xsl index 3a2610230..3a2610230 100644 --- a/src/java/org/apache/fop/cli/image2fo.xsl +++ b/src/main/java/org/apache/fop/cli/image2fo.xsl diff --git a/src/java/org/apache/fop/cli/package.html b/src/main/java/org/apache/fop/cli/package.html index 8363121fd..8363121fd 100644 --- a/src/java/org/apache/fop/cli/package.html +++ b/src/main/java/org/apache/fop/cli/package.html diff --git a/src/java/org/apache/fop/complexscripts/bidi/BidiClass.java b/src/main/java/org/apache/fop/complexscripts/bidi/BidiClass.java index 4267e275a..4267e275a 100644 --- a/src/java/org/apache/fop/complexscripts/bidi/BidiClass.java +++ b/src/main/java/org/apache/fop/complexscripts/bidi/BidiClass.java diff --git a/src/java/org/apache/fop/complexscripts/bidi/BidiConstants.java b/src/main/java/org/apache/fop/complexscripts/bidi/BidiConstants.java index eeca2b41a..eeca2b41a 100644 --- a/src/java/org/apache/fop/complexscripts/bidi/BidiConstants.java +++ b/src/main/java/org/apache/fop/complexscripts/bidi/BidiConstants.java diff --git a/src/java/org/apache/fop/complexscripts/bidi/BidiResolver.java b/src/main/java/org/apache/fop/complexscripts/bidi/BidiResolver.java index e458e781c..e458e781c 100644 --- a/src/java/org/apache/fop/complexscripts/bidi/BidiResolver.java +++ b/src/main/java/org/apache/fop/complexscripts/bidi/BidiResolver.java diff --git a/src/java/org/apache/fop/complexscripts/bidi/DelimitedTextRange.java b/src/main/java/org/apache/fop/complexscripts/bidi/DelimitedTextRange.java index 67bb0aae1..67bb0aae1 100644 --- a/src/java/org/apache/fop/complexscripts/bidi/DelimitedTextRange.java +++ b/src/main/java/org/apache/fop/complexscripts/bidi/DelimitedTextRange.java diff --git a/src/java/org/apache/fop/complexscripts/bidi/InlineRun.java b/src/main/java/org/apache/fop/complexscripts/bidi/InlineRun.java index 828da13e3..828da13e3 100644 --- a/src/java/org/apache/fop/complexscripts/bidi/InlineRun.java +++ b/src/main/java/org/apache/fop/complexscripts/bidi/InlineRun.java diff --git a/src/java/org/apache/fop/complexscripts/bidi/TextInterval.java b/src/main/java/org/apache/fop/complexscripts/bidi/TextInterval.java index 8a1cbe8bd..8a1cbe8bd 100644 --- a/src/java/org/apache/fop/complexscripts/bidi/TextInterval.java +++ b/src/main/java/org/apache/fop/complexscripts/bidi/TextInterval.java diff --git a/src/java/org/apache/fop/complexscripts/bidi/UnflattenProcessor.java b/src/main/java/org/apache/fop/complexscripts/bidi/UnflattenProcessor.java index 456aa52ad..456aa52ad 100644 --- a/src/java/org/apache/fop/complexscripts/bidi/UnflattenProcessor.java +++ b/src/main/java/org/apache/fop/complexscripts/bidi/UnflattenProcessor.java diff --git a/src/java/org/apache/fop/complexscripts/bidi/UnicodeBidiAlgorithm.java b/src/main/java/org/apache/fop/complexscripts/bidi/UnicodeBidiAlgorithm.java index 6b47450b7..6b47450b7 100644 --- a/src/java/org/apache/fop/complexscripts/bidi/UnicodeBidiAlgorithm.java +++ b/src/main/java/org/apache/fop/complexscripts/bidi/UnicodeBidiAlgorithm.java diff --git a/src/java/org/apache/fop/complexscripts/fonts/AdvancedTypographicTableFormatException.java b/src/main/java/org/apache/fop/complexscripts/fonts/AdvancedTypographicTableFormatException.java index 4acd2c87b..4acd2c87b 100644 --- a/src/java/org/apache/fop/complexscripts/fonts/AdvancedTypographicTableFormatException.java +++ b/src/main/java/org/apache/fop/complexscripts/fonts/AdvancedTypographicTableFormatException.java diff --git a/src/java/org/apache/fop/complexscripts/fonts/GlyphClassMapping.java b/src/main/java/org/apache/fop/complexscripts/fonts/GlyphClassMapping.java index f3b89fb8c..f3b89fb8c 100644 --- a/src/java/org/apache/fop/complexscripts/fonts/GlyphClassMapping.java +++ b/src/main/java/org/apache/fop/complexscripts/fonts/GlyphClassMapping.java diff --git a/src/java/org/apache/fop/complexscripts/fonts/GlyphClassTable.java b/src/main/java/org/apache/fop/complexscripts/fonts/GlyphClassTable.java index 301ab846e..301ab846e 100644 --- a/src/java/org/apache/fop/complexscripts/fonts/GlyphClassTable.java +++ b/src/main/java/org/apache/fop/complexscripts/fonts/GlyphClassTable.java diff --git a/src/java/org/apache/fop/complexscripts/fonts/GlyphCoverageMapping.java b/src/main/java/org/apache/fop/complexscripts/fonts/GlyphCoverageMapping.java index 3969d2f38..3969d2f38 100644 --- a/src/java/org/apache/fop/complexscripts/fonts/GlyphCoverageMapping.java +++ b/src/main/java/org/apache/fop/complexscripts/fonts/GlyphCoverageMapping.java diff --git a/src/java/org/apache/fop/complexscripts/fonts/GlyphCoverageTable.java b/src/main/java/org/apache/fop/complexscripts/fonts/GlyphCoverageTable.java index 699672439..699672439 100644 --- a/src/java/org/apache/fop/complexscripts/fonts/GlyphCoverageTable.java +++ b/src/main/java/org/apache/fop/complexscripts/fonts/GlyphCoverageTable.java diff --git a/src/java/org/apache/fop/complexscripts/fonts/GlyphDefinition.java b/src/main/java/org/apache/fop/complexscripts/fonts/GlyphDefinition.java index 6fc43cbc9..6fc43cbc9 100644 --- a/src/java/org/apache/fop/complexscripts/fonts/GlyphDefinition.java +++ b/src/main/java/org/apache/fop/complexscripts/fonts/GlyphDefinition.java diff --git a/src/java/org/apache/fop/complexscripts/fonts/GlyphDefinitionSubtable.java b/src/main/java/org/apache/fop/complexscripts/fonts/GlyphDefinitionSubtable.java index 3ef9a0152..3ef9a0152 100644 --- a/src/java/org/apache/fop/complexscripts/fonts/GlyphDefinitionSubtable.java +++ b/src/main/java/org/apache/fop/complexscripts/fonts/GlyphDefinitionSubtable.java diff --git a/src/java/org/apache/fop/complexscripts/fonts/GlyphDefinitionTable.java b/src/main/java/org/apache/fop/complexscripts/fonts/GlyphDefinitionTable.java index 2ed1c2875..2ed1c2875 100644 --- a/src/java/org/apache/fop/complexscripts/fonts/GlyphDefinitionTable.java +++ b/src/main/java/org/apache/fop/complexscripts/fonts/GlyphDefinitionTable.java diff --git a/src/java/org/apache/fop/complexscripts/fonts/GlyphMappingTable.java b/src/main/java/org/apache/fop/complexscripts/fonts/GlyphMappingTable.java index 469bb6211..469bb6211 100644 --- a/src/java/org/apache/fop/complexscripts/fonts/GlyphMappingTable.java +++ b/src/main/java/org/apache/fop/complexscripts/fonts/GlyphMappingTable.java diff --git a/src/java/org/apache/fop/complexscripts/fonts/GlyphPositioning.java b/src/main/java/org/apache/fop/complexscripts/fonts/GlyphPositioning.java index fc8c6eae4..fc8c6eae4 100644 --- a/src/java/org/apache/fop/complexscripts/fonts/GlyphPositioning.java +++ b/src/main/java/org/apache/fop/complexscripts/fonts/GlyphPositioning.java diff --git a/src/java/org/apache/fop/complexscripts/fonts/GlyphPositioningState.java b/src/main/java/org/apache/fop/complexscripts/fonts/GlyphPositioningState.java index 08c533860..08c533860 100644 --- a/src/java/org/apache/fop/complexscripts/fonts/GlyphPositioningState.java +++ b/src/main/java/org/apache/fop/complexscripts/fonts/GlyphPositioningState.java diff --git a/src/java/org/apache/fop/complexscripts/fonts/GlyphPositioningSubtable.java b/src/main/java/org/apache/fop/complexscripts/fonts/GlyphPositioningSubtable.java index a94fac20f..a94fac20f 100644 --- a/src/java/org/apache/fop/complexscripts/fonts/GlyphPositioningSubtable.java +++ b/src/main/java/org/apache/fop/complexscripts/fonts/GlyphPositioningSubtable.java diff --git a/src/java/org/apache/fop/complexscripts/fonts/GlyphPositioningTable.java b/src/main/java/org/apache/fop/complexscripts/fonts/GlyphPositioningTable.java index ecc933ae2..ecc933ae2 100644 --- a/src/java/org/apache/fop/complexscripts/fonts/GlyphPositioningTable.java +++ b/src/main/java/org/apache/fop/complexscripts/fonts/GlyphPositioningTable.java diff --git a/src/java/org/apache/fop/complexscripts/fonts/GlyphProcessingState.java b/src/main/java/org/apache/fop/complexscripts/fonts/GlyphProcessingState.java index 322399170..322399170 100644 --- a/src/java/org/apache/fop/complexscripts/fonts/GlyphProcessingState.java +++ b/src/main/java/org/apache/fop/complexscripts/fonts/GlyphProcessingState.java diff --git a/src/java/org/apache/fop/complexscripts/fonts/GlyphSubstitution.java b/src/main/java/org/apache/fop/complexscripts/fonts/GlyphSubstitution.java index 4d0939337..4d0939337 100644 --- a/src/java/org/apache/fop/complexscripts/fonts/GlyphSubstitution.java +++ b/src/main/java/org/apache/fop/complexscripts/fonts/GlyphSubstitution.java diff --git a/src/java/org/apache/fop/complexscripts/fonts/GlyphSubstitutionState.java b/src/main/java/org/apache/fop/complexscripts/fonts/GlyphSubstitutionState.java index da40bbd87..da40bbd87 100644 --- a/src/java/org/apache/fop/complexscripts/fonts/GlyphSubstitutionState.java +++ b/src/main/java/org/apache/fop/complexscripts/fonts/GlyphSubstitutionState.java diff --git a/src/java/org/apache/fop/complexscripts/fonts/GlyphSubstitutionSubtable.java b/src/main/java/org/apache/fop/complexscripts/fonts/GlyphSubstitutionSubtable.java index f4e6fb924..f4e6fb924 100644 --- a/src/java/org/apache/fop/complexscripts/fonts/GlyphSubstitutionSubtable.java +++ b/src/main/java/org/apache/fop/complexscripts/fonts/GlyphSubstitutionSubtable.java diff --git a/src/java/org/apache/fop/complexscripts/fonts/GlyphSubstitutionTable.java b/src/main/java/org/apache/fop/complexscripts/fonts/GlyphSubstitutionTable.java index 7bb5a23e1..7bb5a23e1 100644 --- a/src/java/org/apache/fop/complexscripts/fonts/GlyphSubstitutionTable.java +++ b/src/main/java/org/apache/fop/complexscripts/fonts/GlyphSubstitutionTable.java diff --git a/src/java/org/apache/fop/complexscripts/fonts/GlyphSubtable.java b/src/main/java/org/apache/fop/complexscripts/fonts/GlyphSubtable.java index a53fdfd34..a53fdfd34 100644 --- a/src/java/org/apache/fop/complexscripts/fonts/GlyphSubtable.java +++ b/src/main/java/org/apache/fop/complexscripts/fonts/GlyphSubtable.java diff --git a/src/java/org/apache/fop/complexscripts/fonts/GlyphTable.java b/src/main/java/org/apache/fop/complexscripts/fonts/GlyphTable.java index de5d8f824..de5d8f824 100644 --- a/src/java/org/apache/fop/complexscripts/fonts/GlyphTable.java +++ b/src/main/java/org/apache/fop/complexscripts/fonts/GlyphTable.java diff --git a/src/java/org/apache/fop/complexscripts/fonts/IncompatibleSubtableException.java b/src/main/java/org/apache/fop/complexscripts/fonts/IncompatibleSubtableException.java index e3e78307d..e3e78307d 100644 --- a/src/java/org/apache/fop/complexscripts/fonts/IncompatibleSubtableException.java +++ b/src/main/java/org/apache/fop/complexscripts/fonts/IncompatibleSubtableException.java diff --git a/src/java/org/apache/fop/complexscripts/fonts/OTFAdvancedTypographicTableReader.java b/src/main/java/org/apache/fop/complexscripts/fonts/OTFAdvancedTypographicTableReader.java index de083a995..de083a995 100644 --- a/src/java/org/apache/fop/complexscripts/fonts/OTFAdvancedTypographicTableReader.java +++ b/src/main/java/org/apache/fop/complexscripts/fonts/OTFAdvancedTypographicTableReader.java diff --git a/src/java/org/apache/fop/complexscripts/fonts/OTFLanguage.java b/src/main/java/org/apache/fop/complexscripts/fonts/OTFLanguage.java index 49f67df4e..49f67df4e 100644 --- a/src/java/org/apache/fop/complexscripts/fonts/OTFLanguage.java +++ b/src/main/java/org/apache/fop/complexscripts/fonts/OTFLanguage.java diff --git a/src/java/org/apache/fop/complexscripts/fonts/OTFScript.java b/src/main/java/org/apache/fop/complexscripts/fonts/OTFScript.java index a43f1c5fb..a43f1c5fb 100644 --- a/src/java/org/apache/fop/complexscripts/fonts/OTFScript.java +++ b/src/main/java/org/apache/fop/complexscripts/fonts/OTFScript.java diff --git a/src/java/org/apache/fop/complexscripts/fonts/Positionable.java b/src/main/java/org/apache/fop/complexscripts/fonts/Positionable.java index 890036650..890036650 100644 --- a/src/java/org/apache/fop/complexscripts/fonts/Positionable.java +++ b/src/main/java/org/apache/fop/complexscripts/fonts/Positionable.java diff --git a/src/java/org/apache/fop/complexscripts/fonts/Substitutable.java b/src/main/java/org/apache/fop/complexscripts/fonts/Substitutable.java index 428995051..428995051 100644 --- a/src/java/org/apache/fop/complexscripts/fonts/Substitutable.java +++ b/src/main/java/org/apache/fop/complexscripts/fonts/Substitutable.java diff --git a/src/java/org/apache/fop/complexscripts/scripts/ArabicScriptProcessor.java b/src/main/java/org/apache/fop/complexscripts/scripts/ArabicScriptProcessor.java index 6ffd8c5ef..6ffd8c5ef 100644 --- a/src/java/org/apache/fop/complexscripts/scripts/ArabicScriptProcessor.java +++ b/src/main/java/org/apache/fop/complexscripts/scripts/ArabicScriptProcessor.java diff --git a/src/java/org/apache/fop/complexscripts/scripts/DefaultScriptProcessor.java b/src/main/java/org/apache/fop/complexscripts/scripts/DefaultScriptProcessor.java index 275fb20dc..275fb20dc 100644 --- a/src/java/org/apache/fop/complexscripts/scripts/DefaultScriptProcessor.java +++ b/src/main/java/org/apache/fop/complexscripts/scripts/DefaultScriptProcessor.java diff --git a/src/java/org/apache/fop/complexscripts/scripts/DevanagariScriptProcessor.java b/src/main/java/org/apache/fop/complexscripts/scripts/DevanagariScriptProcessor.java index 8d312b846..8d312b846 100644 --- a/src/java/org/apache/fop/complexscripts/scripts/DevanagariScriptProcessor.java +++ b/src/main/java/org/apache/fop/complexscripts/scripts/DevanagariScriptProcessor.java diff --git a/src/java/org/apache/fop/complexscripts/scripts/GujaratiScriptProcessor.java b/src/main/java/org/apache/fop/complexscripts/scripts/GujaratiScriptProcessor.java index 1f96455bc..1f96455bc 100644 --- a/src/java/org/apache/fop/complexscripts/scripts/GujaratiScriptProcessor.java +++ b/src/main/java/org/apache/fop/complexscripts/scripts/GujaratiScriptProcessor.java diff --git a/src/java/org/apache/fop/complexscripts/scripts/GurmukhiScriptProcessor.java b/src/main/java/org/apache/fop/complexscripts/scripts/GurmukhiScriptProcessor.java index cc50761bb..cc50761bb 100644 --- a/src/java/org/apache/fop/complexscripts/scripts/GurmukhiScriptProcessor.java +++ b/src/main/java/org/apache/fop/complexscripts/scripts/GurmukhiScriptProcessor.java diff --git a/src/java/org/apache/fop/complexscripts/scripts/IndicScriptProcessor.java b/src/main/java/org/apache/fop/complexscripts/scripts/IndicScriptProcessor.java index 01d5c6d70..01d5c6d70 100644 --- a/src/java/org/apache/fop/complexscripts/scripts/IndicScriptProcessor.java +++ b/src/main/java/org/apache/fop/complexscripts/scripts/IndicScriptProcessor.java diff --git a/src/java/org/apache/fop/complexscripts/scripts/ScriptProcessor.java b/src/main/java/org/apache/fop/complexscripts/scripts/ScriptProcessor.java index d492045f1..d492045f1 100644 --- a/src/java/org/apache/fop/complexscripts/scripts/ScriptProcessor.java +++ b/src/main/java/org/apache/fop/complexscripts/scripts/ScriptProcessor.java diff --git a/src/java/org/apache/fop/complexscripts/scripts/TamilScriptProcessor.java b/src/main/java/org/apache/fop/complexscripts/scripts/TamilScriptProcessor.java index 6df0bf8ee..6df0bf8ee 100644 --- a/src/java/org/apache/fop/complexscripts/scripts/TamilScriptProcessor.java +++ b/src/main/java/org/apache/fop/complexscripts/scripts/TamilScriptProcessor.java diff --git a/src/java/org/apache/fop/complexscripts/util/CharAssociation.java b/src/main/java/org/apache/fop/complexscripts/util/CharAssociation.java index 23aebbb9a..23aebbb9a 100644 --- a/src/java/org/apache/fop/complexscripts/util/CharAssociation.java +++ b/src/main/java/org/apache/fop/complexscripts/util/CharAssociation.java diff --git a/src/java/org/apache/fop/complexscripts/util/CharMirror.java b/src/main/java/org/apache/fop/complexscripts/util/CharMirror.java index 5e905931a..5e905931a 100644 --- a/src/java/org/apache/fop/complexscripts/util/CharMirror.java +++ b/src/main/java/org/apache/fop/complexscripts/util/CharMirror.java diff --git a/src/java/org/apache/fop/complexscripts/util/CharNormalize.java b/src/main/java/org/apache/fop/complexscripts/util/CharNormalize.java index a0c8e960b..a0c8e960b 100644 --- a/src/java/org/apache/fop/complexscripts/util/CharNormalize.java +++ b/src/main/java/org/apache/fop/complexscripts/util/CharNormalize.java diff --git a/src/java/org/apache/fop/complexscripts/util/CharScript.java b/src/main/java/org/apache/fop/complexscripts/util/CharScript.java index d16de5db5..d16de5db5 100644 --- a/src/java/org/apache/fop/complexscripts/util/CharScript.java +++ b/src/main/java/org/apache/fop/complexscripts/util/CharScript.java diff --git a/src/java/org/apache/fop/complexscripts/util/DiscontinuousAssociationException.java b/src/main/java/org/apache/fop/complexscripts/util/DiscontinuousAssociationException.java index 1c8310398..1c8310398 100644 --- a/src/java/org/apache/fop/complexscripts/util/DiscontinuousAssociationException.java +++ b/src/main/java/org/apache/fop/complexscripts/util/DiscontinuousAssociationException.java diff --git a/src/java/org/apache/fop/complexscripts/util/GlyphContextTester.java b/src/main/java/org/apache/fop/complexscripts/util/GlyphContextTester.java index 2e3afcc1d..2e3afcc1d 100644 --- a/src/java/org/apache/fop/complexscripts/util/GlyphContextTester.java +++ b/src/main/java/org/apache/fop/complexscripts/util/GlyphContextTester.java diff --git a/src/java/org/apache/fop/complexscripts/util/GlyphSequence.java b/src/main/java/org/apache/fop/complexscripts/util/GlyphSequence.java index 2b1d636e1..2b1d636e1 100644 --- a/src/java/org/apache/fop/complexscripts/util/GlyphSequence.java +++ b/src/main/java/org/apache/fop/complexscripts/util/GlyphSequence.java diff --git a/src/java/org/apache/fop/complexscripts/util/GlyphTester.java b/src/main/java/org/apache/fop/complexscripts/util/GlyphTester.java index 8648dcce6..8648dcce6 100644 --- a/src/java/org/apache/fop/complexscripts/util/GlyphTester.java +++ b/src/main/java/org/apache/fop/complexscripts/util/GlyphTester.java diff --git a/src/java/org/apache/fop/complexscripts/util/NumberConverter.java b/src/main/java/org/apache/fop/complexscripts/util/NumberConverter.java index bfb8b6571..bfb8b6571 100644 --- a/src/java/org/apache/fop/complexscripts/util/NumberConverter.java +++ b/src/main/java/org/apache/fop/complexscripts/util/NumberConverter.java diff --git a/src/java/org/apache/fop/complexscripts/util/ScriptContextTester.java b/src/main/java/org/apache/fop/complexscripts/util/ScriptContextTester.java index fa8596a4d..fa8596a4d 100644 --- a/src/java/org/apache/fop/complexscripts/util/ScriptContextTester.java +++ b/src/main/java/org/apache/fop/complexscripts/util/ScriptContextTester.java diff --git a/src/java/org/apache/fop/complexscripts/util/UTF32.java b/src/main/java/org/apache/fop/complexscripts/util/UTF32.java index b0f92eb88..b0f92eb88 100644 --- a/src/java/org/apache/fop/complexscripts/util/UTF32.java +++ b/src/main/java/org/apache/fop/complexscripts/util/UTF32.java diff --git a/src/java/org/apache/fop/datatypes/CompoundDatatype.java b/src/main/java/org/apache/fop/datatypes/CompoundDatatype.java index ad1c8bddf..ad1c8bddf 100644 --- a/src/java/org/apache/fop/datatypes/CompoundDatatype.java +++ b/src/main/java/org/apache/fop/datatypes/CompoundDatatype.java diff --git a/src/java/org/apache/fop/datatypes/FODimension.java b/src/main/java/org/apache/fop/datatypes/FODimension.java index 1ccb1ad55..1ccb1ad55 100644 --- a/src/java/org/apache/fop/datatypes/FODimension.java +++ b/src/main/java/org/apache/fop/datatypes/FODimension.java diff --git a/src/java/org/apache/fop/datatypes/KeepValue.java b/src/main/java/org/apache/fop/datatypes/KeepValue.java index 36fff432a..36fff432a 100644 --- a/src/java/org/apache/fop/datatypes/KeepValue.java +++ b/src/main/java/org/apache/fop/datatypes/KeepValue.java diff --git a/src/java/org/apache/fop/datatypes/Length.java b/src/main/java/org/apache/fop/datatypes/Length.java index 5e2ef8e53..5e2ef8e53 100644 --- a/src/java/org/apache/fop/datatypes/Length.java +++ b/src/main/java/org/apache/fop/datatypes/Length.java diff --git a/src/java/org/apache/fop/datatypes/LengthBase.java b/src/main/java/org/apache/fop/datatypes/LengthBase.java index 7bae525cf..7bae525cf 100644 --- a/src/java/org/apache/fop/datatypes/LengthBase.java +++ b/src/main/java/org/apache/fop/datatypes/LengthBase.java diff --git a/src/java/org/apache/fop/datatypes/Numeric.java b/src/main/java/org/apache/fop/datatypes/Numeric.java index 8ed5a0e5c..8ed5a0e5c 100644 --- a/src/java/org/apache/fop/datatypes/Numeric.java +++ b/src/main/java/org/apache/fop/datatypes/Numeric.java diff --git a/src/java/org/apache/fop/datatypes/PercentBase.java b/src/main/java/org/apache/fop/datatypes/PercentBase.java index 6bc9ac939..6bc9ac939 100644 --- a/src/java/org/apache/fop/datatypes/PercentBase.java +++ b/src/main/java/org/apache/fop/datatypes/PercentBase.java diff --git a/src/java/org/apache/fop/datatypes/PercentBaseContext.java b/src/main/java/org/apache/fop/datatypes/PercentBaseContext.java index b04f774cf..b04f774cf 100644 --- a/src/java/org/apache/fop/datatypes/PercentBaseContext.java +++ b/src/main/java/org/apache/fop/datatypes/PercentBaseContext.java diff --git a/src/java/org/apache/fop/datatypes/SimplePercentBaseContext.java b/src/main/java/org/apache/fop/datatypes/SimplePercentBaseContext.java index 271702f4e..271702f4e 100644 --- a/src/java/org/apache/fop/datatypes/SimplePercentBaseContext.java +++ b/src/main/java/org/apache/fop/datatypes/SimplePercentBaseContext.java diff --git a/src/java/org/apache/fop/datatypes/URISpecification.java b/src/main/java/org/apache/fop/datatypes/URISpecification.java index 9beb817d0..9beb817d0 100644 --- a/src/java/org/apache/fop/datatypes/URISpecification.java +++ b/src/main/java/org/apache/fop/datatypes/URISpecification.java diff --git a/src/java/org/apache/fop/datatypes/ValidationPercentBaseContext.java b/src/main/java/org/apache/fop/datatypes/ValidationPercentBaseContext.java index e13d7d980..e13d7d980 100644 --- a/src/java/org/apache/fop/datatypes/ValidationPercentBaseContext.java +++ b/src/main/java/org/apache/fop/datatypes/ValidationPercentBaseContext.java diff --git a/src/java/org/apache/fop/datatypes/package.html b/src/main/java/org/apache/fop/datatypes/package.html index 344344a5a..344344a5a 100644 --- a/src/java/org/apache/fop/datatypes/package.html +++ b/src/main/java/org/apache/fop/datatypes/package.html diff --git a/src/java/org/apache/fop/events/CompositeEventListener.java b/src/main/java/org/apache/fop/events/CompositeEventListener.java index c2bef322e..c2bef322e 100644 --- a/src/java/org/apache/fop/events/CompositeEventListener.java +++ b/src/main/java/org/apache/fop/events/CompositeEventListener.java diff --git a/src/java/org/apache/fop/events/DefaultEventBroadcaster.java b/src/main/java/org/apache/fop/events/DefaultEventBroadcaster.java index 596a0a86b..596a0a86b 100644 --- a/src/java/org/apache/fop/events/DefaultEventBroadcaster.java +++ b/src/main/java/org/apache/fop/events/DefaultEventBroadcaster.java diff --git a/src/java/org/apache/fop/events/Event.java b/src/main/java/org/apache/fop/events/Event.java index 7c5759e6b..7c5759e6b 100644 --- a/src/java/org/apache/fop/events/Event.java +++ b/src/main/java/org/apache/fop/events/Event.java diff --git a/src/java/org/apache/fop/events/EventBroadcaster.java b/src/main/java/org/apache/fop/events/EventBroadcaster.java index 57f30c9cf..57f30c9cf 100644 --- a/src/java/org/apache/fop/events/EventBroadcaster.java +++ b/src/main/java/org/apache/fop/events/EventBroadcaster.java diff --git a/src/java/org/apache/fop/events/EventExceptionManager.java b/src/main/java/org/apache/fop/events/EventExceptionManager.java index e9208fbc6..e9208fbc6 100644 --- a/src/java/org/apache/fop/events/EventExceptionManager.java +++ b/src/main/java/org/apache/fop/events/EventExceptionManager.java diff --git a/src/java/org/apache/fop/events/EventFormatter.java b/src/main/java/org/apache/fop/events/EventFormatter.java index 7f56c8396..7f56c8396 100644 --- a/src/java/org/apache/fop/events/EventFormatter.java +++ b/src/main/java/org/apache/fop/events/EventFormatter.java diff --git a/src/java/org/apache/fop/events/EventListener.java b/src/main/java/org/apache/fop/events/EventListener.java index fa1bb5beb..fa1bb5beb 100644 --- a/src/java/org/apache/fop/events/EventListener.java +++ b/src/main/java/org/apache/fop/events/EventListener.java diff --git a/src/java/org/apache/fop/events/EventProducer.java b/src/main/java/org/apache/fop/events/EventProducer.java index 88da771a4..88da771a4 100644 --- a/src/java/org/apache/fop/events/EventProducer.java +++ b/src/main/java/org/apache/fop/events/EventProducer.java diff --git a/src/java/org/apache/fop/events/FOPEventListenerProxy.java b/src/main/java/org/apache/fop/events/FOPEventListenerProxy.java index d57ef1e15..d57ef1e15 100644 --- a/src/java/org/apache/fop/events/FOPEventListenerProxy.java +++ b/src/main/java/org/apache/fop/events/FOPEventListenerProxy.java diff --git a/src/java/org/apache/fop/events/LoggingEventListener.java b/src/main/java/org/apache/fop/events/LoggingEventListener.java index 7df05f6d3..7df05f6d3 100644 --- a/src/java/org/apache/fop/events/LoggingEventListener.java +++ b/src/main/java/org/apache/fop/events/LoggingEventListener.java diff --git a/src/java/org/apache/fop/events/PropertyExceptionFactory.java b/src/main/java/org/apache/fop/events/PropertyExceptionFactory.java index 04f954f98..04f954f98 100644 --- a/src/java/org/apache/fop/events/PropertyExceptionFactory.java +++ b/src/main/java/org/apache/fop/events/PropertyExceptionFactory.java diff --git a/src/java/org/apache/fop/events/UnsupportedOperationExceptionFactory.java b/src/main/java/org/apache/fop/events/UnsupportedOperationExceptionFactory.java index b15dea7c0..b15dea7c0 100644 --- a/src/java/org/apache/fop/events/UnsupportedOperationExceptionFactory.java +++ b/src/main/java/org/apache/fop/events/UnsupportedOperationExceptionFactory.java diff --git a/src/java/org/apache/fop/events/ValidationExceptionFactory.java b/src/main/java/org/apache/fop/events/ValidationExceptionFactory.java index 59f952961..59f952961 100644 --- a/src/java/org/apache/fop/events/ValidationExceptionFactory.java +++ b/src/main/java/org/apache/fop/events/ValidationExceptionFactory.java diff --git a/src/java/org/apache/fop/events/model/EventMethodModel.java b/src/main/java/org/apache/fop/events/model/EventMethodModel.java index b9c62f8ab..b9c62f8ab 100644 --- a/src/java/org/apache/fop/events/model/EventMethodModel.java +++ b/src/main/java/org/apache/fop/events/model/EventMethodModel.java diff --git a/src/java/org/apache/fop/events/model/EventModel.java b/src/main/java/org/apache/fop/events/model/EventModel.java index 9c11b79a3..9c11b79a3 100644 --- a/src/java/org/apache/fop/events/model/EventModel.java +++ b/src/main/java/org/apache/fop/events/model/EventModel.java diff --git a/src/java/org/apache/fop/events/model/EventModelParser.java b/src/main/java/org/apache/fop/events/model/EventModelParser.java index 5441d1c4f..5441d1c4f 100644 --- a/src/java/org/apache/fop/events/model/EventModelParser.java +++ b/src/main/java/org/apache/fop/events/model/EventModelParser.java diff --git a/src/java/org/apache/fop/events/model/EventProducerModel.java b/src/main/java/org/apache/fop/events/model/EventProducerModel.java index b0d334e99..b0d334e99 100644 --- a/src/java/org/apache/fop/events/model/EventProducerModel.java +++ b/src/main/java/org/apache/fop/events/model/EventProducerModel.java diff --git a/src/java/org/apache/fop/events/model/EventSeverity.java b/src/main/java/org/apache/fop/events/model/EventSeverity.java index c0d886154..c0d886154 100644 --- a/src/java/org/apache/fop/events/model/EventSeverity.java +++ b/src/main/java/org/apache/fop/events/model/EventSeverity.java diff --git a/src/java/org/apache/fop/events/model/package.html b/src/main/java/org/apache/fop/events/model/package.html index 4d915721b..4d915721b 100644 --- a/src/java/org/apache/fop/events/model/package.html +++ b/src/main/java/org/apache/fop/events/model/package.html diff --git a/src/java/org/apache/fop/events/package.html b/src/main/java/org/apache/fop/events/package.html index d2e6d63de..d2e6d63de 100644 --- a/src/java/org/apache/fop/events/package.html +++ b/src/main/java/org/apache/fop/events/package.html diff --git a/src/java/org/apache/fop/fo/CharIterator.java b/src/main/java/org/apache/fop/fo/CharIterator.java index 68070da3f..68070da3f 100644 --- a/src/java/org/apache/fop/fo/CharIterator.java +++ b/src/main/java/org/apache/fop/fo/CharIterator.java diff --git a/src/java/org/apache/fop/fo/Constants.java b/src/main/java/org/apache/fop/fo/Constants.java index 481081021..481081021 100644 --- a/src/java/org/apache/fop/fo/Constants.java +++ b/src/main/java/org/apache/fop/fo/Constants.java diff --git a/src/java/org/apache/fop/fo/DelegatingFOEventHandler.java b/src/main/java/org/apache/fop/fo/DelegatingFOEventHandler.java index 4cf6ddd15..4cf6ddd15 100644 --- a/src/java/org/apache/fop/fo/DelegatingFOEventHandler.java +++ b/src/main/java/org/apache/fop/fo/DelegatingFOEventHandler.java diff --git a/src/java/org/apache/fop/fo/ElementMapping.java b/src/main/java/org/apache/fop/fo/ElementMapping.java index fcd1b9e89..fcd1b9e89 100644 --- a/src/java/org/apache/fop/fo/ElementMapping.java +++ b/src/main/java/org/apache/fop/fo/ElementMapping.java diff --git a/src/java/org/apache/fop/fo/ElementMappingRegistry.java b/src/main/java/org/apache/fop/fo/ElementMappingRegistry.java index 08e960b1d..08e960b1d 100644 --- a/src/java/org/apache/fop/fo/ElementMappingRegistry.java +++ b/src/main/java/org/apache/fop/fo/ElementMappingRegistry.java diff --git a/src/java/org/apache/fop/fo/FOElementMapping.java b/src/main/java/org/apache/fop/fo/FOElementMapping.java index b087e1d9c..b087e1d9c 100644 --- a/src/java/org/apache/fop/fo/FOElementMapping.java +++ b/src/main/java/org/apache/fop/fo/FOElementMapping.java diff --git a/src/java/org/apache/fop/fo/FOEventHandler.java b/src/main/java/org/apache/fop/fo/FOEventHandler.java index 0be90dd04..0be90dd04 100644 --- a/src/java/org/apache/fop/fo/FOEventHandler.java +++ b/src/main/java/org/apache/fop/fo/FOEventHandler.java diff --git a/src/java/org/apache/fop/fo/FONode.java b/src/main/java/org/apache/fop/fo/FONode.java index f5eb8854e..f5eb8854e 100644 --- a/src/java/org/apache/fop/fo/FONode.java +++ b/src/main/java/org/apache/fop/fo/FONode.java diff --git a/src/java/org/apache/fop/fo/FOPropertyMapping.java b/src/main/java/org/apache/fop/fo/FOPropertyMapping.java index da92cc834..da92cc834 100644 --- a/src/java/org/apache/fop/fo/FOPropertyMapping.java +++ b/src/main/java/org/apache/fop/fo/FOPropertyMapping.java diff --git a/src/java/org/apache/fop/fo/FOText.java b/src/main/java/org/apache/fop/fo/FOText.java index 9f286d888..9f286d888 100644 --- a/src/java/org/apache/fop/fo/FOText.java +++ b/src/main/java/org/apache/fop/fo/FOText.java diff --git a/src/java/org/apache/fop/fo/FOTreeBuilder.java b/src/main/java/org/apache/fop/fo/FOTreeBuilder.java index e3afbbb75..e3afbbb75 100644 --- a/src/java/org/apache/fop/fo/FOTreeBuilder.java +++ b/src/main/java/org/apache/fop/fo/FOTreeBuilder.java diff --git a/src/java/org/apache/fop/fo/FOTreeBuilderContext.java b/src/main/java/org/apache/fop/fo/FOTreeBuilderContext.java index f1060e6a4..f1060e6a4 100644 --- a/src/java/org/apache/fop/fo/FOTreeBuilderContext.java +++ b/src/main/java/org/apache/fop/fo/FOTreeBuilderContext.java diff --git a/src/java/org/apache/fop/fo/FOValidationEventProducer.java b/src/main/java/org/apache/fop/fo/FOValidationEventProducer.java index a96cb3fe3..a96cb3fe3 100644 --- a/src/java/org/apache/fop/fo/FOValidationEventProducer.java +++ b/src/main/java/org/apache/fop/fo/FOValidationEventProducer.java diff --git a/src/java/org/apache/fop/fo/FOValidationEventProducer.xml b/src/main/java/org/apache/fop/fo/FOValidationEventProducer.xml index 9f23557c3..9f23557c3 100644 --- a/src/java/org/apache/fop/fo/FOValidationEventProducer.xml +++ b/src/main/java/org/apache/fop/fo/FOValidationEventProducer.xml diff --git a/src/java/org/apache/fop/fo/FOValidationEventProducer_de.xml b/src/main/java/org/apache/fop/fo/FOValidationEventProducer_de.xml index 4b6090ab7..4b6090ab7 100644 --- a/src/java/org/apache/fop/fo/FOValidationEventProducer_de.xml +++ b/src/main/java/org/apache/fop/fo/FOValidationEventProducer_de.xml diff --git a/src/java/org/apache/fop/fo/FObj.java b/src/main/java/org/apache/fop/fo/FObj.java index ce983dfb2..ce983dfb2 100644 --- a/src/java/org/apache/fop/fo/FObj.java +++ b/src/main/java/org/apache/fop/fo/FObj.java diff --git a/src/java/org/apache/fop/fo/FObjMixed.java b/src/main/java/org/apache/fop/fo/FObjMixed.java index 6d712c9ce..6d712c9ce 100644 --- a/src/java/org/apache/fop/fo/FObjMixed.java +++ b/src/main/java/org/apache/fop/fo/FObjMixed.java diff --git a/src/java/org/apache/fop/fo/GraphicsProperties.java b/src/main/java/org/apache/fop/fo/GraphicsProperties.java index a22d59c24..a22d59c24 100644 --- a/src/java/org/apache/fop/fo/GraphicsProperties.java +++ b/src/main/java/org/apache/fop/fo/GraphicsProperties.java diff --git a/src/java/org/apache/fop/fo/NullCharIterator.java b/src/main/java/org/apache/fop/fo/NullCharIterator.java index 0c796fe73..0c796fe73 100644 --- a/src/java/org/apache/fop/fo/NullCharIterator.java +++ b/src/main/java/org/apache/fop/fo/NullCharIterator.java diff --git a/src/java/org/apache/fop/fo/OneCharIterator.java b/src/main/java/org/apache/fop/fo/OneCharIterator.java index e2c7275e8..e2c7275e8 100644 --- a/src/java/org/apache/fop/fo/OneCharIterator.java +++ b/src/main/java/org/apache/fop/fo/OneCharIterator.java diff --git a/src/java/org/apache/fop/fo/PropertyList.java b/src/main/java/org/apache/fop/fo/PropertyList.java index 0412091a5..0412091a5 100644 --- a/src/java/org/apache/fop/fo/PropertyList.java +++ b/src/main/java/org/apache/fop/fo/PropertyList.java diff --git a/src/java/org/apache/fop/fo/PropertyListMaker.java b/src/main/java/org/apache/fop/fo/PropertyListMaker.java index ef8978b0c..ef8978b0c 100644 --- a/src/java/org/apache/fop/fo/PropertyListMaker.java +++ b/src/main/java/org/apache/fop/fo/PropertyListMaker.java diff --git a/src/java/org/apache/fop/fo/RecursiveCharIterator.java b/src/main/java/org/apache/fop/fo/RecursiveCharIterator.java index 2afb97bcd..2afb97bcd 100644 --- a/src/java/org/apache/fop/fo/RecursiveCharIterator.java +++ b/src/main/java/org/apache/fop/fo/RecursiveCharIterator.java diff --git a/src/java/org/apache/fop/fo/StaticPropertyList.java b/src/main/java/org/apache/fop/fo/StaticPropertyList.java index c3ab95b91..c3ab95b91 100644 --- a/src/java/org/apache/fop/fo/StaticPropertyList.java +++ b/src/main/java/org/apache/fop/fo/StaticPropertyList.java diff --git a/src/java/org/apache/fop/fo/StringCharIterator.java b/src/main/java/org/apache/fop/fo/StringCharIterator.java index f3490052b..f3490052b 100644 --- a/src/java/org/apache/fop/fo/StringCharIterator.java +++ b/src/main/java/org/apache/fop/fo/StringCharIterator.java diff --git a/src/java/org/apache/fop/fo/UnknownXMLObj.java b/src/main/java/org/apache/fop/fo/UnknownXMLObj.java index ac6676427..ac6676427 100644 --- a/src/java/org/apache/fop/fo/UnknownXMLObj.java +++ b/src/main/java/org/apache/fop/fo/UnknownXMLObj.java diff --git a/src/java/org/apache/fop/fo/ValidationException.java b/src/main/java/org/apache/fop/fo/ValidationException.java index 745732863..745732863 100644 --- a/src/java/org/apache/fop/fo/ValidationException.java +++ b/src/main/java/org/apache/fop/fo/ValidationException.java diff --git a/src/java/org/apache/fop/fo/XMLObj.java b/src/main/java/org/apache/fop/fo/XMLObj.java index 1c4597295..1c4597295 100644 --- a/src/java/org/apache/fop/fo/XMLObj.java +++ b/src/main/java/org/apache/fop/fo/XMLObj.java diff --git a/src/java/org/apache/fop/fo/XMLWhiteSpaceHandler.java b/src/main/java/org/apache/fop/fo/XMLWhiteSpaceHandler.java index 8bd28caf5..8bd28caf5 100644 --- a/src/java/org/apache/fop/fo/XMLWhiteSpaceHandler.java +++ b/src/main/java/org/apache/fop/fo/XMLWhiteSpaceHandler.java diff --git a/src/java/org/apache/fop/fo/expr/AbsFunction.java b/src/main/java/org/apache/fop/fo/expr/AbsFunction.java index 9c266da76..9c266da76 100644 --- a/src/java/org/apache/fop/fo/expr/AbsFunction.java +++ b/src/main/java/org/apache/fop/fo/expr/AbsFunction.java diff --git a/src/java/org/apache/fop/fo/expr/BodyStartFunction.java b/src/main/java/org/apache/fop/fo/expr/BodyStartFunction.java index 5177f8a51..5177f8a51 100644 --- a/src/java/org/apache/fop/fo/expr/BodyStartFunction.java +++ b/src/main/java/org/apache/fop/fo/expr/BodyStartFunction.java diff --git a/src/java/org/apache/fop/fo/expr/CIELabColorFunction.java b/src/main/java/org/apache/fop/fo/expr/CIELabColorFunction.java index 9783f5384..9783f5384 100644 --- a/src/java/org/apache/fop/fo/expr/CIELabColorFunction.java +++ b/src/main/java/org/apache/fop/fo/expr/CIELabColorFunction.java diff --git a/src/java/org/apache/fop/fo/expr/CMYKColorFunction.java b/src/main/java/org/apache/fop/fo/expr/CMYKColorFunction.java index 1ca8cfaa0..1ca8cfaa0 100644 --- a/src/java/org/apache/fop/fo/expr/CMYKColorFunction.java +++ b/src/main/java/org/apache/fop/fo/expr/CMYKColorFunction.java diff --git a/src/java/org/apache/fop/fo/expr/CeilingFunction.java b/src/main/java/org/apache/fop/fo/expr/CeilingFunction.java index 9c69cd1bc..9c69cd1bc 100644 --- a/src/java/org/apache/fop/fo/expr/CeilingFunction.java +++ b/src/main/java/org/apache/fop/fo/expr/CeilingFunction.java diff --git a/src/java/org/apache/fop/fo/expr/FloorFunction.java b/src/main/java/org/apache/fop/fo/expr/FloorFunction.java index 501b8d59d..501b8d59d 100644 --- a/src/java/org/apache/fop/fo/expr/FloorFunction.java +++ b/src/main/java/org/apache/fop/fo/expr/FloorFunction.java diff --git a/src/java/org/apache/fop/fo/expr/FromNearestSpecifiedValueFunction.java b/src/main/java/org/apache/fop/fo/expr/FromNearestSpecifiedValueFunction.java index 6da7fcd25..6da7fcd25 100644 --- a/src/java/org/apache/fop/fo/expr/FromNearestSpecifiedValueFunction.java +++ b/src/main/java/org/apache/fop/fo/expr/FromNearestSpecifiedValueFunction.java diff --git a/src/java/org/apache/fop/fo/expr/FromParentFunction.java b/src/main/java/org/apache/fop/fo/expr/FromParentFunction.java index 22a1a95e1..22a1a95e1 100644 --- a/src/java/org/apache/fop/fo/expr/FromParentFunction.java +++ b/src/main/java/org/apache/fop/fo/expr/FromParentFunction.java diff --git a/src/java/org/apache/fop/fo/expr/FromTableColumnFunction.java b/src/main/java/org/apache/fop/fo/expr/FromTableColumnFunction.java index 6874a821f..6874a821f 100644 --- a/src/java/org/apache/fop/fo/expr/FromTableColumnFunction.java +++ b/src/main/java/org/apache/fop/fo/expr/FromTableColumnFunction.java diff --git a/src/java/org/apache/fop/fo/expr/Function.java b/src/main/java/org/apache/fop/fo/expr/Function.java index f558543c0..f558543c0 100644 --- a/src/java/org/apache/fop/fo/expr/Function.java +++ b/src/main/java/org/apache/fop/fo/expr/Function.java diff --git a/src/java/org/apache/fop/fo/expr/FunctionBase.java b/src/main/java/org/apache/fop/fo/expr/FunctionBase.java index e5e346060..e5e346060 100644 --- a/src/java/org/apache/fop/fo/expr/FunctionBase.java +++ b/src/main/java/org/apache/fop/fo/expr/FunctionBase.java diff --git a/src/java/org/apache/fop/fo/expr/InheritedPropFunction.java b/src/main/java/org/apache/fop/fo/expr/InheritedPropFunction.java index d73a8e089..d73a8e089 100644 --- a/src/java/org/apache/fop/fo/expr/InheritedPropFunction.java +++ b/src/main/java/org/apache/fop/fo/expr/InheritedPropFunction.java diff --git a/src/java/org/apache/fop/fo/expr/LabelEndFunction.java b/src/main/java/org/apache/fop/fo/expr/LabelEndFunction.java index 57facc058..57facc058 100644 --- a/src/java/org/apache/fop/fo/expr/LabelEndFunction.java +++ b/src/main/java/org/apache/fop/fo/expr/LabelEndFunction.java diff --git a/src/java/org/apache/fop/fo/expr/MaxFunction.java b/src/main/java/org/apache/fop/fo/expr/MaxFunction.java index 442197de6..442197de6 100644 --- a/src/java/org/apache/fop/fo/expr/MaxFunction.java +++ b/src/main/java/org/apache/fop/fo/expr/MaxFunction.java diff --git a/src/java/org/apache/fop/fo/expr/MinFunction.java b/src/main/java/org/apache/fop/fo/expr/MinFunction.java index 19a06ada1..19a06ada1 100644 --- a/src/java/org/apache/fop/fo/expr/MinFunction.java +++ b/src/main/java/org/apache/fop/fo/expr/MinFunction.java diff --git a/src/java/org/apache/fop/fo/expr/NCnameProperty.java b/src/main/java/org/apache/fop/fo/expr/NCnameProperty.java index 4b2430c51..4b2430c51 100644 --- a/src/java/org/apache/fop/fo/expr/NCnameProperty.java +++ b/src/main/java/org/apache/fop/fo/expr/NCnameProperty.java diff --git a/src/java/org/apache/fop/fo/expr/NumericOp.java b/src/main/java/org/apache/fop/fo/expr/NumericOp.java index a2b203330..a2b203330 100644 --- a/src/java/org/apache/fop/fo/expr/NumericOp.java +++ b/src/main/java/org/apache/fop/fo/expr/NumericOp.java diff --git a/src/java/org/apache/fop/fo/expr/NumericProperty.java b/src/main/java/org/apache/fop/fo/expr/NumericProperty.java index a3a108191..a3a108191 100644 --- a/src/java/org/apache/fop/fo/expr/NumericProperty.java +++ b/src/main/java/org/apache/fop/fo/expr/NumericProperty.java diff --git a/src/java/org/apache/fop/fo/expr/OCAColorFunction.java b/src/main/java/org/apache/fop/fo/expr/OCAColorFunction.java index 06bee49cd..06bee49cd 100644 --- a/src/java/org/apache/fop/fo/expr/OCAColorFunction.java +++ b/src/main/java/org/apache/fop/fo/expr/OCAColorFunction.java diff --git a/src/java/org/apache/fop/fo/expr/PropertyException.java b/src/main/java/org/apache/fop/fo/expr/PropertyException.java index 2d1d04913..2d1d04913 100644 --- a/src/java/org/apache/fop/fo/expr/PropertyException.java +++ b/src/main/java/org/apache/fop/fo/expr/PropertyException.java diff --git a/src/java/org/apache/fop/fo/expr/PropertyInfo.java b/src/main/java/org/apache/fop/fo/expr/PropertyInfo.java index 0463e2e1d..0463e2e1d 100644 --- a/src/java/org/apache/fop/fo/expr/PropertyInfo.java +++ b/src/main/java/org/apache/fop/fo/expr/PropertyInfo.java diff --git a/src/java/org/apache/fop/fo/expr/PropertyParser.java b/src/main/java/org/apache/fop/fo/expr/PropertyParser.java index c3cb073bd..c3cb073bd 100644 --- a/src/java/org/apache/fop/fo/expr/PropertyParser.java +++ b/src/main/java/org/apache/fop/fo/expr/PropertyParser.java diff --git a/src/java/org/apache/fop/fo/expr/PropertyTokenizer.java b/src/main/java/org/apache/fop/fo/expr/PropertyTokenizer.java index f9b4cd87d..f9b4cd87d 100644 --- a/src/java/org/apache/fop/fo/expr/PropertyTokenizer.java +++ b/src/main/java/org/apache/fop/fo/expr/PropertyTokenizer.java diff --git a/src/java/org/apache/fop/fo/expr/ProportionalColumnWidthFunction.java b/src/main/java/org/apache/fop/fo/expr/ProportionalColumnWidthFunction.java index 8f9df5d5f..8f9df5d5f 100644 --- a/src/java/org/apache/fop/fo/expr/ProportionalColumnWidthFunction.java +++ b/src/main/java/org/apache/fop/fo/expr/ProportionalColumnWidthFunction.java diff --git a/src/java/org/apache/fop/fo/expr/RGBColorFunction.java b/src/main/java/org/apache/fop/fo/expr/RGBColorFunction.java index 9f8a7f600..9f8a7f600 100644 --- a/src/java/org/apache/fop/fo/expr/RGBColorFunction.java +++ b/src/main/java/org/apache/fop/fo/expr/RGBColorFunction.java diff --git a/src/java/org/apache/fop/fo/expr/RGBICCColorFunction.java b/src/main/java/org/apache/fop/fo/expr/RGBICCColorFunction.java index 57cf6a949..57cf6a949 100644 --- a/src/java/org/apache/fop/fo/expr/RGBICCColorFunction.java +++ b/src/main/java/org/apache/fop/fo/expr/RGBICCColorFunction.java diff --git a/src/java/org/apache/fop/fo/expr/RGBNamedColorFunction.java b/src/main/java/org/apache/fop/fo/expr/RGBNamedColorFunction.java index 076900d68..076900d68 100644 --- a/src/java/org/apache/fop/fo/expr/RGBNamedColorFunction.java +++ b/src/main/java/org/apache/fop/fo/expr/RGBNamedColorFunction.java diff --git a/src/java/org/apache/fop/fo/expr/RelativeNumericProperty.java b/src/main/java/org/apache/fop/fo/expr/RelativeNumericProperty.java index 3e5ad738d..3e5ad738d 100644 --- a/src/java/org/apache/fop/fo/expr/RelativeNumericProperty.java +++ b/src/main/java/org/apache/fop/fo/expr/RelativeNumericProperty.java diff --git a/src/java/org/apache/fop/fo/expr/RoundFunction.java b/src/main/java/org/apache/fop/fo/expr/RoundFunction.java index 201039b5a..201039b5a 100644 --- a/src/java/org/apache/fop/fo/expr/RoundFunction.java +++ b/src/main/java/org/apache/fop/fo/expr/RoundFunction.java diff --git a/src/java/org/apache/fop/fo/expr/SystemColorFunction.java b/src/main/java/org/apache/fop/fo/expr/SystemColorFunction.java index 8ec88e983..8ec88e983 100644 --- a/src/java/org/apache/fop/fo/expr/SystemColorFunction.java +++ b/src/main/java/org/apache/fop/fo/expr/SystemColorFunction.java diff --git a/src/java/org/apache/fop/fo/expr/package.html b/src/main/java/org/apache/fop/fo/expr/package.html index 0ccd91ee5..0ccd91ee5 100644 --- a/src/java/org/apache/fop/fo/expr/package.html +++ b/src/main/java/org/apache/fop/fo/expr/package.html diff --git a/src/java/org/apache/fop/fo/extensions/ExtensionAttachment.java b/src/main/java/org/apache/fop/fo/extensions/ExtensionAttachment.java index 993768c81..993768c81 100644 --- a/src/java/org/apache/fop/fo/extensions/ExtensionAttachment.java +++ b/src/main/java/org/apache/fop/fo/extensions/ExtensionAttachment.java diff --git a/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java b/src/main/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java index a0df3e122..a0df3e122 100644 --- a/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java +++ b/src/main/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java diff --git a/src/java/org/apache/fop/fo/extensions/ExternalDocument.java b/src/main/java/org/apache/fop/fo/extensions/ExternalDocument.java index b450c21ce..b450c21ce 100644 --- a/src/java/org/apache/fop/fo/extensions/ExternalDocument.java +++ b/src/main/java/org/apache/fop/fo/extensions/ExternalDocument.java diff --git a/src/java/org/apache/fop/fo/extensions/InternalElementMapping.java b/src/main/java/org/apache/fop/fo/extensions/InternalElementMapping.java index f257dd79d..f257dd79d 100644 --- a/src/java/org/apache/fop/fo/extensions/InternalElementMapping.java +++ b/src/main/java/org/apache/fop/fo/extensions/InternalElementMapping.java diff --git a/src/java/org/apache/fop/fo/extensions/OldExtensionElementMapping.java b/src/main/java/org/apache/fop/fo/extensions/OldExtensionElementMapping.java index d1c671dbe..d1c671dbe 100644 --- a/src/java/org/apache/fop/fo/extensions/OldExtensionElementMapping.java +++ b/src/main/java/org/apache/fop/fo/extensions/OldExtensionElementMapping.java diff --git a/src/java/org/apache/fop/fo/extensions/destination/Destination.java b/src/main/java/org/apache/fop/fo/extensions/destination/Destination.java index 95ae64c7d..95ae64c7d 100644 --- a/src/java/org/apache/fop/fo/extensions/destination/Destination.java +++ b/src/main/java/org/apache/fop/fo/extensions/destination/Destination.java diff --git a/src/java/org/apache/fop/fo/extensions/destination/package.html b/src/main/java/org/apache/fop/fo/extensions/destination/package.html index 59cbb493d..59cbb493d 100644 --- a/src/java/org/apache/fop/fo/extensions/destination/package.html +++ b/src/main/java/org/apache/fop/fo/extensions/destination/package.html diff --git a/src/java/org/apache/fop/fo/extensions/package.html b/src/main/java/org/apache/fop/fo/extensions/package.html index 237037308..237037308 100644 --- a/src/java/org/apache/fop/fo/extensions/package.html +++ b/src/main/java/org/apache/fop/fo/extensions/package.html diff --git a/src/java/org/apache/fop/fo/extensions/svg/BatikExtensionElementMapping.java b/src/main/java/org/apache/fop/fo/extensions/svg/BatikExtensionElementMapping.java index 7f8da1063..7f8da1063 100644 --- a/src/java/org/apache/fop/fo/extensions/svg/BatikExtensionElementMapping.java +++ b/src/main/java/org/apache/fop/fo/extensions/svg/BatikExtensionElementMapping.java diff --git a/src/java/org/apache/fop/fo/extensions/svg/SVGDOMContentHandlerFactory.java b/src/main/java/org/apache/fop/fo/extensions/svg/SVGDOMContentHandlerFactory.java index 58ecdc6f1..58ecdc6f1 100644 --- a/src/java/org/apache/fop/fo/extensions/svg/SVGDOMContentHandlerFactory.java +++ b/src/main/java/org/apache/fop/fo/extensions/svg/SVGDOMContentHandlerFactory.java diff --git a/src/java/org/apache/fop/fo/extensions/svg/SVGElement.java b/src/main/java/org/apache/fop/fo/extensions/svg/SVGElement.java index ccb732132..ccb732132 100644 --- a/src/java/org/apache/fop/fo/extensions/svg/SVGElement.java +++ b/src/main/java/org/apache/fop/fo/extensions/svg/SVGElement.java diff --git a/src/java/org/apache/fop/fo/extensions/svg/SVGElementMapping.java b/src/main/java/org/apache/fop/fo/extensions/svg/SVGElementMapping.java index 1b1afe6ab..1b1afe6ab 100644 --- a/src/java/org/apache/fop/fo/extensions/svg/SVGElementMapping.java +++ b/src/main/java/org/apache/fop/fo/extensions/svg/SVGElementMapping.java diff --git a/src/java/org/apache/fop/fo/extensions/svg/SVGObj.java b/src/main/java/org/apache/fop/fo/extensions/svg/SVGObj.java index b23e0f6c6..b23e0f6c6 100644 --- a/src/java/org/apache/fop/fo/extensions/svg/SVGObj.java +++ b/src/main/java/org/apache/fop/fo/extensions/svg/SVGObj.java diff --git a/src/java/org/apache/fop/fo/extensions/svg/package.html b/src/main/java/org/apache/fop/fo/extensions/svg/package.html index 5b57f7db4..5b57f7db4 100644 --- a/src/java/org/apache/fop/fo/extensions/svg/package.html +++ b/src/main/java/org/apache/fop/fo/extensions/svg/package.html diff --git a/src/java/org/apache/fop/fo/extensions/xmp/AbstractMetadataElement.java b/src/main/java/org/apache/fop/fo/extensions/xmp/AbstractMetadataElement.java index 8004be01b..8004be01b 100644 --- a/src/java/org/apache/fop/fo/extensions/xmp/AbstractMetadataElement.java +++ b/src/main/java/org/apache/fop/fo/extensions/xmp/AbstractMetadataElement.java diff --git a/src/java/org/apache/fop/fo/extensions/xmp/RDFElement.java b/src/main/java/org/apache/fop/fo/extensions/xmp/RDFElement.java index 094e1ab5c..094e1ab5c 100644 --- a/src/java/org/apache/fop/fo/extensions/xmp/RDFElement.java +++ b/src/main/java/org/apache/fop/fo/extensions/xmp/RDFElement.java diff --git a/src/java/org/apache/fop/fo/extensions/xmp/RDFElementMapping.java b/src/main/java/org/apache/fop/fo/extensions/xmp/RDFElementMapping.java index 027a35a32..027a35a32 100644 --- a/src/java/org/apache/fop/fo/extensions/xmp/RDFElementMapping.java +++ b/src/main/java/org/apache/fop/fo/extensions/xmp/RDFElementMapping.java diff --git a/src/java/org/apache/fop/fo/extensions/xmp/XMPContentHandlerFactory.java b/src/main/java/org/apache/fop/fo/extensions/xmp/XMPContentHandlerFactory.java index fd64f1a98..fd64f1a98 100644 --- a/src/java/org/apache/fop/fo/extensions/xmp/XMPContentHandlerFactory.java +++ b/src/main/java/org/apache/fop/fo/extensions/xmp/XMPContentHandlerFactory.java diff --git a/src/java/org/apache/fop/fo/extensions/xmp/XMPElementMapping.java b/src/main/java/org/apache/fop/fo/extensions/xmp/XMPElementMapping.java index bdcadc780..bdcadc780 100644 --- a/src/java/org/apache/fop/fo/extensions/xmp/XMPElementMapping.java +++ b/src/main/java/org/apache/fop/fo/extensions/xmp/XMPElementMapping.java diff --git a/src/java/org/apache/fop/fo/extensions/xmp/XMPMetaElement.java b/src/main/java/org/apache/fop/fo/extensions/xmp/XMPMetaElement.java index f61c59d64..f61c59d64 100644 --- a/src/java/org/apache/fop/fo/extensions/xmp/XMPMetaElement.java +++ b/src/main/java/org/apache/fop/fo/extensions/xmp/XMPMetaElement.java diff --git a/src/java/org/apache/fop/fo/extensions/xmp/XMPMetadata.java b/src/main/java/org/apache/fop/fo/extensions/xmp/XMPMetadata.java index af8231448..af8231448 100644 --- a/src/java/org/apache/fop/fo/extensions/xmp/XMPMetadata.java +++ b/src/main/java/org/apache/fop/fo/extensions/xmp/XMPMetadata.java diff --git a/src/java/org/apache/fop/fo/extensions/xmp/package.html b/src/main/java/org/apache/fop/fo/extensions/xmp/package.html index d644bffcb..d644bffcb 100644 --- a/src/java/org/apache/fop/fo/extensions/xmp/package.html +++ b/src/main/java/org/apache/fop/fo/extensions/xmp/package.html diff --git a/src/java/org/apache/fop/fo/flow/AbstractGraphics.java b/src/main/java/org/apache/fop/fo/flow/AbstractGraphics.java index 9f56abb43..9f56abb43 100644 --- a/src/java/org/apache/fop/fo/flow/AbstractGraphics.java +++ b/src/main/java/org/apache/fop/fo/flow/AbstractGraphics.java diff --git a/src/java/org/apache/fop/fo/flow/AbstractListItemPart.java b/src/main/java/org/apache/fop/fo/flow/AbstractListItemPart.java index f10456000..f10456000 100644 --- a/src/java/org/apache/fop/fo/flow/AbstractListItemPart.java +++ b/src/main/java/org/apache/fop/fo/flow/AbstractListItemPart.java diff --git a/src/java/org/apache/fop/fo/flow/AbstractPageNumberCitation.java b/src/main/java/org/apache/fop/fo/flow/AbstractPageNumberCitation.java index 60deaebec..60deaebec 100644 --- a/src/java/org/apache/fop/fo/flow/AbstractPageNumberCitation.java +++ b/src/main/java/org/apache/fop/fo/flow/AbstractPageNumberCitation.java diff --git a/src/java/org/apache/fop/fo/flow/AbstractRetrieveMarker.java b/src/main/java/org/apache/fop/fo/flow/AbstractRetrieveMarker.java index f69649110..f69649110 100644 --- a/src/java/org/apache/fop/fo/flow/AbstractRetrieveMarker.java +++ b/src/main/java/org/apache/fop/fo/flow/AbstractRetrieveMarker.java diff --git a/src/java/org/apache/fop/fo/flow/BasicLink.java b/src/main/java/org/apache/fop/fo/flow/BasicLink.java index 3b59659e7..3b59659e7 100644 --- a/src/java/org/apache/fop/fo/flow/BasicLink.java +++ b/src/main/java/org/apache/fop/fo/flow/BasicLink.java diff --git a/src/java/org/apache/fop/fo/flow/BidiOverride.java b/src/main/java/org/apache/fop/fo/flow/BidiOverride.java index 7b20a0b87..7b20a0b87 100644 --- a/src/java/org/apache/fop/fo/flow/BidiOverride.java +++ b/src/main/java/org/apache/fop/fo/flow/BidiOverride.java diff --git a/src/java/org/apache/fop/fo/flow/Block.java b/src/main/java/org/apache/fop/fo/flow/Block.java index aa55b24a3..aa55b24a3 100644 --- a/src/java/org/apache/fop/fo/flow/Block.java +++ b/src/main/java/org/apache/fop/fo/flow/Block.java diff --git a/src/java/org/apache/fop/fo/flow/BlockContainer.java b/src/main/java/org/apache/fop/fo/flow/BlockContainer.java index d5d8114ea..d5d8114ea 100644 --- a/src/java/org/apache/fop/fo/flow/BlockContainer.java +++ b/src/main/java/org/apache/fop/fo/flow/BlockContainer.java diff --git a/src/java/org/apache/fop/fo/flow/Character.java b/src/main/java/org/apache/fop/fo/flow/Character.java index c075d8b7e..c075d8b7e 100644 --- a/src/java/org/apache/fop/fo/flow/Character.java +++ b/src/main/java/org/apache/fop/fo/flow/Character.java diff --git a/src/java/org/apache/fop/fo/flow/ExternalGraphic.java b/src/main/java/org/apache/fop/fo/flow/ExternalGraphic.java index b564526b4..b564526b4 100644 --- a/src/java/org/apache/fop/fo/flow/ExternalGraphic.java +++ b/src/main/java/org/apache/fop/fo/flow/ExternalGraphic.java diff --git a/src/java/org/apache/fop/fo/flow/Float.java b/src/main/java/org/apache/fop/fo/flow/Float.java index a10d9c74d..a10d9c74d 100644 --- a/src/java/org/apache/fop/fo/flow/Float.java +++ b/src/main/java/org/apache/fop/fo/flow/Float.java diff --git a/src/java/org/apache/fop/fo/flow/Footnote.java b/src/main/java/org/apache/fop/fo/flow/Footnote.java index 521e8b081..521e8b081 100644 --- a/src/java/org/apache/fop/fo/flow/Footnote.java +++ b/src/main/java/org/apache/fop/fo/flow/Footnote.java diff --git a/src/java/org/apache/fop/fo/flow/FootnoteBody.java b/src/main/java/org/apache/fop/fo/flow/FootnoteBody.java index ab2434c47..ab2434c47 100644 --- a/src/java/org/apache/fop/fo/flow/FootnoteBody.java +++ b/src/main/java/org/apache/fop/fo/flow/FootnoteBody.java diff --git a/src/java/org/apache/fop/fo/flow/InitialPropertySet.java b/src/main/java/org/apache/fop/fo/flow/InitialPropertySet.java index b41021b75..b41021b75 100644 --- a/src/java/org/apache/fop/fo/flow/InitialPropertySet.java +++ b/src/main/java/org/apache/fop/fo/flow/InitialPropertySet.java diff --git a/src/java/org/apache/fop/fo/flow/Inline.java b/src/main/java/org/apache/fop/fo/flow/Inline.java index 3ee4ce926..3ee4ce926 100644 --- a/src/java/org/apache/fop/fo/flow/Inline.java +++ b/src/main/java/org/apache/fop/fo/flow/Inline.java diff --git a/src/java/org/apache/fop/fo/flow/InlineContainer.java b/src/main/java/org/apache/fop/fo/flow/InlineContainer.java index 5c95fa34e..5c95fa34e 100644 --- a/src/java/org/apache/fop/fo/flow/InlineContainer.java +++ b/src/main/java/org/apache/fop/fo/flow/InlineContainer.java diff --git a/src/java/org/apache/fop/fo/flow/InlineLevel.java b/src/main/java/org/apache/fop/fo/flow/InlineLevel.java index 87ea5837a..87ea5837a 100644 --- a/src/java/org/apache/fop/fo/flow/InlineLevel.java +++ b/src/main/java/org/apache/fop/fo/flow/InlineLevel.java diff --git a/src/java/org/apache/fop/fo/flow/InstreamForeignObject.java b/src/main/java/org/apache/fop/fo/flow/InstreamForeignObject.java index 9f88b9478..9f88b9478 100644 --- a/src/java/org/apache/fop/fo/flow/InstreamForeignObject.java +++ b/src/main/java/org/apache/fop/fo/flow/InstreamForeignObject.java diff --git a/src/java/org/apache/fop/fo/flow/Leader.java b/src/main/java/org/apache/fop/fo/flow/Leader.java index b4243f22e..b4243f22e 100644 --- a/src/java/org/apache/fop/fo/flow/Leader.java +++ b/src/main/java/org/apache/fop/fo/flow/Leader.java diff --git a/src/java/org/apache/fop/fo/flow/ListBlock.java b/src/main/java/org/apache/fop/fo/flow/ListBlock.java index 452f2c4d4..452f2c4d4 100644 --- a/src/java/org/apache/fop/fo/flow/ListBlock.java +++ b/src/main/java/org/apache/fop/fo/flow/ListBlock.java diff --git a/src/java/org/apache/fop/fo/flow/ListItem.java b/src/main/java/org/apache/fop/fo/flow/ListItem.java index ec04d3bde..ec04d3bde 100644 --- a/src/java/org/apache/fop/fo/flow/ListItem.java +++ b/src/main/java/org/apache/fop/fo/flow/ListItem.java diff --git a/src/java/org/apache/fop/fo/flow/ListItemBody.java b/src/main/java/org/apache/fop/fo/flow/ListItemBody.java index 5b121f53c..5b121f53c 100644 --- a/src/java/org/apache/fop/fo/flow/ListItemBody.java +++ b/src/main/java/org/apache/fop/fo/flow/ListItemBody.java diff --git a/src/java/org/apache/fop/fo/flow/ListItemLabel.java b/src/main/java/org/apache/fop/fo/flow/ListItemLabel.java index 53dfab84e..53dfab84e 100644 --- a/src/java/org/apache/fop/fo/flow/ListItemLabel.java +++ b/src/main/java/org/apache/fop/fo/flow/ListItemLabel.java diff --git a/src/java/org/apache/fop/fo/flow/Marker.java b/src/main/java/org/apache/fop/fo/flow/Marker.java index 4a2ea64fc..4a2ea64fc 100644 --- a/src/java/org/apache/fop/fo/flow/Marker.java +++ b/src/main/java/org/apache/fop/fo/flow/Marker.java diff --git a/src/java/org/apache/fop/fo/flow/Markers.java b/src/main/java/org/apache/fop/fo/flow/Markers.java index d2c9aa863..d2c9aa863 100644 --- a/src/java/org/apache/fop/fo/flow/Markers.java +++ b/src/main/java/org/apache/fop/fo/flow/Markers.java diff --git a/src/java/org/apache/fop/fo/flow/MultiCase.java b/src/main/java/org/apache/fop/fo/flow/MultiCase.java index ef6e444e1..ef6e444e1 100644 --- a/src/java/org/apache/fop/fo/flow/MultiCase.java +++ b/src/main/java/org/apache/fop/fo/flow/MultiCase.java diff --git a/src/java/org/apache/fop/fo/flow/MultiProperties.java b/src/main/java/org/apache/fop/fo/flow/MultiProperties.java index 195dbd8f1..195dbd8f1 100644 --- a/src/java/org/apache/fop/fo/flow/MultiProperties.java +++ b/src/main/java/org/apache/fop/fo/flow/MultiProperties.java diff --git a/src/java/org/apache/fop/fo/flow/MultiPropertySet.java b/src/main/java/org/apache/fop/fo/flow/MultiPropertySet.java index 298ae62c1..298ae62c1 100644 --- a/src/java/org/apache/fop/fo/flow/MultiPropertySet.java +++ b/src/main/java/org/apache/fop/fo/flow/MultiPropertySet.java diff --git a/src/java/org/apache/fop/fo/flow/MultiSwitch.java b/src/main/java/org/apache/fop/fo/flow/MultiSwitch.java index 1248d1ca4..1248d1ca4 100644 --- a/src/java/org/apache/fop/fo/flow/MultiSwitch.java +++ b/src/main/java/org/apache/fop/fo/flow/MultiSwitch.java diff --git a/src/java/org/apache/fop/fo/flow/MultiToggle.java b/src/main/java/org/apache/fop/fo/flow/MultiToggle.java index d9f46364e..d9f46364e 100644 --- a/src/java/org/apache/fop/fo/flow/MultiToggle.java +++ b/src/main/java/org/apache/fop/fo/flow/MultiToggle.java diff --git a/src/java/org/apache/fop/fo/flow/PageNumber.java b/src/main/java/org/apache/fop/fo/flow/PageNumber.java index 42a4bd8ed..42a4bd8ed 100644 --- a/src/java/org/apache/fop/fo/flow/PageNumber.java +++ b/src/main/java/org/apache/fop/fo/flow/PageNumber.java diff --git a/src/java/org/apache/fop/fo/flow/PageNumberCitation.java b/src/main/java/org/apache/fop/fo/flow/PageNumberCitation.java index ee7b59a15..ee7b59a15 100644 --- a/src/java/org/apache/fop/fo/flow/PageNumberCitation.java +++ b/src/main/java/org/apache/fop/fo/flow/PageNumberCitation.java diff --git a/src/java/org/apache/fop/fo/flow/PageNumberCitationLast.java b/src/main/java/org/apache/fop/fo/flow/PageNumberCitationLast.java index b6e209202..b6e209202 100644 --- a/src/java/org/apache/fop/fo/flow/PageNumberCitationLast.java +++ b/src/main/java/org/apache/fop/fo/flow/PageNumberCitationLast.java diff --git a/src/java/org/apache/fop/fo/flow/RetrieveMarker.java b/src/main/java/org/apache/fop/fo/flow/RetrieveMarker.java index 2f2b7e5a4..2f2b7e5a4 100644 --- a/src/java/org/apache/fop/fo/flow/RetrieveMarker.java +++ b/src/main/java/org/apache/fop/fo/flow/RetrieveMarker.java diff --git a/src/java/org/apache/fop/fo/flow/RetrieveTableMarker.java b/src/main/java/org/apache/fop/fo/flow/RetrieveTableMarker.java index 8340736c7..8340736c7 100644 --- a/src/java/org/apache/fop/fo/flow/RetrieveTableMarker.java +++ b/src/main/java/org/apache/fop/fo/flow/RetrieveTableMarker.java diff --git a/src/java/org/apache/fop/fo/flow/Wrapper.java b/src/main/java/org/apache/fop/fo/flow/Wrapper.java index e6625a538..e6625a538 100644 --- a/src/java/org/apache/fop/fo/flow/Wrapper.java +++ b/src/main/java/org/apache/fop/fo/flow/Wrapper.java diff --git a/src/java/org/apache/fop/fo/flow/package.html b/src/main/java/org/apache/fop/fo/flow/package.html index 0eb08f4d6..0eb08f4d6 100644 --- a/src/java/org/apache/fop/fo/flow/package.html +++ b/src/main/java/org/apache/fop/fo/flow/package.html diff --git a/src/java/org/apache/fop/fo/flow/table/BorderResolver.java b/src/main/java/org/apache/fop/fo/flow/table/BorderResolver.java index 1b856abff..1b856abff 100644 --- a/src/java/org/apache/fop/fo/flow/table/BorderResolver.java +++ b/src/main/java/org/apache/fop/fo/flow/table/BorderResolver.java diff --git a/src/java/org/apache/fop/fo/flow/table/BorderSpecification.java b/src/main/java/org/apache/fop/fo/flow/table/BorderSpecification.java index 3fa3eb15b..3fa3eb15b 100644 --- a/src/java/org/apache/fop/fo/flow/table/BorderSpecification.java +++ b/src/main/java/org/apache/fop/fo/flow/table/BorderSpecification.java diff --git a/src/java/org/apache/fop/fo/flow/table/CollapsingBorderResolver.java b/src/main/java/org/apache/fop/fo/flow/table/CollapsingBorderResolver.java index 0af17996d..0af17996d 100644 --- a/src/java/org/apache/fop/fo/flow/table/CollapsingBorderResolver.java +++ b/src/main/java/org/apache/fop/fo/flow/table/CollapsingBorderResolver.java diff --git a/src/java/org/apache/fop/fo/flow/table/ColumnNumberManager.java b/src/main/java/org/apache/fop/fo/flow/table/ColumnNumberManager.java index 89cba94c9..89cba94c9 100644 --- a/src/java/org/apache/fop/fo/flow/table/ColumnNumberManager.java +++ b/src/main/java/org/apache/fop/fo/flow/table/ColumnNumberManager.java diff --git a/src/java/org/apache/fop/fo/flow/table/ColumnNumberManagerHolder.java b/src/main/java/org/apache/fop/fo/flow/table/ColumnNumberManagerHolder.java index 6eb6bab53..6eb6bab53 100644 --- a/src/java/org/apache/fop/fo/flow/table/ColumnNumberManagerHolder.java +++ b/src/main/java/org/apache/fop/fo/flow/table/ColumnNumberManagerHolder.java diff --git a/src/java/org/apache/fop/fo/flow/table/ConditionalBorder.java b/src/main/java/org/apache/fop/fo/flow/table/ConditionalBorder.java index 6a2cc7050..6a2cc7050 100644 --- a/src/java/org/apache/fop/fo/flow/table/ConditionalBorder.java +++ b/src/main/java/org/apache/fop/fo/flow/table/ConditionalBorder.java diff --git a/src/java/org/apache/fop/fo/flow/table/EffRow.java b/src/main/java/org/apache/fop/fo/flow/table/EffRow.java index a5853cd91..a5853cd91 100644 --- a/src/java/org/apache/fop/fo/flow/table/EffRow.java +++ b/src/main/java/org/apache/fop/fo/flow/table/EffRow.java diff --git a/src/java/org/apache/fop/fo/flow/table/EmptyGridUnit.java b/src/main/java/org/apache/fop/fo/flow/table/EmptyGridUnit.java index 2c910d3f8..2c910d3f8 100644 --- a/src/java/org/apache/fop/fo/flow/table/EmptyGridUnit.java +++ b/src/main/java/org/apache/fop/fo/flow/table/EmptyGridUnit.java diff --git a/src/java/org/apache/fop/fo/flow/table/FixedColRowGroupBuilder.java b/src/main/java/org/apache/fop/fo/flow/table/FixedColRowGroupBuilder.java index c3aa9e710..c3aa9e710 100644 --- a/src/java/org/apache/fop/fo/flow/table/FixedColRowGroupBuilder.java +++ b/src/main/java/org/apache/fop/fo/flow/table/FixedColRowGroupBuilder.java diff --git a/src/java/org/apache/fop/fo/flow/table/GridUnit.java b/src/main/java/org/apache/fop/fo/flow/table/GridUnit.java index 9e3f750c6..9e3f750c6 100644 --- a/src/java/org/apache/fop/fo/flow/table/GridUnit.java +++ b/src/main/java/org/apache/fop/fo/flow/table/GridUnit.java diff --git a/src/java/org/apache/fop/fo/flow/table/PendingSpan.java b/src/main/java/org/apache/fop/fo/flow/table/PendingSpan.java index 5b0d72120..5b0d72120 100644 --- a/src/java/org/apache/fop/fo/flow/table/PendingSpan.java +++ b/src/main/java/org/apache/fop/fo/flow/table/PendingSpan.java diff --git a/src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java b/src/main/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java index aa7e27c5a..aa7e27c5a 100644 --- a/src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java +++ b/src/main/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java diff --git a/src/java/org/apache/fop/fo/flow/table/RowGroupBuilder.java b/src/main/java/org/apache/fop/fo/flow/table/RowGroupBuilder.java index 276372bd4..276372bd4 100644 --- a/src/java/org/apache/fop/fo/flow/table/RowGroupBuilder.java +++ b/src/main/java/org/apache/fop/fo/flow/table/RowGroupBuilder.java diff --git a/src/java/org/apache/fop/fo/flow/table/SeparateBorderResolver.java b/src/main/java/org/apache/fop/fo/flow/table/SeparateBorderResolver.java index c3cc30676..c3cc30676 100644 --- a/src/java/org/apache/fop/fo/flow/table/SeparateBorderResolver.java +++ b/src/main/java/org/apache/fop/fo/flow/table/SeparateBorderResolver.java diff --git a/src/java/org/apache/fop/fo/flow/table/Table.java b/src/main/java/org/apache/fop/fo/flow/table/Table.java index 212608664..212608664 100644 --- a/src/java/org/apache/fop/fo/flow/table/Table.java +++ b/src/main/java/org/apache/fop/fo/flow/table/Table.java diff --git a/src/java/org/apache/fop/fo/flow/table/TableAndCaption.java b/src/main/java/org/apache/fop/fo/flow/table/TableAndCaption.java index b7c7adc91..b7c7adc91 100644 --- a/src/java/org/apache/fop/fo/flow/table/TableAndCaption.java +++ b/src/main/java/org/apache/fop/fo/flow/table/TableAndCaption.java diff --git a/src/java/org/apache/fop/fo/flow/table/TableBody.java b/src/main/java/org/apache/fop/fo/flow/table/TableBody.java index 63e927952..63e927952 100644 --- a/src/java/org/apache/fop/fo/flow/table/TableBody.java +++ b/src/main/java/org/apache/fop/fo/flow/table/TableBody.java diff --git a/src/java/org/apache/fop/fo/flow/table/TableCaption.java b/src/main/java/org/apache/fop/fo/flow/table/TableCaption.java index 5ecce65af..5ecce65af 100644 --- a/src/java/org/apache/fop/fo/flow/table/TableCaption.java +++ b/src/main/java/org/apache/fop/fo/flow/table/TableCaption.java diff --git a/src/java/org/apache/fop/fo/flow/table/TableCell.java b/src/main/java/org/apache/fop/fo/flow/table/TableCell.java index 33b4a5fe3..33b4a5fe3 100644 --- a/src/java/org/apache/fop/fo/flow/table/TableCell.java +++ b/src/main/java/org/apache/fop/fo/flow/table/TableCell.java diff --git a/src/java/org/apache/fop/fo/flow/table/TableCellContainer.java b/src/main/java/org/apache/fop/fo/flow/table/TableCellContainer.java index 89ecd159a..89ecd159a 100644 --- a/src/java/org/apache/fop/fo/flow/table/TableCellContainer.java +++ b/src/main/java/org/apache/fop/fo/flow/table/TableCellContainer.java diff --git a/src/java/org/apache/fop/fo/flow/table/TableColumn.java b/src/main/java/org/apache/fop/fo/flow/table/TableColumn.java index abfc8cd4d..abfc8cd4d 100644 --- a/src/java/org/apache/fop/fo/flow/table/TableColumn.java +++ b/src/main/java/org/apache/fop/fo/flow/table/TableColumn.java diff --git a/src/java/org/apache/fop/fo/flow/table/TableEventProducer.java b/src/main/java/org/apache/fop/fo/flow/table/TableEventProducer.java index 132728322..132728322 100644 --- a/src/java/org/apache/fop/fo/flow/table/TableEventProducer.java +++ b/src/main/java/org/apache/fop/fo/flow/table/TableEventProducer.java diff --git a/src/java/org/apache/fop/fo/flow/table/TableEventProducer.xml b/src/main/java/org/apache/fop/fo/flow/table/TableEventProducer.xml index a9741175b..a9741175b 100644 --- a/src/java/org/apache/fop/fo/flow/table/TableEventProducer.xml +++ b/src/main/java/org/apache/fop/fo/flow/table/TableEventProducer.xml diff --git a/src/java/org/apache/fop/fo/flow/table/TableFObj.java b/src/main/java/org/apache/fop/fo/flow/table/TableFObj.java index ae8477401..ae8477401 100644 --- a/src/java/org/apache/fop/fo/flow/table/TableFObj.java +++ b/src/main/java/org/apache/fop/fo/flow/table/TableFObj.java diff --git a/src/java/org/apache/fop/fo/flow/table/TableFooter.java b/src/main/java/org/apache/fop/fo/flow/table/TableFooter.java index e12b75c5c..e12b75c5c 100644 --- a/src/java/org/apache/fop/fo/flow/table/TableFooter.java +++ b/src/main/java/org/apache/fop/fo/flow/table/TableFooter.java diff --git a/src/java/org/apache/fop/fo/flow/table/TableHeader.java b/src/main/java/org/apache/fop/fo/flow/table/TableHeader.java index 73b43f301..73b43f301 100644 --- a/src/java/org/apache/fop/fo/flow/table/TableHeader.java +++ b/src/main/java/org/apache/fop/fo/flow/table/TableHeader.java diff --git a/src/java/org/apache/fop/fo/flow/table/TablePart.java b/src/main/java/org/apache/fop/fo/flow/table/TablePart.java index b148ad48e..b148ad48e 100644 --- a/src/java/org/apache/fop/fo/flow/table/TablePart.java +++ b/src/main/java/org/apache/fop/fo/flow/table/TablePart.java diff --git a/src/java/org/apache/fop/fo/flow/table/TableRow.java b/src/main/java/org/apache/fop/fo/flow/table/TableRow.java index 2beaf2f99..2beaf2f99 100644 --- a/src/java/org/apache/fop/fo/flow/table/TableRow.java +++ b/src/main/java/org/apache/fop/fo/flow/table/TableRow.java diff --git a/src/java/org/apache/fop/fo/flow/table/VariableColRowGroupBuilder.java b/src/main/java/org/apache/fop/fo/flow/table/VariableColRowGroupBuilder.java index 84b4c3769..84b4c3769 100644 --- a/src/java/org/apache/fop/fo/flow/table/VariableColRowGroupBuilder.java +++ b/src/main/java/org/apache/fop/fo/flow/table/VariableColRowGroupBuilder.java diff --git a/src/java/org/apache/fop/fo/package.html b/src/main/java/org/apache/fop/fo/package.html index 86e102030..86e102030 100644 --- a/src/java/org/apache/fop/fo/package.html +++ b/src/main/java/org/apache/fop/fo/package.html diff --git a/src/java/org/apache/fop/fo/pagination/AbstractPageSequence.java b/src/main/java/org/apache/fop/fo/pagination/AbstractPageSequence.java index 49a67a154..49a67a154 100644 --- a/src/java/org/apache/fop/fo/pagination/AbstractPageSequence.java +++ b/src/main/java/org/apache/fop/fo/pagination/AbstractPageSequence.java diff --git a/src/java/org/apache/fop/fo/pagination/ColorProfile.java b/src/main/java/org/apache/fop/fo/pagination/ColorProfile.java index e1ca99ff9..e1ca99ff9 100644 --- a/src/java/org/apache/fop/fo/pagination/ColorProfile.java +++ b/src/main/java/org/apache/fop/fo/pagination/ColorProfile.java diff --git a/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java b/src/main/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java index b83a72a11..b83a72a11 100644 --- a/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java +++ b/src/main/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java diff --git a/src/java/org/apache/fop/fo/pagination/Declarations.java b/src/main/java/org/apache/fop/fo/pagination/Declarations.java index be1ec13e2..be1ec13e2 100644 --- a/src/java/org/apache/fop/fo/pagination/Declarations.java +++ b/src/main/java/org/apache/fop/fo/pagination/Declarations.java diff --git a/src/java/org/apache/fop/fo/pagination/Flow.java b/src/main/java/org/apache/fop/fo/pagination/Flow.java index be3aed3e8..be3aed3e8 100644 --- a/src/java/org/apache/fop/fo/pagination/Flow.java +++ b/src/main/java/org/apache/fop/fo/pagination/Flow.java diff --git a/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java b/src/main/java/org/apache/fop/fo/pagination/LayoutMasterSet.java index 905291b35..905291b35 100644 --- a/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java +++ b/src/main/java/org/apache/fop/fo/pagination/LayoutMasterSet.java diff --git a/src/java/org/apache/fop/fo/pagination/PageNumberGenerator.java b/src/main/java/org/apache/fop/fo/pagination/PageNumberGenerator.java index 2d13cd899..2d13cd899 100644 --- a/src/java/org/apache/fop/fo/pagination/PageNumberGenerator.java +++ b/src/main/java/org/apache/fop/fo/pagination/PageNumberGenerator.java diff --git a/src/java/org/apache/fop/fo/pagination/PageProductionException.java b/src/main/java/org/apache/fop/fo/pagination/PageProductionException.java index c0f14b0ea..c0f14b0ea 100644 --- a/src/java/org/apache/fop/fo/pagination/PageProductionException.java +++ b/src/main/java/org/apache/fop/fo/pagination/PageProductionException.java diff --git a/src/java/org/apache/fop/fo/pagination/PageSequence.java b/src/main/java/org/apache/fop/fo/pagination/PageSequence.java index a1a966e90..a1a966e90 100644 --- a/src/java/org/apache/fop/fo/pagination/PageSequence.java +++ b/src/main/java/org/apache/fop/fo/pagination/PageSequence.java diff --git a/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java b/src/main/java/org/apache/fop/fo/pagination/PageSequenceMaster.java index f218e43b4..f218e43b4 100644 --- a/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java +++ b/src/main/java/org/apache/fop/fo/pagination/PageSequenceMaster.java diff --git a/src/java/org/apache/fop/fo/pagination/PageSequenceWrapper.java b/src/main/java/org/apache/fop/fo/pagination/PageSequenceWrapper.java index f3f362b10..f3f362b10 100644 --- a/src/java/org/apache/fop/fo/pagination/PageSequenceWrapper.java +++ b/src/main/java/org/apache/fop/fo/pagination/PageSequenceWrapper.java diff --git a/src/java/org/apache/fop/fo/pagination/Region.java b/src/main/java/org/apache/fop/fo/pagination/Region.java index 16956b6dd..16956b6dd 100644 --- a/src/java/org/apache/fop/fo/pagination/Region.java +++ b/src/main/java/org/apache/fop/fo/pagination/Region.java diff --git a/src/java/org/apache/fop/fo/pagination/RegionAfter.java b/src/main/java/org/apache/fop/fo/pagination/RegionAfter.java index 1232c68bc..1232c68bc 100644 --- a/src/java/org/apache/fop/fo/pagination/RegionAfter.java +++ b/src/main/java/org/apache/fop/fo/pagination/RegionAfter.java diff --git a/src/java/org/apache/fop/fo/pagination/RegionBA.java b/src/main/java/org/apache/fop/fo/pagination/RegionBA.java index 82decf32e..82decf32e 100644 --- a/src/java/org/apache/fop/fo/pagination/RegionBA.java +++ b/src/main/java/org/apache/fop/fo/pagination/RegionBA.java diff --git a/src/java/org/apache/fop/fo/pagination/RegionBefore.java b/src/main/java/org/apache/fop/fo/pagination/RegionBefore.java index 5a0e7543c..5a0e7543c 100644 --- a/src/java/org/apache/fop/fo/pagination/RegionBefore.java +++ b/src/main/java/org/apache/fop/fo/pagination/RegionBefore.java diff --git a/src/java/org/apache/fop/fo/pagination/RegionBody.java b/src/main/java/org/apache/fop/fo/pagination/RegionBody.java index 164c1cee5..164c1cee5 100644 --- a/src/java/org/apache/fop/fo/pagination/RegionBody.java +++ b/src/main/java/org/apache/fop/fo/pagination/RegionBody.java diff --git a/src/java/org/apache/fop/fo/pagination/RegionEnd.java b/src/main/java/org/apache/fop/fo/pagination/RegionEnd.java index 5de7dc194..5de7dc194 100644 --- a/src/java/org/apache/fop/fo/pagination/RegionEnd.java +++ b/src/main/java/org/apache/fop/fo/pagination/RegionEnd.java diff --git a/src/java/org/apache/fop/fo/pagination/RegionSE.java b/src/main/java/org/apache/fop/fo/pagination/RegionSE.java index 79b36645c..79b36645c 100644 --- a/src/java/org/apache/fop/fo/pagination/RegionSE.java +++ b/src/main/java/org/apache/fop/fo/pagination/RegionSE.java diff --git a/src/java/org/apache/fop/fo/pagination/RegionStart.java b/src/main/java/org/apache/fop/fo/pagination/RegionStart.java index 6e2e752fc..6e2e752fc 100644 --- a/src/java/org/apache/fop/fo/pagination/RegionStart.java +++ b/src/main/java/org/apache/fop/fo/pagination/RegionStart.java diff --git a/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java b/src/main/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java index 2914fb9a8..2914fb9a8 100644 --- a/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java +++ b/src/main/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java diff --git a/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java b/src/main/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java index 5e43c02b1..5e43c02b1 100644 --- a/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java +++ b/src/main/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java diff --git a/src/java/org/apache/fop/fo/pagination/Root.java b/src/main/java/org/apache/fop/fo/pagination/Root.java index 51309a65d..51309a65d 100644 --- a/src/java/org/apache/fop/fo/pagination/Root.java +++ b/src/main/java/org/apache/fop/fo/pagination/Root.java diff --git a/src/java/org/apache/fop/fo/pagination/SideRegion.java b/src/main/java/org/apache/fop/fo/pagination/SideRegion.java index 1b78de73f..1b78de73f 100644 --- a/src/java/org/apache/fop/fo/pagination/SideRegion.java +++ b/src/main/java/org/apache/fop/fo/pagination/SideRegion.java diff --git a/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java b/src/main/java/org/apache/fop/fo/pagination/SimplePageMaster.java index f72146e8b..f72146e8b 100644 --- a/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java +++ b/src/main/java/org/apache/fop/fo/pagination/SimplePageMaster.java diff --git a/src/java/org/apache/fop/fo/pagination/SinglePageMasterReference.java b/src/main/java/org/apache/fop/fo/pagination/SinglePageMasterReference.java index 2600909cb..2600909cb 100644 --- a/src/java/org/apache/fop/fo/pagination/SinglePageMasterReference.java +++ b/src/main/java/org/apache/fop/fo/pagination/SinglePageMasterReference.java diff --git a/src/java/org/apache/fop/fo/pagination/StaticContent.java b/src/main/java/org/apache/fop/fo/pagination/StaticContent.java index d85ab5f30..d85ab5f30 100644 --- a/src/java/org/apache/fop/fo/pagination/StaticContent.java +++ b/src/main/java/org/apache/fop/fo/pagination/StaticContent.java diff --git a/src/java/org/apache/fop/fo/pagination/SubSequenceSpecifier.java b/src/main/java/org/apache/fop/fo/pagination/SubSequenceSpecifier.java index 0905ee8a8..0905ee8a8 100644 --- a/src/java/org/apache/fop/fo/pagination/SubSequenceSpecifier.java +++ b/src/main/java/org/apache/fop/fo/pagination/SubSequenceSpecifier.java diff --git a/src/java/org/apache/fop/fo/pagination/Title.java b/src/main/java/org/apache/fop/fo/pagination/Title.java index 5838e6ae1..5838e6ae1 100644 --- a/src/java/org/apache/fop/fo/pagination/Title.java +++ b/src/main/java/org/apache/fop/fo/pagination/Title.java diff --git a/src/java/org/apache/fop/fo/pagination/bookmarks/Bookmark.java b/src/main/java/org/apache/fop/fo/pagination/bookmarks/Bookmark.java index 9cefe85b4..9cefe85b4 100644 --- a/src/java/org/apache/fop/fo/pagination/bookmarks/Bookmark.java +++ b/src/main/java/org/apache/fop/fo/pagination/bookmarks/Bookmark.java diff --git a/src/java/org/apache/fop/fo/pagination/bookmarks/BookmarkTitle.java b/src/main/java/org/apache/fop/fo/pagination/bookmarks/BookmarkTitle.java index 1db7d84ca..1db7d84ca 100644 --- a/src/java/org/apache/fop/fo/pagination/bookmarks/BookmarkTitle.java +++ b/src/main/java/org/apache/fop/fo/pagination/bookmarks/BookmarkTitle.java diff --git a/src/java/org/apache/fop/fo/pagination/bookmarks/BookmarkTree.java b/src/main/java/org/apache/fop/fo/pagination/bookmarks/BookmarkTree.java index c5594bff0..c5594bff0 100644 --- a/src/java/org/apache/fop/fo/pagination/bookmarks/BookmarkTree.java +++ b/src/main/java/org/apache/fop/fo/pagination/bookmarks/BookmarkTree.java diff --git a/src/java/org/apache/fop/fo/pagination/bookmarks/package.html b/src/main/java/org/apache/fop/fo/pagination/bookmarks/package.html index 0370f97b8..0370f97b8 100644 --- a/src/java/org/apache/fop/fo/pagination/bookmarks/package.html +++ b/src/main/java/org/apache/fop/fo/pagination/bookmarks/package.html diff --git a/src/java/org/apache/fop/fo/pagination/package.html b/src/main/java/org/apache/fop/fo/pagination/package.html index fe3734859..fe3734859 100644 --- a/src/java/org/apache/fop/fo/pagination/package.html +++ b/src/main/java/org/apache/fop/fo/pagination/package.html diff --git a/src/java/org/apache/fop/fo/properties/BackgroundPositionShorthand.java b/src/main/java/org/apache/fop/fo/properties/BackgroundPositionShorthand.java index 2685e5a99..2685e5a99 100644 --- a/src/java/org/apache/fop/fo/properties/BackgroundPositionShorthand.java +++ b/src/main/java/org/apache/fop/fo/properties/BackgroundPositionShorthand.java diff --git a/src/java/org/apache/fop/fo/properties/BorderSpacingShorthandParser.java b/src/main/java/org/apache/fop/fo/properties/BorderSpacingShorthandParser.java index 7822db3f8..7822db3f8 100644 --- a/src/java/org/apache/fop/fo/properties/BorderSpacingShorthandParser.java +++ b/src/main/java/org/apache/fop/fo/properties/BorderSpacingShorthandParser.java diff --git a/src/java/org/apache/fop/fo/properties/BorderWidthPropertyMaker.java b/src/main/java/org/apache/fop/fo/properties/BorderWidthPropertyMaker.java index 763127e4b..763127e4b 100644 --- a/src/java/org/apache/fop/fo/properties/BorderWidthPropertyMaker.java +++ b/src/main/java/org/apache/fop/fo/properties/BorderWidthPropertyMaker.java diff --git a/src/java/org/apache/fop/fo/properties/BoxCornerPropShorthandParser.java b/src/main/java/org/apache/fop/fo/properties/BoxCornerPropShorthandParser.java index 06f198573..06f198573 100644 --- a/src/java/org/apache/fop/fo/properties/BoxCornerPropShorthandParser.java +++ b/src/main/java/org/apache/fop/fo/properties/BoxCornerPropShorthandParser.java diff --git a/src/java/org/apache/fop/fo/properties/BoxPropShorthandParser.java b/src/main/java/org/apache/fop/fo/properties/BoxPropShorthandParser.java index feee406ab..feee406ab 100644 --- a/src/java/org/apache/fop/fo/properties/BoxPropShorthandParser.java +++ b/src/main/java/org/apache/fop/fo/properties/BoxPropShorthandParser.java diff --git a/src/java/org/apache/fop/fo/properties/BreakPropertySet.java b/src/main/java/org/apache/fop/fo/properties/BreakPropertySet.java index c70bc9fb2..c70bc9fb2 100644 --- a/src/java/org/apache/fop/fo/properties/BreakPropertySet.java +++ b/src/main/java/org/apache/fop/fo/properties/BreakPropertySet.java diff --git a/src/java/org/apache/fop/fo/properties/CharacterProperty.java b/src/main/java/org/apache/fop/fo/properties/CharacterProperty.java index c5aa2f939..c5aa2f939 100644 --- a/src/java/org/apache/fop/fo/properties/CharacterProperty.java +++ b/src/main/java/org/apache/fop/fo/properties/CharacterProperty.java diff --git a/src/java/org/apache/fop/fo/properties/ColorProperty.java b/src/main/java/org/apache/fop/fo/properties/ColorProperty.java index 131c5a692..131c5a692 100644 --- a/src/java/org/apache/fop/fo/properties/ColorProperty.java +++ b/src/main/java/org/apache/fop/fo/properties/ColorProperty.java diff --git a/src/java/org/apache/fop/fo/properties/CommonAbsolutePosition.java b/src/main/java/org/apache/fop/fo/properties/CommonAbsolutePosition.java index 59333242f..59333242f 100644 --- a/src/java/org/apache/fop/fo/properties/CommonAbsolutePosition.java +++ b/src/main/java/org/apache/fop/fo/properties/CommonAbsolutePosition.java diff --git a/src/java/org/apache/fop/fo/properties/CommonAccessibility.java b/src/main/java/org/apache/fop/fo/properties/CommonAccessibility.java index 85183b01f..85183b01f 100644 --- a/src/java/org/apache/fop/fo/properties/CommonAccessibility.java +++ b/src/main/java/org/apache/fop/fo/properties/CommonAccessibility.java diff --git a/src/java/org/apache/fop/fo/properties/CommonAccessibilityHolder.java b/src/main/java/org/apache/fop/fo/properties/CommonAccessibilityHolder.java index 745c0cf0e..745c0cf0e 100644 --- a/src/java/org/apache/fop/fo/properties/CommonAccessibilityHolder.java +++ b/src/main/java/org/apache/fop/fo/properties/CommonAccessibilityHolder.java diff --git a/src/java/org/apache/fop/fo/properties/CommonAural.java b/src/main/java/org/apache/fop/fo/properties/CommonAural.java index 387562f91..387562f91 100644 --- a/src/java/org/apache/fop/fo/properties/CommonAural.java +++ b/src/main/java/org/apache/fop/fo/properties/CommonAural.java diff --git a/src/java/org/apache/fop/fo/properties/CommonBorderPaddingBackground.java b/src/main/java/org/apache/fop/fo/properties/CommonBorderPaddingBackground.java index 192833c8a..192833c8a 100644 --- a/src/java/org/apache/fop/fo/properties/CommonBorderPaddingBackground.java +++ b/src/main/java/org/apache/fop/fo/properties/CommonBorderPaddingBackground.java diff --git a/src/java/org/apache/fop/fo/properties/CommonFont.java b/src/main/java/org/apache/fop/fo/properties/CommonFont.java index a22fc4d04..a22fc4d04 100644 --- a/src/java/org/apache/fop/fo/properties/CommonFont.java +++ b/src/main/java/org/apache/fop/fo/properties/CommonFont.java diff --git a/src/java/org/apache/fop/fo/properties/CommonHyphenation.java b/src/main/java/org/apache/fop/fo/properties/CommonHyphenation.java index 4c87030b9..4c87030b9 100644 --- a/src/java/org/apache/fop/fo/properties/CommonHyphenation.java +++ b/src/main/java/org/apache/fop/fo/properties/CommonHyphenation.java diff --git a/src/java/org/apache/fop/fo/properties/CommonMarginBlock.java b/src/main/java/org/apache/fop/fo/properties/CommonMarginBlock.java index f71f36662..f71f36662 100644 --- a/src/java/org/apache/fop/fo/properties/CommonMarginBlock.java +++ b/src/main/java/org/apache/fop/fo/properties/CommonMarginBlock.java diff --git a/src/java/org/apache/fop/fo/properties/CommonMarginInline.java b/src/main/java/org/apache/fop/fo/properties/CommonMarginInline.java index 8d6b9a446..8d6b9a446 100644 --- a/src/java/org/apache/fop/fo/properties/CommonMarginInline.java +++ b/src/main/java/org/apache/fop/fo/properties/CommonMarginInline.java diff --git a/src/java/org/apache/fop/fo/properties/CommonRelativePosition.java b/src/main/java/org/apache/fop/fo/properties/CommonRelativePosition.java index 964f7cd7f..964f7cd7f 100644 --- a/src/java/org/apache/fop/fo/properties/CommonRelativePosition.java +++ b/src/main/java/org/apache/fop/fo/properties/CommonRelativePosition.java diff --git a/src/java/org/apache/fop/fo/properties/CommonTextDecoration.java b/src/main/java/org/apache/fop/fo/properties/CommonTextDecoration.java index 9ce22180e..9ce22180e 100644 --- a/src/java/org/apache/fop/fo/properties/CommonTextDecoration.java +++ b/src/main/java/org/apache/fop/fo/properties/CommonTextDecoration.java diff --git a/src/java/org/apache/fop/fo/properties/CompoundPropertyMaker.java b/src/main/java/org/apache/fop/fo/properties/CompoundPropertyMaker.java index 361427245..361427245 100644 --- a/src/java/org/apache/fop/fo/properties/CompoundPropertyMaker.java +++ b/src/main/java/org/apache/fop/fo/properties/CompoundPropertyMaker.java diff --git a/src/java/org/apache/fop/fo/properties/CondLengthProperty.java b/src/main/java/org/apache/fop/fo/properties/CondLengthProperty.java index 449be5cbf..449be5cbf 100644 --- a/src/java/org/apache/fop/fo/properties/CondLengthProperty.java +++ b/src/main/java/org/apache/fop/fo/properties/CondLengthProperty.java diff --git a/src/java/org/apache/fop/fo/properties/CorrespondingPropertyMaker.java b/src/main/java/org/apache/fop/fo/properties/CorrespondingPropertyMaker.java index b74c9dcfb..b74c9dcfb 100644 --- a/src/java/org/apache/fop/fo/properties/CorrespondingPropertyMaker.java +++ b/src/main/java/org/apache/fop/fo/properties/CorrespondingPropertyMaker.java diff --git a/src/java/org/apache/fop/fo/properties/DimensionPropertyMaker.java b/src/main/java/org/apache/fop/fo/properties/DimensionPropertyMaker.java index 4860a07ac..4860a07ac 100644 --- a/src/java/org/apache/fop/fo/properties/DimensionPropertyMaker.java +++ b/src/main/java/org/apache/fop/fo/properties/DimensionPropertyMaker.java diff --git a/src/java/org/apache/fop/fo/properties/EnumLength.java b/src/main/java/org/apache/fop/fo/properties/EnumLength.java index 9fd75259a..9fd75259a 100644 --- a/src/java/org/apache/fop/fo/properties/EnumLength.java +++ b/src/main/java/org/apache/fop/fo/properties/EnumLength.java diff --git a/src/java/org/apache/fop/fo/properties/EnumNumber.java b/src/main/java/org/apache/fop/fo/properties/EnumNumber.java index dfe1eb877..dfe1eb877 100644 --- a/src/java/org/apache/fop/fo/properties/EnumNumber.java +++ b/src/main/java/org/apache/fop/fo/properties/EnumNumber.java diff --git a/src/java/org/apache/fop/fo/properties/EnumProperty.java b/src/main/java/org/apache/fop/fo/properties/EnumProperty.java index f429b95ac..f429b95ac 100644 --- a/src/java/org/apache/fop/fo/properties/EnumProperty.java +++ b/src/main/java/org/apache/fop/fo/properties/EnumProperty.java diff --git a/src/java/org/apache/fop/fo/properties/FixedLength.java b/src/main/java/org/apache/fop/fo/properties/FixedLength.java index 0cf27e390..0cf27e390 100644 --- a/src/java/org/apache/fop/fo/properties/FixedLength.java +++ b/src/main/java/org/apache/fop/fo/properties/FixedLength.java diff --git a/src/java/org/apache/fop/fo/properties/FontFamilyProperty.java b/src/main/java/org/apache/fop/fo/properties/FontFamilyProperty.java index 2c22fc17e..2c22fc17e 100644 --- a/src/java/org/apache/fop/fo/properties/FontFamilyProperty.java +++ b/src/main/java/org/apache/fop/fo/properties/FontFamilyProperty.java diff --git a/src/java/org/apache/fop/fo/properties/FontShorthandParser.java b/src/main/java/org/apache/fop/fo/properties/FontShorthandParser.java index c22ba4745..c22ba4745 100644 --- a/src/java/org/apache/fop/fo/properties/FontShorthandParser.java +++ b/src/main/java/org/apache/fop/fo/properties/FontShorthandParser.java diff --git a/src/java/org/apache/fop/fo/properties/FontShorthandProperty.java b/src/main/java/org/apache/fop/fo/properties/FontShorthandProperty.java index 0cb44d7f8..0cb44d7f8 100644 --- a/src/java/org/apache/fop/fo/properties/FontShorthandProperty.java +++ b/src/main/java/org/apache/fop/fo/properties/FontShorthandProperty.java diff --git a/src/java/org/apache/fop/fo/properties/FontSizePropertyMaker.java b/src/main/java/org/apache/fop/fo/properties/FontSizePropertyMaker.java index fe9c64cb7..fe9c64cb7 100644 --- a/src/java/org/apache/fop/fo/properties/FontSizePropertyMaker.java +++ b/src/main/java/org/apache/fop/fo/properties/FontSizePropertyMaker.java diff --git a/src/java/org/apache/fop/fo/properties/FontStretchPropertyMaker.java b/src/main/java/org/apache/fop/fo/properties/FontStretchPropertyMaker.java index 579eb99a4..579eb99a4 100644 --- a/src/java/org/apache/fop/fo/properties/FontStretchPropertyMaker.java +++ b/src/main/java/org/apache/fop/fo/properties/FontStretchPropertyMaker.java diff --git a/src/java/org/apache/fop/fo/properties/FontWeightPropertyMaker.java b/src/main/java/org/apache/fop/fo/properties/FontWeightPropertyMaker.java index 8d93beb30..8d93beb30 100644 --- a/src/java/org/apache/fop/fo/properties/FontWeightPropertyMaker.java +++ b/src/main/java/org/apache/fop/fo/properties/FontWeightPropertyMaker.java diff --git a/src/java/org/apache/fop/fo/properties/GenericShorthandParser.java b/src/main/java/org/apache/fop/fo/properties/GenericShorthandParser.java index 42b65486c..42b65486c 100644 --- a/src/java/org/apache/fop/fo/properties/GenericShorthandParser.java +++ b/src/main/java/org/apache/fop/fo/properties/GenericShorthandParser.java diff --git a/src/java/org/apache/fop/fo/properties/IndentPropertyMaker.java b/src/main/java/org/apache/fop/fo/properties/IndentPropertyMaker.java index d1a696737..d1a696737 100644 --- a/src/java/org/apache/fop/fo/properties/IndentPropertyMaker.java +++ b/src/main/java/org/apache/fop/fo/properties/IndentPropertyMaker.java diff --git a/src/java/org/apache/fop/fo/properties/KeepProperty.java b/src/main/java/org/apache/fop/fo/properties/KeepProperty.java index f24e01e90..f24e01e90 100644 --- a/src/java/org/apache/fop/fo/properties/KeepProperty.java +++ b/src/main/java/org/apache/fop/fo/properties/KeepProperty.java diff --git a/src/java/org/apache/fop/fo/properties/LengthPairProperty.java b/src/main/java/org/apache/fop/fo/properties/LengthPairProperty.java index 00898fb88..00898fb88 100644 --- a/src/java/org/apache/fop/fo/properties/LengthPairProperty.java +++ b/src/main/java/org/apache/fop/fo/properties/LengthPairProperty.java diff --git a/src/java/org/apache/fop/fo/properties/LengthProperty.java b/src/main/java/org/apache/fop/fo/properties/LengthProperty.java index 402d2a623..402d2a623 100644 --- a/src/java/org/apache/fop/fo/properties/LengthProperty.java +++ b/src/main/java/org/apache/fop/fo/properties/LengthProperty.java diff --git a/src/java/org/apache/fop/fo/properties/LengthRangeProperty.java b/src/main/java/org/apache/fop/fo/properties/LengthRangeProperty.java index 9eeda0e9f..9eeda0e9f 100644 --- a/src/java/org/apache/fop/fo/properties/LengthRangeProperty.java +++ b/src/main/java/org/apache/fop/fo/properties/LengthRangeProperty.java diff --git a/src/java/org/apache/fop/fo/properties/LineHeightPropertyMaker.java b/src/main/java/org/apache/fop/fo/properties/LineHeightPropertyMaker.java index 1d79bb7af..1d79bb7af 100644 --- a/src/java/org/apache/fop/fo/properties/LineHeightPropertyMaker.java +++ b/src/main/java/org/apache/fop/fo/properties/LineHeightPropertyMaker.java diff --git a/src/java/org/apache/fop/fo/properties/ListProperty.java b/src/main/java/org/apache/fop/fo/properties/ListProperty.java index c0e1d7436..c0e1d7436 100644 --- a/src/java/org/apache/fop/fo/properties/ListProperty.java +++ b/src/main/java/org/apache/fop/fo/properties/ListProperty.java diff --git a/src/java/org/apache/fop/fo/properties/NumberProperty.java b/src/main/java/org/apache/fop/fo/properties/NumberProperty.java index de31e03e7..de31e03e7 100644 --- a/src/java/org/apache/fop/fo/properties/NumberProperty.java +++ b/src/main/java/org/apache/fop/fo/properties/NumberProperty.java diff --git a/src/java/org/apache/fop/fo/properties/PageBreakShorthandParser.java b/src/main/java/org/apache/fop/fo/properties/PageBreakShorthandParser.java index 066c00336..066c00336 100644 --- a/src/java/org/apache/fop/fo/properties/PageBreakShorthandParser.java +++ b/src/main/java/org/apache/fop/fo/properties/PageBreakShorthandParser.java diff --git a/src/java/org/apache/fop/fo/properties/PageDimensionMaker.java b/src/main/java/org/apache/fop/fo/properties/PageDimensionMaker.java index c0c6a2ed7..c0c6a2ed7 100644 --- a/src/java/org/apache/fop/fo/properties/PageDimensionMaker.java +++ b/src/main/java/org/apache/fop/fo/properties/PageDimensionMaker.java diff --git a/src/java/org/apache/fop/fo/properties/PercentLength.java b/src/main/java/org/apache/fop/fo/properties/PercentLength.java index e5e1cb0eb..e5e1cb0eb 100644 --- a/src/java/org/apache/fop/fo/properties/PercentLength.java +++ b/src/main/java/org/apache/fop/fo/properties/PercentLength.java diff --git a/src/java/org/apache/fop/fo/properties/PositionShorthandParser.java b/src/main/java/org/apache/fop/fo/properties/PositionShorthandParser.java index 5040afeaf..5040afeaf 100644 --- a/src/java/org/apache/fop/fo/properties/PositionShorthandParser.java +++ b/src/main/java/org/apache/fop/fo/properties/PositionShorthandParser.java diff --git a/src/java/org/apache/fop/fo/properties/Property.java b/src/main/java/org/apache/fop/fo/properties/Property.java index a396d4bba..a396d4bba 100644 --- a/src/java/org/apache/fop/fo/properties/Property.java +++ b/src/main/java/org/apache/fop/fo/properties/Property.java diff --git a/src/java/org/apache/fop/fo/properties/PropertyCache.java b/src/main/java/org/apache/fop/fo/properties/PropertyCache.java index e14d30b2a..e14d30b2a 100644 --- a/src/java/org/apache/fop/fo/properties/PropertyCache.java +++ b/src/main/java/org/apache/fop/fo/properties/PropertyCache.java diff --git a/src/java/org/apache/fop/fo/properties/PropertyMaker.java b/src/main/java/org/apache/fop/fo/properties/PropertyMaker.java index a315944b1..a315944b1 100644 --- a/src/java/org/apache/fop/fo/properties/PropertyMaker.java +++ b/src/main/java/org/apache/fop/fo/properties/PropertyMaker.java diff --git a/src/java/org/apache/fop/fo/properties/ReferenceOrientationMaker.java b/src/main/java/org/apache/fop/fo/properties/ReferenceOrientationMaker.java index 009b85b35..009b85b35 100644 --- a/src/java/org/apache/fop/fo/properties/ReferenceOrientationMaker.java +++ b/src/main/java/org/apache/fop/fo/properties/ReferenceOrientationMaker.java diff --git a/src/java/org/apache/fop/fo/properties/ShorthandParser.java b/src/main/java/org/apache/fop/fo/properties/ShorthandParser.java index f03c377fd..f03c377fd 100644 --- a/src/java/org/apache/fop/fo/properties/ShorthandParser.java +++ b/src/main/java/org/apache/fop/fo/properties/ShorthandParser.java diff --git a/src/java/org/apache/fop/fo/properties/SpaceProperty.java b/src/main/java/org/apache/fop/fo/properties/SpaceProperty.java index f7bdc60d7..f7bdc60d7 100644 --- a/src/java/org/apache/fop/fo/properties/SpaceProperty.java +++ b/src/main/java/org/apache/fop/fo/properties/SpaceProperty.java diff --git a/src/java/org/apache/fop/fo/properties/SpacePropertyMaker.java b/src/main/java/org/apache/fop/fo/properties/SpacePropertyMaker.java index a4f0c412e..a4f0c412e 100644 --- a/src/java/org/apache/fop/fo/properties/SpacePropertyMaker.java +++ b/src/main/java/org/apache/fop/fo/properties/SpacePropertyMaker.java diff --git a/src/java/org/apache/fop/fo/properties/SpacingPropertyMaker.java b/src/main/java/org/apache/fop/fo/properties/SpacingPropertyMaker.java index 3c51dd44a..3c51dd44a 100644 --- a/src/java/org/apache/fop/fo/properties/SpacingPropertyMaker.java +++ b/src/main/java/org/apache/fop/fo/properties/SpacingPropertyMaker.java diff --git a/src/java/org/apache/fop/fo/properties/StringProperty.java b/src/main/java/org/apache/fop/fo/properties/StringProperty.java index d9718564f..d9718564f 100644 --- a/src/java/org/apache/fop/fo/properties/StringProperty.java +++ b/src/main/java/org/apache/fop/fo/properties/StringProperty.java diff --git a/src/java/org/apache/fop/fo/properties/StructureTreeElementHolder.java b/src/main/java/org/apache/fop/fo/properties/StructureTreeElementHolder.java index 6fbb608de..6fbb608de 100644 --- a/src/java/org/apache/fop/fo/properties/StructureTreeElementHolder.java +++ b/src/main/java/org/apache/fop/fo/properties/StructureTreeElementHolder.java diff --git a/src/java/org/apache/fop/fo/properties/TableBorderPrecedence.java b/src/main/java/org/apache/fop/fo/properties/TableBorderPrecedence.java index b01ee22a0..b01ee22a0 100644 --- a/src/java/org/apache/fop/fo/properties/TableBorderPrecedence.java +++ b/src/main/java/org/apache/fop/fo/properties/TableBorderPrecedence.java diff --git a/src/java/org/apache/fop/fo/properties/TableColLength.java b/src/main/java/org/apache/fop/fo/properties/TableColLength.java index 6c30b3123..6c30b3123 100644 --- a/src/java/org/apache/fop/fo/properties/TableColLength.java +++ b/src/main/java/org/apache/fop/fo/properties/TableColLength.java diff --git a/src/java/org/apache/fop/fo/properties/TextDecorationMaker.java b/src/main/java/org/apache/fop/fo/properties/TextDecorationMaker.java index f084fa017..f084fa017 100644 --- a/src/java/org/apache/fop/fo/properties/TextDecorationMaker.java +++ b/src/main/java/org/apache/fop/fo/properties/TextDecorationMaker.java diff --git a/src/java/org/apache/fop/fo/properties/ToBeImplementedProperty.java b/src/main/java/org/apache/fop/fo/properties/ToBeImplementedProperty.java index 95ed0de85..95ed0de85 100644 --- a/src/java/org/apache/fop/fo/properties/ToBeImplementedProperty.java +++ b/src/main/java/org/apache/fop/fo/properties/ToBeImplementedProperty.java diff --git a/src/java/org/apache/fop/fo/properties/URIProperty.java b/src/main/java/org/apache/fop/fo/properties/URIProperty.java index 3bdfbab00..3bdfbab00 100644 --- a/src/java/org/apache/fop/fo/properties/URIProperty.java +++ b/src/main/java/org/apache/fop/fo/properties/URIProperty.java diff --git a/src/java/org/apache/fop/fo/properties/VerticalAlignShorthandParser.java b/src/main/java/org/apache/fop/fo/properties/VerticalAlignShorthandParser.java index 8c0cec744..8c0cec744 100644 --- a/src/java/org/apache/fop/fo/properties/VerticalAlignShorthandParser.java +++ b/src/main/java/org/apache/fop/fo/properties/VerticalAlignShorthandParser.java diff --git a/src/java/org/apache/fop/fo/properties/WhiteSpaceShorthandParser.java b/src/main/java/org/apache/fop/fo/properties/WhiteSpaceShorthandParser.java index 26df69c91..26df69c91 100644 --- a/src/java/org/apache/fop/fo/properties/WhiteSpaceShorthandParser.java +++ b/src/main/java/org/apache/fop/fo/properties/WhiteSpaceShorthandParser.java diff --git a/src/java/org/apache/fop/fo/properties/XMLLangShorthandParser.java b/src/main/java/org/apache/fop/fo/properties/XMLLangShorthandParser.java index d8b8dac27..d8b8dac27 100644 --- a/src/java/org/apache/fop/fo/properties/XMLLangShorthandParser.java +++ b/src/main/java/org/apache/fop/fo/properties/XMLLangShorthandParser.java diff --git a/src/java/org/apache/fop/fo/properties/package.html b/src/main/java/org/apache/fop/fo/properties/package.html index 9ace84101..9ace84101 100644 --- a/src/java/org/apache/fop/fo/properties/package.html +++ b/src/main/java/org/apache/fop/fo/properties/package.html diff --git a/src/java/org/apache/fop/fonts/AbstractCodePointMapping.java b/src/main/java/org/apache/fop/fonts/AbstractCodePointMapping.java index ca0c52d5e..ca0c52d5e 100644 --- a/src/java/org/apache/fop/fonts/AbstractCodePointMapping.java +++ b/src/main/java/org/apache/fop/fonts/AbstractCodePointMapping.java diff --git a/src/java/org/apache/fop/fonts/Base14Font.java b/src/main/java/org/apache/fop/fonts/Base14Font.java index fdefd0cdd..fdefd0cdd 100644 --- a/src/java/org/apache/fop/fonts/Base14Font.java +++ b/src/main/java/org/apache/fop/fonts/Base14Font.java diff --git a/src/java/org/apache/fop/fonts/CIDFont.java b/src/main/java/org/apache/fop/fonts/CIDFont.java index dc398263e..dc398263e 100644 --- a/src/java/org/apache/fop/fonts/CIDFont.java +++ b/src/main/java/org/apache/fop/fonts/CIDFont.java diff --git a/src/java/org/apache/fop/fonts/CIDFontType.java b/src/main/java/org/apache/fop/fonts/CIDFontType.java index 20a94b9dd..20a94b9dd 100644 --- a/src/java/org/apache/fop/fonts/CIDFontType.java +++ b/src/main/java/org/apache/fop/fonts/CIDFontType.java diff --git a/src/java/org/apache/fop/fonts/CIDFull.java b/src/main/java/org/apache/fop/fonts/CIDFull.java index 1130459b7..1130459b7 100644 --- a/src/java/org/apache/fop/fonts/CIDFull.java +++ b/src/main/java/org/apache/fop/fonts/CIDFull.java diff --git a/src/java/org/apache/fop/fonts/CIDSet.java b/src/main/java/org/apache/fop/fonts/CIDSet.java index acfc705c8..acfc705c8 100644 --- a/src/java/org/apache/fop/fonts/CIDSet.java +++ b/src/main/java/org/apache/fop/fonts/CIDSet.java diff --git a/src/java/org/apache/fop/fonts/CIDSubset.java b/src/main/java/org/apache/fop/fonts/CIDSubset.java index 01b8495f8..01b8495f8 100644 --- a/src/java/org/apache/fop/fonts/CIDSubset.java +++ b/src/main/java/org/apache/fop/fonts/CIDSubset.java diff --git a/src/java/org/apache/fop/fonts/CMapSegment.java b/src/main/java/org/apache/fop/fonts/CMapSegment.java index 664ae727f..664ae727f 100644 --- a/src/java/org/apache/fop/fonts/CMapSegment.java +++ b/src/main/java/org/apache/fop/fonts/CMapSegment.java diff --git a/src/java/org/apache/fop/fonts/CustomFont.java b/src/main/java/org/apache/fop/fonts/CustomFont.java index 6f325d96d..6f325d96d 100644 --- a/src/java/org/apache/fop/fonts/CustomFont.java +++ b/src/main/java/org/apache/fop/fonts/CustomFont.java diff --git a/src/java/org/apache/fop/fonts/CustomFontCollection.java b/src/main/java/org/apache/fop/fonts/CustomFontCollection.java index 35231e224..35231e224 100644 --- a/src/java/org/apache/fop/fonts/CustomFontCollection.java +++ b/src/main/java/org/apache/fop/fonts/CustomFontCollection.java diff --git a/src/java/org/apache/fop/fonts/DefaultFontConfig.java b/src/main/java/org/apache/fop/fonts/DefaultFontConfig.java index 72d2280a8..72d2280a8 100644 --- a/src/java/org/apache/fop/fonts/DefaultFontConfig.java +++ b/src/main/java/org/apache/fop/fonts/DefaultFontConfig.java diff --git a/src/java/org/apache/fop/fonts/DefaultFontConfigurator.java b/src/main/java/org/apache/fop/fonts/DefaultFontConfigurator.java index 4a8b11f74..4a8b11f74 100644 --- a/src/java/org/apache/fop/fonts/DefaultFontConfigurator.java +++ b/src/main/java/org/apache/fop/fonts/DefaultFontConfigurator.java diff --git a/src/java/org/apache/fop/fonts/EmbedFontInfo.java b/src/main/java/org/apache/fop/fonts/EmbedFontInfo.java index cc96469f1..cc96469f1 100644 --- a/src/java/org/apache/fop/fonts/EmbedFontInfo.java +++ b/src/main/java/org/apache/fop/fonts/EmbedFontInfo.java diff --git a/src/java/org/apache/fop/fonts/EmbeddingMode.java b/src/main/java/org/apache/fop/fonts/EmbeddingMode.java index 5a3e905c9..5a3e905c9 100644 --- a/src/java/org/apache/fop/fonts/EmbeddingMode.java +++ b/src/main/java/org/apache/fop/fonts/EmbeddingMode.java diff --git a/src/java/org/apache/fop/fonts/EncodingMode.java b/src/main/java/org/apache/fop/fonts/EncodingMode.java index 78ffb7ac6..78ffb7ac6 100644 --- a/src/java/org/apache/fop/fonts/EncodingMode.java +++ b/src/main/java/org/apache/fop/fonts/EncodingMode.java diff --git a/src/java/org/apache/fop/fonts/Font.java b/src/main/java/org/apache/fop/fonts/Font.java index b3cea0d6f..b3cea0d6f 100644 --- a/src/java/org/apache/fop/fonts/Font.java +++ b/src/main/java/org/apache/fop/fonts/Font.java diff --git a/src/java/org/apache/fop/fonts/FontAdder.java b/src/main/java/org/apache/fop/fonts/FontAdder.java index f585dbfa5..f585dbfa5 100644 --- a/src/java/org/apache/fop/fonts/FontAdder.java +++ b/src/main/java/org/apache/fop/fonts/FontAdder.java diff --git a/src/java/org/apache/fop/fonts/FontCache.java b/src/main/java/org/apache/fop/fonts/FontCache.java index 1f5b96b80..1f5b96b80 100644 --- a/src/java/org/apache/fop/fonts/FontCache.java +++ b/src/main/java/org/apache/fop/fonts/FontCache.java diff --git a/src/java/org/apache/fop/fonts/FontCacheManager.java b/src/main/java/org/apache/fop/fonts/FontCacheManager.java index a4acd43a4..a4acd43a4 100644 --- a/src/java/org/apache/fop/fonts/FontCacheManager.java +++ b/src/main/java/org/apache/fop/fonts/FontCacheManager.java diff --git a/src/java/org/apache/fop/fonts/FontCacheManagerFactory.java b/src/main/java/org/apache/fop/fonts/FontCacheManagerFactory.java index c1d736b0d..c1d736b0d 100644 --- a/src/java/org/apache/fop/fonts/FontCacheManagerFactory.java +++ b/src/main/java/org/apache/fop/fonts/FontCacheManagerFactory.java diff --git a/src/java/org/apache/fop/fonts/FontCollection.java b/src/main/java/org/apache/fop/fonts/FontCollection.java index d481ae2f9..d481ae2f9 100644 --- a/src/java/org/apache/fop/fonts/FontCollection.java +++ b/src/main/java/org/apache/fop/fonts/FontCollection.java diff --git a/src/java/org/apache/fop/fonts/FontConfig.java b/src/main/java/org/apache/fop/fonts/FontConfig.java index 167baf09e..167baf09e 100644 --- a/src/java/org/apache/fop/fonts/FontConfig.java +++ b/src/main/java/org/apache/fop/fonts/FontConfig.java diff --git a/src/java/org/apache/fop/fonts/FontConfigurator.java b/src/main/java/org/apache/fop/fonts/FontConfigurator.java index c1ddb4296..c1ddb4296 100644 --- a/src/java/org/apache/fop/fonts/FontConfigurator.java +++ b/src/main/java/org/apache/fop/fonts/FontConfigurator.java diff --git a/src/java/org/apache/fop/fonts/FontDescriptor.java b/src/main/java/org/apache/fop/fonts/FontDescriptor.java index 8aea105be..8aea105be 100644 --- a/src/java/org/apache/fop/fonts/FontDescriptor.java +++ b/src/main/java/org/apache/fop/fonts/FontDescriptor.java diff --git a/src/java/org/apache/fop/fonts/FontDetector.java b/src/main/java/org/apache/fop/fonts/FontDetector.java index 71965f4a4..71965f4a4 100644 --- a/src/java/org/apache/fop/fonts/FontDetector.java +++ b/src/main/java/org/apache/fop/fonts/FontDetector.java diff --git a/src/java/org/apache/fop/fonts/FontDetectorFactory.java b/src/main/java/org/apache/fop/fonts/FontDetectorFactory.java index dd96e4a1a..dd96e4a1a 100644 --- a/src/java/org/apache/fop/fonts/FontDetectorFactory.java +++ b/src/main/java/org/apache/fop/fonts/FontDetectorFactory.java diff --git a/src/java/org/apache/fop/fonts/FontEventAdapter.java b/src/main/java/org/apache/fop/fonts/FontEventAdapter.java index e8078a796..e8078a796 100644 --- a/src/java/org/apache/fop/fonts/FontEventAdapter.java +++ b/src/main/java/org/apache/fop/fonts/FontEventAdapter.java diff --git a/src/java/org/apache/fop/fonts/FontEventListener.java b/src/main/java/org/apache/fop/fonts/FontEventListener.java index 419a3fcd2..419a3fcd2 100644 --- a/src/java/org/apache/fop/fonts/FontEventListener.java +++ b/src/main/java/org/apache/fop/fonts/FontEventListener.java diff --git a/src/java/org/apache/fop/fonts/FontEventProducer.java b/src/main/java/org/apache/fop/fonts/FontEventProducer.java index c6aaef662..c6aaef662 100644 --- a/src/java/org/apache/fop/fonts/FontEventProducer.java +++ b/src/main/java/org/apache/fop/fonts/FontEventProducer.java diff --git a/src/java/org/apache/fop/fonts/FontEventProducer.xml b/src/main/java/org/apache/fop/fonts/FontEventProducer.xml index d7ce27e7a..d7ce27e7a 100644 --- a/src/java/org/apache/fop/fonts/FontEventProducer.xml +++ b/src/main/java/org/apache/fop/fonts/FontEventProducer.xml diff --git a/src/java/org/apache/fop/fonts/FontInfo.java b/src/main/java/org/apache/fop/fonts/FontInfo.java index 617b5a4a7..617b5a4a7 100644 --- a/src/java/org/apache/fop/fonts/FontInfo.java +++ b/src/main/java/org/apache/fop/fonts/FontInfo.java diff --git a/src/java/org/apache/fop/fonts/FontLoader.java b/src/main/java/org/apache/fop/fonts/FontLoader.java index 92656ca2d..92656ca2d 100644 --- a/src/java/org/apache/fop/fonts/FontLoader.java +++ b/src/main/java/org/apache/fop/fonts/FontLoader.java diff --git a/src/java/org/apache/fop/fonts/FontManager.java b/src/main/java/org/apache/fop/fonts/FontManager.java index 266220d14..266220d14 100644 --- a/src/java/org/apache/fop/fonts/FontManager.java +++ b/src/main/java/org/apache/fop/fonts/FontManager.java diff --git a/src/java/org/apache/fop/fonts/FontManagerConfigurator.java b/src/main/java/org/apache/fop/fonts/FontManagerConfigurator.java index 72c1684b6..72c1684b6 100644 --- a/src/java/org/apache/fop/fonts/FontManagerConfigurator.java +++ b/src/main/java/org/apache/fop/fonts/FontManagerConfigurator.java diff --git a/src/java/org/apache/fop/fonts/FontMetrics.java b/src/main/java/org/apache/fop/fonts/FontMetrics.java index ce00e34b9..ce00e34b9 100644 --- a/src/java/org/apache/fop/fonts/FontMetrics.java +++ b/src/main/java/org/apache/fop/fonts/FontMetrics.java diff --git a/src/java/org/apache/fop/fonts/FontReader.java b/src/main/java/org/apache/fop/fonts/FontReader.java index 9f5d54396..9f5d54396 100644 --- a/src/java/org/apache/fop/fonts/FontReader.java +++ b/src/main/java/org/apache/fop/fonts/FontReader.java diff --git a/src/java/org/apache/fop/fonts/FontSelector.java b/src/main/java/org/apache/fop/fonts/FontSelector.java index a80a0e368..a80a0e368 100644 --- a/src/java/org/apache/fop/fonts/FontSelector.java +++ b/src/main/java/org/apache/fop/fonts/FontSelector.java diff --git a/src/java/org/apache/fop/fonts/FontSetup.java b/src/main/java/org/apache/fop/fonts/FontSetup.java index f9bae3332..f9bae3332 100644 --- a/src/java/org/apache/fop/fonts/FontSetup.java +++ b/src/main/java/org/apache/fop/fonts/FontSetup.java diff --git a/src/java/org/apache/fop/fonts/FontTriplet.java b/src/main/java/org/apache/fop/fonts/FontTriplet.java index a9728428a..a9728428a 100644 --- a/src/java/org/apache/fop/fonts/FontTriplet.java +++ b/src/main/java/org/apache/fop/fonts/FontTriplet.java diff --git a/src/java/org/apache/fop/fonts/FontType.java b/src/main/java/org/apache/fop/fonts/FontType.java index fc820c8b9..fc820c8b9 100644 --- a/src/java/org/apache/fop/fonts/FontType.java +++ b/src/main/java/org/apache/fop/fonts/FontType.java diff --git a/src/java/org/apache/fop/fonts/FontUris.java b/src/main/java/org/apache/fop/fonts/FontUris.java index fe0dfc21a..fe0dfc21a 100644 --- a/src/java/org/apache/fop/fonts/FontUris.java +++ b/src/main/java/org/apache/fop/fonts/FontUris.java diff --git a/src/java/org/apache/fop/fonts/FontUtil.java b/src/main/java/org/apache/fop/fonts/FontUtil.java index 1966d9fca..1966d9fca 100644 --- a/src/java/org/apache/fop/fonts/FontUtil.java +++ b/src/main/java/org/apache/fop/fonts/FontUtil.java diff --git a/src/java/org/apache/fop/fonts/GlyphMapping.java b/src/main/java/org/apache/fop/fonts/GlyphMapping.java index 95db0ff48..95db0ff48 100644 --- a/src/java/org/apache/fop/fonts/GlyphMapping.java +++ b/src/main/java/org/apache/fop/fonts/GlyphMapping.java diff --git a/src/java/org/apache/fop/fonts/Glyphs.java b/src/main/java/org/apache/fop/fonts/Glyphs.java index 04098f590..04098f590 100644 --- a/src/java/org/apache/fop/fonts/Glyphs.java +++ b/src/main/java/org/apache/fop/fonts/Glyphs.java diff --git a/src/java/org/apache/fop/fonts/LazyFont.java b/src/main/java/org/apache/fop/fonts/LazyFont.java index 06b106534..06b106534 100644 --- a/src/java/org/apache/fop/fonts/LazyFont.java +++ b/src/main/java/org/apache/fop/fonts/LazyFont.java diff --git a/src/java/org/apache/fop/fonts/MultiByteFont.java b/src/main/java/org/apache/fop/fonts/MultiByteFont.java index db72bee0c..db72bee0c 100644 --- a/src/java/org/apache/fop/fonts/MultiByteFont.java +++ b/src/main/java/org/apache/fop/fonts/MultiByteFont.java diff --git a/src/java/org/apache/fop/fonts/MutableFont.java b/src/main/java/org/apache/fop/fonts/MutableFont.java index f02eb2b49..f02eb2b49 100644 --- a/src/java/org/apache/fop/fonts/MutableFont.java +++ b/src/main/java/org/apache/fop/fonts/MutableFont.java diff --git a/src/java/org/apache/fop/fonts/NamedCharacter.java b/src/main/java/org/apache/fop/fonts/NamedCharacter.java index 9877ec6ec..9877ec6ec 100644 --- a/src/java/org/apache/fop/fonts/NamedCharacter.java +++ b/src/main/java/org/apache/fop/fonts/NamedCharacter.java diff --git a/src/java/org/apache/fop/fonts/SimpleSingleByteEncoding.java b/src/main/java/org/apache/fop/fonts/SimpleSingleByteEncoding.java index 0180d4540..0180d4540 100644 --- a/src/java/org/apache/fop/fonts/SimpleSingleByteEncoding.java +++ b/src/main/java/org/apache/fop/fonts/SimpleSingleByteEncoding.java diff --git a/src/java/org/apache/fop/fonts/SingleByteEncoding.java b/src/main/java/org/apache/fop/fonts/SingleByteEncoding.java index ad9d691f6..ad9d691f6 100644 --- a/src/java/org/apache/fop/fonts/SingleByteEncoding.java +++ b/src/main/java/org/apache/fop/fonts/SingleByteEncoding.java diff --git a/src/java/org/apache/fop/fonts/SingleByteFont.java b/src/main/java/org/apache/fop/fonts/SingleByteFont.java index e3037a524..e3037a524 100644 --- a/src/java/org/apache/fop/fonts/SingleByteFont.java +++ b/src/main/java/org/apache/fop/fonts/SingleByteFont.java diff --git a/src/java/org/apache/fop/fonts/TextFragment.java b/src/main/java/org/apache/fop/fonts/TextFragment.java index 8722ecf2e..8722ecf2e 100644 --- a/src/java/org/apache/fop/fonts/TextFragment.java +++ b/src/main/java/org/apache/fop/fonts/TextFragment.java diff --git a/src/java/org/apache/fop/fonts/Typeface.java b/src/main/java/org/apache/fop/fonts/Typeface.java index 3232d7605..3232d7605 100644 --- a/src/java/org/apache/fop/fonts/Typeface.java +++ b/src/main/java/org/apache/fop/fonts/Typeface.java diff --git a/src/java/org/apache/fop/fonts/apps/AbstractFontReader.java b/src/main/java/org/apache/fop/fonts/apps/AbstractFontReader.java index 4aa9b77a2..4aa9b77a2 100644 --- a/src/java/org/apache/fop/fonts/apps/AbstractFontReader.java +++ b/src/main/java/org/apache/fop/fonts/apps/AbstractFontReader.java diff --git a/src/java/org/apache/fop/fonts/apps/PFMReader.java b/src/main/java/org/apache/fop/fonts/apps/PFMReader.java index dd7f7343c..dd7f7343c 100644 --- a/src/java/org/apache/fop/fonts/apps/PFMReader.java +++ b/src/main/java/org/apache/fop/fonts/apps/PFMReader.java diff --git a/src/java/org/apache/fop/fonts/apps/TTFReader.java b/src/main/java/org/apache/fop/fonts/apps/TTFReader.java index 6f80fd098..6f80fd098 100644 --- a/src/java/org/apache/fop/fonts/apps/TTFReader.java +++ b/src/main/java/org/apache/fop/fonts/apps/TTFReader.java diff --git a/src/java/org/apache/fop/fonts/apps/package.html b/src/main/java/org/apache/fop/fonts/apps/package.html index 5e0551c23..5e0551c23 100644 --- a/src/java/org/apache/fop/fonts/apps/package.html +++ b/src/main/java/org/apache/fop/fonts/apps/package.html diff --git a/src/java/org/apache/fop/fonts/autodetect/FontDirFinder.java b/src/main/java/org/apache/fop/fonts/autodetect/FontDirFinder.java index 383c5283d..383c5283d 100644 --- a/src/java/org/apache/fop/fonts/autodetect/FontDirFinder.java +++ b/src/main/java/org/apache/fop/fonts/autodetect/FontDirFinder.java diff --git a/src/java/org/apache/fop/fonts/autodetect/FontFileFinder.java b/src/main/java/org/apache/fop/fonts/autodetect/FontFileFinder.java index 8100c4b9b..8100c4b9b 100644 --- a/src/java/org/apache/fop/fonts/autodetect/FontFileFinder.java +++ b/src/main/java/org/apache/fop/fonts/autodetect/FontFileFinder.java diff --git a/src/java/org/apache/fop/fonts/autodetect/FontFinder.java b/src/main/java/org/apache/fop/fonts/autodetect/FontFinder.java index 51e79443a..51e79443a 100644 --- a/src/java/org/apache/fop/fonts/autodetect/FontFinder.java +++ b/src/main/java/org/apache/fop/fonts/autodetect/FontFinder.java diff --git a/src/java/org/apache/fop/fonts/autodetect/FontInfoFinder.java b/src/main/java/org/apache/fop/fonts/autodetect/FontInfoFinder.java index a1d65459a..a1d65459a 100644 --- a/src/java/org/apache/fop/fonts/autodetect/FontInfoFinder.java +++ b/src/main/java/org/apache/fop/fonts/autodetect/FontInfoFinder.java diff --git a/src/java/org/apache/fop/fonts/autodetect/MacFontDirFinder.java b/src/main/java/org/apache/fop/fonts/autodetect/MacFontDirFinder.java index 1231badf2..1231badf2 100644 --- a/src/java/org/apache/fop/fonts/autodetect/MacFontDirFinder.java +++ b/src/main/java/org/apache/fop/fonts/autodetect/MacFontDirFinder.java diff --git a/src/java/org/apache/fop/fonts/autodetect/NativeFontDirFinder.java b/src/main/java/org/apache/fop/fonts/autodetect/NativeFontDirFinder.java index 9f723a308..9f723a308 100644 --- a/src/java/org/apache/fop/fonts/autodetect/NativeFontDirFinder.java +++ b/src/main/java/org/apache/fop/fonts/autodetect/NativeFontDirFinder.java diff --git a/src/java/org/apache/fop/fonts/autodetect/UnixFontDirFinder.java b/src/main/java/org/apache/fop/fonts/autodetect/UnixFontDirFinder.java index b6d596f03..b6d596f03 100644 --- a/src/java/org/apache/fop/fonts/autodetect/UnixFontDirFinder.java +++ b/src/main/java/org/apache/fop/fonts/autodetect/UnixFontDirFinder.java diff --git a/src/java/org/apache/fop/fonts/autodetect/WindowsFontDirFinder.java b/src/main/java/org/apache/fop/fonts/autodetect/WindowsFontDirFinder.java index bd506d9ed..bd506d9ed 100644 --- a/src/java/org/apache/fop/fonts/autodetect/WindowsFontDirFinder.java +++ b/src/main/java/org/apache/fop/fonts/autodetect/WindowsFontDirFinder.java diff --git a/src/java/org/apache/fop/fonts/autodetect/package.html b/src/main/java/org/apache/fop/fonts/autodetect/package.html index 0a29acbb1..0a29acbb1 100644 --- a/src/java/org/apache/fop/fonts/autodetect/package.html +++ b/src/main/java/org/apache/fop/fonts/autodetect/package.html diff --git a/src/java/org/apache/fop/fonts/base14/Base14FontCollection.java b/src/main/java/org/apache/fop/fonts/base14/Base14FontCollection.java index ac01c9850..ac01c9850 100644 --- a/src/java/org/apache/fop/fonts/base14/Base14FontCollection.java +++ b/src/main/java/org/apache/fop/fonts/base14/Base14FontCollection.java diff --git a/src/java/org/apache/fop/fonts/base14/package.html b/src/main/java/org/apache/fop/fonts/base14/package.html index 90c58d555..90c58d555 100644 --- a/src/java/org/apache/fop/fonts/base14/package.html +++ b/src/main/java/org/apache/fop/fonts/base14/package.html diff --git a/src/java/org/apache/fop/fonts/cff/CFFDataReader.java b/src/main/java/org/apache/fop/fonts/cff/CFFDataReader.java index 3ce63a2a4..3ce63a2a4 100644 --- a/src/java/org/apache/fop/fonts/cff/CFFDataReader.java +++ b/src/main/java/org/apache/fop/fonts/cff/CFFDataReader.java diff --git a/src/java/org/apache/fop/fonts/package.html b/src/main/java/org/apache/fop/fonts/package.html index fee0bf827..fee0bf827 100644 --- a/src/java/org/apache/fop/fonts/package.html +++ b/src/main/java/org/apache/fop/fonts/package.html diff --git a/src/java/org/apache/fop/fonts/substitute/AttributeValue.java b/src/main/java/org/apache/fop/fonts/substitute/AttributeValue.java index bfe888d3c..bfe888d3c 100644 --- a/src/java/org/apache/fop/fonts/substitute/AttributeValue.java +++ b/src/main/java/org/apache/fop/fonts/substitute/AttributeValue.java diff --git a/src/java/org/apache/fop/fonts/substitute/FontQualifier.java b/src/main/java/org/apache/fop/fonts/substitute/FontQualifier.java index 8e9213e9d..8e9213e9d 100644 --- a/src/java/org/apache/fop/fonts/substitute/FontQualifier.java +++ b/src/main/java/org/apache/fop/fonts/substitute/FontQualifier.java diff --git a/src/java/org/apache/fop/fonts/substitute/FontSubstitution.java b/src/main/java/org/apache/fop/fonts/substitute/FontSubstitution.java index 7725fc147..7725fc147 100644 --- a/src/java/org/apache/fop/fonts/substitute/FontSubstitution.java +++ b/src/main/java/org/apache/fop/fonts/substitute/FontSubstitution.java diff --git a/src/java/org/apache/fop/fonts/substitute/FontSubstitutions.java b/src/main/java/org/apache/fop/fonts/substitute/FontSubstitutions.java index e96459577..e96459577 100644 --- a/src/java/org/apache/fop/fonts/substitute/FontSubstitutions.java +++ b/src/main/java/org/apache/fop/fonts/substitute/FontSubstitutions.java diff --git a/src/java/org/apache/fop/fonts/substitute/FontSubstitutionsConfigurator.java b/src/main/java/org/apache/fop/fonts/substitute/FontSubstitutionsConfigurator.java index fb60473fc..fb60473fc 100644 --- a/src/java/org/apache/fop/fonts/substitute/FontSubstitutionsConfigurator.java +++ b/src/main/java/org/apache/fop/fonts/substitute/FontSubstitutionsConfigurator.java diff --git a/src/java/org/apache/fop/fonts/substitute/FontWeightRange.java b/src/main/java/org/apache/fop/fonts/substitute/FontWeightRange.java index 34e04eb67..34e04eb67 100644 --- a/src/java/org/apache/fop/fonts/substitute/FontWeightRange.java +++ b/src/main/java/org/apache/fop/fonts/substitute/FontWeightRange.java diff --git a/src/java/org/apache/fop/fonts/substitute/package.html b/src/main/java/org/apache/fop/fonts/substitute/package.html index c144ca1f8..c144ca1f8 100644 --- a/src/java/org/apache/fop/fonts/substitute/package.html +++ b/src/main/java/org/apache/fop/fonts/substitute/package.html diff --git a/src/java/org/apache/fop/fonts/truetype/FontFileReader.java b/src/main/java/org/apache/fop/fonts/truetype/FontFileReader.java index 790e885bc..790e885bc 100644 --- a/src/java/org/apache/fop/fonts/truetype/FontFileReader.java +++ b/src/main/java/org/apache/fop/fonts/truetype/FontFileReader.java diff --git a/src/java/org/apache/fop/fonts/truetype/GlyfTable.java b/src/main/java/org/apache/fop/fonts/truetype/GlyfTable.java index 6ad479a0e..6ad479a0e 100644 --- a/src/java/org/apache/fop/fonts/truetype/GlyfTable.java +++ b/src/main/java/org/apache/fop/fonts/truetype/GlyfTable.java diff --git a/src/java/org/apache/fop/fonts/truetype/OFDirTabEntry.java b/src/main/java/org/apache/fop/fonts/truetype/OFDirTabEntry.java index 34e7fba14..34e7fba14 100644 --- a/src/java/org/apache/fop/fonts/truetype/OFDirTabEntry.java +++ b/src/main/java/org/apache/fop/fonts/truetype/OFDirTabEntry.java diff --git a/src/java/org/apache/fop/fonts/truetype/OFFontLoader.java b/src/main/java/org/apache/fop/fonts/truetype/OFFontLoader.java index 7c8774933..7c8774933 100644 --- a/src/java/org/apache/fop/fonts/truetype/OFFontLoader.java +++ b/src/main/java/org/apache/fop/fonts/truetype/OFFontLoader.java diff --git a/src/java/org/apache/fop/fonts/truetype/OFMtxEntry.java b/src/main/java/org/apache/fop/fonts/truetype/OFMtxEntry.java index b52f03849..b52f03849 100644 --- a/src/java/org/apache/fop/fonts/truetype/OFMtxEntry.java +++ b/src/main/java/org/apache/fop/fonts/truetype/OFMtxEntry.java diff --git a/src/java/org/apache/fop/fonts/truetype/OFTableName.java b/src/main/java/org/apache/fop/fonts/truetype/OFTableName.java index f6264129a..f6264129a 100644 --- a/src/java/org/apache/fop/fonts/truetype/OFTableName.java +++ b/src/main/java/org/apache/fop/fonts/truetype/OFTableName.java diff --git a/src/java/org/apache/fop/fonts/truetype/OTFFile.java b/src/main/java/org/apache/fop/fonts/truetype/OTFFile.java index 1ac7a565e..1ac7a565e 100644 --- a/src/java/org/apache/fop/fonts/truetype/OTFFile.java +++ b/src/main/java/org/apache/fop/fonts/truetype/OTFFile.java diff --git a/src/java/org/apache/fop/fonts/truetype/OTFSubSetFile.java b/src/main/java/org/apache/fop/fonts/truetype/OTFSubSetFile.java index 2c083add2..2c083add2 100644 --- a/src/java/org/apache/fop/fonts/truetype/OTFSubSetFile.java +++ b/src/main/java/org/apache/fop/fonts/truetype/OTFSubSetFile.java diff --git a/src/java/org/apache/fop/fonts/truetype/OpenFont.java b/src/main/java/org/apache/fop/fonts/truetype/OpenFont.java index e94f31bb1..e94f31bb1 100644 --- a/src/java/org/apache/fop/fonts/truetype/OpenFont.java +++ b/src/main/java/org/apache/fop/fonts/truetype/OpenFont.java diff --git a/src/java/org/apache/fop/fonts/truetype/TTFFile.java b/src/main/java/org/apache/fop/fonts/truetype/TTFFile.java index 4b0e3d628..4b0e3d628 100644 --- a/src/java/org/apache/fop/fonts/truetype/TTFFile.java +++ b/src/main/java/org/apache/fop/fonts/truetype/TTFFile.java diff --git a/src/java/org/apache/fop/fonts/truetype/TTFGlyphOutputStream.java b/src/main/java/org/apache/fop/fonts/truetype/TTFGlyphOutputStream.java index 313d5836d..313d5836d 100644 --- a/src/java/org/apache/fop/fonts/truetype/TTFGlyphOutputStream.java +++ b/src/main/java/org/apache/fop/fonts/truetype/TTFGlyphOutputStream.java diff --git a/src/java/org/apache/fop/fonts/truetype/TTFOutputStream.java b/src/main/java/org/apache/fop/fonts/truetype/TTFOutputStream.java index 09b5b6f50..09b5b6f50 100644 --- a/src/java/org/apache/fop/fonts/truetype/TTFOutputStream.java +++ b/src/main/java/org/apache/fop/fonts/truetype/TTFOutputStream.java diff --git a/src/java/org/apache/fop/fonts/truetype/TTFSubSetFile.java b/src/main/java/org/apache/fop/fonts/truetype/TTFSubSetFile.java index 6d2d68672..6d2d68672 100644 --- a/src/java/org/apache/fop/fonts/truetype/TTFSubSetFile.java +++ b/src/main/java/org/apache/fop/fonts/truetype/TTFSubSetFile.java diff --git a/src/java/org/apache/fop/fonts/truetype/TTFTableOutputStream.java b/src/main/java/org/apache/fop/fonts/truetype/TTFTableOutputStream.java index d0d2007f5..d0d2007f5 100644 --- a/src/java/org/apache/fop/fonts/truetype/TTFTableOutputStream.java +++ b/src/main/java/org/apache/fop/fonts/truetype/TTFTableOutputStream.java diff --git a/src/java/org/apache/fop/fonts/truetype/package.html b/src/main/java/org/apache/fop/fonts/truetype/package.html index 6517f9889..6517f9889 100644 --- a/src/java/org/apache/fop/fonts/truetype/package.html +++ b/src/main/java/org/apache/fop/fonts/truetype/package.html diff --git a/src/java/org/apache/fop/fonts/type1/AFMCharMetrics.java b/src/main/java/org/apache/fop/fonts/type1/AFMCharMetrics.java index 8d9f4238b..8d9f4238b 100644 --- a/src/java/org/apache/fop/fonts/type1/AFMCharMetrics.java +++ b/src/main/java/org/apache/fop/fonts/type1/AFMCharMetrics.java diff --git a/src/java/org/apache/fop/fonts/type1/AFMFile.java b/src/main/java/org/apache/fop/fonts/type1/AFMFile.java index 2aa718ea0..2aa718ea0 100644 --- a/src/java/org/apache/fop/fonts/type1/AFMFile.java +++ b/src/main/java/org/apache/fop/fonts/type1/AFMFile.java diff --git a/src/java/org/apache/fop/fonts/type1/AFMParser.java b/src/main/java/org/apache/fop/fonts/type1/AFMParser.java index ecc9196ed..ecc9196ed 100644 --- a/src/java/org/apache/fop/fonts/type1/AFMParser.java +++ b/src/main/java/org/apache/fop/fonts/type1/AFMParser.java diff --git a/src/java/org/apache/fop/fonts/type1/AFMWritingDirectionMetrics.java b/src/main/java/org/apache/fop/fonts/type1/AFMWritingDirectionMetrics.java index 07d522bd9..07d522bd9 100644 --- a/src/java/org/apache/fop/fonts/type1/AFMWritingDirectionMetrics.java +++ b/src/main/java/org/apache/fop/fonts/type1/AFMWritingDirectionMetrics.java diff --git a/src/java/org/apache/fop/fonts/type1/AdobeStandardEncoding.java b/src/main/java/org/apache/fop/fonts/type1/AdobeStandardEncoding.java index d3d5a969d..d3d5a969d 100644 --- a/src/java/org/apache/fop/fonts/type1/AdobeStandardEncoding.java +++ b/src/main/java/org/apache/fop/fonts/type1/AdobeStandardEncoding.java diff --git a/src/java/org/apache/fop/fonts/type1/CharMetricsHandler.java b/src/main/java/org/apache/fop/fonts/type1/CharMetricsHandler.java index 79753f3f8..79753f3f8 100644 --- a/src/java/org/apache/fop/fonts/type1/CharMetricsHandler.java +++ b/src/main/java/org/apache/fop/fonts/type1/CharMetricsHandler.java diff --git a/src/java/org/apache/fop/fonts/type1/PFBData.java b/src/main/java/org/apache/fop/fonts/type1/PFBData.java index 05f0ec78f..05f0ec78f 100644 --- a/src/java/org/apache/fop/fonts/type1/PFBData.java +++ b/src/main/java/org/apache/fop/fonts/type1/PFBData.java diff --git a/src/java/org/apache/fop/fonts/type1/PFBParser.java b/src/main/java/org/apache/fop/fonts/type1/PFBParser.java index 339a9e141..339a9e141 100644 --- a/src/java/org/apache/fop/fonts/type1/PFBParser.java +++ b/src/main/java/org/apache/fop/fonts/type1/PFBParser.java diff --git a/src/java/org/apache/fop/fonts/type1/PFMFile.java b/src/main/java/org/apache/fop/fonts/type1/PFMFile.java index 8856fdb7f..8856fdb7f 100644 --- a/src/java/org/apache/fop/fonts/type1/PFMFile.java +++ b/src/main/java/org/apache/fop/fonts/type1/PFMFile.java diff --git a/src/java/org/apache/fop/fonts/type1/PFMInputStream.java b/src/main/java/org/apache/fop/fonts/type1/PFMInputStream.java index e8f0cb705..e8f0cb705 100644 --- a/src/java/org/apache/fop/fonts/type1/PFMInputStream.java +++ b/src/main/java/org/apache/fop/fonts/type1/PFMInputStream.java diff --git a/src/java/org/apache/fop/fonts/type1/PostscriptParser.java b/src/main/java/org/apache/fop/fonts/type1/PostscriptParser.java index bc984fecd..bc984fecd 100644 --- a/src/java/org/apache/fop/fonts/type1/PostscriptParser.java +++ b/src/main/java/org/apache/fop/fonts/type1/PostscriptParser.java diff --git a/src/java/org/apache/fop/fonts/type1/Type1FontLoader.java b/src/main/java/org/apache/fop/fonts/type1/Type1FontLoader.java index d364462cc..d364462cc 100644 --- a/src/java/org/apache/fop/fonts/type1/Type1FontLoader.java +++ b/src/main/java/org/apache/fop/fonts/type1/Type1FontLoader.java diff --git a/src/java/org/apache/fop/fonts/type1/Type1SubsetFile.java b/src/main/java/org/apache/fop/fonts/type1/Type1SubsetFile.java index 394d5c777..394d5c777 100644 --- a/src/java/org/apache/fop/fonts/type1/Type1SubsetFile.java +++ b/src/main/java/org/apache/fop/fonts/type1/Type1SubsetFile.java diff --git a/src/java/org/apache/fop/fonts/type1/package.html b/src/main/java/org/apache/fop/fonts/type1/package.html index 0c492fc4d..0c492fc4d 100644 --- a/src/java/org/apache/fop/fonts/type1/package.html +++ b/src/main/java/org/apache/fop/fonts/type1/package.html diff --git a/src/java/org/apache/fop/hyphenation/ByteVector.java b/src/main/java/org/apache/fop/hyphenation/ByteVector.java index dde7f2847..dde7f2847 100644 --- a/src/java/org/apache/fop/hyphenation/ByteVector.java +++ b/src/main/java/org/apache/fop/hyphenation/ByteVector.java diff --git a/src/java/org/apache/fop/hyphenation/CharVector.java b/src/main/java/org/apache/fop/hyphenation/CharVector.java index de1dea533..de1dea533 100644 --- a/src/java/org/apache/fop/hyphenation/CharVector.java +++ b/src/main/java/org/apache/fop/hyphenation/CharVector.java diff --git a/src/java/org/apache/fop/hyphenation/Hyphen.java b/src/main/java/org/apache/fop/hyphenation/Hyphen.java index 48af1e8b5..48af1e8b5 100644 --- a/src/java/org/apache/fop/hyphenation/Hyphen.java +++ b/src/main/java/org/apache/fop/hyphenation/Hyphen.java diff --git a/src/java/org/apache/fop/hyphenation/Hyphenation.java b/src/main/java/org/apache/fop/hyphenation/Hyphenation.java index 9b4a33339..9b4a33339 100644 --- a/src/java/org/apache/fop/hyphenation/Hyphenation.java +++ b/src/main/java/org/apache/fop/hyphenation/Hyphenation.java diff --git a/src/java/org/apache/fop/hyphenation/HyphenationException.java b/src/main/java/org/apache/fop/hyphenation/HyphenationException.java index 5fe663191..5fe663191 100644 --- a/src/java/org/apache/fop/hyphenation/HyphenationException.java +++ b/src/main/java/org/apache/fop/hyphenation/HyphenationException.java diff --git a/src/java/org/apache/fop/hyphenation/HyphenationTree.java b/src/main/java/org/apache/fop/hyphenation/HyphenationTree.java index f61e8a11a..f61e8a11a 100644 --- a/src/java/org/apache/fop/hyphenation/HyphenationTree.java +++ b/src/main/java/org/apache/fop/hyphenation/HyphenationTree.java diff --git a/src/java/org/apache/fop/hyphenation/HyphenationTreeCache.java b/src/main/java/org/apache/fop/hyphenation/HyphenationTreeCache.java index ec16810b3..ec16810b3 100644 --- a/src/java/org/apache/fop/hyphenation/HyphenationTreeCache.java +++ b/src/main/java/org/apache/fop/hyphenation/HyphenationTreeCache.java diff --git a/src/java/org/apache/fop/hyphenation/Hyphenator.java b/src/main/java/org/apache/fop/hyphenation/Hyphenator.java index ed992427a..ed992427a 100644 --- a/src/java/org/apache/fop/hyphenation/Hyphenator.java +++ b/src/main/java/org/apache/fop/hyphenation/Hyphenator.java diff --git a/src/java/org/apache/fop/hyphenation/PatternConsumer.java b/src/main/java/org/apache/fop/hyphenation/PatternConsumer.java index f350adcbd..f350adcbd 100644 --- a/src/java/org/apache/fop/hyphenation/PatternConsumer.java +++ b/src/main/java/org/apache/fop/hyphenation/PatternConsumer.java diff --git a/src/java/org/apache/fop/hyphenation/PatternParser.java b/src/main/java/org/apache/fop/hyphenation/PatternParser.java index 2fc5984ad..2fc5984ad 100644 --- a/src/java/org/apache/fop/hyphenation/PatternParser.java +++ b/src/main/java/org/apache/fop/hyphenation/PatternParser.java diff --git a/src/java/org/apache/fop/hyphenation/SerializeHyphPattern.java b/src/main/java/org/apache/fop/hyphenation/SerializeHyphPattern.java index 8d51edf25..8d51edf25 100644 --- a/src/java/org/apache/fop/hyphenation/SerializeHyphPattern.java +++ b/src/main/java/org/apache/fop/hyphenation/SerializeHyphPattern.java diff --git a/src/java/org/apache/fop/hyphenation/TernaryTree.java b/src/main/java/org/apache/fop/hyphenation/TernaryTree.java index 359c729b6..359c729b6 100644 --- a/src/java/org/apache/fop/hyphenation/TernaryTree.java +++ b/src/main/java/org/apache/fop/hyphenation/TernaryTree.java diff --git a/src/java/org/apache/fop/hyphenation/classes.xml b/src/main/java/org/apache/fop/hyphenation/classes.xml index 056a533a8..056a533a8 100644 --- a/src/java/org/apache/fop/hyphenation/classes.xml +++ b/src/main/java/org/apache/fop/hyphenation/classes.xml diff --git a/src/java/org/apache/fop/hyphenation/package.html b/src/main/java/org/apache/fop/hyphenation/package.html index 0633a5446..0633a5446 100644 --- a/src/java/org/apache/fop/hyphenation/package.html +++ b/src/main/java/org/apache/fop/hyphenation/package.html diff --git a/src/java/org/apache/fop/image/loader/batik/BatikImageFlavors.java b/src/main/java/org/apache/fop/image/loader/batik/BatikImageFlavors.java index e96cb68ed..e96cb68ed 100644 --- a/src/java/org/apache/fop/image/loader/batik/BatikImageFlavors.java +++ b/src/main/java/org/apache/fop/image/loader/batik/BatikImageFlavors.java diff --git a/src/java/org/apache/fop/image/loader/batik/BatikUtil.java b/src/main/java/org/apache/fop/image/loader/batik/BatikUtil.java index cda57b596..cda57b596 100644 --- a/src/java/org/apache/fop/image/loader/batik/BatikUtil.java +++ b/src/main/java/org/apache/fop/image/loader/batik/BatikUtil.java diff --git a/src/java/org/apache/fop/image/loader/batik/GenericFOPBridgeContext.java b/src/main/java/org/apache/fop/image/loader/batik/GenericFOPBridgeContext.java index c1782dc13..c1782dc13 100644 --- a/src/java/org/apache/fop/image/loader/batik/GenericFOPBridgeContext.java +++ b/src/main/java/org/apache/fop/image/loader/batik/GenericFOPBridgeContext.java diff --git a/src/java/org/apache/fop/image/loader/batik/GenericFOPImageElementBridge.java b/src/main/java/org/apache/fop/image/loader/batik/GenericFOPImageElementBridge.java index 7a14025c8..7a14025c8 100644 --- a/src/java/org/apache/fop/image/loader/batik/GenericFOPImageElementBridge.java +++ b/src/main/java/org/apache/fop/image/loader/batik/GenericFOPImageElementBridge.java diff --git a/src/java/org/apache/fop/image/loader/batik/Graphics2DImagePainterImpl.java b/src/main/java/org/apache/fop/image/loader/batik/Graphics2DImagePainterImpl.java index 8dbce6e1b..8dbce6e1b 100644 --- a/src/java/org/apache/fop/image/loader/batik/Graphics2DImagePainterImpl.java +++ b/src/main/java/org/apache/fop/image/loader/batik/Graphics2DImagePainterImpl.java diff --git a/src/java/org/apache/fop/image/loader/batik/ImageConverterG2D2SVG.java b/src/main/java/org/apache/fop/image/loader/batik/ImageConverterG2D2SVG.java index 85244aea5..85244aea5 100644 --- a/src/java/org/apache/fop/image/loader/batik/ImageConverterG2D2SVG.java +++ b/src/main/java/org/apache/fop/image/loader/batik/ImageConverterG2D2SVG.java diff --git a/src/java/org/apache/fop/image/loader/batik/ImageConverterSVG2G2D.java b/src/main/java/org/apache/fop/image/loader/batik/ImageConverterSVG2G2D.java index b5d8626f9..b5d8626f9 100644 --- a/src/java/org/apache/fop/image/loader/batik/ImageConverterSVG2G2D.java +++ b/src/main/java/org/apache/fop/image/loader/batik/ImageConverterSVG2G2D.java diff --git a/src/java/org/apache/fop/image/loader/batik/ImageConverterWMF2G2D.java b/src/main/java/org/apache/fop/image/loader/batik/ImageConverterWMF2G2D.java index 6d84a03d3..6d84a03d3 100644 --- a/src/java/org/apache/fop/image/loader/batik/ImageConverterWMF2G2D.java +++ b/src/main/java/org/apache/fop/image/loader/batik/ImageConverterWMF2G2D.java diff --git a/src/java/org/apache/fop/image/loader/batik/ImageLoaderFactorySVG.java b/src/main/java/org/apache/fop/image/loader/batik/ImageLoaderFactorySVG.java index 3add8be8b..3add8be8b 100644 --- a/src/java/org/apache/fop/image/loader/batik/ImageLoaderFactorySVG.java +++ b/src/main/java/org/apache/fop/image/loader/batik/ImageLoaderFactorySVG.java diff --git a/src/java/org/apache/fop/image/loader/batik/ImageLoaderFactoryWMF.java b/src/main/java/org/apache/fop/image/loader/batik/ImageLoaderFactoryWMF.java index eaefe9efe..eaefe9efe 100644 --- a/src/java/org/apache/fop/image/loader/batik/ImageLoaderFactoryWMF.java +++ b/src/main/java/org/apache/fop/image/loader/batik/ImageLoaderFactoryWMF.java diff --git a/src/java/org/apache/fop/image/loader/batik/ImageLoaderSVG.java b/src/main/java/org/apache/fop/image/loader/batik/ImageLoaderSVG.java index 53a7e2cc7..53a7e2cc7 100644 --- a/src/java/org/apache/fop/image/loader/batik/ImageLoaderSVG.java +++ b/src/main/java/org/apache/fop/image/loader/batik/ImageLoaderSVG.java diff --git a/src/java/org/apache/fop/image/loader/batik/ImageLoaderWMF.java b/src/main/java/org/apache/fop/image/loader/batik/ImageLoaderWMF.java index bed3043c6..bed3043c6 100644 --- a/src/java/org/apache/fop/image/loader/batik/ImageLoaderWMF.java +++ b/src/main/java/org/apache/fop/image/loader/batik/ImageLoaderWMF.java diff --git a/src/java/org/apache/fop/image/loader/batik/ImageWMF.java b/src/main/java/org/apache/fop/image/loader/batik/ImageWMF.java index a927345f9..a927345f9 100644 --- a/src/java/org/apache/fop/image/loader/batik/ImageWMF.java +++ b/src/main/java/org/apache/fop/image/loader/batik/ImageWMF.java diff --git a/src/java/org/apache/fop/image/loader/batik/PreloaderSVG.java b/src/main/java/org/apache/fop/image/loader/batik/PreloaderSVG.java index 7df9a6cb6..7df9a6cb6 100644 --- a/src/java/org/apache/fop/image/loader/batik/PreloaderSVG.java +++ b/src/main/java/org/apache/fop/image/loader/batik/PreloaderSVG.java diff --git a/src/java/org/apache/fop/image/loader/batik/PreloaderWMF.java b/src/main/java/org/apache/fop/image/loader/batik/PreloaderWMF.java index 582c35a82..582c35a82 100644 --- a/src/java/org/apache/fop/image/loader/batik/PreloaderWMF.java +++ b/src/main/java/org/apache/fop/image/loader/batik/PreloaderWMF.java diff --git a/src/java/org/apache/fop/image/loader/batik/package.html b/src/main/java/org/apache/fop/image/loader/batik/package.html index f664913d7..f664913d7 100644 --- a/src/java/org/apache/fop/image/loader/batik/package.html +++ b/src/main/java/org/apache/fop/image/loader/batik/package.html diff --git a/src/java/org/apache/fop/image/package.html b/src/main/java/org/apache/fop/image/package.html index cbd2d7c5e..cbd2d7c5e 100644 --- a/src/java/org/apache/fop/image/package.html +++ b/src/main/java/org/apache/fop/image/package.html diff --git a/src/java/org/apache/fop/layoutmgr/AbstractBaseLayoutManager.java b/src/main/java/org/apache/fop/layoutmgr/AbstractBaseLayoutManager.java index b687689bc..b687689bc 100644 --- a/src/java/org/apache/fop/layoutmgr/AbstractBaseLayoutManager.java +++ b/src/main/java/org/apache/fop/layoutmgr/AbstractBaseLayoutManager.java diff --git a/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java b/src/main/java/org/apache/fop/layoutmgr/AbstractBreaker.java index d0594ce8a..d0594ce8a 100644 --- a/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java +++ b/src/main/java/org/apache/fop/layoutmgr/AbstractBreaker.java diff --git a/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java b/src/main/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java index 3a73b233b..3a73b233b 100644 --- a/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java +++ b/src/main/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java diff --git a/src/java/org/apache/fop/layoutmgr/AbstractPageSequenceLayoutManager.java b/src/main/java/org/apache/fop/layoutmgr/AbstractPageSequenceLayoutManager.java index 8435ad093..8435ad093 100644 --- a/src/java/org/apache/fop/layoutmgr/AbstractPageSequenceLayoutManager.java +++ b/src/main/java/org/apache/fop/layoutmgr/AbstractPageSequenceLayoutManager.java diff --git a/src/java/org/apache/fop/layoutmgr/Adjustment.java b/src/main/java/org/apache/fop/layoutmgr/Adjustment.java index 0a96fb2c1..0a96fb2c1 100644 --- a/src/java/org/apache/fop/layoutmgr/Adjustment.java +++ b/src/main/java/org/apache/fop/layoutmgr/Adjustment.java diff --git a/src/java/org/apache/fop/layoutmgr/AreaAdditionUtil.java b/src/main/java/org/apache/fop/layoutmgr/AreaAdditionUtil.java index d731ab62a..d731ab62a 100644 --- a/src/java/org/apache/fop/layoutmgr/AreaAdditionUtil.java +++ b/src/main/java/org/apache/fop/layoutmgr/AreaAdditionUtil.java diff --git a/src/java/org/apache/fop/layoutmgr/BalancingColumnBreakingAlgorithm.java b/src/main/java/org/apache/fop/layoutmgr/BalancingColumnBreakingAlgorithm.java index 06c3c538d..06c3c538d 100644 --- a/src/java/org/apache/fop/layoutmgr/BalancingColumnBreakingAlgorithm.java +++ b/src/main/java/org/apache/fop/layoutmgr/BalancingColumnBreakingAlgorithm.java diff --git a/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java b/src/main/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java index 9ce113d11..9ce113d11 100644 --- a/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java +++ b/src/main/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java diff --git a/src/java/org/apache/fop/layoutmgr/BlockKnuthSequence.java b/src/main/java/org/apache/fop/layoutmgr/BlockKnuthSequence.java index 83c1ae585..83c1ae585 100644 --- a/src/java/org/apache/fop/layoutmgr/BlockKnuthSequence.java +++ b/src/main/java/org/apache/fop/layoutmgr/BlockKnuthSequence.java diff --git a/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java b/src/main/java/org/apache/fop/layoutmgr/BlockLayoutManager.java index d3bdc7b85..d3bdc7b85 100644 --- a/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java +++ b/src/main/java/org/apache/fop/layoutmgr/BlockLayoutManager.java diff --git a/src/java/org/apache/fop/layoutmgr/BlockLevelEventProducer.java b/src/main/java/org/apache/fop/layoutmgr/BlockLevelEventProducer.java index d043456be..d043456be 100644 --- a/src/java/org/apache/fop/layoutmgr/BlockLevelEventProducer.java +++ b/src/main/java/org/apache/fop/layoutmgr/BlockLevelEventProducer.java diff --git a/src/java/org/apache/fop/layoutmgr/BlockLevelEventProducer.xml b/src/main/java/org/apache/fop/layoutmgr/BlockLevelEventProducer.xml index de040bdfe..de040bdfe 100644 --- a/src/java/org/apache/fop/layoutmgr/BlockLevelEventProducer.xml +++ b/src/main/java/org/apache/fop/layoutmgr/BlockLevelEventProducer.xml diff --git a/src/java/org/apache/fop/layoutmgr/BlockLevelLayoutManager.java b/src/main/java/org/apache/fop/layoutmgr/BlockLevelLayoutManager.java index 8f2a4b214..8f2a4b214 100644 --- a/src/java/org/apache/fop/layoutmgr/BlockLevelLayoutManager.java +++ b/src/main/java/org/apache/fop/layoutmgr/BlockLevelLayoutManager.java diff --git a/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java b/src/main/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java index 802960c65..802960c65 100644 --- a/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java +++ b/src/main/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java diff --git a/src/java/org/apache/fop/layoutmgr/BorderElement.java b/src/main/java/org/apache/fop/layoutmgr/BorderElement.java index 67026a4c0..67026a4c0 100644 --- a/src/java/org/apache/fop/layoutmgr/BorderElement.java +++ b/src/main/java/org/apache/fop/layoutmgr/BorderElement.java diff --git a/src/java/org/apache/fop/layoutmgr/BorderOrPaddingElement.java b/src/main/java/org/apache/fop/layoutmgr/BorderOrPaddingElement.java index 5236c9234..5236c9234 100644 --- a/src/java/org/apache/fop/layoutmgr/BorderOrPaddingElement.java +++ b/src/main/java/org/apache/fop/layoutmgr/BorderOrPaddingElement.java diff --git a/src/java/org/apache/fop/layoutmgr/BreakElement.java b/src/main/java/org/apache/fop/layoutmgr/BreakElement.java index f3f173d8c..f3f173d8c 100644 --- a/src/java/org/apache/fop/layoutmgr/BreakElement.java +++ b/src/main/java/org/apache/fop/layoutmgr/BreakElement.java diff --git a/src/java/org/apache/fop/layoutmgr/BreakOpportunity.java b/src/main/java/org/apache/fop/layoutmgr/BreakOpportunity.java index 668f112c9..668f112c9 100644 --- a/src/java/org/apache/fop/layoutmgr/BreakOpportunity.java +++ b/src/main/java/org/apache/fop/layoutmgr/BreakOpportunity.java diff --git a/src/java/org/apache/fop/layoutmgr/BreakOpportunityHelper.java b/src/main/java/org/apache/fop/layoutmgr/BreakOpportunityHelper.java index a3992567f..a3992567f 100644 --- a/src/java/org/apache/fop/layoutmgr/BreakOpportunityHelper.java +++ b/src/main/java/org/apache/fop/layoutmgr/BreakOpportunityHelper.java diff --git a/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java b/src/main/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java index e060226c4..e060226c4 100644 --- a/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java +++ b/src/main/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java diff --git a/src/java/org/apache/fop/layoutmgr/ConditionalElementListener.java b/src/main/java/org/apache/fop/layoutmgr/ConditionalElementListener.java index 9124cf997..9124cf997 100644 --- a/src/java/org/apache/fop/layoutmgr/ConditionalElementListener.java +++ b/src/main/java/org/apache/fop/layoutmgr/ConditionalElementListener.java diff --git a/src/java/org/apache/fop/layoutmgr/ElementListObserver.java b/src/main/java/org/apache/fop/layoutmgr/ElementListObserver.java index 17cdd1462..17cdd1462 100644 --- a/src/java/org/apache/fop/layoutmgr/ElementListObserver.java +++ b/src/main/java/org/apache/fop/layoutmgr/ElementListObserver.java diff --git a/src/java/org/apache/fop/layoutmgr/ElementListUtils.java b/src/main/java/org/apache/fop/layoutmgr/ElementListUtils.java index e0f2daea0..e0f2daea0 100644 --- a/src/java/org/apache/fop/layoutmgr/ElementListUtils.java +++ b/src/main/java/org/apache/fop/layoutmgr/ElementListUtils.java diff --git a/src/java/org/apache/fop/layoutmgr/ExternalDocumentLayoutManager.java b/src/main/java/org/apache/fop/layoutmgr/ExternalDocumentLayoutManager.java index aae5a6b30..aae5a6b30 100644 --- a/src/java/org/apache/fop/layoutmgr/ExternalDocumentLayoutManager.java +++ b/src/main/java/org/apache/fop/layoutmgr/ExternalDocumentLayoutManager.java diff --git a/src/java/org/apache/fop/layoutmgr/FloatContentLayoutManager.java b/src/main/java/org/apache/fop/layoutmgr/FloatContentLayoutManager.java index 6c66646b0..6c66646b0 100644 --- a/src/java/org/apache/fop/layoutmgr/FloatContentLayoutManager.java +++ b/src/main/java/org/apache/fop/layoutmgr/FloatContentLayoutManager.java diff --git a/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java b/src/main/java/org/apache/fop/layoutmgr/FlowLayoutManager.java index 99f6367a3..99f6367a3 100644 --- a/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java +++ b/src/main/java/org/apache/fop/layoutmgr/FlowLayoutManager.java diff --git a/src/java/org/apache/fop/layoutmgr/FootenoteUtil.java b/src/main/java/org/apache/fop/layoutmgr/FootenoteUtil.java index 665756d38..665756d38 100644 --- a/src/java/org/apache/fop/layoutmgr/FootenoteUtil.java +++ b/src/main/java/org/apache/fop/layoutmgr/FootenoteUtil.java diff --git a/src/java/org/apache/fop/layoutmgr/FootnoteBodyLayoutManager.java b/src/main/java/org/apache/fop/layoutmgr/FootnoteBodyLayoutManager.java index 78156d37d..78156d37d 100644 --- a/src/java/org/apache/fop/layoutmgr/FootnoteBodyLayoutManager.java +++ b/src/main/java/org/apache/fop/layoutmgr/FootnoteBodyLayoutManager.java diff --git a/src/java/org/apache/fop/layoutmgr/InlineKnuthSequence.java b/src/main/java/org/apache/fop/layoutmgr/InlineKnuthSequence.java index 1b38b9d8f..1b38b9d8f 100644 --- a/src/java/org/apache/fop/layoutmgr/InlineKnuthSequence.java +++ b/src/main/java/org/apache/fop/layoutmgr/InlineKnuthSequence.java diff --git a/src/java/org/apache/fop/layoutmgr/Keep.java b/src/main/java/org/apache/fop/layoutmgr/Keep.java index c53c5e41a..c53c5e41a 100644 --- a/src/java/org/apache/fop/layoutmgr/Keep.java +++ b/src/main/java/org/apache/fop/layoutmgr/Keep.java diff --git a/src/java/org/apache/fop/layoutmgr/KnuthBlockBox.java b/src/main/java/org/apache/fop/layoutmgr/KnuthBlockBox.java index 92ae1aacf..92ae1aacf 100644 --- a/src/java/org/apache/fop/layoutmgr/KnuthBlockBox.java +++ b/src/main/java/org/apache/fop/layoutmgr/KnuthBlockBox.java diff --git a/src/java/org/apache/fop/layoutmgr/KnuthBox.java b/src/main/java/org/apache/fop/layoutmgr/KnuthBox.java index a1d8c095c..a1d8c095c 100644 --- a/src/java/org/apache/fop/layoutmgr/KnuthBox.java +++ b/src/main/java/org/apache/fop/layoutmgr/KnuthBox.java diff --git a/src/java/org/apache/fop/layoutmgr/KnuthElement.java b/src/main/java/org/apache/fop/layoutmgr/KnuthElement.java index acd95a7d6..acd95a7d6 100644 --- a/src/java/org/apache/fop/layoutmgr/KnuthElement.java +++ b/src/main/java/org/apache/fop/layoutmgr/KnuthElement.java diff --git a/src/java/org/apache/fop/layoutmgr/KnuthGlue.java b/src/main/java/org/apache/fop/layoutmgr/KnuthGlue.java index 2b89c10d4..2b89c10d4 100644 --- a/src/java/org/apache/fop/layoutmgr/KnuthGlue.java +++ b/src/main/java/org/apache/fop/layoutmgr/KnuthGlue.java diff --git a/src/java/org/apache/fop/layoutmgr/KnuthPenalty.java b/src/main/java/org/apache/fop/layoutmgr/KnuthPenalty.java index 220f9c35d..220f9c35d 100644 --- a/src/java/org/apache/fop/layoutmgr/KnuthPenalty.java +++ b/src/main/java/org/apache/fop/layoutmgr/KnuthPenalty.java diff --git a/src/java/org/apache/fop/layoutmgr/KnuthPossPosIter.java b/src/main/java/org/apache/fop/layoutmgr/KnuthPossPosIter.java index 71790ec82..71790ec82 100644 --- a/src/java/org/apache/fop/layoutmgr/KnuthPossPosIter.java +++ b/src/main/java/org/apache/fop/layoutmgr/KnuthPossPosIter.java diff --git a/src/java/org/apache/fop/layoutmgr/KnuthSequence.java b/src/main/java/org/apache/fop/layoutmgr/KnuthSequence.java index cd37f0d3a..cd37f0d3a 100644 --- a/src/java/org/apache/fop/layoutmgr/KnuthSequence.java +++ b/src/main/java/org/apache/fop/layoutmgr/KnuthSequence.java diff --git a/src/java/org/apache/fop/layoutmgr/LMiter.java b/src/main/java/org/apache/fop/layoutmgr/LMiter.java index 373a61a1c..373a61a1c 100644 --- a/src/java/org/apache/fop/layoutmgr/LMiter.java +++ b/src/main/java/org/apache/fop/layoutmgr/LMiter.java diff --git a/src/java/org/apache/fop/layoutmgr/LayoutContext.java b/src/main/java/org/apache/fop/layoutmgr/LayoutContext.java index bb240e637..bb240e637 100644 --- a/src/java/org/apache/fop/layoutmgr/LayoutContext.java +++ b/src/main/java/org/apache/fop/layoutmgr/LayoutContext.java diff --git a/src/java/org/apache/fop/layoutmgr/LayoutException.java b/src/main/java/org/apache/fop/layoutmgr/LayoutException.java index 0fa96e03f..0fa96e03f 100644 --- a/src/java/org/apache/fop/layoutmgr/LayoutException.java +++ b/src/main/java/org/apache/fop/layoutmgr/LayoutException.java diff --git a/src/java/org/apache/fop/layoutmgr/LayoutManager.java b/src/main/java/org/apache/fop/layoutmgr/LayoutManager.java index 8d1e4001c..8d1e4001c 100644 --- a/src/java/org/apache/fop/layoutmgr/LayoutManager.java +++ b/src/main/java/org/apache/fop/layoutmgr/LayoutManager.java diff --git a/src/java/org/apache/fop/layoutmgr/LayoutManagerMaker.java b/src/main/java/org/apache/fop/layoutmgr/LayoutManagerMaker.java index 789d66eb2..789d66eb2 100644 --- a/src/java/org/apache/fop/layoutmgr/LayoutManagerMaker.java +++ b/src/main/java/org/apache/fop/layoutmgr/LayoutManagerMaker.java diff --git a/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java b/src/main/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java index 7c0f9c999..7c0f9c999 100644 --- a/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java +++ b/src/main/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java diff --git a/src/java/org/apache/fop/layoutmgr/LeafPosition.java b/src/main/java/org/apache/fop/layoutmgr/LeafPosition.java index 61ebfc5e7..61ebfc5e7 100644 --- a/src/java/org/apache/fop/layoutmgr/LeafPosition.java +++ b/src/main/java/org/apache/fop/layoutmgr/LeafPosition.java diff --git a/src/java/org/apache/fop/layoutmgr/ListElement.java b/src/main/java/org/apache/fop/layoutmgr/ListElement.java index 74d8a666b..74d8a666b 100644 --- a/src/java/org/apache/fop/layoutmgr/ListElement.java +++ b/src/main/java/org/apache/fop/layoutmgr/ListElement.java diff --git a/src/java/org/apache/fop/layoutmgr/LocalBreaker.java b/src/main/java/org/apache/fop/layoutmgr/LocalBreaker.java index f5882f119..f5882f119 100644 --- a/src/java/org/apache/fop/layoutmgr/LocalBreaker.java +++ b/src/main/java/org/apache/fop/layoutmgr/LocalBreaker.java diff --git a/src/java/org/apache/fop/layoutmgr/MultiCaseLayoutManager.java b/src/main/java/org/apache/fop/layoutmgr/MultiCaseLayoutManager.java index 9469a2fb8..9469a2fb8 100644 --- a/src/java/org/apache/fop/layoutmgr/MultiCaseLayoutManager.java +++ b/src/main/java/org/apache/fop/layoutmgr/MultiCaseLayoutManager.java diff --git a/src/java/org/apache/fop/layoutmgr/MultiSwitchLayoutManager.java b/src/main/java/org/apache/fop/layoutmgr/MultiSwitchLayoutManager.java index 2bef1a815..2bef1a815 100644 --- a/src/java/org/apache/fop/layoutmgr/MultiSwitchLayoutManager.java +++ b/src/main/java/org/apache/fop/layoutmgr/MultiSwitchLayoutManager.java diff --git a/src/java/org/apache/fop/layoutmgr/NonLeafPosition.java b/src/main/java/org/apache/fop/layoutmgr/NonLeafPosition.java index 42908262f..42908262f 100644 --- a/src/java/org/apache/fop/layoutmgr/NonLeafPosition.java +++ b/src/main/java/org/apache/fop/layoutmgr/NonLeafPosition.java diff --git a/src/java/org/apache/fop/layoutmgr/PaddingElement.java b/src/main/java/org/apache/fop/layoutmgr/PaddingElement.java index 3ec0c5054..3ec0c5054 100644 --- a/src/java/org/apache/fop/layoutmgr/PaddingElement.java +++ b/src/main/java/org/apache/fop/layoutmgr/PaddingElement.java diff --git a/src/java/org/apache/fop/layoutmgr/Page.java b/src/main/java/org/apache/fop/layoutmgr/Page.java index d8ec66e82..d8ec66e82 100644 --- a/src/java/org/apache/fop/layoutmgr/Page.java +++ b/src/main/java/org/apache/fop/layoutmgr/Page.java diff --git a/src/java/org/apache/fop/layoutmgr/PageBreaker.java b/src/main/java/org/apache/fop/layoutmgr/PageBreaker.java index 8cc9db790..8cc9db790 100644 --- a/src/java/org/apache/fop/layoutmgr/PageBreaker.java +++ b/src/main/java/org/apache/fop/layoutmgr/PageBreaker.java diff --git a/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java b/src/main/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java index b72124c77..b72124c77 100644 --- a/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java +++ b/src/main/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java diff --git a/src/java/org/apache/fop/layoutmgr/PageProvider.java b/src/main/java/org/apache/fop/layoutmgr/PageProvider.java index ca41c8c1e..ca41c8c1e 100644 --- a/src/java/org/apache/fop/layoutmgr/PageProvider.java +++ b/src/main/java/org/apache/fop/layoutmgr/PageProvider.java diff --git a/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java b/src/main/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java index 0ee7121af..0ee7121af 100644 --- a/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java +++ b/src/main/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java diff --git a/src/java/org/apache/fop/layoutmgr/Position.java b/src/main/java/org/apache/fop/layoutmgr/Position.java index 8230e64f0..8230e64f0 100644 --- a/src/java/org/apache/fop/layoutmgr/Position.java +++ b/src/main/java/org/apache/fop/layoutmgr/Position.java diff --git a/src/java/org/apache/fop/layoutmgr/PositionIterator.java b/src/main/java/org/apache/fop/layoutmgr/PositionIterator.java index b2bf404ff..b2bf404ff 100644 --- a/src/java/org/apache/fop/layoutmgr/PositionIterator.java +++ b/src/main/java/org/apache/fop/layoutmgr/PositionIterator.java diff --git a/src/java/org/apache/fop/layoutmgr/RelSide.java b/src/main/java/org/apache/fop/layoutmgr/RelSide.java index 38e4ab9ec..38e4ab9ec 100644 --- a/src/java/org/apache/fop/layoutmgr/RelSide.java +++ b/src/main/java/org/apache/fop/layoutmgr/RelSide.java diff --git a/src/java/org/apache/fop/layoutmgr/RetrieveTableMarkerLayoutManager.java b/src/main/java/org/apache/fop/layoutmgr/RetrieveTableMarkerLayoutManager.java index 9d0979a29..9d0979a29 100644 --- a/src/java/org/apache/fop/layoutmgr/RetrieveTableMarkerLayoutManager.java +++ b/src/main/java/org/apache/fop/layoutmgr/RetrieveTableMarkerLayoutManager.java diff --git a/src/java/org/apache/fop/layoutmgr/SpaceElement.java b/src/main/java/org/apache/fop/layoutmgr/SpaceElement.java index 6590d3a2a..6590d3a2a 100644 --- a/src/java/org/apache/fop/layoutmgr/SpaceElement.java +++ b/src/main/java/org/apache/fop/layoutmgr/SpaceElement.java diff --git a/src/java/org/apache/fop/layoutmgr/SpaceResolver.java b/src/main/java/org/apache/fop/layoutmgr/SpaceResolver.java index 551e7d3f2..551e7d3f2 100644 --- a/src/java/org/apache/fop/layoutmgr/SpaceResolver.java +++ b/src/main/java/org/apache/fop/layoutmgr/SpaceResolver.java diff --git a/src/java/org/apache/fop/layoutmgr/SpaceSpecifier.java b/src/main/java/org/apache/fop/layoutmgr/SpaceSpecifier.java index dd525e16f..dd525e16f 100644 --- a/src/java/org/apache/fop/layoutmgr/SpaceSpecifier.java +++ b/src/main/java/org/apache/fop/layoutmgr/SpaceSpecifier.java diff --git a/src/java/org/apache/fop/layoutmgr/SpacedBorderedPaddedBlockLayoutManager.java b/src/main/java/org/apache/fop/layoutmgr/SpacedBorderedPaddedBlockLayoutManager.java index 2ac41e96a..2ac41e96a 100644 --- a/src/java/org/apache/fop/layoutmgr/SpacedBorderedPaddedBlockLayoutManager.java +++ b/src/main/java/org/apache/fop/layoutmgr/SpacedBorderedPaddedBlockLayoutManager.java diff --git a/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java b/src/main/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java index 83fa63151..83fa63151 100644 --- a/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java +++ b/src/main/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java diff --git a/src/java/org/apache/fop/layoutmgr/TopLevelLayoutManager.java b/src/main/java/org/apache/fop/layoutmgr/TopLevelLayoutManager.java index f13c7b2c1..f13c7b2c1 100644 --- a/src/java/org/apache/fop/layoutmgr/TopLevelLayoutManager.java +++ b/src/main/java/org/apache/fop/layoutmgr/TopLevelLayoutManager.java diff --git a/src/java/org/apache/fop/layoutmgr/TraitSetter.java b/src/main/java/org/apache/fop/layoutmgr/TraitSetter.java index 0ff0badc8..0ff0badc8 100644 --- a/src/java/org/apache/fop/layoutmgr/TraitSetter.java +++ b/src/main/java/org/apache/fop/layoutmgr/TraitSetter.java diff --git a/src/java/org/apache/fop/layoutmgr/UnresolvedListElement.java b/src/main/java/org/apache/fop/layoutmgr/UnresolvedListElement.java index 89baca9c6..89baca9c6 100644 --- a/src/java/org/apache/fop/layoutmgr/UnresolvedListElement.java +++ b/src/main/java/org/apache/fop/layoutmgr/UnresolvedListElement.java diff --git a/src/java/org/apache/fop/layoutmgr/UnresolvedListElementWithLength.java b/src/main/java/org/apache/fop/layoutmgr/UnresolvedListElementWithLength.java index ef4a366eb..ef4a366eb 100644 --- a/src/java/org/apache/fop/layoutmgr/UnresolvedListElementWithLength.java +++ b/src/main/java/org/apache/fop/layoutmgr/UnresolvedListElementWithLength.java diff --git a/src/java/org/apache/fop/layoutmgr/WhitespaceManagementPenalty.java b/src/main/java/org/apache/fop/layoutmgr/WhitespaceManagementPenalty.java index e34d24b9a..e34d24b9a 100644 --- a/src/java/org/apache/fop/layoutmgr/WhitespaceManagementPenalty.java +++ b/src/main/java/org/apache/fop/layoutmgr/WhitespaceManagementPenalty.java diff --git a/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java b/src/main/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java index 8afec46e1..8afec46e1 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java +++ b/src/main/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java diff --git a/src/java/org/apache/fop/layoutmgr/inline/AbstractPageNumberCitationLayoutManager.java b/src/main/java/org/apache/fop/layoutmgr/inline/AbstractPageNumberCitationLayoutManager.java index ee4143982..ee4143982 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/AbstractPageNumberCitationLayoutManager.java +++ b/src/main/java/org/apache/fop/layoutmgr/inline/AbstractPageNumberCitationLayoutManager.java diff --git a/src/java/org/apache/fop/layoutmgr/inline/AlignmentContext.java b/src/main/java/org/apache/fop/layoutmgr/inline/AlignmentContext.java index 931938697..931938697 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/AlignmentContext.java +++ b/src/main/java/org/apache/fop/layoutmgr/inline/AlignmentContext.java diff --git a/src/java/org/apache/fop/layoutmgr/inline/BasicLinkLayoutManager.java b/src/main/java/org/apache/fop/layoutmgr/inline/BasicLinkLayoutManager.java index 3a630f9be..3a630f9be 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/BasicLinkLayoutManager.java +++ b/src/main/java/org/apache/fop/layoutmgr/inline/BasicLinkLayoutManager.java diff --git a/src/java/org/apache/fop/layoutmgr/inline/BidiLayoutManager.java b/src/main/java/org/apache/fop/layoutmgr/inline/BidiLayoutManager.java index b6145f025..b6145f025 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/BidiLayoutManager.java +++ b/src/main/java/org/apache/fop/layoutmgr/inline/BidiLayoutManager.java diff --git a/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java b/src/main/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java index c959ee7be..c959ee7be 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java +++ b/src/main/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java diff --git a/src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java b/src/main/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java index 83b9502f2..83b9502f2 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java +++ b/src/main/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java diff --git a/src/java/org/apache/fop/layoutmgr/inline/ExternalGraphicLayoutManager.java b/src/main/java/org/apache/fop/layoutmgr/inline/ExternalGraphicLayoutManager.java index 2719d5c96..2719d5c96 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/ExternalGraphicLayoutManager.java +++ b/src/main/java/org/apache/fop/layoutmgr/inline/ExternalGraphicLayoutManager.java diff --git a/src/java/org/apache/fop/layoutmgr/inline/FloatLayoutManager.java b/src/main/java/org/apache/fop/layoutmgr/inline/FloatLayoutManager.java index 4bb481dcd..4bb481dcd 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/FloatLayoutManager.java +++ b/src/main/java/org/apache/fop/layoutmgr/inline/FloatLayoutManager.java diff --git a/src/java/org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java b/src/main/java/org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java index 50b88b5b9..50b88b5b9 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java +++ b/src/main/java/org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java diff --git a/src/java/org/apache/fop/layoutmgr/inline/HyphContext.java b/src/main/java/org/apache/fop/layoutmgr/inline/HyphContext.java index fcbde26e5..fcbde26e5 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/HyphContext.java +++ b/src/main/java/org/apache/fop/layoutmgr/inline/HyphContext.java diff --git a/src/java/org/apache/fop/layoutmgr/inline/ImageLayout.java b/src/main/java/org/apache/fop/layoutmgr/inline/ImageLayout.java index 8a25dc62b..8a25dc62b 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/ImageLayout.java +++ b/src/main/java/org/apache/fop/layoutmgr/inline/ImageLayout.java diff --git a/src/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java b/src/main/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java index 54237a914..54237a914 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java +++ b/src/main/java/org/apache/fop/layoutmgr/inline/InlineContainerLayoutManager.java diff --git a/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java b/src/main/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java index 0a0658b4d..0a0658b4d 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java +++ b/src/main/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java diff --git a/src/java/org/apache/fop/layoutmgr/inline/InlineLevelEventProducer.java b/src/main/java/org/apache/fop/layoutmgr/inline/InlineLevelEventProducer.java index f0b43e672..f0b43e672 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/InlineLevelEventProducer.java +++ b/src/main/java/org/apache/fop/layoutmgr/inline/InlineLevelEventProducer.java diff --git a/src/java/org/apache/fop/layoutmgr/inline/InlineLevelEventProducer.xml b/src/main/java/org/apache/fop/layoutmgr/inline/InlineLevelEventProducer.xml index 8d699f6bc..8d699f6bc 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/InlineLevelEventProducer.xml +++ b/src/main/java/org/apache/fop/layoutmgr/inline/InlineLevelEventProducer.xml diff --git a/src/java/org/apache/fop/layoutmgr/inline/InlineLevelLayoutManager.java b/src/main/java/org/apache/fop/layoutmgr/inline/InlineLevelLayoutManager.java index ac829a2fc..ac829a2fc 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/InlineLevelLayoutManager.java +++ b/src/main/java/org/apache/fop/layoutmgr/inline/InlineLevelLayoutManager.java diff --git a/src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java b/src/main/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java index 5e3820a4b..5e3820a4b 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java +++ b/src/main/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java diff --git a/src/java/org/apache/fop/layoutmgr/inline/InstreamForeignObjectLM.java b/src/main/java/org/apache/fop/layoutmgr/inline/InstreamForeignObjectLM.java index 4a54f582d..4a54f582d 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/InstreamForeignObjectLM.java +++ b/src/main/java/org/apache/fop/layoutmgr/inline/InstreamForeignObjectLM.java diff --git a/src/java/org/apache/fop/layoutmgr/inline/KnuthInlineBox.java b/src/main/java/org/apache/fop/layoutmgr/inline/KnuthInlineBox.java index dad6d283c..dad6d283c 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/KnuthInlineBox.java +++ b/src/main/java/org/apache/fop/layoutmgr/inline/KnuthInlineBox.java diff --git a/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java b/src/main/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java index 5f65a5969..5f65a5969 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java +++ b/src/main/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java diff --git a/src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java b/src/main/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java index ae337b0d0..ae337b0d0 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java +++ b/src/main/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java diff --git a/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java b/src/main/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java index 075199e5e..075199e5e 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java +++ b/src/main/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java diff --git a/src/java/org/apache/fop/layoutmgr/inline/LineLayoutPossibilities.java b/src/main/java/org/apache/fop/layoutmgr/inline/LineLayoutPossibilities.java index 54ca3e54f..54ca3e54f 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/LineLayoutPossibilities.java +++ b/src/main/java/org/apache/fop/layoutmgr/inline/LineLayoutPossibilities.java diff --git a/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLastLayoutManager.java b/src/main/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLastLayoutManager.java index c082bc41f..c082bc41f 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLastLayoutManager.java +++ b/src/main/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLastLayoutManager.java diff --git a/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLayoutManager.java b/src/main/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLayoutManager.java index 556c2f575..556c2f575 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLayoutManager.java +++ b/src/main/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLayoutManager.java diff --git a/src/java/org/apache/fop/layoutmgr/inline/PageNumberLayoutManager.java b/src/main/java/org/apache/fop/layoutmgr/inline/PageNumberLayoutManager.java index 7881283c0..7881283c0 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/PageNumberLayoutManager.java +++ b/src/main/java/org/apache/fop/layoutmgr/inline/PageNumberLayoutManager.java diff --git a/src/java/org/apache/fop/layoutmgr/inline/ScaledBaselineTable.java b/src/main/java/org/apache/fop/layoutmgr/inline/ScaledBaselineTable.java index 1ccba23d7..1ccba23d7 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/ScaledBaselineTable.java +++ b/src/main/java/org/apache/fop/layoutmgr/inline/ScaledBaselineTable.java diff --git a/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java b/src/main/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java index 638460866..638460866 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java +++ b/src/main/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java diff --git a/src/java/org/apache/fop/layoutmgr/inline/WrapperLayoutManager.java b/src/main/java/org/apache/fop/layoutmgr/inline/WrapperLayoutManager.java index 9b37e2405..9b37e2405 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/WrapperLayoutManager.java +++ b/src/main/java/org/apache/fop/layoutmgr/inline/WrapperLayoutManager.java diff --git a/src/java/org/apache/fop/layoutmgr/inline/package.html b/src/main/java/org/apache/fop/layoutmgr/inline/package.html index 9a894795b..9a894795b 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/package.html +++ b/src/main/java/org/apache/fop/layoutmgr/inline/package.html diff --git a/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java b/src/main/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java index d39b63477..d39b63477 100644 --- a/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java +++ b/src/main/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java diff --git a/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java b/src/main/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java index 214ba6269..214ba6269 100644 --- a/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java +++ b/src/main/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java diff --git a/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java b/src/main/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java index 46a93b3f5..46a93b3f5 100644 --- a/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java +++ b/src/main/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java diff --git a/src/java/org/apache/fop/layoutmgr/list/package.html b/src/main/java/org/apache/fop/layoutmgr/list/package.html index 1f70f4bef..1f70f4bef 100644 --- a/src/java/org/apache/fop/layoutmgr/list/package.html +++ b/src/main/java/org/apache/fop/layoutmgr/list/package.html diff --git a/src/java/org/apache/fop/layoutmgr/package.html b/src/main/java/org/apache/fop/layoutmgr/package.html index 90de46bd8..90de46bd8 100644 --- a/src/java/org/apache/fop/layoutmgr/package.html +++ b/src/main/java/org/apache/fop/layoutmgr/package.html diff --git a/src/java/org/apache/fop/layoutmgr/table/ActiveCell.java b/src/main/java/org/apache/fop/layoutmgr/table/ActiveCell.java index 81841b246..81841b246 100644 --- a/src/java/org/apache/fop/layoutmgr/table/ActiveCell.java +++ b/src/main/java/org/apache/fop/layoutmgr/table/ActiveCell.java diff --git a/src/java/org/apache/fop/layoutmgr/table/CellPart.java b/src/main/java/org/apache/fop/layoutmgr/table/CellPart.java index 7dd2bc201..7dd2bc201 100644 --- a/src/java/org/apache/fop/layoutmgr/table/CellPart.java +++ b/src/main/java/org/apache/fop/layoutmgr/table/CellPart.java diff --git a/src/java/org/apache/fop/layoutmgr/table/CollapsingBorderModel.java b/src/main/java/org/apache/fop/layoutmgr/table/CollapsingBorderModel.java index 28cd073e8..28cd073e8 100644 --- a/src/java/org/apache/fop/layoutmgr/table/CollapsingBorderModel.java +++ b/src/main/java/org/apache/fop/layoutmgr/table/CollapsingBorderModel.java diff --git a/src/java/org/apache/fop/layoutmgr/table/CollapsingBorderModelEyeCatching.java b/src/main/java/org/apache/fop/layoutmgr/table/CollapsingBorderModelEyeCatching.java index 7aed158de..7aed158de 100644 --- a/src/java/org/apache/fop/layoutmgr/table/CollapsingBorderModelEyeCatching.java +++ b/src/main/java/org/apache/fop/layoutmgr/table/CollapsingBorderModelEyeCatching.java diff --git a/src/java/org/apache/fop/layoutmgr/table/ColumnSetup.java b/src/main/java/org/apache/fop/layoutmgr/table/ColumnSetup.java index 8fae90849..8fae90849 100644 --- a/src/java/org/apache/fop/layoutmgr/table/ColumnSetup.java +++ b/src/main/java/org/apache/fop/layoutmgr/table/ColumnSetup.java diff --git a/src/java/org/apache/fop/layoutmgr/table/RowGroupLayoutManager.java b/src/main/java/org/apache/fop/layoutmgr/table/RowGroupLayoutManager.java index ed46d2199..ed46d2199 100644 --- a/src/java/org/apache/fop/layoutmgr/table/RowGroupLayoutManager.java +++ b/src/main/java/org/apache/fop/layoutmgr/table/RowGroupLayoutManager.java diff --git a/src/java/org/apache/fop/layoutmgr/table/RowPainter.java b/src/main/java/org/apache/fop/layoutmgr/table/RowPainter.java index 40edca6f7..40edca6f7 100644 --- a/src/java/org/apache/fop/layoutmgr/table/RowPainter.java +++ b/src/main/java/org/apache/fop/layoutmgr/table/RowPainter.java diff --git a/src/java/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java b/src/main/java/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java index aaa896ce3..aaa896ce3 100644 --- a/src/java/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java +++ b/src/main/java/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java diff --git a/src/java/org/apache/fop/layoutmgr/table/TableCaptionLayoutManager.java b/src/main/java/org/apache/fop/layoutmgr/table/TableCaptionLayoutManager.java index 8823c0fae..8823c0fae 100644 --- a/src/java/org/apache/fop/layoutmgr/table/TableCaptionLayoutManager.java +++ b/src/main/java/org/apache/fop/layoutmgr/table/TableCaptionLayoutManager.java diff --git a/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java b/src/main/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java index e667049fa..e667049fa 100644 --- a/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java +++ b/src/main/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java diff --git a/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java b/src/main/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java index eb82a0538..eb82a0538 100644 --- a/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java +++ b/src/main/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java diff --git a/src/java/org/apache/fop/layoutmgr/table/TableContentPosition.java b/src/main/java/org/apache/fop/layoutmgr/table/TableContentPosition.java index e6dc5b22d..e6dc5b22d 100644 --- a/src/java/org/apache/fop/layoutmgr/table/TableContentPosition.java +++ b/src/main/java/org/apache/fop/layoutmgr/table/TableContentPosition.java diff --git a/src/java/org/apache/fop/layoutmgr/table/TableHFPenaltyPosition.java b/src/main/java/org/apache/fop/layoutmgr/table/TableHFPenaltyPosition.java index 3e504a45c..3e504a45c 100644 --- a/src/java/org/apache/fop/layoutmgr/table/TableHFPenaltyPosition.java +++ b/src/main/java/org/apache/fop/layoutmgr/table/TableHFPenaltyPosition.java diff --git a/src/java/org/apache/fop/layoutmgr/table/TableHeaderFooterPosition.java b/src/main/java/org/apache/fop/layoutmgr/table/TableHeaderFooterPosition.java index 8d3b993b2..8d3b993b2 100644 --- a/src/java/org/apache/fop/layoutmgr/table/TableHeaderFooterPosition.java +++ b/src/main/java/org/apache/fop/layoutmgr/table/TableHeaderFooterPosition.java diff --git a/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java b/src/main/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java index ea6cb2b22..ea6cb2b22 100644 --- a/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java +++ b/src/main/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java diff --git a/src/java/org/apache/fop/layoutmgr/table/TableRowIterator.java b/src/main/java/org/apache/fop/layoutmgr/table/TableRowIterator.java index c51c86997..c51c86997 100644 --- a/src/java/org/apache/fop/layoutmgr/table/TableRowIterator.java +++ b/src/main/java/org/apache/fop/layoutmgr/table/TableRowIterator.java diff --git a/src/java/org/apache/fop/layoutmgr/table/TableStepper.java b/src/main/java/org/apache/fop/layoutmgr/table/TableStepper.java index 7c98bd481..7c98bd481 100644 --- a/src/java/org/apache/fop/layoutmgr/table/TableStepper.java +++ b/src/main/java/org/apache/fop/layoutmgr/table/TableStepper.java diff --git a/src/java/org/apache/fop/layoutmgr/table/package.html b/src/main/java/org/apache/fop/layoutmgr/table/package.html index 1d3093e7f..1d3093e7f 100644 --- a/src/java/org/apache/fop/layoutmgr/table/package.html +++ b/src/main/java/org/apache/fop/layoutmgr/table/package.html diff --git a/src/java/org/apache/fop/overview.html b/src/main/java/org/apache/fop/overview.html index 0b1b58ce4..0b1b58ce4 100644 --- a/src/java/org/apache/fop/overview.html +++ b/src/main/java/org/apache/fop/overview.html diff --git a/src/java/org/apache/fop/pdf/ASCII85Filter.java b/src/main/java/org/apache/fop/pdf/ASCII85Filter.java index 7a86f57ee..7a86f57ee 100644 --- a/src/java/org/apache/fop/pdf/ASCII85Filter.java +++ b/src/main/java/org/apache/fop/pdf/ASCII85Filter.java diff --git a/src/java/org/apache/fop/pdf/ASCIIHexFilter.java b/src/main/java/org/apache/fop/pdf/ASCIIHexFilter.java index 3456cf1ae..3456cf1ae 100644 --- a/src/java/org/apache/fop/pdf/ASCIIHexFilter.java +++ b/src/main/java/org/apache/fop/pdf/ASCIIHexFilter.java diff --git a/src/java/org/apache/fop/pdf/AbstractPDFFontStream.java b/src/main/java/org/apache/fop/pdf/AbstractPDFFontStream.java index 34c9c5dee..34c9c5dee 100644 --- a/src/java/org/apache/fop/pdf/AbstractPDFFontStream.java +++ b/src/main/java/org/apache/fop/pdf/AbstractPDFFontStream.java diff --git a/src/java/org/apache/fop/pdf/AbstractPDFStream.java b/src/main/java/org/apache/fop/pdf/AbstractPDFStream.java index 67cb7b097..67cb7b097 100644 --- a/src/java/org/apache/fop/pdf/AbstractPDFStream.java +++ b/src/main/java/org/apache/fop/pdf/AbstractPDFStream.java diff --git a/src/java/org/apache/fop/pdf/AlphaRasterImage.java b/src/main/java/org/apache/fop/pdf/AlphaRasterImage.java index 250b5daa2..250b5daa2 100644 --- a/src/java/org/apache/fop/pdf/AlphaRasterImage.java +++ b/src/main/java/org/apache/fop/pdf/AlphaRasterImage.java diff --git a/src/java/org/apache/fop/pdf/BitmapImage.java b/src/main/java/org/apache/fop/pdf/BitmapImage.java index de6997f95..de6997f95 100644 --- a/src/java/org/apache/fop/pdf/BitmapImage.java +++ b/src/main/java/org/apache/fop/pdf/BitmapImage.java diff --git a/src/java/org/apache/fop/pdf/CCFFilter.java b/src/main/java/org/apache/fop/pdf/CCFFilter.java index 117070bb1..117070bb1 100644 --- a/src/java/org/apache/fop/pdf/CCFFilter.java +++ b/src/main/java/org/apache/fop/pdf/CCFFilter.java diff --git a/src/java/org/apache/fop/pdf/CMapBuilder.java b/src/main/java/org/apache/fop/pdf/CMapBuilder.java index 61c5330e9..61c5330e9 100644 --- a/src/java/org/apache/fop/pdf/CMapBuilder.java +++ b/src/main/java/org/apache/fop/pdf/CMapBuilder.java diff --git a/src/java/org/apache/fop/pdf/CompressedObject.java b/src/main/java/org/apache/fop/pdf/CompressedObject.java index 270e672c1..270e672c1 100644 --- a/src/java/org/apache/fop/pdf/CompressedObject.java +++ b/src/main/java/org/apache/fop/pdf/CompressedObject.java diff --git a/src/java/org/apache/fop/pdf/DCTFilter.java b/src/main/java/org/apache/fop/pdf/DCTFilter.java index c25227d3a..c25227d3a 100644 --- a/src/java/org/apache/fop/pdf/DCTFilter.java +++ b/src/main/java/org/apache/fop/pdf/DCTFilter.java diff --git a/src/java/org/apache/fop/pdf/DestinationComparator.java b/src/main/java/org/apache/fop/pdf/DestinationComparator.java index 6e193dc3d..6e193dc3d 100644 --- a/src/java/org/apache/fop/pdf/DestinationComparator.java +++ b/src/main/java/org/apache/fop/pdf/DestinationComparator.java diff --git a/src/java/org/apache/fop/pdf/FileIDGenerator.java b/src/main/java/org/apache/fop/pdf/FileIDGenerator.java index 00aad4426..00aad4426 100644 --- a/src/java/org/apache/fop/pdf/FileIDGenerator.java +++ b/src/main/java/org/apache/fop/pdf/FileIDGenerator.java diff --git a/src/java/org/apache/fop/pdf/FlateFilter.java b/src/main/java/org/apache/fop/pdf/FlateFilter.java index 62b3d5769..62b3d5769 100644 --- a/src/java/org/apache/fop/pdf/FlateFilter.java +++ b/src/main/java/org/apache/fop/pdf/FlateFilter.java diff --git a/src/java/org/apache/fop/pdf/InMemoryStreamCache.java b/src/main/java/org/apache/fop/pdf/InMemoryStreamCache.java index 85d265e7f..85d265e7f 100644 --- a/src/java/org/apache/fop/pdf/InMemoryStreamCache.java +++ b/src/main/java/org/apache/fop/pdf/InMemoryStreamCache.java diff --git a/src/java/org/apache/fop/pdf/NullFilter.java b/src/main/java/org/apache/fop/pdf/NullFilter.java index f098860c9..f098860c9 100644 --- a/src/java/org/apache/fop/pdf/NullFilter.java +++ b/src/main/java/org/apache/fop/pdf/NullFilter.java diff --git a/src/java/org/apache/fop/pdf/ObjectStream.java b/src/main/java/org/apache/fop/pdf/ObjectStream.java index e9335bc6f..e9335bc6f 100644 --- a/src/java/org/apache/fop/pdf/ObjectStream.java +++ b/src/main/java/org/apache/fop/pdf/ObjectStream.java diff --git a/src/java/org/apache/fop/pdf/ObjectStreamManager.java b/src/main/java/org/apache/fop/pdf/ObjectStreamManager.java index 723facd96..723facd96 100644 --- a/src/java/org/apache/fop/pdf/ObjectStreamManager.java +++ b/src/main/java/org/apache/fop/pdf/ObjectStreamManager.java diff --git a/src/java/org/apache/fop/pdf/PDFAMode.java b/src/main/java/org/apache/fop/pdf/PDFAMode.java index 507b392ed..507b392ed 100644 --- a/src/java/org/apache/fop/pdf/PDFAMode.java +++ b/src/main/java/org/apache/fop/pdf/PDFAMode.java diff --git a/src/java/org/apache/fop/pdf/PDFAction.java b/src/main/java/org/apache/fop/pdf/PDFAction.java index 81b32b97c..81b32b97c 100644 --- a/src/java/org/apache/fop/pdf/PDFAction.java +++ b/src/main/java/org/apache/fop/pdf/PDFAction.java diff --git a/src/java/org/apache/fop/pdf/PDFAnnotList.java b/src/main/java/org/apache/fop/pdf/PDFAnnotList.java index 4259d0e67..4259d0e67 100644 --- a/src/java/org/apache/fop/pdf/PDFAnnotList.java +++ b/src/main/java/org/apache/fop/pdf/PDFAnnotList.java diff --git a/src/java/org/apache/fop/pdf/PDFArray.java b/src/main/java/org/apache/fop/pdf/PDFArray.java index 36ff57799..36ff57799 100644 --- a/src/java/org/apache/fop/pdf/PDFArray.java +++ b/src/main/java/org/apache/fop/pdf/PDFArray.java diff --git a/src/java/org/apache/fop/pdf/PDFCFFStream.java b/src/main/java/org/apache/fop/pdf/PDFCFFStream.java index 4a73c3b4f..4a73c3b4f 100644 --- a/src/java/org/apache/fop/pdf/PDFCFFStream.java +++ b/src/main/java/org/apache/fop/pdf/PDFCFFStream.java diff --git a/src/java/org/apache/fop/pdf/PDFCFFStreamType0C.java b/src/main/java/org/apache/fop/pdf/PDFCFFStreamType0C.java index 53f0b36b4..53f0b36b4 100644 --- a/src/java/org/apache/fop/pdf/PDFCFFStreamType0C.java +++ b/src/main/java/org/apache/fop/pdf/PDFCFFStreamType0C.java diff --git a/src/java/org/apache/fop/pdf/PDFCIDFont.java b/src/main/java/org/apache/fop/pdf/PDFCIDFont.java index 28908c6c3..28908c6c3 100644 --- a/src/java/org/apache/fop/pdf/PDFCIDFont.java +++ b/src/main/java/org/apache/fop/pdf/PDFCIDFont.java diff --git a/src/java/org/apache/fop/pdf/PDFCIDFontDescriptor.java b/src/main/java/org/apache/fop/pdf/PDFCIDFontDescriptor.java index 726e46f23..726e46f23 100644 --- a/src/java/org/apache/fop/pdf/PDFCIDFontDescriptor.java +++ b/src/main/java/org/apache/fop/pdf/PDFCIDFontDescriptor.java diff --git a/src/java/org/apache/fop/pdf/PDFCIDSystemInfo.java b/src/main/java/org/apache/fop/pdf/PDFCIDSystemInfo.java index 7a96930aa..7a96930aa 100644 --- a/src/java/org/apache/fop/pdf/PDFCIDSystemInfo.java +++ b/src/main/java/org/apache/fop/pdf/PDFCIDSystemInfo.java diff --git a/src/java/org/apache/fop/pdf/PDFCIELabColorSpace.java b/src/main/java/org/apache/fop/pdf/PDFCIELabColorSpace.java index 4d1d7f7ff..4d1d7f7ff 100644 --- a/src/java/org/apache/fop/pdf/PDFCIELabColorSpace.java +++ b/src/main/java/org/apache/fop/pdf/PDFCIELabColorSpace.java diff --git a/src/java/org/apache/fop/pdf/PDFCMap.java b/src/main/java/org/apache/fop/pdf/PDFCMap.java index c96cf9d3b..c96cf9d3b 100644 --- a/src/java/org/apache/fop/pdf/PDFCMap.java +++ b/src/main/java/org/apache/fop/pdf/PDFCMap.java diff --git a/src/java/org/apache/fop/pdf/PDFCharProcs.java b/src/main/java/org/apache/fop/pdf/PDFCharProcs.java index 6a423e038..6a423e038 100644 --- a/src/java/org/apache/fop/pdf/PDFCharProcs.java +++ b/src/main/java/org/apache/fop/pdf/PDFCharProcs.java diff --git a/src/java/org/apache/fop/pdf/PDFColor.java b/src/main/java/org/apache/fop/pdf/PDFColor.java index 1fb544368..1fb544368 100644 --- a/src/java/org/apache/fop/pdf/PDFColor.java +++ b/src/main/java/org/apache/fop/pdf/PDFColor.java diff --git a/src/java/org/apache/fop/pdf/PDFColorHandler.java b/src/main/java/org/apache/fop/pdf/PDFColorHandler.java index 3477ea3e7..3477ea3e7 100644 --- a/src/java/org/apache/fop/pdf/PDFColorHandler.java +++ b/src/main/java/org/apache/fop/pdf/PDFColorHandler.java diff --git a/src/java/org/apache/fop/pdf/PDFColorSpace.java b/src/main/java/org/apache/fop/pdf/PDFColorSpace.java index 1d3dd8634..1d3dd8634 100644 --- a/src/java/org/apache/fop/pdf/PDFColorSpace.java +++ b/src/main/java/org/apache/fop/pdf/PDFColorSpace.java diff --git a/src/java/org/apache/fop/pdf/PDFConformanceException.java b/src/main/java/org/apache/fop/pdf/PDFConformanceException.java index 083c11f21..083c11f21 100644 --- a/src/java/org/apache/fop/pdf/PDFConformanceException.java +++ b/src/main/java/org/apache/fop/pdf/PDFConformanceException.java diff --git a/src/java/org/apache/fop/pdf/PDFDPart.java b/src/main/java/org/apache/fop/pdf/PDFDPart.java index bd7262713..bd7262713 100644 --- a/src/java/org/apache/fop/pdf/PDFDPart.java +++ b/src/main/java/org/apache/fop/pdf/PDFDPart.java diff --git a/src/java/org/apache/fop/pdf/PDFDPartRoot.java b/src/main/java/org/apache/fop/pdf/PDFDPartRoot.java index cd1d3b446..cd1d3b446 100644 --- a/src/java/org/apache/fop/pdf/PDFDPartRoot.java +++ b/src/main/java/org/apache/fop/pdf/PDFDPartRoot.java diff --git a/src/java/org/apache/fop/pdf/PDFDestination.java b/src/main/java/org/apache/fop/pdf/PDFDestination.java index 21c655832..21c655832 100644 --- a/src/java/org/apache/fop/pdf/PDFDestination.java +++ b/src/main/java/org/apache/fop/pdf/PDFDestination.java diff --git a/src/java/org/apache/fop/pdf/PDFDests.java b/src/main/java/org/apache/fop/pdf/PDFDests.java index ff2d6a237..ff2d6a237 100644 --- a/src/java/org/apache/fop/pdf/PDFDests.java +++ b/src/main/java/org/apache/fop/pdf/PDFDests.java diff --git a/src/java/org/apache/fop/pdf/PDFDeviceColorSpace.java b/src/main/java/org/apache/fop/pdf/PDFDeviceColorSpace.java index b18c3ac9e..b18c3ac9e 100644 --- a/src/java/org/apache/fop/pdf/PDFDeviceColorSpace.java +++ b/src/main/java/org/apache/fop/pdf/PDFDeviceColorSpace.java diff --git a/src/java/org/apache/fop/pdf/PDFDictionary.java b/src/main/java/org/apache/fop/pdf/PDFDictionary.java index 4ad1c2ce5..4ad1c2ce5 100644 --- a/src/java/org/apache/fop/pdf/PDFDictionary.java +++ b/src/main/java/org/apache/fop/pdf/PDFDictionary.java diff --git a/src/java/org/apache/fop/pdf/PDFDocument.java b/src/main/java/org/apache/fop/pdf/PDFDocument.java index 59ff9c988..59ff9c988 100644 --- a/src/java/org/apache/fop/pdf/PDFDocument.java +++ b/src/main/java/org/apache/fop/pdf/PDFDocument.java diff --git a/src/java/org/apache/fop/pdf/PDFEmbeddedFile.java b/src/main/java/org/apache/fop/pdf/PDFEmbeddedFile.java index ae6893944..ae6893944 100644 --- a/src/java/org/apache/fop/pdf/PDFEmbeddedFile.java +++ b/src/main/java/org/apache/fop/pdf/PDFEmbeddedFile.java diff --git a/src/java/org/apache/fop/pdf/PDFEmbeddedFiles.java b/src/main/java/org/apache/fop/pdf/PDFEmbeddedFiles.java index c4979312e..c4979312e 100644 --- a/src/java/org/apache/fop/pdf/PDFEmbeddedFiles.java +++ b/src/main/java/org/apache/fop/pdf/PDFEmbeddedFiles.java diff --git a/src/java/org/apache/fop/pdf/PDFEncoding.java b/src/main/java/org/apache/fop/pdf/PDFEncoding.java index 64fd6f866..64fd6f866 100644 --- a/src/java/org/apache/fop/pdf/PDFEncoding.java +++ b/src/main/java/org/apache/fop/pdf/PDFEncoding.java diff --git a/src/java/org/apache/fop/pdf/PDFEncryption.java b/src/main/java/org/apache/fop/pdf/PDFEncryption.java index 87b9d2522..87b9d2522 100644 --- a/src/java/org/apache/fop/pdf/PDFEncryption.java +++ b/src/main/java/org/apache/fop/pdf/PDFEncryption.java diff --git a/src/java/org/apache/fop/pdf/PDFEncryptionJCE.java b/src/main/java/org/apache/fop/pdf/PDFEncryptionJCE.java index ff2aac68f..ff2aac68f 100644 --- a/src/java/org/apache/fop/pdf/PDFEncryptionJCE.java +++ b/src/main/java/org/apache/fop/pdf/PDFEncryptionJCE.java diff --git a/src/java/org/apache/fop/pdf/PDFEncryptionManager.java b/src/main/java/org/apache/fop/pdf/PDFEncryptionManager.java index 0bf2ca2e2..0bf2ca2e2 100644 --- a/src/java/org/apache/fop/pdf/PDFEncryptionManager.java +++ b/src/main/java/org/apache/fop/pdf/PDFEncryptionManager.java diff --git a/src/java/org/apache/fop/pdf/PDFEncryptionParams.java b/src/main/java/org/apache/fop/pdf/PDFEncryptionParams.java index a1925b0f4..a1925b0f4 100644 --- a/src/java/org/apache/fop/pdf/PDFEncryptionParams.java +++ b/src/main/java/org/apache/fop/pdf/PDFEncryptionParams.java diff --git a/src/java/org/apache/fop/pdf/PDFFactory.java b/src/main/java/org/apache/fop/pdf/PDFFactory.java index e2c17b4e9..e2c17b4e9 100644 --- a/src/java/org/apache/fop/pdf/PDFFactory.java +++ b/src/main/java/org/apache/fop/pdf/PDFFactory.java diff --git a/src/java/org/apache/fop/pdf/PDFFileSpec.java b/src/main/java/org/apache/fop/pdf/PDFFileSpec.java index b9a46c8b8..b9a46c8b8 100644 --- a/src/java/org/apache/fop/pdf/PDFFileSpec.java +++ b/src/main/java/org/apache/fop/pdf/PDFFileSpec.java diff --git a/src/java/org/apache/fop/pdf/PDFFilter.java b/src/main/java/org/apache/fop/pdf/PDFFilter.java index 98117774d..98117774d 100644 --- a/src/java/org/apache/fop/pdf/PDFFilter.java +++ b/src/main/java/org/apache/fop/pdf/PDFFilter.java diff --git a/src/java/org/apache/fop/pdf/PDFFilterException.java b/src/main/java/org/apache/fop/pdf/PDFFilterException.java index c1da10398..c1da10398 100644 --- a/src/java/org/apache/fop/pdf/PDFFilterException.java +++ b/src/main/java/org/apache/fop/pdf/PDFFilterException.java diff --git a/src/java/org/apache/fop/pdf/PDFFilterList.java b/src/main/java/org/apache/fop/pdf/PDFFilterList.java index 19d15d0d2..19d15d0d2 100644 --- a/src/java/org/apache/fop/pdf/PDFFilterList.java +++ b/src/main/java/org/apache/fop/pdf/PDFFilterList.java diff --git a/src/java/org/apache/fop/pdf/PDFFont.java b/src/main/java/org/apache/fop/pdf/PDFFont.java index dcd69d8bc..dcd69d8bc 100644 --- a/src/java/org/apache/fop/pdf/PDFFont.java +++ b/src/main/java/org/apache/fop/pdf/PDFFont.java diff --git a/src/java/org/apache/fop/pdf/PDFFontDescriptor.java b/src/main/java/org/apache/fop/pdf/PDFFontDescriptor.java index 50bb107e7..50bb107e7 100644 --- a/src/java/org/apache/fop/pdf/PDFFontDescriptor.java +++ b/src/main/java/org/apache/fop/pdf/PDFFontDescriptor.java diff --git a/src/java/org/apache/fop/pdf/PDFFontNonBase14.java b/src/main/java/org/apache/fop/pdf/PDFFontNonBase14.java index faef636f6..faef636f6 100644 --- a/src/java/org/apache/fop/pdf/PDFFontNonBase14.java +++ b/src/main/java/org/apache/fop/pdf/PDFFontNonBase14.java diff --git a/src/java/org/apache/fop/pdf/PDFFontTrueType.java b/src/main/java/org/apache/fop/pdf/PDFFontTrueType.java index 99c9f1c1f..99c9f1c1f 100644 --- a/src/java/org/apache/fop/pdf/PDFFontTrueType.java +++ b/src/main/java/org/apache/fop/pdf/PDFFontTrueType.java diff --git a/src/java/org/apache/fop/pdf/PDFFontType0.java b/src/main/java/org/apache/fop/pdf/PDFFontType0.java index 2f5e037f3..2f5e037f3 100644 --- a/src/java/org/apache/fop/pdf/PDFFontType0.java +++ b/src/main/java/org/apache/fop/pdf/PDFFontType0.java diff --git a/src/java/org/apache/fop/pdf/PDFFontType1.java b/src/main/java/org/apache/fop/pdf/PDFFontType1.java index 884cb3e30..884cb3e30 100644 --- a/src/java/org/apache/fop/pdf/PDFFontType1.java +++ b/src/main/java/org/apache/fop/pdf/PDFFontType1.java diff --git a/src/java/org/apache/fop/pdf/PDFFontType3.java b/src/main/java/org/apache/fop/pdf/PDFFontType3.java index 03d5469ea..03d5469ea 100644 --- a/src/java/org/apache/fop/pdf/PDFFontType3.java +++ b/src/main/java/org/apache/fop/pdf/PDFFontType3.java diff --git a/src/java/org/apache/fop/pdf/PDFFormXObject.java b/src/main/java/org/apache/fop/pdf/PDFFormXObject.java index bc81a0a35..bc81a0a35 100644 --- a/src/java/org/apache/fop/pdf/PDFFormXObject.java +++ b/src/main/java/org/apache/fop/pdf/PDFFormXObject.java diff --git a/src/java/org/apache/fop/pdf/PDFFunction.java b/src/main/java/org/apache/fop/pdf/PDFFunction.java index 3ce581d7f..3ce581d7f 100644 --- a/src/java/org/apache/fop/pdf/PDFFunction.java +++ b/src/main/java/org/apache/fop/pdf/PDFFunction.java diff --git a/src/java/org/apache/fop/pdf/PDFGState.java b/src/main/java/org/apache/fop/pdf/PDFGState.java index 094b7c246..094b7c246 100644 --- a/src/java/org/apache/fop/pdf/PDFGState.java +++ b/src/main/java/org/apache/fop/pdf/PDFGState.java diff --git a/src/java/org/apache/fop/pdf/PDFGoTo.java b/src/main/java/org/apache/fop/pdf/PDFGoTo.java index 695a5b73c..695a5b73c 100644 --- a/src/java/org/apache/fop/pdf/PDFGoTo.java +++ b/src/main/java/org/apache/fop/pdf/PDFGoTo.java diff --git a/src/java/org/apache/fop/pdf/PDFGoToRemote.java b/src/main/java/org/apache/fop/pdf/PDFGoToRemote.java index ef283e6ad..ef283e6ad 100644 --- a/src/java/org/apache/fop/pdf/PDFGoToRemote.java +++ b/src/main/java/org/apache/fop/pdf/PDFGoToRemote.java diff --git a/src/java/org/apache/fop/pdf/PDFICCBasedColorSpace.java b/src/main/java/org/apache/fop/pdf/PDFICCBasedColorSpace.java index 9635917ce..9635917ce 100644 --- a/src/java/org/apache/fop/pdf/PDFICCBasedColorSpace.java +++ b/src/main/java/org/apache/fop/pdf/PDFICCBasedColorSpace.java diff --git a/src/java/org/apache/fop/pdf/PDFICCStream.java b/src/main/java/org/apache/fop/pdf/PDFICCStream.java index 33b81307b..33b81307b 100644 --- a/src/java/org/apache/fop/pdf/PDFICCStream.java +++ b/src/main/java/org/apache/fop/pdf/PDFICCStream.java diff --git a/src/java/org/apache/fop/pdf/PDFIdentifiedDictionary.java b/src/main/java/org/apache/fop/pdf/PDFIdentifiedDictionary.java index c2d033aec..c2d033aec 100644 --- a/src/java/org/apache/fop/pdf/PDFIdentifiedDictionary.java +++ b/src/main/java/org/apache/fop/pdf/PDFIdentifiedDictionary.java diff --git a/src/java/org/apache/fop/pdf/PDFImage.java b/src/main/java/org/apache/fop/pdf/PDFImage.java index 38da60e7b..38da60e7b 100644 --- a/src/java/org/apache/fop/pdf/PDFImage.java +++ b/src/main/java/org/apache/fop/pdf/PDFImage.java diff --git a/src/java/org/apache/fop/pdf/PDFImageXObject.java b/src/main/java/org/apache/fop/pdf/PDFImageXObject.java index bbee663da..bbee663da 100644 --- a/src/java/org/apache/fop/pdf/PDFImageXObject.java +++ b/src/main/java/org/apache/fop/pdf/PDFImageXObject.java diff --git a/src/java/org/apache/fop/pdf/PDFInfo.java b/src/main/java/org/apache/fop/pdf/PDFInfo.java index 97bca9038..97bca9038 100644 --- a/src/java/org/apache/fop/pdf/PDFInfo.java +++ b/src/main/java/org/apache/fop/pdf/PDFInfo.java diff --git a/src/java/org/apache/fop/pdf/PDFInternalLink.java b/src/main/java/org/apache/fop/pdf/PDFInternalLink.java index faa6070a1..faa6070a1 100644 --- a/src/java/org/apache/fop/pdf/PDFInternalLink.java +++ b/src/main/java/org/apache/fop/pdf/PDFInternalLink.java diff --git a/src/java/org/apache/fop/pdf/PDFJavaScriptLaunchAction.java b/src/main/java/org/apache/fop/pdf/PDFJavaScriptLaunchAction.java index 560c408c2..560c408c2 100644 --- a/src/java/org/apache/fop/pdf/PDFJavaScriptLaunchAction.java +++ b/src/main/java/org/apache/fop/pdf/PDFJavaScriptLaunchAction.java diff --git a/src/java/org/apache/fop/pdf/PDFLaunch.java b/src/main/java/org/apache/fop/pdf/PDFLaunch.java index 7d80ddb43..7d80ddb43 100644 --- a/src/java/org/apache/fop/pdf/PDFLaunch.java +++ b/src/main/java/org/apache/fop/pdf/PDFLaunch.java diff --git a/src/java/org/apache/fop/pdf/PDFLayer.java b/src/main/java/org/apache/fop/pdf/PDFLayer.java index f8f434e87..f8f434e87 100644 --- a/src/java/org/apache/fop/pdf/PDFLayer.java +++ b/src/main/java/org/apache/fop/pdf/PDFLayer.java diff --git a/src/java/org/apache/fop/pdf/PDFLinearization.java b/src/main/java/org/apache/fop/pdf/PDFLinearization.java index fb12d2793..fb12d2793 100644 --- a/src/java/org/apache/fop/pdf/PDFLinearization.java +++ b/src/main/java/org/apache/fop/pdf/PDFLinearization.java diff --git a/src/java/org/apache/fop/pdf/PDFLink.java b/src/main/java/org/apache/fop/pdf/PDFLink.java index fd74c100a..fd74c100a 100644 --- a/src/java/org/apache/fop/pdf/PDFLink.java +++ b/src/main/java/org/apache/fop/pdf/PDFLink.java diff --git a/src/java/org/apache/fop/pdf/PDFMetadata.java b/src/main/java/org/apache/fop/pdf/PDFMetadata.java index 3af9af606..3af9af606 100644 --- a/src/java/org/apache/fop/pdf/PDFMetadata.java +++ b/src/main/java/org/apache/fop/pdf/PDFMetadata.java diff --git a/src/java/org/apache/fop/pdf/PDFName.java b/src/main/java/org/apache/fop/pdf/PDFName.java index 23294cc54..23294cc54 100644 --- a/src/java/org/apache/fop/pdf/PDFName.java +++ b/src/main/java/org/apache/fop/pdf/PDFName.java diff --git a/src/java/org/apache/fop/pdf/PDFNameTreeNode.java b/src/main/java/org/apache/fop/pdf/PDFNameTreeNode.java index 4e1f1b71b..4e1f1b71b 100644 --- a/src/java/org/apache/fop/pdf/PDFNameTreeNode.java +++ b/src/main/java/org/apache/fop/pdf/PDFNameTreeNode.java diff --git a/src/java/org/apache/fop/pdf/PDFNames.java b/src/main/java/org/apache/fop/pdf/PDFNames.java index fbea0d3f5..fbea0d3f5 100644 --- a/src/java/org/apache/fop/pdf/PDFNames.java +++ b/src/main/java/org/apache/fop/pdf/PDFNames.java diff --git a/src/java/org/apache/fop/pdf/PDFNavigator.java b/src/main/java/org/apache/fop/pdf/PDFNavigator.java index fdb97469b..fdb97469b 100644 --- a/src/java/org/apache/fop/pdf/PDFNavigator.java +++ b/src/main/java/org/apache/fop/pdf/PDFNavigator.java diff --git a/src/java/org/apache/fop/pdf/PDFNavigatorAction.java b/src/main/java/org/apache/fop/pdf/PDFNavigatorAction.java index ba32269b5..ba32269b5 100644 --- a/src/java/org/apache/fop/pdf/PDFNavigatorAction.java +++ b/src/main/java/org/apache/fop/pdf/PDFNavigatorAction.java diff --git a/src/java/org/apache/fop/pdf/PDFNull.java b/src/main/java/org/apache/fop/pdf/PDFNull.java index 43ba2dd82..43ba2dd82 100644 --- a/src/java/org/apache/fop/pdf/PDFNull.java +++ b/src/main/java/org/apache/fop/pdf/PDFNull.java diff --git a/src/java/org/apache/fop/pdf/PDFNumber.java b/src/main/java/org/apache/fop/pdf/PDFNumber.java index 754194886..754194886 100644 --- a/src/java/org/apache/fop/pdf/PDFNumber.java +++ b/src/main/java/org/apache/fop/pdf/PDFNumber.java diff --git a/src/java/org/apache/fop/pdf/PDFNumberTreeNode.java b/src/main/java/org/apache/fop/pdf/PDFNumberTreeNode.java index 599530439..599530439 100644 --- a/src/java/org/apache/fop/pdf/PDFNumberTreeNode.java +++ b/src/main/java/org/apache/fop/pdf/PDFNumberTreeNode.java diff --git a/src/java/org/apache/fop/pdf/PDFNumsArray.java b/src/main/java/org/apache/fop/pdf/PDFNumsArray.java index e9e1855b0..e9e1855b0 100644 --- a/src/java/org/apache/fop/pdf/PDFNumsArray.java +++ b/src/main/java/org/apache/fop/pdf/PDFNumsArray.java diff --git a/src/java/org/apache/fop/pdf/PDFObject.java b/src/main/java/org/apache/fop/pdf/PDFObject.java index 12402d72c..12402d72c 100644 --- a/src/java/org/apache/fop/pdf/PDFObject.java +++ b/src/main/java/org/apache/fop/pdf/PDFObject.java diff --git a/src/java/org/apache/fop/pdf/PDFObjectNumber.java b/src/main/java/org/apache/fop/pdf/PDFObjectNumber.java index d26823f6b..d26823f6b 100644 --- a/src/java/org/apache/fop/pdf/PDFObjectNumber.java +++ b/src/main/java/org/apache/fop/pdf/PDFObjectNumber.java diff --git a/src/java/org/apache/fop/pdf/PDFOutline.java b/src/main/java/org/apache/fop/pdf/PDFOutline.java index c43db61aa..c43db61aa 100644 --- a/src/java/org/apache/fop/pdf/PDFOutline.java +++ b/src/main/java/org/apache/fop/pdf/PDFOutline.java diff --git a/src/java/org/apache/fop/pdf/PDFOutputIntent.java b/src/main/java/org/apache/fop/pdf/PDFOutputIntent.java index 32a9f01ec..32a9f01ec 100644 --- a/src/java/org/apache/fop/pdf/PDFOutputIntent.java +++ b/src/main/java/org/apache/fop/pdf/PDFOutputIntent.java diff --git a/src/java/org/apache/fop/pdf/PDFPage.java b/src/main/java/org/apache/fop/pdf/PDFPage.java index 7a5365761..7a5365761 100644 --- a/src/java/org/apache/fop/pdf/PDFPage.java +++ b/src/main/java/org/apache/fop/pdf/PDFPage.java diff --git a/src/java/org/apache/fop/pdf/PDFPageLabels.java b/src/main/java/org/apache/fop/pdf/PDFPageLabels.java index 59b231d5b..59b231d5b 100644 --- a/src/java/org/apache/fop/pdf/PDFPageLabels.java +++ b/src/main/java/org/apache/fop/pdf/PDFPageLabels.java diff --git a/src/java/org/apache/fop/pdf/PDFPages.java b/src/main/java/org/apache/fop/pdf/PDFPages.java index d335bde52..d335bde52 100644 --- a/src/java/org/apache/fop/pdf/PDFPages.java +++ b/src/main/java/org/apache/fop/pdf/PDFPages.java diff --git a/src/java/org/apache/fop/pdf/PDFPaintingState.java b/src/main/java/org/apache/fop/pdf/PDFPaintingState.java index ce4296a20..ce4296a20 100644 --- a/src/java/org/apache/fop/pdf/PDFPaintingState.java +++ b/src/main/java/org/apache/fop/pdf/PDFPaintingState.java diff --git a/src/java/org/apache/fop/pdf/PDFParentTree.java b/src/main/java/org/apache/fop/pdf/PDFParentTree.java index e03545568..e03545568 100644 --- a/src/java/org/apache/fop/pdf/PDFParentTree.java +++ b/src/main/java/org/apache/fop/pdf/PDFParentTree.java diff --git a/src/java/org/apache/fop/pdf/PDFPathPaint.java b/src/main/java/org/apache/fop/pdf/PDFPathPaint.java index 5133e54a4..5133e54a4 100644 --- a/src/java/org/apache/fop/pdf/PDFPathPaint.java +++ b/src/main/java/org/apache/fop/pdf/PDFPathPaint.java diff --git a/src/java/org/apache/fop/pdf/PDFPattern.java b/src/main/java/org/apache/fop/pdf/PDFPattern.java index 6602f544d..6602f544d 100644 --- a/src/java/org/apache/fop/pdf/PDFPattern.java +++ b/src/main/java/org/apache/fop/pdf/PDFPattern.java diff --git a/src/java/org/apache/fop/pdf/PDFProfile.java b/src/main/java/org/apache/fop/pdf/PDFProfile.java index 18140a596..18140a596 100644 --- a/src/java/org/apache/fop/pdf/PDFProfile.java +++ b/src/main/java/org/apache/fop/pdf/PDFProfile.java diff --git a/src/java/org/apache/fop/pdf/PDFRectangle.java b/src/main/java/org/apache/fop/pdf/PDFRectangle.java index 30f218824..30f218824 100644 --- a/src/java/org/apache/fop/pdf/PDFRectangle.java +++ b/src/main/java/org/apache/fop/pdf/PDFRectangle.java diff --git a/src/java/org/apache/fop/pdf/PDFReference.java b/src/main/java/org/apache/fop/pdf/PDFReference.java index ca704978b..ca704978b 100644 --- a/src/java/org/apache/fop/pdf/PDFReference.java +++ b/src/main/java/org/apache/fop/pdf/PDFReference.java diff --git a/src/java/org/apache/fop/pdf/PDFResourceContext.java b/src/main/java/org/apache/fop/pdf/PDFResourceContext.java index 1419b2b76..1419b2b76 100644 --- a/src/java/org/apache/fop/pdf/PDFResourceContext.java +++ b/src/main/java/org/apache/fop/pdf/PDFResourceContext.java diff --git a/src/java/org/apache/fop/pdf/PDFResources.java b/src/main/java/org/apache/fop/pdf/PDFResources.java index 9ba9c7f8f..9ba9c7f8f 100644 --- a/src/java/org/apache/fop/pdf/PDFResources.java +++ b/src/main/java/org/apache/fop/pdf/PDFResources.java diff --git a/src/java/org/apache/fop/pdf/PDFRoot.java b/src/main/java/org/apache/fop/pdf/PDFRoot.java index 32edc34fc..32edc34fc 100644 --- a/src/java/org/apache/fop/pdf/PDFRoot.java +++ b/src/main/java/org/apache/fop/pdf/PDFRoot.java diff --git a/src/java/org/apache/fop/pdf/PDFSeparationColorSpace.java b/src/main/java/org/apache/fop/pdf/PDFSeparationColorSpace.java index d364eccbc..d364eccbc 100644 --- a/src/java/org/apache/fop/pdf/PDFSeparationColorSpace.java +++ b/src/main/java/org/apache/fop/pdf/PDFSeparationColorSpace.java diff --git a/src/java/org/apache/fop/pdf/PDFSetOCGStateAction.java b/src/main/java/org/apache/fop/pdf/PDFSetOCGStateAction.java index a47c5cd59..a47c5cd59 100644 --- a/src/java/org/apache/fop/pdf/PDFSetOCGStateAction.java +++ b/src/main/java/org/apache/fop/pdf/PDFSetOCGStateAction.java diff --git a/src/java/org/apache/fop/pdf/PDFShading.java b/src/main/java/org/apache/fop/pdf/PDFShading.java index c4ba5b089..c4ba5b089 100644 --- a/src/java/org/apache/fop/pdf/PDFShading.java +++ b/src/main/java/org/apache/fop/pdf/PDFShading.java diff --git a/src/java/org/apache/fop/pdf/PDFStream.java b/src/main/java/org/apache/fop/pdf/PDFStream.java index d6dd98cf3..d6dd98cf3 100644 --- a/src/java/org/apache/fop/pdf/PDFStream.java +++ b/src/main/java/org/apache/fop/pdf/PDFStream.java diff --git a/src/java/org/apache/fop/pdf/PDFStructElem.java b/src/main/java/org/apache/fop/pdf/PDFStructElem.java index 19864f6e3..19864f6e3 100644 --- a/src/java/org/apache/fop/pdf/PDFStructElem.java +++ b/src/main/java/org/apache/fop/pdf/PDFStructElem.java diff --git a/src/java/org/apache/fop/pdf/PDFStructTreeRoot.java b/src/main/java/org/apache/fop/pdf/PDFStructTreeRoot.java index ca6d82d22..ca6d82d22 100644 --- a/src/java/org/apache/fop/pdf/PDFStructTreeRoot.java +++ b/src/main/java/org/apache/fop/pdf/PDFStructTreeRoot.java diff --git a/src/java/org/apache/fop/pdf/PDFT1Stream.java b/src/main/java/org/apache/fop/pdf/PDFT1Stream.java index 2bae5dca3..2bae5dca3 100644 --- a/src/java/org/apache/fop/pdf/PDFT1Stream.java +++ b/src/main/java/org/apache/fop/pdf/PDFT1Stream.java diff --git a/src/java/org/apache/fop/pdf/PDFTTFStream.java b/src/main/java/org/apache/fop/pdf/PDFTTFStream.java index 998e14f28..998e14f28 100644 --- a/src/java/org/apache/fop/pdf/PDFTTFStream.java +++ b/src/main/java/org/apache/fop/pdf/PDFTTFStream.java diff --git a/src/java/org/apache/fop/pdf/PDFText.java b/src/main/java/org/apache/fop/pdf/PDFText.java index a1b3cff16..a1b3cff16 100644 --- a/src/java/org/apache/fop/pdf/PDFText.java +++ b/src/main/java/org/apache/fop/pdf/PDFText.java diff --git a/src/java/org/apache/fop/pdf/PDFTextUtil.java b/src/main/java/org/apache/fop/pdf/PDFTextUtil.java index bd7c8c4ae..bd7c8c4ae 100644 --- a/src/java/org/apache/fop/pdf/PDFTextUtil.java +++ b/src/main/java/org/apache/fop/pdf/PDFTextUtil.java diff --git a/src/java/org/apache/fop/pdf/PDFToUnicodeCMap.java b/src/main/java/org/apache/fop/pdf/PDFToUnicodeCMap.java index 56ca884f9..56ca884f9 100644 --- a/src/java/org/apache/fop/pdf/PDFToUnicodeCMap.java +++ b/src/main/java/org/apache/fop/pdf/PDFToUnicodeCMap.java diff --git a/src/java/org/apache/fop/pdf/PDFTransitionAction.java b/src/main/java/org/apache/fop/pdf/PDFTransitionAction.java index 01f8fcf21..01f8fcf21 100644 --- a/src/java/org/apache/fop/pdf/PDFTransitionAction.java +++ b/src/main/java/org/apache/fop/pdf/PDFTransitionAction.java diff --git a/src/java/org/apache/fop/pdf/PDFUAMode.java b/src/main/java/org/apache/fop/pdf/PDFUAMode.java index 5f17aa392..5f17aa392 100644 --- a/src/java/org/apache/fop/pdf/PDFUAMode.java +++ b/src/main/java/org/apache/fop/pdf/PDFUAMode.java diff --git a/src/java/org/apache/fop/pdf/PDFUri.java b/src/main/java/org/apache/fop/pdf/PDFUri.java index b3d377ff1..b3d377ff1 100644 --- a/src/java/org/apache/fop/pdf/PDFUri.java +++ b/src/main/java/org/apache/fop/pdf/PDFUri.java diff --git a/src/java/org/apache/fop/pdf/PDFVTMode.java b/src/main/java/org/apache/fop/pdf/PDFVTMode.java index 0dbb65873..0dbb65873 100644 --- a/src/java/org/apache/fop/pdf/PDFVTMode.java +++ b/src/main/java/org/apache/fop/pdf/PDFVTMode.java diff --git a/src/java/org/apache/fop/pdf/PDFWArray.java b/src/main/java/org/apache/fop/pdf/PDFWArray.java index ad6d2ac29..ad6d2ac29 100644 --- a/src/java/org/apache/fop/pdf/PDFWArray.java +++ b/src/main/java/org/apache/fop/pdf/PDFWArray.java diff --git a/src/java/org/apache/fop/pdf/PDFWritable.java b/src/main/java/org/apache/fop/pdf/PDFWritable.java index 67f10ff75..67f10ff75 100644 --- a/src/java/org/apache/fop/pdf/PDFWritable.java +++ b/src/main/java/org/apache/fop/pdf/PDFWritable.java diff --git a/src/java/org/apache/fop/pdf/PDFXMode.java b/src/main/java/org/apache/fop/pdf/PDFXMode.java index 84e7f785a..84e7f785a 100644 --- a/src/java/org/apache/fop/pdf/PDFXMode.java +++ b/src/main/java/org/apache/fop/pdf/PDFXMode.java diff --git a/src/java/org/apache/fop/pdf/PDFXObject.java b/src/main/java/org/apache/fop/pdf/PDFXObject.java index c2b702650..c2b702650 100644 --- a/src/java/org/apache/fop/pdf/PDFXObject.java +++ b/src/main/java/org/apache/fop/pdf/PDFXObject.java diff --git a/src/java/org/apache/fop/pdf/RefPDFFont.java b/src/main/java/org/apache/fop/pdf/RefPDFFont.java index 5870cdcb7..5870cdcb7 100644 --- a/src/java/org/apache/fop/pdf/RefPDFFont.java +++ b/src/main/java/org/apache/fop/pdf/RefPDFFont.java diff --git a/src/java/org/apache/fop/pdf/StandardStructureAttributes.java b/src/main/java/org/apache/fop/pdf/StandardStructureAttributes.java index 0a93d46bb..0a93d46bb 100644 --- a/src/java/org/apache/fop/pdf/StandardStructureAttributes.java +++ b/src/main/java/org/apache/fop/pdf/StandardStructureAttributes.java diff --git a/src/java/org/apache/fop/pdf/StandardStructureTypes.java b/src/main/java/org/apache/fop/pdf/StandardStructureTypes.java index 69550119a..69550119a 100644 --- a/src/java/org/apache/fop/pdf/StandardStructureTypes.java +++ b/src/main/java/org/apache/fop/pdf/StandardStructureTypes.java diff --git a/src/java/org/apache/fop/pdf/StreamCache.java b/src/main/java/org/apache/fop/pdf/StreamCache.java index 6fa687f23..6fa687f23 100644 --- a/src/java/org/apache/fop/pdf/StreamCache.java +++ b/src/main/java/org/apache/fop/pdf/StreamCache.java diff --git a/src/java/org/apache/fop/pdf/StreamCacheFactory.java b/src/main/java/org/apache/fop/pdf/StreamCacheFactory.java index e81edf62a..e81edf62a 100644 --- a/src/java/org/apache/fop/pdf/StreamCacheFactory.java +++ b/src/main/java/org/apache/fop/pdf/StreamCacheFactory.java diff --git a/src/java/org/apache/fop/pdf/StructureHierarchyMember.java b/src/main/java/org/apache/fop/pdf/StructureHierarchyMember.java index e3be92102..e3be92102 100644 --- a/src/java/org/apache/fop/pdf/StructureHierarchyMember.java +++ b/src/main/java/org/apache/fop/pdf/StructureHierarchyMember.java diff --git a/src/java/org/apache/fop/pdf/StructureType.java b/src/main/java/org/apache/fop/pdf/StructureType.java index 7b9b4c169..7b9b4c169 100644 --- a/src/java/org/apache/fop/pdf/StructureType.java +++ b/src/main/java/org/apache/fop/pdf/StructureType.java diff --git a/src/java/org/apache/fop/pdf/TempFileStreamCache.java b/src/main/java/org/apache/fop/pdf/TempFileStreamCache.java index 18a7a8b29..18a7a8b29 100644 --- a/src/java/org/apache/fop/pdf/TempFileStreamCache.java +++ b/src/main/java/org/apache/fop/pdf/TempFileStreamCache.java diff --git a/src/java/org/apache/fop/pdf/TransitionDictionary.java b/src/main/java/org/apache/fop/pdf/TransitionDictionary.java index 079a6ce4e..079a6ce4e 100644 --- a/src/java/org/apache/fop/pdf/TransitionDictionary.java +++ b/src/main/java/org/apache/fop/pdf/TransitionDictionary.java diff --git a/src/java/org/apache/fop/pdf/TransparencyDisallowedException.java b/src/main/java/org/apache/fop/pdf/TransparencyDisallowedException.java index 11d8baf54..11d8baf54 100644 --- a/src/java/org/apache/fop/pdf/TransparencyDisallowedException.java +++ b/src/main/java/org/apache/fop/pdf/TransparencyDisallowedException.java diff --git a/src/java/org/apache/fop/pdf/Version.java b/src/main/java/org/apache/fop/pdf/Version.java index 4bdc7a1b4..4bdc7a1b4 100644 --- a/src/java/org/apache/fop/pdf/Version.java +++ b/src/main/java/org/apache/fop/pdf/Version.java diff --git a/src/java/org/apache/fop/pdf/VersionController.java b/src/main/java/org/apache/fop/pdf/VersionController.java index d9c024515..d9c024515 100644 --- a/src/java/org/apache/fop/pdf/VersionController.java +++ b/src/main/java/org/apache/fop/pdf/VersionController.java diff --git a/src/java/org/apache/fop/pdf/package.html b/src/main/java/org/apache/fop/pdf/package.html index 383f78da1..383f78da1 100644 --- a/src/java/org/apache/fop/pdf/package.html +++ b/src/main/java/org/apache/fop/pdf/package.html diff --git a/src/java/org/apache/fop/pdf/sRGB Color Space Profile.icm b/src/main/java/org/apache/fop/pdf/sRGB Color Space Profile.icm Binary files differindex 7f9d18d09..7f9d18d09 100644 --- a/src/java/org/apache/fop/pdf/sRGB Color Space Profile.icm +++ b/src/main/java/org/apache/fop/pdf/sRGB Color Space Profile.icm diff --git a/src/java/org/apache/fop/pdf/sRGB Color Space Profile.icm.LICENSE.txt b/src/main/java/org/apache/fop/pdf/sRGB Color Space Profile.icm.LICENSE.txt index 9b817e339..9b817e339 100644 --- a/src/java/org/apache/fop/pdf/sRGB Color Space Profile.icm.LICENSE.txt +++ b/src/main/java/org/apache/fop/pdf/sRGB Color Space Profile.icm.LICENSE.txt diff --git a/src/java/org/apache/fop/pdf/xref/CompressedObjectReference.java b/src/main/java/org/apache/fop/pdf/xref/CompressedObjectReference.java index 8da267af1..8da267af1 100644 --- a/src/java/org/apache/fop/pdf/xref/CompressedObjectReference.java +++ b/src/main/java/org/apache/fop/pdf/xref/CompressedObjectReference.java diff --git a/src/java/org/apache/fop/pdf/xref/CrossReferenceObject.java b/src/main/java/org/apache/fop/pdf/xref/CrossReferenceObject.java index 3db50eca9..3db50eca9 100644 --- a/src/java/org/apache/fop/pdf/xref/CrossReferenceObject.java +++ b/src/main/java/org/apache/fop/pdf/xref/CrossReferenceObject.java diff --git a/src/java/org/apache/fop/pdf/xref/CrossReferenceStream.java b/src/main/java/org/apache/fop/pdf/xref/CrossReferenceStream.java index 9dbd317a7..9dbd317a7 100644 --- a/src/java/org/apache/fop/pdf/xref/CrossReferenceStream.java +++ b/src/main/java/org/apache/fop/pdf/xref/CrossReferenceStream.java diff --git a/src/java/org/apache/fop/pdf/xref/CrossReferenceTable.java b/src/main/java/org/apache/fop/pdf/xref/CrossReferenceTable.java index 09beab5b6..09beab5b6 100644 --- a/src/java/org/apache/fop/pdf/xref/CrossReferenceTable.java +++ b/src/main/java/org/apache/fop/pdf/xref/CrossReferenceTable.java diff --git a/src/java/org/apache/fop/pdf/xref/ObjectReference.java b/src/main/java/org/apache/fop/pdf/xref/ObjectReference.java index 894a66ce6..894a66ce6 100644 --- a/src/java/org/apache/fop/pdf/xref/ObjectReference.java +++ b/src/main/java/org/apache/fop/pdf/xref/ObjectReference.java diff --git a/src/java/org/apache/fop/pdf/xref/TrailerDictionary.java b/src/main/java/org/apache/fop/pdf/xref/TrailerDictionary.java index 09545d81c..09545d81c 100644 --- a/src/java/org/apache/fop/pdf/xref/TrailerDictionary.java +++ b/src/main/java/org/apache/fop/pdf/xref/TrailerDictionary.java diff --git a/src/java/org/apache/fop/pdf/xref/UncompressedObjectReference.java b/src/main/java/org/apache/fop/pdf/xref/UncompressedObjectReference.java index a54ec62e7..a54ec62e7 100644 --- a/src/java/org/apache/fop/pdf/xref/UncompressedObjectReference.java +++ b/src/main/java/org/apache/fop/pdf/xref/UncompressedObjectReference.java diff --git a/src/java/org/apache/fop/render/AbstractConfigurator.java b/src/main/java/org/apache/fop/render/AbstractConfigurator.java index eb135dfd2..eb135dfd2 100644 --- a/src/java/org/apache/fop/render/AbstractConfigurator.java +++ b/src/main/java/org/apache/fop/render/AbstractConfigurator.java diff --git a/src/java/org/apache/fop/render/AbstractFOEventHandlerMaker.java b/src/main/java/org/apache/fop/render/AbstractFOEventHandlerMaker.java index 0d891efe9..0d891efe9 100644 --- a/src/java/org/apache/fop/render/AbstractFOEventHandlerMaker.java +++ b/src/main/java/org/apache/fop/render/AbstractFOEventHandlerMaker.java diff --git a/src/java/org/apache/fop/render/AbstractGenericSVGHandler.java b/src/main/java/org/apache/fop/render/AbstractGenericSVGHandler.java index e329765db..e329765db 100644 --- a/src/java/org/apache/fop/render/AbstractGenericSVGHandler.java +++ b/src/main/java/org/apache/fop/render/AbstractGenericSVGHandler.java diff --git a/src/java/org/apache/fop/render/AbstractGraphics2DAdapter.java b/src/main/java/org/apache/fop/render/AbstractGraphics2DAdapter.java index 913a72b0d..913a72b0d 100644 --- a/src/java/org/apache/fop/render/AbstractGraphics2DAdapter.java +++ b/src/main/java/org/apache/fop/render/AbstractGraphics2DAdapter.java diff --git a/src/java/org/apache/fop/render/AbstractImageHandlerGraphics2D.java b/src/main/java/org/apache/fop/render/AbstractImageHandlerGraphics2D.java index 5bac4d88f..5bac4d88f 100644 --- a/src/java/org/apache/fop/render/AbstractImageHandlerGraphics2D.java +++ b/src/main/java/org/apache/fop/render/AbstractImageHandlerGraphics2D.java diff --git a/src/java/org/apache/fop/render/AbstractPathOrientedRenderer.java b/src/main/java/org/apache/fop/render/AbstractPathOrientedRenderer.java index bc514acd9..bc514acd9 100644 --- a/src/java/org/apache/fop/render/AbstractPathOrientedRenderer.java +++ b/src/main/java/org/apache/fop/render/AbstractPathOrientedRenderer.java diff --git a/src/java/org/apache/fop/render/AbstractRenderer.java b/src/main/java/org/apache/fop/render/AbstractRenderer.java index 458bed6a3..458bed6a3 100644 --- a/src/java/org/apache/fop/render/AbstractRenderer.java +++ b/src/main/java/org/apache/fop/render/AbstractRenderer.java diff --git a/src/java/org/apache/fop/render/AbstractRendererConfigurator.java b/src/main/java/org/apache/fop/render/AbstractRendererConfigurator.java index 799469353..799469353 100644 --- a/src/java/org/apache/fop/render/AbstractRendererConfigurator.java +++ b/src/main/java/org/apache/fop/render/AbstractRendererConfigurator.java diff --git a/src/java/org/apache/fop/render/AbstractRendererMaker.java b/src/main/java/org/apache/fop/render/AbstractRendererMaker.java index 505a60a1c..505a60a1c 100644 --- a/src/java/org/apache/fop/render/AbstractRendererMaker.java +++ b/src/main/java/org/apache/fop/render/AbstractRendererMaker.java diff --git a/src/java/org/apache/fop/render/AbstractRenderingContext.java b/src/main/java/org/apache/fop/render/AbstractRenderingContext.java index f6c68aafa..f6c68aafa 100644 --- a/src/java/org/apache/fop/render/AbstractRenderingContext.java +++ b/src/main/java/org/apache/fop/render/AbstractRenderingContext.java diff --git a/src/java/org/apache/fop/render/DefaultRendererConfigurator.java b/src/main/java/org/apache/fop/render/DefaultRendererConfigurator.java index 061c25709..061c25709 100644 --- a/src/java/org/apache/fop/render/DefaultRendererConfigurator.java +++ b/src/main/java/org/apache/fop/render/DefaultRendererConfigurator.java diff --git a/src/java/org/apache/fop/render/DummyPercentBaseContext.java b/src/main/java/org/apache/fop/render/DummyPercentBaseContext.java index c96a7a092..c96a7a092 100644 --- a/src/java/org/apache/fop/render/DummyPercentBaseContext.java +++ b/src/main/java/org/apache/fop/render/DummyPercentBaseContext.java diff --git a/src/java/org/apache/fop/render/Graphics2DAdapter.java b/src/main/java/org/apache/fop/render/Graphics2DAdapter.java index 6c389d0ec..6c389d0ec 100644 --- a/src/java/org/apache/fop/render/Graphics2DAdapter.java +++ b/src/main/java/org/apache/fop/render/Graphics2DAdapter.java diff --git a/src/java/org/apache/fop/render/Graphics2DImagePainter.java b/src/main/java/org/apache/fop/render/Graphics2DImagePainter.java index e72fc1e46..e72fc1e46 100644 --- a/src/java/org/apache/fop/render/Graphics2DImagePainter.java +++ b/src/main/java/org/apache/fop/render/Graphics2DImagePainter.java diff --git a/src/java/org/apache/fop/render/ImageAdapter.java b/src/main/java/org/apache/fop/render/ImageAdapter.java index 757be43b1..757be43b1 100644 --- a/src/java/org/apache/fop/render/ImageAdapter.java +++ b/src/main/java/org/apache/fop/render/ImageAdapter.java diff --git a/src/java/org/apache/fop/render/ImageHandler.java b/src/main/java/org/apache/fop/render/ImageHandler.java index 190d7c5d6..190d7c5d6 100644 --- a/src/java/org/apache/fop/render/ImageHandler.java +++ b/src/main/java/org/apache/fop/render/ImageHandler.java diff --git a/src/java/org/apache/fop/render/ImageHandlerBase.java b/src/main/java/org/apache/fop/render/ImageHandlerBase.java index f07c89671..f07c89671 100644 --- a/src/java/org/apache/fop/render/ImageHandlerBase.java +++ b/src/main/java/org/apache/fop/render/ImageHandlerBase.java diff --git a/src/java/org/apache/fop/render/ImageHandlerRegistry.java b/src/main/java/org/apache/fop/render/ImageHandlerRegistry.java index 18e5b1272..18e5b1272 100644 --- a/src/java/org/apache/fop/render/ImageHandlerRegistry.java +++ b/src/main/java/org/apache/fop/render/ImageHandlerRegistry.java diff --git a/src/java/org/apache/fop/render/ImageHandlerUtil.java b/src/main/java/org/apache/fop/render/ImageHandlerUtil.java index 5aa5f152b..5aa5f152b 100644 --- a/src/java/org/apache/fop/render/ImageHandlerUtil.java +++ b/src/main/java/org/apache/fop/render/ImageHandlerUtil.java diff --git a/src/java/org/apache/fop/render/PrintRenderer.java b/src/main/java/org/apache/fop/render/PrintRenderer.java index 620c3e621..620c3e621 100644 --- a/src/java/org/apache/fop/render/PrintRenderer.java +++ b/src/main/java/org/apache/fop/render/PrintRenderer.java diff --git a/src/java/org/apache/fop/render/PrintRendererConfigurator.java b/src/main/java/org/apache/fop/render/PrintRendererConfigurator.java index 96da591c1..96da591c1 100644 --- a/src/java/org/apache/fop/render/PrintRendererConfigurator.java +++ b/src/main/java/org/apache/fop/render/PrintRendererConfigurator.java diff --git a/src/java/org/apache/fop/render/Renderer.java b/src/main/java/org/apache/fop/render/Renderer.java index 3ff6ffb2a..3ff6ffb2a 100644 --- a/src/java/org/apache/fop/render/Renderer.java +++ b/src/main/java/org/apache/fop/render/Renderer.java diff --git a/src/java/org/apache/fop/render/RendererConfig.java b/src/main/java/org/apache/fop/render/RendererConfig.java index 4b3b63a51..4b3b63a51 100644 --- a/src/java/org/apache/fop/render/RendererConfig.java +++ b/src/main/java/org/apache/fop/render/RendererConfig.java diff --git a/src/java/org/apache/fop/render/RendererConfigOption.java b/src/main/java/org/apache/fop/render/RendererConfigOption.java index 5b670d07a..5b670d07a 100644 --- a/src/java/org/apache/fop/render/RendererConfigOption.java +++ b/src/main/java/org/apache/fop/render/RendererConfigOption.java diff --git a/src/java/org/apache/fop/render/RendererContext.java b/src/main/java/org/apache/fop/render/RendererContext.java index 8d62be570..8d62be570 100644 --- a/src/java/org/apache/fop/render/RendererContext.java +++ b/src/main/java/org/apache/fop/render/RendererContext.java diff --git a/src/java/org/apache/fop/render/RendererContextConstants.java b/src/main/java/org/apache/fop/render/RendererContextConstants.java index 05d802e54..05d802e54 100644 --- a/src/java/org/apache/fop/render/RendererContextConstants.java +++ b/src/main/java/org/apache/fop/render/RendererContextConstants.java diff --git a/src/java/org/apache/fop/render/RendererEventProducer.java b/src/main/java/org/apache/fop/render/RendererEventProducer.java index d8d8e5a23..d8d8e5a23 100644 --- a/src/java/org/apache/fop/render/RendererEventProducer.java +++ b/src/main/java/org/apache/fop/render/RendererEventProducer.java diff --git a/src/java/org/apache/fop/render/RendererEventProducer.xml b/src/main/java/org/apache/fop/render/RendererEventProducer.xml index abc45eb6f..abc45eb6f 100644 --- a/src/java/org/apache/fop/render/RendererEventProducer.xml +++ b/src/main/java/org/apache/fop/render/RendererEventProducer.xml diff --git a/src/java/org/apache/fop/render/RendererFactory.java b/src/main/java/org/apache/fop/render/RendererFactory.java index df5213dad..df5213dad 100644 --- a/src/java/org/apache/fop/render/RendererFactory.java +++ b/src/main/java/org/apache/fop/render/RendererFactory.java diff --git a/src/java/org/apache/fop/render/RenderingContext.java b/src/main/java/org/apache/fop/render/RenderingContext.java index 689227b4a..689227b4a 100644 --- a/src/java/org/apache/fop/render/RenderingContext.java +++ b/src/main/java/org/apache/fop/render/RenderingContext.java diff --git a/src/java/org/apache/fop/render/XMLHandler.java b/src/main/java/org/apache/fop/render/XMLHandler.java index f8152fcbf..f8152fcbf 100644 --- a/src/java/org/apache/fop/render/XMLHandler.java +++ b/src/main/java/org/apache/fop/render/XMLHandler.java diff --git a/src/java/org/apache/fop/render/XMLHandlerConfigurator.java b/src/main/java/org/apache/fop/render/XMLHandlerConfigurator.java index 9baed9959..9baed9959 100644 --- a/src/java/org/apache/fop/render/XMLHandlerConfigurator.java +++ b/src/main/java/org/apache/fop/render/XMLHandlerConfigurator.java diff --git a/src/java/org/apache/fop/render/XMLHandlerRegistry.java b/src/main/java/org/apache/fop/render/XMLHandlerRegistry.java index cad09bff9..cad09bff9 100644 --- a/src/java/org/apache/fop/render/XMLHandlerRegistry.java +++ b/src/main/java/org/apache/fop/render/XMLHandlerRegistry.java diff --git a/src/java/org/apache/fop/render/afp/AFPCustomizable.java b/src/main/java/org/apache/fop/render/afp/AFPCustomizable.java index 1bdb18cf2..1bdb18cf2 100644 --- a/src/java/org/apache/fop/render/afp/AFPCustomizable.java +++ b/src/main/java/org/apache/fop/render/afp/AFPCustomizable.java diff --git a/src/java/org/apache/fop/render/afp/AFPDocumentHandler.java b/src/main/java/org/apache/fop/render/afp/AFPDocumentHandler.java index a2c1389d7..a2c1389d7 100644 --- a/src/java/org/apache/fop/render/afp/AFPDocumentHandler.java +++ b/src/main/java/org/apache/fop/render/afp/AFPDocumentHandler.java diff --git a/src/java/org/apache/fop/render/afp/AFPDocumentHandlerMaker.java b/src/main/java/org/apache/fop/render/afp/AFPDocumentHandlerMaker.java index f83ede9f7..f83ede9f7 100644 --- a/src/java/org/apache/fop/render/afp/AFPDocumentHandlerMaker.java +++ b/src/main/java/org/apache/fop/render/afp/AFPDocumentHandlerMaker.java diff --git a/src/java/org/apache/fop/render/afp/AFPEventProducer.xml b/src/main/java/org/apache/fop/render/afp/AFPEventProducer.xml index 23bd9a182..23bd9a182 100644 --- a/src/java/org/apache/fop/render/afp/AFPEventProducer.xml +++ b/src/main/java/org/apache/fop/render/afp/AFPEventProducer.xml diff --git a/src/java/org/apache/fop/render/afp/AFPFontConfig.java b/src/main/java/org/apache/fop/render/afp/AFPFontConfig.java index 35b2cc3f5..35b2cc3f5 100644 --- a/src/java/org/apache/fop/render/afp/AFPFontConfig.java +++ b/src/main/java/org/apache/fop/render/afp/AFPFontConfig.java diff --git a/src/java/org/apache/fop/render/afp/AFPForeignAttributeReader.java b/src/main/java/org/apache/fop/render/afp/AFPForeignAttributeReader.java index 5f155e277..5f155e277 100644 --- a/src/java/org/apache/fop/render/afp/AFPForeignAttributeReader.java +++ b/src/main/java/org/apache/fop/render/afp/AFPForeignAttributeReader.java diff --git a/src/java/org/apache/fop/render/afp/AFPGraphics2DAdapter.java b/src/main/java/org/apache/fop/render/afp/AFPGraphics2DAdapter.java index 88734dfb8..88734dfb8 100644 --- a/src/java/org/apache/fop/render/afp/AFPGraphics2DAdapter.java +++ b/src/main/java/org/apache/fop/render/afp/AFPGraphics2DAdapter.java diff --git a/src/java/org/apache/fop/render/afp/AFPImageHandler.java b/src/main/java/org/apache/fop/render/afp/AFPImageHandler.java index d3801c119..d3801c119 100644 --- a/src/java/org/apache/fop/render/afp/AFPImageHandler.java +++ b/src/main/java/org/apache/fop/render/afp/AFPImageHandler.java diff --git a/src/java/org/apache/fop/render/afp/AFPImageHandlerGraphics2D.java b/src/main/java/org/apache/fop/render/afp/AFPImageHandlerGraphics2D.java index ba0b5433f..ba0b5433f 100644 --- a/src/java/org/apache/fop/render/afp/AFPImageHandlerGraphics2D.java +++ b/src/main/java/org/apache/fop/render/afp/AFPImageHandlerGraphics2D.java diff --git a/src/java/org/apache/fop/render/afp/AFPImageHandlerRawCCITTFax.java b/src/main/java/org/apache/fop/render/afp/AFPImageHandlerRawCCITTFax.java index 85ef580f5..85ef580f5 100644 --- a/src/java/org/apache/fop/render/afp/AFPImageHandlerRawCCITTFax.java +++ b/src/main/java/org/apache/fop/render/afp/AFPImageHandlerRawCCITTFax.java diff --git a/src/java/org/apache/fop/render/afp/AFPImageHandlerRawJPEG.java b/src/main/java/org/apache/fop/render/afp/AFPImageHandlerRawJPEG.java index e5f6f64cb..e5f6f64cb 100644 --- a/src/java/org/apache/fop/render/afp/AFPImageHandlerRawJPEG.java +++ b/src/main/java/org/apache/fop/render/afp/AFPImageHandlerRawJPEG.java diff --git a/src/java/org/apache/fop/render/afp/AFPImageHandlerRawStream.java b/src/main/java/org/apache/fop/render/afp/AFPImageHandlerRawStream.java index f32f7305b..f32f7305b 100644 --- a/src/java/org/apache/fop/render/afp/AFPImageHandlerRawStream.java +++ b/src/main/java/org/apache/fop/render/afp/AFPImageHandlerRawStream.java diff --git a/src/java/org/apache/fop/render/afp/AFPImageHandlerRenderedImage.java b/src/main/java/org/apache/fop/render/afp/AFPImageHandlerRenderedImage.java index 57a5143f6..57a5143f6 100644 --- a/src/java/org/apache/fop/render/afp/AFPImageHandlerRenderedImage.java +++ b/src/main/java/org/apache/fop/render/afp/AFPImageHandlerRenderedImage.java diff --git a/src/java/org/apache/fop/render/afp/AFPImageHandlerSVG.java b/src/main/java/org/apache/fop/render/afp/AFPImageHandlerSVG.java index f38da91e9..f38da91e9 100644 --- a/src/java/org/apache/fop/render/afp/AFPImageHandlerSVG.java +++ b/src/main/java/org/apache/fop/render/afp/AFPImageHandlerSVG.java diff --git a/src/java/org/apache/fop/render/afp/AFPInfo.java b/src/main/java/org/apache/fop/render/afp/AFPInfo.java index 647a8a7c0..647a8a7c0 100644 --- a/src/java/org/apache/fop/render/afp/AFPInfo.java +++ b/src/main/java/org/apache/fop/render/afp/AFPInfo.java diff --git a/src/java/org/apache/fop/render/afp/AFPPainter.java b/src/main/java/org/apache/fop/render/afp/AFPPainter.java index 7304d2e52..7304d2e52 100644 --- a/src/java/org/apache/fop/render/afp/AFPPainter.java +++ b/src/main/java/org/apache/fop/render/afp/AFPPainter.java diff --git a/src/java/org/apache/fop/render/afp/AFPRendererConfig.java b/src/main/java/org/apache/fop/render/afp/AFPRendererConfig.java index a943f5aad..a943f5aad 100644 --- a/src/java/org/apache/fop/render/afp/AFPRendererConfig.java +++ b/src/main/java/org/apache/fop/render/afp/AFPRendererConfig.java diff --git a/src/java/org/apache/fop/render/afp/AFPRendererConfigurator.java b/src/main/java/org/apache/fop/render/afp/AFPRendererConfigurator.java index 57b65cdcd..57b65cdcd 100644 --- a/src/java/org/apache/fop/render/afp/AFPRendererConfigurator.java +++ b/src/main/java/org/apache/fop/render/afp/AFPRendererConfigurator.java diff --git a/src/java/org/apache/fop/render/afp/AFPRendererContext.java b/src/main/java/org/apache/fop/render/afp/AFPRendererContext.java index cd00a078b..cd00a078b 100644 --- a/src/java/org/apache/fop/render/afp/AFPRendererContext.java +++ b/src/main/java/org/apache/fop/render/afp/AFPRendererContext.java diff --git a/src/java/org/apache/fop/render/afp/AFPRendererContextConstants.java b/src/main/java/org/apache/fop/render/afp/AFPRendererContextConstants.java index 3302b7f3c..3302b7f3c 100644 --- a/src/java/org/apache/fop/render/afp/AFPRendererContextConstants.java +++ b/src/main/java/org/apache/fop/render/afp/AFPRendererContextConstants.java diff --git a/src/java/org/apache/fop/render/afp/AFPRendererImageInfo.java b/src/main/java/org/apache/fop/render/afp/AFPRendererImageInfo.java index c11c89217..c11c89217 100644 --- a/src/java/org/apache/fop/render/afp/AFPRendererImageInfo.java +++ b/src/main/java/org/apache/fop/render/afp/AFPRendererImageInfo.java diff --git a/src/java/org/apache/fop/render/afp/AFPRendererOption.java b/src/main/java/org/apache/fop/render/afp/AFPRendererOption.java index d573570d0..d573570d0 100644 --- a/src/java/org/apache/fop/render/afp/AFPRendererOption.java +++ b/src/main/java/org/apache/fop/render/afp/AFPRendererOption.java diff --git a/src/java/org/apache/fop/render/afp/AFPRenderingContext.java b/src/main/java/org/apache/fop/render/afp/AFPRenderingContext.java index 22a91dd83..22a91dd83 100644 --- a/src/java/org/apache/fop/render/afp/AFPRenderingContext.java +++ b/src/main/java/org/apache/fop/render/afp/AFPRenderingContext.java diff --git a/src/java/org/apache/fop/render/afp/AFPSVGHandler.java b/src/main/java/org/apache/fop/render/afp/AFPSVGHandler.java index 9ea871d17..9ea871d17 100644 --- a/src/java/org/apache/fop/render/afp/AFPSVGHandler.java +++ b/src/main/java/org/apache/fop/render/afp/AFPSVGHandler.java diff --git a/src/java/org/apache/fop/render/afp/AFPShadingMode.java b/src/main/java/org/apache/fop/render/afp/AFPShadingMode.java index 7e963148a..7e963148a 100644 --- a/src/java/org/apache/fop/render/afp/AFPShadingMode.java +++ b/src/main/java/org/apache/fop/render/afp/AFPShadingMode.java diff --git a/src/java/org/apache/fop/render/afp/AbstractAFPImageHandlerRawStream.java b/src/main/java/org/apache/fop/render/afp/AbstractAFPImageHandlerRawStream.java index e2d779192..e2d779192 100644 --- a/src/java/org/apache/fop/render/afp/AbstractAFPImageHandlerRawStream.java +++ b/src/main/java/org/apache/fop/render/afp/AbstractAFPImageHandlerRawStream.java diff --git a/src/java/org/apache/fop/render/afp/PageSegmentDescriptor.java b/src/main/java/org/apache/fop/render/afp/PageSegmentDescriptor.java index 2574bc1bc..2574bc1bc 100644 --- a/src/java/org/apache/fop/render/afp/PageSegmentDescriptor.java +++ b/src/main/java/org/apache/fop/render/afp/PageSegmentDescriptor.java diff --git a/src/java/org/apache/fop/render/afp/exceptions/NestedRuntimeException.java b/src/main/java/org/apache/fop/render/afp/exceptions/NestedRuntimeException.java index 070e631dc..070e631dc 100644 --- a/src/java/org/apache/fop/render/afp/exceptions/NestedRuntimeException.java +++ b/src/main/java/org/apache/fop/render/afp/exceptions/NestedRuntimeException.java diff --git a/src/java/org/apache/fop/render/afp/exceptions/RendererRuntimeException.java b/src/main/java/org/apache/fop/render/afp/exceptions/RendererRuntimeException.java index fe9ec87c0..fe9ec87c0 100644 --- a/src/java/org/apache/fop/render/afp/exceptions/RendererRuntimeException.java +++ b/src/main/java/org/apache/fop/render/afp/exceptions/RendererRuntimeException.java diff --git a/src/java/org/apache/fop/render/afp/extensions/AFPAttribute.java b/src/main/java/org/apache/fop/render/afp/extensions/AFPAttribute.java index 7c88c7168..7c88c7168 100644 --- a/src/java/org/apache/fop/render/afp/extensions/AFPAttribute.java +++ b/src/main/java/org/apache/fop/render/afp/extensions/AFPAttribute.java diff --git a/src/java/org/apache/fop/render/afp/extensions/AFPElementMapping.java b/src/main/java/org/apache/fop/render/afp/extensions/AFPElementMapping.java index 4e4100bc7..4e4100bc7 100644 --- a/src/java/org/apache/fop/render/afp/extensions/AFPElementMapping.java +++ b/src/main/java/org/apache/fop/render/afp/extensions/AFPElementMapping.java diff --git a/src/java/org/apache/fop/render/afp/extensions/AFPExtensionAttachment.java b/src/main/java/org/apache/fop/render/afp/extensions/AFPExtensionAttachment.java index cc8de5f84..cc8de5f84 100644 --- a/src/java/org/apache/fop/render/afp/extensions/AFPExtensionAttachment.java +++ b/src/main/java/org/apache/fop/render/afp/extensions/AFPExtensionAttachment.java diff --git a/src/java/org/apache/fop/render/afp/extensions/AFPExtensionHandler.java b/src/main/java/org/apache/fop/render/afp/extensions/AFPExtensionHandler.java index abf6e359e..abf6e359e 100644 --- a/src/java/org/apache/fop/render/afp/extensions/AFPExtensionHandler.java +++ b/src/main/java/org/apache/fop/render/afp/extensions/AFPExtensionHandler.java diff --git a/src/java/org/apache/fop/render/afp/extensions/AFPExtensionHandlerFactory.java b/src/main/java/org/apache/fop/render/afp/extensions/AFPExtensionHandlerFactory.java index cc12ed9f4..cc12ed9f4 100644 --- a/src/java/org/apache/fop/render/afp/extensions/AFPExtensionHandlerFactory.java +++ b/src/main/java/org/apache/fop/render/afp/extensions/AFPExtensionHandlerFactory.java diff --git a/src/java/org/apache/fop/render/afp/extensions/AFPIncludeFormMap.java b/src/main/java/org/apache/fop/render/afp/extensions/AFPIncludeFormMap.java index 824ecbabb..824ecbabb 100644 --- a/src/java/org/apache/fop/render/afp/extensions/AFPIncludeFormMap.java +++ b/src/main/java/org/apache/fop/render/afp/extensions/AFPIncludeFormMap.java diff --git a/src/java/org/apache/fop/render/afp/extensions/AFPIncludeFormMapElement.java b/src/main/java/org/apache/fop/render/afp/extensions/AFPIncludeFormMapElement.java index 71765bb7d..71765bb7d 100644 --- a/src/java/org/apache/fop/render/afp/extensions/AFPIncludeFormMapElement.java +++ b/src/main/java/org/apache/fop/render/afp/extensions/AFPIncludeFormMapElement.java diff --git a/src/java/org/apache/fop/render/afp/extensions/AFPInvokeMediumMap.java b/src/main/java/org/apache/fop/render/afp/extensions/AFPInvokeMediumMap.java index 83c5325aa..83c5325aa 100644 --- a/src/java/org/apache/fop/render/afp/extensions/AFPInvokeMediumMap.java +++ b/src/main/java/org/apache/fop/render/afp/extensions/AFPInvokeMediumMap.java diff --git a/src/java/org/apache/fop/render/afp/extensions/AFPInvokeMediumMapElement.java b/src/main/java/org/apache/fop/render/afp/extensions/AFPInvokeMediumMapElement.java index e40d3da34..e40d3da34 100644 --- a/src/java/org/apache/fop/render/afp/extensions/AFPInvokeMediumMapElement.java +++ b/src/main/java/org/apache/fop/render/afp/extensions/AFPInvokeMediumMapElement.java diff --git a/src/java/org/apache/fop/render/afp/extensions/AFPPageOverlay.java b/src/main/java/org/apache/fop/render/afp/extensions/AFPPageOverlay.java index 49fdf38ed..49fdf38ed 100644 --- a/src/java/org/apache/fop/render/afp/extensions/AFPPageOverlay.java +++ b/src/main/java/org/apache/fop/render/afp/extensions/AFPPageOverlay.java diff --git a/src/java/org/apache/fop/render/afp/extensions/AFPPageOverlayElement.java b/src/main/java/org/apache/fop/render/afp/extensions/AFPPageOverlayElement.java index 59df1529e..59df1529e 100644 --- a/src/java/org/apache/fop/render/afp/extensions/AFPPageOverlayElement.java +++ b/src/main/java/org/apache/fop/render/afp/extensions/AFPPageOverlayElement.java diff --git a/src/java/org/apache/fop/render/afp/extensions/AFPPageSegmentElement.java b/src/main/java/org/apache/fop/render/afp/extensions/AFPPageSegmentElement.java index f7379e02c..f7379e02c 100644 --- a/src/java/org/apache/fop/render/afp/extensions/AFPPageSegmentElement.java +++ b/src/main/java/org/apache/fop/render/afp/extensions/AFPPageSegmentElement.java diff --git a/src/java/org/apache/fop/render/afp/extensions/AFPPageSetup.java b/src/main/java/org/apache/fop/render/afp/extensions/AFPPageSetup.java index 27db41d39..27db41d39 100644 --- a/src/java/org/apache/fop/render/afp/extensions/AFPPageSetup.java +++ b/src/main/java/org/apache/fop/render/afp/extensions/AFPPageSetup.java diff --git a/src/java/org/apache/fop/render/afp/extensions/AFPPageSetupElement.java b/src/main/java/org/apache/fop/render/afp/extensions/AFPPageSetupElement.java index e3aa3ca57..e3aa3ca57 100644 --- a/src/java/org/apache/fop/render/afp/extensions/AFPPageSetupElement.java +++ b/src/main/java/org/apache/fop/render/afp/extensions/AFPPageSetupElement.java diff --git a/src/java/org/apache/fop/render/afp/extensions/AbstractAFPExtensionObject.java b/src/main/java/org/apache/fop/render/afp/extensions/AbstractAFPExtensionObject.java index 388ea3f44..388ea3f44 100644 --- a/src/java/org/apache/fop/render/afp/extensions/AbstractAFPExtensionObject.java +++ b/src/main/java/org/apache/fop/render/afp/extensions/AbstractAFPExtensionObject.java diff --git a/src/java/org/apache/fop/render/afp/extensions/ExtensionPlacement.java b/src/main/java/org/apache/fop/render/afp/extensions/ExtensionPlacement.java index 9c593d52f..9c593d52f 100644 --- a/src/java/org/apache/fop/render/afp/extensions/ExtensionPlacement.java +++ b/src/main/java/org/apache/fop/render/afp/extensions/ExtensionPlacement.java diff --git a/src/java/org/apache/fop/render/afp/package.html b/src/main/java/org/apache/fop/render/afp/package.html index 3e611d964..3e611d964 100644 --- a/src/java/org/apache/fop/render/afp/package.html +++ b/src/main/java/org/apache/fop/render/afp/package.html diff --git a/src/java/org/apache/fop/render/awt/AWTRenderer.java b/src/main/java/org/apache/fop/render/awt/AWTRenderer.java index f10640a09..f10640a09 100644 --- a/src/java/org/apache/fop/render/awt/AWTRenderer.java +++ b/src/main/java/org/apache/fop/render/awt/AWTRenderer.java diff --git a/src/java/org/apache/fop/render/awt/AWTRendererMaker.java b/src/main/java/org/apache/fop/render/awt/AWTRendererMaker.java index 5efa49a99..5efa49a99 100644 --- a/src/java/org/apache/fop/render/awt/AWTRendererMaker.java +++ b/src/main/java/org/apache/fop/render/awt/AWTRendererMaker.java diff --git a/src/java/org/apache/fop/render/awt/package.html b/src/main/java/org/apache/fop/render/awt/package.html index 0b65a5e90..0b65a5e90 100644 --- a/src/java/org/apache/fop/render/awt/package.html +++ b/src/main/java/org/apache/fop/render/awt/package.html diff --git a/src/java/org/apache/fop/render/awt/viewer/Command.java b/src/main/java/org/apache/fop/render/awt/viewer/Command.java index f989eaf33..f989eaf33 100644 --- a/src/java/org/apache/fop/render/awt/viewer/Command.java +++ b/src/main/java/org/apache/fop/render/awt/viewer/Command.java diff --git a/src/java/org/apache/fop/render/awt/viewer/GoToPageDialog.java b/src/main/java/org/apache/fop/render/awt/viewer/GoToPageDialog.java index 599a7d788..599a7d788 100644 --- a/src/java/org/apache/fop/render/awt/viewer/GoToPageDialog.java +++ b/src/main/java/org/apache/fop/render/awt/viewer/GoToPageDialog.java diff --git a/src/java/org/apache/fop/render/awt/viewer/ImageProxyPanel.java b/src/main/java/org/apache/fop/render/awt/viewer/ImageProxyPanel.java index a1c740da8..a1c740da8 100644 --- a/src/java/org/apache/fop/render/awt/viewer/ImageProxyPanel.java +++ b/src/main/java/org/apache/fop/render/awt/viewer/ImageProxyPanel.java diff --git a/src/java/org/apache/fop/render/awt/viewer/PageChangeEvent.java b/src/main/java/org/apache/fop/render/awt/viewer/PageChangeEvent.java index 78f09b537..78f09b537 100644 --- a/src/java/org/apache/fop/render/awt/viewer/PageChangeEvent.java +++ b/src/main/java/org/apache/fop/render/awt/viewer/PageChangeEvent.java diff --git a/src/java/org/apache/fop/render/awt/viewer/PageChangeListener.java b/src/main/java/org/apache/fop/render/awt/viewer/PageChangeListener.java index b350f891d..b350f891d 100644 --- a/src/java/org/apache/fop/render/awt/viewer/PageChangeListener.java +++ b/src/main/java/org/apache/fop/render/awt/viewer/PageChangeListener.java diff --git a/src/java/org/apache/fop/render/awt/viewer/PreviewDialog.java b/src/main/java/org/apache/fop/render/awt/viewer/PreviewDialog.java index a0a7ddd01..a0a7ddd01 100644 --- a/src/java/org/apache/fop/render/awt/viewer/PreviewDialog.java +++ b/src/main/java/org/apache/fop/render/awt/viewer/PreviewDialog.java diff --git a/src/java/org/apache/fop/render/awt/viewer/PreviewDialogAboutBox.java b/src/main/java/org/apache/fop/render/awt/viewer/PreviewDialogAboutBox.java index 643c78b7c..643c78b7c 100644 --- a/src/java/org/apache/fop/render/awt/viewer/PreviewDialogAboutBox.java +++ b/src/main/java/org/apache/fop/render/awt/viewer/PreviewDialogAboutBox.java diff --git a/src/java/org/apache/fop/render/awt/viewer/PreviewPanel.java b/src/main/java/org/apache/fop/render/awt/viewer/PreviewPanel.java index 93cc29e4f..93cc29e4f 100644 --- a/src/java/org/apache/fop/render/awt/viewer/PreviewPanel.java +++ b/src/main/java/org/apache/fop/render/awt/viewer/PreviewPanel.java diff --git a/src/java/org/apache/fop/render/awt/viewer/Renderable.java b/src/main/java/org/apache/fop/render/awt/viewer/Renderable.java index c40272220..c40272220 100644 --- a/src/java/org/apache/fop/render/awt/viewer/Renderable.java +++ b/src/main/java/org/apache/fop/render/awt/viewer/Renderable.java diff --git a/src/java/org/apache/fop/render/awt/viewer/StatusListener.java b/src/main/java/org/apache/fop/render/awt/viewer/StatusListener.java index d145d7718..d145d7718 100644 --- a/src/java/org/apache/fop/render/awt/viewer/StatusListener.java +++ b/src/main/java/org/apache/fop/render/awt/viewer/StatusListener.java diff --git a/src/java/org/apache/fop/render/awt/viewer/Translator.java b/src/main/java/org/apache/fop/render/awt/viewer/Translator.java index 538c2cd59..538c2cd59 100644 --- a/src/java/org/apache/fop/render/awt/viewer/Translator.java +++ b/src/main/java/org/apache/fop/render/awt/viewer/Translator.java diff --git a/src/java/org/apache/fop/render/awt/viewer/images/Print.gif b/src/main/java/org/apache/fop/render/awt/viewer/images/Print.gif Binary files differindex e715fe67f..e715fe67f 100644 --- a/src/java/org/apache/fop/render/awt/viewer/images/Print.gif +++ b/src/main/java/org/apache/fop/render/awt/viewer/images/Print.gif diff --git a/src/java/org/apache/fop/render/awt/viewer/images/debug.gif b/src/main/java/org/apache/fop/render/awt/viewer/images/debug.gif Binary files differindex b3f2a1869..b3f2a1869 100644 --- a/src/java/org/apache/fop/render/awt/viewer/images/debug.gif +++ b/src/main/java/org/apache/fop/render/awt/viewer/images/debug.gif diff --git a/src/java/org/apache/fop/render/awt/viewer/images/firstpg.gif b/src/main/java/org/apache/fop/render/awt/viewer/images/firstpg.gif Binary files differindex 1d0315d74..1d0315d74 100644 --- a/src/java/org/apache/fop/render/awt/viewer/images/firstpg.gif +++ b/src/main/java/org/apache/fop/render/awt/viewer/images/firstpg.gif diff --git a/src/java/org/apache/fop/render/awt/viewer/images/fop.gif b/src/main/java/org/apache/fop/render/awt/viewer/images/fop.gif Binary files differindex e370237ef..e370237ef 100644 --- a/src/java/org/apache/fop/render/awt/viewer/images/fop.gif +++ b/src/main/java/org/apache/fop/render/awt/viewer/images/fop.gif diff --git a/src/java/org/apache/fop/render/awt/viewer/images/fopLogo.gif b/src/main/java/org/apache/fop/render/awt/viewer/images/fopLogo.gif Binary files differindex f8c223b99..f8c223b99 100644 --- a/src/java/org/apache/fop/render/awt/viewer/images/fopLogo.gif +++ b/src/main/java/org/apache/fop/render/awt/viewer/images/fopLogo.gif diff --git a/src/java/org/apache/fop/render/awt/viewer/images/lastpg.gif b/src/main/java/org/apache/fop/render/awt/viewer/images/lastpg.gif Binary files differindex 082f13a26..082f13a26 100644 --- a/src/java/org/apache/fop/render/awt/viewer/images/lastpg.gif +++ b/src/main/java/org/apache/fop/render/awt/viewer/images/lastpg.gif diff --git a/src/java/org/apache/fop/render/awt/viewer/images/nextpg.gif b/src/main/java/org/apache/fop/render/awt/viewer/images/nextpg.gif Binary files differindex 2e3a2d7b3..2e3a2d7b3 100644 --- a/src/java/org/apache/fop/render/awt/viewer/images/nextpg.gif +++ b/src/main/java/org/apache/fop/render/awt/viewer/images/nextpg.gif diff --git a/src/java/org/apache/fop/render/awt/viewer/images/prevpg.gif b/src/main/java/org/apache/fop/render/awt/viewer/images/prevpg.gif Binary files differindex 3c8cce4b6..3c8cce4b6 100644 --- a/src/java/org/apache/fop/render/awt/viewer/images/prevpg.gif +++ b/src/main/java/org/apache/fop/render/awt/viewer/images/prevpg.gif diff --git a/src/java/org/apache/fop/render/awt/viewer/images/reload.gif b/src/main/java/org/apache/fop/render/awt/viewer/images/reload.gif Binary files differindex 405718c1b..405718c1b 100644 --- a/src/java/org/apache/fop/render/awt/viewer/images/reload.gif +++ b/src/main/java/org/apache/fop/render/awt/viewer/images/reload.gif diff --git a/src/java/org/apache/fop/render/awt/viewer/package.html b/src/main/java/org/apache/fop/render/awt/viewer/package.html index 7146478ea..7146478ea 100644 --- a/src/java/org/apache/fop/render/awt/viewer/package.html +++ b/src/main/java/org/apache/fop/render/awt/viewer/package.html diff --git a/src/java/org/apache/fop/render/awt/viewer/resources/Viewer.properties b/src/main/java/org/apache/fop/render/awt/viewer/resources/Viewer.properties index 27ee88a14..27ee88a14 100644 --- a/src/java/org/apache/fop/render/awt/viewer/resources/Viewer.properties +++ b/src/main/java/org/apache/fop/render/awt/viewer/resources/Viewer.properties diff --git a/src/java/org/apache/fop/render/awt/viewer/resources/Viewer_cs.properties b/src/main/java/org/apache/fop/render/awt/viewer/resources/Viewer_cs.properties index d668e1292..d668e1292 100644 --- a/src/java/org/apache/fop/render/awt/viewer/resources/Viewer_cs.properties +++ b/src/main/java/org/apache/fop/render/awt/viewer/resources/Viewer_cs.properties diff --git a/src/java/org/apache/fop/render/awt/viewer/resources/Viewer_de.properties b/src/main/java/org/apache/fop/render/awt/viewer/resources/Viewer_de.properties index 0da9426c1..0da9426c1 100644 --- a/src/java/org/apache/fop/render/awt/viewer/resources/Viewer_de.properties +++ b/src/main/java/org/apache/fop/render/awt/viewer/resources/Viewer_de.properties diff --git a/src/java/org/apache/fop/render/awt/viewer/resources/Viewer_fi.properties b/src/main/java/org/apache/fop/render/awt/viewer/resources/Viewer_fi.properties index 4068aad5d..4068aad5d 100644 --- a/src/java/org/apache/fop/render/awt/viewer/resources/Viewer_fi.properties +++ b/src/main/java/org/apache/fop/render/awt/viewer/resources/Viewer_fi.properties diff --git a/src/java/org/apache/fop/render/awt/viewer/resources/Viewer_fr.properties b/src/main/java/org/apache/fop/render/awt/viewer/resources/Viewer_fr.properties index d19f36c00..d19f36c00 100644 --- a/src/java/org/apache/fop/render/awt/viewer/resources/Viewer_fr.properties +++ b/src/main/java/org/apache/fop/render/awt/viewer/resources/Viewer_fr.properties diff --git a/src/java/org/apache/fop/render/awt/viewer/resources/Viewer_it.properties b/src/main/java/org/apache/fop/render/awt/viewer/resources/Viewer_it.properties index 471449cb9..471449cb9 100644 --- a/src/java/org/apache/fop/render/awt/viewer/resources/Viewer_it.properties +++ b/src/main/java/org/apache/fop/render/awt/viewer/resources/Viewer_it.properties diff --git a/src/java/org/apache/fop/render/awt/viewer/resources/Viewer_ja.properties b/src/main/java/org/apache/fop/render/awt/viewer/resources/Viewer_ja.properties index 983a72dcb..983a72dcb 100644 --- a/src/java/org/apache/fop/render/awt/viewer/resources/Viewer_ja.properties +++ b/src/main/java/org/apache/fop/render/awt/viewer/resources/Viewer_ja.properties diff --git a/src/java/org/apache/fop/render/awt/viewer/resources/Viewer_pl.properties b/src/main/java/org/apache/fop/render/awt/viewer/resources/Viewer_pl.properties index 63bf2de9f..63bf2de9f 100644 --- a/src/java/org/apache/fop/render/awt/viewer/resources/Viewer_pl.properties +++ b/src/main/java/org/apache/fop/render/awt/viewer/resources/Viewer_pl.properties diff --git a/src/java/org/apache/fop/render/awt/viewer/resources/Viewer_ru.properties b/src/main/java/org/apache/fop/render/awt/viewer/resources/Viewer_ru.properties index 509f22935..509f22935 100644 --- a/src/java/org/apache/fop/render/awt/viewer/resources/Viewer_ru.properties +++ b/src/main/java/org/apache/fop/render/awt/viewer/resources/Viewer_ru.properties diff --git a/src/java/org/apache/fop/render/awt/viewer/resources/Viewer_tr.properties b/src/main/java/org/apache/fop/render/awt/viewer/resources/Viewer_tr.properties index e87b2e10d..e87b2e10d 100644 --- a/src/java/org/apache/fop/render/awt/viewer/resources/Viewer_tr.properties +++ b/src/main/java/org/apache/fop/render/awt/viewer/resources/Viewer_tr.properties diff --git a/src/java/org/apache/fop/render/bitmap/AbstractBitmapDocumentHandler.java b/src/main/java/org/apache/fop/render/bitmap/AbstractBitmapDocumentHandler.java index 0c8b4bc0e..0c8b4bc0e 100644 --- a/src/java/org/apache/fop/render/bitmap/AbstractBitmapDocumentHandler.java +++ b/src/main/java/org/apache/fop/render/bitmap/AbstractBitmapDocumentHandler.java diff --git a/src/java/org/apache/fop/render/bitmap/BitmapRendererConfig.java b/src/main/java/org/apache/fop/render/bitmap/BitmapRendererConfig.java index 828f41d34..828f41d34 100644 --- a/src/java/org/apache/fop/render/bitmap/BitmapRendererConfig.java +++ b/src/main/java/org/apache/fop/render/bitmap/BitmapRendererConfig.java diff --git a/src/java/org/apache/fop/render/bitmap/BitmapRendererConfigurator.java b/src/main/java/org/apache/fop/render/bitmap/BitmapRendererConfigurator.java index f0e32a9d7..f0e32a9d7 100644 --- a/src/java/org/apache/fop/render/bitmap/BitmapRendererConfigurator.java +++ b/src/main/java/org/apache/fop/render/bitmap/BitmapRendererConfigurator.java diff --git a/src/java/org/apache/fop/render/bitmap/BitmapRendererEventProducer.java b/src/main/java/org/apache/fop/render/bitmap/BitmapRendererEventProducer.java index 54ce46290..54ce46290 100644 --- a/src/java/org/apache/fop/render/bitmap/BitmapRendererEventProducer.java +++ b/src/main/java/org/apache/fop/render/bitmap/BitmapRendererEventProducer.java diff --git a/src/java/org/apache/fop/render/bitmap/BitmapRendererEventProducer.xml b/src/main/java/org/apache/fop/render/bitmap/BitmapRendererEventProducer.xml index e42d52673..e42d52673 100644 --- a/src/java/org/apache/fop/render/bitmap/BitmapRendererEventProducer.xml +++ b/src/main/java/org/apache/fop/render/bitmap/BitmapRendererEventProducer.xml diff --git a/src/java/org/apache/fop/render/bitmap/BitmapRendererOption.java b/src/main/java/org/apache/fop/render/bitmap/BitmapRendererOption.java index d6030b5ac..d6030b5ac 100644 --- a/src/java/org/apache/fop/render/bitmap/BitmapRendererOption.java +++ b/src/main/java/org/apache/fop/render/bitmap/BitmapRendererOption.java diff --git a/src/java/org/apache/fop/render/bitmap/BitmapRenderingSettings.java b/src/main/java/org/apache/fop/render/bitmap/BitmapRenderingSettings.java index 4363f1d5e..4363f1d5e 100644 --- a/src/java/org/apache/fop/render/bitmap/BitmapRenderingSettings.java +++ b/src/main/java/org/apache/fop/render/bitmap/BitmapRenderingSettings.java diff --git a/src/java/org/apache/fop/render/bitmap/MultiFileRenderingUtil.java b/src/main/java/org/apache/fop/render/bitmap/MultiFileRenderingUtil.java index 296b04821..296b04821 100644 --- a/src/java/org/apache/fop/render/bitmap/MultiFileRenderingUtil.java +++ b/src/main/java/org/apache/fop/render/bitmap/MultiFileRenderingUtil.java diff --git a/src/java/org/apache/fop/render/bitmap/PNGDocumentHandler.java b/src/main/java/org/apache/fop/render/bitmap/PNGDocumentHandler.java index c63cd3a4d..c63cd3a4d 100644 --- a/src/java/org/apache/fop/render/bitmap/PNGDocumentHandler.java +++ b/src/main/java/org/apache/fop/render/bitmap/PNGDocumentHandler.java diff --git a/src/java/org/apache/fop/render/bitmap/PNGDocumentHandlerMaker.java b/src/main/java/org/apache/fop/render/bitmap/PNGDocumentHandlerMaker.java index 7f820f71e..7f820f71e 100644 --- a/src/java/org/apache/fop/render/bitmap/PNGDocumentHandlerMaker.java +++ b/src/main/java/org/apache/fop/render/bitmap/PNGDocumentHandlerMaker.java diff --git a/src/java/org/apache/fop/render/bitmap/PNGRenderer.java b/src/main/java/org/apache/fop/render/bitmap/PNGRenderer.java index 623b28618..623b28618 100644 --- a/src/java/org/apache/fop/render/bitmap/PNGRenderer.java +++ b/src/main/java/org/apache/fop/render/bitmap/PNGRenderer.java diff --git a/src/java/org/apache/fop/render/bitmap/PNGRendererConfig.java b/src/main/java/org/apache/fop/render/bitmap/PNGRendererConfig.java index 699faea51..699faea51 100644 --- a/src/java/org/apache/fop/render/bitmap/PNGRendererConfig.java +++ b/src/main/java/org/apache/fop/render/bitmap/PNGRendererConfig.java diff --git a/src/java/org/apache/fop/render/bitmap/PNGRendererMaker.java b/src/main/java/org/apache/fop/render/bitmap/PNGRendererMaker.java index fb38b61f6..fb38b61f6 100644 --- a/src/java/org/apache/fop/render/bitmap/PNGRendererMaker.java +++ b/src/main/java/org/apache/fop/render/bitmap/PNGRendererMaker.java diff --git a/src/java/org/apache/fop/render/bitmap/TIFFCompressionValue.java b/src/main/java/org/apache/fop/render/bitmap/TIFFCompressionValue.java index 4e9c3bd26..4e9c3bd26 100644 --- a/src/java/org/apache/fop/render/bitmap/TIFFCompressionValue.java +++ b/src/main/java/org/apache/fop/render/bitmap/TIFFCompressionValue.java diff --git a/src/java/org/apache/fop/render/bitmap/TIFFDocumentHandler.java b/src/main/java/org/apache/fop/render/bitmap/TIFFDocumentHandler.java index 48e79520f..48e79520f 100644 --- a/src/java/org/apache/fop/render/bitmap/TIFFDocumentHandler.java +++ b/src/main/java/org/apache/fop/render/bitmap/TIFFDocumentHandler.java diff --git a/src/java/org/apache/fop/render/bitmap/TIFFDocumentHandlerMaker.java b/src/main/java/org/apache/fop/render/bitmap/TIFFDocumentHandlerMaker.java index ab8c7306a..ab8c7306a 100644 --- a/src/java/org/apache/fop/render/bitmap/TIFFDocumentHandlerMaker.java +++ b/src/main/java/org/apache/fop/render/bitmap/TIFFDocumentHandlerMaker.java diff --git a/src/java/org/apache/fop/render/bitmap/TIFFRenderer.java b/src/main/java/org/apache/fop/render/bitmap/TIFFRenderer.java index 442660c3b..442660c3b 100644 --- a/src/java/org/apache/fop/render/bitmap/TIFFRenderer.java +++ b/src/main/java/org/apache/fop/render/bitmap/TIFFRenderer.java diff --git a/src/java/org/apache/fop/render/bitmap/TIFFRendererConfig.java b/src/main/java/org/apache/fop/render/bitmap/TIFFRendererConfig.java index f2535d456..f2535d456 100644 --- a/src/java/org/apache/fop/render/bitmap/TIFFRendererConfig.java +++ b/src/main/java/org/apache/fop/render/bitmap/TIFFRendererConfig.java diff --git a/src/java/org/apache/fop/render/bitmap/TIFFRendererConfigurator.java b/src/main/java/org/apache/fop/render/bitmap/TIFFRendererConfigurator.java index fb24fa7bf..fb24fa7bf 100644 --- a/src/java/org/apache/fop/render/bitmap/TIFFRendererConfigurator.java +++ b/src/main/java/org/apache/fop/render/bitmap/TIFFRendererConfigurator.java diff --git a/src/java/org/apache/fop/render/bitmap/TIFFRendererMaker.java b/src/main/java/org/apache/fop/render/bitmap/TIFFRendererMaker.java index f4cb78285..f4cb78285 100644 --- a/src/java/org/apache/fop/render/bitmap/TIFFRendererMaker.java +++ b/src/main/java/org/apache/fop/render/bitmap/TIFFRendererMaker.java diff --git a/src/java/org/apache/fop/render/bitmap/package.html b/src/main/java/org/apache/fop/render/bitmap/package.html index c5fe901bd..c5fe901bd 100644 --- a/src/java/org/apache/fop/render/bitmap/package.html +++ b/src/main/java/org/apache/fop/render/bitmap/package.html diff --git a/src/java/org/apache/fop/render/extensions/prepress/PageBoundaries.java b/src/main/java/org/apache/fop/render/extensions/prepress/PageBoundaries.java index 8001e1fc2..8001e1fc2 100644 --- a/src/java/org/apache/fop/render/extensions/prepress/PageBoundaries.java +++ b/src/main/java/org/apache/fop/render/extensions/prepress/PageBoundaries.java diff --git a/src/java/org/apache/fop/render/extensions/prepress/PageScale.java b/src/main/java/org/apache/fop/render/extensions/prepress/PageScale.java index 361423753..361423753 100644 --- a/src/java/org/apache/fop/render/extensions/prepress/PageScale.java +++ b/src/main/java/org/apache/fop/render/extensions/prepress/PageScale.java diff --git a/src/java/org/apache/fop/render/gradient/Function.java b/src/main/java/org/apache/fop/render/gradient/Function.java index 848b1cdb7..848b1cdb7 100644 --- a/src/java/org/apache/fop/render/gradient/Function.java +++ b/src/main/java/org/apache/fop/render/gradient/Function.java diff --git a/src/java/org/apache/fop/render/gradient/GradientMaker.java b/src/main/java/org/apache/fop/render/gradient/GradientMaker.java index 3c847a843..3c847a843 100644 --- a/src/java/org/apache/fop/render/gradient/GradientMaker.java +++ b/src/main/java/org/apache/fop/render/gradient/GradientMaker.java diff --git a/src/java/org/apache/fop/render/gradient/Pattern.java b/src/main/java/org/apache/fop/render/gradient/Pattern.java index eb473e922..eb473e922 100644 --- a/src/java/org/apache/fop/render/gradient/Pattern.java +++ b/src/main/java/org/apache/fop/render/gradient/Pattern.java diff --git a/src/java/org/apache/fop/render/gradient/Shading.java b/src/main/java/org/apache/fop/render/gradient/Shading.java index 843081b4a..843081b4a 100644 --- a/src/java/org/apache/fop/render/gradient/Shading.java +++ b/src/main/java/org/apache/fop/render/gradient/Shading.java diff --git a/src/java/org/apache/fop/render/intermediate/AbstractBinaryWritingIFDocumentHandler.java b/src/main/java/org/apache/fop/render/intermediate/AbstractBinaryWritingIFDocumentHandler.java index e0ee5b3b3..e0ee5b3b3 100644 --- a/src/java/org/apache/fop/render/intermediate/AbstractBinaryWritingIFDocumentHandler.java +++ b/src/main/java/org/apache/fop/render/intermediate/AbstractBinaryWritingIFDocumentHandler.java diff --git a/src/java/org/apache/fop/render/intermediate/AbstractIFDocumentHandler.java b/src/main/java/org/apache/fop/render/intermediate/AbstractIFDocumentHandler.java index 0a949e777..0a949e777 100644 --- a/src/java/org/apache/fop/render/intermediate/AbstractIFDocumentHandler.java +++ b/src/main/java/org/apache/fop/render/intermediate/AbstractIFDocumentHandler.java diff --git a/src/java/org/apache/fop/render/intermediate/AbstractIFDocumentHandlerMaker.java b/src/main/java/org/apache/fop/render/intermediate/AbstractIFDocumentHandlerMaker.java index 610f522c2..610f522c2 100644 --- a/src/java/org/apache/fop/render/intermediate/AbstractIFDocumentHandlerMaker.java +++ b/src/main/java/org/apache/fop/render/intermediate/AbstractIFDocumentHandlerMaker.java diff --git a/src/java/org/apache/fop/render/intermediate/AbstractIFPainter.java b/src/main/java/org/apache/fop/render/intermediate/AbstractIFPainter.java index 929d786ea..929d786ea 100644 --- a/src/java/org/apache/fop/render/intermediate/AbstractIFPainter.java +++ b/src/main/java/org/apache/fop/render/intermediate/AbstractIFPainter.java diff --git a/src/java/org/apache/fop/render/intermediate/AbstractXMLWritingIFDocumentHandler.java b/src/main/java/org/apache/fop/render/intermediate/AbstractXMLWritingIFDocumentHandler.java index 0c3305797..0c3305797 100644 --- a/src/java/org/apache/fop/render/intermediate/AbstractXMLWritingIFDocumentHandler.java +++ b/src/main/java/org/apache/fop/render/intermediate/AbstractXMLWritingIFDocumentHandler.java diff --git a/src/java/org/apache/fop/render/intermediate/AffineTransformArrayParser.java b/src/main/java/org/apache/fop/render/intermediate/AffineTransformArrayParser.java index acbe1a793..acbe1a793 100644 --- a/src/java/org/apache/fop/render/intermediate/AffineTransformArrayParser.java +++ b/src/main/java/org/apache/fop/render/intermediate/AffineTransformArrayParser.java diff --git a/src/java/org/apache/fop/render/intermediate/ArcToBezierCurveTransformer.java b/src/main/java/org/apache/fop/render/intermediate/ArcToBezierCurveTransformer.java index 112808f62..112808f62 100644 --- a/src/java/org/apache/fop/render/intermediate/ArcToBezierCurveTransformer.java +++ b/src/main/java/org/apache/fop/render/intermediate/ArcToBezierCurveTransformer.java diff --git a/src/java/org/apache/fop/render/intermediate/BezierCurvePainter.java b/src/main/java/org/apache/fop/render/intermediate/BezierCurvePainter.java index dd28dd5c8..dd28dd5c8 100644 --- a/src/java/org/apache/fop/render/intermediate/BezierCurvePainter.java +++ b/src/main/java/org/apache/fop/render/intermediate/BezierCurvePainter.java diff --git a/src/java/org/apache/fop/render/intermediate/BorderPainter.java b/src/main/java/org/apache/fop/render/intermediate/BorderPainter.java index 1ec127f83..1ec127f83 100644 --- a/src/java/org/apache/fop/render/intermediate/BorderPainter.java +++ b/src/main/java/org/apache/fop/render/intermediate/BorderPainter.java diff --git a/src/java/org/apache/fop/render/intermediate/DelegatingFragmentContentHandler.java b/src/main/java/org/apache/fop/render/intermediate/DelegatingFragmentContentHandler.java index a0065d655..a0065d655 100644 --- a/src/java/org/apache/fop/render/intermediate/DelegatingFragmentContentHandler.java +++ b/src/main/java/org/apache/fop/render/intermediate/DelegatingFragmentContentHandler.java diff --git a/src/java/org/apache/fop/render/intermediate/EventProducingFilter.java b/src/main/java/org/apache/fop/render/intermediate/EventProducingFilter.java index 36f518d9a..36f518d9a 100644 --- a/src/java/org/apache/fop/render/intermediate/EventProducingFilter.java +++ b/src/main/java/org/apache/fop/render/intermediate/EventProducingFilter.java diff --git a/src/java/org/apache/fop/render/intermediate/GraphicsPainter.java b/src/main/java/org/apache/fop/render/intermediate/GraphicsPainter.java index 369cacd43..369cacd43 100644 --- a/src/java/org/apache/fop/render/intermediate/GraphicsPainter.java +++ b/src/main/java/org/apache/fop/render/intermediate/GraphicsPainter.java diff --git a/src/java/org/apache/fop/render/intermediate/IFConstants.java b/src/main/java/org/apache/fop/render/intermediate/IFConstants.java index c7bf13e31..c7bf13e31 100644 --- a/src/java/org/apache/fop/render/intermediate/IFConstants.java +++ b/src/main/java/org/apache/fop/render/intermediate/IFConstants.java diff --git a/src/java/org/apache/fop/render/intermediate/IFContentHandler.java b/src/main/java/org/apache/fop/render/intermediate/IFContentHandler.java index ac7feb269..ac7feb269 100644 --- a/src/java/org/apache/fop/render/intermediate/IFContentHandler.java +++ b/src/main/java/org/apache/fop/render/intermediate/IFContentHandler.java diff --git a/src/java/org/apache/fop/render/intermediate/IFContext.java b/src/main/java/org/apache/fop/render/intermediate/IFContext.java index 0edb94c4b..0edb94c4b 100644 --- a/src/java/org/apache/fop/render/intermediate/IFContext.java +++ b/src/main/java/org/apache/fop/render/intermediate/IFContext.java diff --git a/src/java/org/apache/fop/render/intermediate/IFDocumentHandler.java b/src/main/java/org/apache/fop/render/intermediate/IFDocumentHandler.java index 5342f09aa..5342f09aa 100644 --- a/src/java/org/apache/fop/render/intermediate/IFDocumentHandler.java +++ b/src/main/java/org/apache/fop/render/intermediate/IFDocumentHandler.java diff --git a/src/java/org/apache/fop/render/intermediate/IFDocumentHandlerConfigurator.java b/src/main/java/org/apache/fop/render/intermediate/IFDocumentHandlerConfigurator.java index a55f42e9d..a55f42e9d 100644 --- a/src/java/org/apache/fop/render/intermediate/IFDocumentHandlerConfigurator.java +++ b/src/main/java/org/apache/fop/render/intermediate/IFDocumentHandlerConfigurator.java diff --git a/src/java/org/apache/fop/render/intermediate/IFDocumentNavigationHandler.java b/src/main/java/org/apache/fop/render/intermediate/IFDocumentNavigationHandler.java index 09a641ce2..09a641ce2 100644 --- a/src/java/org/apache/fop/render/intermediate/IFDocumentNavigationHandler.java +++ b/src/main/java/org/apache/fop/render/intermediate/IFDocumentNavigationHandler.java diff --git a/src/java/org/apache/fop/render/intermediate/IFException.java b/src/main/java/org/apache/fop/render/intermediate/IFException.java index 5f35c3e3a..5f35c3e3a 100644 --- a/src/java/org/apache/fop/render/intermediate/IFException.java +++ b/src/main/java/org/apache/fop/render/intermediate/IFException.java diff --git a/src/java/org/apache/fop/render/intermediate/IFGraphicContext.java b/src/main/java/org/apache/fop/render/intermediate/IFGraphicContext.java index 16471fe9c..16471fe9c 100644 --- a/src/java/org/apache/fop/render/intermediate/IFGraphicContext.java +++ b/src/main/java/org/apache/fop/render/intermediate/IFGraphicContext.java diff --git a/src/java/org/apache/fop/render/intermediate/IFPainter.java b/src/main/java/org/apache/fop/render/intermediate/IFPainter.java index d43b5cb85..d43b5cb85 100644 --- a/src/java/org/apache/fop/render/intermediate/IFPainter.java +++ b/src/main/java/org/apache/fop/render/intermediate/IFPainter.java diff --git a/src/java/org/apache/fop/render/intermediate/IFParser.java b/src/main/java/org/apache/fop/render/intermediate/IFParser.java index 8d562e465..8d562e465 100644 --- a/src/java/org/apache/fop/render/intermediate/IFParser.java +++ b/src/main/java/org/apache/fop/render/intermediate/IFParser.java diff --git a/src/java/org/apache/fop/render/intermediate/IFRenderer.java b/src/main/java/org/apache/fop/render/intermediate/IFRenderer.java index f2eae9ae1..f2eae9ae1 100644 --- a/src/java/org/apache/fop/render/intermediate/IFRenderer.java +++ b/src/main/java/org/apache/fop/render/intermediate/IFRenderer.java diff --git a/src/java/org/apache/fop/render/intermediate/IFRendererConfig.java b/src/main/java/org/apache/fop/render/intermediate/IFRendererConfig.java index 753d9ff30..753d9ff30 100644 --- a/src/java/org/apache/fop/render/intermediate/IFRendererConfig.java +++ b/src/main/java/org/apache/fop/render/intermediate/IFRendererConfig.java diff --git a/src/java/org/apache/fop/render/intermediate/IFSerializer.java b/src/main/java/org/apache/fop/render/intermediate/IFSerializer.java index 395e79719..395e79719 100644 --- a/src/java/org/apache/fop/render/intermediate/IFSerializer.java +++ b/src/main/java/org/apache/fop/render/intermediate/IFSerializer.java diff --git a/src/java/org/apache/fop/render/intermediate/IFSerializerMaker.java b/src/main/java/org/apache/fop/render/intermediate/IFSerializerMaker.java index fa375fb94..fa375fb94 100644 --- a/src/java/org/apache/fop/render/intermediate/IFSerializerMaker.java +++ b/src/main/java/org/apache/fop/render/intermediate/IFSerializerMaker.java diff --git a/src/java/org/apache/fop/render/intermediate/IFState.java b/src/main/java/org/apache/fop/render/intermediate/IFState.java index 4d8325d3e..4d8325d3e 100644 --- a/src/java/org/apache/fop/render/intermediate/IFState.java +++ b/src/main/java/org/apache/fop/render/intermediate/IFState.java diff --git a/src/java/org/apache/fop/render/intermediate/IFStructureTreeBuilder.java b/src/main/java/org/apache/fop/render/intermediate/IFStructureTreeBuilder.java index f7049997e..f7049997e 100644 --- a/src/java/org/apache/fop/render/intermediate/IFStructureTreeBuilder.java +++ b/src/main/java/org/apache/fop/render/intermediate/IFStructureTreeBuilder.java diff --git a/src/java/org/apache/fop/render/intermediate/IFUtil.java b/src/main/java/org/apache/fop/render/intermediate/IFUtil.java index a534ca729..a534ca729 100644 --- a/src/java/org/apache/fop/render/intermediate/IFUtil.java +++ b/src/main/java/org/apache/fop/render/intermediate/IFUtil.java diff --git a/src/java/org/apache/fop/render/intermediate/extensions/AbstractAction.java b/src/main/java/org/apache/fop/render/intermediate/extensions/AbstractAction.java index a2595d320..a2595d320 100644 --- a/src/java/org/apache/fop/render/intermediate/extensions/AbstractAction.java +++ b/src/main/java/org/apache/fop/render/intermediate/extensions/AbstractAction.java diff --git a/src/java/org/apache/fop/render/intermediate/extensions/ActionSet.java b/src/main/java/org/apache/fop/render/intermediate/extensions/ActionSet.java index 080a33a81..080a33a81 100644 --- a/src/java/org/apache/fop/render/intermediate/extensions/ActionSet.java +++ b/src/main/java/org/apache/fop/render/intermediate/extensions/ActionSet.java diff --git a/src/java/org/apache/fop/render/intermediate/extensions/Bookmark.java b/src/main/java/org/apache/fop/render/intermediate/extensions/Bookmark.java index 5921ae676..5921ae676 100644 --- a/src/java/org/apache/fop/render/intermediate/extensions/Bookmark.java +++ b/src/main/java/org/apache/fop/render/intermediate/extensions/Bookmark.java diff --git a/src/java/org/apache/fop/render/intermediate/extensions/BookmarkTree.java b/src/main/java/org/apache/fop/render/intermediate/extensions/BookmarkTree.java index e9fc6bf95..e9fc6bf95 100644 --- a/src/java/org/apache/fop/render/intermediate/extensions/BookmarkTree.java +++ b/src/main/java/org/apache/fop/render/intermediate/extensions/BookmarkTree.java diff --git a/src/java/org/apache/fop/render/intermediate/extensions/DocumentNavigationExtensionConstants.java b/src/main/java/org/apache/fop/render/intermediate/extensions/DocumentNavigationExtensionConstants.java index b5e767bb2..b5e767bb2 100644 --- a/src/java/org/apache/fop/render/intermediate/extensions/DocumentNavigationExtensionConstants.java +++ b/src/main/java/org/apache/fop/render/intermediate/extensions/DocumentNavigationExtensionConstants.java diff --git a/src/java/org/apache/fop/render/intermediate/extensions/DocumentNavigationHandler.java b/src/main/java/org/apache/fop/render/intermediate/extensions/DocumentNavigationHandler.java index c174a74a9..c174a74a9 100644 --- a/src/java/org/apache/fop/render/intermediate/extensions/DocumentNavigationHandler.java +++ b/src/main/java/org/apache/fop/render/intermediate/extensions/DocumentNavigationHandler.java diff --git a/src/java/org/apache/fop/render/intermediate/extensions/GoToXYAction.java b/src/main/java/org/apache/fop/render/intermediate/extensions/GoToXYAction.java index 4bd548c73..4bd548c73 100644 --- a/src/java/org/apache/fop/render/intermediate/extensions/GoToXYAction.java +++ b/src/main/java/org/apache/fop/render/intermediate/extensions/GoToXYAction.java diff --git a/src/java/org/apache/fop/render/intermediate/extensions/Link.java b/src/main/java/org/apache/fop/render/intermediate/extensions/Link.java index 8e1558d55..8e1558d55 100644 --- a/src/java/org/apache/fop/render/intermediate/extensions/Link.java +++ b/src/main/java/org/apache/fop/render/intermediate/extensions/Link.java diff --git a/src/java/org/apache/fop/render/intermediate/extensions/NamedDestination.java b/src/main/java/org/apache/fop/render/intermediate/extensions/NamedDestination.java index 836d8abe0..836d8abe0 100644 --- a/src/java/org/apache/fop/render/intermediate/extensions/NamedDestination.java +++ b/src/main/java/org/apache/fop/render/intermediate/extensions/NamedDestination.java diff --git a/src/java/org/apache/fop/render/intermediate/extensions/URIAction.java b/src/main/java/org/apache/fop/render/intermediate/extensions/URIAction.java index 22e7a270c..22e7a270c 100644 --- a/src/java/org/apache/fop/render/intermediate/extensions/URIAction.java +++ b/src/main/java/org/apache/fop/render/intermediate/extensions/URIAction.java diff --git a/src/java/org/apache/fop/render/intermediate/util/IFConcatenator.java b/src/main/java/org/apache/fop/render/intermediate/util/IFConcatenator.java index b4b08cc42..b4b08cc42 100644 --- a/src/java/org/apache/fop/render/intermediate/util/IFConcatenator.java +++ b/src/main/java/org/apache/fop/render/intermediate/util/IFConcatenator.java diff --git a/src/java/org/apache/fop/render/intermediate/util/IFDocumentHandlerProxy.java b/src/main/java/org/apache/fop/render/intermediate/util/IFDocumentHandlerProxy.java index b88e75206..b88e75206 100644 --- a/src/java/org/apache/fop/render/intermediate/util/IFDocumentHandlerProxy.java +++ b/src/main/java/org/apache/fop/render/intermediate/util/IFDocumentHandlerProxy.java diff --git a/src/java/org/apache/fop/render/java2d/Base14FontCollection.java b/src/main/java/org/apache/fop/render/java2d/Base14FontCollection.java index b9b6d12e6..b9b6d12e6 100644 --- a/src/java/org/apache/fop/render/java2d/Base14FontCollection.java +++ b/src/main/java/org/apache/fop/render/java2d/Base14FontCollection.java diff --git a/src/java/org/apache/fop/render/java2d/ConfiguredFontCollection.java b/src/main/java/org/apache/fop/render/java2d/ConfiguredFontCollection.java index c6f02506e..c6f02506e 100644 --- a/src/java/org/apache/fop/render/java2d/ConfiguredFontCollection.java +++ b/src/main/java/org/apache/fop/render/java2d/ConfiguredFontCollection.java diff --git a/src/java/org/apache/fop/render/java2d/CustomFontMetricsMapper.java b/src/main/java/org/apache/fop/render/java2d/CustomFontMetricsMapper.java index c7f5da116..c7f5da116 100644 --- a/src/java/org/apache/fop/render/java2d/CustomFontMetricsMapper.java +++ b/src/main/java/org/apache/fop/render/java2d/CustomFontMetricsMapper.java diff --git a/src/java/org/apache/fop/render/java2d/FontMetricsMapper.java b/src/main/java/org/apache/fop/render/java2d/FontMetricsMapper.java index 806a07d6c..806a07d6c 100644 --- a/src/java/org/apache/fop/render/java2d/FontMetricsMapper.java +++ b/src/main/java/org/apache/fop/render/java2d/FontMetricsMapper.java diff --git a/src/java/org/apache/fop/render/java2d/InstalledFontCollection.java b/src/main/java/org/apache/fop/render/java2d/InstalledFontCollection.java index afb22a883..afb22a883 100644 --- a/src/java/org/apache/fop/render/java2d/InstalledFontCollection.java +++ b/src/main/java/org/apache/fop/render/java2d/InstalledFontCollection.java diff --git a/src/java/org/apache/fop/render/java2d/Java2DDocumentHandler.java b/src/main/java/org/apache/fop/render/java2d/Java2DDocumentHandler.java index 87003f077..87003f077 100644 --- a/src/java/org/apache/fop/render/java2d/Java2DDocumentHandler.java +++ b/src/main/java/org/apache/fop/render/java2d/Java2DDocumentHandler.java diff --git a/src/java/org/apache/fop/render/java2d/Java2DFontMetrics.java b/src/main/java/org/apache/fop/render/java2d/Java2DFontMetrics.java index e7f6d989f..e7f6d989f 100644 --- a/src/java/org/apache/fop/render/java2d/Java2DFontMetrics.java +++ b/src/main/java/org/apache/fop/render/java2d/Java2DFontMetrics.java diff --git a/src/java/org/apache/fop/render/java2d/Java2DGraphics2DAdapter.java b/src/main/java/org/apache/fop/render/java2d/Java2DGraphics2DAdapter.java index f136a046f..f136a046f 100644 --- a/src/java/org/apache/fop/render/java2d/Java2DGraphics2DAdapter.java +++ b/src/main/java/org/apache/fop/render/java2d/Java2DGraphics2DAdapter.java diff --git a/src/java/org/apache/fop/render/java2d/Java2DGraphicsPainter.java b/src/main/java/org/apache/fop/render/java2d/Java2DGraphicsPainter.java index c3bf523d3..c3bf523d3 100644 --- a/src/java/org/apache/fop/render/java2d/Java2DGraphicsPainter.java +++ b/src/main/java/org/apache/fop/render/java2d/Java2DGraphicsPainter.java diff --git a/src/java/org/apache/fop/render/java2d/Java2DGraphicsState.java b/src/main/java/org/apache/fop/render/java2d/Java2DGraphicsState.java index 70fe0b449..70fe0b449 100644 --- a/src/java/org/apache/fop/render/java2d/Java2DGraphicsState.java +++ b/src/main/java/org/apache/fop/render/java2d/Java2DGraphicsState.java diff --git a/src/java/org/apache/fop/render/java2d/Java2DImageHandlerGraphics2D.java b/src/main/java/org/apache/fop/render/java2d/Java2DImageHandlerGraphics2D.java index 63dce094d..63dce094d 100644 --- a/src/java/org/apache/fop/render/java2d/Java2DImageHandlerGraphics2D.java +++ b/src/main/java/org/apache/fop/render/java2d/Java2DImageHandlerGraphics2D.java diff --git a/src/java/org/apache/fop/render/java2d/Java2DImageHandlerRenderedImage.java b/src/main/java/org/apache/fop/render/java2d/Java2DImageHandlerRenderedImage.java index 4bdd52162..4bdd52162 100644 --- a/src/java/org/apache/fop/render/java2d/Java2DImageHandlerRenderedImage.java +++ b/src/main/java/org/apache/fop/render/java2d/Java2DImageHandlerRenderedImage.java diff --git a/src/java/org/apache/fop/render/java2d/Java2DPainter.java b/src/main/java/org/apache/fop/render/java2d/Java2DPainter.java index 06f67e75b..06f67e75b 100644 --- a/src/java/org/apache/fop/render/java2d/Java2DPainter.java +++ b/src/main/java/org/apache/fop/render/java2d/Java2DPainter.java diff --git a/src/java/org/apache/fop/render/java2d/Java2DRenderer.java b/src/main/java/org/apache/fop/render/java2d/Java2DRenderer.java index 75957c396..75957c396 100644 --- a/src/java/org/apache/fop/render/java2d/Java2DRenderer.java +++ b/src/main/java/org/apache/fop/render/java2d/Java2DRenderer.java diff --git a/src/java/org/apache/fop/render/java2d/Java2DRendererConfig.java b/src/main/java/org/apache/fop/render/java2d/Java2DRendererConfig.java index 1ed0aec96..1ed0aec96 100644 --- a/src/java/org/apache/fop/render/java2d/Java2DRendererConfig.java +++ b/src/main/java/org/apache/fop/render/java2d/Java2DRendererConfig.java diff --git a/src/java/org/apache/fop/render/java2d/Java2DRendererConfigurator.java b/src/main/java/org/apache/fop/render/java2d/Java2DRendererConfigurator.java index 9ff2ccdbd..9ff2ccdbd 100644 --- a/src/java/org/apache/fop/render/java2d/Java2DRendererConfigurator.java +++ b/src/main/java/org/apache/fop/render/java2d/Java2DRendererConfigurator.java diff --git a/src/java/org/apache/fop/render/java2d/Java2DRendererContextConstants.java b/src/main/java/org/apache/fop/render/java2d/Java2DRendererContextConstants.java index 0157b7411..0157b7411 100644 --- a/src/java/org/apache/fop/render/java2d/Java2DRendererContextConstants.java +++ b/src/main/java/org/apache/fop/render/java2d/Java2DRendererContextConstants.java diff --git a/src/java/org/apache/fop/render/java2d/Java2DRendererOption.java b/src/main/java/org/apache/fop/render/java2d/Java2DRendererOption.java index b25f05889..b25f05889 100644 --- a/src/java/org/apache/fop/render/java2d/Java2DRendererOption.java +++ b/src/main/java/org/apache/fop/render/java2d/Java2DRendererOption.java diff --git a/src/java/org/apache/fop/render/java2d/Java2DRenderingContext.java b/src/main/java/org/apache/fop/render/java2d/Java2DRenderingContext.java index 86655434f..86655434f 100644 --- a/src/java/org/apache/fop/render/java2d/Java2DRenderingContext.java +++ b/src/main/java/org/apache/fop/render/java2d/Java2DRenderingContext.java diff --git a/src/java/org/apache/fop/render/java2d/Java2DRenderingSettings.java b/src/main/java/org/apache/fop/render/java2d/Java2DRenderingSettings.java index 06ea8a3cf..06ea8a3cf 100644 --- a/src/java/org/apache/fop/render/java2d/Java2DRenderingSettings.java +++ b/src/main/java/org/apache/fop/render/java2d/Java2DRenderingSettings.java diff --git a/src/java/org/apache/fop/render/java2d/Java2DSVGHandler.java b/src/main/java/org/apache/fop/render/java2d/Java2DSVGHandler.java index b4347070d..b4347070d 100644 --- a/src/java/org/apache/fop/render/java2d/Java2DSVGHandler.java +++ b/src/main/java/org/apache/fop/render/java2d/Java2DSVGHandler.java diff --git a/src/java/org/apache/fop/render/java2d/Java2DUtil.java b/src/main/java/org/apache/fop/render/java2d/Java2DUtil.java index c17ad2994..c17ad2994 100644 --- a/src/java/org/apache/fop/render/java2d/Java2DUtil.java +++ b/src/main/java/org/apache/fop/render/java2d/Java2DUtil.java diff --git a/src/java/org/apache/fop/render/java2d/SystemFontMetricsMapper.java b/src/main/java/org/apache/fop/render/java2d/SystemFontMetricsMapper.java index 9ed323ac4..9ed323ac4 100644 --- a/src/java/org/apache/fop/render/java2d/SystemFontMetricsMapper.java +++ b/src/main/java/org/apache/fop/render/java2d/SystemFontMetricsMapper.java diff --git a/src/java/org/apache/fop/render/java2d/package.html b/src/main/java/org/apache/fop/render/java2d/package.html index 7b3fc921c..7b3fc921c 100644 --- a/src/java/org/apache/fop/render/java2d/package.html +++ b/src/main/java/org/apache/fop/render/java2d/package.html diff --git a/src/java/org/apache/fop/render/package.html b/src/main/java/org/apache/fop/render/package.html index 22671f054..22671f054 100644 --- a/src/java/org/apache/fop/render/package.html +++ b/src/main/java/org/apache/fop/render/package.html diff --git a/src/java/org/apache/fop/render/pcl/HardcodedFonts.java b/src/main/java/org/apache/fop/render/pcl/HardcodedFonts.java index 82e622098..82e622098 100644 --- a/src/java/org/apache/fop/render/pcl/HardcodedFonts.java +++ b/src/main/java/org/apache/fop/render/pcl/HardcodedFonts.java diff --git a/src/java/org/apache/fop/render/pcl/Java2DRendererOption.java b/src/main/java/org/apache/fop/render/pcl/Java2DRendererOption.java index 9ec0b779b..9ec0b779b 100644 --- a/src/java/org/apache/fop/render/pcl/Java2DRendererOption.java +++ b/src/main/java/org/apache/fop/render/pcl/Java2DRendererOption.java diff --git a/src/java/org/apache/fop/render/pcl/PCLConstants.java b/src/main/java/org/apache/fop/render/pcl/PCLConstants.java index 28532053b..28532053b 100644 --- a/src/java/org/apache/fop/render/pcl/PCLConstants.java +++ b/src/main/java/org/apache/fop/render/pcl/PCLConstants.java diff --git a/src/java/org/apache/fop/render/pcl/PCLDocumentHandler.java b/src/main/java/org/apache/fop/render/pcl/PCLDocumentHandler.java index 66655a721..66655a721 100644 --- a/src/java/org/apache/fop/render/pcl/PCLDocumentHandler.java +++ b/src/main/java/org/apache/fop/render/pcl/PCLDocumentHandler.java diff --git a/src/java/org/apache/fop/render/pcl/PCLDocumentHandlerMaker.java b/src/main/java/org/apache/fop/render/pcl/PCLDocumentHandlerMaker.java index affe2abae..affe2abae 100644 --- a/src/java/org/apache/fop/render/pcl/PCLDocumentHandlerMaker.java +++ b/src/main/java/org/apache/fop/render/pcl/PCLDocumentHandlerMaker.java diff --git a/src/java/org/apache/fop/render/pcl/PCLEventProducer.java b/src/main/java/org/apache/fop/render/pcl/PCLEventProducer.java index 3a8a1de55..3a8a1de55 100644 --- a/src/java/org/apache/fop/render/pcl/PCLEventProducer.java +++ b/src/main/java/org/apache/fop/render/pcl/PCLEventProducer.java diff --git a/src/java/org/apache/fop/render/pcl/PCLEventProducer.xml b/src/main/java/org/apache/fop/render/pcl/PCLEventProducer.xml index 463fcb16a..463fcb16a 100644 --- a/src/java/org/apache/fop/render/pcl/PCLEventProducer.xml +++ b/src/main/java/org/apache/fop/render/pcl/PCLEventProducer.xml diff --git a/src/java/org/apache/fop/render/pcl/PCLGenerator.java b/src/main/java/org/apache/fop/render/pcl/PCLGenerator.java index 589779ad9..589779ad9 100644 --- a/src/java/org/apache/fop/render/pcl/PCLGenerator.java +++ b/src/main/java/org/apache/fop/render/pcl/PCLGenerator.java diff --git a/src/java/org/apache/fop/render/pcl/PCLGraphics2D.java b/src/main/java/org/apache/fop/render/pcl/PCLGraphics2D.java index d349394c5..d349394c5 100644 --- a/src/java/org/apache/fop/render/pcl/PCLGraphics2D.java +++ b/src/main/java/org/apache/fop/render/pcl/PCLGraphics2D.java diff --git a/src/java/org/apache/fop/render/pcl/PCLImageHandlerGraphics2D.java b/src/main/java/org/apache/fop/render/pcl/PCLImageHandlerGraphics2D.java index 66336955e..66336955e 100644 --- a/src/java/org/apache/fop/render/pcl/PCLImageHandlerGraphics2D.java +++ b/src/main/java/org/apache/fop/render/pcl/PCLImageHandlerGraphics2D.java diff --git a/src/java/org/apache/fop/render/pcl/PCLImageHandlerRenderedImage.java b/src/main/java/org/apache/fop/render/pcl/PCLImageHandlerRenderedImage.java index aabb9c5ac..aabb9c5ac 100644 --- a/src/java/org/apache/fop/render/pcl/PCLImageHandlerRenderedImage.java +++ b/src/main/java/org/apache/fop/render/pcl/PCLImageHandlerRenderedImage.java diff --git a/src/java/org/apache/fop/render/pcl/PCLPageDefinition.java b/src/main/java/org/apache/fop/render/pcl/PCLPageDefinition.java index 3e577cfa0..3e577cfa0 100644 --- a/src/java/org/apache/fop/render/pcl/PCLPageDefinition.java +++ b/src/main/java/org/apache/fop/render/pcl/PCLPageDefinition.java diff --git a/src/java/org/apache/fop/render/pcl/PCLPainter.java b/src/main/java/org/apache/fop/render/pcl/PCLPainter.java index 65e996d08..65e996d08 100644 --- a/src/java/org/apache/fop/render/pcl/PCLPainter.java +++ b/src/main/java/org/apache/fop/render/pcl/PCLPainter.java diff --git a/src/java/org/apache/fop/render/pcl/PCLRendererConfig.java b/src/main/java/org/apache/fop/render/pcl/PCLRendererConfig.java index 05e72b00e..05e72b00e 100644 --- a/src/java/org/apache/fop/render/pcl/PCLRendererConfig.java +++ b/src/main/java/org/apache/fop/render/pcl/PCLRendererConfig.java diff --git a/src/java/org/apache/fop/render/pcl/PCLRendererConfigurator.java b/src/main/java/org/apache/fop/render/pcl/PCLRendererConfigurator.java index 7a92b7408..7a92b7408 100644 --- a/src/java/org/apache/fop/render/pcl/PCLRendererConfigurator.java +++ b/src/main/java/org/apache/fop/render/pcl/PCLRendererConfigurator.java diff --git a/src/java/org/apache/fop/render/pcl/PCLRendererContext.java b/src/main/java/org/apache/fop/render/pcl/PCLRendererContext.java index 9f3d97d7b..9f3d97d7b 100644 --- a/src/java/org/apache/fop/render/pcl/PCLRendererContext.java +++ b/src/main/java/org/apache/fop/render/pcl/PCLRendererContext.java diff --git a/src/java/org/apache/fop/render/pcl/PCLRendererContextConstants.java b/src/main/java/org/apache/fop/render/pcl/PCLRendererContextConstants.java index 66ce40f5e..66ce40f5e 100644 --- a/src/java/org/apache/fop/render/pcl/PCLRendererContextConstants.java +++ b/src/main/java/org/apache/fop/render/pcl/PCLRendererContextConstants.java diff --git a/src/java/org/apache/fop/render/pcl/PCLRenderingContext.java b/src/main/java/org/apache/fop/render/pcl/PCLRenderingContext.java index 5efa6f4fc..5efa6f4fc 100644 --- a/src/java/org/apache/fop/render/pcl/PCLRenderingContext.java +++ b/src/main/java/org/apache/fop/render/pcl/PCLRenderingContext.java diff --git a/src/java/org/apache/fop/render/pcl/PCLRenderingMode.java b/src/main/java/org/apache/fop/render/pcl/PCLRenderingMode.java index afea5a7fe..afea5a7fe 100644 --- a/src/java/org/apache/fop/render/pcl/PCLRenderingMode.java +++ b/src/main/java/org/apache/fop/render/pcl/PCLRenderingMode.java diff --git a/src/java/org/apache/fop/render/pcl/PCLRenderingUtil.java b/src/main/java/org/apache/fop/render/pcl/PCLRenderingUtil.java index 674605bde..674605bde 100644 --- a/src/java/org/apache/fop/render/pcl/PCLRenderingUtil.java +++ b/src/main/java/org/apache/fop/render/pcl/PCLRenderingUtil.java diff --git a/src/java/org/apache/fop/render/pcl/PCLSVGHandler.java b/src/main/java/org/apache/fop/render/pcl/PCLSVGHandler.java index f07a7a7e2..f07a7a7e2 100644 --- a/src/java/org/apache/fop/render/pcl/PCLSVGHandler.java +++ b/src/main/java/org/apache/fop/render/pcl/PCLSVGHandler.java diff --git a/src/java/org/apache/fop/render/pcl/extensions/PCLElementMapping.java b/src/main/java/org/apache/fop/render/pcl/extensions/PCLElementMapping.java index 08f3a5f44..08f3a5f44 100644 --- a/src/java/org/apache/fop/render/pcl/extensions/PCLElementMapping.java +++ b/src/main/java/org/apache/fop/render/pcl/extensions/PCLElementMapping.java diff --git a/src/java/org/apache/fop/render/pcl/fonts/PCLByteWriterUtil.java b/src/main/java/org/apache/fop/render/pcl/fonts/PCLByteWriterUtil.java index 1b9382f7b..1b9382f7b 100644 --- a/src/java/org/apache/fop/render/pcl/fonts/PCLByteWriterUtil.java +++ b/src/main/java/org/apache/fop/render/pcl/fonts/PCLByteWriterUtil.java diff --git a/src/java/org/apache/fop/render/pcl/fonts/PCLCharacterDefinition.java b/src/main/java/org/apache/fop/render/pcl/fonts/PCLCharacterDefinition.java index c275084dc..c275084dc 100644 --- a/src/java/org/apache/fop/render/pcl/fonts/PCLCharacterDefinition.java +++ b/src/main/java/org/apache/fop/render/pcl/fonts/PCLCharacterDefinition.java diff --git a/src/java/org/apache/fop/render/pcl/fonts/PCLCharacterWriter.java b/src/main/java/org/apache/fop/render/pcl/fonts/PCLCharacterWriter.java index df04371e0..df04371e0 100644 --- a/src/java/org/apache/fop/render/pcl/fonts/PCLCharacterWriter.java +++ b/src/main/java/org/apache/fop/render/pcl/fonts/PCLCharacterWriter.java diff --git a/src/java/org/apache/fop/render/pcl/fonts/PCLFontReader.java b/src/main/java/org/apache/fop/render/pcl/fonts/PCLFontReader.java index 6bd5192ac..6bd5192ac 100644 --- a/src/java/org/apache/fop/render/pcl/fonts/PCLFontReader.java +++ b/src/main/java/org/apache/fop/render/pcl/fonts/PCLFontReader.java diff --git a/src/java/org/apache/fop/render/pcl/fonts/PCLFontReaderFactory.java b/src/main/java/org/apache/fop/render/pcl/fonts/PCLFontReaderFactory.java index 15c4e8d54..15c4e8d54 100644 --- a/src/java/org/apache/fop/render/pcl/fonts/PCLFontReaderFactory.java +++ b/src/main/java/org/apache/fop/render/pcl/fonts/PCLFontReaderFactory.java diff --git a/src/java/org/apache/fop/render/pcl/fonts/PCLFontSegment.java b/src/main/java/org/apache/fop/render/pcl/fonts/PCLFontSegment.java index 111dbf932..111dbf932 100644 --- a/src/java/org/apache/fop/render/pcl/fonts/PCLFontSegment.java +++ b/src/main/java/org/apache/fop/render/pcl/fonts/PCLFontSegment.java diff --git a/src/java/org/apache/fop/render/pcl/fonts/PCLSoftFont.java b/src/main/java/org/apache/fop/render/pcl/fonts/PCLSoftFont.java index 8412534eb..8412534eb 100644 --- a/src/java/org/apache/fop/render/pcl/fonts/PCLSoftFont.java +++ b/src/main/java/org/apache/fop/render/pcl/fonts/PCLSoftFont.java diff --git a/src/java/org/apache/fop/render/pcl/fonts/PCLSoftFontManager.java b/src/main/java/org/apache/fop/render/pcl/fonts/PCLSoftFontManager.java index 621ea4f18..621ea4f18 100644 --- a/src/java/org/apache/fop/render/pcl/fonts/PCLSoftFontManager.java +++ b/src/main/java/org/apache/fop/render/pcl/fonts/PCLSoftFontManager.java diff --git a/src/java/org/apache/fop/render/pcl/fonts/PCLSymbolSet.java b/src/main/java/org/apache/fop/render/pcl/fonts/PCLSymbolSet.java index a2c50df23..a2c50df23 100644 --- a/src/java/org/apache/fop/render/pcl/fonts/PCLSymbolSet.java +++ b/src/main/java/org/apache/fop/render/pcl/fonts/PCLSymbolSet.java diff --git a/src/java/org/apache/fop/render/pcl/fonts/truetype/PCLTTFCharacterWriter.java b/src/main/java/org/apache/fop/render/pcl/fonts/truetype/PCLTTFCharacterWriter.java index 41fefaaf0..41fefaaf0 100644 --- a/src/java/org/apache/fop/render/pcl/fonts/truetype/PCLTTFCharacterWriter.java +++ b/src/main/java/org/apache/fop/render/pcl/fonts/truetype/PCLTTFCharacterWriter.java diff --git a/src/java/org/apache/fop/render/pcl/fonts/truetype/PCLTTFFontReader.java b/src/main/java/org/apache/fop/render/pcl/fonts/truetype/PCLTTFFontReader.java index 35e37f23f..35e37f23f 100644 --- a/src/java/org/apache/fop/render/pcl/fonts/truetype/PCLTTFFontReader.java +++ b/src/main/java/org/apache/fop/render/pcl/fonts/truetype/PCLTTFFontReader.java diff --git a/src/java/org/apache/fop/render/pcl/fonts/truetype/PCLTTFOS2FontTable.java b/src/main/java/org/apache/fop/render/pcl/fonts/truetype/PCLTTFOS2FontTable.java index 4c5f98d8b..4c5f98d8b 100644 --- a/src/java/org/apache/fop/render/pcl/fonts/truetype/PCLTTFOS2FontTable.java +++ b/src/main/java/org/apache/fop/render/pcl/fonts/truetype/PCLTTFOS2FontTable.java diff --git a/src/java/org/apache/fop/render/pcl/fonts/truetype/PCLTTFPCLTFontTable.java b/src/main/java/org/apache/fop/render/pcl/fonts/truetype/PCLTTFPCLTFontTable.java index 5be46a4ec..5be46a4ec 100644 --- a/src/java/org/apache/fop/render/pcl/fonts/truetype/PCLTTFPCLTFontTable.java +++ b/src/main/java/org/apache/fop/render/pcl/fonts/truetype/PCLTTFPCLTFontTable.java diff --git a/src/java/org/apache/fop/render/pcl/fonts/truetype/PCLTTFPOSTFontTable.java b/src/main/java/org/apache/fop/render/pcl/fonts/truetype/PCLTTFPOSTFontTable.java index 9995f7f55..9995f7f55 100644 --- a/src/java/org/apache/fop/render/pcl/fonts/truetype/PCLTTFPOSTFontTable.java +++ b/src/main/java/org/apache/fop/render/pcl/fonts/truetype/PCLTTFPOSTFontTable.java diff --git a/src/java/org/apache/fop/render/pcl/fonts/truetype/PCLTTFTable.java b/src/main/java/org/apache/fop/render/pcl/fonts/truetype/PCLTTFTable.java index ea0f5cafb..ea0f5cafb 100644 --- a/src/java/org/apache/fop/render/pcl/fonts/truetype/PCLTTFTable.java +++ b/src/main/java/org/apache/fop/render/pcl/fonts/truetype/PCLTTFTable.java diff --git a/src/java/org/apache/fop/render/pcl/fonts/truetype/PCLTTFTableFactory.java b/src/main/java/org/apache/fop/render/pcl/fonts/truetype/PCLTTFTableFactory.java index e72563e96..e72563e96 100644 --- a/src/java/org/apache/fop/render/pcl/fonts/truetype/PCLTTFTableFactory.java +++ b/src/main/java/org/apache/fop/render/pcl/fonts/truetype/PCLTTFTableFactory.java diff --git a/src/java/org/apache/fop/render/pcl/package.html b/src/main/java/org/apache/fop/render/pcl/package.html index e5bf81ed9..e5bf81ed9 100644 --- a/src/java/org/apache/fop/render/pcl/package.html +++ b/src/main/java/org/apache/fop/render/pcl/package.html diff --git a/src/java/org/apache/fop/render/pdf/AbstractImageAdapter.java b/src/main/java/org/apache/fop/render/pdf/AbstractImageAdapter.java index c61ca8cda..c61ca8cda 100644 --- a/src/java/org/apache/fop/render/pdf/AbstractImageAdapter.java +++ b/src/main/java/org/apache/fop/render/pdf/AbstractImageAdapter.java diff --git a/src/java/org/apache/fop/render/pdf/AbstractPDFImageHandler.java b/src/main/java/org/apache/fop/render/pdf/AbstractPDFImageHandler.java index 5bc83fee3..5bc83fee3 100644 --- a/src/java/org/apache/fop/render/pdf/AbstractPDFImageHandler.java +++ b/src/main/java/org/apache/fop/render/pdf/AbstractPDFImageHandler.java diff --git a/src/java/org/apache/fop/render/pdf/CTMHelper.java b/src/main/java/org/apache/fop/render/pdf/CTMHelper.java index 5f1706905..5f1706905 100644 --- a/src/java/org/apache/fop/render/pdf/CTMHelper.java +++ b/src/main/java/org/apache/fop/render/pdf/CTMHelper.java diff --git a/src/java/org/apache/fop/render/pdf/ImageRawCCITTFaxAdapter.java b/src/main/java/org/apache/fop/render/pdf/ImageRawCCITTFaxAdapter.java index 877a76d21..877a76d21 100644 --- a/src/java/org/apache/fop/render/pdf/ImageRawCCITTFaxAdapter.java +++ b/src/main/java/org/apache/fop/render/pdf/ImageRawCCITTFaxAdapter.java diff --git a/src/java/org/apache/fop/render/pdf/ImageRawJPEGAdapter.java b/src/main/java/org/apache/fop/render/pdf/ImageRawJPEGAdapter.java index 306b0b350..306b0b350 100644 --- a/src/java/org/apache/fop/render/pdf/ImageRawJPEGAdapter.java +++ b/src/main/java/org/apache/fop/render/pdf/ImageRawJPEGAdapter.java diff --git a/src/java/org/apache/fop/render/pdf/ImageRawPNGAdapter.java b/src/main/java/org/apache/fop/render/pdf/ImageRawPNGAdapter.java index 9742036b7..9742036b7 100644 --- a/src/java/org/apache/fop/render/pdf/ImageRawPNGAdapter.java +++ b/src/main/java/org/apache/fop/render/pdf/ImageRawPNGAdapter.java diff --git a/src/java/org/apache/fop/render/pdf/ImageRenderedAdapter.java b/src/main/java/org/apache/fop/render/pdf/ImageRenderedAdapter.java index c1eaa07c9..c1eaa07c9 100644 --- a/src/java/org/apache/fop/render/pdf/ImageRenderedAdapter.java +++ b/src/main/java/org/apache/fop/render/pdf/ImageRenderedAdapter.java diff --git a/src/java/org/apache/fop/render/pdf/PDFContentGenerator.java b/src/main/java/org/apache/fop/render/pdf/PDFContentGenerator.java index fc1f31cc6..fc1f31cc6 100644 --- a/src/java/org/apache/fop/render/pdf/PDFContentGenerator.java +++ b/src/main/java/org/apache/fop/render/pdf/PDFContentGenerator.java diff --git a/src/java/org/apache/fop/render/pdf/PDFDocumentHandler.java b/src/main/java/org/apache/fop/render/pdf/PDFDocumentHandler.java index e5896b803..e5896b803 100644 --- a/src/java/org/apache/fop/render/pdf/PDFDocumentHandler.java +++ b/src/main/java/org/apache/fop/render/pdf/PDFDocumentHandler.java diff --git a/src/java/org/apache/fop/render/pdf/PDFDocumentHandlerMaker.java b/src/main/java/org/apache/fop/render/pdf/PDFDocumentHandlerMaker.java index ceab6f54a..ceab6f54a 100644 --- a/src/java/org/apache/fop/render/pdf/PDFDocumentHandlerMaker.java +++ b/src/main/java/org/apache/fop/render/pdf/PDFDocumentHandlerMaker.java diff --git a/src/java/org/apache/fop/render/pdf/PDFDocumentNavigationHandler.java b/src/main/java/org/apache/fop/render/pdf/PDFDocumentNavigationHandler.java index cb9f43fa9..cb9f43fa9 100644 --- a/src/java/org/apache/fop/render/pdf/PDFDocumentNavigationHandler.java +++ b/src/main/java/org/apache/fop/render/pdf/PDFDocumentNavigationHandler.java diff --git a/src/java/org/apache/fop/render/pdf/PDFEncryptionOption.java b/src/main/java/org/apache/fop/render/pdf/PDFEncryptionOption.java index c14be719a..c14be719a 100644 --- a/src/java/org/apache/fop/render/pdf/PDFEncryptionOption.java +++ b/src/main/java/org/apache/fop/render/pdf/PDFEncryptionOption.java diff --git a/src/java/org/apache/fop/render/pdf/PDFEventProducer.java b/src/main/java/org/apache/fop/render/pdf/PDFEventProducer.java index 802bb06b4..802bb06b4 100644 --- a/src/java/org/apache/fop/render/pdf/PDFEventProducer.java +++ b/src/main/java/org/apache/fop/render/pdf/PDFEventProducer.java diff --git a/src/java/org/apache/fop/render/pdf/PDFEventProducer.xml b/src/main/java/org/apache/fop/render/pdf/PDFEventProducer.xml index b954e61d5..b954e61d5 100644 --- a/src/java/org/apache/fop/render/pdf/PDFEventProducer.xml +++ b/src/main/java/org/apache/fop/render/pdf/PDFEventProducer.xml diff --git a/src/java/org/apache/fop/render/pdf/PDFGraphicsPainter.java b/src/main/java/org/apache/fop/render/pdf/PDFGraphicsPainter.java index 5e0792696..5e0792696 100644 --- a/src/java/org/apache/fop/render/pdf/PDFGraphicsPainter.java +++ b/src/main/java/org/apache/fop/render/pdf/PDFGraphicsPainter.java diff --git a/src/java/org/apache/fop/render/pdf/PDFImageHandlerGraphics2D.java b/src/main/java/org/apache/fop/render/pdf/PDFImageHandlerGraphics2D.java index 60f2c11bc..60f2c11bc 100644 --- a/src/java/org/apache/fop/render/pdf/PDFImageHandlerGraphics2D.java +++ b/src/main/java/org/apache/fop/render/pdf/PDFImageHandlerGraphics2D.java diff --git a/src/java/org/apache/fop/render/pdf/PDFImageHandlerRawCCITTFax.java b/src/main/java/org/apache/fop/render/pdf/PDFImageHandlerRawCCITTFax.java index c0971a8d0..c0971a8d0 100644 --- a/src/java/org/apache/fop/render/pdf/PDFImageHandlerRawCCITTFax.java +++ b/src/main/java/org/apache/fop/render/pdf/PDFImageHandlerRawCCITTFax.java diff --git a/src/java/org/apache/fop/render/pdf/PDFImageHandlerRawJPEG.java b/src/main/java/org/apache/fop/render/pdf/PDFImageHandlerRawJPEG.java index d09ae9804..d09ae9804 100644 --- a/src/java/org/apache/fop/render/pdf/PDFImageHandlerRawJPEG.java +++ b/src/main/java/org/apache/fop/render/pdf/PDFImageHandlerRawJPEG.java diff --git a/src/java/org/apache/fop/render/pdf/PDFImageHandlerRawPNG.java b/src/main/java/org/apache/fop/render/pdf/PDFImageHandlerRawPNG.java index 3475954a8..3475954a8 100644 --- a/src/java/org/apache/fop/render/pdf/PDFImageHandlerRawPNG.java +++ b/src/main/java/org/apache/fop/render/pdf/PDFImageHandlerRawPNG.java diff --git a/src/java/org/apache/fop/render/pdf/PDFImageHandlerRenderedImage.java b/src/main/java/org/apache/fop/render/pdf/PDFImageHandlerRenderedImage.java index 7b34e7bd7..7b34e7bd7 100644 --- a/src/java/org/apache/fop/render/pdf/PDFImageHandlerRenderedImage.java +++ b/src/main/java/org/apache/fop/render/pdf/PDFImageHandlerRenderedImage.java diff --git a/src/java/org/apache/fop/render/pdf/PDFImageHandlerSVG.java b/src/main/java/org/apache/fop/render/pdf/PDFImageHandlerSVG.java index d2f05106f..d2f05106f 100644 --- a/src/java/org/apache/fop/render/pdf/PDFImageHandlerSVG.java +++ b/src/main/java/org/apache/fop/render/pdf/PDFImageHandlerSVG.java diff --git a/src/java/org/apache/fop/render/pdf/PDFLogicalStructureHandler.java b/src/main/java/org/apache/fop/render/pdf/PDFLogicalStructureHandler.java index abaffad60..abaffad60 100644 --- a/src/java/org/apache/fop/render/pdf/PDFLogicalStructureHandler.java +++ b/src/main/java/org/apache/fop/render/pdf/PDFLogicalStructureHandler.java diff --git a/src/java/org/apache/fop/render/pdf/PDFPainter.java b/src/main/java/org/apache/fop/render/pdf/PDFPainter.java index 6bbb2fff5..6bbb2fff5 100644 --- a/src/java/org/apache/fop/render/pdf/PDFPainter.java +++ b/src/main/java/org/apache/fop/render/pdf/PDFPainter.java diff --git a/src/java/org/apache/fop/render/pdf/PDFRendererConfig.java b/src/main/java/org/apache/fop/render/pdf/PDFRendererConfig.java index 5e7447888..5e7447888 100644 --- a/src/java/org/apache/fop/render/pdf/PDFRendererConfig.java +++ b/src/main/java/org/apache/fop/render/pdf/PDFRendererConfig.java diff --git a/src/java/org/apache/fop/render/pdf/PDFRendererConfigurator.java b/src/main/java/org/apache/fop/render/pdf/PDFRendererConfigurator.java index 96a19db6a..96a19db6a 100644 --- a/src/java/org/apache/fop/render/pdf/PDFRendererConfigurator.java +++ b/src/main/java/org/apache/fop/render/pdf/PDFRendererConfigurator.java diff --git a/src/java/org/apache/fop/render/pdf/PDFRendererContextConstants.java b/src/main/java/org/apache/fop/render/pdf/PDFRendererContextConstants.java index 11380bf59..11380bf59 100644 --- a/src/java/org/apache/fop/render/pdf/PDFRendererContextConstants.java +++ b/src/main/java/org/apache/fop/render/pdf/PDFRendererContextConstants.java diff --git a/src/java/org/apache/fop/render/pdf/PDFRendererOption.java b/src/main/java/org/apache/fop/render/pdf/PDFRendererOption.java index 422a5d0ac..422a5d0ac 100644 --- a/src/java/org/apache/fop/render/pdf/PDFRendererOption.java +++ b/src/main/java/org/apache/fop/render/pdf/PDFRendererOption.java diff --git a/src/java/org/apache/fop/render/pdf/PDFRendererOptionsConfig.java b/src/main/java/org/apache/fop/render/pdf/PDFRendererOptionsConfig.java index 54d236db8..54d236db8 100644 --- a/src/java/org/apache/fop/render/pdf/PDFRendererOptionsConfig.java +++ b/src/main/java/org/apache/fop/render/pdf/PDFRendererOptionsConfig.java diff --git a/src/java/org/apache/fop/render/pdf/PDFRenderingContext.java b/src/main/java/org/apache/fop/render/pdf/PDFRenderingContext.java index b99bcdbfe..b99bcdbfe 100644 --- a/src/java/org/apache/fop/render/pdf/PDFRenderingContext.java +++ b/src/main/java/org/apache/fop/render/pdf/PDFRenderingContext.java diff --git a/src/java/org/apache/fop/render/pdf/PDFRenderingUtil.java b/src/main/java/org/apache/fop/render/pdf/PDFRenderingUtil.java index 18a804b5d..18a804b5d 100644 --- a/src/java/org/apache/fop/render/pdf/PDFRenderingUtil.java +++ b/src/main/java/org/apache/fop/render/pdf/PDFRenderingUtil.java diff --git a/src/java/org/apache/fop/render/pdf/PDFSVGHandler.java b/src/main/java/org/apache/fop/render/pdf/PDFSVGHandler.java index 3899e40e7..3899e40e7 100644 --- a/src/java/org/apache/fop/render/pdf/PDFSVGHandler.java +++ b/src/main/java/org/apache/fop/render/pdf/PDFSVGHandler.java diff --git a/src/java/org/apache/fop/render/pdf/PDFStructureTreeBuilder.java b/src/main/java/org/apache/fop/render/pdf/PDFStructureTreeBuilder.java index 790f97468..790f97468 100644 --- a/src/java/org/apache/fop/render/pdf/PDFStructureTreeBuilder.java +++ b/src/main/java/org/apache/fop/render/pdf/PDFStructureTreeBuilder.java diff --git a/src/java/org/apache/fop/render/pdf/PageSequenceStructElem.java b/src/main/java/org/apache/fop/render/pdf/PageSequenceStructElem.java index c660d2496..c660d2496 100644 --- a/src/java/org/apache/fop/render/pdf/PageSequenceStructElem.java +++ b/src/main/java/org/apache/fop/render/pdf/PageSequenceStructElem.java diff --git a/src/java/org/apache/fop/render/pdf/TableStructElem.java b/src/main/java/org/apache/fop/render/pdf/TableStructElem.java index c44acb25c..c44acb25c 100644 --- a/src/java/org/apache/fop/render/pdf/TableStructElem.java +++ b/src/main/java/org/apache/fop/render/pdf/TableStructElem.java diff --git a/src/java/org/apache/fop/render/pdf/extensions/AbstractPDFExtensionElement.java b/src/main/java/org/apache/fop/render/pdf/extensions/AbstractPDFExtensionElement.java index 15be455d4..15be455d4 100644 --- a/src/java/org/apache/fop/render/pdf/extensions/AbstractPDFExtensionElement.java +++ b/src/main/java/org/apache/fop/render/pdf/extensions/AbstractPDFExtensionElement.java diff --git a/src/java/org/apache/fop/render/pdf/extensions/PDFActionElement.java b/src/main/java/org/apache/fop/render/pdf/extensions/PDFActionElement.java index e4a5747e6..e4a5747e6 100644 --- a/src/java/org/apache/fop/render/pdf/extensions/PDFActionElement.java +++ b/src/main/java/org/apache/fop/render/pdf/extensions/PDFActionElement.java diff --git a/src/java/org/apache/fop/render/pdf/extensions/PDFActionExtension.java b/src/main/java/org/apache/fop/render/pdf/extensions/PDFActionExtension.java index 778b8a203..778b8a203 100644 --- a/src/java/org/apache/fop/render/pdf/extensions/PDFActionExtension.java +++ b/src/main/java/org/apache/fop/render/pdf/extensions/PDFActionExtension.java diff --git a/src/java/org/apache/fop/render/pdf/extensions/PDFArrayElement.java b/src/main/java/org/apache/fop/render/pdf/extensions/PDFArrayElement.java index 34b11272f..34b11272f 100644 --- a/src/java/org/apache/fop/render/pdf/extensions/PDFArrayElement.java +++ b/src/main/java/org/apache/fop/render/pdf/extensions/PDFArrayElement.java diff --git a/src/java/org/apache/fop/render/pdf/extensions/PDFArrayExtension.java b/src/main/java/org/apache/fop/render/pdf/extensions/PDFArrayExtension.java index 80c6c94e4..80c6c94e4 100644 --- a/src/java/org/apache/fop/render/pdf/extensions/PDFArrayExtension.java +++ b/src/main/java/org/apache/fop/render/pdf/extensions/PDFArrayExtension.java diff --git a/src/java/org/apache/fop/render/pdf/extensions/PDFCatalogElement.java b/src/main/java/org/apache/fop/render/pdf/extensions/PDFCatalogElement.java index 029357d22..029357d22 100644 --- a/src/java/org/apache/fop/render/pdf/extensions/PDFCatalogElement.java +++ b/src/main/java/org/apache/fop/render/pdf/extensions/PDFCatalogElement.java diff --git a/src/java/org/apache/fop/render/pdf/extensions/PDFCatalogExtension.java b/src/main/java/org/apache/fop/render/pdf/extensions/PDFCatalogExtension.java index 381f6fbe8..381f6fbe8 100644 --- a/src/java/org/apache/fop/render/pdf/extensions/PDFCatalogExtension.java +++ b/src/main/java/org/apache/fop/render/pdf/extensions/PDFCatalogExtension.java diff --git a/src/java/org/apache/fop/render/pdf/extensions/PDFCollectionEntryElement.java b/src/main/java/org/apache/fop/render/pdf/extensions/PDFCollectionEntryElement.java index 4185ceef0..4185ceef0 100644 --- a/src/java/org/apache/fop/render/pdf/extensions/PDFCollectionEntryElement.java +++ b/src/main/java/org/apache/fop/render/pdf/extensions/PDFCollectionEntryElement.java diff --git a/src/java/org/apache/fop/render/pdf/extensions/PDFCollectionEntryExtension.java b/src/main/java/org/apache/fop/render/pdf/extensions/PDFCollectionEntryExtension.java index d28f1602f..d28f1602f 100644 --- a/src/java/org/apache/fop/render/pdf/extensions/PDFCollectionEntryExtension.java +++ b/src/main/java/org/apache/fop/render/pdf/extensions/PDFCollectionEntryExtension.java diff --git a/src/java/org/apache/fop/render/pdf/extensions/PDFCollectionExtension.java b/src/main/java/org/apache/fop/render/pdf/extensions/PDFCollectionExtension.java index 228d69c79..228d69c79 100644 --- a/src/java/org/apache/fop/render/pdf/extensions/PDFCollectionExtension.java +++ b/src/main/java/org/apache/fop/render/pdf/extensions/PDFCollectionExtension.java diff --git a/src/java/org/apache/fop/render/pdf/extensions/PDFDictionaryAttachment.java b/src/main/java/org/apache/fop/render/pdf/extensions/PDFDictionaryAttachment.java index 3832619ba..3832619ba 100644 --- a/src/java/org/apache/fop/render/pdf/extensions/PDFDictionaryAttachment.java +++ b/src/main/java/org/apache/fop/render/pdf/extensions/PDFDictionaryAttachment.java diff --git a/src/java/org/apache/fop/render/pdf/extensions/PDFDictionaryElement.java b/src/main/java/org/apache/fop/render/pdf/extensions/PDFDictionaryElement.java index d7b155e23..d7b155e23 100644 --- a/src/java/org/apache/fop/render/pdf/extensions/PDFDictionaryElement.java +++ b/src/main/java/org/apache/fop/render/pdf/extensions/PDFDictionaryElement.java diff --git a/src/java/org/apache/fop/render/pdf/extensions/PDFDictionaryExtension.java b/src/main/java/org/apache/fop/render/pdf/extensions/PDFDictionaryExtension.java index d1367413e..d1367413e 100644 --- a/src/java/org/apache/fop/render/pdf/extensions/PDFDictionaryExtension.java +++ b/src/main/java/org/apache/fop/render/pdf/extensions/PDFDictionaryExtension.java diff --git a/src/java/org/apache/fop/render/pdf/extensions/PDFDictionaryType.java b/src/main/java/org/apache/fop/render/pdf/extensions/PDFDictionaryType.java index 4cefc2bad..4cefc2bad 100644 --- a/src/java/org/apache/fop/render/pdf/extensions/PDFDictionaryType.java +++ b/src/main/java/org/apache/fop/render/pdf/extensions/PDFDictionaryType.java diff --git a/src/java/org/apache/fop/render/pdf/extensions/PDFDocumentInformationElement.java b/src/main/java/org/apache/fop/render/pdf/extensions/PDFDocumentInformationElement.java index 7aae57602..7aae57602 100644 --- a/src/java/org/apache/fop/render/pdf/extensions/PDFDocumentInformationElement.java +++ b/src/main/java/org/apache/fop/render/pdf/extensions/PDFDocumentInformationElement.java diff --git a/src/java/org/apache/fop/render/pdf/extensions/PDFDocumentInformationExtension.java b/src/main/java/org/apache/fop/render/pdf/extensions/PDFDocumentInformationExtension.java index ed77c2746..ed77c2746 100644 --- a/src/java/org/apache/fop/render/pdf/extensions/PDFDocumentInformationExtension.java +++ b/src/main/java/org/apache/fop/render/pdf/extensions/PDFDocumentInformationExtension.java diff --git a/src/java/org/apache/fop/render/pdf/extensions/PDFElementMapping.java b/src/main/java/org/apache/fop/render/pdf/extensions/PDFElementMapping.java index 836b53656..836b53656 100644 --- a/src/java/org/apache/fop/render/pdf/extensions/PDFElementMapping.java +++ b/src/main/java/org/apache/fop/render/pdf/extensions/PDFElementMapping.java diff --git a/src/java/org/apache/fop/render/pdf/extensions/PDFEmbeddedFileAttachment.java b/src/main/java/org/apache/fop/render/pdf/extensions/PDFEmbeddedFileAttachment.java index 8a6e76ba9..8a6e76ba9 100644 --- a/src/java/org/apache/fop/render/pdf/extensions/PDFEmbeddedFileAttachment.java +++ b/src/main/java/org/apache/fop/render/pdf/extensions/PDFEmbeddedFileAttachment.java diff --git a/src/java/org/apache/fop/render/pdf/extensions/PDFEmbeddedFileElement.java b/src/main/java/org/apache/fop/render/pdf/extensions/PDFEmbeddedFileElement.java index 90f63d7cf..90f63d7cf 100644 --- a/src/java/org/apache/fop/render/pdf/extensions/PDFEmbeddedFileElement.java +++ b/src/main/java/org/apache/fop/render/pdf/extensions/PDFEmbeddedFileElement.java diff --git a/src/java/org/apache/fop/render/pdf/extensions/PDFExtensionAttachment.java b/src/main/java/org/apache/fop/render/pdf/extensions/PDFExtensionAttachment.java index 0339f10a2..0339f10a2 100644 --- a/src/java/org/apache/fop/render/pdf/extensions/PDFExtensionAttachment.java +++ b/src/main/java/org/apache/fop/render/pdf/extensions/PDFExtensionAttachment.java diff --git a/src/java/org/apache/fop/render/pdf/extensions/PDFExtensionEventProducer.java b/src/main/java/org/apache/fop/render/pdf/extensions/PDFExtensionEventProducer.java index f4338c6a5..f4338c6a5 100644 --- a/src/java/org/apache/fop/render/pdf/extensions/PDFExtensionEventProducer.java +++ b/src/main/java/org/apache/fop/render/pdf/extensions/PDFExtensionEventProducer.java diff --git a/src/java/org/apache/fop/render/pdf/extensions/PDFExtensionEventProducer.xml b/src/main/java/org/apache/fop/render/pdf/extensions/PDFExtensionEventProducer.xml index 57abcc185..57abcc185 100644 --- a/src/java/org/apache/fop/render/pdf/extensions/PDFExtensionEventProducer.xml +++ b/src/main/java/org/apache/fop/render/pdf/extensions/PDFExtensionEventProducer.xml diff --git a/src/java/org/apache/fop/render/pdf/extensions/PDFExtensionHandler.java b/src/main/java/org/apache/fop/render/pdf/extensions/PDFExtensionHandler.java index 9579acc84..9579acc84 100644 --- a/src/java/org/apache/fop/render/pdf/extensions/PDFExtensionHandler.java +++ b/src/main/java/org/apache/fop/render/pdf/extensions/PDFExtensionHandler.java diff --git a/src/java/org/apache/fop/render/pdf/extensions/PDFExtensionHandlerFactory.java b/src/main/java/org/apache/fop/render/pdf/extensions/PDFExtensionHandlerFactory.java index 6d83cd58f..6d83cd58f 100644 --- a/src/java/org/apache/fop/render/pdf/extensions/PDFExtensionHandlerFactory.java +++ b/src/main/java/org/apache/fop/render/pdf/extensions/PDFExtensionHandlerFactory.java diff --git a/src/java/org/apache/fop/render/pdf/extensions/PDFLayerElement.java b/src/main/java/org/apache/fop/render/pdf/extensions/PDFLayerElement.java index dab0ecf78..dab0ecf78 100644 --- a/src/java/org/apache/fop/render/pdf/extensions/PDFLayerElement.java +++ b/src/main/java/org/apache/fop/render/pdf/extensions/PDFLayerElement.java diff --git a/src/java/org/apache/fop/render/pdf/extensions/PDFLayerExtension.java b/src/main/java/org/apache/fop/render/pdf/extensions/PDFLayerExtension.java index d6cc27ab8..d6cc27ab8 100644 --- a/src/java/org/apache/fop/render/pdf/extensions/PDFLayerExtension.java +++ b/src/main/java/org/apache/fop/render/pdf/extensions/PDFLayerExtension.java diff --git a/src/java/org/apache/fop/render/pdf/extensions/PDFNavigatorElement.java b/src/main/java/org/apache/fop/render/pdf/extensions/PDFNavigatorElement.java index 5c5b779b5..5c5b779b5 100644 --- a/src/java/org/apache/fop/render/pdf/extensions/PDFNavigatorElement.java +++ b/src/main/java/org/apache/fop/render/pdf/extensions/PDFNavigatorElement.java diff --git a/src/java/org/apache/fop/render/pdf/extensions/PDFNavigatorExtension.java b/src/main/java/org/apache/fop/render/pdf/extensions/PDFNavigatorExtension.java index ee9dfa7c8..ee9dfa7c8 100644 --- a/src/java/org/apache/fop/render/pdf/extensions/PDFNavigatorExtension.java +++ b/src/main/java/org/apache/fop/render/pdf/extensions/PDFNavigatorExtension.java diff --git a/src/java/org/apache/fop/render/pdf/extensions/PDFObjectExtension.java b/src/main/java/org/apache/fop/render/pdf/extensions/PDFObjectExtension.java index 5447d87f2..5447d87f2 100644 --- a/src/java/org/apache/fop/render/pdf/extensions/PDFObjectExtension.java +++ b/src/main/java/org/apache/fop/render/pdf/extensions/PDFObjectExtension.java diff --git a/src/java/org/apache/fop/render/pdf/extensions/PDFObjectType.java b/src/main/java/org/apache/fop/render/pdf/extensions/PDFObjectType.java index c193a3b7b..c193a3b7b 100644 --- a/src/java/org/apache/fop/render/pdf/extensions/PDFObjectType.java +++ b/src/main/java/org/apache/fop/render/pdf/extensions/PDFObjectType.java diff --git a/src/java/org/apache/fop/render/pdf/extensions/PDFPageElement.java b/src/main/java/org/apache/fop/render/pdf/extensions/PDFPageElement.java index 28a966ead..28a966ead 100644 --- a/src/java/org/apache/fop/render/pdf/extensions/PDFPageElement.java +++ b/src/main/java/org/apache/fop/render/pdf/extensions/PDFPageElement.java diff --git a/src/java/org/apache/fop/render/pdf/extensions/PDFPageExtension.java b/src/main/java/org/apache/fop/render/pdf/extensions/PDFPageExtension.java index 0726a4e55..0726a4e55 100644 --- a/src/java/org/apache/fop/render/pdf/extensions/PDFPageExtension.java +++ b/src/main/java/org/apache/fop/render/pdf/extensions/PDFPageExtension.java diff --git a/src/java/org/apache/fop/render/pdf/extensions/PDFPagePieceElement.java b/src/main/java/org/apache/fop/render/pdf/extensions/PDFPagePieceElement.java index df6958696..df6958696 100644 --- a/src/java/org/apache/fop/render/pdf/extensions/PDFPagePieceElement.java +++ b/src/main/java/org/apache/fop/render/pdf/extensions/PDFPagePieceElement.java diff --git a/src/java/org/apache/fop/render/pdf/extensions/PDFPagePieceExtension.java b/src/main/java/org/apache/fop/render/pdf/extensions/PDFPagePieceExtension.java index 34600727c..34600727c 100644 --- a/src/java/org/apache/fop/render/pdf/extensions/PDFPagePieceExtension.java +++ b/src/main/java/org/apache/fop/render/pdf/extensions/PDFPagePieceExtension.java diff --git a/src/java/org/apache/fop/render/pdf/extensions/PDFReferenceElement.java b/src/main/java/org/apache/fop/render/pdf/extensions/PDFReferenceElement.java index c774a09a8..c774a09a8 100644 --- a/src/java/org/apache/fop/render/pdf/extensions/PDFReferenceElement.java +++ b/src/main/java/org/apache/fop/render/pdf/extensions/PDFReferenceElement.java diff --git a/src/java/org/apache/fop/render/pdf/extensions/PDFReferenceExtension.java b/src/main/java/org/apache/fop/render/pdf/extensions/PDFReferenceExtension.java index 09621c01c..09621c01c 100644 --- a/src/java/org/apache/fop/render/pdf/extensions/PDFReferenceExtension.java +++ b/src/main/java/org/apache/fop/render/pdf/extensions/PDFReferenceExtension.java diff --git a/src/java/org/apache/fop/render/pdf/extensions/PDFVTElement.java b/src/main/java/org/apache/fop/render/pdf/extensions/PDFVTElement.java index 24fb50b6c..24fb50b6c 100644 --- a/src/java/org/apache/fop/render/pdf/extensions/PDFVTElement.java +++ b/src/main/java/org/apache/fop/render/pdf/extensions/PDFVTElement.java diff --git a/src/java/org/apache/fop/render/pdf/extensions/PDFVTExtension.java b/src/main/java/org/apache/fop/render/pdf/extensions/PDFVTExtension.java index 22ac56ffe..22ac56ffe 100644 --- a/src/java/org/apache/fop/render/pdf/extensions/PDFVTExtension.java +++ b/src/main/java/org/apache/fop/render/pdf/extensions/PDFVTExtension.java diff --git a/src/java/org/apache/fop/render/pdf/package.html b/src/main/java/org/apache/fop/render/pdf/package.html index 8b33b16e3..8b33b16e3 100644 --- a/src/java/org/apache/fop/render/pdf/package.html +++ b/src/main/java/org/apache/fop/render/pdf/package.html diff --git a/src/java/org/apache/fop/render/print/PageableRenderer.java b/src/main/java/org/apache/fop/render/print/PageableRenderer.java index 7a6f89b9c..7a6f89b9c 100644 --- a/src/java/org/apache/fop/render/print/PageableRenderer.java +++ b/src/main/java/org/apache/fop/render/print/PageableRenderer.java diff --git a/src/java/org/apache/fop/render/print/PagesMode.java b/src/main/java/org/apache/fop/render/print/PagesMode.java index cf8bade1d..cf8bade1d 100644 --- a/src/java/org/apache/fop/render/print/PagesMode.java +++ b/src/main/java/org/apache/fop/render/print/PagesMode.java diff --git a/src/java/org/apache/fop/render/print/PrintRenderer.java b/src/main/java/org/apache/fop/render/print/PrintRenderer.java index 1540acd23..1540acd23 100644 --- a/src/java/org/apache/fop/render/print/PrintRenderer.java +++ b/src/main/java/org/apache/fop/render/print/PrintRenderer.java diff --git a/src/java/org/apache/fop/render/print/PrintRendererMaker.java b/src/main/java/org/apache/fop/render/print/PrintRendererMaker.java index e5673c1f4..e5673c1f4 100644 --- a/src/java/org/apache/fop/render/print/PrintRendererMaker.java +++ b/src/main/java/org/apache/fop/render/print/PrintRendererMaker.java diff --git a/src/java/org/apache/fop/render/print/package.html b/src/main/java/org/apache/fop/render/print/package.html index 7a93d488b..7a93d488b 100644 --- a/src/java/org/apache/fop/render/print/package.html +++ b/src/main/java/org/apache/fop/render/print/package.html diff --git a/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java b/src/main/java/org/apache/fop/render/ps/AbstractPSTranscoder.java index 24a48d225..24a48d225 100644 --- a/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java +++ b/src/main/java/org/apache/fop/render/ps/AbstractPSTranscoder.java diff --git a/src/java/org/apache/fop/render/ps/EPSTranscoder.java b/src/main/java/org/apache/fop/render/ps/EPSTranscoder.java index 79856b835..79856b835 100644 --- a/src/java/org/apache/fop/render/ps/EPSTranscoder.java +++ b/src/main/java/org/apache/fop/render/ps/EPSTranscoder.java diff --git a/src/java/org/apache/fop/render/ps/FOPProcSet.java b/src/main/java/org/apache/fop/render/ps/FOPProcSet.java index 06e508c98..06e508c98 100644 --- a/src/java/org/apache/fop/render/ps/FOPProcSet.java +++ b/src/main/java/org/apache/fop/render/ps/FOPProcSet.java diff --git a/src/java/org/apache/fop/render/ps/FontResourceCache.java b/src/main/java/org/apache/fop/render/ps/FontResourceCache.java index 1514d201e..1514d201e 100644 --- a/src/java/org/apache/fop/render/ps/FontResourceCache.java +++ b/src/main/java/org/apache/fop/render/ps/FontResourceCache.java diff --git a/src/java/org/apache/fop/render/ps/Gradient.java b/src/main/java/org/apache/fop/render/ps/Gradient.java index 558f3b952..558f3b952 100644 --- a/src/java/org/apache/fop/render/ps/Gradient.java +++ b/src/main/java/org/apache/fop/render/ps/Gradient.java diff --git a/src/java/org/apache/fop/render/ps/ImageEncoderCCITTFax.java b/src/main/java/org/apache/fop/render/ps/ImageEncoderCCITTFax.java index 3fded29d7..3fded29d7 100644 --- a/src/java/org/apache/fop/render/ps/ImageEncoderCCITTFax.java +++ b/src/main/java/org/apache/fop/render/ps/ImageEncoderCCITTFax.java diff --git a/src/java/org/apache/fop/render/ps/ImageEncoderJPEG.java b/src/main/java/org/apache/fop/render/ps/ImageEncoderJPEG.java index fd24032e3..fd24032e3 100644 --- a/src/java/org/apache/fop/render/ps/ImageEncoderJPEG.java +++ b/src/main/java/org/apache/fop/render/ps/ImageEncoderJPEG.java diff --git a/src/java/org/apache/fop/render/ps/ImageEncoderPNG.java b/src/main/java/org/apache/fop/render/ps/ImageEncoderPNG.java index 8ab91cb0a..8ab91cb0a 100644 --- a/src/java/org/apache/fop/render/ps/ImageEncoderPNG.java +++ b/src/main/java/org/apache/fop/render/ps/ImageEncoderPNG.java diff --git a/src/java/org/apache/fop/render/ps/NativeTextHandler.java b/src/main/java/org/apache/fop/render/ps/NativeTextHandler.java index d487d3279..d487d3279 100644 --- a/src/java/org/apache/fop/render/ps/NativeTextHandler.java +++ b/src/main/java/org/apache/fop/render/ps/NativeTextHandler.java diff --git a/src/java/org/apache/fop/render/ps/PSBatikFlowTextElementBridge.java b/src/main/java/org/apache/fop/render/ps/PSBatikFlowTextElementBridge.java index a09f55bec..a09f55bec 100644 --- a/src/java/org/apache/fop/render/ps/PSBatikFlowTextElementBridge.java +++ b/src/main/java/org/apache/fop/render/ps/PSBatikFlowTextElementBridge.java diff --git a/src/java/org/apache/fop/render/ps/PSBridgeContext.java b/src/main/java/org/apache/fop/render/ps/PSBridgeContext.java index b774c598f..b774c598f 100644 --- a/src/java/org/apache/fop/render/ps/PSBridgeContext.java +++ b/src/main/java/org/apache/fop/render/ps/PSBridgeContext.java diff --git a/src/java/org/apache/fop/render/ps/PSDocumentHandler.java b/src/main/java/org/apache/fop/render/ps/PSDocumentHandler.java index b40fef8ba..b40fef8ba 100644 --- a/src/java/org/apache/fop/render/ps/PSDocumentHandler.java +++ b/src/main/java/org/apache/fop/render/ps/PSDocumentHandler.java diff --git a/src/java/org/apache/fop/render/ps/PSDocumentHandlerMaker.java b/src/main/java/org/apache/fop/render/ps/PSDocumentHandlerMaker.java index 1c31c4906..1c31c4906 100644 --- a/src/java/org/apache/fop/render/ps/PSDocumentHandlerMaker.java +++ b/src/main/java/org/apache/fop/render/ps/PSDocumentHandlerMaker.java diff --git a/src/java/org/apache/fop/render/ps/PSEventProducer.java b/src/main/java/org/apache/fop/render/ps/PSEventProducer.java index 2a739a1e5..2a739a1e5 100644 --- a/src/java/org/apache/fop/render/ps/PSEventProducer.java +++ b/src/main/java/org/apache/fop/render/ps/PSEventProducer.java diff --git a/src/java/org/apache/fop/render/ps/PSEventProducer.xml b/src/main/java/org/apache/fop/render/ps/PSEventProducer.xml index 64b22d1a4..64b22d1a4 100644 --- a/src/java/org/apache/fop/render/ps/PSEventProducer.xml +++ b/src/main/java/org/apache/fop/render/ps/PSEventProducer.xml diff --git a/src/java/org/apache/fop/render/ps/PSFontResource.java b/src/main/java/org/apache/fop/render/ps/PSFontResource.java index 8b7b835ed..8b7b835ed 100644 --- a/src/java/org/apache/fop/render/ps/PSFontResource.java +++ b/src/main/java/org/apache/fop/render/ps/PSFontResource.java diff --git a/src/java/org/apache/fop/render/ps/PSFontUtils.java b/src/main/java/org/apache/fop/render/ps/PSFontUtils.java index e8ad32b5e..e8ad32b5e 100644 --- a/src/java/org/apache/fop/render/ps/PSFontUtils.java +++ b/src/main/java/org/apache/fop/render/ps/PSFontUtils.java diff --git a/src/java/org/apache/fop/render/ps/PSGraphics2DAdapter.java b/src/main/java/org/apache/fop/render/ps/PSGraphics2DAdapter.java index 2ed64e770..2ed64e770 100644 --- a/src/java/org/apache/fop/render/ps/PSGraphics2DAdapter.java +++ b/src/main/java/org/apache/fop/render/ps/PSGraphics2DAdapter.java diff --git a/src/java/org/apache/fop/render/ps/PSGraphicsPainter.java b/src/main/java/org/apache/fop/render/ps/PSGraphicsPainter.java index 9152d0937..9152d0937 100644 --- a/src/java/org/apache/fop/render/ps/PSGraphicsPainter.java +++ b/src/main/java/org/apache/fop/render/ps/PSGraphicsPainter.java diff --git a/src/java/org/apache/fop/render/ps/PSImageFormResource.java b/src/main/java/org/apache/fop/render/ps/PSImageFormResource.java index bc695f14a..bc695f14a 100644 --- a/src/java/org/apache/fop/render/ps/PSImageFormResource.java +++ b/src/main/java/org/apache/fop/render/ps/PSImageFormResource.java diff --git a/src/java/org/apache/fop/render/ps/PSImageHandler.java b/src/main/java/org/apache/fop/render/ps/PSImageHandler.java index 0aeafa6fa..0aeafa6fa 100644 --- a/src/java/org/apache/fop/render/ps/PSImageHandler.java +++ b/src/main/java/org/apache/fop/render/ps/PSImageHandler.java diff --git a/src/java/org/apache/fop/render/ps/PSImageHandlerEPS.java b/src/main/java/org/apache/fop/render/ps/PSImageHandlerEPS.java index b77d48162..b77d48162 100644 --- a/src/java/org/apache/fop/render/ps/PSImageHandlerEPS.java +++ b/src/main/java/org/apache/fop/render/ps/PSImageHandlerEPS.java diff --git a/src/java/org/apache/fop/render/ps/PSImageHandlerGraphics2D.java b/src/main/java/org/apache/fop/render/ps/PSImageHandlerGraphics2D.java index f7f22020a..f7f22020a 100644 --- a/src/java/org/apache/fop/render/ps/PSImageHandlerGraphics2D.java +++ b/src/main/java/org/apache/fop/render/ps/PSImageHandlerGraphics2D.java diff --git a/src/java/org/apache/fop/render/ps/PSImageHandlerRawCCITTFax.java b/src/main/java/org/apache/fop/render/ps/PSImageHandlerRawCCITTFax.java index 1bbbf310c..1bbbf310c 100644 --- a/src/java/org/apache/fop/render/ps/PSImageHandlerRawCCITTFax.java +++ b/src/main/java/org/apache/fop/render/ps/PSImageHandlerRawCCITTFax.java diff --git a/src/java/org/apache/fop/render/ps/PSImageHandlerRawJPEG.java b/src/main/java/org/apache/fop/render/ps/PSImageHandlerRawJPEG.java index deedf3bc4..deedf3bc4 100644 --- a/src/java/org/apache/fop/render/ps/PSImageHandlerRawJPEG.java +++ b/src/main/java/org/apache/fop/render/ps/PSImageHandlerRawJPEG.java diff --git a/src/java/org/apache/fop/render/ps/PSImageHandlerRawPNG.java b/src/main/java/org/apache/fop/render/ps/PSImageHandlerRawPNG.java index 2a283e913..2a283e913 100644 --- a/src/java/org/apache/fop/render/ps/PSImageHandlerRawPNG.java +++ b/src/main/java/org/apache/fop/render/ps/PSImageHandlerRawPNG.java diff --git a/src/java/org/apache/fop/render/ps/PSImageHandlerRenderedImage.java b/src/main/java/org/apache/fop/render/ps/PSImageHandlerRenderedImage.java index 6b5745e86..6b5745e86 100644 --- a/src/java/org/apache/fop/render/ps/PSImageHandlerRenderedImage.java +++ b/src/main/java/org/apache/fop/render/ps/PSImageHandlerRenderedImage.java diff --git a/src/java/org/apache/fop/render/ps/PSImageHandlerSVG.java b/src/main/java/org/apache/fop/render/ps/PSImageHandlerSVG.java index c679d7d75..c679d7d75 100644 --- a/src/java/org/apache/fop/render/ps/PSImageHandlerSVG.java +++ b/src/main/java/org/apache/fop/render/ps/PSImageHandlerSVG.java diff --git a/src/java/org/apache/fop/render/ps/PSImageUtils.java b/src/main/java/org/apache/fop/render/ps/PSImageUtils.java index 5f7aa7b79..5f7aa7b79 100644 --- a/src/java/org/apache/fop/render/ps/PSImageUtils.java +++ b/src/main/java/org/apache/fop/render/ps/PSImageUtils.java diff --git a/src/java/org/apache/fop/render/ps/PSPainter.java b/src/main/java/org/apache/fop/render/ps/PSPainter.java index d00fdd263..d00fdd263 100644 --- a/src/java/org/apache/fop/render/ps/PSPainter.java +++ b/src/main/java/org/apache/fop/render/ps/PSPainter.java diff --git a/src/java/org/apache/fop/render/ps/PSRendererConfig.java b/src/main/java/org/apache/fop/render/ps/PSRendererConfig.java index e26be11d0..e26be11d0 100644 --- a/src/java/org/apache/fop/render/ps/PSRendererConfig.java +++ b/src/main/java/org/apache/fop/render/ps/PSRendererConfig.java diff --git a/src/java/org/apache/fop/render/ps/PSRendererConfigurator.java b/src/main/java/org/apache/fop/render/ps/PSRendererConfigurator.java index 3540732d7..3540732d7 100644 --- a/src/java/org/apache/fop/render/ps/PSRendererConfigurator.java +++ b/src/main/java/org/apache/fop/render/ps/PSRendererConfigurator.java diff --git a/src/java/org/apache/fop/render/ps/PSRendererContextConstants.java b/src/main/java/org/apache/fop/render/ps/PSRendererContextConstants.java index 3150e4273..3150e4273 100644 --- a/src/java/org/apache/fop/render/ps/PSRendererContextConstants.java +++ b/src/main/java/org/apache/fop/render/ps/PSRendererContextConstants.java diff --git a/src/java/org/apache/fop/render/ps/PSRendererOption.java b/src/main/java/org/apache/fop/render/ps/PSRendererOption.java index 992ca1959..992ca1959 100644 --- a/src/java/org/apache/fop/render/ps/PSRendererOption.java +++ b/src/main/java/org/apache/fop/render/ps/PSRendererOption.java diff --git a/src/java/org/apache/fop/render/ps/PSRenderingContext.java b/src/main/java/org/apache/fop/render/ps/PSRenderingContext.java index b34874ffa..b34874ffa 100644 --- a/src/java/org/apache/fop/render/ps/PSRenderingContext.java +++ b/src/main/java/org/apache/fop/render/ps/PSRenderingContext.java diff --git a/src/java/org/apache/fop/render/ps/PSRenderingMode.java b/src/main/java/org/apache/fop/render/ps/PSRenderingMode.java index dc48b56ac..dc48b56ac 100644 --- a/src/java/org/apache/fop/render/ps/PSRenderingMode.java +++ b/src/main/java/org/apache/fop/render/ps/PSRenderingMode.java diff --git a/src/java/org/apache/fop/render/ps/PSRenderingUtil.java b/src/main/java/org/apache/fop/render/ps/PSRenderingUtil.java index 47e46da02..47e46da02 100644 --- a/src/java/org/apache/fop/render/ps/PSRenderingUtil.java +++ b/src/main/java/org/apache/fop/render/ps/PSRenderingUtil.java diff --git a/src/java/org/apache/fop/render/ps/PSSVGFlowRootElementBridge.java b/src/main/java/org/apache/fop/render/ps/PSSVGFlowRootElementBridge.java index df9e22053..df9e22053 100644 --- a/src/java/org/apache/fop/render/ps/PSSVGFlowRootElementBridge.java +++ b/src/main/java/org/apache/fop/render/ps/PSSVGFlowRootElementBridge.java diff --git a/src/java/org/apache/fop/render/ps/PSSVGHandler.java b/src/main/java/org/apache/fop/render/ps/PSSVGHandler.java index 5e3fa1ca5..5e3fa1ca5 100644 --- a/src/java/org/apache/fop/render/ps/PSSVGHandler.java +++ b/src/main/java/org/apache/fop/render/ps/PSSVGHandler.java diff --git a/src/java/org/apache/fop/render/ps/PSSupportedFlavors.java b/src/main/java/org/apache/fop/render/ps/PSSupportedFlavors.java index b5c42c99e..b5c42c99e 100644 --- a/src/java/org/apache/fop/render/ps/PSSupportedFlavors.java +++ b/src/main/java/org/apache/fop/render/ps/PSSupportedFlavors.java diff --git a/src/java/org/apache/fop/render/ps/PSTextElementBridge.java b/src/main/java/org/apache/fop/render/ps/PSTextElementBridge.java index f331ecad9..f331ecad9 100644 --- a/src/java/org/apache/fop/render/ps/PSTextElementBridge.java +++ b/src/main/java/org/apache/fop/render/ps/PSTextElementBridge.java diff --git a/src/java/org/apache/fop/render/ps/PSTextPainter.java b/src/main/java/org/apache/fop/render/ps/PSTextPainter.java index 189a6bd8f..189a6bd8f 100644 --- a/src/java/org/apache/fop/render/ps/PSTextPainter.java +++ b/src/main/java/org/apache/fop/render/ps/PSTextPainter.java diff --git a/src/java/org/apache/fop/render/ps/PSTranscoder.java b/src/main/java/org/apache/fop/render/ps/PSTranscoder.java index aeaa74714..aeaa74714 100644 --- a/src/java/org/apache/fop/render/ps/PSTranscoder.java +++ b/src/main/java/org/apache/fop/render/ps/PSTranscoder.java diff --git a/src/java/org/apache/fop/render/ps/ResourceHandler.java b/src/main/java/org/apache/fop/render/ps/ResourceHandler.java index a12ae5a49..a12ae5a49 100644 --- a/src/java/org/apache/fop/render/ps/ResourceHandler.java +++ b/src/main/java/org/apache/fop/render/ps/ResourceHandler.java diff --git a/src/java/org/apache/fop/render/ps/extensions/AbstractPSCommentElement.java b/src/main/java/org/apache/fop/render/ps/extensions/AbstractPSCommentElement.java index 11b2e5f7b..11b2e5f7b 100644 --- a/src/java/org/apache/fop/render/ps/extensions/AbstractPSCommentElement.java +++ b/src/main/java/org/apache/fop/render/ps/extensions/AbstractPSCommentElement.java diff --git a/src/java/org/apache/fop/render/ps/extensions/AbstractPSExtensionElement.java b/src/main/java/org/apache/fop/render/ps/extensions/AbstractPSExtensionElement.java index c79d31613..c79d31613 100644 --- a/src/java/org/apache/fop/render/ps/extensions/AbstractPSExtensionElement.java +++ b/src/main/java/org/apache/fop/render/ps/extensions/AbstractPSExtensionElement.java diff --git a/src/java/org/apache/fop/render/ps/extensions/AbstractPSExtensionObject.java b/src/main/java/org/apache/fop/render/ps/extensions/AbstractPSExtensionObject.java index 1ee48d9d6..1ee48d9d6 100644 --- a/src/java/org/apache/fop/render/ps/extensions/AbstractPSExtensionObject.java +++ b/src/main/java/org/apache/fop/render/ps/extensions/AbstractPSExtensionObject.java diff --git a/src/java/org/apache/fop/render/ps/extensions/PSCommentAfter.java b/src/main/java/org/apache/fop/render/ps/extensions/PSCommentAfter.java index 60c47b29c..60c47b29c 100644 --- a/src/java/org/apache/fop/render/ps/extensions/PSCommentAfter.java +++ b/src/main/java/org/apache/fop/render/ps/extensions/PSCommentAfter.java diff --git a/src/java/org/apache/fop/render/ps/extensions/PSCommentAfterElement.java b/src/main/java/org/apache/fop/render/ps/extensions/PSCommentAfterElement.java index eb0f4d833..eb0f4d833 100644 --- a/src/java/org/apache/fop/render/ps/extensions/PSCommentAfterElement.java +++ b/src/main/java/org/apache/fop/render/ps/extensions/PSCommentAfterElement.java diff --git a/src/java/org/apache/fop/render/ps/extensions/PSCommentBefore.java b/src/main/java/org/apache/fop/render/ps/extensions/PSCommentBefore.java index 60b6f2e4f..60b6f2e4f 100644 --- a/src/java/org/apache/fop/render/ps/extensions/PSCommentBefore.java +++ b/src/main/java/org/apache/fop/render/ps/extensions/PSCommentBefore.java diff --git a/src/java/org/apache/fop/render/ps/extensions/PSCommentBeforeElement.java b/src/main/java/org/apache/fop/render/ps/extensions/PSCommentBeforeElement.java index 951e685b3..951e685b3 100644 --- a/src/java/org/apache/fop/render/ps/extensions/PSCommentBeforeElement.java +++ b/src/main/java/org/apache/fop/render/ps/extensions/PSCommentBeforeElement.java diff --git a/src/java/org/apache/fop/render/ps/extensions/PSExtensionAttachment.java b/src/main/java/org/apache/fop/render/ps/extensions/PSExtensionAttachment.java index efee86aa8..efee86aa8 100644 --- a/src/java/org/apache/fop/render/ps/extensions/PSExtensionAttachment.java +++ b/src/main/java/org/apache/fop/render/ps/extensions/PSExtensionAttachment.java diff --git a/src/java/org/apache/fop/render/ps/extensions/PSExtensionElementMapping.java b/src/main/java/org/apache/fop/render/ps/extensions/PSExtensionElementMapping.java index 5721afaf6..5721afaf6 100644 --- a/src/java/org/apache/fop/render/ps/extensions/PSExtensionElementMapping.java +++ b/src/main/java/org/apache/fop/render/ps/extensions/PSExtensionElementMapping.java diff --git a/src/java/org/apache/fop/render/ps/extensions/PSExtensionHandler.java b/src/main/java/org/apache/fop/render/ps/extensions/PSExtensionHandler.java index b520d8736..b520d8736 100644 --- a/src/java/org/apache/fop/render/ps/extensions/PSExtensionHandler.java +++ b/src/main/java/org/apache/fop/render/ps/extensions/PSExtensionHandler.java diff --git a/src/java/org/apache/fop/render/ps/extensions/PSExtensionHandlerFactory.java b/src/main/java/org/apache/fop/render/ps/extensions/PSExtensionHandlerFactory.java index 736246dfb..736246dfb 100644 --- a/src/java/org/apache/fop/render/ps/extensions/PSExtensionHandlerFactory.java +++ b/src/main/java/org/apache/fop/render/ps/extensions/PSExtensionHandlerFactory.java diff --git a/src/java/org/apache/fop/render/ps/extensions/PSPageSetupCodeElement.java b/src/main/java/org/apache/fop/render/ps/extensions/PSPageSetupCodeElement.java index cf2ea9444..cf2ea9444 100644 --- a/src/java/org/apache/fop/render/ps/extensions/PSPageSetupCodeElement.java +++ b/src/main/java/org/apache/fop/render/ps/extensions/PSPageSetupCodeElement.java diff --git a/src/java/org/apache/fop/render/ps/extensions/PSPageTrailerCodeBefore.java b/src/main/java/org/apache/fop/render/ps/extensions/PSPageTrailerCodeBefore.java index f28f0003e..f28f0003e 100644 --- a/src/java/org/apache/fop/render/ps/extensions/PSPageTrailerCodeBefore.java +++ b/src/main/java/org/apache/fop/render/ps/extensions/PSPageTrailerCodeBefore.java diff --git a/src/java/org/apache/fop/render/ps/extensions/PSPageTrailerCodeBeforeElement.java b/src/main/java/org/apache/fop/render/ps/extensions/PSPageTrailerCodeBeforeElement.java index 65a22eadd..65a22eadd 100644 --- a/src/java/org/apache/fop/render/ps/extensions/PSPageTrailerCodeBeforeElement.java +++ b/src/main/java/org/apache/fop/render/ps/extensions/PSPageTrailerCodeBeforeElement.java diff --git a/src/java/org/apache/fop/render/ps/extensions/PSSetPageDevice.java b/src/main/java/org/apache/fop/render/ps/extensions/PSSetPageDevice.java index b463fc3d5..b463fc3d5 100644 --- a/src/java/org/apache/fop/render/ps/extensions/PSSetPageDevice.java +++ b/src/main/java/org/apache/fop/render/ps/extensions/PSSetPageDevice.java diff --git a/src/java/org/apache/fop/render/ps/extensions/PSSetPageDeviceElement.java b/src/main/java/org/apache/fop/render/ps/extensions/PSSetPageDeviceElement.java index 4ddc8f60f..4ddc8f60f 100644 --- a/src/java/org/apache/fop/render/ps/extensions/PSSetPageDeviceElement.java +++ b/src/main/java/org/apache/fop/render/ps/extensions/PSSetPageDeviceElement.java diff --git a/src/java/org/apache/fop/render/ps/extensions/PSSetupCode.java b/src/main/java/org/apache/fop/render/ps/extensions/PSSetupCode.java index f2d580582..f2d580582 100644 --- a/src/java/org/apache/fop/render/ps/extensions/PSSetupCode.java +++ b/src/main/java/org/apache/fop/render/ps/extensions/PSSetupCode.java diff --git a/src/java/org/apache/fop/render/ps/extensions/PSSetupCodeElement.java b/src/main/java/org/apache/fop/render/ps/extensions/PSSetupCodeElement.java index 365275455..365275455 100644 --- a/src/java/org/apache/fop/render/ps/extensions/PSSetupCodeElement.java +++ b/src/main/java/org/apache/fop/render/ps/extensions/PSSetupCodeElement.java diff --git a/src/java/org/apache/fop/render/ps/extensions/package.html b/src/main/java/org/apache/fop/render/ps/extensions/package.html index b52d4d46a..b52d4d46a 100644 --- a/src/java/org/apache/fop/render/ps/extensions/package.html +++ b/src/main/java/org/apache/fop/render/ps/extensions/package.html diff --git a/src/java/org/apache/fop/render/ps/fonts/PSTTFGenerator.java b/src/main/java/org/apache/fop/render/ps/fonts/PSTTFGenerator.java index 556b62457..556b62457 100644 --- a/src/java/org/apache/fop/render/ps/fonts/PSTTFGenerator.java +++ b/src/main/java/org/apache/fop/render/ps/fonts/PSTTFGenerator.java diff --git a/src/java/org/apache/fop/render/ps/fonts/PSTTFGlyphOutputStream.java b/src/main/java/org/apache/fop/render/ps/fonts/PSTTFGlyphOutputStream.java index cc2ae3e82..cc2ae3e82 100644 --- a/src/java/org/apache/fop/render/ps/fonts/PSTTFGlyphOutputStream.java +++ b/src/main/java/org/apache/fop/render/ps/fonts/PSTTFGlyphOutputStream.java diff --git a/src/java/org/apache/fop/render/ps/fonts/PSTTFOutputStream.java b/src/main/java/org/apache/fop/render/ps/fonts/PSTTFOutputStream.java index 271d87d1b..271d87d1b 100644 --- a/src/java/org/apache/fop/render/ps/fonts/PSTTFOutputStream.java +++ b/src/main/java/org/apache/fop/render/ps/fonts/PSTTFOutputStream.java diff --git a/src/java/org/apache/fop/render/ps/fonts/PSTTFTableOutputStream.java b/src/main/java/org/apache/fop/render/ps/fonts/PSTTFTableOutputStream.java index 2226e11e8..2226e11e8 100644 --- a/src/java/org/apache/fop/render/ps/fonts/PSTTFTableOutputStream.java +++ b/src/main/java/org/apache/fop/render/ps/fonts/PSTTFTableOutputStream.java diff --git a/src/java/org/apache/fop/render/ps/package.html b/src/main/java/org/apache/fop/render/ps/package.html index 53554c38d..53554c38d 100644 --- a/src/java/org/apache/fop/render/ps/package.html +++ b/src/main/java/org/apache/fop/render/ps/package.html diff --git a/src/java/org/apache/fop/render/ps/svg/PSSVGGraphics2D.java b/src/main/java/org/apache/fop/render/ps/svg/PSSVGGraphics2D.java index a1e7cf9dc..a1e7cf9dc 100644 --- a/src/java/org/apache/fop/render/ps/svg/PSSVGGraphics2D.java +++ b/src/main/java/org/apache/fop/render/ps/svg/PSSVGGraphics2D.java diff --git a/src/java/org/apache/fop/render/rtf/BorderAttributesConverter.java b/src/main/java/org/apache/fop/render/rtf/BorderAttributesConverter.java index 4dd7a2d95..4dd7a2d95 100644 --- a/src/java/org/apache/fop/render/rtf/BorderAttributesConverter.java +++ b/src/main/java/org/apache/fop/render/rtf/BorderAttributesConverter.java diff --git a/src/java/org/apache/fop/render/rtf/FOPRtfAttributes.java b/src/main/java/org/apache/fop/render/rtf/FOPRtfAttributes.java index 3ffed6ba0..3ffed6ba0 100644 --- a/src/java/org/apache/fop/render/rtf/FOPRtfAttributes.java +++ b/src/main/java/org/apache/fop/render/rtf/FOPRtfAttributes.java diff --git a/src/java/org/apache/fop/render/rtf/FoUnitsConverter.java b/src/main/java/org/apache/fop/render/rtf/FoUnitsConverter.java index 66c3b01ab..66c3b01ab 100644 --- a/src/java/org/apache/fop/render/rtf/FoUnitsConverter.java +++ b/src/main/java/org/apache/fop/render/rtf/FoUnitsConverter.java diff --git a/src/java/org/apache/fop/render/rtf/ListAttributesConverter.java b/src/main/java/org/apache/fop/render/rtf/ListAttributesConverter.java index b44bf16b1..b44bf16b1 100644 --- a/src/java/org/apache/fop/render/rtf/ListAttributesConverter.java +++ b/src/main/java/org/apache/fop/render/rtf/ListAttributesConverter.java diff --git a/src/java/org/apache/fop/render/rtf/PageAttributesConverter.java b/src/main/java/org/apache/fop/render/rtf/PageAttributesConverter.java index 360e5c1df..360e5c1df 100644 --- a/src/java/org/apache/fop/render/rtf/PageAttributesConverter.java +++ b/src/main/java/org/apache/fop/render/rtf/PageAttributesConverter.java diff --git a/src/java/org/apache/fop/render/rtf/RTFEventProducer.java b/src/main/java/org/apache/fop/render/rtf/RTFEventProducer.java index bab760d8d..bab760d8d 100644 --- a/src/java/org/apache/fop/render/rtf/RTFEventProducer.java +++ b/src/main/java/org/apache/fop/render/rtf/RTFEventProducer.java diff --git a/src/java/org/apache/fop/render/rtf/RTFEventProducer.xml b/src/main/java/org/apache/fop/render/rtf/RTFEventProducer.xml index cb88760e0..cb88760e0 100644 --- a/src/java/org/apache/fop/render/rtf/RTFEventProducer.xml +++ b/src/main/java/org/apache/fop/render/rtf/RTFEventProducer.xml diff --git a/src/java/org/apache/fop/render/rtf/RTFFOEventHandlerMaker.java b/src/main/java/org/apache/fop/render/rtf/RTFFOEventHandlerMaker.java index afcfbf702..afcfbf702 100644 --- a/src/java/org/apache/fop/render/rtf/RTFFOEventHandlerMaker.java +++ b/src/main/java/org/apache/fop/render/rtf/RTFFOEventHandlerMaker.java diff --git a/src/java/org/apache/fop/render/rtf/RTFHandler.java b/src/main/java/org/apache/fop/render/rtf/RTFHandler.java index 05c68bec6..05c68bec6 100644 --- a/src/java/org/apache/fop/render/rtf/RTFHandler.java +++ b/src/main/java/org/apache/fop/render/rtf/RTFHandler.java diff --git a/src/java/org/apache/fop/render/rtf/RTFPlaceHolderHelper.java b/src/main/java/org/apache/fop/render/rtf/RTFPlaceHolderHelper.java index e3278ad95..e3278ad95 100644 --- a/src/java/org/apache/fop/render/rtf/RTFPlaceHolderHelper.java +++ b/src/main/java/org/apache/fop/render/rtf/RTFPlaceHolderHelper.java diff --git a/src/java/org/apache/fop/render/rtf/TableAttributesConverter.java b/src/main/java/org/apache/fop/render/rtf/TableAttributesConverter.java index 78a8bcf12..78a8bcf12 100644 --- a/src/java/org/apache/fop/render/rtf/TableAttributesConverter.java +++ b/src/main/java/org/apache/fop/render/rtf/TableAttributesConverter.java diff --git a/src/java/org/apache/fop/render/rtf/TextAttributesConverter.java b/src/main/java/org/apache/fop/render/rtf/TextAttributesConverter.java index d3810b094..d3810b094 100644 --- a/src/java/org/apache/fop/render/rtf/TextAttributesConverter.java +++ b/src/main/java/org/apache/fop/render/rtf/TextAttributesConverter.java diff --git a/src/java/org/apache/fop/render/rtf/package.html b/src/main/java/org/apache/fop/render/rtf/package.html index 84be02e97..84be02e97 100644 --- a/src/java/org/apache/fop/render/rtf/package.html +++ b/src/main/java/org/apache/fop/render/rtf/package.html diff --git a/src/java/org/apache/fop/render/rtf/rtflib/exceptions/RtfException.java b/src/main/java/org/apache/fop/render/rtf/rtflib/exceptions/RtfException.java index eb26a4137..eb26a4137 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/exceptions/RtfException.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/exceptions/RtfException.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/exceptions/RtfStructureException.java b/src/main/java/org/apache/fop/render/rtf/rtflib/exceptions/RtfStructureException.java index b4e8e6f2e..b4e8e6f2e 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/exceptions/RtfStructureException.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/exceptions/RtfStructureException.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/exceptions/package.html b/src/main/java/org/apache/fop/render/rtf/rtflib/exceptions/package.html index da0564ad2..da0564ad2 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/exceptions/package.html +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/exceptions/package.html diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IBorderAttributes.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IBorderAttributes.java index 5b3153b15..5b3153b15 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IBorderAttributes.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IBorderAttributes.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfAfterContainer.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfAfterContainer.java index c4231a0d3..c4231a0d3 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfAfterContainer.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfAfterContainer.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfBeforeContainer.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfBeforeContainer.java index 416c885a1..416c885a1 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfBeforeContainer.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfBeforeContainer.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfBookmarkContainer.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfBookmarkContainer.java index 68c17b695..68c17b695 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfBookmarkContainer.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfBookmarkContainer.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfExternalGraphicContainer.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfExternalGraphicContainer.java index 22914a5a0..22914a5a0 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfExternalGraphicContainer.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfExternalGraphicContainer.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfHyperLinkContainer.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfHyperLinkContainer.java index 195c71423..195c71423 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfHyperLinkContainer.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfHyperLinkContainer.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfJforCmdContainer.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfJforCmdContainer.java index c1b603252..c1b603252 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfJforCmdContainer.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfJforCmdContainer.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfListContainer.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfListContainer.java index 62ec52d8a..62ec52d8a 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfListContainer.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfListContainer.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfOptions.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfOptions.java index 23b8f2d8a..23b8f2d8a 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfOptions.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfOptions.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfPageBreakContainer.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfPageBreakContainer.java index 825b3c2b4..825b3c2b4 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfPageBreakContainer.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfPageBreakContainer.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfPageContainer.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfPageContainer.java index 92a71218f..92a71218f 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfPageContainer.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfPageContainer.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfPageNumberCitationContainer.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfPageNumberCitationContainer.java index dba341700..dba341700 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfPageNumberCitationContainer.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfPageNumberCitationContainer.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfPageNumberContainer.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfPageNumberContainer.java index 9226578db..9226578db 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfPageNumberContainer.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfPageNumberContainer.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfParagraphContainer.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfParagraphContainer.java index 335d81f2d..335d81f2d 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfParagraphContainer.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfParagraphContainer.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfParagraphKeepTogetherContainer.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfParagraphKeepTogetherContainer.java index e3a4819ed..e3a4819ed 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfParagraphKeepTogetherContainer.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfParagraphKeepTogetherContainer.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfTableContainer.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfTableContainer.java index 635177727..635177727 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfTableContainer.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfTableContainer.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfTextContainer.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfTextContainer.java index 4a7779cc4..4a7779cc4 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfTextContainer.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfTextContainer.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfTextrunContainer.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfTextrunContainer.java index f9164bce2..f9164bce2 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfTextrunContainer.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IRtfTextrunContainer.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/ITableAttributes.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/ITableAttributes.java index e0639f6e5..e0639f6e5 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/ITableAttributes.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/ITableAttributes.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/ITableColumnsInfo.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/ITableColumnsInfo.java index 97a5626f4..97a5626f4 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/ITableColumnsInfo.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/ITableColumnsInfo.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IrtfTemplateContainer.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IrtfTemplateContainer.java index 1b32ece43..1b32ece43 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IrtfTemplateContainer.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/IrtfTemplateContainer.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/ParagraphKeeptogetherContext.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/ParagraphKeeptogetherContext.java index ce6212a59..ce6212a59 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/ParagraphKeeptogetherContext.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/ParagraphKeeptogetherContext.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfAfter.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfAfter.java index 832853f5f..832853f5f 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfAfter.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfAfter.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfAfterBeforeBase.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfAfterBeforeBase.java index 950921e77..950921e77 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfAfterBeforeBase.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfAfterBeforeBase.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfAttributes.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfAttributes.java index 6fa84d44c..6fa84d44c 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfAttributes.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfAttributes.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfBefore.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfBefore.java index c15339b0e..c15339b0e 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfBefore.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfBefore.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfBookmark.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfBookmark.java index e82a50eca..e82a50eca 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfBookmark.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfBookmark.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfBookmarkContainerImpl.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfBookmarkContainerImpl.java index 9733df1e7..9733df1e7 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfBookmarkContainerImpl.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfBookmarkContainerImpl.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfColorTable.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfColorTable.java index 413c9ad87..413c9ad87 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfColorTable.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfColorTable.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfContainer.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfContainer.java index a42d25b69..a42d25b69 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfContainer.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfContainer.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfDocumentArea.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfDocumentArea.java index 1f7fbab1b..1f7fbab1b 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfDocumentArea.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfDocumentArea.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfElement.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfElement.java index b9f0b501d..b9f0b501d 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfElement.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfElement.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfExternalGraphic.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfExternalGraphic.java index 5af417ed5..5af417ed5 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfExternalGraphic.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfExternalGraphic.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfExtraRowSet.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfExtraRowSet.java index 55f8cbf27..55f8cbf27 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfExtraRowSet.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfExtraRowSet.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfFile.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfFile.java index cd28a518c..cd28a518c 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfFile.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfFile.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfFontManager.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfFontManager.java index 4701604c8..4701604c8 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfFontManager.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfFontManager.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfFontTable.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfFontTable.java index 50b53a4e8..50b53a4e8 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfFontTable.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfFontTable.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfFootnote.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfFootnote.java index 47b6944b5..47b6944b5 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfFootnote.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfFootnote.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfGenerator.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfGenerator.java index ce51f93a0..ce51f93a0 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfGenerator.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfGenerator.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfHeader.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfHeader.java index 845ee1d28..845ee1d28 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfHeader.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfHeader.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfHyperLink.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfHyperLink.java index 58d93e45d..58d93e45d 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfHyperLink.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfHyperLink.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfJforCmd.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfJforCmd.java index dd007f774..dd007f774 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfJforCmd.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfJforCmd.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfLeader.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfLeader.java index 88ce01edc..88ce01edc 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfLeader.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfLeader.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfLineBreak.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfLineBreak.java index 5fe5c2f0b..5fe5c2f0b 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfLineBreak.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfLineBreak.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfList.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfList.java index a89159109..a89159109 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfList.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfList.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListItem.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListItem.java index 209cbe102..209cbe102 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListItem.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListItem.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListStyle.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListStyle.java index 4364b92f9..4364b92f9 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListStyle.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListStyle.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListStyleBullet.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListStyleBullet.java index 9c7235352..9c7235352 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListStyleBullet.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListStyleBullet.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListStyleNumber.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListStyleNumber.java index c03315715..c03315715 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListStyleNumber.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListStyleNumber.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListStyleText.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListStyleText.java index e236ea4bd..e236ea4bd 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListStyleText.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListStyleText.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListTable.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListTable.java index ff51d8535..ff51d8535 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListTable.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListTable.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfNull.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfNull.java index c446e0e82..c446e0e82 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfNull.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfNull.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfOptions.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfOptions.java index 7cacb82f8..7cacb82f8 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfOptions.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfOptions.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfPage.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfPage.java index 11feb951c..11feb951c 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfPage.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfPage.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfPageArea.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfPageArea.java index 4dfcd5bec..4dfcd5bec 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfPageArea.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfPageArea.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfPageBreak.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfPageBreak.java index 9707fe439..9707fe439 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfPageBreak.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfPageBreak.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfPageNumber.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfPageNumber.java index 1fc3cd5c1..1fc3cd5c1 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfPageNumber.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfPageNumber.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfPageNumberCitation.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfPageNumberCitation.java index 6cd78f03b..6cd78f03b 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfPageNumberCitation.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfPageNumberCitation.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfParagraph.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfParagraph.java index 4b5554acf..4b5554acf 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfParagraph.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfParagraph.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfParagraphBreak.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfParagraphBreak.java index 15c4d0e35..15c4d0e35 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfParagraphBreak.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfParagraphBreak.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfParagraphKeepTogether.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfParagraphKeepTogether.java index d682626ec..d682626ec 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfParagraphKeepTogether.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfParagraphKeepTogether.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfSection.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfSection.java index 0a796a3d9..0a796a3d9 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfSection.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfSection.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfSpaceManager.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfSpaceManager.java index e38a78c95..e38a78c95 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfSpaceManager.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfSpaceManager.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfSpaceSplitter.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfSpaceSplitter.java index 689a2753f..689a2753f 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfSpaceSplitter.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfSpaceSplitter.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfString.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfString.java index 8f0e3d0b3..8f0e3d0b3 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfString.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfString.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfStringConverter.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfStringConverter.java index 9f542dd75..9f542dd75 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfStringConverter.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfStringConverter.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfStyleSheetTable.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfStyleSheetTable.java index 48d6efed1..48d6efed1 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfStyleSheetTable.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfStyleSheetTable.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTable.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTable.java index aecf30dce..aecf30dce 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTable.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTable.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableCell.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableCell.java index e37070905..e37070905 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableCell.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableCell.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableRow.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableRow.java index 8dd58739c..8dd58739c 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableRow.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableRow.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTemplate.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTemplate.java index 6d928765c..6d928765c 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTemplate.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTemplate.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfText.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfText.java index e32891e9b..e32891e9b 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfText.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfText.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTextrun.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTextrun.java index 5a1615541..5a1615541 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTextrun.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTextrun.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/WhitespaceCollapser.java b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/WhitespaceCollapser.java index abe903a73..abe903a73 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/WhitespaceCollapser.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/WhitespaceCollapser.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/package.html b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/package.html index 1d8c8db97..1d8c8db97 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/package.html +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/package.html diff --git a/src/java/org/apache/fop/render/rtf/rtflib/tools/BuilderContext.java b/src/main/java/org/apache/fop/render/rtf/rtflib/tools/BuilderContext.java index 4b3f8bd4a..4b3f8bd4a 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/tools/BuilderContext.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/tools/BuilderContext.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/tools/ImageConstants.java b/src/main/java/org/apache/fop/render/rtf/rtflib/tools/ImageConstants.java index 7f65f9c10..7f65f9c10 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/tools/ImageConstants.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/tools/ImageConstants.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/tools/ImageUtil.java b/src/main/java/org/apache/fop/render/rtf/rtflib/tools/ImageUtil.java index fb590ab63..fb590ab63 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/tools/ImageUtil.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/tools/ImageUtil.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/tools/PercentContext.java b/src/main/java/org/apache/fop/render/rtf/rtflib/tools/PercentContext.java index a1d76478c..a1d76478c 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/tools/PercentContext.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/tools/PercentContext.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/tools/TableContext.java b/src/main/java/org/apache/fop/render/rtf/rtflib/tools/TableContext.java index 3e1aca1c1..3e1aca1c1 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/tools/TableContext.java +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/tools/TableContext.java diff --git a/src/java/org/apache/fop/render/rtf/rtflib/tools/package.html b/src/main/java/org/apache/fop/render/rtf/rtflib/tools/package.html index 1a0347b9b..1a0347b9b 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/tools/package.html +++ b/src/main/java/org/apache/fop/render/rtf/rtflib/tools/package.html diff --git a/src/java/org/apache/fop/render/txt/Helper.java b/src/main/java/org/apache/fop/render/txt/Helper.java index 1bdf86f0f..1bdf86f0f 100644 --- a/src/java/org/apache/fop/render/txt/Helper.java +++ b/src/main/java/org/apache/fop/render/txt/Helper.java diff --git a/src/java/org/apache/fop/render/txt/TXTRenderer.java b/src/main/java/org/apache/fop/render/txt/TXTRenderer.java index 811906f36..811906f36 100644 --- a/src/java/org/apache/fop/render/txt/TXTRenderer.java +++ b/src/main/java/org/apache/fop/render/txt/TXTRenderer.java diff --git a/src/java/org/apache/fop/render/txt/TXTRendererConfigurator.java b/src/main/java/org/apache/fop/render/txt/TXTRendererConfigurator.java index a600047ae..a600047ae 100644 --- a/src/java/org/apache/fop/render/txt/TXTRendererConfigurator.java +++ b/src/main/java/org/apache/fop/render/txt/TXTRendererConfigurator.java diff --git a/src/java/org/apache/fop/render/txt/TXTRendererMaker.java b/src/main/java/org/apache/fop/render/txt/TXTRendererMaker.java index 150338120..150338120 100644 --- a/src/java/org/apache/fop/render/txt/TXTRendererMaker.java +++ b/src/main/java/org/apache/fop/render/txt/TXTRendererMaker.java diff --git a/src/java/org/apache/fop/render/txt/TXTState.java b/src/main/java/org/apache/fop/render/txt/TXTState.java index 09abc2515..09abc2515 100644 --- a/src/java/org/apache/fop/render/txt/TXTState.java +++ b/src/main/java/org/apache/fop/render/txt/TXTState.java diff --git a/src/java/org/apache/fop/render/txt/TXTStream.java b/src/main/java/org/apache/fop/render/txt/TXTStream.java index 44a237b34..44a237b34 100644 --- a/src/java/org/apache/fop/render/txt/TXTStream.java +++ b/src/main/java/org/apache/fop/render/txt/TXTStream.java diff --git a/src/java/org/apache/fop/render/txt/TxtRendererConfig.java b/src/main/java/org/apache/fop/render/txt/TxtRendererConfig.java index f597ee518..f597ee518 100644 --- a/src/java/org/apache/fop/render/txt/TxtRendererConfig.java +++ b/src/main/java/org/apache/fop/render/txt/TxtRendererConfig.java diff --git a/src/java/org/apache/fop/render/txt/border/AbstractBorderElement.java b/src/main/java/org/apache/fop/render/txt/border/AbstractBorderElement.java index cd79594c1..cd79594c1 100644 --- a/src/java/org/apache/fop/render/txt/border/AbstractBorderElement.java +++ b/src/main/java/org/apache/fop/render/txt/border/AbstractBorderElement.java diff --git a/src/java/org/apache/fop/render/txt/border/BorderManager.java b/src/main/java/org/apache/fop/render/txt/border/BorderManager.java index 0af243ec6..0af243ec6 100644 --- a/src/java/org/apache/fop/render/txt/border/BorderManager.java +++ b/src/main/java/org/apache/fop/render/txt/border/BorderManager.java diff --git a/src/java/org/apache/fop/render/txt/border/DashedBorderElement.java b/src/main/java/org/apache/fop/render/txt/border/DashedBorderElement.java index 7c806e6ce..7c806e6ce 100644 --- a/src/java/org/apache/fop/render/txt/border/DashedBorderElement.java +++ b/src/main/java/org/apache/fop/render/txt/border/DashedBorderElement.java diff --git a/src/java/org/apache/fop/render/txt/border/DottedBorderElement.java b/src/main/java/org/apache/fop/render/txt/border/DottedBorderElement.java index 3e1700f1a..3e1700f1a 100644 --- a/src/java/org/apache/fop/render/txt/border/DottedBorderElement.java +++ b/src/main/java/org/apache/fop/render/txt/border/DottedBorderElement.java diff --git a/src/java/org/apache/fop/render/txt/border/SolidAndDoubleBorderElement.java b/src/main/java/org/apache/fop/render/txt/border/SolidAndDoubleBorderElement.java index 7defc64c6..7defc64c6 100644 --- a/src/java/org/apache/fop/render/txt/border/SolidAndDoubleBorderElement.java +++ b/src/main/java/org/apache/fop/render/txt/border/SolidAndDoubleBorderElement.java diff --git a/src/java/org/apache/fop/render/txt/border/package.html b/src/main/java/org/apache/fop/render/txt/border/package.html index 495563755..495563755 100644 --- a/src/java/org/apache/fop/render/txt/border/package.html +++ b/src/main/java/org/apache/fop/render/txt/border/package.html diff --git a/src/java/org/apache/fop/render/txt/package.html b/src/main/java/org/apache/fop/render/txt/package.html index af1dc76fe..af1dc76fe 100644 --- a/src/java/org/apache/fop/render/txt/package.html +++ b/src/main/java/org/apache/fop/render/txt/package.html diff --git a/src/java/org/apache/fop/render/xml/AbstractXMLRenderer.java b/src/main/java/org/apache/fop/render/xml/AbstractXMLRenderer.java index 149111e0d..149111e0d 100644 --- a/src/java/org/apache/fop/render/xml/AbstractXMLRenderer.java +++ b/src/main/java/org/apache/fop/render/xml/AbstractXMLRenderer.java diff --git a/src/java/org/apache/fop/render/xml/XMLRenderer.java b/src/main/java/org/apache/fop/render/xml/XMLRenderer.java index c50508edb..c50508edb 100644 --- a/src/java/org/apache/fop/render/xml/XMLRenderer.java +++ b/src/main/java/org/apache/fop/render/xml/XMLRenderer.java diff --git a/src/java/org/apache/fop/render/xml/XMLRendererMaker.java b/src/main/java/org/apache/fop/render/xml/XMLRendererMaker.java index 3110ed0ef..3110ed0ef 100644 --- a/src/java/org/apache/fop/render/xml/XMLRendererMaker.java +++ b/src/main/java/org/apache/fop/render/xml/XMLRendererMaker.java diff --git a/src/java/org/apache/fop/render/xml/XMLXMLHandler.java b/src/main/java/org/apache/fop/render/xml/XMLXMLHandler.java index 65a3aa026..65a3aa026 100644 --- a/src/java/org/apache/fop/render/xml/XMLXMLHandler.java +++ b/src/main/java/org/apache/fop/render/xml/XMLXMLHandler.java diff --git a/src/java/org/apache/fop/render/xml/package.html b/src/main/java/org/apache/fop/render/xml/package.html index 297d1af24..297d1af24 100644 --- a/src/java/org/apache/fop/render/xml/package.html +++ b/src/main/java/org/apache/fop/render/xml/package.html diff --git a/src/java/org/apache/fop/servlet/FopPrintServlet.java b/src/main/java/org/apache/fop/servlet/FopPrintServlet.java index 006a95dfc..006a95dfc 100644 --- a/src/java/org/apache/fop/servlet/FopPrintServlet.java +++ b/src/main/java/org/apache/fop/servlet/FopPrintServlet.java diff --git a/src/java/org/apache/fop/servlet/FopServlet.java b/src/main/java/org/apache/fop/servlet/FopServlet.java index f06486c2b..f06486c2b 100644 --- a/src/java/org/apache/fop/servlet/FopServlet.java +++ b/src/main/java/org/apache/fop/servlet/FopServlet.java diff --git a/src/java/org/apache/fop/servlet/ServletContextURIResolver.java b/src/main/java/org/apache/fop/servlet/ServletContextURIResolver.java index 413dac76d..413dac76d 100644 --- a/src/java/org/apache/fop/servlet/ServletContextURIResolver.java +++ b/src/main/java/org/apache/fop/servlet/ServletContextURIResolver.java diff --git a/src/java/org/apache/fop/servlet/package.html b/src/main/java/org/apache/fop/servlet/package.html index 4e09e188b..4e09e188b 100644 --- a/src/java/org/apache/fop/servlet/package.html +++ b/src/main/java/org/apache/fop/servlet/package.html diff --git a/src/java/org/apache/fop/svg/ACIUtils.java b/src/main/java/org/apache/fop/svg/ACIUtils.java index deba98f21..deba98f21 100644 --- a/src/java/org/apache/fop/svg/ACIUtils.java +++ b/src/main/java/org/apache/fop/svg/ACIUtils.java diff --git a/src/java/org/apache/fop/svg/AbstractFOPBridgeContext.java b/src/main/java/org/apache/fop/svg/AbstractFOPBridgeContext.java index 1622d4f51..1622d4f51 100644 --- a/src/java/org/apache/fop/svg/AbstractFOPBridgeContext.java +++ b/src/main/java/org/apache/fop/svg/AbstractFOPBridgeContext.java diff --git a/src/java/org/apache/fop/svg/AbstractFOPImageElementBridge.java b/src/main/java/org/apache/fop/svg/AbstractFOPImageElementBridge.java index 42fb729dd..42fb729dd 100644 --- a/src/java/org/apache/fop/svg/AbstractFOPImageElementBridge.java +++ b/src/main/java/org/apache/fop/svg/AbstractFOPImageElementBridge.java diff --git a/src/java/org/apache/fop/svg/AbstractFOPTextElementBridge.java b/src/main/java/org/apache/fop/svg/AbstractFOPTextElementBridge.java index 59db21d63..59db21d63 100644 --- a/src/java/org/apache/fop/svg/AbstractFOPTextElementBridge.java +++ b/src/main/java/org/apache/fop/svg/AbstractFOPTextElementBridge.java diff --git a/src/java/org/apache/fop/svg/AbstractFOPTextPainter.java b/src/main/java/org/apache/fop/svg/AbstractFOPTextPainter.java index df24dbb92..df24dbb92 100644 --- a/src/java/org/apache/fop/svg/AbstractFOPTextPainter.java +++ b/src/main/java/org/apache/fop/svg/AbstractFOPTextPainter.java diff --git a/src/java/org/apache/fop/svg/AbstractFOPTranscoder.java b/src/main/java/org/apache/fop/svg/AbstractFOPTranscoder.java index 430638a4b..430638a4b 100644 --- a/src/java/org/apache/fop/svg/AbstractFOPTranscoder.java +++ b/src/main/java/org/apache/fop/svg/AbstractFOPTranscoder.java diff --git a/src/java/org/apache/fop/svg/FOPSAXSVGDocumentFactory.java b/src/main/java/org/apache/fop/svg/FOPSAXSVGDocumentFactory.java index b8e73a29d..b8e73a29d 100644 --- a/src/java/org/apache/fop/svg/FOPSAXSVGDocumentFactory.java +++ b/src/main/java/org/apache/fop/svg/FOPSAXSVGDocumentFactory.java diff --git a/src/java/org/apache/fop/svg/FOPTextHandler.java b/src/main/java/org/apache/fop/svg/FOPTextHandler.java index cb59c7472..cb59c7472 100644 --- a/src/java/org/apache/fop/svg/FOPTextHandler.java +++ b/src/main/java/org/apache/fop/svg/FOPTextHandler.java diff --git a/src/java/org/apache/fop/svg/FOPTextHandlerAdapter.java b/src/main/java/org/apache/fop/svg/FOPTextHandlerAdapter.java index 6f326546e..6f326546e 100644 --- a/src/java/org/apache/fop/svg/FOPTextHandlerAdapter.java +++ b/src/main/java/org/apache/fop/svg/FOPTextHandlerAdapter.java diff --git a/src/java/org/apache/fop/svg/GraphicsConfiguration.java b/src/main/java/org/apache/fop/svg/GraphicsConfiguration.java index f64eab62f..f64eab62f 100644 --- a/src/java/org/apache/fop/svg/GraphicsConfiguration.java +++ b/src/main/java/org/apache/fop/svg/GraphicsConfiguration.java diff --git a/src/java/org/apache/fop/svg/NativeImageHandler.java b/src/main/java/org/apache/fop/svg/NativeImageHandler.java index e9d8116e6..e9d8116e6 100644 --- a/src/java/org/apache/fop/svg/NativeImageHandler.java +++ b/src/main/java/org/apache/fop/svg/NativeImageHandler.java diff --git a/src/java/org/apache/fop/svg/NativeTextPainter.java b/src/main/java/org/apache/fop/svg/NativeTextPainter.java index 983a184c4..983a184c4 100644 --- a/src/java/org/apache/fop/svg/NativeTextPainter.java +++ b/src/main/java/org/apache/fop/svg/NativeTextPainter.java diff --git a/src/java/org/apache/fop/svg/PDFAElementBridge.java b/src/main/java/org/apache/fop/svg/PDFAElementBridge.java index c2a481af9..c2a481af9 100644 --- a/src/java/org/apache/fop/svg/PDFAElementBridge.java +++ b/src/main/java/org/apache/fop/svg/PDFAElementBridge.java diff --git a/src/java/org/apache/fop/svg/PDFANode.java b/src/main/java/org/apache/fop/svg/PDFANode.java index 005a34a71..005a34a71 100644 --- a/src/java/org/apache/fop/svg/PDFANode.java +++ b/src/main/java/org/apache/fop/svg/PDFANode.java diff --git a/src/java/org/apache/fop/svg/PDFBatikFlowTextElementBridge.java b/src/main/java/org/apache/fop/svg/PDFBatikFlowTextElementBridge.java index 44f3b10fa..44f3b10fa 100644 --- a/src/java/org/apache/fop/svg/PDFBatikFlowTextElementBridge.java +++ b/src/main/java/org/apache/fop/svg/PDFBatikFlowTextElementBridge.java diff --git a/src/java/org/apache/fop/svg/PDFBridgeContext.java b/src/main/java/org/apache/fop/svg/PDFBridgeContext.java index 0f6ba60c8..0f6ba60c8 100644 --- a/src/java/org/apache/fop/svg/PDFBridgeContext.java +++ b/src/main/java/org/apache/fop/svg/PDFBridgeContext.java diff --git a/src/java/org/apache/fop/svg/PDFContext.java b/src/main/java/org/apache/fop/svg/PDFContext.java index b7eec7b73..b7eec7b73 100644 --- a/src/java/org/apache/fop/svg/PDFContext.java +++ b/src/main/java/org/apache/fop/svg/PDFContext.java diff --git a/src/java/org/apache/fop/svg/PDFDocumentGraphics2D.java b/src/main/java/org/apache/fop/svg/PDFDocumentGraphics2D.java index 19862480b..19862480b 100644 --- a/src/java/org/apache/fop/svg/PDFDocumentGraphics2D.java +++ b/src/main/java/org/apache/fop/svg/PDFDocumentGraphics2D.java diff --git a/src/java/org/apache/fop/svg/PDFDocumentGraphics2DConfigurator.java b/src/main/java/org/apache/fop/svg/PDFDocumentGraphics2DConfigurator.java index a8e9307a7..a8e9307a7 100644 --- a/src/java/org/apache/fop/svg/PDFDocumentGraphics2DConfigurator.java +++ b/src/main/java/org/apache/fop/svg/PDFDocumentGraphics2DConfigurator.java diff --git a/src/java/org/apache/fop/svg/PDFFlowExtTextPainter.java b/src/main/java/org/apache/fop/svg/PDFFlowExtTextPainter.java index 5472a9fa1..5472a9fa1 100644 --- a/src/java/org/apache/fop/svg/PDFFlowExtTextPainter.java +++ b/src/main/java/org/apache/fop/svg/PDFFlowExtTextPainter.java diff --git a/src/java/org/apache/fop/svg/PDFFlowTextPainter.java b/src/main/java/org/apache/fop/svg/PDFFlowTextPainter.java index beb97c539..beb97c539 100644 --- a/src/java/org/apache/fop/svg/PDFFlowTextPainter.java +++ b/src/main/java/org/apache/fop/svg/PDFFlowTextPainter.java diff --git a/src/java/org/apache/fop/svg/PDFGraphics2D.java b/src/main/java/org/apache/fop/svg/PDFGraphics2D.java index f415c5473..f415c5473 100644 --- a/src/java/org/apache/fop/svg/PDFGraphics2D.java +++ b/src/main/java/org/apache/fop/svg/PDFGraphics2D.java diff --git a/src/java/org/apache/fop/svg/PDFGraphicsConfiguration.java b/src/main/java/org/apache/fop/svg/PDFGraphicsConfiguration.java index a41b7e229..a41b7e229 100644 --- a/src/java/org/apache/fop/svg/PDFGraphicsConfiguration.java +++ b/src/main/java/org/apache/fop/svg/PDFGraphicsConfiguration.java diff --git a/src/java/org/apache/fop/svg/PDFGraphicsDevice.java b/src/main/java/org/apache/fop/svg/PDFGraphicsDevice.java index 43658fd6d..43658fd6d 100644 --- a/src/java/org/apache/fop/svg/PDFGraphicsDevice.java +++ b/src/main/java/org/apache/fop/svg/PDFGraphicsDevice.java diff --git a/src/java/org/apache/fop/svg/PDFImageElementBridge.java b/src/main/java/org/apache/fop/svg/PDFImageElementBridge.java index 0cc14b7e3..0cc14b7e3 100644 --- a/src/java/org/apache/fop/svg/PDFImageElementBridge.java +++ b/src/main/java/org/apache/fop/svg/PDFImageElementBridge.java diff --git a/src/java/org/apache/fop/svg/PDFSVGFlowRootElementBridge.java b/src/main/java/org/apache/fop/svg/PDFSVGFlowRootElementBridge.java index c65630819..c65630819 100644 --- a/src/java/org/apache/fop/svg/PDFSVGFlowRootElementBridge.java +++ b/src/main/java/org/apache/fop/svg/PDFSVGFlowRootElementBridge.java diff --git a/src/java/org/apache/fop/svg/PDFTextElementBridge.java b/src/main/java/org/apache/fop/svg/PDFTextElementBridge.java index e63b580f2..e63b580f2 100644 --- a/src/java/org/apache/fop/svg/PDFTextElementBridge.java +++ b/src/main/java/org/apache/fop/svg/PDFTextElementBridge.java diff --git a/src/java/org/apache/fop/svg/PDFTextPainter.java b/src/main/java/org/apache/fop/svg/PDFTextPainter.java index 0320438f8..0320438f8 100644 --- a/src/java/org/apache/fop/svg/PDFTextPainter.java +++ b/src/main/java/org/apache/fop/svg/PDFTextPainter.java diff --git a/src/java/org/apache/fop/svg/PDFTextUtil.java b/src/main/java/org/apache/fop/svg/PDFTextUtil.java index 23fadc542..23fadc542 100644 --- a/src/java/org/apache/fop/svg/PDFTextUtil.java +++ b/src/main/java/org/apache/fop/svg/PDFTextUtil.java diff --git a/src/java/org/apache/fop/svg/PDFTranscoder.java b/src/main/java/org/apache/fop/svg/PDFTranscoder.java index f52b18437..f52b18437 100644 --- a/src/java/org/apache/fop/svg/PDFTranscoder.java +++ b/src/main/java/org/apache/fop/svg/PDFTranscoder.java diff --git a/src/java/org/apache/fop/svg/SVGEventProducer.java b/src/main/java/org/apache/fop/svg/SVGEventProducer.java index ce8b0a422..ce8b0a422 100644 --- a/src/java/org/apache/fop/svg/SVGEventProducer.java +++ b/src/main/java/org/apache/fop/svg/SVGEventProducer.java diff --git a/src/java/org/apache/fop/svg/SVGEventProducer.xml b/src/main/java/org/apache/fop/svg/SVGEventProducer.xml index e7d9b555d..e7d9b555d 100644 --- a/src/java/org/apache/fop/svg/SVGEventProducer.xml +++ b/src/main/java/org/apache/fop/svg/SVGEventProducer.xml diff --git a/src/java/org/apache/fop/svg/SVGUserAgent.java b/src/main/java/org/apache/fop/svg/SVGUserAgent.java index 6a4d9d0de..6a4d9d0de 100644 --- a/src/java/org/apache/fop/svg/SVGUserAgent.java +++ b/src/main/java/org/apache/fop/svg/SVGUserAgent.java diff --git a/src/java/org/apache/fop/svg/SVGUtilities.java b/src/main/java/org/apache/fop/svg/SVGUtilities.java index d75aa2099..d75aa2099 100644 --- a/src/java/org/apache/fop/svg/SVGUtilities.java +++ b/src/main/java/org/apache/fop/svg/SVGUtilities.java diff --git a/src/java/org/apache/fop/svg/SimpleSVGUserAgent.java b/src/main/java/org/apache/fop/svg/SimpleSVGUserAgent.java index 0267cb683..0267cb683 100644 --- a/src/java/org/apache/fop/svg/SimpleSVGUserAgent.java +++ b/src/main/java/org/apache/fop/svg/SimpleSVGUserAgent.java diff --git a/src/java/org/apache/fop/svg/font/AggregatingFontFamilyResolver.java b/src/main/java/org/apache/fop/svg/font/AggregatingFontFamilyResolver.java index 9ac0ccc47..9ac0ccc47 100644 --- a/src/java/org/apache/fop/svg/font/AggregatingFontFamilyResolver.java +++ b/src/main/java/org/apache/fop/svg/font/AggregatingFontFamilyResolver.java diff --git a/src/java/org/apache/fop/svg/font/ComplexGlyphVector.java b/src/main/java/org/apache/fop/svg/font/ComplexGlyphVector.java index 567f9726a..567f9726a 100644 --- a/src/java/org/apache/fop/svg/font/ComplexGlyphVector.java +++ b/src/main/java/org/apache/fop/svg/font/ComplexGlyphVector.java diff --git a/src/java/org/apache/fop/svg/font/FOPFontFamilyResolver.java b/src/main/java/org/apache/fop/svg/font/FOPFontFamilyResolver.java index 92911d0ee..92911d0ee 100644 --- a/src/java/org/apache/fop/svg/font/FOPFontFamilyResolver.java +++ b/src/main/java/org/apache/fop/svg/font/FOPFontFamilyResolver.java diff --git a/src/java/org/apache/fop/svg/font/FOPFontFamilyResolverImpl.java b/src/main/java/org/apache/fop/svg/font/FOPFontFamilyResolverImpl.java index 4305838da..4305838da 100644 --- a/src/java/org/apache/fop/svg/font/FOPFontFamilyResolverImpl.java +++ b/src/main/java/org/apache/fop/svg/font/FOPFontFamilyResolverImpl.java diff --git a/src/java/org/apache/fop/svg/font/FOPGVTFont.java b/src/main/java/org/apache/fop/svg/font/FOPGVTFont.java index 3a1b49c78..3a1b49c78 100644 --- a/src/java/org/apache/fop/svg/font/FOPGVTFont.java +++ b/src/main/java/org/apache/fop/svg/font/FOPGVTFont.java diff --git a/src/java/org/apache/fop/svg/font/FOPGVTFontFamily.java b/src/main/java/org/apache/fop/svg/font/FOPGVTFontFamily.java index b9351af44..b9351af44 100644 --- a/src/java/org/apache/fop/svg/font/FOPGVTFontFamily.java +++ b/src/main/java/org/apache/fop/svg/font/FOPGVTFontFamily.java diff --git a/src/java/org/apache/fop/svg/font/FOPGVTGlyphVector.java b/src/main/java/org/apache/fop/svg/font/FOPGVTGlyphVector.java index ef9adf08f..ef9adf08f 100644 --- a/src/java/org/apache/fop/svg/font/FOPGVTGlyphVector.java +++ b/src/main/java/org/apache/fop/svg/font/FOPGVTGlyphVector.java diff --git a/src/java/org/apache/fop/svg/font/FilteringFontFamilyResolver.java b/src/main/java/org/apache/fop/svg/font/FilteringFontFamilyResolver.java index 93b92ea36..93b92ea36 100644 --- a/src/java/org/apache/fop/svg/font/FilteringFontFamilyResolver.java +++ b/src/main/java/org/apache/fop/svg/font/FilteringFontFamilyResolver.java diff --git a/src/java/org/apache/fop/svg/package.html b/src/main/java/org/apache/fop/svg/package.html index a42efa921..a42efa921 100644 --- a/src/java/org/apache/fop/svg/package.html +++ b/src/main/java/org/apache/fop/svg/package.html diff --git a/src/java/org/apache/fop/svg/text/BidiAttributedCharacterIterator.java b/src/main/java/org/apache/fop/svg/text/BidiAttributedCharacterIterator.java index 268d44747..268d44747 100644 --- a/src/java/org/apache/fop/svg/text/BidiAttributedCharacterIterator.java +++ b/src/main/java/org/apache/fop/svg/text/BidiAttributedCharacterIterator.java diff --git a/src/java/org/apache/fop/svg/text/ComplexGlyphLayout.java b/src/main/java/org/apache/fop/svg/text/ComplexGlyphLayout.java index b90e89b01..b90e89b01 100644 --- a/src/java/org/apache/fop/svg/text/ComplexGlyphLayout.java +++ b/src/main/java/org/apache/fop/svg/text/ComplexGlyphLayout.java diff --git a/src/java/org/apache/fop/text/linebreak/LineBreakStatus.java b/src/main/java/org/apache/fop/text/linebreak/LineBreakStatus.java index 157a480cc..157a480cc 100644 --- a/src/java/org/apache/fop/text/linebreak/LineBreakStatus.java +++ b/src/main/java/org/apache/fop/text/linebreak/LineBreakStatus.java diff --git a/src/java/org/apache/fop/text/linebreak/LineBreakUtils.java b/src/main/java/org/apache/fop/text/linebreak/LineBreakUtils.java index 6598d1b85..6598d1b85 100644 --- a/src/java/org/apache/fop/text/linebreak/LineBreakUtils.java +++ b/src/main/java/org/apache/fop/text/linebreak/LineBreakUtils.java diff --git a/src/java/org/apache/fop/text/linebreak/package.html b/src/main/java/org/apache/fop/text/linebreak/package.html index 3eca305f0..3eca305f0 100644 --- a/src/java/org/apache/fop/text/linebreak/package.html +++ b/src/main/java/org/apache/fop/text/linebreak/package.html diff --git a/src/java/org/apache/fop/tools/TestConverter.java b/src/main/java/org/apache/fop/tools/TestConverter.java index d837a29fb..d837a29fb 100644 --- a/src/java/org/apache/fop/tools/TestConverter.java +++ b/src/main/java/org/apache/fop/tools/TestConverter.java diff --git a/src/java/org/apache/fop/tools/anttasks/FileCompare.java b/src/main/java/org/apache/fop/tools/anttasks/FileCompare.java index 7fa588e23..7fa588e23 100644 --- a/src/java/org/apache/fop/tools/anttasks/FileCompare.java +++ b/src/main/java/org/apache/fop/tools/anttasks/FileCompare.java diff --git a/src/java/org/apache/fop/tools/anttasks/Fop.java b/src/main/java/org/apache/fop/tools/anttasks/Fop.java index 8460e5964..8460e5964 100644 --- a/src/java/org/apache/fop/tools/anttasks/Fop.java +++ b/src/main/java/org/apache/fop/tools/anttasks/Fop.java diff --git a/src/java/org/apache/fop/tools/anttasks/RunTest.java b/src/main/java/org/apache/fop/tools/anttasks/RunTest.java index 0d728ae9a..0d728ae9a 100644 --- a/src/java/org/apache/fop/tools/anttasks/RunTest.java +++ b/src/main/java/org/apache/fop/tools/anttasks/RunTest.java diff --git a/src/java/org/apache/fop/tools/anttasks/package.html b/src/main/java/org/apache/fop/tools/anttasks/package.html index 56d04d745..56d04d745 100644 --- a/src/java/org/apache/fop/tools/anttasks/package.html +++ b/src/main/java/org/apache/fop/tools/anttasks/package.html diff --git a/src/java/org/apache/fop/tools/fontlist/FontListGenerator.java b/src/main/java/org/apache/fop/tools/fontlist/FontListGenerator.java index 0f3f737f7..0f3f737f7 100644 --- a/src/java/org/apache/fop/tools/fontlist/FontListGenerator.java +++ b/src/main/java/org/apache/fop/tools/fontlist/FontListGenerator.java diff --git a/src/java/org/apache/fop/tools/fontlist/FontListMain.java b/src/main/java/org/apache/fop/tools/fontlist/FontListMain.java index af9921c4d..af9921c4d 100644 --- a/src/java/org/apache/fop/tools/fontlist/FontListMain.java +++ b/src/main/java/org/apache/fop/tools/fontlist/FontListMain.java diff --git a/src/java/org/apache/fop/tools/fontlist/FontListSerializer.java b/src/main/java/org/apache/fop/tools/fontlist/FontListSerializer.java index 3b3d13245..3b3d13245 100644 --- a/src/java/org/apache/fop/tools/fontlist/FontListSerializer.java +++ b/src/main/java/org/apache/fop/tools/fontlist/FontListSerializer.java diff --git a/src/java/org/apache/fop/tools/fontlist/FontSpec.java b/src/main/java/org/apache/fop/tools/fontlist/FontSpec.java index 35b882c46..35b882c46 100644 --- a/src/java/org/apache/fop/tools/fontlist/FontSpec.java +++ b/src/main/java/org/apache/fop/tools/fontlist/FontSpec.java diff --git a/src/java/org/apache/fop/tools/fontlist/fonts2fo.xsl b/src/main/java/org/apache/fop/tools/fontlist/fonts2fo.xsl index 5c2b59e8e..5c2b59e8e 100644 --- a/src/java/org/apache/fop/tools/fontlist/fonts2fo.xsl +++ b/src/main/java/org/apache/fop/tools/fontlist/fonts2fo.xsl diff --git a/src/java/org/apache/fop/tools/package.html b/src/main/java/org/apache/fop/tools/package.html index ec17cacd7..ec17cacd7 100644 --- a/src/java/org/apache/fop/tools/package.html +++ b/src/main/java/org/apache/fop/tools/package.html diff --git a/src/java/org/apache/fop/traits/BorderProps.java b/src/main/java/org/apache/fop/traits/BorderProps.java index d230a02b2..d230a02b2 100644 --- a/src/java/org/apache/fop/traits/BorderProps.java +++ b/src/main/java/org/apache/fop/traits/BorderProps.java diff --git a/src/java/org/apache/fop/traits/BorderStyle.java b/src/main/java/org/apache/fop/traits/BorderStyle.java index 2f274df22..2f274df22 100644 --- a/src/java/org/apache/fop/traits/BorderStyle.java +++ b/src/main/java/org/apache/fop/traits/BorderStyle.java diff --git a/src/java/org/apache/fop/traits/Direction.java b/src/main/java/org/apache/fop/traits/Direction.java index 378c8dd2a..378c8dd2a 100644 --- a/src/java/org/apache/fop/traits/Direction.java +++ b/src/main/java/org/apache/fop/traits/Direction.java diff --git a/src/java/org/apache/fop/traits/MinOptMax.java b/src/main/java/org/apache/fop/traits/MinOptMax.java index 84fb0156a..84fb0156a 100644 --- a/src/java/org/apache/fop/traits/MinOptMax.java +++ b/src/main/java/org/apache/fop/traits/MinOptMax.java diff --git a/src/java/org/apache/fop/traits/RuleStyle.java b/src/main/java/org/apache/fop/traits/RuleStyle.java index 19b57d76f..19b57d76f 100644 --- a/src/java/org/apache/fop/traits/RuleStyle.java +++ b/src/main/java/org/apache/fop/traits/RuleStyle.java diff --git a/src/java/org/apache/fop/traits/SpaceVal.java b/src/main/java/org/apache/fop/traits/SpaceVal.java index 1cefd62f7..1cefd62f7 100644 --- a/src/java/org/apache/fop/traits/SpaceVal.java +++ b/src/main/java/org/apache/fop/traits/SpaceVal.java diff --git a/src/java/org/apache/fop/traits/TraitEnum.java b/src/main/java/org/apache/fop/traits/TraitEnum.java index 0d664a6df..0d664a6df 100644 --- a/src/java/org/apache/fop/traits/TraitEnum.java +++ b/src/main/java/org/apache/fop/traits/TraitEnum.java diff --git a/src/java/org/apache/fop/traits/WritingMode.java b/src/main/java/org/apache/fop/traits/WritingMode.java index f8c784941..f8c784941 100644 --- a/src/java/org/apache/fop/traits/WritingMode.java +++ b/src/main/java/org/apache/fop/traits/WritingMode.java diff --git a/src/java/org/apache/fop/traits/WritingModeTraits.java b/src/main/java/org/apache/fop/traits/WritingModeTraits.java index fbd150ca9..fbd150ca9 100644 --- a/src/java/org/apache/fop/traits/WritingModeTraits.java +++ b/src/main/java/org/apache/fop/traits/WritingModeTraits.java diff --git a/src/java/org/apache/fop/traits/WritingModeTraitsGetter.java b/src/main/java/org/apache/fop/traits/WritingModeTraitsGetter.java index 7340b3e8c..7340b3e8c 100644 --- a/src/java/org/apache/fop/traits/WritingModeTraitsGetter.java +++ b/src/main/java/org/apache/fop/traits/WritingModeTraitsGetter.java diff --git a/src/java/org/apache/fop/traits/WritingModeTraitsSetter.java b/src/main/java/org/apache/fop/traits/WritingModeTraitsSetter.java index b70f73954..b70f73954 100644 --- a/src/java/org/apache/fop/traits/WritingModeTraitsSetter.java +++ b/src/main/java/org/apache/fop/traits/WritingModeTraitsSetter.java diff --git a/src/java/org/apache/fop/traits/package.html b/src/main/java/org/apache/fop/traits/package.html index 0dabf9930..0dabf9930 100644 --- a/src/java/org/apache/fop/traits/package.html +++ b/src/main/java/org/apache/fop/traits/package.html diff --git a/src/java/org/apache/fop/util/AbstractPaintingState.java b/src/main/java/org/apache/fop/util/AbstractPaintingState.java index 8368383ba..8368383ba 100644 --- a/src/java/org/apache/fop/util/AbstractPaintingState.java +++ b/src/main/java/org/apache/fop/util/AbstractPaintingState.java diff --git a/src/java/org/apache/fop/util/BreakUtil.java b/src/main/java/org/apache/fop/util/BreakUtil.java index 7302f270c..7302f270c 100644 --- a/src/java/org/apache/fop/util/BreakUtil.java +++ b/src/main/java/org/apache/fop/util/BreakUtil.java diff --git a/src/java/org/apache/fop/util/CharUtilities.java b/src/main/java/org/apache/fop/util/CharUtilities.java index e0f5e1911..e0f5e1911 100644 --- a/src/java/org/apache/fop/util/CharUtilities.java +++ b/src/main/java/org/apache/fop/util/CharUtilities.java diff --git a/src/java/org/apache/fop/util/CloseBlockerOutputStream.java b/src/main/java/org/apache/fop/util/CloseBlockerOutputStream.java index eae1cc09d..eae1cc09d 100644 --- a/src/java/org/apache/fop/util/CloseBlockerOutputStream.java +++ b/src/main/java/org/apache/fop/util/CloseBlockerOutputStream.java diff --git a/src/java/org/apache/fop/util/ColorExt.java b/src/main/java/org/apache/fop/util/ColorExt.java index a910a54dd..a910a54dd 100644 --- a/src/java/org/apache/fop/util/ColorExt.java +++ b/src/main/java/org/apache/fop/util/ColorExt.java diff --git a/src/java/org/apache/fop/util/ColorProfileUtil.java b/src/main/java/org/apache/fop/util/ColorProfileUtil.java index 9ee34d2b6..9ee34d2b6 100644 --- a/src/java/org/apache/fop/util/ColorProfileUtil.java +++ b/src/main/java/org/apache/fop/util/ColorProfileUtil.java diff --git a/src/java/org/apache/fop/util/ColorSpaceCache.java b/src/main/java/org/apache/fop/util/ColorSpaceCache.java index acb83cdef..acb83cdef 100644 --- a/src/java/org/apache/fop/util/ColorSpaceCache.java +++ b/src/main/java/org/apache/fop/util/ColorSpaceCache.java diff --git a/src/java/org/apache/fop/util/ColorUtil.java b/src/main/java/org/apache/fop/util/ColorUtil.java index cf534c49f..cf534c49f 100644 --- a/src/java/org/apache/fop/util/ColorUtil.java +++ b/src/main/java/org/apache/fop/util/ColorUtil.java diff --git a/src/java/org/apache/fop/util/ColorWithFallback.java b/src/main/java/org/apache/fop/util/ColorWithFallback.java index a19d9c275..a19d9c275 100644 --- a/src/java/org/apache/fop/util/ColorWithFallback.java +++ b/src/main/java/org/apache/fop/util/ColorWithFallback.java diff --git a/src/java/org/apache/fop/util/CompareUtil.java b/src/main/java/org/apache/fop/util/CompareUtil.java index 4c83da1aa..4c83da1aa 100644 --- a/src/java/org/apache/fop/util/CompareUtil.java +++ b/src/main/java/org/apache/fop/util/CompareUtil.java diff --git a/src/java/org/apache/fop/util/ContentHandlerFactory.java b/src/main/java/org/apache/fop/util/ContentHandlerFactory.java index 7eca0bf95..7eca0bf95 100644 --- a/src/java/org/apache/fop/util/ContentHandlerFactory.java +++ b/src/main/java/org/apache/fop/util/ContentHandlerFactory.java diff --git a/src/java/org/apache/fop/util/ContentHandlerFactoryRegistry.java b/src/main/java/org/apache/fop/util/ContentHandlerFactoryRegistry.java index ceedf9f12..ceedf9f12 100644 --- a/src/java/org/apache/fop/util/ContentHandlerFactoryRegistry.java +++ b/src/main/java/org/apache/fop/util/ContentHandlerFactoryRegistry.java diff --git a/src/java/org/apache/fop/util/ConversionUtils.java b/src/main/java/org/apache/fop/util/ConversionUtils.java index fcdb4cdbd..fcdb4cdbd 100644 --- a/src/java/org/apache/fop/util/ConversionUtils.java +++ b/src/main/java/org/apache/fop/util/ConversionUtils.java diff --git a/src/java/org/apache/fop/util/DOM2SAX.java b/src/main/java/org/apache/fop/util/DOM2SAX.java index 39d2af4a1..39d2af4a1 100644 --- a/src/java/org/apache/fop/util/DOM2SAX.java +++ b/src/main/java/org/apache/fop/util/DOM2SAX.java diff --git a/src/java/org/apache/fop/util/DOMBuilderContentHandlerFactory.java b/src/main/java/org/apache/fop/util/DOMBuilderContentHandlerFactory.java index 6117c436d..6117c436d 100644 --- a/src/java/org/apache/fop/util/DOMBuilderContentHandlerFactory.java +++ b/src/main/java/org/apache/fop/util/DOMBuilderContentHandlerFactory.java diff --git a/src/java/org/apache/fop/util/DataURIResolver.java b/src/main/java/org/apache/fop/util/DataURIResolver.java index 19ca31b22..19ca31b22 100644 --- a/src/java/org/apache/fop/util/DataURIResolver.java +++ b/src/main/java/org/apache/fop/util/DataURIResolver.java diff --git a/src/java/org/apache/fop/util/DataURLUtil.java b/src/main/java/org/apache/fop/util/DataURLUtil.java index 46ff8635b..46ff8635b 100644 --- a/src/java/org/apache/fop/util/DataURLUtil.java +++ b/src/main/java/org/apache/fop/util/DataURLUtil.java diff --git a/src/java/org/apache/fop/util/DefaultErrorListener.java b/src/main/java/org/apache/fop/util/DefaultErrorListener.java index 3c554afc7..3c554afc7 100644 --- a/src/java/org/apache/fop/util/DefaultErrorListener.java +++ b/src/main/java/org/apache/fop/util/DefaultErrorListener.java diff --git a/src/java/org/apache/fop/util/DelegatingContentHandler.java b/src/main/java/org/apache/fop/util/DelegatingContentHandler.java index 8a2acba1a..8a2acba1a 100644 --- a/src/java/org/apache/fop/util/DelegatingContentHandler.java +++ b/src/main/java/org/apache/fop/util/DelegatingContentHandler.java diff --git a/src/java/org/apache/fop/util/GenerationHelperContentHandler.java b/src/main/java/org/apache/fop/util/GenerationHelperContentHandler.java index 68970a7f2..68970a7f2 100644 --- a/src/java/org/apache/fop/util/GenerationHelperContentHandler.java +++ b/src/main/java/org/apache/fop/util/GenerationHelperContentHandler.java diff --git a/src/java/org/apache/fop/util/HexEncoder.java b/src/main/java/org/apache/fop/util/HexEncoder.java index 9ca91f2d2..9ca91f2d2 100644 --- a/src/java/org/apache/fop/util/HexEncoder.java +++ b/src/main/java/org/apache/fop/util/HexEncoder.java diff --git a/src/java/org/apache/fop/util/LanguageTags.java b/src/main/java/org/apache/fop/util/LanguageTags.java index 662fab908..662fab908 100644 --- a/src/java/org/apache/fop/util/LanguageTags.java +++ b/src/main/java/org/apache/fop/util/LanguageTags.java diff --git a/src/java/org/apache/fop/util/ListUtil.java b/src/main/java/org/apache/fop/util/ListUtil.java index 8e88e4cbf..8e88e4cbf 100644 --- a/src/java/org/apache/fop/util/ListUtil.java +++ b/src/main/java/org/apache/fop/util/ListUtil.java diff --git a/src/java/org/apache/fop/util/LogUtil.java b/src/main/java/org/apache/fop/util/LogUtil.java index acecca2ee..acecca2ee 100644 --- a/src/java/org/apache/fop/util/LogUtil.java +++ b/src/main/java/org/apache/fop/util/LogUtil.java diff --git a/src/java/org/apache/fop/util/OCAColor.java b/src/main/java/org/apache/fop/util/OCAColor.java index 94513fa2e..94513fa2e 100644 --- a/src/java/org/apache/fop/util/OCAColor.java +++ b/src/main/java/org/apache/fop/util/OCAColor.java diff --git a/src/java/org/apache/fop/util/OCAColorSpace.java b/src/main/java/org/apache/fop/util/OCAColorSpace.java index ff38152f1..ff38152f1 100644 --- a/src/java/org/apache/fop/util/OCAColorSpace.java +++ b/src/main/java/org/apache/fop/util/OCAColorSpace.java diff --git a/src/java/org/apache/fop/util/QName.java b/src/main/java/org/apache/fop/util/QName.java index dcf76a985..dcf76a985 100644 --- a/src/java/org/apache/fop/util/QName.java +++ b/src/main/java/org/apache/fop/util/QName.java diff --git a/src/java/org/apache/fop/util/TransformerDefaultHandler.java b/src/main/java/org/apache/fop/util/TransformerDefaultHandler.java index cf07cc836..cf07cc836 100644 --- a/src/java/org/apache/fop/util/TransformerDefaultHandler.java +++ b/src/main/java/org/apache/fop/util/TransformerDefaultHandler.java diff --git a/src/java/org/apache/fop/util/UnclosableInputStream.java b/src/main/java/org/apache/fop/util/UnclosableInputStream.java index 7d06a5ac7..7d06a5ac7 100644 --- a/src/java/org/apache/fop/util/UnclosableInputStream.java +++ b/src/main/java/org/apache/fop/util/UnclosableInputStream.java diff --git a/src/java/org/apache/fop/util/UnitConv.java b/src/main/java/org/apache/fop/util/UnitConv.java index b0c87ec18..b0c87ec18 100644 --- a/src/java/org/apache/fop/util/UnitConv.java +++ b/src/main/java/org/apache/fop/util/UnitConv.java diff --git a/src/java/org/apache/fop/util/WriterOutputStream.java b/src/main/java/org/apache/fop/util/WriterOutputStream.java index 17ec5d658..17ec5d658 100644 --- a/src/java/org/apache/fop/util/WriterOutputStream.java +++ b/src/main/java/org/apache/fop/util/WriterOutputStream.java diff --git a/src/java/org/apache/fop/util/XMLConstants.java b/src/main/java/org/apache/fop/util/XMLConstants.java index 34cc65e2a..34cc65e2a 100644 --- a/src/java/org/apache/fop/util/XMLConstants.java +++ b/src/main/java/org/apache/fop/util/XMLConstants.java diff --git a/src/java/org/apache/fop/util/XMLResourceBundle.java b/src/main/java/org/apache/fop/util/XMLResourceBundle.java index 80aec2d2f..80aec2d2f 100644 --- a/src/java/org/apache/fop/util/XMLResourceBundle.java +++ b/src/main/java/org/apache/fop/util/XMLResourceBundle.java diff --git a/src/java/org/apache/fop/util/XMLUtil.java b/src/main/java/org/apache/fop/util/XMLUtil.java index 3f815e59e..3f815e59e 100644 --- a/src/java/org/apache/fop/util/XMLUtil.java +++ b/src/main/java/org/apache/fop/util/XMLUtil.java diff --git a/src/java/org/apache/fop/util/bitmap/BitmapImageUtil.java b/src/main/java/org/apache/fop/util/bitmap/BitmapImageUtil.java index 4bfc74a39..4bfc74a39 100644 --- a/src/java/org/apache/fop/util/bitmap/BitmapImageUtil.java +++ b/src/main/java/org/apache/fop/util/bitmap/BitmapImageUtil.java diff --git a/src/java/org/apache/fop/util/bitmap/DefaultMonochromeBitmapConverter.java b/src/main/java/org/apache/fop/util/bitmap/DefaultMonochromeBitmapConverter.java index 8df5603fb..8df5603fb 100644 --- a/src/java/org/apache/fop/util/bitmap/DefaultMonochromeBitmapConverter.java +++ b/src/main/java/org/apache/fop/util/bitmap/DefaultMonochromeBitmapConverter.java diff --git a/src/java/org/apache/fop/util/bitmap/DitherUtil.java b/src/main/java/org/apache/fop/util/bitmap/DitherUtil.java index 2fa2e9402..2fa2e9402 100644 --- a/src/java/org/apache/fop/util/bitmap/DitherUtil.java +++ b/src/main/java/org/apache/fop/util/bitmap/DitherUtil.java diff --git a/src/java/org/apache/fop/util/bitmap/JAIMonochromeBitmapConverter.java b/src/main/java/org/apache/fop/util/bitmap/JAIMonochromeBitmapConverter.java index 1c2b78218..1c2b78218 100644 --- a/src/java/org/apache/fop/util/bitmap/JAIMonochromeBitmapConverter.java +++ b/src/main/java/org/apache/fop/util/bitmap/JAIMonochromeBitmapConverter.java diff --git a/src/java/org/apache/fop/util/bitmap/MonochromeBitmapConverter.java b/src/main/java/org/apache/fop/util/bitmap/MonochromeBitmapConverter.java index 880ba0265..880ba0265 100644 --- a/src/java/org/apache/fop/util/bitmap/MonochromeBitmapConverter.java +++ b/src/main/java/org/apache/fop/util/bitmap/MonochromeBitmapConverter.java diff --git a/src/java/org/apache/fop/util/package.html b/src/main/java/org/apache/fop/util/package.html index fb73364ec..fb73364ec 100644 --- a/src/java/org/apache/fop/util/package.html +++ b/src/main/java/org/apache/fop/util/package.html diff --git a/src/java/org/apache/fop/util/text/AdvancedMessageFormat.java b/src/main/java/org/apache/fop/util/text/AdvancedMessageFormat.java index f8508e082..f8508e082 100644 --- a/src/java/org/apache/fop/util/text/AdvancedMessageFormat.java +++ b/src/main/java/org/apache/fop/util/text/AdvancedMessageFormat.java diff --git a/src/java/org/apache/fop/util/text/ChoiceFieldPart.java b/src/main/java/org/apache/fop/util/text/ChoiceFieldPart.java index c87b9c61f..c87b9c61f 100644 --- a/src/java/org/apache/fop/util/text/ChoiceFieldPart.java +++ b/src/main/java/org/apache/fop/util/text/ChoiceFieldPart.java diff --git a/src/java/org/apache/fop/util/text/EqualsFieldPart.java b/src/main/java/org/apache/fop/util/text/EqualsFieldPart.java index 153322f27..153322f27 100644 --- a/src/java/org/apache/fop/util/text/EqualsFieldPart.java +++ b/src/main/java/org/apache/fop/util/text/EqualsFieldPart.java diff --git a/src/java/org/apache/fop/util/text/GlyphNameFieldPart.java b/src/main/java/org/apache/fop/util/text/GlyphNameFieldPart.java index f0e5bcc32..f0e5bcc32 100644 --- a/src/java/org/apache/fop/util/text/GlyphNameFieldPart.java +++ b/src/main/java/org/apache/fop/util/text/GlyphNameFieldPart.java diff --git a/src/java/org/apache/fop/util/text/HexFieldPart.java b/src/main/java/org/apache/fop/util/text/HexFieldPart.java index 6333a8df2..6333a8df2 100644 --- a/src/java/org/apache/fop/util/text/HexFieldPart.java +++ b/src/main/java/org/apache/fop/util/text/HexFieldPart.java diff --git a/src/java/org/apache/fop/util/text/IfFieldPart.java b/src/main/java/org/apache/fop/util/text/IfFieldPart.java index 451329f47..451329f47 100644 --- a/src/java/org/apache/fop/util/text/IfFieldPart.java +++ b/src/main/java/org/apache/fop/util/text/IfFieldPart.java diff --git a/src/java/org/apache/fop/util/text/LocatorFormatter.java b/src/main/java/org/apache/fop/util/text/LocatorFormatter.java index 07e7f2aaa..07e7f2aaa 100644 --- a/src/java/org/apache/fop/util/text/LocatorFormatter.java +++ b/src/main/java/org/apache/fop/util/text/LocatorFormatter.java diff --git a/src/java/org/apache/fop/util/text/package.html b/src/main/java/org/apache/fop/util/text/package.html index e8ba8044f..e8ba8044f 100644 --- a/src/java/org/apache/fop/util/text/package.html +++ b/src/main/java/org/apache/fop/util/text/package.html diff --git a/src/test/java/META-INF/services/org.apache.fop.fo.ElementMapping b/src/test/java/META-INF/services/org.apache.fop.fo.ElementMapping new file mode 100644 index 000000000..f270d50b3 --- /dev/null +++ b/src/test/java/META-INF/services/org.apache.fop.fo.ElementMapping @@ -0,0 +1,2 @@ +org.apache.fop.fotreetest.ext.TestElementMapping
+
diff --git a/src/test/java/org/apache/fop/AbstractBasicTranscoderTest.java b/src/test/java/org/apache/fop/AbstractBasicTranscoderTest.java new file mode 100644 index 000000000..7a40b353a --- /dev/null +++ b/src/test/java/org/apache/fop/AbstractBasicTranscoderTest.java @@ -0,0 +1,81 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop; + +import java.io.File; +import java.io.InputStream; + +import org.junit.Test; + +import static org.junit.Assert.assertTrue; + +import org.apache.commons.io.output.ByteArrayOutputStream; + +import org.apache.batik.transcoder.Transcoder; +import org.apache.batik.transcoder.TranscoderInput; +import org.apache.batik.transcoder.TranscoderOutput; + +import static org.apache.fop.FOPTestUtils.getBaseDir; + +/** + * Basic runtime test for FOP's transcoders. It is used to verify that + * nothing obvious is broken after compiling. + */ +public abstract class AbstractBasicTranscoderTest { + + /** + * Creates the transcoder to test. + * @return the newly instantiated transcoder + */ + protected abstract Transcoder createTranscoder(); + + /** + * Runs the PDF transcoder as if it were called by Batik's rasterizer. + * Without special configuration stuff. + * @throws Exception if a problem occurs + */ + @Test + public void testGenericPDFTranscoder() throws Exception { + //Create transcoder + Transcoder transcoder = createTranscoder(); + + //Setup input + File svgFile = new File(getBaseDir(), "test/resources/fop/svg/text.svg"); + InputStream in = new java.io.FileInputStream(svgFile); + try { + TranscoderInput input = new TranscoderInput(in); + + //Setup output + ByteArrayOutputStream out = new ByteArrayOutputStream(); + try { + TranscoderOutput output = new TranscoderOutput(out); + + //Do the transformation + transcoder.transcode(input, output); + } finally { + out.close(); + } + assertTrue("Some output expected", out.size() > 0); + } finally { + in.close(); + } + } + +} diff --git a/src/test/java/org/apache/fop/BasicDriverTestCase.java b/src/test/java/org/apache/fop/BasicDriverTestCase.java new file mode 100644 index 000000000..e89a1c558 --- /dev/null +++ b/src/test/java/org/apache/fop/BasicDriverTestCase.java @@ -0,0 +1,143 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop; + +import java.io.File; + +import javax.xml.transform.Result; +import javax.xml.transform.Source; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.sax.SAXResult; +import javax.xml.transform.stream.StreamSource; + +import org.junit.Test; + +import static org.junit.Assert.assertTrue; + +import org.apache.commons.io.output.ByteArrayOutputStream; + +import org.apache.fop.apps.FOPException; +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.apps.Fop; +import org.apache.fop.apps.FopFactory; +import org.apache.fop.apps.MimeConstants; +import org.apache.fop.cli.InputHandler; + +import static org.apache.fop.FOPTestUtils.getBaseDir; + +/** + * Basic runtime test for the old Fop class. It is used to verify that + * nothing obvious is broken after compiling. + */ +public class BasicDriverTestCase { + + private FopFactory fopFactory = FopFactory.newInstance(new File(".").toURI()); + + /** + * Tests Fop with JAXP and OutputStream generating PDF. + * @throws Exception if anything fails + */ + @Test + public void testFO2PDFWithJAXP() throws Exception { + FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); + File foFile = new File(getBaseDir(), "test/xml/bugtests/block.fo"); + ByteArrayOutputStream baout = new ByteArrayOutputStream(); + Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, baout); + + TransformerFactory factory = TransformerFactory.newInstance(); + Transformer transformer = factory.newTransformer(); //Identity transf. + Source src = new StreamSource(foFile); + Result res = new SAXResult(fop.getDefaultHandler()); + transformer.transform(src, res); + + assertTrue("Generated PDF has zero length", baout.size() > 0); + } + + /** + * Tests Fop with JAXP and OutputStream generating PostScript. + * @throws Exception if anything fails + */ + @Test + public void testFO2PSWithJAXP() throws Exception { + FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); + File foFile = new File(getBaseDir(), "test/xml/bugtests/block.fo"); + ByteArrayOutputStream baout = new ByteArrayOutputStream(); + Fop fop = fopFactory.newFop(MimeConstants.MIME_POSTSCRIPT, foUserAgent, baout); + + TransformerFactory factory = TransformerFactory.newInstance(); + Transformer transformer = factory.newTransformer(); //Identity transf. + Source src = new StreamSource(foFile); + Result res = new SAXResult(fop.getDefaultHandler()); + transformer.transform(src, res); + + assertTrue("Generated PostScript has zero length", baout.size() > 0); + } + + /** + * Tests Fop with JAXP and OutputStream generating RTF. + * @throws Exception if anything fails + */ + @Test + public void testFO2RTFWithJAXP() throws Exception { + FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); + File foFile = new File(getBaseDir(), "test/xml/bugtests/block.fo"); + ByteArrayOutputStream baout = new ByteArrayOutputStream(); + Fop fop = fopFactory.newFop(MimeConstants.MIME_RTF, foUserAgent, baout); + + TransformerFactory factory = TransformerFactory.newInstance(); + Transformer transformer = factory.newTransformer(); //Identity transf. + Source src = new StreamSource(foFile); + Result res = new SAXResult(fop.getDefaultHandler()); + transformer.transform(src, res); + + assertTrue("Generated RTF has zero length", baout.size() > 0); + } + + /** + * Tests Fop with XsltInputHandler and OutputStream. + * @throws Exception if anything fails + */ + @Test + public void testFO2PDFWithXSLTInputHandler() throws Exception { + FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); + File xmlFile = new File(getBaseDir(), "test/xml/1.xml"); + File xsltFile = new File(getBaseDir(), "test/xsl/doc.xsl"); + ByteArrayOutputStream baout = new ByteArrayOutputStream(); + + InputHandler handler = new InputHandler(xmlFile, xsltFile, null); + handler.renderTo(foUserAgent, MimeConstants.MIME_PDF, baout); + + assertTrue("Generated PDF has zero length", baout.size() > 0); + } + + @Test + public void testXSLILoop() throws Exception { + FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); + File xmlFile = new File(getBaseDir(), "test/xml/1.xml"); + File xsltFile = new File(getBaseDir(), "test/xsl/iloop.xsl"); + ByteArrayOutputStream baout = new ByteArrayOutputStream(); + InputHandler handler = new InputHandler(xmlFile, xsltFile, null); + try { + handler.renderTo(foUserAgent, MimeConstants.MIME_PDF, baout); + } catch (FOPException e) { /* NOP */ } + } + +} diff --git a/src/test/java/org/apache/fop/BasicDriverTestSuite.java b/src/test/java/org/apache/fop/BasicDriverTestSuite.java new file mode 100644 index 000000000..68619926a --- /dev/null +++ b/src/test/java/org/apache/fop/BasicDriverTestSuite.java @@ -0,0 +1,32 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +/** + * Test suite for basic functionality of FOP's Driver API. + */ +@RunWith(Suite.class) +@SuiteClasses(BasicDriverTestCase.class) +public class BasicDriverTestSuite { +} diff --git a/src/test/java/org/apache/fop/BasicPDFTranscoderTestCase.java b/src/test/java/org/apache/fop/BasicPDFTranscoderTestCase.java new file mode 100644 index 000000000..0f20a1967 --- /dev/null +++ b/src/test/java/org/apache/fop/BasicPDFTranscoderTestCase.java @@ -0,0 +1,37 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop; + +import org.apache.batik.transcoder.Transcoder; + +import org.apache.fop.svg.PDFTranscoder; + +/** + * Basic runtime test for the PDF transcoder. It is used to verify that + * nothing obvious is broken after compiling. + */ +public class BasicPDFTranscoderTestCase extends AbstractBasicTranscoderTest { + + @Override + protected Transcoder createTranscoder() { + return new PDFTranscoder(); + } + +} diff --git a/src/test/java/org/apache/fop/BasicPSTranscoderTestCase.java b/src/test/java/org/apache/fop/BasicPSTranscoderTestCase.java new file mode 100644 index 000000000..2d6fc0d81 --- /dev/null +++ b/src/test/java/org/apache/fop/BasicPSTranscoderTestCase.java @@ -0,0 +1,37 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop; + +import org.apache.batik.transcoder.Transcoder; + +import org.apache.fop.render.ps.PSTranscoder; + +/** + * Basic runtime test for the PS transcoder. It is used to verify that + * nothing obvious is broken after compiling. + */ +public class BasicPSTranscoderTestCase extends AbstractBasicTranscoderTest { + + @Override + protected Transcoder createTranscoder() { + return new PSTranscoder(); + } + +} diff --git a/src/test/java/org/apache/fop/BasicTranscoderTestSuite.java b/src/test/java/org/apache/fop/BasicTranscoderTestSuite.java new file mode 100644 index 000000000..a372f737a --- /dev/null +++ b/src/test/java/org/apache/fop/BasicTranscoderTestSuite.java @@ -0,0 +1,35 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +/** + * Test suite for basic functionality of FOP's transcoders. + */ +@RunWith(Suite.class) +@SuiteClasses({ + BasicPDFTranscoderTestCase.class, + BasicPSTranscoderTestCase.class +}) +public class BasicTranscoderTestSuite { +} diff --git a/src/test/java/org/apache/fop/DebugHelper.java b/src/test/java/org/apache/fop/DebugHelper.java new file mode 100644 index 000000000..1fb7074ee --- /dev/null +++ b/src/test/java/org/apache/fop/DebugHelper.java @@ -0,0 +1,45 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop; + +import org.apache.fop.layoutmgr.ElementListObserver; +import org.apache.fop.logging.LoggingElementListObserver; + +/** + * Handles some standard tasks for debugging. + */ +public final class DebugHelper { + + private DebugHelper() { + } + + private static boolean elObserversRegistered; + + /** + * Registers the default element list observers used for debugging. + */ + public static void registerStandardElementListObservers() { + if (!elObserversRegistered) { + ElementListObserver.addObserver(new LoggingElementListObserver()); + elObserversRegistered = true; + } + } + +} diff --git a/src/test/java/org/apache/fop/DigestFilterTestCase.java b/src/test/java/org/apache/fop/DigestFilterTestCase.java new file mode 100644 index 000000000..679b65aee --- /dev/null +++ b/src/test/java/org/apache/fop/DigestFilterTestCase.java @@ -0,0 +1,159 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop; + +import java.io.IOException; +import java.io.StringReader; +import java.security.NoSuchAlgorithmException; + +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.parsers.SAXParserFactory; + +import org.junit.Before; +import org.junit.Test; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; +import org.xml.sax.XMLReader; + +import static org.junit.Assert.assertTrue; + +import org.apache.fop.util.DigestFilter; + +/** + * Test case for digesting SAX filter. + * + */ +public class DigestFilterTestCase { + + private SAXParserFactory parserFactory; + + @Before + public void setUp() { + parserFactory = SAXParserFactory.newInstance(); + parserFactory.setNamespaceAware(true); + } + + private boolean compareDigest(byte[] a, byte[] b) { + if (a.length != b.length) { + return false; + } + for (int i = 0; i < a.length; i++) { + if (a[i] != b[i]) { + return false; + } + } + return true; + } + + private String digestToString(byte[] digest) { + StringBuffer buffer = new StringBuffer(2 * digest.length); + for (int i = 0; i < digest.length; i++) { + int val = digest[i]; + int hi = (val >> 4) & 0xF; + int lo = val & 0xF; + if (hi < 10) { + buffer.append((char) (hi + 0x30)); + } else { + buffer.append((char) (hi + 0x61 - 10)); + } + if (lo < 10) { + buffer.append((char) (lo + 0x30)); + } else { + buffer.append((char) (lo + 0x61 - 10)); + } + } + return buffer.toString(); + } + + private byte[] runTest(String input) + throws + NoSuchAlgorithmException, + ParserConfigurationException, + SAXException, + IOException { + XMLReader parser = parserFactory.newSAXParser().getXMLReader(); + DigestFilter digestFilter = new DigestFilter("MD5"); + digestFilter.setParent(parser); + digestFilter.setFeature("http://xml.org/sax/features/namespaces", true); + parser.setContentHandler(digestFilter); + InputSource inputSource = new InputSource(new StringReader(input)); + parser.parse(inputSource); + return digestFilter.getDigestValue(); + } + + @Test + public final void testLineFeed() + throws + NoSuchAlgorithmException, + ParserConfigurationException, + SAXException, + IOException { + byte[] lfDigest = runTest("<a>\n</a>"); + byte[] crlfDigest = runTest("<a>\r\n</a>"); + assertTrue( + "LF: " + + digestToString(lfDigest) + + " CRLF: " + + digestToString(crlfDigest), + compareDigest(lfDigest, crlfDigest)); + } + + @Test + public final void testAttributeOrder() + throws + NoSuchAlgorithmException, + ParserConfigurationException, + SAXException, + IOException { + byte[] sortDigest = runTest("<a a1='1' a2='2' a3='3'/>"); + byte[] permutationDigest = runTest("<a a2='2' a3='3' a1='1'/>"); + assertTrue( + "Sort: " + + digestToString(sortDigest) + + " permuted: " + + digestToString(permutationDigest), + compareDigest(sortDigest, permutationDigest)); + byte[] reverseDigest = runTest("<a a3='3' a2='2' a1='1'/>"); + assertTrue( + "Sort: " + + digestToString(sortDigest) + + " permuted: " + + digestToString(reverseDigest), + compareDigest(sortDigest, reverseDigest)); + } + + @Test + public final void testNamespacePrefix() + throws + NoSuchAlgorithmException, + ParserConfigurationException, + SAXException, + IOException { + byte[] prefix1Digest = runTest("<a:a xmlns:a='foo'/>"); + byte[] prefix2Digest = runTest("<b:a xmlns:b='foo'/>"); + assertTrue( + "prefix1: " + + digestToString(prefix1Digest) + + " prefix2: " + + digestToString(prefix2Digest), + compareDigest(prefix1Digest, prefix2Digest)); + } + +} diff --git a/src/test/java/org/apache/fop/FOPTestUtils.java b/src/test/java/org/apache/fop/FOPTestUtils.java new file mode 100644 index 000000000..429bef187 --- /dev/null +++ b/src/test/java/org/apache/fop/FOPTestUtils.java @@ -0,0 +1,40 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop; + +import java.io.File; + +/** + * Abstract base test class for FOP's tests. + */ +public final class FOPTestUtils { + + private FOPTestUtils() { + } + + /** + * Returns the base directory to use for the tests. + * @return the base directory + */ + public static File getBaseDir() { + return new File(".").getAbsoluteFile(); + } + +} diff --git a/src/test/java/org/apache/fop/KnuthAlgorithmTestCase.java b/src/test/java/org/apache/fop/KnuthAlgorithmTestCase.java new file mode 100644 index 000000000..aa92191de --- /dev/null +++ b/src/test/java/org/apache/fop/KnuthAlgorithmTestCase.java @@ -0,0 +1,150 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop; + +import java.util.List; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +import org.apache.fop.layoutmgr.BlockKnuthSequence; +import org.apache.fop.layoutmgr.BreakingAlgorithm; +import org.apache.fop.layoutmgr.ElementListObserver; +import org.apache.fop.layoutmgr.KnuthBox; +import org.apache.fop.layoutmgr.KnuthGlue; +import org.apache.fop.layoutmgr.KnuthPenalty; +import org.apache.fop.layoutmgr.KnuthSequence; + +/** + * Tests the Knuth algorithm implementation. + */ +public class KnuthAlgorithmTestCase { + + @Before + public void setUp() { + DebugHelper.registerStandardElementListObservers(); + } + + private KnuthSequence getKnuthSequence1() { + KnuthSequence seq = new BlockKnuthSequence(); + for (int i = 0; i < 5; i++) { + seq.add(new KnuthBox(0, null, true)); + seq.add(new KnuthPenalty(0, KnuthPenalty.INFINITE, false, null, true)); + seq.add(new KnuthGlue(5000, 0, 0, null, true)); + seq.add(new KnuthBox(10000, null, false)); + if (i < 4) { + seq.add(new KnuthPenalty(0, 0, false, null, false)); + seq.add(new KnuthGlue(-5000, 0, 0, null, true)); + } + } + + seq.add(new KnuthPenalty(0, KnuthPenalty.INFINITE, false, null, false)); + seq.add(new KnuthGlue(0, Integer.MAX_VALUE, 0, null, false)); + seq.add(new KnuthPenalty(0, -KnuthPenalty.INFINITE, false, null, false)); + ElementListObserver.observe(seq, "test", null); + return seq; + } + + /** + * Tests a special condition where a negative-length glue occurs directly after a break + * possibility. + * @throws Exception if an error occurs + */ + @Test + public void test1() throws Exception { + MyBreakingAlgorithm algo = new MyBreakingAlgorithm(0, 0, true, true, 0); + algo.setConstantLineWidth(30000); + KnuthSequence seq = getKnuthSequence1(); + algo.findBreakingPoints(seq, 1, true, BreakingAlgorithm.ALL_BREAKS); + Part[] parts = algo.getParts(); + assertEquals("Sequence must produce 3 parts", 3, parts.length); + assertEquals(5000, parts[0].difference); + assertEquals(5000, parts[1].difference); + } + + private class Part { + private int difference; + private double ratio; + private int position; + } + + private class MyBreakingAlgorithm extends BreakingAlgorithm { + + private final List<Part> parts = new java.util.ArrayList<Part>(); + + public MyBreakingAlgorithm(int align, int alignLast, boolean first, + boolean partOverflowRecovery, int maxFlagCount) { + super(align, alignLast, first, partOverflowRecovery, maxFlagCount); + } + + public Part[] getParts() { + return parts.toArray(new Part[parts.size()]); + } + + @Override + public void updateData1(int total, double demerits) { + //nop + } + + @Override + public void updateData2(KnuthNode bestActiveNode, KnuthSequence sequence, int total) { + int difference = bestActiveNode.difference; + // it is always allowed to adjust space, so the ratio must be set regardless of + // the value of the property display-align; the ratio must be <= 1 + double ratio = bestActiveNode.adjustRatio; + if (ratio < 0) { + // page break with a negative difference: + // spaces always have enough shrink + difference = 0; + } else if (ratio <= 1 && bestActiveNode.line < total) { + // not-last page break with a positive difference smaller than the available + // stretch: spaces can stretch to fill the whole difference + difference = 0; + } else if (ratio > 1) { + // not-last page with a positive difference greater than the available stretch + // spaces can stretch to fill the difference only partially + ratio = 1; + difference -= bestActiveNode.availableStretch; + } else { + // last page with a positive difference: + // spaces do not need to stretch + ratio = 0; + } + + // add nodes at the beginning of the list, as they are found + // backwards, from the last one to the first one + Part part = new Part(); + part.difference = difference; + part.ratio = ratio; + part.position = bestActiveNode.position; + parts.add(0, part); + } + + @Override + protected int filterActiveNodes() { + //nop + return 0; + } + + } + +} diff --git a/src/test/java/org/apache/fop/StandardTestSuite.java b/src/test/java/org/apache/fop/StandardTestSuite.java new file mode 100644 index 000000000..c7c1db9aa --- /dev/null +++ b/src/test/java/org/apache/fop/StandardTestSuite.java @@ -0,0 +1,82 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +import org.apache.fop.afp.fonts.CharactersetEncoderTestCase; +import org.apache.fop.afp.parser.MODCAParserTestCase; +import org.apache.fop.area.ViewportTestSuite; +import org.apache.fop.fonts.truetype.GlyfTableTestCase; +import org.apache.fop.fonts.type1.AFMParserTestCase; +import org.apache.fop.fonts.type1.AdobeStandardEncodingTestCase; +import org.apache.fop.image.loader.batik.ImageLoaderTestCase; +import org.apache.fop.image.loader.batik.ImagePreloaderTestCase; +import org.apache.fop.intermediate.IFMimickingTestCase; +import org.apache.fop.layoutmgr.PageSequenceLayoutManagerTestCase; +import org.apache.fop.pdf.PDFLibraryTestSuite; +import org.apache.fop.render.extensions.prepress.PageBoundariesTestCase; +import org.apache.fop.render.extensions.prepress.PageScaleTestCase; +import org.apache.fop.render.pdf.PDFAConformanceTestCase; +import org.apache.fop.render.pdf.PDFCMapTestCase; +import org.apache.fop.render.pdf.PDFEncodingTestCase; +import org.apache.fop.render.pdf.PDFsRGBSettingsTestCase; +import org.apache.fop.render.pdf.RenderPDFTestSuite; +import org.apache.fop.render.ps.PSTestSuite; +import org.apache.fop.render.rtf.RichTextFormatTestSuite; +import org.apache.fop.traits.MinOptMaxTestCase; + +/** + * Test suite for basic functionality of FOP. + */ +@RunWith(Suite.class) +@SuiteClasses({ + BasicDriverTestSuite.class, + UtilityCodeTestSuite.class, + PDFAConformanceTestCase.class, + PDFEncodingTestCase.class, + PDFCMapTestCase.class, + PDFsRGBSettingsTestCase.class, + RichTextFormatTestSuite.class, + ImageLoaderTestCase.class, + ImagePreloaderTestCase.class, + IFMimickingTestCase.class, + PageSequenceLayoutManagerTestCase.class, + PageBoundariesTestCase.class, + PageScaleTestCase.class, + org.apache.fop.afp.AFPTestSuite.class, + GlyfTableTestCase.class, + ViewportTestSuite.class, + RenderPDFTestSuite.class, + MODCAParserTestCase.class, + CharactersetEncoderTestCase.class, + org.apache.fop.render.afp.AFPTestSuite.class, + PDFLibraryTestSuite.class, + PSTestSuite.class, + MinOptMaxTestCase.class, + AdobeStandardEncodingTestCase.class, + AFMParserTestCase.class, + org.apache.fop.render.intermediate.IFStructureTreeBuilderTestCase.class, + org.apache.fop.fonts.FontsTestSuite.class +}) +public class StandardTestSuite { +} diff --git a/src/test/java/org/apache/fop/URIResolutionTestCase.java b/src/test/java/org/apache/fop/URIResolutionTestCase.java new file mode 100644 index 000000000..e01271f2b --- /dev/null +++ b/src/test/java/org/apache/fop/URIResolutionTestCase.java @@ -0,0 +1,197 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.net.URI; + +import javax.xml.transform.Result; +import javax.xml.transform.Source; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; +import javax.xml.transform.dom.DOMResult; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.sax.SAXResult; +import javax.xml.transform.sax.SAXTransformerFactory; +import javax.xml.transform.sax.TransformerHandler; +import javax.xml.transform.stream.StreamResult; +import javax.xml.transform.stream.StreamSource; + +import org.junit.BeforeClass; +import org.junit.Test; +import org.w3c.dom.Document; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import org.apache.commons.io.IOUtils; +import org.apache.commons.io.output.ByteArrayOutputStream; +import org.apache.xpath.XPathAPI; +import org.apache.xpath.objects.XObject; + +import org.apache.xmlgraphics.io.Resource; +import org.apache.xmlgraphics.io.ResourceResolver; + +import org.apache.fop.apps.FOPException; +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.apps.Fop; +import org.apache.fop.apps.FopFactory; +import org.apache.fop.apps.FopFactoryBuilder; +import org.apache.fop.apps.MimeConstants; +import org.apache.fop.apps.io.ResourceResolverFactory; +import org.apache.fop.render.xml.XMLRenderer; + +import static org.apache.fop.FOPTestUtils.getBaseDir; + +/** + * Tests URI resolution facilities. + */ +public class URIResolutionTestCase { + + private SAXTransformerFactory tfactory = (SAXTransformerFactory) SAXTransformerFactory.newInstance(); + + private static final File BACKUP_DIR = new File(getBaseDir(), "build/test-results"); + + private static FopFactory fopFactory; + + @BeforeClass + public static void makeDirs() { + BACKUP_DIR.mkdirs(); + fopFactory = new FopFactoryBuilder(new File(".").getAbsoluteFile().toURI(), + new CustomURIResolver()).build(); + } + + private static File getTestDir() { + return new File(getBaseDir(), "test/xml/uri-testing/"); + } + + @Test + public void innerTestFO1() throws Exception { + File foFile = new File(getTestDir(), "custom-scheme/only-scheme-specific-part.fo"); + + FOUserAgent ua = fopFactory.newFOUserAgent(); + + Document doc = createAreaTree(foFile, ua); + + // XPath checking on the area tree + assertEquals("viewport for external-graphic is missing", + "true", evalXPath(doc, "boolean(//flow/block[1]/lineArea/viewport)")); + assertEquals("46080", evalXPath(doc, "//flow/block[1]/lineArea/viewport/@ipd")); + assertEquals("46080", evalXPath(doc, "//flow/block[1]/lineArea/viewport/@bpd")); + } + + /** + * Test custom URI resolution with a hand-written URIResolver. + * @throws Exception if anything fails + */ + @Test + public void testFO2() throws Exception { + File foFile = new File(getTestDir(), "custom-scheme/only-scheme-specific-part-svg.fo"); + + FOUserAgent ua = fopFactory.newFOUserAgent(); + + ByteArrayOutputStream baout = new ByteArrayOutputStream(); + + Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, ua, baout); + + Transformer transformer = tfactory.newTransformer(); //Identity transf. + Source src = new StreamSource(foFile); + Result res = new SAXResult(fop.getDefaultHandler()); + transformer.transform(src, res); + + OutputStream out = new java.io.FileOutputStream( + new File(BACKUP_DIR, foFile.getName() + ".pdf")); + try { + baout.writeTo(out); + } finally { + IOUtils.closeQuietly(out); + } + + //Test using PDF as the area tree doesn't invoke Batik so we could check + //if the resolver is actually passed to Batik by FOP + assertTrue("Generated PDF has zero length", baout.size() > 0); + } + + private Document createAreaTree(File fo, FOUserAgent ua) + throws TransformerException, FOPException { + DOMResult domres = new DOMResult(); + //Setup Transformer to convert the area tree to a DOM + TransformerHandler athandler = tfactory.newTransformerHandler(); + athandler.setResult(domres); + + XMLRenderer atrenderer = new XMLRenderer(ua); + atrenderer.setContentHandler(athandler); + ua.setRendererOverride(atrenderer); + + Fop fop = fopFactory.newFop(ua); + + Transformer transformer = tfactory.newTransformer(); //Identity transf. + Source src = new StreamSource(fo); + Result res = new SAXResult(fop.getDefaultHandler()); + transformer.transform(src, res); + + Document doc = (Document) domres.getNode(); + saveAreaTreeXML(doc, new File(BACKUP_DIR, fo.getName() + ".at.xml")); + return doc; + } + + private String evalXPath(Document doc, String xpath) { + XObject res; + try { + res = XPathAPI.eval(doc, xpath); + } catch (TransformerException e) { + throw new RuntimeException("XPath evaluation failed: " + e.getMessage()); + } + return res.str(); + } + + /** + * Save the area tree XML for later inspection. + * @param doc area tree as a DOM document + * @param target target file + * @throws TransformerException if a problem occurs during serialization + */ + protected void saveAreaTreeXML(Document doc, File target) throws TransformerException { + Transformer transformer = tfactory.newTransformer(); + Source src = new DOMSource(doc); + Result res = new StreamResult(target); + transformer.transform(src, res); + } + + private static final class CustomURIResolver implements ResourceResolver { + private final ResourceResolver defaultImpl = ResourceResolverFactory.createDefaultResourceResolver(); + + public Resource getResource(URI uri) throws IOException { + if (uri.getScheme().equals("funky") && uri.getSchemeSpecificPart().equals("myimage123")) { + return new Resource("", new FileInputStream("test/resources/images/bgimg300dpi.jpg")); + } + + return defaultImpl.getResource(uri); + } + + public OutputStream getOutputStream(URI uri) throws IOException { + return defaultImpl.getOutputStream(uri); + } + + } +} diff --git a/src/test/java/org/apache/fop/UtilityCodeTestSuite.java b/src/test/java/org/apache/fop/UtilityCodeTestSuite.java new file mode 100644 index 000000000..762b86b14 --- /dev/null +++ b/src/test/java/org/apache/fop/UtilityCodeTestSuite.java @@ -0,0 +1,61 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +import org.apache.fop.events.BasicEventTestCase; +import org.apache.fop.pdf.FileIDGeneratorTestCase; +import org.apache.fop.pdf.PDFDocumentGraphics2DTestCase; +import org.apache.fop.pdf.PDFEncryptionJCETestCase; +import org.apache.fop.pdf.PDFFactoryTestCase; +import org.apache.fop.pdf.PDFNumberTestCase; +import org.apache.fop.pdf.PDFObjectTestCase; +import org.apache.fop.traits.BorderPropsTestCase; +import org.apache.fop.util.BitmapImageUtilTestCase; +import org.apache.fop.util.ColorUtilTestCase; +import org.apache.fop.util.ElementListUtilsTestCase; +import org.apache.fop.util.HexEncoderTestCase; +import org.apache.fop.util.XMLResourceBundleTestCase; + +/** + * Test suite for FOP's utility classes. + */ +@RunWith(Suite.class) +@SuiteClasses({ + ColorUtilTestCase.class, + BorderPropsTestCase.class, + ElementListUtilsTestCase.class, + BasicEventTestCase.class, + XMLResourceBundleTestCase.class, + URIResolutionTestCase.class, + FileIDGeneratorTestCase.class, + PDFFactoryTestCase.class, + PDFEncryptionJCETestCase.class, + BitmapImageUtilTestCase.class, + PDFDocumentGraphics2DTestCase.class, + PDFNumberTestCase.class, + PDFObjectTestCase.class, + HexEncoderTestCase.class +}) +public class UtilityCodeTestSuite { +} diff --git a/src/test/java/org/apache/fop/accessibility/fo/DOMResultUtil.java b/src/test/java/org/apache/fop/accessibility/fo/DOMResultUtil.java new file mode 100644 index 000000000..5b4e264f2 --- /dev/null +++ b/src/test/java/org/apache/fop/accessibility/fo/DOMResultUtil.java @@ -0,0 +1,54 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.accessibility.fo; + +import java.io.File; + +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMResult; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; + +/** + * Utility class to stream an instance of {@link DOMResult} into a file. May be + * useful for debugging. + */ +final class DOMResultUtil { + + private DOMResultUtil() { + } + + /** + * Streams the given result into a file of the given name. + * + * @param result the result of a transformation + * @param filename name of the file into which to stream the result + * @throws TransformerException if a problem occurs when streaming + */ + public static void streamToFile(DOMResult result, String filename) throws TransformerException { + DOMSource source = new DOMSource(result.getNode()); + TransformerFactory tFactory = TransformerFactory.newInstance(); + Transformer transformer = tFactory.newTransformer(); + transformer.transform(source, new StreamResult(new File(filename))); + } + +} diff --git a/src/test/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverterTestCase.java b/src/test/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverterTestCase.java new file mode 100644 index 000000000..eddd90ec4 --- /dev/null +++ b/src/test/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverterTestCase.java @@ -0,0 +1,244 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.accessibility.fo; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; + +import javax.xml.transform.Result; +import javax.xml.transform.Source; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.TransformerFactoryConfigurationError; +import javax.xml.transform.dom.DOMResult; +import javax.xml.transform.sax.SAXTransformerFactory; +import javax.xml.transform.sax.TransformerHandler; +import javax.xml.transform.stream.StreamResult; +import javax.xml.transform.stream.StreamSource; + +import org.custommonkey.xmlunit.Diff; +import org.junit.Test; +import org.w3c.dom.Document; +import org.xml.sax.SAXException; +import org.xml.sax.helpers.AttributesImpl; + +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import org.apache.fop.accessibility.StructureTree2SAXEventAdapter; +import org.apache.fop.accessibility.StructureTreeEventHandler; +import org.apache.fop.apps.FOPException; +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.apps.FopFactory; +import org.apache.fop.fo.FODocumentParser; +import org.apache.fop.fo.FODocumentParser.FOEventHandlerFactory; +import org.apache.fop.fo.FOEventHandler; +import org.apache.fop.fo.LoadingException; +import org.apache.fop.fotreetest.DummyFOEventHandler; +import org.apache.fop.render.intermediate.IFContext; +import org.apache.fop.render.pdf.PDFDocumentHandler; + +public class FO2StructureTreeConverterTestCase { + + private static class FOLoader { + + private final String resourceName; + + FOLoader(String resourceName) { + this.resourceName = resourceName; + } + + public InputStream getFoInputStream() { + return getResource(resourceName); + } + } + + private static final String STRUCTURE_TREE_SEQUENCE_NAME = "structure-tree-sequence"; + + private FOLoader foLoader; + + @Test + public void testCompleteDocument() throws Exception { + testConverter("/org/apache/fop/fo/complete_document.fo"); + } + + @Test + public void testAbbreviationProperty() throws Exception { + testConverter("abb.fo"); + } + + @Test + public void testTableFooters() throws Exception { + testConverter("table-footers.fo"); + } + + @Test + public void testArtifact() throws Exception { + testConverter("artifact.fo"); + } + + @Test + public void testSideRegions() throws Exception { + testConverter("/org/apache/fop/fo/pagination/side-regions.fo"); + } + + @Test + public void headerTableCellMustPropagateScope() throws Exception { + testConverter("table-header_scope.fo"); + } + + @Test + public void testLanguage() throws Exception { + testConverter("language.fo"); + } + + private static InputStream getResource(String name) { + return FO2StructureTreeConverterTestCase.class.getResourceAsStream(name); + } + + @Test + public void testPDFA() throws Exception { + FOUserAgent userAgent = FopFactory.newInstance(new File(".").toURI()).newFOUserAgent(); + userAgent.getRendererOptions().put("pdf-a-mode", "PDF/A-1b"); + userAgent.setAccessibility(true); + PDFDocumentHandler d = new PDFDocumentHandler(new IFContext(userAgent)); + OutputStream writer = new ByteArrayOutputStream(); + StreamResult result = new StreamResult(writer); + d.setResult(result); + d.getStructureTreeEventHandler(); + d.startDocument(); + assertNull(d.getStructureTreeEventHandler().startNode("table-body", null, null)); + } + + private void testConverter(String foResourceName) throws Exception { + foLoader = new FOLoader(foResourceName); + DOMResult expectedStructureTree = loadExpectedStructureTree(); + DOMResult actualStructureTree = buildActualStructureTree(); + final Diff diff = createDiff(expectedStructureTree, actualStructureTree); + assertTrue(diff.toString(), diff.identical()); + } + + private DOMResult loadExpectedStructureTree() { + DOMResult expectedStructureTree = new DOMResult(); + InputStream xslt = getResource("fo2StructureTree.xsl"); + runXSLT(xslt, foLoader.getFoInputStream(), expectedStructureTree); + return expectedStructureTree; + } + + private static void runXSLT(InputStream xslt, InputStream doc, Result result) { + Source fo = new StreamSource(doc); + try { + Transformer transformer = TransformerFactory.newInstance() + .newTransformer(new StreamSource(xslt)); + transformer.transform(fo, result); + } catch (TransformerConfigurationException e) { + throw new RuntimeException(e); + } catch (TransformerException e) { + throw new RuntimeException(e); + } finally { + closeStream(xslt); + closeStream(doc); + } + } + + private static void closeStream(InputStream stream) { + try { + stream.close(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + private DOMResult buildActualStructureTree() throws Exception { + DOMResult actualStructureTree = new DOMResult(); + createStructureTreeFromDocument(foLoader.getFoInputStream(), actualStructureTree); + return actualStructureTree; + } + + private static void createStructureTreeFromDocument(InputStream foInputStream, + Result result) throws Exception { + TransformerHandler tHandler = createTransformerHandler(result); + startStructureTreeSequence(tHandler); + StructureTreeEventHandler structureTreeEventHandler + = StructureTree2SAXEventAdapter.newInstance(tHandler); + FODocumentParser documentParser = createDocumentParser(structureTreeEventHandler); + FOUserAgent userAgent = createFOUserAgent(documentParser); + parseDocument(foInputStream, documentParser, userAgent); + endStructureTreeSequence(tHandler); + } + + private static TransformerHandler createTransformerHandler(Result domResult) + throws TransformerConfigurationException, TransformerFactoryConfigurationError { + SAXTransformerFactory factory = (SAXTransformerFactory) SAXTransformerFactory.newInstance(); + TransformerHandler transformerHandler = factory.newTransformerHandler(); + transformerHandler.setResult(domResult); + return transformerHandler; + } + + private static void startStructureTreeSequence(TransformerHandler tHandler) throws SAXException { + tHandler.startDocument(); + tHandler.startElement("", STRUCTURE_TREE_SEQUENCE_NAME, STRUCTURE_TREE_SEQUENCE_NAME, + new AttributesImpl()); + } + + private static FODocumentParser createDocumentParser( + final StructureTreeEventHandler structureTreeEventHandler) { + return FODocumentParser.newInstance(new FOEventHandlerFactory() { + public FOEventHandler newFOEventHandler(FOUserAgent foUserAgent) { + return new FO2StructureTreeConverter(structureTreeEventHandler, + new DummyFOEventHandler(foUserAgent)); + } + }); + } + + private static FOUserAgent createFOUserAgent(FODocumentParser documentParser) { + FOUserAgent userAgent = documentParser.createFOUserAgent(); + userAgent.setAccessibility(true); + return userAgent; + } + + private static void parseDocument(InputStream foInputStream, FODocumentParser documentParser, + FOUserAgent userAgent) throws FOPException, LoadingException { + try { + documentParser.parse(foInputStream, userAgent); + } finally { + closeStream(foInputStream); + } + } + + private static void endStructureTreeSequence(TransformerHandler tHandler) throws SAXException { + tHandler.endElement("", STRUCTURE_TREE_SEQUENCE_NAME, STRUCTURE_TREE_SEQUENCE_NAME); + tHandler.endDocument(); + } + + private static Diff createDiff(DOMResult expected, DOMResult actual) { + Diff diff = new Diff(getDocument(expected), getDocument(actual)); + return diff; + } + + private static Document getDocument(DOMResult result) { + return (Document) result.getNode(); + } +} diff --git a/src/test/java/org/apache/fop/accessibility/fo/PDFUAWarningTestCase.java b/src/test/java/org/apache/fop/accessibility/fo/PDFUAWarningTestCase.java new file mode 100644 index 000000000..3940ada7e --- /dev/null +++ b/src/test/java/org/apache/fop/accessibility/fo/PDFUAWarningTestCase.java @@ -0,0 +1,61 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.accessibility.fo; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +import org.xml.sax.helpers.AttributesImpl; + +import org.apache.fop.pdf.PDFDocument; +import org.apache.fop.pdf.PDFFactory; +import org.apache.fop.pdf.PDFParentTree; +import org.apache.fop.pdf.PDFStructElem; +import org.apache.fop.pdf.PDFUAMode; +import org.apache.fop.render.pdf.PDFStructureTreeBuilder; + +public class PDFUAWarningTestCase { + + PDFFactory pdfFactory; + + @Test + public void nestedTableWarningTestCase() throws IOException { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + PDFStructElem emptyElem = new PDFStructElem(); + PDFStructElem block = PDFStructureTreeBuilder.createStructureElement("block", emptyElem, + new AttributesImpl(), pdfFactory, null); + PDFStructureTreeBuilder.createStructureElement("table", block, new AttributesImpl(), pdfFactory, null); + block.output(bos); + Assert.assertEquals("Div", block.getStructureType().toString()); + } + + @Before + public void setUp() { + PDFParentTree tree = new PDFParentTree(); + PDFDocument doc = new PDFDocument(""); + doc.makeStructTreeRoot(tree); + doc.getProfile().setPDFUAMode(PDFUAMode.PDFUA_1); + pdfFactory = new PDFFactory(doc); + } +} diff --git a/src/test/java/org/apache/fop/accessibility/fo/abb.fo b/src/test/java/org/apache/fop/accessibility/fo/abb.fo new file mode 100644 index 000000000..4ebc16398 --- /dev/null +++ b/src/test/java/org/apache/fop/accessibility/fo/abb.fo @@ -0,0 +1,17 @@ +<?xml version="1.0" standalone="no"?> +<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" + xmlns:fox="http://xmlgraphics.apache.org/fop/extensions"> + <fo:layout-master-set> + <fo:simple-page-master master-name="page" + page-height="220pt" page-width="320pt" margin="10pt"> + <fo:region-body/> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="page" language="en" country="GB"> + <fo:flow flow-name="xsl-region-body"> + <fo:block>Apache <fo:inline fox:abbreviation ="Formatting Objects Processor">FOP</fo:inline> is a print + formatter driven by XSL + </fo:block> + </fo:flow> + </fo:page-sequence> +</fo:root> diff --git a/src/test/java/org/apache/fop/accessibility/fo/artifact.fo b/src/test/java/org/apache/fop/accessibility/fo/artifact.fo new file mode 100644 index 000000000..c3d5fadf3 --- /dev/null +++ b/src/test/java/org/apache/fop/accessibility/fo/artifact.fo @@ -0,0 +1,97 @@ +<?xml version="1.0" standalone="no"?> +<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> + <fo:layout-master-set> + <fo:simple-page-master master-name="page" + page-height="500pt" page-width="300pt" margin="20pt"> + <fo:region-body/> + </fo:simple-page-master> + </fo:layout-master-set> + + <fo:page-sequence master-reference="page"> + <fo:flow flow-name="xsl-region-body" text-align="justify"> + + <fo:block>This piece of text is normal content that should be read out loud by a screen + reader.</fo:block> + + <fo:block space-before="10pt">The following content will be treated as artifact:</fo:block> + + <fo:wrapper role="artifact"> + <fo:block-container border="1pt solid black" padding="5pt" background-color="#F0F0F0" + space-before="10pt" start-indent="6pt" end-indent="6pt" color="#606060"> + <fo:block start-indent="0" end-indent="0"> + <fo:block>A block as artifact.</fo:block> + <fo:table space-before="5pt" width="100%" table-layout="fixed"> + <fo:table-column column-width="proportional-column-width(1)"/> + <fo:table-column column-width="proportional-column-width(2)"/> + <fo:table-header> + <fo:table-cell border="1pt solid #606060"><fo:block>Header 1.1</fo:block></fo:table-cell> + <fo:table-cell border="1pt solid #606060"><fo:block>Header 1.2</fo:block></fo:table-cell> + </fo:table-header> + <fo:table-footer> + <fo:table-cell border="1pt solid #606060"><fo:block>Footer 1.1</fo:block></fo:table-cell> + <fo:table-cell border="1pt solid #606060"><fo:block>Footer 1.2</fo:block></fo:table-cell> + </fo:table-footer> + <fo:table-body> + <fo:table-row> + <fo:table-cell border="1pt solid #606060"><fo:block>Cell 1.1</fo:block></fo:table-cell> + <fo:table-cell border="1pt solid #606060"><fo:block>Cell 1.2</fo:block></fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell border="1pt solid #606060"><fo:block>Cell 2.1</fo:block></fo:table-cell> + <fo:table-cell border="1pt solid #606060"><fo:block>Cell 2.2</fo:block></fo:table-cell> + </fo:table-row> + </fo:table-body> + </fo:table> + <fo:list-block space-before="7pt" provisional-distance-between-starts="8pt" + provisional-label-separation="5pt"> + <fo:list-item> + <fo:list-item-label end-indent="label-end()"> + <fo:block>•</fo:block> + </fo:list-item-label> + <fo:list-item-body start-indent="body-start()"> + <fo:block>Item 1.</fo:block> + </fo:list-item-body> + </fo:list-item> + <fo:list-item> + <fo:list-item-label end-indent="label-end()"> + <fo:block>•</fo:block> + </fo:list-item-label> + <fo:list-item-body start-indent="body-start()"> + <fo:block>Item 2.</fo:block> + </fo:list-item-body> + </fo:list-item> + <fo:list-item> + <fo:list-item-label end-indent="label-end()"> + <fo:block>•</fo:block> + </fo:list-item-label> + <fo:list-item-body start-indent="body-start()"> + <fo:block>Item 3.</fo:block> + </fo:list-item-body> + </fo:list-item> + </fo:list-block> + <fo:wrapper> + <fo:block>A block in a nested wrapper.</fo:block> + </fo:wrapper> + <fo:wrapper role="artifact"> + <fo:block>A block in a nested artifact wrapper.</fo:block> + </fo:wrapper> + <fo:wrapper> + <fo:block>Inside a nested wrapper. + <fo:wrapper role="artifact">An artifact wrapper inside the nested wrapper. + <fo:inline><fo:wrapper>Inside a wrapper inside the artifact wrapper that is inside + the nested wrapper.</fo:wrapper> Outside the wrapper inside the artifact + wrapper that is inside the nested wrapper.</fo:inline> + </fo:wrapper> Outside the artifact wrapper.</fo:block> + </fo:wrapper> + </fo:block> + </fo:block-container> + </fo:wrapper> + + <fo:block space-before="10pt">Now we are back to normal content that is part of the logical + structure, should appear in the structure tree and should be read out loud by the screen + reader.</fo:block> + + </fo:flow> + </fo:page-sequence> + +</fo:root> diff --git a/src/test/java/org/apache/fop/accessibility/fo/fo2StructureTree.xsl b/src/test/java/org/apache/fop/accessibility/fo/fo2StructureTree.xsl new file mode 100644 index 000000000..f21b079a4 --- /dev/null +++ b/src/test/java/org/apache/fop/accessibility/fo/fo2StructureTree.xsl @@ -0,0 +1,186 @@ +<?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. +--> +<!-- $Id$ --> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:fo="http://www.w3.org/1999/XSL/Format" + xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" + xmlns:foi="http://xmlgraphics.apache.org/fop/internal"> + + <xsl:output method="xml" indent="yes"/> + + <xsl:template name="copy"> + <xsl:copy> + <xsl:apply-templates select="@*|node()"/> + </xsl:copy> + </xsl:template> + + + <!-- Ignore fo:root --> + <xsl:template match="fo:root"> + <structure-tree-sequence> + <xsl:apply-templates/> + </structure-tree-sequence> + </xsl:template> + + <!-- fo:page-sequence maps to structure-tree --> + <xsl:template match="fo:page-sequence"> + <structure-tree xmlns="http://xmlgraphics.apache.org/fop/intermediate"> + <xsl:apply-templates/> + </structure-tree> + </xsl:template> + + + <!-- Declarations and Pagination and Layout Formatting Objects --> + <xsl:template match="fo:static-content|fo:flow"> + <xsl:call-template name="copy"/> + </xsl:template> + + <xsl:template match="fo:static-content/@flow-name|fo:flow/@flow-name"> + <xsl:choose> + <xsl:when test=". = 'xsl-region-body' or + . = 'xsl-region-before' or + . = 'xsl-region-after' or + . = 'xsl-region-start' or + . = 'xsl-region-end' or + . = 'xsl-before-float-separator' or + . = 'xsl-footnote-separator'"> + <xsl:copy/> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="{local-name()}"> + <xsl:value-of select="concat('xsl-', local-name(//*[@region-name = current()]))"/> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <!-- Block-level Formatting Objects --> + <xsl:template match="fo:block|fo:block-container"> + <xsl:call-template name="copy"/> + </xsl:template> + + <!-- Inline-level Formatting Objects --> + <xsl:template match="fo:character|fo:inline|fo:inline-container"> + <xsl:call-template name="copy"/> + </xsl:template> + + <xsl:template match="fo:external-graphic|fo:instream-foreign-object"> + <xsl:call-template name="copy"/> + </xsl:template> + + <xsl:template match="fo:page-number|fo:page-number-citation|fo:page-number-citation-last"> + <xsl:call-template name="copy"/> + </xsl:template> + + <!-- Formatting Objects for Tables --> + <xsl:template match="fo:table-and-caption|fo:table-caption"> + <xsl:call-template name="copy"/> + </xsl:template> + + <xsl:template match="fo:table|fo:table-header|fo:table-footer|fo:table-body|fo:table-row"> + <xsl:call-template name="copy"/> + </xsl:template> + + <xsl:template name="get.column.header"> + <xsl:value-of select="ancestor::fo:table/fo:table-column[ + count(preceding-sibling::fo:table-column) = count(current()/preceding-sibling::fo:table-cell)]/@fox:header"/> + </xsl:template> + + <xsl:template match="fo:table-cell"> + <xsl:variable name="header"><xsl:call-template name="get.column.header"/></xsl:variable> + <xsl:copy> + <xsl:if test="$header = 'true'"> + <xsl:attribute name="role">TH</xsl:attribute> + <xsl:attribute name="scope" namespace="http://xmlgraphics.apache.org/fop/internal">Row</xsl:attribute> + </xsl:if> + <xsl:apply-templates select="@*|node()"/> + </xsl:copy> + </xsl:template> + + <xsl:template match="fo:table-header/fo:table-cell|fo:table-header/fo:table-row/fo:table-cell"> + <xsl:variable name="header"><xsl:call-template name="get.column.header"/></xsl:variable> + <xsl:copy> + <xsl:attribute name="role">TH</xsl:attribute> + <xsl:if test="$header = 'true'"> + <xsl:attribute name="scope" namespace="http://xmlgraphics.apache.org/fop/internal">Both</xsl:attribute> + </xsl:if> + <xsl:apply-templates select="@*|node()"/> + </xsl:copy> + </xsl:template> + + <!-- Formatting Objects for Lists --> + <xsl:template match="fo:list-block|fo:list-item|fo:list-item-label|fo:list-item-body"> + <xsl:call-template name="copy"/> + </xsl:template> + + <!-- Dynamic Effects: Link and Multi Formatting Objects --> + <xsl:template match="fo:basic-link"> + <xsl:call-template name="copy"/> + </xsl:template> + + <!-- Out-of-Line Formatting Objects --> + <xsl:template match="fo:float|fo:footnote|fo:footnote-body"> + <xsl:call-template name="copy"/> + </xsl:template> + + <!-- Other Formatting Objects --> + <xsl:template match="fo:wrapper|fo:marker"> + <xsl:call-template name="copy"/> + </xsl:template> + + <xsl:template match="fo:wrapper[translate(normalize-space(@role), 'ARTIFCT', 'artifct') = 'artifact']"/> + + + <!-- Discard descendants of fo:leader --> + <xsl:template match="fo:leader"/> + + + <!-- Keep the relevant attributes, discard everything else --> + <xsl:template match="@fox:alt-text|@role|@fox:abbreviation"> + <xsl:copy-of select="."/> + </xsl:template> + + <xsl:template match="fo:block/@language[. != ../ancestor::*[@language][1]/@language] + |fo:character/@language[. != ../ancestor::*[@language][1]/@language]"> + <xsl:attribute name="xml:lang"> + <xsl:value-of select="."/> + <xsl:if test="../@country[. != 'none']"> + <xsl:text>-</xsl:text> + <xsl:value-of select="../@country"/> + </xsl:if> + </xsl:attribute> + </xsl:template> + + <xsl:template match="@*"/> + + + <!-- Discard text nodes... --> + <xsl:template match="text()"/> + + <!-- ...except those that will result into marked content --> + <xsl:template match="fo:title/text() + |fo:block/text() + |fo:bidi-override/text() + |fo:inline/text() + |fo:basic-link/text() + |fo:wrapper/text() + |fo:marker/text()"> + <marked-content xmlns="http://xmlgraphics.apache.org/fop/intermediate"/> + </xsl:template> + +</xsl:stylesheet> diff --git a/src/test/java/org/apache/fop/accessibility/fo/language.fo b/src/test/java/org/apache/fop/accessibility/fo/language.fo new file mode 100644 index 000000000..8dfb2694a --- /dev/null +++ b/src/test/java/org/apache/fop/accessibility/fo/language.fo @@ -0,0 +1,30 @@ +<?xml version="1.0" standalone="no"?> +<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" + xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" + font-family="sans-serif"> + <fo:layout-master-set> + <fo:simple-page-master master-name="page" + page-height="170pt" page-width="220pt" margin="10pt"> + <fo:region-body display-align="center"/> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="page" language="en" country="GB"> + <fo:flow flow-name="xsl-region-body" line-height="10pt" font-size="8pt" space-before="5pt" + space-after="5pt"> + <fo:block>This block of text is written in the default language of the page sequence, which is + British English.</fo:block> + <fo:block language="fr" country="FR" space-before="inherit" space-after="inherit">Ce text est + écrit dans une autre langue, en l’occurence le français de France. + <fo:block language="en" country="US" space-before="inherit" start-indent="1em" + space-after="inherit">However, this block of French text encloses a block of American + English. + <fo:block space-before="inherit" start-indent="2em" space-after="inherit" language="en" + country="US">The structure element corresponding to this block should have no language + set as it is the same as on the parent block.</fo:block></fo:block> + Maintenant on revient au français.</fo:block> + <fo:block space-before="inherit">And now we are back to the English language, with a + <fo:character character="F" language="fr" country="none" color="blue"/>rench + character.</fo:block> + </fo:flow> + </fo:page-sequence> +</fo:root> diff --git a/src/test/java/org/apache/fop/accessibility/fo/table-footers.fo b/src/test/java/org/apache/fop/accessibility/fo/table-footers.fo new file mode 100644 index 000000000..6dcb9b68d --- /dev/null +++ b/src/test/java/org/apache/fop/accessibility/fo/table-footers.fo @@ -0,0 +1,195 @@ +<?xml version="1.0" standalone="no"?> +<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> + <fo:layout-master-set> + <fo:simple-page-master master-name="page" + page-height="440pt" page-width="420pt" margin="10pt"> + <fo:region-body display-align="center"/> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="page"> + <fo:flow flow-name="xsl-region-body" line-height="10pt" font-size="8pt"> + <fo:table width="100% - 6pt" table-layout="fixed" + border-collapse="separate" border="2pt solid black" border-separation="2pt" padding="1pt" + start-indent="3pt" end-indent="3pt" space-after="2pt"> + <fo:table-header start-indent="0" end-indent="0"> + <fo:table-cell background-color="#E0E0E0" padding="2pt"> + <fo:block>Start Outer Header</fo:block> + <fo:table width="100% - 6pt" table-layout="fixed" + border="2pt solid red" padding="1pt" + start-indent="3pt" end-indent="3pt" space-after="2pt"> + <fo:table-header start-indent="0" end-indent="0"> + <fo:table-cell background-color="#FFB0B0" padding="2pt"> + <fo:block>Inner Header 1.1</fo:block> + </fo:table-cell> + <fo:table-cell background-color="#FFB0B0" padding="2pt"> + <fo:block>Inner Header 1.2</fo:block> + </fo:table-cell> + </fo:table-header> + <fo:table-footer start-indent="0" end-indent="0"> + <fo:table-cell background-color="#FFB0B0" padding="2pt"> + <fo:block>Inner Footer 1.1</fo:block> + </fo:table-cell> + <fo:table-cell background-color="#FFB0B0" padding="2pt"> + <fo:block>Inner Footer 1.2</fo:block> + </fo:table-cell> + </fo:table-footer> + <fo:table-body start-indent="0" end-indent="0"> + <fo:table-row> + <fo:table-cell background-color="#FFB0B0" padding="2pt"> + <fo:block>Inner Body 1.1</fo:block> + </fo:table-cell> + <fo:table-cell background-color="#FFB0B0" padding="2pt"> + <fo:block>Inner Body 1.2</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell background-color="#FFB0B0" padding="2pt"> + <fo:block>Inner Body 2.1</fo:block> + </fo:table-cell> + <fo:table-cell background-color="#FFB0B0" padding="2pt"> + <fo:block>Inner Body 2.2</fo:block> + </fo:table-cell> + </fo:table-row> + </fo:table-body> + </fo:table> + <fo:block>End Outer Header</fo:block> + </fo:table-cell> + </fo:table-header> + <fo:table-footer start-indent="0" end-indent="0"> + <fo:table-cell background-color="#E0E0E0" padding="2pt"> + <fo:block>Start Outer Footer</fo:block> + <fo:table width="100% - 6pt" table-layout="fixed" + border="2pt solid green" padding="1pt" + start-indent="3pt" end-indent="3pt" space-after="2pt"> + <fo:table-header start-indent="0" end-indent="0"> + <fo:table-cell background-color="lightgreen" padding="2pt"> + <fo:block>Inner Header 1.1</fo:block> + </fo:table-cell> + <fo:table-cell background-color="lightgreen" padding="2pt"> + <fo:block>Inner Header 1.2</fo:block> + </fo:table-cell> + </fo:table-header> + <fo:table-footer start-indent="0" end-indent="0"> + <fo:table-cell background-color="lightgreen" padding="2pt"> + <fo:block>Start Inner Footer 1.1</fo:block> + <fo:table width="100% - 6pt" table-layout="fixed" + border="2pt solid yellow" padding="1pt" + start-indent="3pt" end-indent="3pt" space-after="2pt"> + <fo:table-header start-indent="0" end-indent="0"> + <fo:table-cell background-color="yellow" padding="2pt"> + <fo:block>Inner Inner Header 1.1</fo:block> + </fo:table-cell> + <fo:table-cell background-color="yellow" padding="2pt"> + <fo:block>Inner Inner Header 1.2</fo:block> + </fo:table-cell> + </fo:table-header> + <fo:table-footer start-indent="0" end-indent="0"> + <fo:table-cell background-color="yellow" padding="2pt"> + <fo:block>Inner Inner Footer 1.1</fo:block> + </fo:table-cell> + <fo:table-cell background-color="yellow" padding="2pt"> + <fo:block>Inner Inner Footer 1.2</fo:block> + </fo:table-cell> + </fo:table-footer> + <fo:table-body start-indent="0" end-indent="0"> + <fo:table-row> + <fo:table-cell background-color="yellow" padding="2pt"> + <fo:block>Inner Inner Body 1.1</fo:block> + </fo:table-cell> + <fo:table-cell background-color="yellow" padding="2pt"> + <fo:block>Inner Inner Body 1.2</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell background-color="yellow" padding="2pt"> + <fo:block>Inner Inner Body 2.1</fo:block> + </fo:table-cell> + <fo:table-cell background-color="yellow" padding="2pt"> + <fo:block>Inner Inner Body 2.2</fo:block> + </fo:table-cell> + </fo:table-row> + </fo:table-body> + </fo:table> + <fo:block>End Inner Footer 1.1</fo:block> + </fo:table-cell> + <fo:table-cell background-color="lightgreen" padding="2pt"> + <fo:block>Inner Footer 1.2</fo:block> + </fo:table-cell> + </fo:table-footer> + <fo:table-body start-indent="0" end-indent="0"> + <fo:table-row> + <fo:table-cell background-color="lightgreen" padding="2pt"> + <fo:block>Inner Body 1.1</fo:block> + </fo:table-cell> + <fo:table-cell background-color="lightgreen" padding="2pt"> + <fo:block>Inner Body 1.2</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell background-color="lightgreen" padding="2pt"> + <fo:block>Inner Body 2.1</fo:block> + </fo:table-cell> + <fo:table-cell background-color="lightgreen" padding="2pt"> + <fo:block>Inner Body 2.2</fo:block> + </fo:table-cell> + </fo:table-row> + </fo:table-body> + </fo:table> + <fo:block>End Outer Footer</fo:block> + </fo:table-cell> + </fo:table-footer> + <fo:table-body start-indent="0" end-indent="0"> + <fo:table-row> + <fo:table-cell background-color="#E0E0E0" padding="2pt"> + <fo:block>Outer Body Cell 1</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell background-color="#E0E0E0" padding="2pt"> + <fo:block>Start Outer Body Cell 2</fo:block> + <fo:table width="100% - 6pt" table-layout="fixed" + border="2pt solid blue" padding="1pt" + start-indent="3pt" end-indent="3pt" space-after="2pt"> + <fo:table-header start-indent="0" end-indent="0"> + <fo:table-cell background-color="lightblue" padding="2pt"> + <fo:block>Inner Footer 1.1</fo:block> + </fo:table-cell> + <fo:table-cell background-color="lightblue" padding="2pt"> + <fo:block>Inner Footer 1.2</fo:block> + </fo:table-cell> + </fo:table-header> + <fo:table-footer start-indent="0" end-indent="0"> + <fo:table-cell background-color="lightblue" padding="2pt"> + <fo:block>Inner Header 1.1</fo:block> + </fo:table-cell> + <fo:table-cell background-color="lightblue" padding="2pt"> + <fo:block>Inner Header 1.2</fo:block> + </fo:table-cell> + </fo:table-footer> + <fo:table-body start-indent="0" end-indent="0"> + <fo:table-row> + <fo:table-cell background-color="lightblue" padding="2pt"> + <fo:block>Inner Body 1.1</fo:block> + </fo:table-cell> + <fo:table-cell background-color="lightblue" padding="2pt"> + <fo:block>Inner Body 1.2</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell background-color="lightblue" padding="2pt"> + <fo:block>Inner Body 2.1</fo:block> + </fo:table-cell> + <fo:table-cell background-color="lightblue" padding="2pt"> + <fo:block>Inner Body 2.2</fo:block> + </fo:table-cell> + </fo:table-row> + </fo:table-body> + </fo:table> + <fo:block>End Outer Body Cell 2</fo:block> + </fo:table-cell> + </fo:table-row> + </fo:table-body> + </fo:table> + </fo:flow> + </fo:page-sequence> +</fo:root> diff --git a/src/test/java/org/apache/fop/accessibility/fo/table-header_scope.fo b/src/test/java/org/apache/fop/accessibility/fo/table-header_scope.fo new file mode 100644 index 000000000..c6272d546 --- /dev/null +++ b/src/test/java/org/apache/fop/accessibility/fo/table-header_scope.fo @@ -0,0 +1,57 @@ +<?xml version="1.0" standalone="no"?> +<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" + xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" + font-family="sans-serif"> + <fo:layout-master-set> + <fo:simple-page-master master-name="page" + page-height="120pt" page-width="220pt" margin="10pt"> + <fo:region-body display-align="center"/> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="page"> + <fo:flow flow-name="xsl-region-body" line-height="10pt" font-size="8pt"> + <fo:table width="100%" table-layout="fixed"> + <fo:table-column fox:header="true" column-width="proportional-column-width(1)"/> + <fo:table-column column-width="proportional-column-width(1)"/> + <fo:table-column column-width="proportional-column-width(1)"/> + <fo:table-header font-weight="bold"> + <fo:table-row> + <fo:table-cell border="1pt solid black" padding-left="1pt"> + <fo:block>Table Header</fo:block> + </fo:table-cell> + <fo:table-cell border="1pt solid black" padding-left="1pt"> + <fo:block>Column 1</fo:block> + </fo:table-cell> + <fo:table-cell border="1pt solid black" padding-left="1pt"> + <fo:block>Column 2</fo:block> + </fo:table-cell> + </fo:table-row> + </fo:table-header> + <fo:table-body> + <fo:table-row> + <fo:table-cell id="Row1" border="1pt solid black" padding-left="1pt" font-weight="bold"> + <fo:block>Row 1</fo:block> + </fo:table-cell> + <fo:table-cell border="1pt solid black" padding-left="1pt"> + <fo:block>Cell 1.1</fo:block> + </fo:table-cell> + <fo:table-cell border="1pt solid black" padding-left="1pt"> + <fo:block>Cell 1.2</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell border="1pt solid black" padding-left="1pt" font-weight="bold" role="TH"> + <fo:block>Row 2</fo:block> + </fo:table-cell> + <fo:table-cell border="1pt solid black" padding-left="1pt"> + <fo:block>Cell 2.1</fo:block> + </fo:table-cell> + <fo:table-cell border="1pt solid black" padding-left="1pt"> + <fo:block>Cell 2.2</fo:block> + </fo:table-cell> + </fo:table-row> + </fo:table-body> + </fo:table> + </fo:flow> + </fo:page-sequence> +</fo:root> diff --git a/src/test/java/org/apache/fop/accessibility/pdf/FootnoteSeparatorTestCase.java b/src/test/java/org/apache/fop/accessibility/pdf/FootnoteSeparatorTestCase.java new file mode 100644 index 000000000..1da88b2eb --- /dev/null +++ b/src/test/java/org/apache/fop/accessibility/pdf/FootnoteSeparatorTestCase.java @@ -0,0 +1,68 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.accessibility.pdf; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; + +import org.junit.Test; + +import org.xml.sax.helpers.AttributesImpl; +import static org.junit.Assert.assertEquals; + +import org.apache.fop.pdf.PDFArray; +import org.apache.fop.pdf.PDFDocument; +import org.apache.fop.pdf.PDFFactory; +import org.apache.fop.pdf.PDFParentTree; +import org.apache.fop.pdf.PDFStructElem; +import org.apache.fop.pdf.PDFStructTreeRoot; +import org.apache.fop.render.pdf.PDFStructureTreeBuilder; + +public class FootnoteSeparatorTestCase { + + @Test + public void testFootNoteSeparatorText() throws IOException { + PDFParentTree tree = new PDFParentTree(); + AttributesImpl attributes = new AttributesImpl(); + attributes.addAttribute("", "role", "role", "CDATA", null); + PDFDocument doc = new PDFDocument(""); + PDFStructTreeRoot strucRoot = doc.makeStructTreeRoot(tree); + PDFFactory factory = new PDFFactory(doc); + PDFStructElem part = PDFStructureTreeBuilder.createStructureElement("page-sequence", strucRoot, attributes, + factory, null); + AttributesImpl att = new AttributesImpl(); + att.addAttribute("", "flow-name", "flow-name", "CDATA", "xsl-footnote-separator"); + PDFStructElem staticSection = PDFStructureTreeBuilder.createStructureElement("static-content", part, att, + factory, null); + PDFStructElem block = PDFStructureTreeBuilder.createStructureElement("block", part, new AttributesImpl(), + factory, null); + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + part.output(bos); + PDFArray array = (PDFArray)part.get("K"); + PDFStructElem elem1 = (PDFStructElem)array.get(0); + String test = elem1.getStructureType().getName().getName(); + String expected = "P"; + assertEquals(test, expected); + PDFStructElem elem2 = (PDFStructElem)array.get(1); + test = elem2.getStructureType().getName().getName(); + expected = "Sect"; + assertEquals(test, expected); + } +} diff --git a/src/test/java/org/apache/fop/accessibility/pdf/MissingLanguageWarningTestCase.java b/src/test/java/org/apache/fop/accessibility/pdf/MissingLanguageWarningTestCase.java new file mode 100644 index 000000000..c5d161194 --- /dev/null +++ b/src/test/java/org/apache/fop/accessibility/pdf/MissingLanguageWarningTestCase.java @@ -0,0 +1,94 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.accessibility.pdf; + +import java.io.File; +import java.util.Arrays; +import java.util.LinkedList; + +import javax.xml.transform.Source; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.sax.SAXResult; +import javax.xml.transform.stream.StreamSource; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.apache.commons.io.output.NullOutputStream; + +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.apps.Fop; +import org.apache.fop.apps.FopFactory; +import org.apache.fop.apps.MimeConstants; +import org.apache.fop.events.Event; +import org.apache.fop.events.EventListener; +import org.apache.fop.render.pdf.PDFEventProducer; + +public class MissingLanguageWarningTestCase { + + private Fop fop; + + private MissingLanguageEventChecker eventChecker; + + private static class MissingLanguageEventChecker implements EventListener { + + private final String unknownLanguageEventID = PDFEventProducer.class.getName() + ".unknownLanguage"; + + private final LinkedList<String> expectedLocations = new LinkedList<String>( + Arrays.asList("30:37", "34:40")); + + public void processEvent(Event event) { + if (event.getEventID().equals(unknownLanguageEventID)) { + assertFalse("Too many unknownLanguage events", expectedLocations.isEmpty()); + assertEquals(expectedLocations.removeFirst(), event.getParam("location")); + } + } + + void end() { + assertTrue("Expected more unknownLanguage events", expectedLocations.isEmpty()); + } + + } + + @Before + public void setUp() throws Exception { + FopFactory fopFactory = FopFactory.newInstance(new File(".").toURI()); + FOUserAgent userAgent = fopFactory.newFOUserAgent(); + userAgent.setAccessibility(true); + eventChecker = new MissingLanguageEventChecker(); + userAgent.getEventBroadcaster().addEventListener(eventChecker); + fop = fopFactory.newFop(MimeConstants.MIME_PDF, userAgent, new NullOutputStream()); + } + + @Test + public void testMissingLanguage() throws Exception { + Source src = new StreamSource(getClass().getResourceAsStream("missing-language.fo")); + SAXResult res = new SAXResult(fop.getDefaultHandler()); + Transformer transformer = TransformerFactory.newInstance().newTransformer(); + transformer.transform(src, res); + eventChecker.end(); + } + +} diff --git a/src/test/java/org/apache/fop/accessibility/pdf/missing-language.fo b/src/test/java/org/apache/fop/accessibility/pdf/missing-language.fo new file mode 100644 index 000000000..a774d3c3b --- /dev/null +++ b/src/test/java/org/apache/fop/accessibility/pdf/missing-language.fo @@ -0,0 +1,40 @@ +<?xml version="1.0"?> +<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" + xmlns:fox="http://xmlgraphics.apache.org/fop/extensions"> + <fo:layout-master-set> + <fo:simple-page-master master-name="page" + page-height="320pt" page-width="420pt" margin="10pt"> + <fo:region-body/> + </fo:simple-page-master> + </fo:layout-master-set> + + <fo:page-sequence master-reference="page"> + <fo:flow flow-name="xsl-region-body" text-align="justify" space-before="10pt"> + + <fo:block language="en" country="GB" space-before="inherit">This block of text is written in + British English. The following block is in French and translates as: “This block contains + French text and is tagged as such.”</fo:block> + + <fo:block language="fr" country="FR" space-before="inherit">Ce block contient du texte en + français et est marqué comme tel.</fo:block> + + <fo:block language="en" country="GB" space-before="inherit">The following block has no + language information, but since it contains no text no warning should be issued.</fo:block> + + <fo:block border="0.2pt solid black" space-before="inherit"> </fo:block> + + <fo:block language="en" country="GB" space-before="inherit">The following block has no + language information and contains an image with an alt-text, for which a warning should be + issued.</fo:block> + + <fo:block text-align="center"><fo:external-graphic + src="test/resources/images/fop-logo-color-24bit.png" + fox:alt-text="FOP logo"/></fo:block> + + <fo:block space-before="inherit">This block contains no language information. However, only + one warning should be issued for all of its lines.</fo:block> + + </fo:flow> + </fo:page-sequence> + +</fo:root> diff --git a/src/test/java/org/apache/fop/afp/AFPEventProcessingTestCase.java b/src/test/java/org/apache/fop/afp/AFPEventProcessingTestCase.java new file mode 100644 index 000000000..d1b47846b --- /dev/null +++ b/src/test/java/org/apache/fop/afp/AFPEventProcessingTestCase.java @@ -0,0 +1,72 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.afp; + +import java.io.InputStream; +import java.net.URI; + +import org.junit.Test; + +import org.apache.xmlgraphics.util.MimeConstants; + +import org.apache.fop.apps.FOPException; +import org.apache.fop.events.EventProcessingTestCase; + + +/** + * A test class for testing AFP events. + */ +public class AFPEventProcessingTestCase { + + private EventProcessingTestCase eventsTests = new EventProcessingTestCase(); + private static final URI CONFIG_BASE_DIR = EventProcessingTestCase.CONFIG_BASE_DIR; + + private void testInvalidConfigEvent(String xconf, String eventId) + throws Exception { + InputStream inStream = getClass().getResourceAsStream("simple.fo"); + eventsTests.doTest(inStream, CONFIG_BASE_DIR.resolve(xconf), + AFPEventProducer.class.getName() + eventId, MimeConstants.MIME_AFP); + } + + @Test + public void testMissingFontConfigurationElement() throws Exception { + testInvalidConfigEvent("afp-font-missing.xconf", ".fontConfigMissing"); + } + + @Test(expected = FOPException.class) + public void testInvalidCharactersetName() throws Exception { + testInvalidConfigEvent("afp-invalid-characterset.xconf", ".characterSetNameInvalid"); + } + + @Test(expected = FOPException.class) + public void testinvalidConfig() throws Exception { + testInvalidConfigEvent("afp-invalid-config.xconf", ".invalidConfiguration"); + } + + @Test + public void testRasterFontElementMissing() throws Exception { + testInvalidConfigEvent("afp-raster-font-missing.xconf", ".fontConfigMissing"); + } + + @Test + public void testTripletElementMissing() throws Exception { + testInvalidConfigEvent("afp-triplet-missing.xconf", ".fontConfigMissing"); + } +} diff --git a/src/test/java/org/apache/fop/afp/AFPGraphics2DTestCase.java b/src/test/java/org/apache/fop/afp/AFPGraphics2DTestCase.java new file mode 100644 index 000000000..7b261d482 --- /dev/null +++ b/src/test/java/org/apache/fop/afp/AFPGraphics2DTestCase.java @@ -0,0 +1,57 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.afp; + +import java.awt.BasicStroke; + +import org.junit.Test; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import org.apache.fop.afp.modca.GraphicsObject; +import org.apache.fop.fonts.FontInfo; + +public class AFPGraphics2DTestCase { + + private final float lineWidth = 1.0f; + private final float correction = 2.5f; + private final BasicStroke stroke = mock(BasicStroke.class); + private final GraphicsObject gObject = mock(GraphicsObject.class); + private final AFPPaintingState paintingState = mock(AFPPaintingState.class); + private final AFPResourceManager resourceManager = mock(AFPResourceManager.class); + private final AFPResourceInfo resourceInfo = mock(AFPResourceInfo.class); + private final FontInfo fontInfo = mock(FontInfo.class); + private AFPGraphics2D graphics2D = new AFPGraphics2D(false, paintingState, resourceManager, resourceInfo, + fontInfo); + + @Test + public void testApplyStroke() { + // note: this only tests the setLineWidth in the GraphicsObject + float correctedLineWidth = lineWidth * correction; + when(stroke.getLineWidth()).thenReturn(lineWidth); + when(paintingState.getLineWidthCorrection()).thenReturn(correction); + graphics2D.setGraphicsObject(gObject); + graphics2D.applyStroke(stroke); + verify(gObject).setLineWidth(correctedLineWidth); + } + +} diff --git a/src/test/java/org/apache/fop/afp/AFPObjectAreaInfoTestCase.java b/src/test/java/org/apache/fop/afp/AFPObjectAreaInfoTestCase.java new file mode 100644 index 000000000..e9134a90b --- /dev/null +++ b/src/test/java/org/apache/fop/afp/AFPObjectAreaInfoTestCase.java @@ -0,0 +1,76 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.afp; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +/** + * Test case for {@link AFPObjectAreaInfo}. + */ +public class AFPObjectAreaInfoTestCase { + + private AFPObjectAreaInfo sut; + + /** + * Instantiate the system under test + */ + @Before + public void setUp() { + sut = new AFPObjectAreaInfo(1, 2, 3, 4, 5, 6); + } + + /** + * Test the getter functions with arbitrary data. + */ + @Test + public void testGetters() { + assertEquals(1, sut.getX()); + assertEquals(2, sut.getY()); + assertEquals(3, sut.getWidth()); + assertEquals(4, sut.getHeight()); + assertEquals(5, sut.getWidthRes()); + assertEquals(5, sut.getHeightRes()); + assertEquals(6, sut.getRotation()); + } + + /** + * Test the resolution setters with arbitrary data. + */ + @Test + public void testSetters() { + assertEquals(5, sut.getWidthRes()); + assertEquals(5, sut.getHeightRes()); + + sut.setResolution(20); + assertEquals(20, sut.getWidthRes()); + assertEquals(20, sut.getHeightRes()); + + sut.setHeightRes(10); + assertEquals(20, sut.getWidthRes()); + assertEquals(10, sut.getHeightRes()); + + sut.setWidthRes(9); + assertEquals(9, sut.getWidthRes()); + assertEquals(10, sut.getHeightRes()); + } +} diff --git a/src/test/java/org/apache/fop/afp/AFPPaintingStateTestCase.java b/src/test/java/org/apache/fop/afp/AFPPaintingStateTestCase.java new file mode 100644 index 000000000..e9806f944 --- /dev/null +++ b/src/test/java/org/apache/fop/afp/AFPPaintingStateTestCase.java @@ -0,0 +1,61 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.afp; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +/** + * Test case for {@link AFPPaintingState}. + */ +public class AFPPaintingStateTestCase { + private AFPPaintingState sut; + + /** + * Set up the system under test + */ + @Before + public void setUp() { + sut = new AFPPaintingState(); + } + + /** + * Test {get,set}BitmapEncodingQuality() + */ + @Test + public void testGetSetBitmapEncodingQuality() { + sut.setBitmapEncodingQuality(0.5f); + assertEquals(0.5f, sut.getBitmapEncodingQuality(), 0.01f); + + sut.setBitmapEncodingQuality(0.9f); + assertEquals(0.9f, sut.getBitmapEncodingQuality(), 0.01f); + } + + /** + * Test {,set}CanEmbedJpeg + */ + public void testGetSetCanEmbedJpeg() { + assertEquals(false, sut.canEmbedJpeg()); + sut.setCanEmbedJpeg(true); + assertEquals(true, sut.canEmbedJpeg()); + } +} diff --git a/src/test/java/org/apache/fop/afp/AFPResourceManagerTestCase.java b/src/test/java/org/apache/fop/afp/AFPResourceManagerTestCase.java new file mode 100644 index 000000000..9d805a7da --- /dev/null +++ b/src/test/java/org/apache/fop/afp/AFPResourceManagerTestCase.java @@ -0,0 +1,93 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.afp; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.apache.xmlgraphics.util.MimeConstants; + +import org.apache.fop.apps.io.ResourceResolverFactory; + +/** + * Test case for {@link AFPResourceManager}. + */ +public class AFPResourceManagerTestCase { + + private AFPResourceManager sut; + + @Before + public void setUp() throws IOException { + sut = new AFPResourceManager(ResourceResolverFactory.createDefaultInternalResourceResolver( + new File(".").toURI())); + AFPPaintingState paintingState = new AFPPaintingState(); + ByteArrayOutputStream outStream = new ByteArrayOutputStream(); + DataStream stream = sut.createDataStream(paintingState, outStream); + stream.startPage(0, 0, 0, 10, 10); + } + + /** + * Ensures that if tryIncludeObject() is called with a new object, it returns false suggesting + * that we have to create said object. However, if it is called with an object that has already + * been created, it returns true suggesting that we don't have to create that object again. + * Page-segment is false. + * + * @throws IOException if an I/O error occurs + */ + @Test + public void testTryIncludeObjectWithPageSegFalse() throws IOException { + AFPDataObjectInfo dataInfo = createAFPDataObjectInfo(); + // An empty object needs to be created every time! + assertFalse(sut.tryIncludeObject(dataInfo)); + sut.createObject(dataInfo); + assertTrue(sut.tryIncludeObject(dataInfo)); + } + + /** + * {@code testTryIncludeObjectWithPageSegFalse()} but with page-segment true. + * + * @throws IOException if an I/O error occurs + */ + @Test + public void testTryIncludeObjectWithPageSegTrue() throws IOException { + AFPDataObjectInfo dataInfo = createAFPDataObjectInfo(); + dataInfo.setCreatePageSegment(true); + // An empty object needs to be created every time! + assertFalse(sut.tryIncludeObject(dataInfo)); + sut.createObject(dataInfo); + assertTrue(sut.tryIncludeObject(dataInfo)); + } + + private AFPDataObjectInfo createAFPDataObjectInfo() { + AFPDataObjectInfo dataInfo = new AFPDataObjectInfo(); + dataInfo.setMimeType(MimeConstants.MIME_TIFF); + dataInfo.setData(new byte[1]); + AFPObjectAreaInfo objectAreaInfo = new AFPObjectAreaInfo(0, 0, 10, 10, 1, 0); + dataInfo.setObjectAreaInfo(objectAreaInfo); + return dataInfo; + } +} diff --git a/src/test/java/org/apache/fop/afp/AFPResourceUtilTestCase.java b/src/test/java/org/apache/fop/afp/AFPResourceUtilTestCase.java new file mode 100644 index 000000000..178e5c6ad --- /dev/null +++ b/src/test/java/org/apache/fop/afp/AFPResourceUtilTestCase.java @@ -0,0 +1,159 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.afp; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.Arrays; + +import org.junit.Test; + +import static org.junit.Assert.assertTrue; + +import org.apache.commons.io.IOUtils; + +import org.apache.fop.afp.util.AFPResourceUtil; + +/** + * Tests the {@link AFPResourceUtil} class. + */ +public class AFPResourceUtilTestCase { + + private static final String RESOURCE_FILENAME = "expected_resource.afp"; + private static final String NAMED_RESOURCE_FILENAME = "expected_named_resource.afp"; + + private static final String RESOURCE_ANY_NAME = "resource_any_name.afp"; + private static final String RESOURCE_NAME_MATCH = "resource_name_match.afp"; + private static final String RESOURCE_NAME_MISMATCH = "resource_name_mismatch.afp"; + private static final String RESOURCE_NO_END_NAME = "resource_no_end_name.afp"; + + private static final String PSEG_A = "XFEATHER"; + private static final String PSEG_B = "S1CODEQR"; + + /** + * Tests copyResourceFile() + * @throws Exception - + */ + @Test + public void testCopyResourceFile() throws Exception { + compareResources(new ResourceCopier() { + public void copy(InputStream in, OutputStream out) throws IOException { + AFPResourceUtil.copyResourceFile(in, out); + } + }, RESOURCE_FILENAME, RESOURCE_FILENAME); + } + + /** + * Tests copyNamedResource() + * @throws Exception - + */ + @Test + public void testCopyNamedResource() throws Exception { + compareResources(new ResourceCopier() { + public void copy(InputStream in, OutputStream out) throws IOException { + AFPResourceUtil.copyNamedResource(PSEG_A, in, out); + } + }, RESOURCE_FILENAME, NAMED_RESOURCE_FILENAME); + } + + private void compareResources(ResourceCopier copyResource, String resourceA, String resourceB) + throws IOException { + ByteArrayOutputStream baos = copyResource(resourceA, copyResource); + byte[] expectedBytes = resourceAsByteArray(resourceB); + assertTrue(Arrays.equals(expectedBytes, baos.toByteArray())); + } + + private ByteArrayOutputStream copyResource(String resource, ResourceCopier resourceCopier) + throws IOException { + final ByteArrayOutputStream baos = new ByteArrayOutputStream(); + InputStream in = null; + try { + in = getClass().getResourceAsStream(resource); + resourceCopier.copy(in, baos); + } finally { + in.close(); + } + return baos; + } + + private byte[] resourceAsByteArray(String resource) throws IOException { + InputStream in = null; + byte[] expectedBytes = null; + try { + in = getClass().getResourceAsStream(resource); + expectedBytes = IOUtils.toByteArray(in); + } finally { + in.close(); + } + return expectedBytes; + } + + /** + * Tests the validity of a closing structured field having an FF FF name which + * allows it to match any existing matching starting field + * @throws Exception - + */ + @Test + public void testResourceAnyName() throws Exception { + testResource(RESOURCE_ANY_NAME, PSEG_B); + } + + /** + * Tests a matching end structured field name + * @throws Exception - + */ + @Test + public void testResourceNameMatch() throws Exception { + testResource(RESOURCE_NAME_MATCH, PSEG_B); + } + + /** + * Tests to see whether a matching structured field pair with mismatching + * names fails. + * @throws Exception - + */ + @Test(expected = Exception.class) + public void testResourceNameMismatch() throws Exception { + testResource(RESOURCE_NAME_MISMATCH, PSEG_B); + } + + /** + * Tests a matching structured end field with no name + * @throws Exception - + */ + @Test + public void testResourceNoEndName() throws Exception { + testResource(RESOURCE_NO_END_NAME, PSEG_B); + } + + private void testResource(String resource, final String pseg) throws Exception { + copyResource(resource, new ResourceCopier() { + public void copy(InputStream in, OutputStream out) throws IOException { + AFPResourceUtil.copyNamedResource(pseg, in, out); + } + }); + } + + private interface ResourceCopier { + void copy(InputStream in, OutputStream out) throws IOException; + } +} diff --git a/src/test/java/org/apache/fop/afp/AFPTestSuite.java b/src/test/java/org/apache/fop/afp/AFPTestSuite.java new file mode 100644 index 000000000..ac983f2db --- /dev/null +++ b/src/test/java/org/apache/fop/afp/AFPTestSuite.java @@ -0,0 +1,38 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.afp; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +import org.apache.fop.afp.modca.IncludeObjectTestCase; + +/** + * Test suite for FOP's AFP classes. + */ +@RunWith(Suite.class) +@SuiteClasses({ + IncludeObjectTestCase.class, + AFPObjectAreaInfoTestCase.class, + AFPPaintingStateTestCase.class +}) +public class AFPTestSuite { +} diff --git a/src/test/java/org/apache/fop/afp/expected_named_resource.afp b/src/test/java/org/apache/fop/afp/expected_named_resource.afp Binary files differnew file mode 100644 index 000000000..9fe45c388 --- /dev/null +++ b/src/test/java/org/apache/fop/afp/expected_named_resource.afp diff --git a/src/test/java/org/apache/fop/afp/expected_resource.afp b/src/test/java/org/apache/fop/afp/expected_resource.afp Binary files differnew file mode 100644 index 000000000..a98ac0e5e --- /dev/null +++ b/src/test/java/org/apache/fop/afp/expected_resource.afp diff --git a/src/test/java/org/apache/fop/afp/fonts/CharactersetEncoderTestCase.java b/src/test/java/org/apache/fop/afp/fonts/CharactersetEncoderTestCase.java new file mode 100644 index 000000000..ee2fd7876 --- /dev/null +++ b/src/test/java/org/apache/fop/afp/fonts/CharactersetEncoderTestCase.java @@ -0,0 +1,116 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.afp.fonts; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.nio.charset.CharacterCodingException; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +/** + * Test {@link CharactersetEncoder} + */ +public class CharactersetEncoderTestCase { + private CharactersetEncoder singlebyteEncoder; + private CharactersetEncoder doublebyteEncoder; + + @Before + public void setUp() { + singlebyteEncoder = CharacterSetType.SINGLE_BYTE.getEncoder("cp500"); + doublebyteEncoder = CharacterSetType.DOUBLE_BYTE_LINE_DATA.getEncoder("cp937"); + } + + // This is just an arbitrary CJK string + private final String testCJKText = "\u8ACB\u65BC\u627F\u505A\u65E5\u4E03\u65E5\u5167\u672A\u9054" + + "\u4E03\u65E5\u4E4B\u5B9A\u5B58\u8005\u4EE5\u5BE6\u969B\u5230\u671F\u65E5\u5167\u78BA" + + "\u8A8D\u672C\u4EA4\u6613\u5167\u5BB9\u3002\u5982\u672A\u65BC\u4E0A\u8FF0\u671F\u9593" + + "\u5167\u63D0\u51FA\u7570\u8B70\uFF0C\u8996\u540C\u610F\u627F\u8A8D\u672C\u4EA4\u6613" + + "\u3002"; + + private final byte[] test6CJKChars = { + (byte) 0x61, (byte) 0x99, + (byte) 0x50, (byte) 0xf4, + (byte) 0x50, (byte) 0xd4, + (byte) 0x56, (byte) 0x99, + (byte) 0x4c, (byte) 0xc9, + (byte) 0x4c, (byte) 0x44 }; + + private final String testEngText = "Hello World!"; + private final byte[] testEngChars = { + (byte) 0xc8, // H + (byte) 0x85, // e + (byte) 0x93, // l + (byte) 0x93, // l + (byte) 0x96, // o + (byte) 0x40, // " " + (byte) 0xe6, // W + (byte) 0x96, // o + (byte) 0x99, // r + (byte) 0x93, // l + (byte) 0x84, // d + (byte) 0x4f // ! + }; + + /** + * Tests canEncode() - tests that canEncode() responds properly to various input characters. + */ + @Test + public void testCanEncode() { + // Both SBCS and DBCS should support Latin characters + for (char c = '!'; c < '~'; c++) { + assertTrue(singlebyteEncoder.canEncode(c)); + assertTrue(doublebyteEncoder.canEncode(c)); + } + // ONLY the double byte characters can handle CJK text + for (char c : testCJKText.toCharArray()) { + assertFalse(singlebyteEncoder.canEncode(c)); + assertTrue(doublebyteEncoder.canEncode(c)); + } + // Ensure that double byte encoder doesn't just return true all the time... + assertFalse(doublebyteEncoder.canEncode('\u00BB')); + } + + @Test + public void testEncode() throws CharacterCodingException, IOException { + CharactersetEncoder.EncodedChars encChars; // = doublebyteEncoder.encode(testCJKText); + ByteArrayOutputStream bOut = new ByteArrayOutputStream(); + // JAVA 1.5 has a bug in the JVM in which these err for some reason... JAVA 1.6 no issues + /*encChars.writeTo(bOut, 0, encChars.getLength()); + byte[] bytes = bOut.toByteArray(); + for (int i = 0; i < 12; i++) { + assertEquals(test6CJKChars[i], bytes[i]); + } + bOut.reset();*/ + + encChars = singlebyteEncoder.encode(testEngText); + encChars.writeTo(bOut, 0, encChars.getLength()); + byte[] engBytes = bOut.toByteArray(); + for (int i = 0; i < testEngChars.length; i++) { + assertEquals(testEngChars[i], engBytes[i]); + } + assertEquals(testEngChars.length, engBytes.length); + } +} diff --git a/src/test/java/org/apache/fop/afp/fonts/IntegerKeyStoreTestCase.java b/src/test/java/org/apache/fop/afp/fonts/IntegerKeyStoreTestCase.java new file mode 100644 index 000000000..96c0618a7 --- /dev/null +++ b/src/test/java/org/apache/fop/afp/fonts/IntegerKeyStoreTestCase.java @@ -0,0 +1,48 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.afp.fonts; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.fail; + +public class IntegerKeyStoreTestCase { + + @Test + public void getAndPut() { + IntegerKeyStore<Integer> sut = new IntegerKeyStore<Integer>(); + assertNull(sut.get(0)); + sut.put(0, 0); + assertEquals(Integer.valueOf(0), sut.get(0)); + sut.put(0, 1); + assertEquals(Integer.valueOf(1), sut.get(0)); + sut.put(0, null); + assertNull(sut.get(0)); + try { + sut.put(-1, 0); + fail("Negative index"); + } catch (IndexOutOfBoundsException e) { + // As expected + } + } + +} diff --git a/src/test/java/org/apache/fop/afp/goca/GraphicsCharacterStringTestCase.java b/src/test/java/org/apache/fop/afp/goca/GraphicsCharacterStringTestCase.java new file mode 100644 index 000000000..17c47743c --- /dev/null +++ b/src/test/java/org/apache/fop/afp/goca/GraphicsCharacterStringTestCase.java @@ -0,0 +1,73 @@ +/* + * 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.fop.afp.goca; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +import org.apache.fop.afp.fonts.CharacterSet; +import org.apache.fop.afp.fonts.CharacterSetBuilder; +import org.apache.fop.fonts.Typeface; + +public class GraphicsCharacterStringTestCase { + private GraphicsCharacterString gcsCp500; + private GraphicsCharacterString gcsCp1146; + // consider the EBCDIC code page variants Cp500 and Cp1146 + // the <A3> (pound sign) corresponds to byte 5B (position 91) in the CCSID 285 and CCSID 1146 + // the $ corresponds to byte 5B (position 91) in the CCSID 500 + private final String poundsText = "\u00A3\u00A3\u00A3\u00A3"; + private final String dollarsText = "$$$$"; + private final byte[] bytesToCheck = {(byte) 0x5b, (byte) 0x5b, (byte) 0x5b, (byte) 0x5b}; + + @Before + public void setUp() throws Exception { + CharacterSetBuilder csb = CharacterSetBuilder.getSingleByteInstance(); + CharacterSet cs1146 = csb.build("C0H200B0", "T1V10500", "Cp1146", + Class.forName("org.apache.fop.fonts.base14.Helvetica").asSubclass(Typeface.class) + .newInstance(), null); + gcsCp1146 = new GraphicsCharacterString(poundsText, 0, 0, cs1146); + CharacterSet cs500 = csb.build("C0H200B0", "T1V10500", "Cp500", + Class.forName("org.apache.fop.fonts.base14.Helvetica").asSubclass(Typeface.class) + .newInstance(), null); + gcsCp500 = new GraphicsCharacterString(dollarsText, 0, 0, cs500); + } + + @Test + public void testWriteToStream() throws IOException { + // check pounds + ByteArrayOutputStream baos1146 = new ByteArrayOutputStream(); + gcsCp1146.writeToStream(baos1146); + byte[] bytes1146 = baos1146.toByteArray(); + for (int i = 0; i < bytesToCheck.length; i++) { + assertEquals(bytesToCheck[i], bytes1146[6 + i]); + } + assertEquals(bytesToCheck.length + 6, bytes1146.length); + // check dollars + ByteArrayOutputStream baos500 = new ByteArrayOutputStream(); + gcsCp500.writeToStream(baos500); + byte[] bytes500 = baos500.toByteArray(); + for (int i = 0; i < bytesToCheck.length; i++) { + assertEquals(bytesToCheck[i], bytes500[6 + i]); + } + assertEquals(bytesToCheck.length + 6, bytes500.length); + } +} diff --git a/src/test/java/org/apache/fop/afp/goca/GraphicsSetFractionalLineWidthTestCase.java b/src/test/java/org/apache/fop/afp/goca/GraphicsSetFractionalLineWidthTestCase.java new file mode 100644 index 000000000..f34275de0 --- /dev/null +++ b/src/test/java/org/apache/fop/afp/goca/GraphicsSetFractionalLineWidthTestCase.java @@ -0,0 +1,59 @@ +/* + * 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. + */ + +// $Id$ + +package org.apache.fop.afp.goca; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.Arrays; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +public class GraphicsSetFractionalLineWidthTestCase { + + private final float multiplier = 5.25f; + private final GraphicsSetFractionalLineWidth gsflw = new GraphicsSetFractionalLineWidth(multiplier); + + @Test + public void testGetDataLength() { + assertEquals(4, gsflw.getDataLength()); + } + + @Test + public void testWriteToStream() throws IOException { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + gsflw.writeToStream(baos); + baos.close(); + // note: 0.25 = 64/256 and 64 = 4*16, so 0x40 + // expected: 0x11 (order code), 0x02 (2 bytes next), 0x05 (integral multiplier), 0x40 (fractional + // multiplier) + byte[] expected = new byte[] {0x11, 0x02, 0x05, 0x40}; + assertTrue(Arrays.equals(expected, baos.toByteArray())); + } + + @Test + public void testToString() { + // lets make sure we keep good coverage... + assertEquals("GraphicsSetFractionalLineWidth{multiplier=" + multiplier + "}", gsflw.toString()); + } + +} diff --git a/src/test/java/org/apache/fop/afp/goca/GraphicsSetLineWidthTestCase.java b/src/test/java/org/apache/fop/afp/goca/GraphicsSetLineWidthTestCase.java new file mode 100644 index 000000000..c0a18a551 --- /dev/null +++ b/src/test/java/org/apache/fop/afp/goca/GraphicsSetLineWidthTestCase.java @@ -0,0 +1,57 @@ +/* + * 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. + */ + +// $Id$ + +package org.apache.fop.afp.goca; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.Arrays; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +public class GraphicsSetLineWidthTestCase { + + private final int multiplier = 5; + private final GraphicsSetLineWidth gslw = new GraphicsSetLineWidth(multiplier); + + @Test + public void testGetDataLength() { + assertEquals(2, gslw.getDataLength()); + } + + @Test + public void testWriteToStream() throws IOException { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + gslw.writeToStream(baos); + baos.close(); + // expected: 0x19 (order code), 0x05 (integral multiplier) + byte[] expected = new byte[] {0x19, 0x05}; + assertTrue(Arrays.equals(expected, baos.toByteArray())); + } + + @Test + public void testToString() { + // lets make sure we keep good coverage... + assertEquals("GraphicsSetLineWidth{multiplier=" + multiplier + "}", gslw.toString()); + } + +} diff --git a/src/test/java/org/apache/fop/afp/modca/AbstractAFPObjectTest.java b/src/test/java/org/apache/fop/afp/modca/AbstractAFPObjectTest.java new file mode 100644 index 000000000..a4c80cc65 --- /dev/null +++ b/src/test/java/org/apache/fop/afp/modca/AbstractAFPObjectTest.java @@ -0,0 +1,252 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.afp.modca; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import org.apache.fop.afp.Streamable; + +/** + * Tests the {@link AbstractAFPObject} class. + */ +public abstract class AbstractAFPObjectTest<S extends AbstractAFPObject> { + + private S sut; + + protected final S getSut() { + return sut; + } + + protected final void setSut(S sut) { + if (this.sut == null) { + this.sut = sut; + } + } + + + private byte[] header = new byte[] { + 0x5A, // Structured field identifier + 0x00, // Length byte 1 + 0x10, // Length byte 2 + 0x00, // Structured field id byte 1 + 0x00, // Structured field id byte 2 + 0x00, // Structured field id byte 3 + 0x00, // Flags + 0x00, // Reserved + 0x00 // Reserved + }; + + @Test + public void testCopySFStatic() { + byte[] actual = new byte[9]; + Arrays.fill(actual, (byte)-1); + + S.copySF(actual, (byte)0, (byte)0, (byte)0); + + assertTrue(Arrays.equals(actual, header)); + + byte[] expected2 = new byte[9]; + System.arraycopy(header, 0, expected2, 0, header.length); + + final byte clazz = (byte) 0x01; + final byte type = (byte) 0x02; + final byte catagory = (byte) 0x03; + expected2[3] = clazz; + expected2[4] = type; + expected2[5] = catagory; + + AbstractAFPObject.copySF(actual, clazz, type, catagory); + + assertTrue(Arrays.equals(actual, expected2)); + } + + @Test + public void testCopySF() { + byte[] expected = new byte[9]; + S.copySF(expected, (byte) 0xD3, (byte)0, (byte)0); + + byte[] actual = new byte[9]; + Arrays.fill(actual, (byte)-1); + + getSut().copySF(actual, (byte)0, (byte)0); + + assertTrue(Arrays.equals(actual, expected)); + + byte[] expected2 = new byte[9]; + System.arraycopy(expected, 0, expected2, 0, expected.length); + + final byte type = (byte)1; + final byte catagory = (byte)2; + expected2[4] = type; + expected2[5] = catagory; + + getSut().copySF(actual, type, catagory); + + assertTrue(Arrays.equals(actual, expected2)); + } + + /** + * + */ + @Test + public void testwriteObjects() { + final byte[][] expected = {{(byte)0, (byte)1}, {(byte)2, (byte)3}, {(byte)4, (byte)5}}; + + List<Streamable> objects = new ArrayList<Streamable>() { + { + add(StreamableObject.instance(expected[0])); + add(StreamableObject.instance(expected[1])); + add(StreamableObject.instance(expected[2])); + } }; + + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + + try { + getSut().writeObjects(objects, baos); + } catch (IOException e) { + fail(); + } + + byte[] actual = baos.toByteArray(); + + int index = 0; + for (int i = 0; i < expected.length; i++) { + for (int j = 0; j < expected[i].length; j++) { + assertTrue("" + index, actual[index] == expected[i][j]); + index++; + } + } + } + + /** + * + */ + @Test + public void testTruncate() { + String expected = "abc"; + assertTrue(AbstractAFPObject.truncate(expected, 4) == expected); + assertTrue(AbstractAFPObject.truncate(expected, 3) == expected); + assertEquals(AbstractAFPObject.truncate(expected + "d", 3), expected); + assertEquals(AbstractAFPObject.truncate(expected, 0), ""); + try { + assertTrue(AbstractAFPObject.truncate(null, 4) == null); + fail(); + } catch (NullPointerException e) { + // PASS + } + } + + /** + * + */ + @Test + public void testWriteChunksToStream() throws IOException { + final byte[] data = new byte[256]; + int counter = 0; + for (int i = 0; i < data.length; i++) { + data[i] = (byte) counter++; + } + + byte[] header = new byte[9]; + // Test when chunk size % data.length == 0 + testWithGivenChunkSize(data, header, 16); + + // test when chunk size % data.length != 0 + testWithGivenChunkSize(data, header, 10); + + // test with an odd number... + testWithGivenChunkSize(data, header, 13); + } + + private void testWithGivenChunkSize(byte[] data, byte[] header, int chunkSize) + throws IOException { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + S.writeChunksToStream(data, header, 0, chunkSize, baos); + byte[] testData = baos.toByteArray(); + + int numberOfFullDataChunks = data.length / chunkSize; + int lastChunkSize = data.length % chunkSize; + int lengthOfTestData = numberOfFullDataChunks * (chunkSize + header.length); + lengthOfTestData += lastChunkSize == 0 ? 0 : header.length + lastChunkSize; + + putLengthInHeader(header, chunkSize); + + assertEquals(lengthOfTestData, testData.length); + int testIndex = 0; + int expectedIndex = 0; + for (int i = 0; i < numberOfFullDataChunks; i++) { + checkHeaderAndData(header, data, testData, expectedIndex, testIndex, chunkSize); + expectedIndex += chunkSize + header.length; + testIndex += chunkSize; + } + + putLengthInHeader(header, lastChunkSize); + // check last chunk + if (lastChunkSize != 0) { + checkHeaderAndData(header, data, testData, expectedIndex, testIndex, lastChunkSize); + } + } + + private void putLengthInHeader(byte[] header, int chunkSize) { + header[0] = 0; + header[1] = (byte) (chunkSize + header.length); + } + + private void checkHeaderAndData(byte[] header, byte[] data, byte[] testData, int expectedIndex, + int testIndex, int chunkSize) { + for (int i = 0; i < header.length; i++) { + assertEquals(testData[expectedIndex++], header[i]); + } + for (int i = 0; i < chunkSize; i++) { + assertEquals(testData[expectedIndex++], data[i + testIndex]); + } + } + + /** + * + */ + private static class StreamableObject implements Streamable { + private byte[] bytes; + + StreamableObject(byte[] bytes) { + this.bytes = new byte[bytes.length]; + System.arraycopy(bytes, 0, this.bytes, 0, bytes.length); + } + + private static Streamable instance(byte[] bytes) { + return new StreamableObject(bytes); + } + + public void writeToStream(OutputStream os) throws IOException { + os.write(bytes); + } + } +} diff --git a/src/test/java/org/apache/fop/afp/modca/AbstractNamedAFPObjectTest.java b/src/test/java/org/apache/fop/afp/modca/AbstractNamedAFPObjectTest.java new file mode 100644 index 000000000..0593ae637 --- /dev/null +++ b/src/test/java/org/apache/fop/afp/modca/AbstractNamedAFPObjectTest.java @@ -0,0 +1,64 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.afp.modca; + +import java.util.Arrays; + +import org.junit.Test; + +import static org.junit.Assert.assertTrue; + +/** + * Tests the {@linkplain AbstractAFPObject} class. + */ +public abstract class AbstractNamedAFPObjectTest<S extends AbstractNamedAFPObject> + extends AbstractAFPObjectTest<S> { + @Test + public void testCopySF() { + + final S sut = getSut(); + + byte[] expected = new byte[17]; + S.copySF(expected, (byte) 0xD3, (byte)0, (byte)0); + + byte[] nameData = sut.getNameBytes(); + System.arraycopy(nameData, 0, expected, 9, nameData.length); + + byte[] actual = new byte[17]; + Arrays.fill(actual, (byte)-1); + + getSut().copySF(actual, (byte)0, (byte)0); + + assertTrue(Arrays.equals(actual, expected)); + + byte[] expected2 = new byte[17]; + System.arraycopy(expected, 0, expected2, 0, expected.length); + System.arraycopy(nameData, 0, expected, 9, nameData.length); + + final byte type = (byte)1; + final byte catagory = (byte)2; + expected2[4] = type; + expected2[5] = catagory; + + getSut().copySF(actual, type, catagory); + + assertTrue(Arrays.equals(actual, expected2)); + } +} diff --git a/src/test/java/org/apache/fop/afp/modca/AbstractStructuredObjectTest.java b/src/test/java/org/apache/fop/afp/modca/AbstractStructuredObjectTest.java new file mode 100644 index 000000000..d0a543087 --- /dev/null +++ b/src/test/java/org/apache/fop/afp/modca/AbstractStructuredObjectTest.java @@ -0,0 +1,64 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.afp.modca; + +import java.io.IOException; + +public abstract class AbstractStructuredObjectTest<S extends AbstractStructuredObject> + extends AbstractAFPObjectTest<S> { + + /** + * Test writeStart() - test that the contract is maintained with + * {@link AbstractStructuredObject}. + * + * @throws IOException + */ + public void testwriteStart() throws IOException { + } + + /** + * Test writeEnd() - test that the contract is maintained with {@link AbstractStructuredObject}. + * + * @throws IOException + */ + public void testWriteEnd() throws IOException { + } + + /** + * Test writeContent() - test that the contract is maintained with + * {@link AbstractStructuredObject}. + * + * @throws IOException + */ + public void testWriteContent() throws IOException { + } + + /** + * Test writeToStream() - test that the contract is maintained with + * {@link AbstractStructuredObject}. + * + * @throws IOException + */ + public void testWriteToStream() throws IOException { + testwriteStart(); + testWriteEnd(); + testWriteContent(); + } +} diff --git a/src/test/java/org/apache/fop/afp/modca/AbstractTripletStructuredObjectTest.java b/src/test/java/org/apache/fop/afp/modca/AbstractTripletStructuredObjectTest.java new file mode 100644 index 000000000..fe25996bb --- /dev/null +++ b/src/test/java/org/apache/fop/afp/modca/AbstractTripletStructuredObjectTest.java @@ -0,0 +1,160 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.afp.modca; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.apache.fop.afp.modca.triplets.AbstractTriplet; +import org.apache.fop.afp.modca.triplets.AttributeQualifierTriplet; +import org.apache.fop.afp.modca.triplets.CommentTriplet; +import org.apache.fop.afp.modca.triplets.ObjectAreaSizeTriplet; +import org.apache.fop.afp.modca.triplets.Triplet; + +/** + * Test {@link AbstractTripletStructuredObject} + */ +public class AbstractTripletStructuredObjectTest<S extends AbstractTripletStructuredObject> + extends AbstractStructuredObjectTest<AbstractTripletStructuredObject> { + + private static final List<AbstractTriplet> TRIPLETS; + + static { + List<AbstractTriplet> triplets = new ArrayList<AbstractTriplet>(); + + triplets.add(new CommentTriplet((byte) 0x01, "test comment")); + + triplets.add(new AttributeQualifierTriplet(1, 1)); + + triplets.add(new ObjectAreaSizeTriplet(10, 20)); + + TRIPLETS = Collections.unmodifiableList(triplets); + } + + private AbstractTripletStructuredObject emptyStructuredObject + = new AbstractTripletStructuredObject() { }; + + @Before + public void setUp() throws Exception { + AbstractTripletStructuredObject sut = getSut(); + + for (AbstractTriplet triplet : TRIPLETS) { + sut.addTriplet(triplet); + } + } + + + /** + * Test getTripletLength() - ensure a sum of all enclosing object lengths is returned. + */ + public void testGetTripletLength() { + + int dataLength = 0; + for (Triplet t : TRIPLETS) { + dataLength += t.getDataLength(); + } + assertEquals(dataLength, getSut().getTripletDataLength()); + assertEquals(0, emptyStructuredObject.getTripletDataLength()); + } + + /** + * Test hasTriplets() + */ + public void testHasTriplets() { + assertTrue(getSut().hasTriplets()); + assertFalse(emptyStructuredObject.hasTriplets()); + } + + /** + * Test writeTriplets() - Ensure the triplets are written properly. + * + * @throws IOException - + */ + public void testWriteObjects() throws IOException { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + for (AbstractTriplet triplet : TRIPLETS) { + triplet.writeToStream(baos); + } + byte[] expected = baos.toByteArray(); + baos.reset(); + getSut().writeTriplets(baos); + assertTrue(Arrays.equals(expected, baos.toByteArray())); + + baos.reset(); + // Ensure it doesn't die if no data has been added + emptyStructuredObject.writeTriplets(baos); + byte[] emptyArray = baos.toByteArray(); + assertTrue(Arrays.equals(emptyArray, new byte[0])); + } + + /** + * Test hasTriplet() - ensure both positive and negative values are returned. + */ + public void testHasTriplet() { + for (AbstractTriplet triplet : TRIPLETS) { + assertTrue(getSut().hasTriplet(triplet.getId())); + assertFalse(emptyStructuredObject.hasTriplet(triplet.getId())); + } + CommentTriplet notInSystem = new CommentTriplet((byte) 0x30, "This should return false"); + assertFalse(getSut().hasTriplet(notInSystem.getId())); + } + + /** + * Test addTriplet() - mostly tested above, but check boundary cases + */ + public void testAddTriplet() { + // ensure null doesn't kill it... not sure what else to test + getSut().addTriplet(null); + } + + /** + * Test addTriplets() - ensure all triplets are added. + */ + @Test + public void testAddTriplets() { + // Tested on empty object + List<AbstractTriplet> expectedList = TRIPLETS; + emptyStructuredObject.addTriplets(expectedList); + // checks equals() on each member of both lists + assertEquals(expectedList, emptyStructuredObject.getTriplets()); + + // Add a list to an already populated list + getSut().addTriplets(expectedList); + + List<AbstractTriplet> newExpected = new ArrayList<AbstractTriplet>(expectedList); + newExpected.addAll(expectedList); + assertEquals(newExpected, getSut().getTriplets()); + + // Ensure null doesn't throw exception + emptyStructuredObject.addTriplets(null); + } + +} diff --git a/src/test/java/org/apache/fop/afp/modca/IncludeObjectTestCase.java b/src/test/java/org/apache/fop/afp/modca/IncludeObjectTestCase.java new file mode 100644 index 000000000..7e096f98b --- /dev/null +++ b/src/test/java/org/apache/fop/afp/modca/IncludeObjectTestCase.java @@ -0,0 +1,135 @@ +/* + * 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. + */ + +/* $Id:$ */ + +package org.apache.fop.afp.modca; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.Arrays; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertTrue; + +import org.apache.fop.afp.util.BinaryUtils; + +/** + * Test {@link IncludeObject} + */ +public class IncludeObjectTestCase extends AbstractNamedAFPObjectTest<IncludeObject> { + + @Before + public void setUp() throws Exception { + setSut(new IncludeObject("8__chars")); + } + + /** + * Test writeToStream() + * @throws IOException - + */ + @Test + public void testWriteToStream() throws IOException { + final IncludeObject sut = getSut(); + + byte[] expected = defaultIncludeObjectBytes(sut.getTripletDataLength(), sut.getNameBytes()); + + testWriteToStreamHelper(sut, expected); + } + + /** + * Test writeToStream() - the orientation of the referenced object is a right- + * handed with a 180 x-axis + * @throws IOException - + */ + @Test + public void testWriteToStreamForOrientation() throws IOException { + final IncludeObject sut = getSut(); + + byte[] expected = defaultIncludeObjectBytes(sut.getTripletDataLength(), sut.getNameBytes()); + + expected[25] = (byte)0x5A; + expected[26] = (byte)0x00; + expected[27] = (byte)0x87; + expected[28] = (byte)0x00; + + sut.setObjectAreaOrientation(180); + + testWriteToStreamHelper(sut, expected); + } + + private void testWriteToStreamHelper(IncludeObject sut, byte[] expected) throws IOException { + + final ByteArrayOutputStream baos = new ByteArrayOutputStream(); + + sut.writeToStream(baos); + + byte[] actual = baos.toByteArray(); + + assertTrue(Arrays.equals(actual, expected)); + } + + private byte[] defaultIncludeObjectBytes(int tripletDataLength, byte[] nameData) { + + byte[] expected = new byte[36]; + + byte[] header = new byte[] { + 0x5A, // Structured field identifier + 0x00, // Length byte 1 + 0x10, // Length byte 2 + (byte)0xD3, // Structured field id byte 1 + (byte)0xAF, // Structured field id byte 2 - type 'input' + (byte)0xC3, // Structured field id byte 3 - category 'data resource' + 0x00, // Flags + 0x00, // Reserved + 0x00, // Reserved + }; + + System.arraycopy(header, 0, expected, 0, header.length); + + byte[] lengthBytes = BinaryUtils.convert(35 + tripletDataLength, 2); //Ignore first byte + expected[1] = lengthBytes[0]; + expected[2] = lengthBytes[1]; + + System.arraycopy(nameData, 0, expected, 9, nameData.length); + + expected[18] = (byte)0x92; // object type 'other' + + expected[27] = (byte)0x2D; // orientation of the reference object + writeOsetTo(expected, 29, -1); // the X-axis origin defined in the object + writeOsetTo(expected, 32, -1); // the Y-axis origin defined in the object + + expected[35] = 0x01; // Page or overlay coordinate system + + return expected; + } + + private static void writeOsetTo(byte[] out, int offset, int oset) { + if (oset > -1) { + byte[] y = BinaryUtils.convert(oset, 3); + out[offset] = y[0]; + out[offset + 1] = y[1]; + out[offset + 2] = y[2]; + } else { + out[offset] = (byte)0xFF; + out[offset + 1] = (byte)0xFF; + out[offset + 2] = (byte)0xFF; + } + } +} diff --git a/src/test/java/org/apache/fop/afp/parser/MODCAParserTestCase.java b/src/test/java/org/apache/fop/afp/parser/MODCAParserTestCase.java new file mode 100644 index 000000000..176344618 --- /dev/null +++ b/src/test/java/org/apache/fop/afp/parser/MODCAParserTestCase.java @@ -0,0 +1,245 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.afp.parser; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.EOFException; +import java.io.InputStream; +import java.util.Arrays; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +/** + * MODCAParser and MODCAParser.UnparsedStructuredField Unit tests + */ +public class MODCAParserTestCase { + + /** The carriage control character (0x5A) used to indicate the start of a structured field. */ + public static final byte CARRIAGE_CONTROL_CHAR = (byte)0x5A; + /**ASCII carriage return control character*/ + public static final byte CARRIAGE_RETURN = (byte)0x0A; + /**ASCII line feed control character */ + public static final byte LINE_FEED = (byte)0x0D; + /** 8 byte introducer describe the SF */ + private static final int INTRODUCER_LENGTH = 8; + + /** + * Test that the MODCA parser recognises carriage control (0x5A) as the Structured Field + * delimeter + * + * @throws Exception * + */ + @Test + public void testReadNextStructuredField1() throws Exception { + + // carriage control (0x5A) delimits structured fields, + // and control is handed to readStructuredField(DataInputStream) + byte[][] goodInputStream = new byte[][]{ + new byte[]{CARRIAGE_CONTROL_CHAR} + }; + + for (byte[] b : goodInputStream) { + try { + new MODCAParser(new ByteArrayInputStream(b)) + .readNextStructuredField(); + fail("BAD SF should throw EOF: " + byteArrayToString(b)); + } catch (EOFException eof) { + //passed + } + } + + // EOFException thrown when reading the input stream are caught and + // a null value is returned + byte[][] badInputStream = new byte[][]{ + new byte[]{}, + new byte[]{CARRIAGE_RETURN}, + new byte[]{LINE_FEED} + }; + + for (byte[] b : badInputStream) { + UnparsedStructuredField usf = new MODCAParser(new ByteArrayInputStream(b)) + .readNextStructuredField(); + assertNull(usf); + } + } + + + /** + * Test that the MODCA parser correctly constructs an UnparsedStructuredField + * from a well formed structured field + * + * @throws Exception * + */ + @Test + public void testReadNextStructuredField2() throws Exception { + + // no extension data + testSF((byte)0xd3, (byte)0xa8, (byte)0x89, //SFTypeID + (byte)0, //flags excluding the bits for + //extension present, segmented data and padding present + false, false, + new byte[]{0, 0}, + new byte[]{1}, null); + + // with extension data + testSF((byte)0xd3, (byte)0xa8, (byte)0x89, //SFTypeID + (byte)0, //flags excluding the bits for + //extension present, segmented data and padding present + false, false, + new byte[]{0, 0}, + new byte[]{1}, new byte[]{10}); + + // with ignored reserved bits + testSF((byte)0xd3, (byte)0xa8, (byte)0x89, //SFTypeID + (byte)0, //flags excluding the bits for + //extension present, segmented data and padding present + false, false, + new byte[]{1, 2}, + new byte[]{1}, null); + + // with padding present and segmented data + testSF((byte)0xd3, (byte)0xa8, (byte)0x89, //SFTypeID + (byte)(1 << 3), //flags excluding the bits for + //extension present, segmented data and padding present + true, true, + new byte[]{0, 0}, + new byte[]{1}, null); + + // with flags non zero + testSF((byte)0xd3, (byte)0xa8, (byte)0x89, //SFTypeID + (byte)(1 << 3), //flags excluding the bits for + //extension present, segmented data and padding present + false, false, + new byte[]{0, 0}, + new byte[]{1}, null); + } + + + private void testSF(byte classCode, byte typeCode, byte categoryCode, + byte flags, boolean segmentedData, boolean paddingPresent, byte[] reserved, + byte[] data, byte[] extData) throws Exception { + + byte extDataLength = 0; + boolean extensionPresent = (extData != null); + + if (extensionPresent) { + flags = (byte)(flags | 0x01); + extDataLength = (byte)(extData.length + 1); //length includes length byte + } + + if (segmentedData) { + flags = (byte)(flags | 0x04); + } + + if (paddingPresent) { + flags = (byte)(flags | 0x10); + } + + short length = (short)(INTRODUCER_LENGTH + data.length + extDataLength); + byte[] lengthBytes = new byte[]{(byte)(length >> 8), (byte)(length & 0xFF)}; + + byte[] sfBytes = new byte[length]; + + //introducer bytes + sfBytes[0] = lengthBytes[0]; + sfBytes[1] = lengthBytes[1]; + sfBytes[2] = classCode; + sfBytes[3] = typeCode; + sfBytes[4] = categoryCode; + sfBytes[5] = flags; + sfBytes[6] = reserved[0]; + sfBytes[7] = reserved[1]; + + if (extDataLength > 0) { + sfBytes[8] = (byte)(extData.length + 1); + System.arraycopy(extData, 0, sfBytes, 9, extData.length); + } + + System.arraycopy(data, 0, sfBytes, length - data.length, data.length); + + + byte[] delimiteredSF = new byte[length + 1]; + + delimiteredSF[0] = (byte)0x5A; + + System.arraycopy(sfBytes, 0, delimiteredSF, 1, length); + + InputStream bis = new ByteArrayInputStream(delimiteredSF); + + UnparsedStructuredField actual = new MODCAParser(bis) + .readNextStructuredField(); + + //check introducer + assertEquals(length, actual.getSfLength()); + assertEquals(classCode, actual.getSfClassCode()); + assertEquals(typeCode, actual.getSfTypeCode()); + assertEquals(categoryCode, actual.getSfCategoryCode()); + assertEquals(extensionPresent, actual.isSfiExtensionPresent()); + assertEquals(segmentedData, actual.isSfiSegmentedData()); + assertEquals(paddingPresent, actual.isSfiPaddingPresent()); + + byte[] introducerData = new byte[]{(byte)(length >> 8), (byte)(length & 0xFF), + classCode, typeCode, categoryCode, flags, reserved[0], reserved[1]}; + + assertTrue(Arrays.equals(introducerData, actual.getIntroducerData())); + + //check data + assertTrue(Arrays.equals(data, actual.getData())); + + //check extension data + if (extData != null) { + assertTrue(Arrays.equals(extData, actual.getExtData())); + } + assertEquals( + (extData == null) ? 0 : extData.length + 1, // 1 byte for length byte + actual.getExtLength()); + + assertTrue(Arrays.equals(data, actual.getData())); + + int expectedSfTypeID = ((classCode & 0xFF) << 16) + | ((typeCode & 0xFF) << 8) + | (categoryCode & 0xFF); + + assertEquals(expectedSfTypeID, actual.getSfTypeID()); + + assertTrue(Arrays.equals(sfBytes, actual.getCompleteFieldAsBytes())); + + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + actual.writeTo(baos); + assertTrue(Arrays.equals(sfBytes, baos.toByteArray())); + + } + + + private static String byteArrayToString(byte[] byteArray) { + StringBuilder sb = new StringBuilder(); + for (byte b : byteArray) { + sb.append(Integer.toHexString(b & 0xFF)).append(" "); + } + return sb.toString(); + } + +} diff --git a/src/test/java/org/apache/fop/afp/ptoca/TransparentDataControlSequenceTestCase.java b/src/test/java/org/apache/fop/afp/ptoca/TransparentDataControlSequenceTestCase.java new file mode 100644 index 000000000..8d6c79d05 --- /dev/null +++ b/src/test/java/org/apache/fop/afp/ptoca/TransparentDataControlSequenceTestCase.java @@ -0,0 +1,74 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.afp.ptoca; + +import java.io.IOException; +import java.io.OutputStream; + +import org.junit.Test; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import org.apache.fop.afp.fonts.CharactersetEncoder.EncodedChars; +import org.apache.fop.afp.ptoca.TransparentDataControlSequence.TransparentData; + +import static org.apache.fop.afp.ptoca.PtocaConstants.TRANSPARENT_DATA_MAX_SIZE; + +public class TransparentDataControlSequenceTestCase { + + private EncodedChars encodedChars; + private final OutputStream outStream = mock(OutputStream.class); + + @Test + public void testSingleByteCharacterSet() throws IOException { + testTRNs(false); + } + + @Test + public void testDoubleByteCharacterSets() throws IOException { + testTRNs(true); + } + + public void testTRNs(boolean isDBCS) throws IOException { + for (int length = 100; length < 10000; length += 1000) { + createTRNControlSequence(isDBCS, length); + int maxTRNSize = TRANSPARENT_DATA_MAX_SIZE - (isDBCS ? 1 : 0); + int numberOfTRNs = length / maxTRNSize; + for (int i = 0; i < numberOfTRNs; i++) { + verify(encodedChars, times(1)).writeTo(outStream, i * maxTRNSize, maxTRNSize); + } + int lastOffset = numberOfTRNs * maxTRNSize; + verify(encodedChars, times(1)).writeTo(outStream, numberOfTRNs * maxTRNSize, + length - lastOffset); + } + } + + private void createTRNControlSequence(boolean isDBCS, int length) throws IOException { + encodedChars = mock(EncodedChars.class); + when(encodedChars.isDBCS()).thenReturn(isDBCS); + when(encodedChars.getLength()).thenReturn(length); + for (TransparentData trn : new TransparentDataControlSequence(encodedChars)) { + trn.writeTo(outStream); + } + } +} diff --git a/src/test/java/org/apache/fop/afp/resource_any_name.afp b/src/test/java/org/apache/fop/afp/resource_any_name.afp Binary files differnew file mode 100644 index 000000000..a91cabfae --- /dev/null +++ b/src/test/java/org/apache/fop/afp/resource_any_name.afp diff --git a/src/test/java/org/apache/fop/afp/resource_name_match.afp b/src/test/java/org/apache/fop/afp/resource_name_match.afp Binary files differnew file mode 100644 index 000000000..53999574e --- /dev/null +++ b/src/test/java/org/apache/fop/afp/resource_name_match.afp diff --git a/src/test/java/org/apache/fop/afp/resource_name_mismatch.afp b/src/test/java/org/apache/fop/afp/resource_name_mismatch.afp Binary files differnew file mode 100644 index 000000000..d4f2c7f81 --- /dev/null +++ b/src/test/java/org/apache/fop/afp/resource_name_mismatch.afp diff --git a/src/test/java/org/apache/fop/afp/resource_no_end_name.afp b/src/test/java/org/apache/fop/afp/resource_no_end_name.afp Binary files differnew file mode 100644 index 000000000..517e4cb15 --- /dev/null +++ b/src/test/java/org/apache/fop/afp/resource_no_end_name.afp diff --git a/src/test/java/org/apache/fop/afp/simple.fo b/src/test/java/org/apache/fop/afp/simple.fo new file mode 100644 index 000000000..760ff4b63 --- /dev/null +++ b/src/test/java/org/apache/fop/afp/simple.fo @@ -0,0 +1,14 @@ +<?xml version="1.0" standalone="no"?> +<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> + <fo:layout-master-set> + <fo:simple-page-master master-name="page" + page-height="420pt" page-width="320pt" margin="10pt"> + <fo:region-body background-color="#F0F0F0"/> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="page"> + <fo:flow flow-name="xsl-region-body"> + <fo:block>This is a simple document.</fo:block> + </fo:flow> + </fo:page-sequence> +</fo:root> diff --git a/src/test/java/org/apache/fop/afp/util/AFPResourceAccessorTestCase.java b/src/test/java/org/apache/fop/afp/util/AFPResourceAccessorTestCase.java new file mode 100644 index 000000000..d729d336d --- /dev/null +++ b/src/test/java/org/apache/fop/afp/util/AFPResourceAccessorTestCase.java @@ -0,0 +1,84 @@ +/* + * 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.fop.afp.util; + +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; + +import org.apache.fop.apps.io.InternalResourceResolver; + +public class AFPResourceAccessorTestCase { + + private InternalResourceResolver nullBaseResourceResolver; + private InternalResourceResolver absoluteBaseResourceResolver; + private InternalResourceResolver relativeBaseResourceResolver; + private final URI absoluteBaseURI = URI.create("this:///purely.for.testing"); + private final URI relativeBaseURI = URI.create("./this.is.purely.for.testing"); + private AFPResourceAccessor nullBaseURISut; + private AFPResourceAccessor absoluteBaseURISut; + private AFPResourceAccessor relativeBaseURISut; + + @Before + public void setUp() { + nullBaseResourceResolver = mock(InternalResourceResolver.class); + absoluteBaseResourceResolver = mock(InternalResourceResolver.class); + relativeBaseResourceResolver = mock(InternalResourceResolver.class); + nullBaseURISut = new AFPResourceAccessor(nullBaseResourceResolver); + absoluteBaseURISut = new AFPResourceAccessor(absoluteBaseResourceResolver, + absoluteBaseURI.toASCIIString()); + relativeBaseURISut = new AFPResourceAccessor(relativeBaseResourceResolver, + relativeBaseURI.toASCIIString()); + } + + @Test + public void testCreateInputStream() throws IOException, URISyntaxException { + URI testURI = URI.create("test"); + nullBaseURISut.createInputStream(testURI); + verify(nullBaseResourceResolver).getResource(testURI); + + absoluteBaseURISut.createInputStream(testURI); + verify(absoluteBaseResourceResolver).getResource(getActualURI(absoluteBaseURI, testURI)); + + relativeBaseURISut.createInputStream(testURI); + verify(relativeBaseResourceResolver).getResource(getActualURI(relativeBaseURI, testURI)); + } + + private URI getActualURI(URI baseURI, URI testURI) throws URISyntaxException { + return InternalResourceResolver.getBaseURI(baseURI.toASCIIString()).resolve(testURI); + } + + @Test + public void testResolveURI() throws URISyntaxException { + String testURI = "anotherTestURI"; + assertEquals(URI.create("./" + testURI), nullBaseURISut.resolveURI(testURI)); + + assertEquals(getActualURI(absoluteBaseURI, URI.create(testURI)), + absoluteBaseURISut.resolveURI(testURI)); + + assertEquals(getActualURI(relativeBaseURI, URI.create(testURI)), + relativeBaseURISut.resolveURI(testURI)); + } +} diff --git a/src/test/java/org/apache/fop/apps/AFPRendererConfBuilder.java b/src/test/java/org/apache/fop/apps/AFPRendererConfBuilder.java new file mode 100644 index 000000000..f108e4d44 --- /dev/null +++ b/src/test/java/org/apache/fop/apps/AFPRendererConfBuilder.java @@ -0,0 +1,172 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.apps; + +import java.util.Map; + +import org.w3c.dom.Element; + +import org.apache.fop.apps.FopConfBuilder.RendererConfBuilder; +import org.apache.fop.render.afp.AFPRendererConfig; +import org.apache.fop.render.afp.AFPRendererOption; +import org.apache.fop.render.afp.AFPShadingMode; + +import static org.apache.fop.render.afp.AFPRendererConfig.ImagesModeOptions.MODE_GRAYSCALE; +import static org.apache.fop.render.afp.AFPRendererOption.DEFAULT_RESOURCE_LEVELS; +import static org.apache.fop.render.afp.AFPRendererOption.IMAGES; +import static org.apache.fop.render.afp.AFPRendererOption.IMAGES_DITHERING_QUALITY; +import static org.apache.fop.render.afp.AFPRendererOption.IMAGES_FS45; +import static org.apache.fop.render.afp.AFPRendererOption.IMAGES_JPEG; +import static org.apache.fop.render.afp.AFPRendererOption.IMAGES_MAPPING_OPTION; +import static org.apache.fop.render.afp.AFPRendererOption.IMAGES_MODE; +import static org.apache.fop.render.afp.AFPRendererOption.IMAGES_NATIVE; +import static org.apache.fop.render.afp.AFPRendererOption.IMAGES_WRAP_PSEG; +import static org.apache.fop.render.afp.AFPRendererOption.JPEG_ALLOW_JPEG_EMBEDDING; +import static org.apache.fop.render.afp.AFPRendererOption.JPEG_BITMAP_ENCODING_QUALITY; +import static org.apache.fop.render.afp.AFPRendererOption.LINE_WIDTH_CORRECTION; +import static org.apache.fop.render.afp.AFPRendererOption.RENDERER_RESOLUTION; +import static org.apache.fop.render.afp.AFPRendererOption.RESOURCE_GROUP_URI; +import static org.apache.fop.render.afp.AFPRendererOption.SHADING; + +/** + * A config builder specific to a particular renderer for specific MIME type. + */ +public final class AFPRendererConfBuilder extends RendererConfBuilder { + + private ImagesBuilder images; + + public AFPRendererConfBuilder() { + super(MimeConstants.MIME_AFP); + } + + private AFPRendererConfBuilder createTextElement(AFPRendererOption option, String value) { + createTextElement(option.getName(), value); + return this; + } + + public AFPRendererConfBuilder setShading(AFPShadingMode mode) { + return createTextElement(SHADING, mode.getName()); + } + + public AFPRendererConfBuilder setRenderingResolution(int res) { + return createTextElement(RENDERER_RESOLUTION, String.valueOf(res)); + } + + public AFPRendererConfBuilder setLineWidthCorrection(float value) { + return createTextElement(LINE_WIDTH_CORRECTION, String.valueOf(value)); + } + + public ImagesBuilder startImages(AFPRendererConfig.ImagesModeOptions mode) { + images = new ImagesBuilder(mode); + return images; + } + + public ImagesBuilder startImages() { + return startImages(MODE_GRAYSCALE); + } + + public AFPRendererConfBuilder endImages() { + images = null; + return this; + } + + public AFPRendererConfBuilder setResourceGroupUri(String uri) { + createTextElement(RESOURCE_GROUP_URI, uri); + return this; + } + + public AFPRendererConfBuilder setDefaultResourceLevels(Map<String, String> levels) { + Element e = createElement(DEFAULT_RESOURCE_LEVELS.getName()); + for (String key : levels.keySet()) { + e.setAttribute(key, levels.get(key)); + } + return this; + } + + public final class ImagesBuilder { + + private final Element el; + + private Element jpeg; + + private ImagesBuilder(AFPRendererConfig.ImagesModeOptions mode) { + el = createElement(IMAGES.getName()); + setAttribute(IMAGES_MODE, mode.getName()); + } + + public ImagesBuilder setModeAttribute(String name, String value) { + return setAttribute(name, value); + } + + public ImagesBuilder setAllowJpegEmbedding(boolean value) { + getJpeg().setAttribute(JPEG_ALLOW_JPEG_EMBEDDING.getName(), String.valueOf(value)); + return this; + } + + public ImagesBuilder setBitmapEncodingQuality(float value) { + getJpeg().setAttribute(JPEG_BITMAP_ENCODING_QUALITY.getName(), String.valueOf(value)); + return this; + } + + public ImagesBuilder setDitheringQuality(String value) { + return setAttribute(IMAGES_DITHERING_QUALITY, value); + } + + public ImagesBuilder setDitheringQuality(float value) { + return setAttribute(IMAGES_DITHERING_QUALITY, value); + } + + public ImagesBuilder setFs45(boolean value) { + return setAttribute(IMAGES_FS45, value); + } + + public ImagesBuilder setMappingOption(String value) { + return setAttribute(IMAGES_MAPPING_OPTION, value); + } + + public ImagesBuilder setWrapPseg(boolean value) { + return setAttribute(IMAGES_WRAP_PSEG, value); + } + + public ImagesBuilder setNativeImageSupport(boolean value) { + return setAttribute(IMAGES_NATIVE, value); + } + + public AFPRendererConfBuilder endImages() { + return AFPRendererConfBuilder.this.endImages(); + } + + private ImagesBuilder setAttribute(AFPRendererOption options, Object value) { + return setAttribute(options.getName(), value); + } + + private ImagesBuilder setAttribute(String name, Object value) { + el.setAttribute(name, String.valueOf(value)); + return this; + } + + private Element getJpeg() { + if (jpeg == null) { + jpeg = createElement(IMAGES_JPEG.getName(), el); + } + return jpeg; + } + } +} diff --git a/src/test/java/org/apache/fop/apps/AbstractRendererConfigParserTester.java b/src/test/java/org/apache/fop/apps/AbstractRendererConfigParserTester.java new file mode 100644 index 000000000..e4c9ceb44 --- /dev/null +++ b/src/test/java/org/apache/fop/apps/AbstractRendererConfigParserTester.java @@ -0,0 +1,79 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.apps; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import org.apache.avalon.framework.configuration.Configuration; +import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder; + +import org.apache.fop.apps.FopConfBuilder.RendererConfBuilder; +import org.apache.fop.events.DefaultEventBroadcaster; +import org.apache.fop.fonts.FontManager; +import org.apache.fop.render.RendererConfig; +import org.apache.fop.render.RendererConfig.RendererConfigParser; + +public abstract class AbstractRendererConfigParserTester<B extends RendererConfBuilder, + C extends RendererConfig> { + + protected B builder; + + protected C conf; + + protected final RendererConfigParser configBuilder; + + private final Class<B> type; + + public AbstractRendererConfigParserTester(RendererConfigParser configBuilder, Class<B> type) { + this.configBuilder = configBuilder; + this.type = type; + } + + protected void parseConfig() throws Exception { + parseConfig(createRenderer()); + } + + protected void parseConfig(B rendererConfBuilder) throws Exception { + DefaultConfigurationBuilder cfgBuilder = new DefaultConfigurationBuilder(); + Configuration cfg = cfgBuilder.build(rendererConfBuilder.endRendererConfig().build()) + .getChild("renderers") + .getChild("renderer"); + FOUserAgent userAgent = mock(FOUserAgent.class); + when(userAgent.validateStrictly()).thenReturn(true); + FontManager fontManager = mock(FontManager.class); + when(userAgent.getFontManager()).thenReturn(fontManager); + when(userAgent.getEventBroadcaster()).thenReturn(new DefaultEventBroadcaster()); + conf = (C) configBuilder.build(userAgent, cfg); + } + + protected B createRenderer() { + return createRenderer(type); + } + + protected B createRenderer(Class<B> type) { + builder = new FopConfBuilder().setStrictValidation(true).startRendererConfig(type); + return builder; + } + + protected void dump() throws Exception { + builder.dump(); + } +} diff --git a/src/test/java/org/apache/fop/apps/AbstractRendererConfiguratorTest.java b/src/test/java/org/apache/fop/apps/AbstractRendererConfiguratorTest.java new file mode 100644 index 000000000..2487c0a63 --- /dev/null +++ b/src/test/java/org/apache/fop/apps/AbstractRendererConfiguratorTest.java @@ -0,0 +1,69 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.apps; + +import java.io.File; +import java.io.IOException; + +import org.xml.sax.SAXException; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import org.apache.avalon.framework.configuration.ConfigurationException; + +import org.apache.fop.apps.FopConfBuilder.RendererConfBuilder; +import org.apache.fop.render.PrintRendererConfigurator; +import org.apache.fop.render.intermediate.IFDocumentHandler; + +public abstract class AbstractRendererConfiguratorTest<T extends PrintRendererConfigurator, + B extends RendererConfBuilder> { + + protected final String mimeType; + protected FOUserAgent userAgent; + protected T sut; + protected IFDocumentHandler docHandler; + private final Class<B> builderClass; + + public abstract void setUpDocumentHandler(); + + public AbstractRendererConfiguratorTest(String mimeType, Class<B> builderClass, + Class<? extends IFDocumentHandler> docHandlerClass) { + this.mimeType = mimeType; + this.builderClass = builderClass; + this.docHandler = mock(docHandlerClass); + when(this.docHandler.getMimeType()).thenReturn(mimeType); + } + + protected B createBuilder() { + return builderClass.cast(new FopConfBuilder().startRendererConfig(builderClass)); + } + + protected abstract T createConfigurator(); + + protected void parseConfig(RendererConfBuilder builder) + throws ConfigurationException, SAXException, IOException { + userAgent = FopFactory.newInstance( + new File(".").toURI(), builder.endRendererConfig().build()).newFOUserAgent(); + setUpDocumentHandler(); + sut = createConfigurator(); + sut.configure(docHandler); + } +} diff --git a/src/test/java/org/apache/fop/apps/BitmapRendererConfBuilder.java b/src/test/java/org/apache/fop/apps/BitmapRendererConfBuilder.java new file mode 100644 index 000000000..9ea2a4e9e --- /dev/null +++ b/src/test/java/org/apache/fop/apps/BitmapRendererConfBuilder.java @@ -0,0 +1,68 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.apps; + +import org.apache.fop.apps.FopConfBuilder.RendererConfBuilder; + +import static org.apache.fop.render.bitmap.BitmapRendererOption.ANTI_ALIASING; +import static org.apache.fop.render.bitmap.BitmapRendererOption.BACKGROUND_COLOR; +import static org.apache.fop.render.bitmap.BitmapRendererOption.COLOR_MODE; +import static org.apache.fop.render.bitmap.BitmapRendererOption.JAVA2D_TRANSPARENT_PAGE_BACKGROUND; +import static org.apache.fop.render.bitmap.BitmapRendererOption.RENDERING_QUALITY_ELEMENT; + +public class BitmapRendererConfBuilder extends RendererConfBuilder { + + protected BitmapRendererConfBuilder(String mimeType) { + super(mimeType); + } + + protected BitmapRendererConfBuilder() { + super(getMimeType()); + } + + public BitmapRendererConfBuilder setPageBackgroundTransparency(boolean isTransparent) { + createTextElement(JAVA2D_TRANSPARENT_PAGE_BACKGROUND, String.valueOf(isTransparent)); + return this; + } + + public BitmapRendererConfBuilder setBackgroundColor(String color) { + createTextElement(BACKGROUND_COLOR, color); + return this; + } + + public BitmapRendererConfBuilder setAntiAliasing(boolean antiAlias) { + createTextElement(ANTI_ALIASING, String.valueOf(antiAlias)); + return this; + } + + public BitmapRendererConfBuilder setRenderingQuality(String quality) { + createTextElement(RENDERING_QUALITY_ELEMENT, quality); + return this; + } + + public BitmapRendererConfBuilder setColorMode(String colorMode) { + createTextElement(COLOR_MODE, colorMode); + return this; + } + + public static String getMimeType() { + return "Bitmap"; + } +} diff --git a/src/test/java/org/apache/fop/apps/EnvironmentalProfileFactoryTestCase.java b/src/test/java/org/apache/fop/apps/EnvironmentalProfileFactoryTestCase.java new file mode 100644 index 000000000..83bfd2076 --- /dev/null +++ b/src/test/java/org/apache/fop/apps/EnvironmentalProfileFactoryTestCase.java @@ -0,0 +1,39 @@ +/* + * 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.fop.apps; + +import java.net.URI; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.mock; + +import org.apache.xmlgraphics.io.ResourceResolver; + +public class EnvironmentalProfileFactoryTestCase { + + private final URI testURI = URI.create("this.is.purely.for.test.purposes"); + + @Test + public void testCreateDefault() { + ResourceResolver mockedResolver = mock(ResourceResolver.class); + EnvironmentProfile sut = EnvironmentalProfileFactory.createDefault(testURI, mockedResolver); + assertEquals(mockedResolver, sut.getResourceResolver()); + } +} diff --git a/src/test/java/org/apache/fop/apps/FontConfigurator.java b/src/test/java/org/apache/fop/apps/FontConfigurator.java new file mode 100644 index 000000000..e9b8b8ff1 --- /dev/null +++ b/src/test/java/org/apache/fop/apps/FontConfigurator.java @@ -0,0 +1,24 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.apps; + +public interface FontConfigurator<P> { + P endFontsConfig(); +} diff --git a/src/test/java/org/apache/fop/apps/FopConfBuilder.java b/src/test/java/org/apache/fop/apps/FopConfBuilder.java new file mode 100644 index 000000000..8dd882d8a --- /dev/null +++ b/src/test/java/org/apache/fop/apps/FopConfBuilder.java @@ -0,0 +1,546 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.apps; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.UnsupportedEncodingException; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Result; +import javax.xml.transform.Source; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +import org.apache.fop.render.RendererConfigOption; + +/** + * A builder class for creating fop.xconf XML DOMs for test purposes. You can set all the necessary + * fields inline and build the fop conf DOM into an {@link InputStream}. + * <pre> + * {@code + * new FopConfBuilder().setStrictValidation(true) + * .startRendererBuilder(RendererConfBuilder.class) + * .startFontsConfig() + * .startFont(null, null) + * .addTriplet("Gladiator", "normal", "normal") + * .endFont() + * .endFontConfig() + * .endRendererConfigBuilder().build() + * } + * </pre> + */ +public class FopConfBuilder implements FontConfigurator<FopConfBuilder> { + + private final Element root; + private final Document fopConfDOM; + private RendererConfBuilder currentRendererConfig; + private FontsConfBuilder<FopConfBuilder> currentFontsConfig; + + /** + * Constructs the FopConfBuilder and initializes the underlying DOM. + */ + public FopConfBuilder() { + try { + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + dbf.setNamespaceAware(true); + DocumentBuilder db = dbf.newDocumentBuilder(); + fopConfDOM = db.newDocument(); + root = fopConfDOM.createElement("fop"); + fopConfDOM.appendChild(root); + } catch (ParserConfigurationException e) { + throw new RuntimeException(e); + } + } + + private FopConfBuilder createElement(String elementName, String elementValue) { + Element el = fopConfDOM.createElement(elementName); + el.appendChild(fopConfDOM.createTextNode(elementValue)); + root.appendChild(el); + return this; + } + + /** + * Set the <font-base> tag within the fop.xconf. + * + * @param fontBase the font base value + * @return <b>this</b> + */ + public FopConfBuilder setFontBaseURI(String fontBase) { + return createElement("font-base", fontBase); + } + + /** + * Set the <base> tag within the fop.xconf. + * + * @param baseURI the base URI + * @return <b>this</b> + */ + public FopConfBuilder setBaseURI(String baseURI) { + return createElement("base", baseURI); + } + + /** + * Set the <strict-validation> tag within the fop.xconf. + * + * @param validateStrictly true to enforce strict FO validation + * @return <b>this</b> + */ + public FopConfBuilder setStrictConfiguration(boolean validateStrictly) { + return createElement("strict-configuration", String.valueOf(validateStrictly)); + } + + /** + * Set the <strict-validation> tag within the fop.xconf. + * + * @param validateStrictly true to enforce strict configuration validation + * @return <b>this</b> + */ + public FopConfBuilder setStrictValidation(boolean validateStrictly) { + return createElement("strict-validation", String.valueOf(validateStrictly)); + } + + /** + * Set the <accessibility> tag within the fop.xconf. + * + * @param setAccessibility true to enable accessibility features + * @return <b>this</b> + */ + public FopConfBuilder setAccessibility(boolean setAccessibility) { + return createElement("accessibility", String.valueOf(setAccessibility)); + } + + @Deprecated + public FopConfBuilder setHyphenationBaseURI(String uri) { + return createElement("hyphenation-base", uri); + } + + /** + * Set the <source-resolution> tag within the fop.xconf. + * + * @param srcRes the source resolution + * @return <b>this</b> + */ + public FopConfBuilder setSourceResolution(float srcRes) { + return createElement("source-resolution", String.valueOf(srcRes)); + } + + /** + * Set the <target-resolution> tag within the fop.xconf. + * + * @param targetRes the target resolution + * @return <b>this</b> + */ + public FopConfBuilder setTargetResolution(float targetRes) { + return createElement("target-resolution", String.valueOf(targetRes)); + } + + /** + * Set the <break-indent-inheritance> tag within the fop.xconf. + * + * @param value true to break indent inheritance + * @return <b>this</b> + */ + public FopConfBuilder setBreakIndentInheritance(boolean value) { + return createElement("break-indent-inheritance", String.valueOf(value)); + } + + /** + * Set the <prefer-renderer> tag within the fop.xconf. + * + * @param value true to prefer the renderer + * @return <b>this</b> + */ + public FopConfBuilder setPreferRenderer(boolean value) { + return createElement("prefer-renderer", String.valueOf(value)); + } + + /** + * Set the <default-page-settings> tag within the fop.xconf. + * + * @param height the height of the page + * @param width the width of the page + * @return <b>this</b> + */ + public FopConfBuilder setDefaultPageSettings(float height, float width) { + Element el = fopConfDOM.createElement("default-page-settings"); + el.setAttribute("height", String.valueOf(height)); + el.setAttribute("width", String.valueOf(width)); + root.appendChild(el); + return this; + } + + /** + * Sets whether the fonts cache is used or not. + * + * @param enableFontCaching true to enable font data caching. + * @return <b>this</b> + */ + public FopConfBuilder useCache(boolean enableFontCaching) { + return createElement("use-cache", String.valueOf(enableFontCaching)); + } + + /** + * Starts a renderer specific config builder. + * + * @param mimeType the MIME type of the builder + * @return the renderer config builder + */ + public <T extends RendererConfBuilder> T startRendererConfig(Class<T> rendererConfigClass) { + try { + currentRendererConfig = rendererConfigClass.newInstance(); + } catch (InstantiationException e) { + throw new RuntimeException(e); + } catch (IllegalAccessException e) { + throw new RuntimeException(e); + } + currentRendererConfig.init(this, fopConfDOM); + return rendererConfigClass.cast(currentRendererConfig); + } + + /** + * Ends a renderer specific config builder. + * + * @return <b>this</b> + */ + private FopConfBuilder endRendererConfig() { + Element renderersEl = fopConfDOM.createElement("renderers"); + renderersEl.appendChild(currentRendererConfig.rendererEl); + root.appendChild(renderersEl); + currentRendererConfig = null; + return this; + } + + /** + * Starts a fonts config builder, for configuring the fonts handling system within FOP i.e. + * the <fonts> element. + * + * @return the fop config builder + */ + public FontsConfBuilder<FopConfBuilder> startFontsConfig() { + currentFontsConfig = new FontsConfBuilder<FopConfBuilder>(this); + currentFontsConfig.setFopConfDOM(fopConfDOM); + return currentFontsConfig; + } + + /** + * Ends the fonts config builder. + * + * @return <b>this</b> + */ + public FopConfBuilder endFontsConfig() { + root.appendChild(currentFontsConfig.fontsEl); + currentFontsConfig = null; + return this; + } + + /** + * Converts the underlying DOM into an {@link InputStream} for building. + * + * @return an {@link InputStream} + */ + public InputStream build() { + try { + Source src = new DOMSource(fopConfDOM); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + Result res = new StreamResult(baos); + Transformer transformer = TransformerFactory.newInstance().newTransformer(); + transformer.transform(src, res); + return new ByteArrayInputStream(baos.toByteArray()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public void dump() { + dump(System.out); + } + + public void dump(OutputStream out) { + TransformerFactory tf = TransformerFactory.newInstance(); + Transformer transformer; + try { + transformer = tf.newTransformer(); + } catch (TransformerConfigurationException e1) { + throw new RuntimeException(e1); + } + transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no"); + transformer.setOutputProperty(OutputKeys.METHOD, "xml"); + transformer.setOutputProperty(OutputKeys.INDENT, "yes"); + transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); + transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4"); + try { + transformer.transform(new DOMSource(fopConfDOM), + new StreamResult(new OutputStreamWriter(out, "UTF-8"))); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(e); + } catch (TransformerException e) { + throw new RuntimeException(e); + } + } + + public abstract static class RendererConfBuilder implements FontConfigurator<RendererConfBuilder> { + + private Element rendererEl; + + private FopConfBuilder fopConfBuilder; + + private Document fopConfDOM; + + private final String mimeType; + + private FontsConfBuilder<RendererConfBuilder> fontsConfBuilder; + + protected RendererConfBuilder(String mimeType) { + this.mimeType = mimeType; + } + + private void init(FopConfBuilder fopConfBuilder, Document fopConfDOM) { + this.fopConfBuilder = fopConfBuilder; + this.fopConfDOM = fopConfDOM; + rendererEl = fopConfDOM.createElement("renderer"); + rendererEl.setAttribute("mime", mimeType); + } + + protected final Element createElement(String name) { + return createElement(name, rendererEl); + } + + protected final Element createElement(String name, Element parent) { + Element el = fopConfDOM.createElement(name); + parent.appendChild(el); + return el; + } + + protected final Element createTextElement(String name, String value) { + return createTextElement(name, value, rendererEl); + } + + protected final Element createTextElement(RendererConfigOption option, String value) { + return createTextElement(option.getName(), value, rendererEl); + } + + protected final Element createTextElement(String name, String value, Element parent) { + Element el = createElement(name, parent); + el.setTextContent(value); + return el; + } + + /** + * Starts a fonts config builder, for configuring the fonts handling system within FOP i.e. + * the <fonts> element. + * + * @return the fonts config builder + */ + public final FontsConfBuilder<RendererConfBuilder> startFontsConfig() { + fontsConfBuilder = new FontsConfBuilder<RendererConfBuilder>(this); + fontsConfBuilder.setFopConfDOM(fopConfBuilder.fopConfDOM); + return fontsConfBuilder; + } + + /** + * Ends the fonts config builder. + * + * @return <b>this</b> + */ + public final RendererConfBuilder endFontsConfig() { + rendererEl.appendChild(fontsConfBuilder.fontsEl); + fontsConfBuilder = null; + return this; + } + + /** + * Ends the renderer specific config. + * + * @return the parent + */ + public final FopConfBuilder endRendererConfig() { + return fopConfBuilder.endRendererConfig(); + } + + public void dump() { + fopConfBuilder.dump(); + } + + public void dump(OutputStream out) { + fopConfBuilder.dump(out); + } + } + + public static final class FontsConfBuilder<P extends FontConfigurator<P>> { + private Element fontsEl; + private final P parent; + private Document fopConfDOM; + private Element fontSubstitutions; + private FontTripletInfo<P> currentTripletInfo; + + private FontsConfBuilder(P parent) { + this.parent = parent; + } + + private void setFopConfDOM(Document fopConfDOM) { + this.fopConfDOM = fopConfDOM; + fontsEl = fopConfDOM.createElement("fonts"); + } + + /** + * Add <auto-detect> to find fonts. + * + * @return <b>this</b> + */ + public FontsConfBuilder<P> addAutoDetect() { + fontsEl.appendChild(fopConfDOM.createElement("auto-detect")); + return this; + } + + /** + * Add a <directory> for specifying a directory to check fonts in. + * + * @param directory the directory to find fonts within + * @param recursive true to recurse through sub-directories + * @return <b>this</b> + */ + public FontsConfBuilder<P> addDirectory(String directory, boolean recursive) { + Element dir = fopConfDOM.createElement("directory"); + dir.setAttribute("recursive", String.valueOf(recursive)); + dir.setTextContent(directory); + fontsEl.appendChild(dir); + return this; + } + + /** + * Create a font <substitution>. + * + * @param fromFamily from font family name + * @param fromStyle from font style + * @param fromWeight from font weight + * @param toFamily to font family name + * @param toStyle to font style + * @param toWeight to font weight + * @return <b>this</b> + */ + public P substituteFonts(String fromFamily, String fromStyle, + String fromWeight, String toFamily, String toStyle, String toWeight) { + if (fontSubstitutions == null) { + fontSubstitutions = fopConfDOM.createElement("substitutions"); + } + Element fontSubEl = fopConfDOM.createElement("substitution"); + fontSubEl.appendChild(createSubstitutionEl("from", fromFamily, fromStyle, fromWeight)); + fontSubEl.appendChild(createSubstitutionEl("to", toFamily, toStyle, toWeight)); + fontSubstitutions.appendChild(fontSubEl); + fontsEl.appendChild(fontSubstitutions); + return parent; + } + + private Element createSubstitutionEl(String elName, String family, String style, + String weight) { + Element element = fopConfDOM.createElement(elName); + addAttribute(element, "font-family", family); + addAttribute(element, "font-style", style); + addAttribute(element, "font-weight", weight); + return element; + } + + private void addAttribute(Element fontSub, String attName, String attValue) { + if (attName != null && attValue != null) { + fontSub.setAttribute(attName, attValue); + } + } + + /** + * Start a <font> configuration element. + * + * @param metricsURL the URL to the metrics resource + * @param embedURL the URL to the font resource + * @return <b>this</b> + */ + public FontTripletInfo<P> startFont(String metricsURL, String embedURL) { + currentTripletInfo = new FontTripletInfo<P>(this, metricsURL, embedURL); + return currentTripletInfo; + } + + private FontsConfBuilder<P> endFontTriplet(Element el) { + fontsEl.appendChild(el); + currentTripletInfo = null; + return this; + } + + /** + * Ends a font configuration element . + * + * @return the parent + */ + public P endFontConfig() { + return parent.endFontsConfig(); + } + + public final class FontTripletInfo<T> { + private final Element fontEl; + private final FontsConfBuilder<P> parent; + + private FontTripletInfo(FontsConfBuilder<P> parent, + String metricsURL, String embedURL) { + this.parent = parent; + fontEl = fopConfDOM.createElement("font"); + addAttribute(fontEl, "metrics-url", metricsURL); + addAttribute(fontEl, "embed-url", embedURL); + } + + /** + * Add triplet information to a font. + * + * @param name the font name + * @param style the font style + * @param weight the font weight + * @return <b>this</b> + */ + public FontTripletInfo<T> addTriplet(String name, String style, String weight) { + Element tripletEl = fopConfDOM.createElement("font-triplet"); + addAttribute(tripletEl, "name", name); + addAttribute(tripletEl, "style", style); + addAttribute(tripletEl, "weight", weight); + fontEl.appendChild(tripletEl); + return this; + } + + /** + * Ends the font configuration element. + * + * @return the parent + */ + public FontsConfBuilder<P> endFont() { + return parent.endFontTriplet(fontEl); + } + } + } +} diff --git a/src/test/java/org/apache/fop/apps/FopConfParserTestCase.java b/src/test/java/org/apache/fop/apps/FopConfParserTestCase.java new file mode 100644 index 000000000..dc794fdb8 --- /dev/null +++ b/src/test/java/org/apache/fop/apps/FopConfParserTestCase.java @@ -0,0 +1,168 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.apps; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.net.URI; + +import org.junit.Before; +import org.junit.Test; +import org.xml.sax.SAXException; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +/** + * Test case for {@link FopConfParser}. + */ +public class FopConfParserTestCase { + + private final URI baseURI = URI.create("test/config/fop_factory_tests/"); + private FopConfBuilder builder; + + @Before + public void setUp() { + builder = new FopConfBuilder(); + } + + public static FopFactory getFopFactory(InputStream fopConfStream, URI baseURI) { + FopConfParser confParser; + try { + confParser = new FopConfParser(fopConfStream, baseURI); + return confParser.getFopFactoryBuilder().build(); + } catch (SAXException e) { + throw new RuntimeException(e); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + private FopFactory buildFactory() { + FopConfParser confParser; + try { + confParser = new FopConfParser(builder.build(), baseURI); + return confParser.getFopFactoryBuilder().build(); + } catch (SAXException e) { + throw new RuntimeException(e); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + @Test + public void testDefaults() { + FopFactory config = buildFactory(); + FopFactoryBuilderTestCase.testDefaults(config, baseURI); + } + + @Test + public void testStrictFOValidation() { + builder.setStrictValidation(false); + assertFalse(buildFactory().validateStrictly()); + } + + @Test + public void testStrictUserValidation() { + builder.setStrictConfiguration(false); + assertFalse(buildFactory().validateUserConfigStrictly()); + } + + @Test + public void testAccessibility() { + builder.setAccessibility(false); + assertFalse(buildFactory().isAccessibilityEnabled()); + } + + @Test + public void testSourceResolution() { + float srcRes = 123.456f; + builder.setSourceResolution(srcRes); + assertEquals(srcRes, buildFactory().getSourceResolution(), 0.0001f); + } + + @Test + public void testTargetResolution() { + float targetRes = 123.456f; + builder.setTargetResolution(targetRes); + assertEquals(targetRes, buildFactory().getTargetResolution(), 0.0001f); + } + + @Test + public void testBreakIndentInheritance() { + builder.setBreakIndentInheritance(true); + assertTrue(buildFactory().isBreakIndentInheritanceOnReferenceAreaBoundary()); + } + + @Test + public void testDefaultPageSettings() { + float height = 12.345f; + float width = 67.89f; + builder.setDefaultPageSettings(height, width); + FopFactory factory = buildFactory(); + assertEquals("12.345", factory.getPageHeight()); + assertEquals("67.89", factory.getPageWidth()); + } + + @Test + public void testPreferRenderer() { + builder.setPreferRenderer(true); + assertTrue(buildFactory().getRendererFactory().isRendererPreferred()); + } + + @Test + public void testRelativeURINoBaseNoFont() throws Exception { + checkRelativeURIs("test/config/relative-uri/no-base_no-font.xconf", + "", ""); + } + + @Test + public void testRelativeURINoBaseFont() throws Exception { + checkRelativeURIs("test/config/relative-uri/no-base_font.xconf", + "", "test/config/relative-uri/fonts/"); + } + + @Test + public void testRelativeURIBaseNoFont() throws Exception { + checkRelativeURIs("test/config/relative-uri/base_no-font.xconf", + "test/config/relative-uri/relative/", "test/config/relative-uri/relative/"); + } + + @Test + public void testRelativeURIBaseFont() throws Exception { + checkRelativeURIs("test/config/relative-uri/base_font.xconf", + "test/config/relative-uri/relative/", "test/config/relative-uri/fonts/"); + } + + private void checkRelativeURIs(String conf, String expectedBase, String expectedFontBase) + throws SAXException, IOException { + File configFile = new File(conf); + URI currentDir = new File(".").getCanonicalFile().toURI(); + FopConfParser parser = new FopConfParser(configFile, currentDir); + FopFactoryBuilder fopFactoryBuilder = parser.getFopFactoryBuilder(); + assertEquals("base URI", currentDir.resolve(expectedBase), + fopFactoryBuilder.getBaseURI()); + assertEquals("font base", currentDir.resolve(expectedFontBase), + fopFactoryBuilder.getFontManager().getResourceResolver().getBaseURI()); + } + +} diff --git a/src/test/java/org/apache/fop/apps/FopFactoryBuilderTestCase.java b/src/test/java/org/apache/fop/apps/FopFactoryBuilderTestCase.java new file mode 100644 index 000000000..86b4e7c04 --- /dev/null +++ b/src/test/java/org/apache/fop/apps/FopFactoryBuilderTestCase.java @@ -0,0 +1,291 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.apps; + +import java.net.URI; +import java.net.URISyntaxException; +import java.util.ArrayList; +import java.util.List; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import org.apache.fop.apps.io.ResourceResolverFactory; +import org.apache.fop.area.AreaTreeHandler; +import org.apache.fop.area.Block; +import org.apache.fop.fo.FONode; +import org.apache.fop.fo.extensions.ExternalDocument; +import org.apache.fop.fo.pagination.Flow; +import org.apache.fop.fo.pagination.PageSequence; +import org.apache.fop.fo.pagination.SideRegion; +import org.apache.fop.fo.pagination.StaticContent; +import org.apache.fop.fo.pagination.Title; +import org.apache.fop.layoutmgr.ExternalDocumentLayoutManager; +import org.apache.fop.layoutmgr.FlowLayoutManager; +import org.apache.fop.layoutmgr.LayoutManager; +import org.apache.fop.layoutmgr.LayoutManagerMaker; +import org.apache.fop.layoutmgr.PageSequenceLayoutManager; +import org.apache.fop.layoutmgr.StaticContentLayoutManager; +import org.apache.fop.layoutmgr.inline.ContentLayoutManager; + +/** + * Test case for {@link FopFactoryBuilder}. + */ +public class FopFactoryBuilderTestCase { + + private FopFactoryBuilder defaultBuilder; + private static final String POST_SET_ERROR_MSG = "Should not be able to set any properties" + + " once the builder has built a FopFactory."; + + @Before + public void setUp() { + defaultBuilder = new FopFactoryBuilder(URI.create(".")); + } + + @Test(expected = IllegalArgumentException.class) + public void testNullParamsInConstructor() throws URISyntaxException { + new FopFactoryBuilder(null, ResourceResolverFactory.createDefaultResourceResolver()); + } + + @Test + public void testDefaultImplementation() { + testDefaults(defaultBuilder.build(), URI.create(".")); + } + + private FopFactory buildFopFactory() { + return defaultBuilder.build(); + } + + public static void testDefaults(FopFactory factory, URI baseURI) { + assertFalse(factory.isAccessibilityEnabled()); + assertNull(factory.getLayoutManagerMakerOverride()); + assertEquals(FopFactoryConfig.DEFAULT_STRICT_FO_VALIDATION, factory.validateStrictly()); + assertEquals(FopFactoryConfig.DEFAULT_STRICT_USERCONFIG_VALIDATION, + factory.validateUserConfigStrictly()); + assertEquals(FopFactoryConfig.DEFAULT_BREAK_INDENT_INHERITANCE, + factory.isBreakIndentInheritanceOnReferenceAreaBoundary()); + assertEquals(FopFactoryConfig.DEFAULT_SOURCE_RESOLUTION, factory.getSourceResolution(), + 0.001f); + assertEquals(FopFactoryConfig.DEFAULT_TARGET_RESOLUTION, factory.getTargetResolution(), + 0.001f); + assertEquals(FopFactoryConfig.DEFAULT_PAGE_HEIGHT, factory.getPageHeight()); + assertEquals(FopFactoryConfig.DEFAULT_PAGE_WIDTH, factory.getPageWidth()); + assertFalse(factory.getRendererFactory().isRendererPreferred()); + } + + @Test + public void testSetGetAccessibility() { + runSetterTest(new Runnable() { + public void run() { + defaultBuilder.setAccessibility(true); + assertTrue(buildFopFactory().isAccessibilityEnabled()); + } + }); + } + + @Test + public void testsetGetLMM() { + runSetterTest(new Runnable() { + public void run() { + LayoutManagerMaker testLmm = new LayoutManagerMaker() { + + public StaticContentLayoutManager makeStaticContentLayoutManager( + PageSequenceLayoutManager pslm, StaticContent sc, Block block) { + return null; + } + + public StaticContentLayoutManager makeStaticContentLayoutManager( + PageSequenceLayoutManager pslm, StaticContent sc, SideRegion reg) { + return null; + } + + public PageSequenceLayoutManager makePageSequenceLayoutManager(AreaTreeHandler ath, + PageSequence ps) { + return null; + } + + public void makeLayoutManagers(FONode node, List lms) { + } + + public LayoutManager makeLayoutManager(FONode node) { + return null; + } + + public FlowLayoutManager makeFlowLayoutManager(PageSequenceLayoutManager pslm, + Flow flow) { + return null; + } + + public ExternalDocumentLayoutManager makeExternalDocumentLayoutManager( + AreaTreeHandler ath, ExternalDocument ed) { + return null; + } + + public ContentLayoutManager makeContentLayoutManager(PageSequenceLayoutManager pslm, + Title title) { + return null; + } + }; + defaultBuilder.setLayoutManagerMakerOverride(testLmm); + assertEquals(testLmm, buildFopFactory().getLayoutManagerMakerOverride()); + } + }); + + } + + @Test + public void testSetGetBaseURI() { + runSetterTest(new Runnable() { + public void run() { + URI nonDefaultURI = URI.create("./test/"); + defaultBuilder.setBaseURI(nonDefaultURI); + assertEquals(nonDefaultURI, defaultBuilder.buildConfiguration().getBaseURI()); + } + }); + } + + @Test + public void testGetSetValidateFO() { + runSetterTest(new Runnable() { + public void run() { + defaultBuilder.setStrictFOValidation(false); + assertFalse(buildFopFactory().validateStrictly()); + } + }); + } + + @Test + public void testGetSetValidateUserConfig() { + runSetterTest(new Runnable() { + public void run() { + defaultBuilder.setStrictUserConfigValidation(false); + assertFalse(buildFopFactory().validateUserConfigStrictly()); + } + }); + } + + @Test + public void testGetSetBreakInheritance() { + runSetterTest(new Runnable() { + public void run() { + defaultBuilder.setBreakIndentInheritanceOnReferenceAreaBoundary(true); + assertTrue(buildFopFactory().isBreakIndentInheritanceOnReferenceAreaBoundary()); + } + }); + } + + @Test + public void testGetSetSourceRes() { + runSetterTest(new Runnable() { + public void run() { + float testRes = 10f; + defaultBuilder.setSourceResolution(testRes); + assertEquals(testRes, buildFopFactory().getSourceResolution(), 0.0001); + } + }); + } + + @Test + public void testGetSetTargetRes() { + runSetterTest(new Runnable() { + public void run() { + float testRes = 10f; + defaultBuilder.setTargetResolution(testRes); + assertEquals(testRes, buildFopFactory().getTargetResolution(), 0.0001f); + } + }); + } + + @Test + public void testGetSetPageHeight() { + runSetterTest(new Runnable() { + public void run() { + String testString = "Purely for testing"; + defaultBuilder.setPageHeight(testString); + assertEquals(testString, buildFopFactory().getPageHeight()); + } + }); + } + + @Test + public void testGetSetPageWidth() { + runSetterTest(new Runnable() { + public void run() { + String testString = "Purely for testing"; + defaultBuilder.setPageWidth(testString); + assertEquals(testString, buildFopFactory().getPageWidth()); + } + }); + } + + @Test + public void testGetSetIsNamespaceIgnored() { + runSetterTest(new Runnable() { + public void run() { + String testString = "Purely for testing"; + defaultBuilder.ignoreNamespace(testString); + assertTrue(buildFopFactory().isNamespaceIgnored(testString)); + } + }); + } + + @Test + public void testGetSetListNamespaceIgnored() { + runSetterTest(new Runnable() { + public void run() { + List<String> strings = new ArrayList<String>(); + strings.add("1"); + strings.add("2"); + strings.add("3"); + defaultBuilder.ignoreNamespaces(strings); + FopFactory factory = buildFopFactory(); + assertTrue(factory.isNamespaceIgnored("1")); + assertTrue(factory.isNamespaceIgnored("2")); + assertTrue(factory.isNamespaceIgnored("3")); + } + }); + } + + @Test + public void testGetSetPreferRenderer() { + runSetterTest(new Runnable() { + public void run() { + defaultBuilder.setPreferRenderer(true); + assertTrue(buildFopFactory().getRendererFactory().isRendererPreferred()); + } + }); + } + + private void runSetterTest(Runnable setterTest) { + setterTest.run(); + try { + setterTest.run(); + fail(POST_SET_ERROR_MSG); + } catch (IllegalStateException e) { + // Expected + } + } +} diff --git a/src/test/java/org/apache/fop/apps/FopFactoryTestCase.java b/src/test/java/org/apache/fop/apps/FopFactoryTestCase.java new file mode 100644 index 000000000..439ffa44e --- /dev/null +++ b/src/test/java/org/apache/fop/apps/FopFactoryTestCase.java @@ -0,0 +1,66 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.apps; + +import java.io.IOException; + +import org.junit.Test; +import org.xml.sax.SAXException; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import org.apache.fop.config.BaseConstructiveUserConfigTest; +import org.apache.fop.render.RendererConfig.RendererConfigParser; +import org.apache.fop.render.pdf.PDFRendererConfig; + +public class FopFactoryTestCase extends BaseConstructiveUserConfigTest { + + public FopFactoryTestCase() throws SAXException, IOException { + super(new FopConfBuilder().setStrictValidation(true) + .startRendererConfig(PDFRendererConfBuilder.class) + .startFontsConfig() + .startFont(null, "test/resources/fonts/ttf/glb12.ttf.xml") + .addTriplet("Gladiator", "normal", "normal") + .endFont() + .endFontConfig() + .endRendererConfig().build()); + } + + @Test + @Override + public void testUserConfig() throws Exception { + RendererConfigParser mock = mock(RendererConfigParser.class); + when(mock.getMimeType()).thenReturn(MimeConstants.MIME_PDF); + try { + convertFO(); + PDFRendererConfig config = (PDFRendererConfig) fopFactory.getRendererConfig(null, null, + mock); + convertFO(); + assertEquals(config, fopFactory.getRendererConfig(null, null, mock)); + } catch (Exception e) { + // this should *not* happen! + e.printStackTrace(); + fail(e.getMessage()); + } + } +} diff --git a/src/test/java/org/apache/fop/apps/Java2DRendererConfBuilder.java b/src/test/java/org/apache/fop/apps/Java2DRendererConfBuilder.java new file mode 100644 index 000000000..00568cfc5 --- /dev/null +++ b/src/test/java/org/apache/fop/apps/Java2DRendererConfBuilder.java @@ -0,0 +1,36 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.apps; + +import org.apache.fop.apps.FopConfBuilder.RendererConfBuilder; + +import static org.apache.fop.render.java2d.Java2DRendererOption.JAVA2D_TRANSPARENT_PAGE_BACKGROUND; + +public class Java2DRendererConfBuilder extends RendererConfBuilder { + + protected Java2DRendererConfBuilder() { + super("Java2D"); + } + + public Java2DRendererConfBuilder setPageBackgroundTransparency(boolean value) { + createTextElement(JAVA2D_TRANSPARENT_PAGE_BACKGROUND, String.valueOf(value)); + return this; + } +} diff --git a/src/test/java/org/apache/fop/apps/MutableConfig.java b/src/test/java/org/apache/fop/apps/MutableConfig.java new file mode 100644 index 000000000..3ff3c10fa --- /dev/null +++ b/src/test/java/org/apache/fop/apps/MutableConfig.java @@ -0,0 +1,138 @@ +/* + * 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.fop.apps; + +import java.net.URI; +import java.util.Map; +import java.util.Set; + +import org.apache.avalon.framework.configuration.Configuration; + +import org.apache.xmlgraphics.image.loader.ImageManager; +import org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext.FallbackResolver; +import org.apache.xmlgraphics.io.ResourceResolver; + +import org.apache.fop.fonts.FontManager; +import org.apache.fop.layoutmgr.LayoutManagerMaker; + +/** + * This is a mutable implementation of the {@link FopFactoryConfig} to be used for testing purposes. + * This is also an example of how to make the seemingly immutable {@link FopFactory} mutable should + * a client need to, though this is ill-advised. + */ +public final class MutableConfig implements FopFactoryConfig { + + private final FopFactoryConfig delegate; + + private boolean setBreakInheritance; + private float sourceResolution; + + public MutableConfig(FopFactoryBuilder factoryBuilder) { + delegate = factoryBuilder.buildConfiguration(); + setBreakInheritance = delegate.isBreakIndentInheritanceOnReferenceAreaBoundary(); + sourceResolution = delegate.getSourceResolution(); + } + + public boolean isAccessibilityEnabled() { + return delegate.isAccessibilityEnabled(); + } + + public LayoutManagerMaker getLayoutManagerMakerOverride() { + return delegate.getLayoutManagerMakerOverride(); + } + + public ResourceResolver getResourceResolver() { + return delegate.getResourceResolver(); + } + + public URI getBaseURI() { + return delegate.getBaseURI(); + } + + public boolean validateStrictly() { + return delegate.validateStrictly(); + } + + public boolean validateUserConfigStrictly() { + return delegate.validateUserConfigStrictly(); + } + + public boolean isBreakIndentInheritanceOnReferenceAreaBoundary() { + return setBreakInheritance; + } + + public void setBreakIndentInheritanceOnReferenceAreaBoundary(boolean value) { + setBreakInheritance = value; + } + + public float getSourceResolution() { + return sourceResolution; + } + + public void setSourceResolution(float srcRes) { + sourceResolution = srcRes; + } + + public float getTargetResolution() { + return delegate.getTargetResolution(); + } + + public String getPageHeight() { + return delegate.getPageHeight(); + } + + public String getPageWidth() { + return delegate.getPageWidth(); + } + + public Set<String> getIgnoredNamespaces() { + return delegate.getIgnoredNamespaces(); + } + + public boolean isNamespaceIgnored(String namespace) { + return delegate.isNamespaceIgnored(namespace); + } + + public Configuration getUserConfig() { + return delegate.getUserConfig(); + } + + public boolean preferRenderer() { + return delegate.preferRenderer(); + } + + public FontManager getFontManager() { + return delegate.getFontManager(); + } + + public ImageManager getImageManager() { + return delegate.getImageManager(); + } + + public boolean isComplexScriptFeaturesEnabled() { + return delegate.isComplexScriptFeaturesEnabled(); + } + + public Map<String, String> getHyphenationPatternNames() { + return delegate.getHyphenationPatternNames(); + } + + public FallbackResolver getFallbackResolver() { + return delegate.getFallbackResolver(); + } +} diff --git a/src/test/java/org/apache/fop/apps/PDFRendererConfBuilder.java b/src/test/java/org/apache/fop/apps/PDFRendererConfBuilder.java new file mode 100644 index 000000000..3da4e1daf --- /dev/null +++ b/src/test/java/org/apache/fop/apps/PDFRendererConfBuilder.java @@ -0,0 +1,132 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.apps; + +import org.w3c.dom.Element; + +import org.apache.fop.apps.FopConfBuilder.RendererConfBuilder; +import org.apache.fop.render.RendererConfigOption; +import org.apache.fop.render.pdf.PDFEncryptionOption; + +import static org.apache.fop.render.pdf.PDFEncryptionOption.ENCRYPTION_LENGTH; +import static org.apache.fop.render.pdf.PDFEncryptionOption.ENCRYPTION_PARAMS; +import static org.apache.fop.render.pdf.PDFEncryptionOption.OWNER_PASSWORD; +import static org.apache.fop.render.pdf.PDFEncryptionOption.USER_PASSWORD; +import static org.apache.fop.render.pdf.PDFRendererOption.DISABLE_SRGB_COLORSPACE; +import static org.apache.fop.render.pdf.PDFRendererOption.FILTER_LIST; +import static org.apache.fop.render.pdf.PDFRendererOption.OUTPUT_PROFILE; +import static org.apache.fop.render.pdf.PDFRendererOption.PDF_A_MODE; +import static org.apache.fop.render.pdf.PDFRendererOption.PDF_X_MODE; +import static org.apache.fop.render.pdf.PDFRendererOption.VERSION; + +/** + * A config builder specific to a particular renderer for specific MIME type. + */ +public final class PDFRendererConfBuilder extends RendererConfBuilder { + + private EncryptionParamsBuilder accessConf; + + public PDFRendererConfBuilder() { + super(MimeConstants.MIME_PDF); + } + + public EncryptionParamsBuilder startEncryptionParams() { + accessConf = new EncryptionParamsBuilder(); + return accessConf; + } + + public PDFRendererConfBuilder endEncryptionParams() { + accessConf = null; + return this; + } + + public PDFRendererConfBuilder createFilterList(String type, String... filters) { + Element filterListEl = createElement(FILTER_LIST.getName()); + if (type != null) { + filterListEl.setAttribute("type", type); + } + for (String filter : filters) { + createTextElement("value", filter, filterListEl); + } + return this; + } + + public PDFRendererConfBuilder setPDFAMode(String value) { + createTextElement(PDF_A_MODE, value); + return this; + } + + public PDFRendererConfBuilder setPDFXMode(String value) { + createTextElement(PDF_X_MODE, value); + return this; + } + + public PDFRendererConfBuilder setPDFVersion(String version) { + createTextElement(VERSION, version); + return this; + } + + public PDFRendererConfBuilder setOutputProfile(String profile) { + createTextElement(OUTPUT_PROFILE, profile); + return this; + } + + public PDFRendererConfBuilder disableSRGBColorSpace(boolean disable) { + createTextElement(DISABLE_SRGB_COLORSPACE, String.valueOf(disable)); + return this; + } + + public final class EncryptionParamsBuilder { + private final Element el; + + private EncryptionParamsBuilder() { + el = createElement(ENCRYPTION_PARAMS); + } + + public EncryptionParamsBuilder setEncryptionLength(int length) { + createTextElement(ENCRYPTION_LENGTH, String.valueOf(length)); + return this; + } + + public EncryptionParamsBuilder setUserPassword(String password) { + createTextElement(USER_PASSWORD, password); + return this; + } + + public EncryptionParamsBuilder setOwnerPassword(String password) { + createTextElement(OWNER_PASSWORD, password); + return this; + } + + public EncryptionParamsBuilder setAllowParam(PDFEncryptionOption option) { + el.appendChild(createElement(option.getName())); + return this; + } + + public PDFRendererConfBuilder endEncryptionParams() { + return PDFRendererConfBuilder.this.endEncryptionParams(); + } + + private void createTextElement(RendererConfigOption name, String value) { + PDFRendererConfBuilder.this.createTextElement(name.getName(), value, el); + } + + } +} diff --git a/src/test/java/org/apache/fop/apps/PSRendererConfBuilder.java b/src/test/java/org/apache/fop/apps/PSRendererConfBuilder.java new file mode 100644 index 000000000..92d2ce45e --- /dev/null +++ b/src/test/java/org/apache/fop/apps/PSRendererConfBuilder.java @@ -0,0 +1,63 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.apps; + +import org.apache.fop.apps.FopConfBuilder.RendererConfBuilder; + +import static org.apache.fop.render.ps.PSRendererOption.AUTO_ROTATE_LANDSCAPE; +import static org.apache.fop.render.ps.PSRendererOption.DSC_COMPLIANT; +import static org.apache.fop.render.ps.PSRendererOption.LANGUAGE_LEVEL; +import static org.apache.fop.render.ps.PSRendererOption.OPTIMIZE_RESOURCES; +import static org.apache.fop.render.ps.PSRendererOption.SAFE_SET_PAGE_DEVICE; + +/** + * A fop conf builder specific to a particular renderer for Postscript. + */ +public final class PSRendererConfBuilder extends RendererConfBuilder { + + public PSRendererConfBuilder() { + super(MimeConstants.MIME_POSTSCRIPT); + } + + public PSRendererConfBuilder setAutoRotateLandscape(boolean value) { + createTextElement(AUTO_ROTATE_LANDSCAPE, String.valueOf(value)); + return this; + } + + public PSRendererConfBuilder setSafeSetPageDevice(boolean value) { + createTextElement(SAFE_SET_PAGE_DEVICE, String.valueOf(value)); + return this; + } + + public PSRendererConfBuilder setDscCompliant(boolean value) { + createTextElement(DSC_COMPLIANT, String.valueOf(value)); + return this; + } + + public PSRendererConfBuilder setLanguageLevel(int value) { + createTextElement(LANGUAGE_LEVEL, String.valueOf(value)); + return this; + } + + public PSRendererConfBuilder setOptimizeResources(boolean value) { + createTextElement(OPTIMIZE_RESOURCES, String.valueOf(value)); + return this; + } +} diff --git a/src/test/java/org/apache/fop/apps/TIFFRendererConfBuilder.java b/src/test/java/org/apache/fop/apps/TIFFRendererConfBuilder.java new file mode 100644 index 000000000..e2262017f --- /dev/null +++ b/src/test/java/org/apache/fop/apps/TIFFRendererConfBuilder.java @@ -0,0 +1,45 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.apps; + +import static org.apache.fop.render.bitmap.TIFFRendererConfig.TIFFRendererOption.COMPRESSION; +import static org.apache.fop.render.bitmap.TIFFRendererConfig.TIFFRendererOption.ENDIANNESS; +import static org.apache.fop.render.bitmap.TIFFRendererConfig.TIFFRendererOption.SINGLE_STRIP; +public class TIFFRendererConfBuilder extends BitmapRendererConfBuilder { + + public TIFFRendererConfBuilder() { + super(MimeConstants.MIME_TIFF); + } + + public TIFFRendererConfBuilder setCompressionMode(String mode) { + createTextElement(COMPRESSION, mode); + return this; + } + + public TIFFRendererConfBuilder setSingleStrip(boolean single) { + createTextElement(SINGLE_STRIP, String.valueOf(single)); + return this; + } + + public TIFFRendererConfBuilder setEndianness(String endianness) { + createTextElement(ENDIANNESS, endianness); + return this; + } +} diff --git a/src/test/java/org/apache/fop/apps/TxtRendererConfBuilder.java b/src/test/java/org/apache/fop/apps/TxtRendererConfBuilder.java new file mode 100644 index 000000000..816b59b11 --- /dev/null +++ b/src/test/java/org/apache/fop/apps/TxtRendererConfBuilder.java @@ -0,0 +1,36 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.apps; + +import org.apache.fop.apps.FopConfBuilder.RendererConfBuilder; + +import static org.apache.fop.render.txt.TxtRendererConfig.TxtRendererOption.ENCODING; + +public class TxtRendererConfBuilder extends RendererConfBuilder { + + protected TxtRendererConfBuilder() { + super(MimeConstants.MIME_PLAIN_TEXT); + } + + public TxtRendererConfBuilder setEncoding(String value) { + createTextElement(ENCODING, value); + return this; + } +} diff --git a/src/test/java/org/apache/fop/apps/io/BaseURIResolutionTest.java b/src/test/java/org/apache/fop/apps/io/BaseURIResolutionTest.java new file mode 100644 index 000000000..e04283718 --- /dev/null +++ b/src/test/java/org/apache/fop/apps/io/BaseURIResolutionTest.java @@ -0,0 +1,103 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.apps.io; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; + +import javax.xml.transform.Result; +import javax.xml.transform.Source; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; +import javax.xml.transform.sax.SAXResult; +import javax.xml.transform.sax.SAXTransformerFactory; +import javax.xml.transform.stream.StreamSource; + +import org.xml.sax.SAXException; + +import static org.junit.Assert.assertTrue; + +import org.apache.commons.io.IOUtils; +import org.apache.commons.io.output.ByteArrayOutputStream; + +import org.apache.xmlgraphics.io.ResourceResolver; + +import org.apache.fop.apps.FOPException; +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.apps.Fop; +import org.apache.fop.apps.FopConfParser; +import org.apache.fop.apps.FopFactory; +import org.apache.fop.apps.FopFactoryBuilder; +import org.apache.fop.apps.MimeConstants; + +import static org.apache.fop.FOPTestUtils.getBaseDir; + +public abstract class BaseURIResolutionTest { + + private final FopFactory fopFactory; + private SAXTransformerFactory tfactory = (SAXTransformerFactory) SAXTransformerFactory.newInstance(); + private static final File BACKUP_DIR = new File(getBaseDir(), "build/test-results"); + + public BaseURIResolutionTest(FopFactoryBuilder builder, File foFile) throws FOPException, + TransformerException, IOException { + fopFactory = builder.build(); + createDocument(foFile); + } + + public BaseURIResolutionTest(InputStream confStream, ResourceResolver resolver, File foFile) + throws FOPException, TransformerException, SAXException, IOException { + this(new FopConfParser(confStream, getBaseDir().toURI(), resolver).getFopFactoryBuilder(), + foFile); + } + + private void createDocument(File foFile) throws TransformerException, FOPException, + IOException { + FOUserAgent ua = fopFactory.newFOUserAgent(); + + ByteArrayOutputStream baout = new ByteArrayOutputStream(); + + Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, ua, baout); + + Transformer transformer = tfactory.newTransformer(); //Identity transf. + Source src = new StreamSource(foFile); + Result res = new SAXResult(fop.getDefaultHandler()); + transformer.transform(src, res); + + OutputStream out = new java.io.FileOutputStream( + new File(BACKUP_DIR, foFile.getName() + ".pdf")); + try { + baout.writeTo(out); + } finally { + IOUtils.closeQuietly(out); + } + + //Test using PDF as the area tree doesn't invoke Batik so we could check + //if the resolver is actually passed to Batik by FOP + assertTrue("Generated PDF has zero length", baout.size() > 0); + } + + public abstract void testAssertions(); + + static File getFODirectory() { + return new File(getBaseDir(), "test/xml/uri-testing/"); + } +} diff --git a/src/test/java/org/apache/fop/apps/io/FontURIResolver.java b/src/test/java/org/apache/fop/apps/io/FontURIResolver.java new file mode 100644 index 000000000..781aca368 --- /dev/null +++ b/src/test/java/org/apache/fop/apps/io/FontURIResolver.java @@ -0,0 +1,107 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.apps.io; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.URI; +import java.util.HashMap; +import java.util.Map; + +import javax.xml.transform.TransformerException; + +import org.junit.Test; +import org.xml.sax.SAXException; + +import static org.junit.Assert.assertTrue; + +import org.apache.xmlgraphics.io.Resource; + +import org.apache.fop.apps.FopConfBuilder; +import org.apache.fop.apps.PDFRendererConfBuilder; + +public class FontURIResolver extends BaseURIResolutionTest { + + public enum Event { + TTF, + TYPE1; + } + + private static final InputStream FOP_CONF_STREAM = new FopConfBuilder() + .setBaseURI(".") + .setFontBaseURI("fonts:///") + .useCache(false) + .startRendererConfig(PDFRendererConfBuilder.class) + .startFontsConfig() + .startFont(null, "gladiator?type=ttf") + .addTriplet("gladttf", "normal", "normal") + .endFont() + .startFont(null, "gladiator?type=type1") + .addTriplet("gladtype1", "normal", "normal") + .endFont() + .endFontConfig() + .endRendererConfig().build(); + + private static final class CustomFontURIResolver extends TestingResourceResolver { + + private final File fontsDir = new File("test/resources/fonts/ttf/"); + + public Resource getResource(URI uri) throws IOException { + if (uri.getScheme().equals("fonts") && uri.getPath().equals("/gladiator")) { + if (uri.getQuery().startsWith("type")) { + String typeArg = uri.getQuery().split("=")[1]; + if (typeArg.equals("ttf")) { + recordProperty(uri, Event.TTF); + return new Resource(new FileInputStream(new File(fontsDir, "glb12.ttf"))); + } else if (typeArg.equals("type1")) { + recordProperty(uri, Event.TYPE1); + return new Resource(new FileInputStream(new File(fontsDir, "glb12.ttf"))); + } + } + } + return null; + } + + public OutputStream getOutputStream(URI uri) throws IOException { + return null; + } + } + + private static final CustomFontURIResolver RESOLVER = new CustomFontURIResolver(); + + public FontURIResolver() throws TransformerException, SAXException, IOException { + super(FOP_CONF_STREAM, RESOLVER, new File(getFODirectory(), "font.fo")); + } + + @Test + @Override + public void testAssertions() { + Map<URI, Object> expectedEvent = new HashMap<URI, Object>(); + expectedEvent.put(URI.create("fonts:/gladiator?type=type1"), Event.TYPE1); + expectedEvent.put(URI.create("fonts:/gladiator?type=ttf"), Event.TTF); + + Map<URI, Object> propertyMap = RESOLVER.getMap(); + assertTrue(propertyMap.equals(expectedEvent)); + } + +} diff --git a/src/test/java/org/apache/fop/apps/io/ResourceResolverFactoryTestCase.java b/src/test/java/org/apache/fop/apps/io/ResourceResolverFactoryTestCase.java new file mode 100644 index 000000000..6ae34b4f9 --- /dev/null +++ b/src/test/java/org/apache/fop/apps/io/ResourceResolverFactoryTestCase.java @@ -0,0 +1,217 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.apps.io; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.URI; + +import org.junit.Test; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import org.apache.xmlgraphics.io.Resource; +import org.apache.xmlgraphics.io.ResourceResolver; +import org.apache.xmlgraphics.io.TempResourceResolver; + +public class ResourceResolverFactoryTestCase { + + private static final byte[] DATA = new byte[]{(byte) 0, (byte) 1, (byte) 2}; + + private void writeDataTo(File f) throws IOException { + writeDataTo(new FileOutputStream(f)); + } + + private void writeDataTo(OutputStream os) throws IOException { + os.write(DATA); + os.close(); + } + + private void checkStream(InputStream inputStream) throws IOException { + byte[] actual = new byte[DATA.length]; + for (int i = 0; i < DATA.length; i++) { + actual[i] = (byte) inputStream.read(); + } + assertEquals(-1, inputStream.read()); + assertArrayEquals(DATA, actual); + } + + @Test + public void testDefaultResourceResolverGetResource() throws Exception { + ResourceResolver sut = ResourceResolverFactory.createDefaultResourceResolver(); + File inputFile = File.createTempFile("prefix", "suffix"); + InputStream is = null; + try { + writeDataTo(inputFile); + is = sut.getResource(inputFile.toURI()); + checkStream(is); + } finally { + if (is != null) { + is.close(); + } + inputFile.delete(); + } + } + + @Test + public void testDefaultResourceResolverGetOutput() throws Exception { + ResourceResolver sut = ResourceResolverFactory.createDefaultResourceResolver(); + File outputFile = File.createTempFile("prefix", "suffix"); + outputFile.deleteOnExit(); + writeDataTo(sut.getOutputStream(outputFile.toURI())); + InputStream is = new FileInputStream(outputFile); + try { + checkStream(is); + } finally { + is.close(); + } + } + + private static class TestCreateTempAwareResourceResolverHelper implements ResourceResolver { + + final TempResourceResolver tempResourceResolver = mock(TempResourceResolver.class); + + final ResourceResolver defaultResourceResolver = mock(ResourceResolver.class); + + final ResourceResolver sut = ResourceResolverFactory.createTempAwareResourceResolver( + tempResourceResolver, defaultResourceResolver); + + public Resource getResource(URI uri) throws IOException { + return sut.getResource(uri); + } + public OutputStream getOutputStream(URI uri) throws IOException { + return sut.getOutputStream(uri); + } + } + + @Test + public void testCreateTempAwareResourceResolverForTmpResource() throws Exception { + URI uri = URI.create("tmp:///id"); + TestCreateTempAwareResourceResolverHelper helper = new TestCreateTempAwareResourceResolverHelper(); + helper.getResource(uri); + verify(helper.tempResourceResolver, times(1)).getResource(uri.getPath()); + verify(helper.defaultResourceResolver, never()).getResource(uri); + } + + @Test + public void testCreateTempAwareResourceResolverForRegularResource() throws Exception { + URI uri = URI.create("file:///path/to/file"); + TestCreateTempAwareResourceResolverHelper helper = new TestCreateTempAwareResourceResolverHelper(); + helper.getResource(uri); + verify(helper.tempResourceResolver, never()).getResource(uri.getPath()); + verify(helper.defaultResourceResolver, times(1)).getResource(uri); + } + + @Test + public void testCreateTempAwareResourceResolverForTmpOuput() throws Exception { + URI uri = URI.create("tmp:///id"); + TestCreateTempAwareResourceResolverHelper helper = new TestCreateTempAwareResourceResolverHelper(); + helper.getOutputStream(uri); + verify(helper.tempResourceResolver, times(1)).getOutputStream(uri.getPath()); + verify(helper.defaultResourceResolver, never()).getOutputStream(uri); + } + + @Test + public void testCreateTempAwareResourceResolverForRegularOutput() throws Exception { + URI uri = URI.create("file:///path/to/file"); + TestCreateTempAwareResourceResolverHelper helper = new TestCreateTempAwareResourceResolverHelper(); + helper.getOutputStream(uri); + verify(helper.tempResourceResolver, never()).getOutputStream(uri.getPath()); + verify(helper.defaultResourceResolver, times(1)).getOutputStream(uri); + } + + @Test + public void testCreateSchemaAwareResourceResolverForDefaultResource() throws Exception { + URI uri = URI.create("file:///path/to/file"); + TestCreateSchemaAwareResourceResolverBuilderHelper helper + = new TestCreateSchemaAwareResourceResolverBuilderHelper(); + helper.getResource(uri); + verify(helper.registedResourceResolver, never()).getResource(uri); + verify(helper.defaultResourceResolver, times(1)).getResource(uri); + } + + @Test + public void testCreateSchemaAwareResourceResolverForRegisteredResource() throws Exception { + URI uri = URI.create(TestCreateSchemaAwareResourceResolverBuilderHelper.SCHEMA + ":///path"); + TestCreateSchemaAwareResourceResolverBuilderHelper helper + = new TestCreateSchemaAwareResourceResolverBuilderHelper(); + helper.getResource(uri); + verify(helper.registedResourceResolver, times(1)).getResource(uri); + verify(helper.defaultResourceResolver, never()).getResource(uri); + } + + @Test + public void testCreateSchemaAwareResourceResolverForDefaultOutput() throws Exception { + URI uri = URI.create("file:///path/to/file"); + TestCreateSchemaAwareResourceResolverBuilderHelper helper + = new TestCreateSchemaAwareResourceResolverBuilderHelper(); + helper.getOutputStream(uri); + verify(helper.registedResourceResolver, never()).getOutputStream(uri); + verify(helper.defaultResourceResolver, times(1)).getOutputStream(uri); + } + + @Test + public void testCreateSchemaAwareResourceResolverForRegisteredOutput() throws Exception { + URI uri = URI.create(TestCreateSchemaAwareResourceResolverBuilderHelper.SCHEMA + ":///path"); + TestCreateSchemaAwareResourceResolverBuilderHelper helper + = new TestCreateSchemaAwareResourceResolverBuilderHelper(); + helper.getOutputStream(uri); + verify(helper.registedResourceResolver, times(1)).getOutputStream(uri); + verify(helper.defaultResourceResolver, never()).getOutputStream(uri); + } + + private static class TestCreateSchemaAwareResourceResolverBuilderHelper implements ResourceResolver { + + private static final String SCHEMA = "protocol"; + + final ResourceResolver registedResourceResolver = mock(ResourceResolver.class); + + final ResourceResolver defaultResourceResolver = mock(ResourceResolver.class); + + final ResourceResolver sut; + + TestCreateSchemaAwareResourceResolverBuilderHelper() { + ResourceResolverFactory.SchemeAwareResourceResolverBuilder builder + = ResourceResolverFactory.createSchemeAwareResourceResolverBuilder( + defaultResourceResolver); + builder.registerResourceResolverForScheme(SCHEMA, registedResourceResolver); + sut = builder.build(); + + } + + public Resource getResource(URI uri) throws IOException { + return sut.getResource(uri); + } + public OutputStream getOutputStream(URI uri) throws IOException { + return sut.getOutputStream(uri); + } + } + +} + diff --git a/src/test/java/org/apache/fop/apps/io/TestingResourceResolver.java b/src/test/java/org/apache/fop/apps/io/TestingResourceResolver.java new file mode 100644 index 000000000..f1cd06138 --- /dev/null +++ b/src/test/java/org/apache/fop/apps/io/TestingResourceResolver.java @@ -0,0 +1,45 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.apps.io; + +import java.net.URI; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +import org.apache.xmlgraphics.io.ResourceResolver; + +abstract class TestingResourceResolver implements ResourceResolver { + + private final Map<URI, Object> checker; + + TestingResourceResolver() { + checker = new HashMap<URI, Object>(); + } + + void recordProperty(URI uri, Object obj) { + checker.put(uri, obj); + } + + Map<URI, Object> getMap() { + return Collections.unmodifiableMap(checker); + } + +} diff --git a/src/test/java/org/apache/fop/apps/io/URIResolverWrapperTestCase.java b/src/test/java/org/apache/fop/apps/io/URIResolverWrapperTestCase.java new file mode 100644 index 000000000..b2044e3b9 --- /dev/null +++ b/src/test/java/org/apache/fop/apps/io/URIResolverWrapperTestCase.java @@ -0,0 +1,133 @@ +/* + * 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. + */ + +/* $Id$ */ +package org.apache.fop.apps.io; + +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.fail; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; + +import org.apache.xmlgraphics.io.ResourceResolver; + +public class URIResolverWrapperTestCase { + + private static final List<String> BASE_URIS = Collections.unmodifiableList(Arrays.asList( + new String[] { + ".", + "../", + "some/path", + "file:///absolute/file/path"} + )); + + private URI base; + + @Before + public void setup() throws URISyntaxException { + setBase("."); + } + + private void setBase(String baseStr) throws URISyntaxException { + base = new URI(baseStr); + } + + @Test + public void testResolveIn() throws Exception { + String[] uris = new String[] {".", "resource", "path/to/resource"}; + for (String base : BASE_URIS) { + setBase(base); + for (String uriStr : uris) { + URI uri = new URI(uriStr); + URI expected = resolveFromBase(uri); + test(uriStr, uri, expected); + } + } + } + + @Test + public void testResolveInBadUri() throws Exception { + String[] uris = new String[] {"path\\to\\resource", "bad resource name"}; + for (String base : BASE_URIS) { + setBase(base); + for (String uriStr : uris) { + assertBadSyntax(uriStr); + URI uri = cleanURI(uriStr); + URI expected = resolveFromBase(uri); + test(uriStr, uri, expected); + } + } + } + + @Test + public void getBaseURI() throws URISyntaxException { + assertEquals(InternalResourceResolver.getBaseURI("x/y/z/"), new URI("x/y/z/")); + assertEquals(InternalResourceResolver.getBaseURI("x/y/z"), new URI("x/y/z/")); + } + + @Test + public void cleanURI() throws URISyntaxException { + String[] uris = new String[] {".", "path/to/resource", "path\\to\\resource", + "bad resource name"}; + for (String uri : uris) { + assertEquals(InternalResourceResolver.cleanURI(uri), cleanURI(uri)); + } + assertNull(InternalResourceResolver.cleanURI(null)); + } + + private void test(String uriStr, URI uri, URI expected) throws IOException, URISyntaxException { + ResourceResolver resolver = mock(ResourceResolver.class); + InternalResourceResolver sut = new InternalResourceResolver(base, resolver); + sut.getResource(uriStr); + verify(resolver).getResource(eq(expected)); + resolver = mock(ResourceResolver.class); + sut = new InternalResourceResolver(base, resolver); + sut.getResource(uri); + verify(resolver).getResource(eq(expected)); + } + + private URI resolveFromBase(URI uri) { + return base.resolve(uri); + } + + private URI cleanURI(String raw) throws URISyntaxException { + String fixedUri = raw.replace('\\', '/'); + fixedUri = fixedUri.replace(" ", "%20"); + return new URI(fixedUri); + } + + private void assertBadSyntax(String badUri) { + try { + new URI(badUri); + fail(badUri + " is correctly formed."); + } catch (URISyntaxException e) { + // PASS + } + } +} diff --git a/src/test/java/org/apache/fop/area/BlockViewportTestCase.java b/src/test/java/org/apache/fop/area/BlockViewportTestCase.java new file mode 100644 index 000000000..f825fdda5 --- /dev/null +++ b/src/test/java/org/apache/fop/area/BlockViewportTestCase.java @@ -0,0 +1,47 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.area; + +import org.junit.Test; + +/** + * Tests the {@linkplain BlockViewport} class. + */ +public class BlockViewportTestCase extends ViewportTest { + + @Test + public void testNonClip() throws Exception { + BlockViewport bv = new BlockViewport(); + bv.setIPD(100); + bv.setBPD(50); + checkNonClip(bv); + } + + @Test + public void testClip() throws Exception { + BlockViewport bv = new BlockViewport(); + int ipd = 100; + int bpd = 50; + bv.setIPD(ipd); + bv.setBPD(bpd); + bv.setClip(true); + checkClip(bv, ipd, bpd); + } +} diff --git a/src/test/java/org/apache/fop/area/RegionViewportTestCase.java b/src/test/java/org/apache/fop/area/RegionViewportTestCase.java new file mode 100644 index 000000000..638126efb --- /dev/null +++ b/src/test/java/org/apache/fop/area/RegionViewportTestCase.java @@ -0,0 +1,54 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.area; + +import java.awt.Rectangle; +import java.awt.geom.Rectangle2D; + +import org.junit.Test; + +/** + * Tests the {@linkplain RegionViewport} class. + */ +public class RegionViewportTestCase extends ViewportTest { + + private RegionViewport createRegionViewport(int x, int y, int ipd, int bpd) { + Rectangle2D v = new Rectangle(x, y, ipd, bpd); + RegionViewport viewport = new RegionViewport(v); + viewport.setIPD(ipd); + viewport.setBPD(bpd); + return viewport; + } + + @Test + public void testNonClip() throws Exception { + RegionViewport viewport = createRegionViewport(10, 10, 100, 20); + checkNonClip(viewport); + } + + @Test + public void testClip() throws Exception { + int ipd = 150; + int bpd = 20; + RegionViewport viewport = createRegionViewport(10, 10, ipd, bpd); + viewport.setClip(true); + checkClip(viewport, ipd, bpd); + } +} diff --git a/src/test/java/org/apache/fop/area/TraitTestCase.java b/src/test/java/org/apache/fop/area/TraitTestCase.java new file mode 100644 index 000000000..2c77228c5 --- /dev/null +++ b/src/test/java/org/apache/fop/area/TraitTestCase.java @@ -0,0 +1,42 @@ +/* + * 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. + */ + +/* $Id: ActiveLayouts.java 99 2008-11-24 11:06:55Z vincent $ */ + +package org.apache.fop.area; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +public class TraitTestCase { + + @Test + public void testImageTargetWidthAndHeight() { + int width = 2911; + int height = 1911; + Trait.Background background = new Trait.Background(); + background.setImageTargetWidth(width); + background.setImageTargetHeight(height); + assertEquals(width, background.getImageTargetWidth()); + assertEquals(height, background.getImageTargetHeight()); + assertTrue(background.toString().contains(Integer.toString(width))); + assertTrue(background.toString().contains(Integer.toString(height))); + } + +} diff --git a/src/test/java/org/apache/fop/area/ViewportTest.java b/src/test/java/org/apache/fop/area/ViewportTest.java new file mode 100644 index 000000000..46412c83d --- /dev/null +++ b/src/test/java/org/apache/fop/area/ViewportTest.java @@ -0,0 +1,43 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.area; + +import java.awt.Rectangle; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +/** + * Tests implementations of the {@linkplain Viewport} interface. + */ +public abstract class ViewportTest { + + protected void checkNonClip(Viewport v) throws Exception { + assertFalse(v.hasClip()); + assertNull(v.getClipRectangle()); + } + + protected void checkClip(Viewport v, int expectedWidth, int expectedHeight) throws Exception { + assertTrue(v.hasClip()); + assertEquals(new Rectangle(0, 0, expectedWidth, expectedHeight), v.getClipRectangle()); + } +} diff --git a/src/test/java/org/apache/fop/area/ViewportTestSuite.java b/src/test/java/org/apache/fop/area/ViewportTestSuite.java new file mode 100644 index 000000000..891f1d081 --- /dev/null +++ b/src/test/java/org/apache/fop/area/ViewportTestSuite.java @@ -0,0 +1,38 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.area; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +import org.apache.fop.area.inline.InlineViewportTestCase; + +/** + * A suite of all the tests relating to the {@linkplain Viewport} interface. + */ +@RunWith(Suite.class) +@SuiteClasses({ + RegionViewportTestCase.class, + BlockViewportTestCase.class, + InlineViewportTestCase.class +}) +public final class ViewportTestSuite { +} diff --git a/src/test/java/org/apache/fop/area/inline/InlineViewportTestCase.java b/src/test/java/org/apache/fop/area/inline/InlineViewportTestCase.java new file mode 100644 index 000000000..cba5759cf --- /dev/null +++ b/src/test/java/org/apache/fop/area/inline/InlineViewportTestCase.java @@ -0,0 +1,50 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.area.inline; + +import org.junit.Test; + +import org.apache.fop.area.ViewportTest; + +/** + * Tests the {@linkplain InlineViewport} class. + */ +public class InlineViewportTestCase extends ViewportTest { + + @Test + public void testNonClip() throws Exception { + InlineViewport v = new InlineViewport(null); + v.setIPD(50); + v.setBPD(25); + checkNonClip(v); + } + + @Test + public void testClip() throws Exception { + InlineViewport v = new InlineViewport(null); + int ipd = 50; + int bpd = 25; + v.setIPD(ipd); + v.setBPD(bpd); + v.setClip(true); + checkClip(v, ipd, bpd); + } + +} diff --git a/src/test/java/org/apache/fop/check/Check.java b/src/test/java/org/apache/fop/check/Check.java new file mode 100644 index 000000000..ffc7e3cbc --- /dev/null +++ b/src/test/java/org/apache/fop/check/Check.java @@ -0,0 +1,27 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.check; + +/** + * A marker interface to identify checks in XML test cases. + */ +public interface Check { + +} diff --git a/src/test/java/org/apache/fop/check/ChecksFactory.java b/src/test/java/org/apache/fop/check/ChecksFactory.java new file mode 100644 index 000000000..d77ce422d --- /dev/null +++ b/src/test/java/org/apache/fop/check/ChecksFactory.java @@ -0,0 +1,97 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.check; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +/** + * A factory class for creating checks that belong to a same family. + * @param <C> a family of checks + */ +public abstract class ChecksFactory<C extends Check> { + + /** + * A factory to create a particular kind of check. + */ + protected interface CheckFactory<C> { + + /** + * Creates a {@link Check} instance from the given XML element. + * + * @param element an element representing a check + * @return the corresponding check + */ + C createCheck(Element element); + } + + private final Map<String, CheckFactory<C>> checkFactories + = new HashMap<String, CheckFactory<C>>(); + + /** Default constructor. */ + protected ChecksFactory() { } + + /** + * Registers a factory for a new kind of check. + * + * @param elementName the name of the element under which the check is identified in + * the XML test case + * @param factory the corresponding factory + */ + protected void registerCheckFactory(String elementName, CheckFactory<C> factory) { + checkFactories.put(elementName, factory); + } + + /** + * Creates a new {@link Check} instance corresponding to the given element. + * + * @param element an element in the XML test case that identifies a particular check + * @return the corresponding check + * @throws IllegalArgumentException if not check corresponding to the given element + * has been found + */ + public final C createCheck(Element element) { + String name = element.getTagName(); + CheckFactory<C> factory = checkFactories.get(name); + if (factory == null) { + throw new IllegalArgumentException("No check class found for " + name); + } else { + return factory.createCheck(element); + } + } + + public final List<C> createCheckList(Element container) { + List<C> checks = new ArrayList<C>(); + NodeList nodes = container.getChildNodes(); + for (int i = 0; i < nodes.getLength(); i++) { + Node node = nodes.item(i); + if (node instanceof Element) { + checks.add(createCheck((Element) node)); + } + } + return checks; + } +} diff --git a/src/test/java/org/apache/fop/check/package-info.java b/src/test/java/org/apache/fop/check/package-info.java new file mode 100644 index 000000000..5785f7a4b --- /dev/null +++ b/src/test/java/org/apache/fop/check/package-info.java @@ -0,0 +1,25 @@ +/* + * 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. + */ + +/* $Id$ */ + +/** + * A framework for creating checks from elements stored in an XML test case. The test case + * typically contains the XML document under test, along with a series of checks expressed + * as XML elements. + */ +package org.apache.fop.check; diff --git a/src/test/java/org/apache/fop/cli/CommandLineOptionsTestCase.java b/src/test/java/org/apache/fop/cli/CommandLineOptionsTestCase.java new file mode 100644 index 000000000..1be3daa84 --- /dev/null +++ b/src/test/java/org/apache/fop/cli/CommandLineOptionsTestCase.java @@ -0,0 +1,73 @@ +/* + * 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. + */ + +/* $Id: CommandLineOptions.java 1293736 2012-02-26 02:29:01Z gadams $ */ + +package org.apache.fop.cli; + +import java.io.IOException; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import org.apache.fop.apps.FOPException; + +public class CommandLineOptionsTestCase { + + private final CommandLineOptions clo = new CommandLineOptions(); + private final String commandLine = "-fo examples/fo/basic/simple.fo -print"; + private String[] cmd; + private boolean parsed; + + @Before + public void setUp() throws Exception { + cmd = commandLine.split(" "); + parsed = clo.parse(cmd); + } + + @Test + public void testParse() { + assertTrue(parsed); + } + + @Test + public void testGetOutputFormat() throws FOPException { + assertEquals(clo.getOutputFormat(), "application/X-fop-print"); + } + + @Test + public void testVandVersionSwitchs() throws FOPException, IOException { + // test -v + String cl1 = "-v"; + String[] cmd1 = cl1.split(" "); + CommandLineOptions clo1 = new CommandLineOptions(); + assertTrue(!clo1.parse(cmd1)); + // test -version + String cl2 = "-version"; + String[] cmd2 = cl2.split(" "); + CommandLineOptions clo2 = new CommandLineOptions(); + assertTrue(!clo2.parse(cmd2)); + // test -v + more switches + String cl3 = "-v " + commandLine; + String[] cmd3 = cl3.split(" "); + CommandLineOptions clo3 = new CommandLineOptions(); + assertTrue(clo3.parse(cmd3)); + } +} diff --git a/src/test/java/org/apache/fop/complexscripts/ComplexScriptsTestSuite.java b/src/test/java/org/apache/fop/complexscripts/ComplexScriptsTestSuite.java new file mode 100644 index 000000000..1dc0610b9 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/ComplexScriptsTestSuite.java @@ -0,0 +1,42 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.complexscripts; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +import org.apache.fop.complexscripts.bidi.BidiTestSuite; +import org.apache.fop.complexscripts.fonts.FontsTestSuite; +import org.apache.fop.complexscripts.scripts.ScriptsTestSuite; +import org.apache.fop.complexscripts.util.UtilTestSuite; + +/** + * Test suite for complex scripts functionality. + */ +@RunWith(Suite.class) +@SuiteClasses({ + BidiTestSuite.class, + FontsTestSuite.class, + ScriptsTestSuite.class, + UtilTestSuite.class +}) +public class ComplexScriptsTestSuite { +} diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiAlgorithmTestCase.java b/src/test/java/org/apache/fop/complexscripts/bidi/BidiAlgorithmTestCase.java new file mode 100644 index 000000000..8ed1af217 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiAlgorithmTestCase.java @@ -0,0 +1,263 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.complexscripts.bidi; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * <p>Test case for Unicode Bidi Algorithm.</p> + */ +public class BidiAlgorithmTestCase { + + /** + * logging instance + */ + private static final Log log = LogFactory.getLog(BidiAlgorithmTestCase.class); + + /** + * Concatenated array of <test-set,test-sequence> tuples + * specifying which sequences are to be excluded from testing, + * where -1 for either component is a wildcard. + */ + private static final int[] EXCLUSIONS = { + // no exclusions + }; + + /** + * Concatenated array of <test-set,test-sequence> tuples + * specifying which sequences are to be included in testing, where + * -1 for either component is a wildcard. + */ + private static final int[] INCLUSIONS = { + -1, -1 // all sequences + }; + + /** + * Concatenated array of <start,end> tuples expressing ranges of + * test sets to be tested, where -1 in the end position signifies + * all remaining test sets. + */ + private static final int[] TEST_SET_RANGES = { + 0, -1 // all test sets + }; + + // instrumentation + private int includedSequences; + private int excludedSequences; + private int passedSequences; + + @Test + public void testBidiAlgorithm() throws Exception { + String ldPfx = BidiTestData.LD_PFX; + int ldCount = BidiTestData.LD_CNT; + for (int i = 0; i < ldCount; i++) { + int[] da = BidiTestData.readTestData(ldPfx, i); + if (da != null) { + testBidiAlgorithm(i, da); + } else { + fail("unable to read bidi test data for resource at index " + i); + } + } + // ensure we passed all test sequences + assertEquals("did not pass all test sequences", BidiTestData.NUM_TEST_SEQUENCES, passedSequences); + if (log.isDebugEnabled()) { + log.debug("Included Sequences : " + includedSequences); + log.debug("Excluded Sequences : " + excludedSequences); + log.debug("Passed Sequences : " + passedSequences); + } + } + + private void testBidiAlgorithm(int testSet, int[] da) throws Exception { + if (da.length < 1) { + fail("test data is empty"); + } else if (da.length < ((da[0] * 2) + 1)) { + fail("test data is truncated"); + } else { + int k = 0; + // extract level count + int n = da[k++]; + // extract level array + int[] la = new int [ n ]; + for (int i = 0; i < n; i++) { + la[i] = da[k++]; + } + // extract reorder array + int[] ra = new int [ n ]; + for (int i = 0; i < n; i++) { + ra[i] = da[k++]; + } + // extract and test each test sequence + int testSequence = 0; + int[] ta = new int [ n ]; + while ((k + (1 + n)) <= da.length) { + int bs = da[k++]; + for (int i = 0; i < n; i++) { + ta[i] = da[k++]; + } + if (includeSequence(testSet, testSequence)) { + includedSequences++; + if (!excludeSequence(testSet, testSequence)) { + if (testBidiAlgorithm(testSet, testSequence, la, ra, ta, bs)) { + passedSequences++; + } + } else { + excludedSequences++; + } + } + testSequence++; + } + // ensure we exhausted test data + assertEquals("extraneous test data", da.length, k); + } + } + + private boolean includeTestSet(int testSet) { + for (int i = 0, n = TEST_SET_RANGES.length / 2; i < n; i++) { + int s = TEST_SET_RANGES [ (i * 2) + 0 ]; + int e = TEST_SET_RANGES [ (i * 2) + 1 ]; + if (testSet >= s) { + if ((e < 0) || (testSet <= e)) { + return true; + } + } + } + return false; + } + + private boolean includeSequence(int testSet, int testSequence) { + if (!includeTestSet(testSet)) { + return false; + } else { + for (int i = 0, n = INCLUSIONS.length / 2; i < n; i++) { + int setno = INCLUSIONS [ (i * 2) + 0 ]; + int seqno = INCLUSIONS [ (i * 2) + 1 ]; + if (setno < 0) { + if (seqno < 0) { + return true; + } else if (seqno == testSequence) { + return true; + } + } else if (setno == testSet) { + if (seqno < 0) { + return true; + } else if (seqno == testSequence) { + return true; + } + } + } + return false; + } + } + + private boolean excludeSequence(int testSet, int testSequence) { + for (int i = 0, n = EXCLUSIONS.length / 2; i < n; i++) { + int setno = EXCLUSIONS [ (i * 2) + 0 ]; + int seqno = EXCLUSIONS [ (i * 2) + 1 ]; + if (setno < 0) { + if (seqno < 0) { + return true; + } else if (seqno == testSequence) { + return true; + } + } else if (setno == testSet) { + if (seqno < 0) { + return true; + } else if (seqno == testSequence) { + return true; + } + } + } + return false; + } + + private boolean testBidiAlgorithm(int testSet, int testSequence, int[] la, int[] ra, int[] ta, int bs) + throws Exception { + boolean passed = true; + int n = la.length; + if (ra.length != n) { + fail("bad reorder array length, expected " + n + ", got " + ra.length); + } else if (ta.length != n) { + fail("bad test array length, expected " + n + ", got " + ta.length); + } else { + // auto-LTR + if ((bs & 1) != 0) { + // auto-LTR is performed at higher level + } + // LTR + if ((bs & 2) != 0) { + int[] levels = UnicodeBidiAlgorithm.resolveLevels(null, ta, 0, new int [ n ], true); + if (!verifyResults(la, levels, ta, 0, testSet, testSequence)) { + passed = false; + } + } + // RTL + if ((bs & 4) != 0) { + int[] levels = UnicodeBidiAlgorithm.resolveLevels(null, ta, 1, new int [ n ], true); + if (!verifyResults(la, levels, ta, 1, testSet, testSequence)) { + passed = false; + } + } + } + return passed; + } + + private boolean verifyResults(int[] laExp, int[] laOut, int[] ta, int dl, int testSet, int testSequence) { + if (laOut.length != laExp.length) { + fail("output levels array length mismatch, expected " + laExp.length + ", got " + laOut.length); + return false; + } else { + int numMatch = 0; + for (int i = 0, n = laExp.length; i < n; i++) { + if (laExp[i] >= 0) { + int lo = laOut[i]; + int le = laExp[i]; + if (lo != le) { + assertEquals(getMismatchMessage(testSet, testSequence, i, dl), le, lo); + } else { + numMatch++; + } + } else { + numMatch++; + } + } + return numMatch == laExp.length; + } + } + + private String getMismatchMessage(int testSet, int testSequence, int seqIndex, int defaultLevel) { + StringBuffer sb = new StringBuffer(); + sb.append("level mismatch for default level "); + sb.append(defaultLevel); + sb.append(" at sequence index "); + sb.append(seqIndex); + sb.append(" in test sequence "); + sb.append(testSequence); + sb.append(" of test set "); + sb.append(testSet); + return sb.toString(); + } + +} diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiClassTestCase.java b/src/test/java/org/apache/fop/complexscripts/bidi/BidiClassTestCase.java new file mode 100644 index 000000000..f393e5b70 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiClassTestCase.java @@ -0,0 +1,57 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.complexscripts.bidi; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +import org.apache.fop.util.CharUtilities; + +public class BidiClassTestCase { + + @Test + public void testBidiClasses() throws Exception { + String tdPfx = BidiTestData.TD_PFX; + int tdCount = BidiTestData.TD_CNT; + for (int i = 0; i < tdCount; i++) { + int[] da = BidiTestData.readTestData(tdPfx, i); + if (da != null) { + testBidiClass(da); + } else { + fail("unable to read bidi test data for resource at index " + i); + } + } + } + + private void testBidiClass(int[] da) throws Exception { + int bc = da[0]; + for (int i = 1, n = da.length; i < n; i += 2) { + int s = da[i + 0]; + int e = da[i + 1]; + for (int c = s; c < e; c++) { + int cbc = BidiClass.getBidiClass(c); + assertEquals("bad bidi class for CH(" + CharUtilities.format(c) + ")", bc, cbc); + } + } + } + +} diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD0.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD0.ser Binary files differnew file mode 100644 index 000000000..6eccb4b6f --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD0.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD1.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD1.ser Binary files differnew file mode 100644 index 000000000..8a7a802d2 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD1.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD10.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD10.ser Binary files differnew file mode 100644 index 000000000..74a52f212 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD10.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD100.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD100.ser Binary files differnew file mode 100644 index 000000000..4058da121 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD100.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD101.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD101.ser Binary files differnew file mode 100644 index 000000000..321ed2682 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD101.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD102.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD102.ser Binary files differnew file mode 100644 index 000000000..f5e3973dd --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD102.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD103.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD103.ser Binary files differnew file mode 100644 index 000000000..0235952c9 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD103.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD104.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD104.ser Binary files differnew file mode 100644 index 000000000..00d9ff6b4 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD104.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD105.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD105.ser Binary files differnew file mode 100644 index 000000000..b924c8d19 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD105.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD106.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD106.ser Binary files differnew file mode 100644 index 000000000..2cdabbf17 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD106.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD107.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD107.ser Binary files differnew file mode 100644 index 000000000..24e41ceab --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD107.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD108.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD108.ser Binary files differnew file mode 100644 index 000000000..8c9d014f2 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD108.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD109.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD109.ser Binary files differnew file mode 100644 index 000000000..fc2fc255e --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD109.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD11.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD11.ser Binary files differnew file mode 100644 index 000000000..2a40fe758 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD11.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD110.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD110.ser Binary files differnew file mode 100644 index 000000000..89ef3a341 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD110.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD111.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD111.ser Binary files differnew file mode 100644 index 000000000..0691f5f96 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD111.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD112.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD112.ser Binary files differnew file mode 100644 index 000000000..c3bd6103e --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD112.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD113.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD113.ser Binary files differnew file mode 100644 index 000000000..54d27e213 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD113.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD114.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD114.ser Binary files differnew file mode 100644 index 000000000..0ba52993a --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD114.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD115.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD115.ser Binary files differnew file mode 100644 index 000000000..0b95e6283 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD115.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD116.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD116.ser Binary files differnew file mode 100644 index 000000000..ca1111447 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD116.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD117.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD117.ser Binary files differnew file mode 100644 index 000000000..fbce0f949 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD117.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD118.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD118.ser Binary files differnew file mode 100644 index 000000000..c7bee5162 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD118.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD119.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD119.ser Binary files differnew file mode 100644 index 000000000..83ad166ef --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD119.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD12.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD12.ser Binary files differnew file mode 100644 index 000000000..81ff5dcbd --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD12.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD120.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD120.ser Binary files differnew file mode 100644 index 000000000..2a84369ef --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD120.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD121.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD121.ser Binary files differnew file mode 100644 index 000000000..3c3f08edf --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD121.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD122.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD122.ser Binary files differnew file mode 100644 index 000000000..81a342bc0 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD122.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD123.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD123.ser Binary files differnew file mode 100644 index 000000000..f2fdba316 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD123.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD124.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD124.ser Binary files differnew file mode 100644 index 000000000..5bebb054f --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD124.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD125.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD125.ser Binary files differnew file mode 100644 index 000000000..1292a8a01 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD125.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD126.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD126.ser Binary files differnew file mode 100644 index 000000000..f7c910fb0 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD126.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD127.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD127.ser Binary files differnew file mode 100644 index 000000000..bb2d2353a --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD127.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD128.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD128.ser Binary files differnew file mode 100644 index 000000000..4ef886527 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD128.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD129.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD129.ser Binary files differnew file mode 100644 index 000000000..7538307f8 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD129.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD13.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD13.ser Binary files differnew file mode 100644 index 000000000..5a81f8f76 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD13.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD130.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD130.ser Binary files differnew file mode 100644 index 000000000..dfa56bb42 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD130.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD131.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD131.ser Binary files differnew file mode 100644 index 000000000..04c0e6b02 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD131.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD132.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD132.ser Binary files differnew file mode 100644 index 000000000..5389ec53c --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD132.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD133.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD133.ser Binary files differnew file mode 100644 index 000000000..6ec49f1c7 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD133.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD134.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD134.ser Binary files differnew file mode 100644 index 000000000..381b6b741 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD134.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD135.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD135.ser Binary files differnew file mode 100644 index 000000000..e991a278f --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD135.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD136.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD136.ser Binary files differnew file mode 100644 index 000000000..84eb27fa3 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD136.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD137.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD137.ser Binary files differnew file mode 100644 index 000000000..3e3ceb4f0 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD137.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD138.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD138.ser Binary files differnew file mode 100644 index 000000000..52f01ebbf --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD138.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD139.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD139.ser Binary files differnew file mode 100644 index 000000000..54a66ac43 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD139.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD14.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD14.ser Binary files differnew file mode 100644 index 000000000..5bad9fe23 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD14.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD140.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD140.ser Binary files differnew file mode 100644 index 000000000..7e58aea97 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD140.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD141.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD141.ser Binary files differnew file mode 100644 index 000000000..60811580c --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD141.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD142.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD142.ser Binary files differnew file mode 100644 index 000000000..bfa39bf75 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD142.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD143.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD143.ser Binary files differnew file mode 100644 index 000000000..5df598aa7 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD143.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD144.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD144.ser Binary files differnew file mode 100644 index 000000000..f46f6a289 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD144.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD145.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD145.ser Binary files differnew file mode 100644 index 000000000..825930ea8 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD145.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD146.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD146.ser Binary files differnew file mode 100644 index 000000000..3d2efe600 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD146.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD147.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD147.ser Binary files differnew file mode 100644 index 000000000..5e3667df8 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD147.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD148.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD148.ser Binary files differnew file mode 100644 index 000000000..4a04343a5 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD148.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD149.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD149.ser Binary files differnew file mode 100644 index 000000000..85260e0f8 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD149.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD15.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD15.ser Binary files differnew file mode 100644 index 000000000..c1cb2878d --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD15.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD150.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD150.ser Binary files differnew file mode 100644 index 000000000..ab5dd0c00 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD150.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD151.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD151.ser Binary files differnew file mode 100644 index 000000000..df304a84b --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD151.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD152.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD152.ser Binary files differnew file mode 100644 index 000000000..887699163 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD152.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD153.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD153.ser Binary files differnew file mode 100644 index 000000000..fa70ead76 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD153.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD154.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD154.ser Binary files differnew file mode 100644 index 000000000..73402d898 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD154.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD155.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD155.ser Binary files differnew file mode 100644 index 000000000..c611d952e --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD155.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD156.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD156.ser Binary files differnew file mode 100644 index 000000000..a5a70cf81 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD156.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD157.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD157.ser Binary files differnew file mode 100644 index 000000000..736576c15 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD157.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD158.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD158.ser Binary files differnew file mode 100644 index 000000000..4667a5a4a --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD158.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD159.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD159.ser Binary files differnew file mode 100644 index 000000000..9a07236c3 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD159.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD16.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD16.ser Binary files differnew file mode 100644 index 000000000..6a8e667fb --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD16.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD160.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD160.ser Binary files differnew file mode 100644 index 000000000..abfeac3ec --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD160.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD161.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD161.ser Binary files differnew file mode 100644 index 000000000..1b225c825 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD161.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD162.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD162.ser Binary files differnew file mode 100644 index 000000000..36aab1fd1 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD162.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD163.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD163.ser Binary files differnew file mode 100644 index 000000000..77a744263 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD163.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD164.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD164.ser Binary files differnew file mode 100644 index 000000000..6f340e971 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD164.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD165.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD165.ser Binary files differnew file mode 100644 index 000000000..92ab48e50 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD165.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD166.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD166.ser Binary files differnew file mode 100644 index 000000000..412885433 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD166.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD167.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD167.ser Binary files differnew file mode 100644 index 000000000..3b4b83607 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD167.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD168.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD168.ser Binary files differnew file mode 100644 index 000000000..3e04f60f7 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD168.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD169.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD169.ser Binary files differnew file mode 100644 index 000000000..5e58d00f8 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD169.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD17.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD17.ser Binary files differnew file mode 100644 index 000000000..290d0e5b4 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD17.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD170.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD170.ser Binary files differnew file mode 100644 index 000000000..fb1f6b7ae --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD170.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD171.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD171.ser Binary files differnew file mode 100644 index 000000000..7ba80984d --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD171.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD172.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD172.ser Binary files differnew file mode 100644 index 000000000..594645bdc --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD172.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD173.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD173.ser Binary files differnew file mode 100644 index 000000000..5d995d076 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD173.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD174.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD174.ser Binary files differnew file mode 100644 index 000000000..e57c46d8e --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD174.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD175.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD175.ser Binary files differnew file mode 100644 index 000000000..ad4317529 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD175.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD176.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD176.ser Binary files differnew file mode 100644 index 000000000..52cdcd567 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD176.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD177.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD177.ser Binary files differnew file mode 100644 index 000000000..e786ab17e --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD177.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD178.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD178.ser Binary files differnew file mode 100644 index 000000000..2f9e41f08 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD178.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD179.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD179.ser Binary files differnew file mode 100644 index 000000000..94f739223 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD179.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD18.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD18.ser Binary files differnew file mode 100644 index 000000000..53073211e --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD18.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD180.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD180.ser Binary files differnew file mode 100644 index 000000000..172498f80 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD180.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD181.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD181.ser Binary files differnew file mode 100644 index 000000000..c5a9b434d --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD181.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD182.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD182.ser Binary files differnew file mode 100644 index 000000000..1c98e34a4 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD182.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD183.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD183.ser Binary files differnew file mode 100644 index 000000000..4e8c8e30c --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD183.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD184.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD184.ser Binary files differnew file mode 100644 index 000000000..824fad23d --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD184.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD185.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD185.ser Binary files differnew file mode 100644 index 000000000..969e34a37 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD185.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD186.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD186.ser Binary files differnew file mode 100644 index 000000000..0867d2e55 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD186.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD187.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD187.ser Binary files differnew file mode 100644 index 000000000..dd052d7a1 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD187.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD188.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD188.ser Binary files differnew file mode 100644 index 000000000..d52c97d1d --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD188.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD189.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD189.ser Binary files differnew file mode 100644 index 000000000..2bdb9dab4 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD189.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD19.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD19.ser Binary files differnew file mode 100644 index 000000000..21128bf86 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD19.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD190.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD190.ser Binary files differnew file mode 100644 index 000000000..d153d3442 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD190.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD191.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD191.ser Binary files differnew file mode 100644 index 000000000..5019d6fea --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD191.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD192.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD192.ser Binary files differnew file mode 100644 index 000000000..e726e2651 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD192.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD193.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD193.ser Binary files differnew file mode 100644 index 000000000..c37e1cdd0 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD193.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD194.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD194.ser Binary files differnew file mode 100644 index 000000000..1ba7b2877 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD194.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD195.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD195.ser Binary files differnew file mode 100644 index 000000000..62215ed07 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD195.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD196.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD196.ser Binary files differnew file mode 100644 index 000000000..709279994 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD196.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD197.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD197.ser Binary files differnew file mode 100644 index 000000000..788ac372f --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD197.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD198.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD198.ser Binary files differnew file mode 100644 index 000000000..9d4a14249 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD198.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD199.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD199.ser Binary files differnew file mode 100644 index 000000000..6cbb79535 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD199.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD2.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD2.ser Binary files differnew file mode 100644 index 000000000..05cf07859 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD2.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD20.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD20.ser Binary files differnew file mode 100644 index 000000000..9c10e367c --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD20.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD200.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD200.ser Binary files differnew file mode 100644 index 000000000..583084f0b --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD200.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD201.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD201.ser Binary files differnew file mode 100644 index 000000000..d8ed032c6 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD201.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD202.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD202.ser Binary files differnew file mode 100644 index 000000000..21e97fff0 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD202.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD203.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD203.ser Binary files differnew file mode 100644 index 000000000..5e3e01293 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD203.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD204.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD204.ser Binary files differnew file mode 100644 index 000000000..eba9874c5 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD204.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD205.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD205.ser Binary files differnew file mode 100644 index 000000000..182c5fc35 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD205.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD206.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD206.ser Binary files differnew file mode 100644 index 000000000..47ed04ba6 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD206.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD207.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD207.ser Binary files differnew file mode 100644 index 000000000..b56f3ee7c --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD207.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD208.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD208.ser Binary files differnew file mode 100644 index 000000000..302b20c39 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD208.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD209.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD209.ser Binary files differnew file mode 100644 index 000000000..c97cbbe12 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD209.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD21.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD21.ser Binary files differnew file mode 100644 index 000000000..e7eb886be --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD21.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD210.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD210.ser Binary files differnew file mode 100644 index 000000000..4da33f6c0 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD210.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD211.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD211.ser Binary files differnew file mode 100644 index 000000000..46f29b71a --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD211.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD212.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD212.ser Binary files differnew file mode 100644 index 000000000..b84d2efaa --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD212.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD213.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD213.ser Binary files differnew file mode 100644 index 000000000..2d0995a6f --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD213.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD214.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD214.ser Binary files differnew file mode 100644 index 000000000..66a505aae --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD214.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD215.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD215.ser Binary files differnew file mode 100644 index 000000000..cbd99924e --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD215.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD216.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD216.ser Binary files differnew file mode 100644 index 000000000..46b5315a0 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD216.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD217.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD217.ser Binary files differnew file mode 100644 index 000000000..4afc67dbc --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD217.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD218.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD218.ser Binary files differnew file mode 100644 index 000000000..992177ded --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD218.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD219.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD219.ser Binary files differnew file mode 100644 index 000000000..e75b1d344 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD219.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD22.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD22.ser Binary files differnew file mode 100644 index 000000000..ca7478b6c --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD22.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD220.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD220.ser Binary files differnew file mode 100644 index 000000000..3f754847c --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD220.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD221.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD221.ser Binary files differnew file mode 100644 index 000000000..02efa8786 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD221.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD222.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD222.ser Binary files differnew file mode 100644 index 000000000..1897b09f8 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD222.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD223.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD223.ser Binary files differnew file mode 100644 index 000000000..cd24d1101 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD223.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD224.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD224.ser Binary files differnew file mode 100644 index 000000000..aba011dba --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD224.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD225.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD225.ser Binary files differnew file mode 100644 index 000000000..dad463960 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD225.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD226.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD226.ser Binary files differnew file mode 100644 index 000000000..6430967e4 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD226.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD227.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD227.ser Binary files differnew file mode 100644 index 000000000..4f2bde014 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD227.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD228.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD228.ser Binary files differnew file mode 100644 index 000000000..7be09ec92 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD228.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD229.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD229.ser Binary files differnew file mode 100644 index 000000000..6ffa285db --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD229.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD23.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD23.ser Binary files differnew file mode 100644 index 000000000..d6c532596 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD23.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD230.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD230.ser Binary files differnew file mode 100644 index 000000000..3519adb5e --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD230.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD231.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD231.ser Binary files differnew file mode 100644 index 000000000..7540663aa --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD231.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD232.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD232.ser Binary files differnew file mode 100644 index 000000000..788e4c7e1 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD232.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD233.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD233.ser Binary files differnew file mode 100644 index 000000000..c36265614 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD233.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD234.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD234.ser Binary files differnew file mode 100644 index 000000000..772b72aef --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD234.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD235.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD235.ser Binary files differnew file mode 100644 index 000000000..e5fa50b85 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD235.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD236.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD236.ser Binary files differnew file mode 100644 index 000000000..13fdb364c --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD236.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD237.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD237.ser Binary files differnew file mode 100644 index 000000000..c600524d6 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD237.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD238.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD238.ser Binary files differnew file mode 100644 index 000000000..6043e0155 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD238.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD239.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD239.ser Binary files differnew file mode 100644 index 000000000..14250a315 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD239.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD24.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD24.ser Binary files differnew file mode 100644 index 000000000..209e8179e --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD24.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD240.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD240.ser Binary files differnew file mode 100644 index 000000000..bdbc02f69 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD240.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD241.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD241.ser Binary files differnew file mode 100644 index 000000000..d3f40a8de --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD241.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD242.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD242.ser Binary files differnew file mode 100644 index 000000000..03b94bc76 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD242.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD243.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD243.ser Binary files differnew file mode 100644 index 000000000..cb0321933 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD243.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD244.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD244.ser Binary files differnew file mode 100644 index 000000000..3cdc87c9c --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD244.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD245.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD245.ser Binary files differnew file mode 100644 index 000000000..7c50f1284 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD245.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD246.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD246.ser Binary files differnew file mode 100644 index 000000000..b04164e4c --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD246.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD247.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD247.ser Binary files differnew file mode 100644 index 000000000..bdce40f9c --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD247.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD248.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD248.ser Binary files differnew file mode 100644 index 000000000..e50ed7988 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD248.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD249.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD249.ser Binary files differnew file mode 100644 index 000000000..14ac62043 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD249.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD25.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD25.ser Binary files differnew file mode 100644 index 000000000..c1b31fcce --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD25.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD250.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD250.ser Binary files differnew file mode 100644 index 000000000..d96343972 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD250.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD251.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD251.ser Binary files differnew file mode 100644 index 000000000..7b3168b23 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD251.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD252.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD252.ser Binary files differnew file mode 100644 index 000000000..7f9b9056d --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD252.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD253.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD253.ser Binary files differnew file mode 100644 index 000000000..d5849ec9d --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD253.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD254.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD254.ser Binary files differnew file mode 100644 index 000000000..00a2b4a0e --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD254.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD255.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD255.ser Binary files differnew file mode 100644 index 000000000..5cc330f12 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD255.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD256.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD256.ser Binary files differnew file mode 100644 index 000000000..23e032ac9 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD256.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD257.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD257.ser Binary files differnew file mode 100644 index 000000000..7ba16c21a --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD257.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD258.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD258.ser Binary files differnew file mode 100644 index 000000000..334737ecd --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD258.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD259.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD259.ser Binary files differnew file mode 100644 index 000000000..26defabff --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD259.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD26.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD26.ser Binary files differnew file mode 100644 index 000000000..09dc4ca08 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD26.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD260.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD260.ser Binary files differnew file mode 100644 index 000000000..03cb82426 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD260.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD261.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD261.ser Binary files differnew file mode 100644 index 000000000..6d00960cf --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD261.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD262.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD262.ser Binary files differnew file mode 100644 index 000000000..920e4c5b1 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD262.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD263.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD263.ser Binary files differnew file mode 100644 index 000000000..dbbee5d7f --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD263.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD264.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD264.ser Binary files differnew file mode 100644 index 000000000..716661a75 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD264.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD265.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD265.ser Binary files differnew file mode 100644 index 000000000..b418d9b9f --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD265.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD266.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD266.ser Binary files differnew file mode 100644 index 000000000..bc16ddcff --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD266.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD267.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD267.ser Binary files differnew file mode 100644 index 000000000..a105347f0 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD267.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD268.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD268.ser Binary files differnew file mode 100644 index 000000000..f75552dc3 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD268.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD269.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD269.ser Binary files differnew file mode 100644 index 000000000..a3f6eab8f --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD269.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD27.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD27.ser Binary files differnew file mode 100644 index 000000000..604170dcc --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD27.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD270.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD270.ser Binary files differnew file mode 100644 index 000000000..755d6cd60 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD270.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD271.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD271.ser Binary files differnew file mode 100644 index 000000000..9b29a7d1e --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD271.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD272.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD272.ser Binary files differnew file mode 100644 index 000000000..5685e40b8 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD272.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD273.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD273.ser Binary files differnew file mode 100644 index 000000000..49a7c0739 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD273.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD274.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD274.ser Binary files differnew file mode 100644 index 000000000..1697a421b --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD274.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD275.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD275.ser Binary files differnew file mode 100644 index 000000000..ea0d9adf1 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD275.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD276.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD276.ser Binary files differnew file mode 100644 index 000000000..067dca228 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD276.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD277.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD277.ser Binary files differnew file mode 100644 index 000000000..9f9078678 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD277.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD278.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD278.ser Binary files differnew file mode 100644 index 000000000..9cd498c3c --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD278.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD279.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD279.ser Binary files differnew file mode 100644 index 000000000..c5c4c6ab0 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD279.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD28.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD28.ser Binary files differnew file mode 100644 index 000000000..890ce30bb --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD28.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD280.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD280.ser Binary files differnew file mode 100644 index 000000000..fac475452 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD280.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD281.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD281.ser Binary files differnew file mode 100644 index 000000000..4711e4586 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD281.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD282.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD282.ser Binary files differnew file mode 100644 index 000000000..1fcea5dbf --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD282.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD283.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD283.ser Binary files differnew file mode 100644 index 000000000..bf2a0bcc5 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD283.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD284.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD284.ser Binary files differnew file mode 100644 index 000000000..29a3c23d4 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD284.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD285.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD285.ser Binary files differnew file mode 100644 index 000000000..fea28c7d2 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD285.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD286.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD286.ser Binary files differnew file mode 100644 index 000000000..48663053e --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD286.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD287.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD287.ser Binary files differnew file mode 100644 index 000000000..43f440cf7 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD287.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD288.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD288.ser Binary files differnew file mode 100644 index 000000000..385ac7184 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD288.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD289.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD289.ser Binary files differnew file mode 100644 index 000000000..8a032f261 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD289.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD29.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD29.ser Binary files differnew file mode 100644 index 000000000..fdc27290b --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD29.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD290.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD290.ser Binary files differnew file mode 100644 index 000000000..264c28e08 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD290.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD291.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD291.ser Binary files differnew file mode 100644 index 000000000..daf236abf --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD291.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD292.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD292.ser Binary files differnew file mode 100644 index 000000000..8f972bf5a --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD292.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD293.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD293.ser Binary files differnew file mode 100644 index 000000000..647424ee0 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD293.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD294.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD294.ser Binary files differnew file mode 100644 index 000000000..9e8b99773 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD294.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD295.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD295.ser Binary files differnew file mode 100644 index 000000000..486bcf475 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD295.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD296.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD296.ser Binary files differnew file mode 100644 index 000000000..856d72fd1 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD296.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD297.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD297.ser Binary files differnew file mode 100644 index 000000000..ce0b5bf4c --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD297.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD298.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD298.ser Binary files differnew file mode 100644 index 000000000..cad0d5049 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD298.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD299.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD299.ser Binary files differnew file mode 100644 index 000000000..b14aa4597 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD299.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD3.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD3.ser Binary files differnew file mode 100644 index 000000000..6657a3593 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD3.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD30.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD30.ser Binary files differnew file mode 100644 index 000000000..b30faf809 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD30.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD300.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD300.ser Binary files differnew file mode 100644 index 000000000..4baca2704 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD300.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD301.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD301.ser Binary files differnew file mode 100644 index 000000000..630a13467 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD301.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD302.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD302.ser Binary files differnew file mode 100644 index 000000000..0f8e3d7d8 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD302.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD303.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD303.ser Binary files differnew file mode 100644 index 000000000..42a05ced7 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD303.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD304.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD304.ser Binary files differnew file mode 100644 index 000000000..13ba94a7e --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD304.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD305.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD305.ser Binary files differnew file mode 100644 index 000000000..e5a3a925e --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD305.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD306.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD306.ser Binary files differnew file mode 100644 index 000000000..1ada57413 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD306.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD307.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD307.ser Binary files differnew file mode 100644 index 000000000..a14a0bebf --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD307.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD308.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD308.ser Binary files differnew file mode 100644 index 000000000..c66ae933f --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD308.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD309.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD309.ser Binary files differnew file mode 100644 index 000000000..fd1e62ca8 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD309.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD31.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD31.ser Binary files differnew file mode 100644 index 000000000..4914c3b65 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD31.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD310.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD310.ser Binary files differnew file mode 100644 index 000000000..e8aad8cad --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD310.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD311.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD311.ser Binary files differnew file mode 100644 index 000000000..0d8f4cf1e --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD311.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD312.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD312.ser Binary files differnew file mode 100644 index 000000000..54d856156 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD312.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD313.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD313.ser Binary files differnew file mode 100644 index 000000000..5bd0e8286 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD313.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD314.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD314.ser Binary files differnew file mode 100644 index 000000000..37a4d8c68 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD314.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD315.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD315.ser Binary files differnew file mode 100644 index 000000000..a16a7b8f9 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD315.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD316.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD316.ser Binary files differnew file mode 100644 index 000000000..6e5747ed9 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD316.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD317.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD317.ser Binary files differnew file mode 100644 index 000000000..3ee6650ed --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD317.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD318.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD318.ser Binary files differnew file mode 100644 index 000000000..8c6f200a2 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD318.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD319.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD319.ser Binary files differnew file mode 100644 index 000000000..4774611b5 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD319.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD32.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD32.ser Binary files differnew file mode 100644 index 000000000..09332a05e --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD32.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD320.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD320.ser Binary files differnew file mode 100644 index 000000000..88327e077 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD320.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD321.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD321.ser Binary files differnew file mode 100644 index 000000000..600eb2ac3 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD321.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD322.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD322.ser Binary files differnew file mode 100644 index 000000000..eed01d875 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD322.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD323.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD323.ser Binary files differnew file mode 100644 index 000000000..cc2db9896 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD323.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD324.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD324.ser Binary files differnew file mode 100644 index 000000000..d0ae70999 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD324.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD325.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD325.ser Binary files differnew file mode 100644 index 000000000..eb2a30d19 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD325.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD326.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD326.ser Binary files differnew file mode 100644 index 000000000..5825c9571 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD326.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD327.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD327.ser Binary files differnew file mode 100644 index 000000000..c1b927a19 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD327.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD328.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD328.ser Binary files differnew file mode 100644 index 000000000..5d7eb7f7e --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD328.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD329.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD329.ser Binary files differnew file mode 100644 index 000000000..a78094615 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD329.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD33.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD33.ser Binary files differnew file mode 100644 index 000000000..efb28b562 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD33.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD330.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD330.ser Binary files differnew file mode 100644 index 000000000..686c66e20 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD330.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD331.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD331.ser Binary files differnew file mode 100644 index 000000000..b210f7896 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD331.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD332.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD332.ser Binary files differnew file mode 100644 index 000000000..da93f81fc --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD332.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD333.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD333.ser Binary files differnew file mode 100644 index 000000000..8a0f567f1 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD333.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD334.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD334.ser Binary files differnew file mode 100644 index 000000000..622bdd1e1 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD334.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD335.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD335.ser Binary files differnew file mode 100644 index 000000000..4baa13941 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD335.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD336.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD336.ser Binary files differnew file mode 100644 index 000000000..1d40b0818 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD336.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD337.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD337.ser Binary files differnew file mode 100644 index 000000000..ef0b76e42 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD337.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD338.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD338.ser Binary files differnew file mode 100644 index 000000000..bd0a0456f --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD338.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD339.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD339.ser Binary files differnew file mode 100644 index 000000000..73ee20cbe --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD339.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD34.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD34.ser Binary files differnew file mode 100644 index 000000000..9e33d39e9 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD34.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD340.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD340.ser Binary files differnew file mode 100644 index 000000000..6afa6bf7c --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD340.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD341.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD341.ser Binary files differnew file mode 100644 index 000000000..84782b980 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD341.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD342.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD342.ser Binary files differnew file mode 100644 index 000000000..fdde6d7a5 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD342.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD343.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD343.ser Binary files differnew file mode 100644 index 000000000..2654a884a --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD343.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD344.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD344.ser Binary files differnew file mode 100644 index 000000000..b24a2a444 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD344.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD345.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD345.ser Binary files differnew file mode 100644 index 000000000..613d80bee --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD345.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD346.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD346.ser Binary files differnew file mode 100644 index 000000000..df1df5fbf --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD346.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD347.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD347.ser Binary files differnew file mode 100644 index 000000000..3f68bd344 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD347.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD348.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD348.ser Binary files differnew file mode 100644 index 000000000..361734a3c --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD348.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD349.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD349.ser Binary files differnew file mode 100644 index 000000000..009e2419c --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD349.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD35.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD35.ser Binary files differnew file mode 100644 index 000000000..7c142c3e3 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD35.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD350.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD350.ser Binary files differnew file mode 100644 index 000000000..6e14a51a4 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD350.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD351.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD351.ser Binary files differnew file mode 100644 index 000000000..ed8f2450d --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD351.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD352.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD352.ser Binary files differnew file mode 100644 index 000000000..80489aa41 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD352.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD353.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD353.ser Binary files differnew file mode 100644 index 000000000..ede61bef1 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD353.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD354.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD354.ser Binary files differnew file mode 100644 index 000000000..e837ec5a6 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD354.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD355.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD355.ser Binary files differnew file mode 100644 index 000000000..0dbeb4a18 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD355.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD356.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD356.ser Binary files differnew file mode 100644 index 000000000..fdbc6a8f2 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD356.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD357.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD357.ser Binary files differnew file mode 100644 index 000000000..47665da0c --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD357.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD358.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD358.ser Binary files differnew file mode 100644 index 000000000..aae718782 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD358.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD359.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD359.ser Binary files differnew file mode 100644 index 000000000..5bc6e4083 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD359.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD36.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD36.ser Binary files differnew file mode 100644 index 000000000..07d3b8d15 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD36.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD360.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD360.ser Binary files differnew file mode 100644 index 000000000..81af1c964 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD360.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD361.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD361.ser Binary files differnew file mode 100644 index 000000000..4abfa7c14 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD361.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD362.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD362.ser Binary files differnew file mode 100644 index 000000000..aec3af860 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD362.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD363.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD363.ser Binary files differnew file mode 100644 index 000000000..ac1eecb96 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD363.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD364.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD364.ser Binary files differnew file mode 100644 index 000000000..1f1367be6 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD364.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD365.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD365.ser Binary files differnew file mode 100644 index 000000000..3cf337cda --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD365.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD366.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD366.ser Binary files differnew file mode 100644 index 000000000..19f7fd9e9 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD366.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD367.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD367.ser Binary files differnew file mode 100644 index 000000000..8c92df043 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD367.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD368.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD368.ser Binary files differnew file mode 100644 index 000000000..dad7f014b --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD368.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD369.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD369.ser Binary files differnew file mode 100644 index 000000000..b0022c672 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD369.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD37.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD37.ser Binary files differnew file mode 100644 index 000000000..bfbb586fb --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD37.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD370.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD370.ser Binary files differnew file mode 100644 index 000000000..b435feea0 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD370.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD371.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD371.ser Binary files differnew file mode 100644 index 000000000..dafe64d04 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD371.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD372.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD372.ser Binary files differnew file mode 100644 index 000000000..973fcdc92 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD372.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD373.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD373.ser Binary files differnew file mode 100644 index 000000000..a49d73cfe --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD373.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD374.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD374.ser Binary files differnew file mode 100644 index 000000000..892a50d1b --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD374.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD375.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD375.ser Binary files differnew file mode 100644 index 000000000..0fa29c84b --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD375.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD376.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD376.ser Binary files differnew file mode 100644 index 000000000..a29b52179 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD376.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD377.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD377.ser Binary files differnew file mode 100644 index 000000000..e7c2a5a36 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD377.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD378.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD378.ser Binary files differnew file mode 100644 index 000000000..0ec361014 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD378.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD379.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD379.ser Binary files differnew file mode 100644 index 000000000..bca795879 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD379.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD38.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD38.ser Binary files differnew file mode 100644 index 000000000..49ca3d106 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD38.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD380.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD380.ser Binary files differnew file mode 100644 index 000000000..0a340e65e --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD380.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD381.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD381.ser Binary files differnew file mode 100644 index 000000000..2e73aff87 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD381.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD382.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD382.ser Binary files differnew file mode 100644 index 000000000..d3a437077 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD382.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD383.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD383.ser Binary files differnew file mode 100644 index 000000000..963e0a877 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD383.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD384.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD384.ser Binary files differnew file mode 100644 index 000000000..092300f46 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD384.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD385.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD385.ser Binary files differnew file mode 100644 index 000000000..0c4c00312 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD385.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD386.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD386.ser Binary files differnew file mode 100644 index 000000000..9abf70ed9 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD386.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD387.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD387.ser Binary files differnew file mode 100644 index 000000000..7e518db09 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD387.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD388.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD388.ser Binary files differnew file mode 100644 index 000000000..797d08f9c --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD388.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD389.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD389.ser Binary files differnew file mode 100644 index 000000000..672e36e4a --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD389.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD39.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD39.ser Binary files differnew file mode 100644 index 000000000..de9d5aadb --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD39.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD390.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD390.ser Binary files differnew file mode 100644 index 000000000..44c076196 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD390.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD391.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD391.ser Binary files differnew file mode 100644 index 000000000..2706725f7 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD391.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD392.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD392.ser Binary files differnew file mode 100644 index 000000000..1cc61a4ed --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD392.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD393.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD393.ser Binary files differnew file mode 100644 index 000000000..33305fe62 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD393.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD394.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD394.ser Binary files differnew file mode 100644 index 000000000..278fb38d7 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD394.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD395.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD395.ser Binary files differnew file mode 100644 index 000000000..3d2ff817c --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD395.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD396.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD396.ser Binary files differnew file mode 100644 index 000000000..45833bacc --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD396.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD397.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD397.ser Binary files differnew file mode 100644 index 000000000..54e88ffc0 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD397.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD398.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD398.ser Binary files differnew file mode 100644 index 000000000..751b118a7 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD398.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD399.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD399.ser Binary files differnew file mode 100644 index 000000000..4acd804ca --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD399.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD4.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD4.ser Binary files differnew file mode 100644 index 000000000..c65761df1 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD4.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD40.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD40.ser Binary files differnew file mode 100644 index 000000000..d6759145b --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD40.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD400.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD400.ser Binary files differnew file mode 100644 index 000000000..4c9b21368 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD400.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD401.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD401.ser Binary files differnew file mode 100644 index 000000000..e3e6c6ec2 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD401.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD402.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD402.ser Binary files differnew file mode 100644 index 000000000..92e5a6187 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD402.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD403.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD403.ser Binary files differnew file mode 100644 index 000000000..873595ead --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD403.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD404.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD404.ser Binary files differnew file mode 100644 index 000000000..1709012da --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD404.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD405.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD405.ser Binary files differnew file mode 100644 index 000000000..5ad6315e3 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD405.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD406.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD406.ser Binary files differnew file mode 100644 index 000000000..aa04c95e2 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD406.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD407.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD407.ser Binary files differnew file mode 100644 index 000000000..12edd65ab --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD407.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD408.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD408.ser Binary files differnew file mode 100644 index 000000000..40290ec4c --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD408.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD409.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD409.ser Binary files differnew file mode 100644 index 000000000..b59671610 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD409.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD41.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD41.ser Binary files differnew file mode 100644 index 000000000..5d664e82c --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD41.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD410.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD410.ser Binary files differnew file mode 100644 index 000000000..9c5866504 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD410.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD411.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD411.ser Binary files differnew file mode 100644 index 000000000..01fe69955 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD411.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD412.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD412.ser Binary files differnew file mode 100644 index 000000000..b71d6c546 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD412.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD413.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD413.ser Binary files differnew file mode 100644 index 000000000..5ad3f0613 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD413.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD414.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD414.ser Binary files differnew file mode 100644 index 000000000..b89491a41 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD414.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD415.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD415.ser Binary files differnew file mode 100644 index 000000000..289f9b48d --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD415.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD416.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD416.ser Binary files differnew file mode 100644 index 000000000..24d1e1cbe --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD416.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD417.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD417.ser Binary files differnew file mode 100644 index 000000000..927349572 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD417.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD418.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD418.ser Binary files differnew file mode 100644 index 000000000..8208a5005 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD418.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD419.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD419.ser Binary files differnew file mode 100644 index 000000000..346fb131d --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD419.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD42.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD42.ser Binary files differnew file mode 100644 index 000000000..28c0e15e1 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD42.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD420.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD420.ser Binary files differnew file mode 100644 index 000000000..53d6b158d --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD420.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD421.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD421.ser Binary files differnew file mode 100644 index 000000000..c324000e4 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD421.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD422.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD422.ser Binary files differnew file mode 100644 index 000000000..d99423cbb --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD422.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD423.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD423.ser Binary files differnew file mode 100644 index 000000000..d78b800db --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD423.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD424.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD424.ser Binary files differnew file mode 100644 index 000000000..eabb33cc3 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD424.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD425.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD425.ser Binary files differnew file mode 100644 index 000000000..571728da3 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD425.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD426.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD426.ser Binary files differnew file mode 100644 index 000000000..25d9cb0aa --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD426.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD427.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD427.ser Binary files differnew file mode 100644 index 000000000..d493f3859 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD427.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD428.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD428.ser Binary files differnew file mode 100644 index 000000000..06b90d501 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD428.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD429.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD429.ser Binary files differnew file mode 100644 index 000000000..5b97f90ca --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD429.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD43.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD43.ser Binary files differnew file mode 100644 index 000000000..22b1b8d9b --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD43.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD430.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD430.ser Binary files differnew file mode 100644 index 000000000..db3749949 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD430.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD431.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD431.ser Binary files differnew file mode 100644 index 000000000..272364c6f --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD431.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD432.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD432.ser Binary files differnew file mode 100644 index 000000000..078a31f84 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD432.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD433.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD433.ser Binary files differnew file mode 100644 index 000000000..b4aaf015b --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD433.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD434.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD434.ser Binary files differnew file mode 100644 index 000000000..52c01f7e9 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD434.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD435.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD435.ser Binary files differnew file mode 100644 index 000000000..626e52df0 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD435.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD436.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD436.ser Binary files differnew file mode 100644 index 000000000..2de03dae5 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD436.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD437.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD437.ser Binary files differnew file mode 100644 index 000000000..041c1a4cf --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD437.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD438.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD438.ser Binary files differnew file mode 100644 index 000000000..c8da3b083 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD438.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD439.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD439.ser Binary files differnew file mode 100644 index 000000000..74f71d784 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD439.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD44.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD44.ser Binary files differnew file mode 100644 index 000000000..d1321181b --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD44.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD440.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD440.ser Binary files differnew file mode 100644 index 000000000..bcf11b73c --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD440.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD441.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD441.ser Binary files differnew file mode 100644 index 000000000..a9ba2dea1 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD441.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD442.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD442.ser Binary files differnew file mode 100644 index 000000000..fe728d89c --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD442.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD443.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD443.ser Binary files differnew file mode 100644 index 000000000..23d7eb22b --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD443.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD444.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD444.ser Binary files differnew file mode 100644 index 000000000..58f06cbce --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD444.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD445.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD445.ser Binary files differnew file mode 100644 index 000000000..bd56f8524 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD445.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD446.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD446.ser Binary files differnew file mode 100644 index 000000000..54d14da06 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD446.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD447.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD447.ser Binary files differnew file mode 100644 index 000000000..ee6f83422 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD447.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD448.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD448.ser Binary files differnew file mode 100644 index 000000000..f94d24f69 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD448.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD449.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD449.ser Binary files differnew file mode 100644 index 000000000..feef36694 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD449.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD45.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD45.ser Binary files differnew file mode 100644 index 000000000..93720aeac --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD45.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD450.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD450.ser Binary files differnew file mode 100644 index 000000000..d1a58aaa5 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD450.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD451.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD451.ser Binary files differnew file mode 100644 index 000000000..11f0d14b3 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD451.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD452.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD452.ser Binary files differnew file mode 100644 index 000000000..2aef6789e --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD452.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD453.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD453.ser Binary files differnew file mode 100644 index 000000000..e60e00a75 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD453.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD454.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD454.ser Binary files differnew file mode 100644 index 000000000..e7ed6f17e --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD454.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD455.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD455.ser Binary files differnew file mode 100644 index 000000000..49062bd27 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD455.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD456.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD456.ser Binary files differnew file mode 100644 index 000000000..5b4049240 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD456.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD457.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD457.ser Binary files differnew file mode 100644 index 000000000..c051bb336 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD457.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD458.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD458.ser Binary files differnew file mode 100644 index 000000000..bb781c485 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD458.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD459.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD459.ser Binary files differnew file mode 100644 index 000000000..289e7e587 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD459.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD46.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD46.ser Binary files differnew file mode 100644 index 000000000..c4b5db34b --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD46.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD460.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD460.ser Binary files differnew file mode 100644 index 000000000..bacc29cf6 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD460.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD461.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD461.ser Binary files differnew file mode 100644 index 000000000..d791c7d59 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD461.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD462.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD462.ser Binary files differnew file mode 100644 index 000000000..eac181fa5 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD462.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD463.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD463.ser Binary files differnew file mode 100644 index 000000000..4d4c36621 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD463.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD464.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD464.ser Binary files differnew file mode 100644 index 000000000..ab10d3c9d --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD464.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD465.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD465.ser Binary files differnew file mode 100644 index 000000000..ada0cfb53 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD465.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD466.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD466.ser Binary files differnew file mode 100644 index 000000000..b2f924cb4 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD466.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD467.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD467.ser Binary files differnew file mode 100644 index 000000000..4965ccab3 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD467.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD468.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD468.ser Binary files differnew file mode 100644 index 000000000..f04ae6182 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD468.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD469.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD469.ser Binary files differnew file mode 100644 index 000000000..27fc5e31f --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD469.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD47.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD47.ser Binary files differnew file mode 100644 index 000000000..dd2f2f73d --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD47.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD470.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD470.ser Binary files differnew file mode 100644 index 000000000..868c0718f --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD470.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD471.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD471.ser Binary files differnew file mode 100644 index 000000000..95ba064e9 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD471.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD472.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD472.ser Binary files differnew file mode 100644 index 000000000..ec1bcb735 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD472.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD473.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD473.ser Binary files differnew file mode 100644 index 000000000..d4bfab753 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD473.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD474.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD474.ser Binary files differnew file mode 100644 index 000000000..bf4de5393 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD474.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD475.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD475.ser Binary files differnew file mode 100644 index 000000000..b01e493df --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD475.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD476.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD476.ser Binary files differnew file mode 100644 index 000000000..247977216 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD476.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD477.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD477.ser Binary files differnew file mode 100644 index 000000000..0a4655675 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD477.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD478.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD478.ser Binary files differnew file mode 100644 index 000000000..7847c8b34 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD478.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD479.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD479.ser Binary files differnew file mode 100644 index 000000000..6ac093714 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD479.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD48.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD48.ser Binary files differnew file mode 100644 index 000000000..1fb8a568a --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD48.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD480.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD480.ser Binary files differnew file mode 100644 index 000000000..4f5ce8e37 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD480.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD481.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD481.ser Binary files differnew file mode 100644 index 000000000..b9cf2310e --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD481.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD482.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD482.ser Binary files differnew file mode 100644 index 000000000..d8cc78a39 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD482.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD483.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD483.ser Binary files differnew file mode 100644 index 000000000..44438e065 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD483.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD484.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD484.ser Binary files differnew file mode 100644 index 000000000..a6227255a --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD484.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD485.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD485.ser Binary files differnew file mode 100644 index 000000000..415f6c049 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD485.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD486.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD486.ser Binary files differnew file mode 100644 index 000000000..8ea2f93ad --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD486.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD487.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD487.ser Binary files differnew file mode 100644 index 000000000..ca7f77129 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD487.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD488.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD488.ser Binary files differnew file mode 100644 index 000000000..5aaf07824 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD488.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD489.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD489.ser Binary files differnew file mode 100644 index 000000000..655516191 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD489.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD49.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD49.ser Binary files differnew file mode 100644 index 000000000..3cc2d4a75 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD49.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD490.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD490.ser Binary files differnew file mode 100644 index 000000000..94f1d83fd --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD490.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD491.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD491.ser Binary files differnew file mode 100644 index 000000000..14b49f0a4 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD491.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD492.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD492.ser Binary files differnew file mode 100644 index 000000000..adb3d3737 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD492.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD493.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD493.ser Binary files differnew file mode 100644 index 000000000..b2c4902eb --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD493.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD494.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD494.ser Binary files differnew file mode 100644 index 000000000..8b28deac8 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD494.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD495.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD495.ser Binary files differnew file mode 100644 index 000000000..5d238271b --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD495.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD496.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD496.ser Binary files differnew file mode 100644 index 000000000..ab8f4d6d1 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD496.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD497.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD497.ser Binary files differnew file mode 100644 index 000000000..901e4173d --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD497.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD498.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD498.ser Binary files differnew file mode 100644 index 000000000..d6fd495bb --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD498.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD499.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD499.ser Binary files differnew file mode 100644 index 000000000..52400b507 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD499.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD5.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD5.ser Binary files differnew file mode 100644 index 000000000..4d03b7211 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD5.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD50.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD50.ser Binary files differnew file mode 100644 index 000000000..975618522 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD50.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD500.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD500.ser Binary files differnew file mode 100644 index 000000000..33e7b0c7d --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD500.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD501.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD501.ser Binary files differnew file mode 100644 index 000000000..8e101db57 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD501.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD502.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD502.ser Binary files differnew file mode 100644 index 000000000..f8246c2d2 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD502.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD503.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD503.ser Binary files differnew file mode 100644 index 000000000..c8707cd48 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD503.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD504.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD504.ser Binary files differnew file mode 100644 index 000000000..41e6c694a --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD504.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD505.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD505.ser Binary files differnew file mode 100644 index 000000000..595e24ff2 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD505.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD506.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD506.ser Binary files differnew file mode 100644 index 000000000..731b47fd2 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD506.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD507.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD507.ser Binary files differnew file mode 100644 index 000000000..8bf1d99fa --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD507.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD508.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD508.ser Binary files differnew file mode 100644 index 000000000..bc63d7e97 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD508.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD509.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD509.ser Binary files differnew file mode 100644 index 000000000..d7415c13a --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD509.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD51.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD51.ser Binary files differnew file mode 100644 index 000000000..e8d28148e --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD51.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD510.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD510.ser Binary files differnew file mode 100644 index 000000000..b94811af6 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD510.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD511.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD511.ser Binary files differnew file mode 100644 index 000000000..91a3bd4ea --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD511.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD512.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD512.ser Binary files differnew file mode 100644 index 000000000..2e31b49d8 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD512.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD513.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD513.ser Binary files differnew file mode 100644 index 000000000..2cef55911 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD513.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD514.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD514.ser Binary files differnew file mode 100644 index 000000000..84c1bdeb8 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD514.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD515.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD515.ser Binary files differnew file mode 100644 index 000000000..431fe2dd8 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD515.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD516.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD516.ser Binary files differnew file mode 100644 index 000000000..37c17f168 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD516.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD517.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD517.ser Binary files differnew file mode 100644 index 000000000..087847d57 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD517.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD518.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD518.ser Binary files differnew file mode 100644 index 000000000..8bd76318d --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD518.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD519.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD519.ser Binary files differnew file mode 100644 index 000000000..318fc84a7 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD519.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD52.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD52.ser Binary files differnew file mode 100644 index 000000000..5e853ec29 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD52.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD520.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD520.ser Binary files differnew file mode 100644 index 000000000..e72f8d30e --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD520.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD521.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD521.ser Binary files differnew file mode 100644 index 000000000..cbd161b83 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD521.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD522.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD522.ser Binary files differnew file mode 100644 index 000000000..a2c4ccff7 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD522.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD523.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD523.ser Binary files differnew file mode 100644 index 000000000..cbd7fa3b8 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD523.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD524.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD524.ser Binary files differnew file mode 100644 index 000000000..b876b1b27 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD524.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD525.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD525.ser Binary files differnew file mode 100644 index 000000000..64e50de82 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD525.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD526.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD526.ser Binary files differnew file mode 100644 index 000000000..e5f094eeb --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD526.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD527.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD527.ser Binary files differnew file mode 100644 index 000000000..537459e7f --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD527.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD528.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD528.ser Binary files differnew file mode 100644 index 000000000..577b66158 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD528.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD529.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD529.ser Binary files differnew file mode 100644 index 000000000..4679568f4 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD529.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD53.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD53.ser Binary files differnew file mode 100644 index 000000000..389261a05 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD53.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD530.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD530.ser Binary files differnew file mode 100644 index 000000000..635151fa9 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD530.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD531.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD531.ser Binary files differnew file mode 100644 index 000000000..69e85f02b --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD531.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD532.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD532.ser Binary files differnew file mode 100644 index 000000000..c28ba450a --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD532.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD533.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD533.ser Binary files differnew file mode 100644 index 000000000..fe26705e5 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD533.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD534.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD534.ser Binary files differnew file mode 100644 index 000000000..19595d9e3 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD534.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD535.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD535.ser Binary files differnew file mode 100644 index 000000000..95e9836b4 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD535.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD536.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD536.ser Binary files differnew file mode 100644 index 000000000..d179f7c8c --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD536.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD537.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD537.ser Binary files differnew file mode 100644 index 000000000..1b91641ad --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD537.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD538.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD538.ser Binary files differnew file mode 100644 index 000000000..fc83f4562 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD538.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD539.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD539.ser Binary files differnew file mode 100644 index 000000000..ea2af6364 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD539.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD54.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD54.ser Binary files differnew file mode 100644 index 000000000..0f76396bb --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD54.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD540.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD540.ser Binary files differnew file mode 100644 index 000000000..143d5894a --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD540.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD541.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD541.ser Binary files differnew file mode 100644 index 000000000..671cf26d1 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD541.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD542.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD542.ser Binary files differnew file mode 100644 index 000000000..1a7fda27b --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD542.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD543.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD543.ser Binary files differnew file mode 100644 index 000000000..5aee466d8 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD543.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD544.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD544.ser Binary files differnew file mode 100644 index 000000000..37f124113 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD544.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD545.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD545.ser Binary files differnew file mode 100644 index 000000000..8bc00e144 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD545.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD546.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD546.ser Binary files differnew file mode 100644 index 000000000..9d9b9c119 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD546.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD547.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD547.ser Binary files differnew file mode 100644 index 000000000..88411a216 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD547.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD548.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD548.ser Binary files differnew file mode 100644 index 000000000..f8324788b --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD548.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD549.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD549.ser Binary files differnew file mode 100644 index 000000000..2d3118a56 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD549.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD55.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD55.ser Binary files differnew file mode 100644 index 000000000..51a8b7095 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD55.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD550.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD550.ser Binary files differnew file mode 100644 index 000000000..e939d4754 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD550.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD551.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD551.ser Binary files differnew file mode 100644 index 000000000..61e5e3f3c --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD551.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD552.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD552.ser Binary files differnew file mode 100644 index 000000000..496e6912a --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD552.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD553.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD553.ser Binary files differnew file mode 100644 index 000000000..0fc2f1a23 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD553.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD554.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD554.ser Binary files differnew file mode 100644 index 000000000..dc5183342 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD554.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD555.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD555.ser Binary files differnew file mode 100644 index 000000000..de477db15 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD555.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD556.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD556.ser Binary files differnew file mode 100644 index 000000000..6a4e51c29 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD556.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD557.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD557.ser Binary files differnew file mode 100644 index 000000000..fccb593ae --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD557.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD558.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD558.ser Binary files differnew file mode 100644 index 000000000..828b3a72e --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD558.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD559.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD559.ser Binary files differnew file mode 100644 index 000000000..3b14d4a8f --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD559.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD56.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD56.ser Binary files differnew file mode 100644 index 000000000..373392279 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD56.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD560.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD560.ser Binary files differnew file mode 100644 index 000000000..a91b8512a --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD560.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD561.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD561.ser Binary files differnew file mode 100644 index 000000000..639a7be49 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD561.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD562.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD562.ser Binary files differnew file mode 100644 index 000000000..68dd4089b --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD562.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD563.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD563.ser Binary files differnew file mode 100644 index 000000000..2908e3f63 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD563.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD564.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD564.ser Binary files differnew file mode 100644 index 000000000..391e3e14a --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD564.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD565.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD565.ser Binary files differnew file mode 100644 index 000000000..5bd9c1e71 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD565.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD566.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD566.ser Binary files differnew file mode 100644 index 000000000..d4ecb3a88 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD566.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD567.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD567.ser Binary files differnew file mode 100644 index 000000000..d68ca24ac --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD567.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD568.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD568.ser Binary files differnew file mode 100644 index 000000000..73cd97bf6 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD568.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD569.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD569.ser Binary files differnew file mode 100644 index 000000000..a6d766289 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD569.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD57.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD57.ser Binary files differnew file mode 100644 index 000000000..d0af60722 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD57.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD570.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD570.ser Binary files differnew file mode 100644 index 000000000..231290df6 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD570.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD571.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD571.ser Binary files differnew file mode 100644 index 000000000..21e85e747 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD571.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD572.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD572.ser Binary files differnew file mode 100644 index 000000000..e99365766 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD572.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD573.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD573.ser Binary files differnew file mode 100644 index 000000000..4f844be2e --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD573.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD574.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD574.ser Binary files differnew file mode 100644 index 000000000..ccb6d70f1 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD574.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD575.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD575.ser Binary files differnew file mode 100644 index 000000000..aa3909601 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD575.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD576.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD576.ser Binary files differnew file mode 100644 index 000000000..5d1bb4981 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD576.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD577.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD577.ser Binary files differnew file mode 100644 index 000000000..64823ec47 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD577.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD578.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD578.ser Binary files differnew file mode 100644 index 000000000..09d6843e8 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD578.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD579.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD579.ser Binary files differnew file mode 100644 index 000000000..59f2572ad --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD579.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD58.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD58.ser Binary files differnew file mode 100644 index 000000000..cb600cfca --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD58.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD580.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD580.ser Binary files differnew file mode 100644 index 000000000..b1faa848b --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD580.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD581.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD581.ser Binary files differnew file mode 100644 index 000000000..1e057fdf4 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD581.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD582.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD582.ser Binary files differnew file mode 100644 index 000000000..cdd3cbec1 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD582.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD583.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD583.ser Binary files differnew file mode 100644 index 000000000..84eed41fe --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD583.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD584.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD584.ser Binary files differnew file mode 100644 index 000000000..7b91077fc --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD584.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD585.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD585.ser Binary files differnew file mode 100644 index 000000000..259194e4e --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD585.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD586.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD586.ser Binary files differnew file mode 100644 index 000000000..0616c3c12 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD586.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD587.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD587.ser Binary files differnew file mode 100644 index 000000000..22430bd97 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD587.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD588.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD588.ser Binary files differnew file mode 100644 index 000000000..b583a1a1b --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD588.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD589.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD589.ser Binary files differnew file mode 100644 index 000000000..841747bdf --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD589.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD59.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD59.ser Binary files differnew file mode 100644 index 000000000..23521f3cd --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD59.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD590.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD590.ser Binary files differnew file mode 100644 index 000000000..168552d3c --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD590.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD591.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD591.ser Binary files differnew file mode 100644 index 000000000..c0da95a76 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD591.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD592.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD592.ser Binary files differnew file mode 100644 index 000000000..276e0ffed --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD592.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD593.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD593.ser Binary files differnew file mode 100644 index 000000000..363f4f695 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD593.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD594.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD594.ser Binary files differnew file mode 100644 index 000000000..a0f6639ba --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD594.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD595.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD595.ser Binary files differnew file mode 100644 index 000000000..cdc9eb94a --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD595.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD596.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD596.ser Binary files differnew file mode 100644 index 000000000..c6223a7ce --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD596.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD597.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD597.ser Binary files differnew file mode 100644 index 000000000..74f023e83 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD597.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD598.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD598.ser Binary files differnew file mode 100644 index 000000000..9755e4a3c --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD598.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD599.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD599.ser Binary files differnew file mode 100644 index 000000000..986a332f3 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD599.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD6.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD6.ser Binary files differnew file mode 100644 index 000000000..edc35abdc --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD6.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD60.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD60.ser Binary files differnew file mode 100644 index 000000000..6ed639c5e --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD60.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD600.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD600.ser Binary files differnew file mode 100644 index 000000000..d2c52eba1 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD600.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD601.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD601.ser Binary files differnew file mode 100644 index 000000000..f34830970 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD601.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD602.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD602.ser Binary files differnew file mode 100644 index 000000000..7cea4a6c6 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD602.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD603.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD603.ser Binary files differnew file mode 100644 index 000000000..e2c08df91 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD603.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD604.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD604.ser Binary files differnew file mode 100644 index 000000000..7a37cd019 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD604.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD605.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD605.ser Binary files differnew file mode 100644 index 000000000..85f679da2 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD605.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD606.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD606.ser Binary files differnew file mode 100644 index 000000000..8f1d6966d --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD606.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD607.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD607.ser Binary files differnew file mode 100644 index 000000000..f82e37287 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD607.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD608.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD608.ser Binary files differnew file mode 100644 index 000000000..f22902dd5 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD608.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD609.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD609.ser Binary files differnew file mode 100644 index 000000000..bb7f98e41 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD609.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD61.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD61.ser Binary files differnew file mode 100644 index 000000000..d25cb04c7 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD61.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD610.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD610.ser Binary files differnew file mode 100644 index 000000000..8ddaeb744 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD610.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD611.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD611.ser Binary files differnew file mode 100644 index 000000000..b11de6c32 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD611.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD612.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD612.ser Binary files differnew file mode 100644 index 000000000..2b1ea8898 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD612.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD613.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD613.ser Binary files differnew file mode 100644 index 000000000..1d2ea017c --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD613.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD614.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD614.ser Binary files differnew file mode 100644 index 000000000..ae74ca063 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD614.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD615.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD615.ser Binary files differnew file mode 100644 index 000000000..fed68df6e --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD615.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD616.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD616.ser Binary files differnew file mode 100644 index 000000000..94b09c1e1 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD616.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD617.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD617.ser Binary files differnew file mode 100644 index 000000000..0af062be1 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD617.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD618.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD618.ser Binary files differnew file mode 100644 index 000000000..bd93b288c --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD618.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD619.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD619.ser Binary files differnew file mode 100644 index 000000000..ea7a544bf --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD619.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD62.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD62.ser Binary files differnew file mode 100644 index 000000000..c3510ec9e --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD62.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD620.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD620.ser Binary files differnew file mode 100644 index 000000000..c02164344 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD620.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD621.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD621.ser Binary files differnew file mode 100644 index 000000000..16cf973f2 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD621.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD63.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD63.ser Binary files differnew file mode 100644 index 000000000..f827db274 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD63.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD64.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD64.ser Binary files differnew file mode 100644 index 000000000..c079752d6 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD64.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD65.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD65.ser Binary files differnew file mode 100644 index 000000000..18d091c4a --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD65.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD66.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD66.ser Binary files differnew file mode 100644 index 000000000..2628ac645 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD66.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD67.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD67.ser Binary files differnew file mode 100644 index 000000000..e0a656874 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD67.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD68.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD68.ser Binary files differnew file mode 100644 index 000000000..cd908264a --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD68.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD69.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD69.ser Binary files differnew file mode 100644 index 000000000..da9a56794 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD69.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD7.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD7.ser Binary files differnew file mode 100644 index 000000000..1eec94eeb --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD7.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD70.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD70.ser Binary files differnew file mode 100644 index 000000000..1458485b6 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD70.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD71.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD71.ser Binary files differnew file mode 100644 index 000000000..0bb894af9 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD71.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD72.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD72.ser Binary files differnew file mode 100644 index 000000000..596af011c --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD72.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD73.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD73.ser Binary files differnew file mode 100644 index 000000000..adac3305c --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD73.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD74.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD74.ser Binary files differnew file mode 100644 index 000000000..1440bb78a --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD74.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD75.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD75.ser Binary files differnew file mode 100644 index 000000000..2a1091e9c --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD75.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD76.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD76.ser Binary files differnew file mode 100644 index 000000000..a519dc078 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD76.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD77.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD77.ser Binary files differnew file mode 100644 index 000000000..533579a8f --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD77.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD78.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD78.ser Binary files differnew file mode 100644 index 000000000..cd8bea1c7 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD78.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD79.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD79.ser Binary files differnew file mode 100644 index 000000000..16635b605 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD79.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD8.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD8.ser Binary files differnew file mode 100644 index 000000000..05616a937 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD8.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD80.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD80.ser Binary files differnew file mode 100644 index 000000000..44ce6375e --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD80.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD81.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD81.ser Binary files differnew file mode 100644 index 000000000..cfd698d7d --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD81.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD82.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD82.ser Binary files differnew file mode 100644 index 000000000..415f1bf8e --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD82.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD83.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD83.ser Binary files differnew file mode 100644 index 000000000..2fc94de93 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD83.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD84.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD84.ser Binary files differnew file mode 100644 index 000000000..a7e226ec1 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD84.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD85.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD85.ser Binary files differnew file mode 100644 index 000000000..573c8ce87 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD85.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD86.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD86.ser Binary files differnew file mode 100644 index 000000000..e8df233a5 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD86.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD87.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD87.ser Binary files differnew file mode 100644 index 000000000..abcad78d0 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD87.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD88.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD88.ser Binary files differnew file mode 100644 index 000000000..e702881e7 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD88.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD89.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD89.ser Binary files differnew file mode 100644 index 000000000..1b76a8499 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD89.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD9.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD9.ser Binary files differnew file mode 100644 index 000000000..13edb5406 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD9.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD90.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD90.ser Binary files differnew file mode 100644 index 000000000..da2ee39ec --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD90.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD91.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD91.ser Binary files differnew file mode 100644 index 000000000..7f9f0a3fd --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD91.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD92.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD92.ser Binary files differnew file mode 100644 index 000000000..6cbe89840 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD92.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD93.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD93.ser Binary files differnew file mode 100644 index 000000000..423f92310 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD93.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD94.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD94.ser Binary files differnew file mode 100644 index 000000000..331ba261f --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD94.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD95.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD95.ser Binary files differnew file mode 100644 index 000000000..0c4e54135 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD95.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD96.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD96.ser Binary files differnew file mode 100644 index 000000000..20afc295a --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD96.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD97.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD97.ser Binary files differnew file mode 100644 index 000000000..e801916f4 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD97.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD98.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD98.ser Binary files differnew file mode 100644 index 000000000..7fc398de9 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD98.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD99.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD99.ser Binary files differnew file mode 100644 index 000000000..5c7a0de21 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$LD99.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD0.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD0.ser Binary files differnew file mode 100644 index 000000000..f7b1fbed1 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD0.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD1.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD1.ser Binary files differnew file mode 100644 index 000000000..dc3634dec --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD1.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD10.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD10.ser Binary files differnew file mode 100644 index 000000000..a3108b43e --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD10.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD11.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD11.ser Binary files differnew file mode 100644 index 000000000..f561c2d2f --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD11.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD12.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD12.ser Binary files differnew file mode 100644 index 000000000..1dc99e434 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD12.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD13.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD13.ser Binary files differnew file mode 100644 index 000000000..e1b97d053 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD13.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD14.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD14.ser Binary files differnew file mode 100644 index 000000000..5600cbfa2 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD14.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD15.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD15.ser Binary files differnew file mode 100644 index 000000000..fe4068c42 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD15.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD16.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD16.ser Binary files differnew file mode 100644 index 000000000..59ad5e462 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD16.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD17.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD17.ser Binary files differnew file mode 100644 index 000000000..b11600cd0 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD17.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD18.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD18.ser Binary files differnew file mode 100644 index 000000000..5abc2b1b6 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD18.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD2.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD2.ser Binary files differnew file mode 100644 index 000000000..37814223f --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD2.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD3.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD3.ser Binary files differnew file mode 100644 index 000000000..58bb75a7f --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD3.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD4.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD4.ser Binary files differnew file mode 100644 index 000000000..f905fc364 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD4.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD5.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD5.ser Binary files differnew file mode 100644 index 000000000..0c1e74beb --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD5.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD6.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD6.ser Binary files differnew file mode 100644 index 000000000..1032043be --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD6.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD7.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD7.ser Binary files differnew file mode 100644 index 000000000..d0e34603a --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD7.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD8.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD8.ser Binary files differnew file mode 100644 index 000000000..4d47ada2d --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD8.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD9.ser b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD9.ser Binary files differnew file mode 100644 index 000000000..eb522634d --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData$TD9.ser diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData.java b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData.java new file mode 100644 index 000000000..49a5c9455 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestData.java @@ -0,0 +1,73 @@ +/* + * 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. + */ + +/* $Id: License.java 1039179 2010-11-25 21:04:09Z vhennebert $ */ + +package org.apache.fop.complexscripts.bidi; + +import java.io.IOException; +import java.io.InputStream; +import java.io.ObjectInputStream; + + +/* + * !!! THIS IS A GENERATED FILE !!! + * If updates to the source are needed, then: + * - apply the necessary modifications to + * 'src/codegen/unicode/java/org/apache/fop/text/bidi/GenerateBidiTestData.java' + * - run 'ant codegen-unicode', which will generate a new BidiTestData.java + * in 'test/java/org/apache/fop/complexscripts/bidi' + * - commit BOTH changed files + */ + +/** Bidirectional test data. */ +public final class BidiTestData { + + private BidiTestData() { + } + + public static final String TD_PFX = "TD"; + public static final int TD_CNT = 19; + + public static final String LD_PFX = "LD"; + public static final int LD_CNT = 622; + + public static final int NUM_TEST_SEQUENCES = 216357; + + public static int[] readTestData(String prefix, int index) { + int[] data = null; + InputStream is = null; + Class btc = BidiTestData.class; + String name = btc.getSimpleName() + "$" + prefix + index + ".ser"; + try { + if ((is = btc.getResourceAsStream(name)) != null) { + ObjectInputStream ois = new ObjectInputStream(is); + data = (int[]) ois.readObject(); + ois.close(); + } + } catch (IOException e) { + data = null; + } catch (ClassNotFoundException e) { + data = null; + } finally { + if (is != null) { + try { is.close(); } catch (Exception e) { /* NOP */ } + } + } + return data; + } +} diff --git a/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestSuite.java b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestSuite.java new file mode 100644 index 000000000..7a6a095c6 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/bidi/BidiTestSuite.java @@ -0,0 +1,35 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.complexscripts.bidi; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +/** + * Test suite for bidirectional functionality. + */ +@RunWith(Suite.class) +@SuiteClasses({ + BidiClassTestCase.class, + BidiAlgorithmTestCase.class +}) +public class BidiTestSuite { +} diff --git a/src/test/java/org/apache/fop/complexscripts/fonts/FontsTestSuite.java b/src/test/java/org/apache/fop/complexscripts/fonts/FontsTestSuite.java new file mode 100644 index 000000000..a7e4b0615 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/fonts/FontsTestSuite.java @@ -0,0 +1,39 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.complexscripts.fonts; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +import org.apache.fop.complexscripts.fonts.ttx.TTXFileTestCase; + +/** + * Test suite for fonts functionality related to complex scripts. + */ +@RunWith(Suite.class) +@SuiteClasses({ + TTXFileTestCase.class, + GDEFTestCase.class, + GSUBTestCase.class, + GPOSTestCase.class +}) +public class FontsTestSuite { +} diff --git a/src/test/java/org/apache/fop/complexscripts/fonts/GDEFTestCase.java b/src/test/java/org/apache/fop/complexscripts/fonts/GDEFTestCase.java new file mode 100644 index 000000000..f1512903c --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/fonts/GDEFTestCase.java @@ -0,0 +1,3170 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.complexscripts.fonts; + +import java.io.File; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import org.apache.fop.complexscripts.fonts.ttx.TTXFile; + +public class GDEFTestCase { + + private static String ttxFilesRoot = "test/resources/complexscripts"; + + private static String[][] ttxFonts = { + { "f0", "arab/ttx/arab-001.ttx" }, // simplified arabic + { "f1", "arab/ttx/arab-002.ttx" }, // traditional arabic + { "f2", "arab/ttx/arab-003.ttx" }, // lateef + { "f3", "arab/ttx/arab-004.ttx" }, // scheherazade + }; + + private static Object[][] ltGlyphClass = { + { GlyphDefinitionTable.GDEF_LOOKUP_TYPE_GLYPH_CLASS }, + // arab-001.ttx + { "f0", "lu0", + new String[][] { + { "a", "1" }, + { "aacute", "1" }, + { "acircumflex", "1" }, + { "acute", "1" }, + { "adieresis", "1" }, + { "ae", "1" }, + { "agrave", "1" }, + { "ain", "1" }, + { "ainfinal", "1" }, + { "aininitial", "1" }, + { "ainisolated", "1" }, + { "ainmedial", "1" }, + { "aleffinal", "1" }, + { "alefisolated", "1" }, + { "alefmaksura", "1" }, + { "alefmaksurafinal", "1" }, + { "alefmaksuraisolated", "1" }, + { "alefwasla", "1" }, + { "alefwaslafinal", "1" }, + { "alefwaslaisolated", "1" }, + { "alefwithfathatanfinal", "1" }, + { "alefwithfathatanisolated", "1" }, + { "alefwithhamzaabove", "1" }, + { "alefwithhamzaabovefinal", "1" }, + { "alefwithhamzaaboveisolated", "1" }, + { "alefwithhamzabelow", "1" }, + { "alefwithhamzabelowfinal", "1" }, + { "alefwithhamzabelowisolated", "1" }, + { "alefwithmaddaabove", "1" }, + { "alefwithmaddaabovefinal", "1" }, + { "alefwithmaddaaboveisolated", "1" }, + { "allahisolated", "2" }, + { "ampersand", "1" }, + { "arabicae", "1" }, + { "arabicalef", "1" }, + { "arabiccomma", "1" }, + { "arabicfivepointedstar", "1" }, + { "arabicindicdigiteight", "1" }, + { "arabicindicdigitfive", "1" }, + { "arabicindicdigitfour", "1" }, + { "arabicindicdigitnine", "1" }, + { "arabicindicdigitone", "1" }, + { "arabicindicdigitseven", "1" }, + { "arabicindicdigitsix", "1" }, + { "arabicindicdigitthree", "1" }, + { "arabicindicdigittwo", "1" }, + { "arabicindicdigitzero", "1" }, + { "arabickaf", "1" }, + { "arabicpercentsign", "1" }, + { "arabicquestionmark", "1" }, + { "arabicsemicolon", "1" }, + { "aring", "1" }, + { "asciicircum", "1" }, + { "asciitilde", "1" }, + { "asterisk", "1" }, + { "at", "1" }, + { "atilde", "1" }, + { "b", "1" }, + { "backslash", "1" }, + { "bar", "1" }, + { "beh", "1" }, + { "behisolated", "1" }, + { "behmedial", "1" }, + { "braceleft", "1" }, + { "braceright", "1" }, + { "bracketleft", "1" }, + { "bracketright", "1" }, + { "brokenbar", "1" }, + { "bullet", "1" }, + { "c", "1" }, + { "caron", "1" }, + { "ccedilla", "1" }, + { "cedilla", "1" }, + { "cent", "1" }, + { "circumflex", "1" }, + { "colon", "1" }, + { "comma", "1" }, + { "copyright", "1" }, + { "currency", "1" }, + { "d", "1" }, + { "dad", "1" }, + { "dadisolated", "1" }, + { "dadmedial", "1" }, + { "dagger", "1" }, + { "daggerdbl", "1" }, + { "dal", "1" }, + { "dalisolated", "1" }, + { "damma", "3" }, + { "dammahontatweel", "3" }, + { "dammaisolated", "3" }, + { "dammalow", "1" }, + { "dammaonhamza", "3" }, + { "dammatan", "3" }, + { "dammatanisolated", "3" }, + { "dammatanlow", "1" }, + { "dammatanonhamza", "3" }, + { "degree", "1" }, + { "delete", "1" }, + { "dieresis", "1" }, + { "divide", "1" }, + { "dollar", "1" }, + { "dotlessi", "1" }, + { "e", "1" }, + { "eacute", "1" }, + { "ecircumflex", "1" }, + { "edieresis", "1" }, + { "egrave", "1" }, + { "eight", "1" }, + { "ellipsis", "1" }, + { "endash", "1" }, + { "equal", "1" }, + { "eth", "1" }, + { "exclam", "1" }, + { "exclamdown", "1" }, + { "extendedarabicindicdigiteight", "1" }, + { "extendedarabicindicdigitfive", "1" }, + { "extendedarabicindicdigitfour", "1" }, + { "extendedarabicindicdigitnine", "1" }, + { "extendedarabicindicdigitone", "1" }, + { "extendedarabicindicdigitseven", "1" }, + { "extendedarabicindicdigitsix", "1" }, + { "extendedarabicindicdigitthree", "1" }, + { "extendedarabicindicdigittwo", "1" }, + { "extendedarabicindicdigitzero", "1" }, + { "f", "1" }, + { "farsiyeh", "1" }, + { "farsiyehfinal", "1" }, + { "farsiyehisolated", "1" }, + { "fatha", "3" }, + { "fathahontatweel", "3" }, + { "fathaisolated", "3" }, + { "fathalow", "1" }, + { "fathaonhamza", "3" }, + { "fathatan", "3" }, + { "fathatanisolated", "3" }, + { "fathatanlow", "1" }, + { "fathatanonhamza", "3" }, + { "fathatanontatweel", "1" }, + { "feh", "1" }, + { "fehinitial", "1" }, + { "fehisolated", "1" }, + { "fehmedial", "1" }, + { "five", "1" }, + { "florin", "1" }, + { "four", "1" }, + { "g", "1" }, + { "gaf", "1" }, + { "gaffinal", "1" }, + { "gafinitial", "1" }, + { "gafisolated", "1" }, + { "gafmedial", "1" }, + { "germandbls", "1" }, + { "ghain", "1" }, + { "ghainfinal", "1" }, + { "ghaininitial", "1" }, + { "ghainisolated", "1" }, + { "ghainmedial", "1" }, + { "glyph1", "1" }, + { "glyph2", "1" }, + { "glyph99", "1" }, + { "grave", "1" }, + { "greater", "1" }, + { "guillemotleft", "1" }, + { "guillemotright", "1" }, + { "guilsinglleft", "1" }, + { "guilsinglright", "1" }, + { "h", "1" }, + { "hah", "1" }, + { "hahfinal", "1" }, + { "hahisolated", "1" }, + { "hahmedial", "1" }, + { "hamza", "1" }, + { "hamzaisolated", "3" }, + { "heh", "1" }, + { "hehfinal", "1" }, + { "hehinitial", "1" }, + { "hehisolated", "1" }, + { "hehmedial", "1" }, + { "highhamza", "1" }, + { "hyphenminus", "1" }, + { "i", "1" }, + { "iacute", "1" }, + { "icircumflex", "1" }, + { "idieresis", "1" }, + { "igrave", "1" }, + { "j", "1" }, + { "jeem", "1" }, + { "jeemfinal", "1" }, + { "jeemisolated", "1" }, + { "jeemmedial", "1" }, + { "jeh", "1" }, + { "jehisolated", "1" }, + { "k", "1" }, + { "kafisolated", "1" }, + { "kafmedial", "1" }, + { "kasra", "3" }, + { "kasrahontatweel", "3" }, + { "kasraisolated", "3" }, + { "kasralow", "1" }, + { "kasratan", "3" }, + { "kasratanisolated", "3" }, + { "kasratanlow", "1" }, + { "keheh", "1" }, + { "kehehfinal", "1" }, + { "kehehinitial", "1" }, + { "kehehisolated", "1" }, + { "kehehmedial", "1" }, + { "khah", "1" }, + { "khahfinal", "1" }, + { "khahisolated", "1" }, + { "khahmedial", "1" }, + { "l", "1" }, + { "lam", "1" }, + { "lamisolated", "1" }, + { "lammedial", "1" }, + { "lamwithaleffinal", "2" }, + { "lamwithalefhamzaabovefinal", "2" }, + { "lamwithalefhamzaaboveisolatedd", "2" }, + { "lamwithalefhamzabelowfinal", "2" }, + { "lamwithalefhamzabelowisolated", "2" }, + { "lamwithalefisolated", "2" }, + { "lamwithalefmaddaabovefinal", "2" }, + { "lamwithalefmaddaaboveisolatedd", "2" }, + { "lamwithmeemwithjeeminitial", "1" }, + { "lefttoright", "1" }, + { "less", "1" }, + { "logicalnot", "1" }, + { "m", "1" }, + { "macron", "1" }, + { "meem", "1" }, + { "meemisolated", "1" }, + { "meemmedial", "1" }, + { "micro", "1" }, + { "multiply", "1" }, + { "n", "1" }, + { "nbspace", "1" }, + { "nine", "1" }, + { "noon", "1" }, + { "noonisolated", "1" }, + { "noonmedial", "1" }, + { "ntilde", "1" }, + { "numbersign", "1" }, + { "o", "1" }, + { "oacute", "1" }, + { "ocircumflex", "1" }, + { "odieresis", "1" }, + { "oe", "1" }, + { "ograve", "1" }, + { "one", "1" }, + { "onehalf", "1" }, + { "onequarter", "1" }, + { "onesuperior", "1" }, + { "ordfeminine", "1" }, + { "ordmasculine", "1" }, + { "ornateleftparenthesis", "1" }, + { "ornaterightparenthesis", "1" }, + { "oslash", "1" }, + { "otilde", "1" }, + { "p", "1" }, + { "paragraph", "1" }, + { "parenleft", "1" }, + { "parenright", "1" }, + { "peh", "1" }, + { "pehisolated", "1" }, + { "pehmedial", "1" }, + { "percent", "1" }, + { "period", "1" }, + { "periodcentered", "1" }, + { "perthousand", "1" }, + { "plus", "1" }, + { "plusminus", "1" }, + { "q", "1" }, + { "qaf", "1" }, + { "qafinitial", "1" }, + { "qafisolated", "1" }, + { "qafmedial", "1" }, + { "question", "1" }, + { "questiondown", "1" }, + { "quotedash", "1" }, + { "quotedbl", "1" }, + { "quotedblbase", "1" }, + { "quotedblleft", "1" }, + { "quotedblright", "1" }, + { "quoteleft", "1" }, + { "quoteright", "1" }, + { "quotesinglbase", "1" }, + { "quotesingle", "1" }, + { "r", "1" }, + { "rayaleflam", "2" }, + { "registered", "1" }, + { "reh", "1" }, + { "rehisolated", "1" }, + { "righttoleft", "1" }, + { "s", "1" }, + { "sad", "1" }, + { "sadisolated", "1" }, + { "sadmedial", "1" }, + { "scaron", "1" }, + { "section", "1" }, + { "seen", "1" }, + { "seenisolated", "1" }, + { "seenmedial", "1" }, + { "semicolon", "1" }, + { "seven", "1" }, + { "sfthyphen", "1" }, + { "shadda", "3" }, + { "shaddahontatweel", "3" }, + { "shaddaisolated", "3" }, + { "shaddalow", "1" }, + { "shaddawithdammaisolated", "3" }, + { "shaddawithdammalow", "3" }, + { "shaddawithdammamedial", "1" }, + { "shaddawithdammatanisolated", "1" }, + { "shaddawithdammatanlow", "3" }, + { "shaddawithfathaisolated", "3" }, + { "shaddawithfathalow", "3" }, + { "shaddawithfathamedial", "1" }, + { "shaddawithfathatanisolated", "1" }, + { "shaddawithfathatanlow", "3" }, + { "shaddawithkasraisolated", "3" }, + { "shaddawithkasralow", "3" }, + { "shaddawithkasramedial", "1" }, + { "shaddawithkasratanisolated", "1" }, + { "shaddawithkasratanlow", "3" }, + { "sheen", "1" }, + { "sheenisolated", "1" }, + { "sheenmedial", "1" }, + { "six", "1" }, + { "slash", "1" }, + { "smallhighmadda", "3" }, + { "space", "1" }, + { "sterling", "1" }, + { "sukun", "3" }, + { "sukunisolated", "3" }, + { "sukunlow", "1" }, + { "sukunonhamza", "3" }, + { "sukunontatweel", "3" }, + { "superscriptalef", "3" }, + { "t", "1" }, + { "tah", "1" }, + { "tahisolated", "1" }, + { "tatweel", "1" }, + { "tcheh", "1" }, + { "tchehfinal", "1" }, + { "tchehisolated", "1" }, + { "tchehmedial", "1" }, + { "teh", "1" }, + { "tehisolated", "1" }, + { "tehmarbuta", "1" }, + { "tehmarbutafinal", "1" }, + { "tehmarbutaisolated", "1" }, + { "tehmedial", "1" }, + { "thal", "1" }, + { "thalisolated", "1" }, + { "theh", "1" }, + { "thehisolated", "1" }, + { "thehmedial", "1" }, + { "thorn", "1" }, + { "three", "1" }, + { "threequarters", "1" }, + { "threesuperior", "1" }, + { "tilde", "1" }, + { "trademark", "1" }, + { "two", "1" }, + { "twosuperior", "1" }, + { "u", "1" }, + { "uacute", "1" }, + { "ucircumflex", "1" }, + { "udieresis", "1" }, + { "ugrave", "1" }, + { "underscore", "1" }, + { "uni000D", "1" }, + { "uni0649.init", "1" }, + { "uni0654", "3" }, + { "uni0655", "3" }, + { "uni0655064D", "3" }, + { "uni06550650", "3" }, + { "uni06A5.init", "1" }, + { "uni25CC", "1" }, + { "v", "1" }, + { "veh", "1" }, + { "vehisolated", "1" }, + { "vehmedial", "1" }, + { "w", "1" }, + { "waw", "1" }, + { "wawisolated", "1" }, + { "wawwithhamzaabove", "1" }, + { "wawwithhamzaaboveisolated", "1" }, + { "x", "1" }, + { "y", "1" }, + { "yacute", "1" }, + { "ydieresis", "1" }, + { "yeh", "1" }, + { "yehfinal", "1" }, + { "yehisolated", "1" }, + { "yehmedial", "1" }, + { "yehwithhamzaabove", "1" }, + { "yehwithhamzaabovefinal", "1" }, + { "yehwithhamzaaboveisolated", "1" }, + { "yehwithhamzaabovemedial", "1" }, + { "yen", "1" }, + { "z", "1" }, + { "zah", "1" }, + { "zahisolated", "1" }, + { "zain", "1" }, + { "zainisolated", "1" }, + { "zcaron", "1" }, + { "zero", "1" }, + { "zerojoin", "1" }, + { "zeronojoin", "1" }, + { "zerowidthnobreakspace", "1" }, + }, + }, + // arab-002.ttx + { "f1", "lu0", + new String[][] { + { "a", "1" }, + { "aacute", "1" }, + { "acircumflex", "1" }, + { "acute", "1" }, + { "adieresis", "1" }, + { "ae", "1" }, + { "agrave", "1" }, + { "ain", "1" }, + { "ainfinal", "1" }, + { "aininitial", "1" }, + { "ainisolated", "1" }, + { "ainmedial", "1" }, + { "aleffinal", "1" }, + { "alefisolated", "1" }, + { "alefmaksura", "1" }, + { "alefmaksurafinal", "1" }, + { "alefmaksuraisolated", "1" }, + { "alefwasla", "1" }, + { "alefwaslafinal", "1" }, + { "alefwaslaisolated", "1" }, + { "alefwithfathatanfinal", "1" }, + { "alefwithfathatanisolated", "1" }, + { "alefwithhamzaabove", "1" }, + { "alefwithhamzaabovefinal", "1" }, + { "alefwithhamzaaboveisolated", "1" }, + { "alefwithhamzabelow", "1" }, + { "alefwithhamzabelowfinal", "1" }, + { "alefwithhamzabelowisolated", "1" }, + { "alefwithmaddaabove", "1" }, + { "alefwithmaddaabovefinal", "1" }, + { "alefwithmaddaaboveisolated", "1" }, + { "allahisolated", "2" }, + { "ampersand", "1" }, + { "arabicae", "1" }, + { "arabicalef", "1" }, + { "arabiccomma", "1" }, + { "arabicfivepointedstar", "3" }, + { "arabicindicdigiteight", "1" }, + { "arabicindicdigitfive", "1" }, + { "arabicindicdigitfour", "1" }, + { "arabicindicdigitnine", "1" }, + { "arabicindicdigitone", "1" }, + { "arabicindicdigitseven", "1" }, + { "arabicindicdigitsix", "1" }, + { "arabicindicdigitthree", "1" }, + { "arabicindicdigittwo", "1" }, + { "arabicindicdigitzero", "1" }, + { "arabickaf", "1" }, + { "arabickaffinal", "1" }, + { "arabicpercentsign", "1" }, + { "arabicquestionmark", "1" }, + { "arabicsemicolon", "1" }, + { "aring", "1" }, + { "asciicircum", "1" }, + { "asciitilde", "1" }, + { "asterisk", "1" }, + { "at", "1" }, + { "atilde", "1" }, + { "b", "1" }, + { "backslash", "1" }, + { "bar", "1" }, + { "beh", "1" }, + { "behfinal", "1" }, + { "behinitial", "1" }, + { "behisolated", "1" }, + { "behmedial", "1" }, + { "behwithalefmaksurafinal", "2" }, + { "behwithalefmaksuraisolated", "2" }, + { "behwithhahinitial", "2" }, + { "behwithhehinitial", "2" }, + { "behwithjeeminitial", "2" }, + { "behwithkhahinitial", "2" }, + { "behwithmeeminitial", "2" }, + { "behwithmeemisolated", "2" }, + { "behwithnoonfinal", "2" }, + { "behwithrehfinal", "2" }, + { "behwithyehfinal", "2" }, + { "behwithyehisolated", "2" }, + { "braceleft", "1" }, + { "braceright", "1" }, + { "bracketleft", "1" }, + { "bracketright", "1" }, + { "brokenbar", "1" }, + { "bullet", "1" }, + { "c", "1" }, + { "caron", "1" }, + { "ccedilla", "1" }, + { "cedilla", "1" }, + { "cent", "1" }, + { "circumflex", "1" }, + { "colon", "1" }, + { "comma", "1" }, + { "copyright", "1" }, + { "currency", "1" }, + { "d", "1" }, + { "dad", "1" }, + { "dadfinal", "1" }, + { "dadinitial", "1" }, + { "dadisolated", "1" }, + { "dadmedial", "1" }, + { "dagger", "1" }, + { "daggerdbl", "1" }, + { "dal", "1" }, + { "dalfinal", "1" }, + { "dalisolated", "1" }, + { "damma", "3" }, + { "dammahontatweel", "1" }, + { "dammaisolated", "1" }, + { "dammalow", "1" }, + { "dammaonhamza", "3" }, + { "dammatan", "3" }, + { "dammatanisolated", "1" }, + { "dammatanlow", "1" }, + { "dammatanonhamza", "3" }, + { "degree", "1" }, + { "delete", "1" }, + { "dieresis", "1" }, + { "divide", "1" }, + { "dollar", "1" }, + { "dotlessi", "1" }, + { "e", "1" }, + { "eacute", "1" }, + { "ecircumflex", "1" }, + { "edieresis", "1" }, + { "egrave", "1" }, + { "eight", "1" }, + { "ellipsis", "1" }, + { "endash", "1" }, + { "equal", "1" }, + { "eth", "1" }, + { "exclam", "1" }, + { "exclamdown", "1" }, + { "extendedarabicindicdigiteight", "1" }, + { "extendedarabicindicdigitfive", "1" }, + { "extendedarabicindicdigitfour", "1" }, + { "extendedarabicindicdigitnine", "1" }, + { "extendedarabicindicdigitone", "1" }, + { "extendedarabicindicdigitseven", "1" }, + { "extendedarabicindicdigitsix", "1" }, + { "extendedarabicindicdigitthree", "1" }, + { "extendedarabicindicdigittwo", "1" }, + { "extendedarabicindicdigitzero", "1" }, + { "f", "1" }, + { "farsiyeh", "1" }, + { "farsiyehfinal", "1" }, + { "farsiyehisolated", "1" }, + { "fatha", "3" }, + { "fathahontatweel", "1" }, + { "fathaisolated", "1" }, + { "fathalow", "1" }, + { "fathaonhamza", "3" }, + { "fathatan", "3" }, + { "fathatanisolated", "1" }, + { "fathatanlow", "1" }, + { "fathatanonhamza", "3" }, + { "fathatanontatweel", "1" }, + { "feh", "1" }, + { "fehfinal", "1" }, + { "fehinitial", "1" }, + { "fehisolated", "1" }, + { "fehmedial", "1" }, + { "fehwithalefmaksuraisolated", "2" }, + { "fehwithyehisolated", "2" }, + { "five", "1" }, + { "florin", "1" }, + { "four", "1" }, + { "g", "1" }, + { "gaf", "1" }, + { "gaffinal", "1" }, + { "gafinitial", "1" }, + { "gafisolated", "1" }, + { "gafmedial", "1" }, + { "germandbls", "1" }, + { "ghain", "1" }, + { "ghainfinal", "1" }, + { "ghaininitial", "1" }, + { "ghainisolated", "1" }, + { "ghainmedial", "1" }, + { "grave", "1" }, + { "greater", "1" }, + { "guillemotleft", "1" }, + { "guillemotright", "1" }, + { "guilsinglleft", "1" }, + { "guilsinglright", "1" }, + { "h", "1" }, + { "hah", "1" }, + { "hahfinal", "1" }, + { "hahinitial", "1" }, + { "hahisolated", "1" }, + { "hahmedial", "1" }, + { "hahwithmeeminitial", "2" }, + { "hamza", "1" }, + { "hamzaisolated", "1" }, + { "heh", "1" }, + { "hehfinal", "1" }, + { "hehinitial", "1" }, + { "hehisolated", "1" }, + { "hehmedial", "1" }, + { "hehwithmeeminitial", "2" }, + { "highhamza", "1" }, + { "hyphenminus", "1" }, + { "i", "1" }, + { "iacute", "1" }, + { "icircumflex", "1" }, + { "idieresis", "1" }, + { "igrave", "1" }, + { "j", "1" }, + { "jeem", "1" }, + { "jeemfinal", "1" }, + { "jeeminitial", "1" }, + { "jeemisolated", "1" }, + { "jeemmedial", "1" }, + { "jeemwithmeeminitial", "2" }, + { "jeh", "1" }, + { "jehfinal", "1" }, + { "jehisolated", "1" }, + { "k", "1" }, + { "kafinitial", "1" }, + { "kafisolated", "1" }, + { "kafmedial", "1" }, + { "kasra", "3" }, + { "kasrahontatweel", "1" }, + { "kasraisolated", "1" }, + { "kasralow", "1" }, + { "kasratan", "3" }, + { "kasratanisolated", "1" }, + { "kasratanlow", "1" }, + { "keheh", "1" }, + { "kehehfinal", "1" }, + { "kehehinitial", "1" }, + { "kehehisolated", "1" }, + { "kehehmedial", "1" }, + { "khah", "1" }, + { "khahfinal", "1" }, + { "khahinitial", "1" }, + { "khahisolated", "1" }, + { "khahmedial", "1" }, + { "khahwithmeeminitial", "2" }, + { "l", "1" }, + { "lam", "1" }, + { "lamfinal", "1" }, + { "laminitial", "1" }, + { "lamisolated", "1" }, + { "lammedial", "1" }, + { "lamwithaleffinal", "2" }, + { "lamwithalefhamzaabovefinal", "2" }, + { "lamwithalefhamzaaboveisolatedd", "2" }, + { "lamwithalefhamzabelowfinal", "2" }, + { "lamwithalefhamzabelowisolated", "2" }, + { "lamwithalefisolated", "2" }, + { "lamwithalefmaddaabovefinal", "2" }, + { "lamwithalefmaddaaboveisolatedd", "2" }, + { "lamwithalefmaksuraisolated", "2" }, + { "lamwithhahinitial", "2" }, + { "lamwithhahisolated", "2" }, + { "lamwithhehinitial", "2" }, + { "lamwithjeeminitial", "2" }, + { "lamwithjeemisolated", "2" }, + { "lamwithkhahinitial", "2" }, + { "lamwithkhahisolated", "2" }, + { "lamwithmeeminitial", "2" }, + { "lamwithmeemisolated", "2" }, + { "lamwithmeemwithhahinitial", "2" }, + { "lamwithmeemwithjeeminitial", "2" }, + { "lamwithyehisolated", "2" }, + { "lefttoright", "1" }, + { "less", "1" }, + { "logicalnot", "1" }, + { "m", "1" }, + { "macron", "1" }, + { "meem", "1" }, + { "meemfinal", "1" }, + { "meeminitial", "1" }, + { "meemisolated", "1" }, + { "meemmedial", "1" }, + { "meemwithhahinitial", "2" }, + { "meemwithjeeminitial", "2" }, + { "meemwithkhahinitial", "2" }, + { "meemwithmeeminitial", "2" }, + { "micro", "1" }, + { "multiply", "1" }, + { "n", "1" }, + { "nine", "1" }, + { "nonbreakingspace", "1" }, + { "nonmarkingreturn", "1" }, + { "noon", "1" }, + { "noonfinal", "1" }, + { "nooninitial", "1" }, + { "noonisolated", "1" }, + { "noonmedial", "1" }, + { "noonwithalefmaksurafinal", "2" }, + { "noonwithalefmaksuraisolated", "2" }, + { "noonwithhahinitial", "2" }, + { "noonwithhehinitial", "2" }, + { "noonwithjeeminitial", "2" }, + { "noonwithkhahinitial", "2" }, + { "noonwithmeeminitial", "2" }, + { "noonwithmeemisolated", "2" }, + { "noonwithyehfinal", "2" }, + { "noonwithyehisolated", "2" }, + { "noonwithzainfinal", "2" }, + { "ntilde", "1" }, + { "numbersign", "1" }, + { "o", "1" }, + { "oacute", "1" }, + { "ocircumflex", "1" }, + { "odieresis", "1" }, + { "oe", "1" }, + { "ograve", "1" }, + { "one", "1" }, + { "onehalf", "1" }, + { "onequarter", "1" }, + { "onesuperior", "1" }, + { "ordfeminine", "1" }, + { "ordmasculine", "1" }, + { "ornateleftparenthesis", "1" }, + { "ornaterightparenthesis", "1" }, + { "oslash", "1" }, + { "otilde", "1" }, + { "p", "1" }, + { "paragraph", "1" }, + { "parenleft", "1" }, + { "parenright", "1" }, + { "peh", "1" }, + { "pehfinal", "1" }, + { "pehinitial", "1" }, + { "pehisolated", "1" }, + { "pehmedial", "1" }, + { "pehwithhehinitial", "2" }, + { "percent", "1" }, + { "period", "1" }, + { "periodcentered", "1" }, + { "perthousand", "1" }, + { "plus", "1" }, + { "plusminus", "1" }, + { "q", "1" }, + { "qaf", "1" }, + { "qaffinal", "1" }, + { "qafinitial", "1" }, + { "qafisolated", "1" }, + { "qafmedial", "1" }, + { "question", "1" }, + { "questiondown", "1" }, + { "quotedash", "1" }, + { "quotedbl", "1" }, + { "quotedblbase", "1" }, + { "quotedblleft", "1" }, + { "quotedblright", "1" }, + { "quoteleft", "1" }, + { "quoteright", "1" }, + { "quotesinglbase", "1" }, + { "quotesingle", "1" }, + { "r", "1" }, + { "rayaleflam", "2" }, + { "registered", "1" }, + { "reh", "1" }, + { "rehfinal", "1" }, + { "rehisolated", "1" }, + { "righttoleft", "1" }, + { "s", "1" }, + { "sad", "1" }, + { "sadfinal", "1" }, + { "sadinitial", "1" }, + { "sadisolated", "1" }, + { "sadmedial", "1" }, + { "scaron", "1" }, + { "section", "1" }, + { "seen", "1" }, + { "seenfinal", "1" }, + { "seeninitial", "1" }, + { "seenisolated", "1" }, + { "seenmedial", "1" }, + { "seenwithmeeminitial", "2" }, + { "semicolon", "1" }, + { "seven", "1" }, + { "sfthyphen", "1" }, + { "shadda", "3" }, + { "shaddahontatweel", "1" }, + { "shaddaisolated", "1" }, + { "shaddalow", "1" }, + { "shaddawithdammaisolated", "1" }, + { "shaddawithdammaisolatedlow", "3" }, + { "shaddawithdammamedial", "1" }, + { "shaddawithdammatanisolated", "1" }, + { "shaddawithdammatanisolatedlow", "3" }, + { "shaddawithfathaisolated", "1" }, + { "shaddawithfathaisolatedlow", "3" }, + { "shaddawithfathamedial", "1" }, + { "shaddawithfathatanisolated", "3" }, + { "shaddawithfathatanisolatedlow", "3" }, + { "shaddawithkasraisolated", "1" }, + { "shaddawithkasraisolatedlow", "3" }, + { "shaddawithkasramedial", "1" }, + { "shaddawithkasratanisolated", "1" }, + { "shaddawithkasratanisolatedlow", "3" }, + { "sheen", "1" }, + { "sheenfinal", "1" }, + { "sheeninitial", "1" }, + { "sheenisolated", "1" }, + { "sheenmedial", "1" }, + { "sheenwithmeeminitial", "2" }, + { "six", "1" }, + { "slash", "1" }, + { "smallhighmadda", "3" }, + { "space", "1" }, + { "sterling", "1" }, + { "sukun", "3" }, + { "sukunisolated", "1" }, + { "sukunlow", "1" }, + { "sukunonhamza", "3" }, + { "sukunontatweel", "1" }, + { "superscriptalef", "3" }, + { "t", "1" }, + { "tah", "1" }, + { "tahfinal", "1" }, + { "tahinitial", "1" }, + { "tahisolated", "1" }, + { "tahmedial", "1" }, + { "tatweel", "1" }, + { "tcheh", "1" }, + { "tchehfinal", "1" }, + { "tchehinitial", "1" }, + { "tchehisolated", "1" }, + { "tchehmedial", "1" }, + { "teh", "1" }, + { "tehfinal", "1" }, + { "tehinitial", "1" }, + { "tehisolated", "1" }, + { "tehmarbuta", "1" }, + { "tehmarbutafinal", "1" }, + { "tehmarbutaisolated", "1" }, + { "tehmedial", "1" }, + { "tehwithalefmaksurafinal", "2" }, + { "tehwithhahinitial", "2" }, + { "tehwithhehinitial", "2" }, + { "tehwithjeeminitial", "2" }, + { "tehwithkhahinitial", "2" }, + { "tehwithmeeminitial", "2" }, + { "tehwithmeemisolated", "2" }, + { "tehwithnoonfinal", "2" }, + { "tehwithyehfinal", "2" }, + { "tehwithyehisolated", "2" }, + { "thal", "1" }, + { "thalfinal", "1" }, + { "thalisolated", "1" }, + { "theh", "1" }, + { "thehfinal", "1" }, + { "thehinitial", "1" }, + { "thehisolated", "1" }, + { "thehmedial", "1" }, + { "thehwithmeeminitial", "2" }, + { "thehwithmeemisolated", "2" }, + { "thorn", "1" }, + { "three", "1" }, + { "threequarters", "1" }, + { "threesuperior", "1" }, + { "tilde", "1" }, + { "trademark", "1" }, + { "two", "1" }, + { "twosuperior", "1" }, + { "u", "1" }, + { "uacute", "1" }, + { "ucircumflex", "1" }, + { "udieresis", "1" }, + { "ugrave", "1" }, + { "underscore", "1" }, + { "uni000D", "1" }, + { "uni0649.init", "1" }, + { "uni0649.medi", "1" }, + { "uni0654", "3" }, + { "uni0655", "3" }, + { "uni0655064D", "3" }, + { "uni06550650", "3" }, + { "uni25CC", "1" }, + { "uniE817", "2" }, + { "v", "1" }, + { "veh", "1" }, + { "vehfinal", "1" }, + { "vehinitial", "1" }, + { "vehisolated", "1" }, + { "vehmedial", "1" }, + { "w", "1" }, + { "waw", "1" }, + { "wawfinal", "1" }, + { "wawisolated", "1" }, + { "wawwithhamzaabove", "1" }, + { "wawwithhamzaabovefinal", "1" }, + { "wawwithhamzaaboveisolated", "1" }, + { "x", "1" }, + { "y", "1" }, + { "yacute", "1" }, + { "ydieresis", "1" }, + { "yeh", "1" }, + { "yehfinal", "1" }, + { "yehinitial", "1" }, + { "yehisolated", "1" }, + { "yehmedial", "1" }, + { "yehwithalefmaksurafinal", "2" }, + { "yehwithalefmaksuraisolated", "2" }, + { "yehwithhahinitial", "2" }, + { "yehwithhamzaabove", "1" }, + { "yehwithhamzaabovefinal", "1" }, + { "yehwithhamzaaboveinitial", "1" }, + { "yehwithhamzaaboveisolated", "1" }, + { "yehwithhamzaabovemedial", "1" }, + { "yehwithjeeminitial", "2" }, + { "yehwithkhahinitial", "2" }, + { "yehwithmeeminitial", "2" }, + { "yehwithmeemisolated", "2" }, + { "yehwithnoonfinal", "2" }, + { "yehwithrehfinal", "2" }, + { "yen", "1" }, + { "z", "1" }, + { "zah", "1" }, + { "zahfinal", "1" }, + { "zahinitial", "1" }, + { "zahisolated", "1" }, + { "zahmedial", "1" }, + { "zain", "1" }, + { "zainfinal", "1" }, + { "zainisolated", "1" }, + { "zcaron", "1" }, + { "zero", "1" }, + { "zerojoin", "1" }, + { "zeronojoin", "1" }, + { "zerowidthnobreakspace", "1" }, + }, + }, + // arab-003.ttx + { "f2", "lu0", + new String[][] { + { "_bar", "1" }, + { "_damma", "1" }, + { "_dot1", "1" }, + { "_dot1_hat", "1" }, + { "_dot1_smallV", "1" }, + { "_dot1_tah", "1" }, + { "_dot2h", "1" }, + { "_dot2h_tah", "1" }, + { "_dot2v", "1" }, + { "_dot3d", "1" }, + { "_dot3h", "1" }, + { "_dot3u", "1" }, + { "_dot3u_tah", "1" }, + { "_dot4", "1" }, + { "_gafBar", "1" }, + { "_gafBar_dot2h", "1" }, + { "_gafBar_dot3u", "1" }, + { "_hamza", "1" }, + { "_hamzaDamma", "1" }, + { "_hat", "1" }, + { "_highHamza", "1" }, + { "_hook", "1" }, + { "_invSmallV", "1" }, + { "_lines", "1" }, + { "_madda", "1" }, + { "_ring", "1" }, + { "_smallV", "1" }, + { "_tah", "1" }, + { "_vline", "1" }, + { "_wasla", "1" }, + { "_wavyHamza", "1" }, + { "_wavyHamza.b", "1" }, + { "a", "1" }, + { "absAutoKashida", "1" }, + { "absJeemRetro1", "1" }, + { "absJeemRetro1Fin", "1" }, + { "absJeemRetro1Ini", "1" }, + { "absJeemRetro1Med", "1" }, + { "absJeemRetro2", "1" }, + { "absJeemRetro2Fin", "1" }, + { "absJeemRetro2Ini", "1" }, + { "absJeemRetro2Med", "1" }, + { "absJeemRetro3", "1" }, + { "absJeemRetro3Fin", "1" }, + { "absJeemRetro3Ini", "1" }, + { "absJeemRetro3Med", "1" }, + { "absJehRetro1", "1" }, + { "absJehRetro1Fin", "1" }, + { "absJehRetro2", "1" }, + { "absJehRetro2Fin", "1" }, + { "absLamRetro", "1" }, + { "absLamRetroAlef", "2" }, + { "absLamRetroAlefFin", "2" }, + { "absLamRetroFin", "1" }, + { "absLamRetroIni", "1" }, + { "absLamRetroIni.preAlef", "1" }, + { "absLamRetroMed", "1" }, + { "absLamRetroMed.preAlef", "1" }, + { "absShaddaAlef", "3" }, + { "absSheenRetro1", "1" }, + { "absSheenRetro1Fin", "1" }, + { "absSheenRetro1Ini", "1" }, + { "absSheenRetro1Med", "1" }, + { "absSheenRetro2", "1" }, + { "absSheenRetro2Fin", "1" }, + { "absSheenRetro2Ini", "1" }, + { "absSheenRetro2Med", "1" }, + { "absTchehRetro1", "1" }, + { "absTchehRetro1Fin", "1" }, + { "absTchehRetro1Ini", "1" }, + { "absTchehRetro1Med", "1" }, + { "absTchehRetro2", "1" }, + { "absTchehRetro2Fin", "1" }, + { "absTchehRetro2Ini", "1" }, + { "absTchehRetro2Med", "1" }, + { "absWawDotBelow", "1" }, + { "absWawDotBelowFin", "1" }, + { "ampersand", "1" }, + { "asciicircum", "1" }, + { "asciitilde", "1" }, + { "asterisk", "1" }, + { "asterisk.arab", "1" }, + { "at", "1" }, + { "b", "1" }, + { "backslash", "1" }, + { "bar", "1" }, + { "braceleft", "1" }, + { "braceright", "1" }, + { "bracketleft", "1" }, + { "bracketright", "1" }, + { "c", "1" }, + { "colon", "1" }, + { "colon.arab", "1" }, + { "comma", "1" }, + { "d", "1" }, + { "dollar", "1" }, + { "e", "1" }, + { "eight", "1" }, + { "eightMedium", "3" }, + { "eightSmall", "3" }, + { "equal", "1" }, + { "exclam", "1" }, + { "exclam.arab", "1" }, + { "f", "1" }, + { "five", "1" }, + { "fiveMedium", "3" }, + { "fiveSmall", "3" }, + { "four", "1" }, + { "fourMedium", "3" }, + { "fourSmall", "3" }, + { "g", "1" }, + { "grave", "1" }, + { "greater", "1" }, + { "h", "1" }, + { "hyphen", "1" }, + { "i", "1" }, + { "j", "1" }, + { "k", "1" }, + { "l", "1" }, + { "less", "1" }, + { "m", "1" }, + { "n", "1" }, + { "nine", "1" }, + { "nineMedium", "3" }, + { "nineSmall", "3" }, + { "nonmarkingreturn", "1" }, + { "numbersign", "1" }, + { "o", "1" }, + { "one", "1" }, + { "oneMedium", "3" }, + { "oneSmall", "3" }, + { "p", "1" }, + { "parenleft", "1" }, + { "parenleft.arab", "1" }, + { "parenright", "1" }, + { "parenright.arab", "1" }, + { "percent", "1" }, + { "period", "1" }, + { "plus", "1" }, + { "q", "1" }, + { "question", "1" }, + { "quotedbl", "1" }, + { "quotedblleft.arab", "1" }, + { "quotedblright.arab", "1" }, + { "quoteleft.arab", "1" }, + { "quoteright.arab", "1" }, + { "quotesingle", "1" }, + { "r", "1" }, + { "s", "1" }, + { "semicolon", "1" }, + { "seven", "1" }, + { "sevenMedium", "3" }, + { "sevenSmall", "3" }, + { "six", "1" }, + { "sixMedium", "3" }, + { "sixSmall", "3" }, + { "slash", "1" }, + { "space", "1" }, + { "t", "1" }, + { "three", "1" }, + { "threeMedium", "3" }, + { "threeSmall", "3" }, + { "two", "1" }, + { "twoMedium", "3" }, + { "twoSmall", "3" }, + { "u", "1" }, + { "underscore", "1" }, + { "uni060C", "1" }, + { "uni060C.downward", "1" }, + { "uni0614", "3" }, + { "uni061B", "1" }, + { "uni061B.downward", "1" }, + { "uni061E", "1" }, + { "uni061F", "1" }, + { "uni0621", "1" }, + { "uni0622", "1" }, + { "uni0622.fina", "1" }, + { "uni0622.fina.postLamIni", "1" }, + { "uni0622.fina.postLamMed", "1" }, + { "uni0623", "1" }, + { "uni0623.fina", "1" }, + { "uni0623.fina.postLamIni", "1" }, + { "uni0623.fina.postLamMed", "1" }, + { "uni0624", "1" }, + { "uni0624.fina", "1" }, + { "uni0625", "1" }, + { "uni0625.fina", "1" }, + { "uni0625.fina.postLamIni", "1" }, + { "uni0625.fina.postLamMed", "1" }, + { "uni0626", "1" }, + { "uni0626.fina", "1" }, + { "uni0626.init", "1" }, + { "uni0626.medi", "1" }, + { "uni0627", "1" }, + { "uni0627.fina", "1" }, + { "uni0627.fina.postLamIni", "1" }, + { "uni0627.fina.postLamMed", "1" }, + { "uni0628", "1" }, + { "uni0628.fina", "1" }, + { "uni0628.init", "1" }, + { "uni0628.medi", "1" }, + { "uni0629", "1" }, + { "uni0629.fina", "1" }, + { "uni062A", "1" }, + { "uni062A.fina", "1" }, + { "uni062A.init", "1" }, + { "uni062A.medi", "1" }, + { "uni062B", "1" }, + { "uni062B.fina", "1" }, + { "uni062B.init", "1" }, + { "uni062B.medi", "1" }, + { "uni062C", "1" }, + { "uni062C.fina", "1" }, + { "uni062C.init", "1" }, + { "uni062C.medi", "1" }, + { "uni062D", "1" }, + { "uni062D.fina", "1" }, + { "uni062D.init", "1" }, + { "uni062D.medi", "1" }, + { "uni062E", "1" }, + { "uni062E.fina", "1" }, + { "uni062E.init", "1" }, + { "uni062E.medi", "1" }, + { "uni062F", "1" }, + { "uni062F.fina", "1" }, + { "uni0630", "1" }, + { "uni0630.fina", "1" }, + { "uni0631", "1" }, + { "uni0631.fina", "1" }, + { "uni0632", "1" }, + { "uni0632.fina", "1" }, + { "uni0633", "1" }, + { "uni0633.fina", "1" }, + { "uni0633.init", "1" }, + { "uni0633.medi", "1" }, + { "uni0634", "1" }, + { "uni0634.fina", "1" }, + { "uni0634.init", "1" }, + { "uni0634.medi", "1" }, + { "uni0635", "1" }, + { "uni0635.fina", "1" }, + { "uni0635.init", "1" }, + { "uni0635.medi", "1" }, + { "uni0636", "1" }, + { "uni0636.fina", "1" }, + { "uni0636.init", "1" }, + { "uni0636.medi", "1" }, + { "uni0637", "1" }, + { "uni0637.fina", "1" }, + { "uni0637.init", "1" }, + { "uni0637.medi", "1" }, + { "uni0638", "1" }, + { "uni0638.fina", "1" }, + { "uni0638.init", "1" }, + { "uni0638.medi", "1" }, + { "uni0639", "1" }, + { "uni0639.fina", "1" }, + { "uni0639.init", "1" }, + { "uni0639.medi", "1" }, + { "uni063A", "1" }, + { "uni063A.fina", "1" }, + { "uni063A.init", "1" }, + { "uni063A.medi", "1" }, + { "uni0640", "1" }, + { "uni0641", "1" }, + { "uni0641.fina", "1" }, + { "uni0641.init", "1" }, + { "uni0641.medi", "1" }, + { "uni0642", "1" }, + { "uni0642.fina", "1" }, + { "uni0642.init", "1" }, + { "uni0642.medi", "1" }, + { "uni0643", "1" }, + { "uni0643.fina", "1" }, + { "uni0643.init", "1" }, + { "uni0643.medi", "1" }, + { "uni0644", "1" }, + { "uni0644.fina", "1" }, + { "uni0644.init", "1" }, + { "uni0644.init.preAlef", "1" }, + { "uni0644.medi", "1" }, + { "uni0644.medi.preAlef", "1" }, + { "uni06440627", "2" }, + { "uni06440627.fina", "2" }, + { "uni0645", "1" }, + { "uni0645.fina", "1" }, + { "uni0645.fina.sindhi", "1" }, + { "uni0645.init", "1" }, + { "uni0645.medi", "1" }, + { "uni0645.sindhi", "1" }, + { "uni0646", "1" }, + { "uni0646.fina", "1" }, + { "uni0646.init", "1" }, + { "uni0646.medi", "1" }, + { "uni0647", "1" }, + { "uni0647.fina", "1" }, + { "uni0647.fina.hooked", "1" }, + { "uni0647.fina.knottedFlat", "1" }, + { "uni0647.fina.knottedHigh", "1" }, + { "uni0647.init", "1" }, + { "uni0647.init.hooked", "1" }, + { "uni0647.knotted", "1" }, + { "uni0647.medi", "1" }, + { "uni0647.medi.hooked", "1" }, + { "uni0647.medi.knottedHigh", "1" }, + { "uni0648", "1" }, + { "uni0648.fina", "1" }, + { "uni0649", "1" }, + { "uni0649.fina", "1" }, + { "uni0649.init", "1" }, + { "uni0649.medi", "1" }, + { "uni064A", "1" }, + { "uni064A.fina", "1" }, + { "uni064A.fina.noDots", "1" }, + { "uni064A.init", "1" }, + { "uni064A.init.noDots", "1" }, + { "uni064A.medi", "1" }, + { "uni064A.medi.noDots", "1" }, + { "uni064A.noDots", "1" }, + { "uni064B", "3" }, + { "uni064C", "3" }, + { "uni064C.sixNine", "3" }, + { "uni064D", "3" }, + { "uni064E", "3" }, + { "uni064F", "3" }, + { "uni0650", "3" }, + { "uni0651", "3" }, + { "uni0651064B", "3" }, + { "uni0651064C", "3" }, + { "uni0651064D", "3" }, + { "uni0651064E", "3" }, + { "uni0651064F", "3" }, + { "uni06510650", "3" }, + { "uni0652", "3" }, + { "uni0652.downOpen", "3" }, + { "uni0652.leftOpen", "3" }, + { "uni0653", "3" }, + { "uni0654", "3" }, + { "uni0654064E", "3" }, + { "uni0654064F", "3" }, + { "uni0655", "3" }, + { "uni0656", "3" }, + { "uni0657", "3" }, + { "uni0658", "3" }, + { "uni0659", "3" }, + { "uni065A", "3" }, + { "uni065B", "3" }, + { "uni065C", "3" }, + { "uni065D", "3" }, + { "uni065E", "3" }, + { "uni0660", "1" }, + { "uni0660.Medium", "3" }, + { "uni0660.Small", "3" }, + { "uni0661", "1" }, + { "uni0661.Medium", "3" }, + { "uni0661.Small", "3" }, + { "uni0662", "1" }, + { "uni0662.Medium", "3" }, + { "uni0662.Small", "3" }, + { "uni0663", "1" }, + { "uni0663.Medium", "3" }, + { "uni0663.Small", "3" }, + { "uni0664", "1" }, + { "uni0664.Medium", "3" }, + { "uni0664.Small", "3" }, + { "uni0665", "1" }, + { "uni0665.Medium", "3" }, + { "uni0665.Small", "3" }, + { "uni0666", "1" }, + { "uni0666.Medium", "3" }, + { "uni0666.Small", "3" }, + { "uni0667", "1" }, + { "uni0667.Medium", "3" }, + { "uni0667.Small", "3" }, + { "uni0668", "1" }, + { "uni0668.Medium", "3" }, + { "uni0668.Small", "3" }, + { "uni0669", "1" }, + { "uni0669.Medium", "3" }, + { "uni0669.Small", "3" }, + { "uni066A", "1" }, + { "uni066B", "1" }, + { "uni066C", "1" }, + { "uni066D", "1" }, + { "uni066E", "1" }, + { "uni066E.fina", "1" }, + { "uni066E.init", "1" }, + { "uni066E.medi", "1" }, + { "uni066F", "1" }, + { "uni066F.fina", "1" }, + { "uni066F.init", "1" }, + { "uni066F.medi", "1" }, + { "uni0670", "3" }, + { "uni0670.large", "3" }, + { "uni0671", "1" }, + { "uni0671.fina", "1" }, + { "uni0671.fina.postLamIni", "1" }, + { "uni0671.fina.postLamMed", "1" }, + { "uni0672", "1" }, + { "uni0672.fina", "1" }, + { "uni0672.fina.postLamIni", "1" }, + { "uni0672.fina.postLamMed", "1" }, + { "uni0673", "1" }, + { "uni0673.fina", "1" }, + { "uni0673.fina.postLamIni", "1" }, + { "uni0673.fina.postLamMed", "1" }, + { "uni0674", "3" }, + { "uni0675", "1" }, + { "uni0675.fina", "1" }, + { "uni0675.fina.postLamIni", "1" }, + { "uni0675.fina.postLamMed", "1" }, + { "uni0676", "1" }, + { "uni0676.fina", "1" }, + { "uni0677", "1" }, + { "uni0677.fina", "1" }, + { "uni0678", "1" }, + { "uni0678.fina", "1" }, + { "uni0678.init", "1" }, + { "uni0678.medi", "1" }, + { "uni0679", "1" }, + { "uni0679.fina", "1" }, + { "uni0679.init", "1" }, + { "uni0679.medi", "1" }, + { "uni067A", "1" }, + { "uni067A.fina", "1" }, + { "uni067A.init", "1" }, + { "uni067A.medi", "1" }, + { "uni067B", "1" }, + { "uni067B.fina", "1" }, + { "uni067B.init", "1" }, + { "uni067B.medi", "1" }, + { "uni067C", "1" }, + { "uni067C.fina", "1" }, + { "uni067C.init", "1" }, + { "uni067C.medi", "1" }, + { "uni067D", "1" }, + { "uni067D.fina", "1" }, + { "uni067D.init", "1" }, + { "uni067D.medi", "1" }, + { "uni067E", "1" }, + { "uni067E.fina", "1" }, + { "uni067E.init", "1" }, + { "uni067E.medi", "1" }, + { "uni067F", "1" }, + { "uni067F.fina", "1" }, + { "uni067F.init", "1" }, + { "uni067F.medi", "1" }, + { "uni0680", "1" }, + { "uni0680.fina", "1" }, + { "uni0680.init", "1" }, + { "uni0680.medi", "1" }, + { "uni0681", "1" }, + { "uni0681.fina", "1" }, + { "uni0681.init", "1" }, + { "uni0681.medi", "1" }, + { "uni0682", "1" }, + { "uni0682.fina", "1" }, + { "uni0682.init", "1" }, + { "uni0682.medi", "1" }, + { "uni0683", "1" }, + { "uni0683.fina", "1" }, + { "uni0683.init", "1" }, + { "uni0683.medi", "1" }, + { "uni0684", "1" }, + { "uni0684.fina", "1" }, + { "uni0684.init", "1" }, + { "uni0684.medi", "1" }, + { "uni0685", "1" }, + { "uni0685.fina", "1" }, + { "uni0685.init", "1" }, + { "uni0685.medi", "1" }, + { "uni0686", "1" }, + { "uni0686.fina", "1" }, + { "uni0686.init", "1" }, + { "uni0686.medi", "1" }, + { "uni0687", "1" }, + { "uni0687.fina", "1" }, + { "uni0687.init", "1" }, + { "uni0687.medi", "1" }, + { "uni0688", "1" }, + { "uni0688.fina", "1" }, + { "uni0689", "1" }, + { "uni0689.fina", "1" }, + { "uni068A", "1" }, + { "uni068A.fina", "1" }, + { "uni068B", "1" }, + { "uni068B.fina", "1" }, + { "uni068C", "1" }, + { "uni068C.fina", "1" }, + { "uni068D", "1" }, + { "uni068D.fina", "1" }, + { "uni068E", "1" }, + { "uni068E.fina", "1" }, + { "uni068F", "1" }, + { "uni068F.fina", "1" }, + { "uni0690", "1" }, + { "uni0690.fina", "1" }, + { "uni0691", "1" }, + { "uni0691.fina", "1" }, + { "uni0692", "1" }, + { "uni0692.fina", "1" }, + { "uni0693", "1" }, + { "uni0693.fina", "1" }, + { "uni0694", "1" }, + { "uni0694.fina", "1" }, + { "uni0695", "1" }, + { "uni0695.fina", "1" }, + { "uni0696", "1" }, + { "uni0696.fina", "1" }, + { "uni0697", "1" }, + { "uni0697.fina", "1" }, + { "uni0698", "1" }, + { "uni0698.dotHat", "1" }, + { "uni0698.fina", "1" }, + { "uni0698.fina.dotHat", "1" }, + { "uni0699", "1" }, + { "uni0699.fina", "1" }, + { "uni069A", "1" }, + { "uni069A.fina", "1" }, + { "uni069A.init", "1" }, + { "uni069A.medi", "1" }, + { "uni069B", "1" }, + { "uni069B.fina", "1" }, + { "uni069B.init", "1" }, + { "uni069B.medi", "1" }, + { "uni069C", "1" }, + { "uni069C.fina", "1" }, + { "uni069C.init", "1" }, + { "uni069C.medi", "1" }, + { "uni069D", "1" }, + { "uni069D.fina", "1" }, + { "uni069D.init", "1" }, + { "uni069D.medi", "1" }, + { "uni069E", "1" }, + { "uni069E.fina", "1" }, + { "uni069E.init", "1" }, + { "uni069E.medi", "1" }, + { "uni069F", "1" }, + { "uni069F.fina", "1" }, + { "uni069F.init", "1" }, + { "uni069F.medi", "1" }, + { "uni06A0", "1" }, + { "uni06A0.fina", "1" }, + { "uni06A0.init", "1" }, + { "uni06A0.medi", "1" }, + { "uni06A1", "1" }, + { "uni06A1.fina", "1" }, + { "uni06A1.init", "1" }, + { "uni06A1.medi", "1" }, + { "uni06A2", "1" }, + { "uni06A2.fina", "1" }, + { "uni06A2.init", "1" }, + { "uni06A2.medi", "1" }, + { "uni06A3", "1" }, + { "uni06A3.fina", "1" }, + { "uni06A3.init", "1" }, + { "uni06A3.medi", "1" }, + { "uni06A4", "1" }, + { "uni06A4.fina", "1" }, + { "uni06A4.init", "1" }, + { "uni06A4.medi", "1" }, + { "uni06A5", "1" }, + { "uni06A5.fina", "1" }, + { "uni06A5.init", "1" }, + { "uni06A5.medi", "1" }, + { "uni06A6", "1" }, + { "uni06A6.fina", "1" }, + { "uni06A6.init", "1" }, + { "uni06A6.medi", "1" }, + { "uni06A7", "1" }, + { "uni06A7.fina", "1" }, + { "uni06A7.init", "1" }, + { "uni06A7.medi", "1" }, + { "uni06A8", "1" }, + { "uni06A8.fina", "1" }, + { "uni06A8.init", "1" }, + { "uni06A8.medi", "1" }, + { "uni06A9", "1" }, + { "uni06A9.fina", "1" }, + { "uni06A9.init", "1" }, + { "uni06A9.medi", "1" }, + { "uni06AA", "1" }, + { "uni06AA.fina", "1" }, + { "uni06AA.init", "1" }, + { "uni06AA.medi", "1" }, + { "uni06AB", "1" }, + { "uni06AB.fina", "1" }, + { "uni06AB.init", "1" }, + { "uni06AB.medi", "1" }, + { "uni06AC", "1" }, + { "uni06AC.fina", "1" }, + { "uni06AC.init", "1" }, + { "uni06AC.medi", "1" }, + { "uni06AD", "1" }, + { "uni06AD.fina", "1" }, + { "uni06AD.init", "1" }, + { "uni06AD.medi", "1" }, + { "uni06AE", "1" }, + { "uni06AE.fina", "1" }, + { "uni06AE.init", "1" }, + { "uni06AE.medi", "1" }, + { "uni06AF", "1" }, + { "uni06AF.fina", "1" }, + { "uni06AF.init", "1" }, + { "uni06AF.medi", "1" }, + { "uni06B0", "1" }, + { "uni06B0.fina", "1" }, + { "uni06B0.init", "1" }, + { "uni06B0.medi", "1" }, + { "uni06B1", "1" }, + { "uni06B1.fina", "1" }, + { "uni06B1.init", "1" }, + { "uni06B1.medi", "1" }, + { "uni06B2", "1" }, + { "uni06B2.fina", "1" }, + { "uni06B2.init", "1" }, + { "uni06B2.medi", "1" }, + { "uni06B3", "1" }, + { "uni06B3.fina", "1" }, + { "uni06B3.init", "1" }, + { "uni06B3.medi", "1" }, + { "uni06B4", "1" }, + { "uni06B4.fina", "1" }, + { "uni06B4.init", "1" }, + { "uni06B4.medi", "1" }, + { "uni06B5", "1" }, + { "uni06B5.fina", "1" }, + { "uni06B5.init", "1" }, + { "uni06B5.init.preAlef", "1" }, + { "uni06B5.medi", "1" }, + { "uni06B5.medi.preAlef", "1" }, + { "uni06B50627", "2" }, + { "uni06B50627.fina", "2" }, + { "uni06B6", "1" }, + { "uni06B6.fina", "1" }, + { "uni06B6.init", "1" }, + { "uni06B6.init.preAlef", "1" }, + { "uni06B6.medi", "1" }, + { "uni06B6.medi.preAlef", "1" }, + { "uni06B60627", "2" }, + { "uni06B60627.fina", "2" }, + { "uni06B7", "1" }, + { "uni06B7.fina", "1" }, + { "uni06B7.init", "1" }, + { "uni06B7.init.preAlef", "1" }, + { "uni06B7.medi", "1" }, + { "uni06B7.medi.preAlef", "1" }, + { "uni06B70627", "2" }, + { "uni06B70627.fina", "2" }, + { "uni06B8", "1" }, + { "uni06B8.fina", "1" }, + { "uni06B8.init", "1" }, + { "uni06B8.init.preAlef", "1" }, + { "uni06B8.medi", "1" }, + { "uni06B8.medi.preAlef", "1" }, + { "uni06B80627", "2" }, + { "uni06B80627.fina", "2" }, + { "uni06B9", "1" }, + { "uni06B9.fina", "1" }, + { "uni06B9.init", "1" }, + { "uni06B9.medi", "1" }, + { "uni06BA", "1" }, + { "uni06BA.fina", "1" }, + { "uni06BA.init", "1" }, + { "uni06BA.medi", "1" }, + { "uni06BB", "1" }, + { "uni06BB.fina", "1" }, + { "uni06BB.init", "1" }, + { "uni06BB.medi", "1" }, + { "uni06BC", "1" }, + { "uni06BC.fina", "1" }, + { "uni06BC.init", "1" }, + { "uni06BC.medi", "1" }, + { "uni06BD", "1" }, + { "uni06BD.fina", "1" }, + { "uni06BD.init", "1" }, + { "uni06BD.medi", "1" }, + { "uni06BE", "1" }, + { "uni06BE.fina", "1" }, + { "uni06BE.init", "1" }, + { "uni06BE.medi", "1" }, + { "uni06BF", "1" }, + { "uni06BF.fina", "1" }, + { "uni06BF.init", "1" }, + { "uni06BF.medi", "1" }, + { "uni06C0", "1" }, + { "uni06C0.fina", "1" }, + { "uni06C0.init", "1" }, + { "uni06C0.medi", "1" }, + { "uni06C1", "1" }, + { "uni06C1.fina", "1" }, + { "uni06C1.init", "1" }, + { "uni06C1.medi", "1" }, + { "uni06C2", "1" }, + { "uni06C2.fina", "1" }, + { "uni06C2.init", "1" }, + { "uni06C2.medi", "1" }, + { "uni06C3", "1" }, + { "uni06C3.fina", "1" }, + { "uni06C4", "1" }, + { "uni06C4.fina", "1" }, + { "uni06C5", "1" }, + { "uni06C5.fina", "1" }, + { "uni06C6", "1" }, + { "uni06C6.fina", "1" }, + { "uni06C7", "1" }, + { "uni06C7.fina", "1" }, + { "uni06C8", "1" }, + { "uni06C8.fina", "1" }, + { "uni06C9", "1" }, + { "uni06C9.fina", "1" }, + { "uni06CA", "1" }, + { "uni06CA.fina", "1" }, + { "uni06CB", "1" }, + { "uni06CB.fina", "1" }, + { "uni06CC", "1" }, + { "uni06CC.fina", "1" }, + { "uni06CC.init", "1" }, + { "uni06CC.medi", "1" }, + { "uni06CD", "1" }, + { "uni06CD.fina", "1" }, + { "uni06CE", "1" }, + { "uni06CE.fina", "1" }, + { "uni06CE.init", "1" }, + { "uni06CE.medi", "1" }, + { "uni06CF", "1" }, + { "uni06CF.fina", "1" }, + { "uni06D0", "1" }, + { "uni06D0.fina", "1" }, + { "uni06D0.init", "1" }, + { "uni06D0.medi", "1" }, + { "uni06D1", "1" }, + { "uni06D1.fina", "1" }, + { "uni06D1.init", "1" }, + { "uni06D1.medi", "1" }, + { "uni06D2", "1" }, + { "uni06D2.fina", "1" }, + { "uni06D3", "1" }, + { "uni06D3.fina", "1" }, + { "uni06D4", "1" }, + { "uni06D5", "1" }, + { "uni06D6", "3" }, + { "uni06D7", "3" }, + { "uni06D8", "3" }, + { "uni06D9", "3" }, + { "uni06DA", "3" }, + { "uni06DB", "3" }, + { "uni06DC", "3" }, + { "uni06DD", "1" }, + { "uni06DD.2", "1" }, + { "uni06DD.3", "1" }, + { "uni06DD.aat1", "1" }, + { "uni06DD.aat2", "1" }, + { "uni06DD.aat3", "1" }, + { "uni06DD.sp1", "1" }, + { "uni06DD.sp2", "1" }, + { "uni06DD.sp3", "1" }, + { "uni06DE", "1" }, + { "uni06DF", "3" }, + { "uni06E0", "3" }, + { "uni06E1", "3" }, + { "uni06E2", "3" }, + { "uni06E3", "3" }, + { "uni06E4", "3" }, + { "uni06E5", "3" }, + { "uni06E6", "3" }, + { "uni06E7", "3" }, + { "uni06E8", "3" }, + { "uni06E9", "1" }, + { "uni06EA", "3" }, + { "uni06EB", "3" }, + { "uni06EC", "3" }, + { "uni06ED", "3" }, + { "uni06EE", "1" }, + { "uni06EE.fina", "1" }, + { "uni06EF", "1" }, + { "uni06EF.fina", "1" }, + { "uni06F0", "1" }, + { "uni06F0.Medium", "3" }, + { "uni06F0.Small", "3" }, + { "uni06F1", "1" }, + { "uni06F1.Medium", "3" }, + { "uni06F1.Small", "3" }, + { "uni06F2", "1" }, + { "uni06F2.Medium", "3" }, + { "uni06F2.Small", "3" }, + { "uni06F3", "1" }, + { "uni06F3.Medium", "3" }, + { "uni06F3.Small", "3" }, + { "uni06F4", "1" }, + { "uni06F4.Medium", "3" }, + { "uni06F4.Medium.urdu", "3" }, + { "uni06F4.Small", "3" }, + { "uni06F4.Small.urdu", "3" }, + { "uni06F4.urdu", "1" }, + { "uni06F5", "1" }, + { "uni06F5.Medium", "3" }, + { "uni06F5.Small", "3" }, + { "uni06F6", "1" }, + { "uni06F6.Medium", "3" }, + { "uni06F6.Medium.urdu", "3" }, + { "uni06F6.Small", "3" }, + { "uni06F6.Small.urdu", "3" }, + { "uni06F6.urdu", "1" }, + { "uni06F7", "1" }, + { "uni06F7.Medium", "3" }, + { "uni06F7.Medium.urdu", "3" }, + { "uni06F7.Small", "3" }, + { "uni06F7.Small.urdu", "3" }, + { "uni06F7.urdu", "1" }, + { "uni06F8", "1" }, + { "uni06F8.Medium", "3" }, + { "uni06F8.Small", "3" }, + { "uni06F9", "1" }, + { "uni06F9.Medium", "3" }, + { "uni06F9.Small", "3" }, + { "uni06FA", "1" }, + { "uni06FA.fina", "1" }, + { "uni06FA.init", "1" }, + { "uni06FA.medi", "1" }, + { "uni06FB", "1" }, + { "uni06FB.fina", "1" }, + { "uni06FB.init", "1" }, + { "uni06FB.medi", "1" }, + { "uni06FC", "1" }, + { "uni06FC.fina", "1" }, + { "uni06FC.init", "1" }, + { "uni06FC.medi", "1" }, + { "uni06FD", "1" }, + { "uni06FE", "1" }, + { "uni06FF", "1" }, + { "uni06FF.fina", "1" }, + { "uni06FF.init", "1" }, + { "uni06FF.medi", "1" }, + { "uni0750", "1" }, + { "uni0750.fina", "1" }, + { "uni0750.init", "1" }, + { "uni0750.medi", "1" }, + { "uni0751", "1" }, + { "uni0751.fina", "1" }, + { "uni0751.init", "1" }, + { "uni0751.medi", "1" }, + { "uni0752", "1" }, + { "uni0752.fina", "1" }, + { "uni0752.init", "1" }, + { "uni0752.medi", "1" }, + { "uni0753", "1" }, + { "uni0753.fina", "1" }, + { "uni0753.init", "1" }, + { "uni0753.medi", "1" }, + { "uni0754", "1" }, + { "uni0754.fina", "1" }, + { "uni0754.init", "1" }, + { "uni0754.medi", "1" }, + { "uni0755", "1" }, + { "uni0755.fina", "1" }, + { "uni0755.init", "1" }, + { "uni0755.medi", "1" }, + { "uni0756", "1" }, + { "uni0756.fina", "1" }, + { "uni0756.init", "1" }, + { "uni0756.medi", "1" }, + { "uni0757", "1" }, + { "uni0757.fina", "1" }, + { "uni0757.init", "1" }, + { "uni0757.medi", "1" }, + { "uni0758", "1" }, + { "uni0758.fina", "1" }, + { "uni0758.init", "1" }, + { "uni0758.medi", "1" }, + { "uni0759", "1" }, + { "uni0759.fina", "1" }, + { "uni075A", "1" }, + { "uni075A.fina", "1" }, + { "uni075B", "1" }, + { "uni075B.fina", "1" }, + { "uni075C", "1" }, + { "uni075C.fina", "1" }, + { "uni075C.init", "1" }, + { "uni075C.medi", "1" }, + { "uni075D", "1" }, + { "uni075D.fina", "1" }, + { "uni075D.init", "1" }, + { "uni075D.medi", "1" }, + { "uni075E", "1" }, + { "uni075E.fina", "1" }, + { "uni075E.init", "1" }, + { "uni075E.medi", "1" }, + { "uni075F", "1" }, + { "uni075F.fina", "1" }, + { "uni075F.init", "1" }, + { "uni075F.medi", "1" }, + { "uni0760", "1" }, + { "uni0760.fina", "1" }, + { "uni0760.init", "1" }, + { "uni0760.medi", "1" }, + { "uni0761", "1" }, + { "uni0761.fina", "1" }, + { "uni0761.init", "1" }, + { "uni0761.medi", "1" }, + { "uni0762", "1" }, + { "uni0762.fina", "1" }, + { "uni0762.init", "1" }, + { "uni0762.medi", "1" }, + { "uni0763", "1" }, + { "uni0763.fina", "1" }, + { "uni0763.init", "1" }, + { "uni0763.medi", "1" }, + { "uni0764", "1" }, + { "uni0764.fina", "1" }, + { "uni0764.init", "1" }, + { "uni0764.medi", "1" }, + { "uni0765", "1" }, + { "uni0765.fina", "1" }, + { "uni0765.init", "1" }, + { "uni0765.medi", "1" }, + { "uni0766", "1" }, + { "uni0766.fina", "1" }, + { "uni0766.init", "1" }, + { "uni0766.medi", "1" }, + { "uni0767", "1" }, + { "uni0767.fina", "1" }, + { "uni0767.init", "1" }, + { "uni0767.medi", "1" }, + { "uni0768", "1" }, + { "uni0768.fina", "1" }, + { "uni0768.init", "1" }, + { "uni0768.medi", "1" }, + { "uni0769", "1" }, + { "uni0769.fina", "1" }, + { "uni0769.init", "1" }, + { "uni0769.medi", "1" }, + { "uni076A", "1" }, + { "uni076A.fina", "1" }, + { "uni076A.init", "1" }, + { "uni076A.init.preAlef", "1" }, + { "uni076A.medi", "1" }, + { "uni076A.medi.preAlef", "1" }, + { "uni076A0627", "2" }, + { "uni076A0627.fina", "2" }, + { "uni076B", "1" }, + { "uni076B.fina", "1" }, + { "uni076C", "1" }, + { "uni076C.fina", "1" }, + { "uni076D", "1" }, + { "uni076D.fina", "1" }, + { "uni076D.init", "1" }, + { "uni076D.medi", "1" }, + { "uni2000", "1" }, + { "uni2001", "1" }, + { "uni2002", "1" }, + { "uni2003", "1" }, + { "uni2004", "1" }, + { "uni2005", "1" }, + { "uni2006", "1" }, + { "uni2007", "1" }, + { "uni2008", "1" }, + { "uni2009", "1" }, + { "uni200A", "1" }, + { "uni200B", "1" }, + { "uni200C", "1" }, + { "uni200D", "1" }, + { "uni200E", "1" }, + { "uni200F", "1" }, + { "uni202A", "1" }, + { "uni202B", "1" }, + { "uni202C", "1" }, + { "uni202D", "1" }, + { "uni202E", "1" }, + { "uni2060", "1" }, + { "uni206C", "1" }, + { "uni206D", "1" }, + { "uni25CC", "1" }, + { "uniFD3E", "1" }, + { "uniFD3F", "1" }, + { "uniFDF2", "1" }, + { "uniFDFC", "1" }, + { "uniFEFF", "1" }, + { "v", "1" }, + { "w", "1" }, + { "x", "1" }, + { "y", "1" }, + { "z", "1" }, + { "zero", "1" }, + { "zeroMedium", "3" }, + { "zeroSmall", "3" }, + }, + }, + // arab-004.ttx + { "f3", "lu0", + new String[][] { + { "_bar", "1" }, + { "_damma", "1" }, + { "_dot1", "1" }, + { "_dot1_hat", "1" }, + { "_dot1_smallV", "1" }, + { "_dot1_tah", "1" }, + { "_dot2h", "1" }, + { "_dot2h_tah", "1" }, + { "_dot2v", "1" }, + { "_dot3d", "1" }, + { "_dot3h", "1" }, + { "_dot3u", "1" }, + { "_dot3u_tah", "1" }, + { "_dot4", "1" }, + { "_gafBar", "1" }, + { "_gafBarShort", "1" }, + { "_gafBarShort_dot2h", "1" }, + { "_gafBarShort_dot3u", "1" }, + { "_gafBar_dot2h", "1" }, + { "_gafBar_dot3u", "1" }, + { "_hamza", "1" }, + { "_hamzaDamma", "1" }, + { "_hat", "1" }, + { "_highHamza", "1" }, + { "_invSmallV", "1" }, + { "_lines", "1" }, + { "_madda", "1" }, + { "_ring", "1" }, + { "_smallV", "1" }, + { "_tah", "1" }, + { "_vline", "1" }, + { "_wasla", "1" }, + { "_wavyHamza", "1" }, + { "_wavyHamza.b", "1" }, + { "a", "1" }, + { "absAutoKashida", "1" }, + { "absJeemRetro1", "1" }, + { "absJeemRetro1Fin", "1" }, + { "absJeemRetro1Ini", "1" }, + { "absJeemRetro1Med", "1" }, + { "absJeemRetro2", "1" }, + { "absJeemRetro2Fin", "1" }, + { "absJeemRetro2Ini", "1" }, + { "absJeemRetro2Med", "1" }, + { "absJeemRetro3", "1" }, + { "absJeemRetro3Fin", "1" }, + { "absJeemRetro3Ini", "1" }, + { "absJeemRetro3Med", "1" }, + { "absJehRetro1", "1" }, + { "absJehRetro1Fin", "1" }, + { "absJehRetro2", "1" }, + { "absJehRetro2Fin", "1" }, + { "absLamRetro", "1" }, + { "absLamRetroAlef", "2" }, + { "absLamRetroAlefFin", "2" }, + { "absLamRetroFin", "1" }, + { "absLamRetroIni", "1" }, + { "absLamRetroIni.preAlef", "1" }, + { "absLamRetroMed", "1" }, + { "absLamRetroMed.preAlef", "1" }, + { "absShaddaAlef", "3" }, + { "absSheenRetro1", "1" }, + { "absSheenRetro1Fin", "1" }, + { "absSheenRetro1Ini", "1" }, + { "absSheenRetro1Med", "1" }, + { "absSheenRetro2", "1" }, + { "absSheenRetro2Fin", "1" }, + { "absSheenRetro2Ini", "1" }, + { "absSheenRetro2Med", "1" }, + { "absTchehRetro1", "1" }, + { "absTchehRetro1Fin", "1" }, + { "absTchehRetro1Ini", "1" }, + { "absTchehRetro1Med", "1" }, + { "absTchehRetro2", "1" }, + { "absTchehRetro2Fin", "1" }, + { "absTchehRetro2Ini", "1" }, + { "absTchehRetro2Med", "1" }, + { "absWawDotBelow", "1" }, + { "absWawDotBelowFin", "1" }, + { "ampersand", "1" }, + { "asciicircum", "1" }, + { "asciitilde", "1" }, + { "asterisk", "1" }, + { "at", "1" }, + { "b", "1" }, + { "backslash", "1" }, + { "bar", "1" }, + { "braceleft", "1" }, + { "braceright", "1" }, + { "bracketleft", "1" }, + { "bracketright", "1" }, + { "c", "1" }, + { "colon", "1" }, + { "comma", "1" }, + { "d", "1" }, + { "dollar", "1" }, + { "e", "1" }, + { "eight", "1" }, + { "eightMedium", "3" }, + { "eightSmall", "3" }, + { "equal", "1" }, + { "exclam", "1" }, + { "f", "1" }, + { "five", "1" }, + { "fiveMedium", "3" }, + { "fiveSmall", "3" }, + { "four", "1" }, + { "fourMedium", "3" }, + { "fourSmall", "3" }, + { "g", "1" }, + { "grave", "1" }, + { "greater", "1" }, + { "h", "1" }, + { "hyphen", "1" }, + { "i", "1" }, + { "j", "1" }, + { "k", "1" }, + { "l", "1" }, + { "less", "1" }, + { "m", "1" }, + { "n", "1" }, + { "nine", "1" }, + { "nineMedium", "3" }, + { "nineSmall", "3" }, + { "nonmarkingreturn", "1" }, + { "numbersign", "1" }, + { "o", "1" }, + { "one", "1" }, + { "oneMedium", "3" }, + { "oneSmall", "3" }, + { "p", "1" }, + { "parenleft", "1" }, + { "parenright", "1" }, + { "percent", "1" }, + { "period", "1" }, + { "plus", "1" }, + { "q", "1" }, + { "question", "1" }, + { "quotedbl", "1" }, + { "quotesingle", "1" }, + { "r", "1" }, + { "s", "1" }, + { "semicolon", "1" }, + { "seven", "1" }, + { "sevenMedium", "3" }, + { "sevenSmall", "3" }, + { "six", "1" }, + { "sixMedium", "3" }, + { "sixSmall", "3" }, + { "slash", "1" }, + { "space", "1" }, + { "t", "1" }, + { "three", "1" }, + { "threeMedium", "3" }, + { "threeSmall", "3" }, + { "two", "1" }, + { "twoMedium", "3" }, + { "twoSmall", "3" }, + { "u", "1" }, + { "underscore", "1" }, + { "uni0600", "1" }, + { "uni0600.2", "1" }, + { "uni0600.3", "1" }, + { "uni0600.aat1", "1" }, + { "uni0600.aat2", "1" }, + { "uni0600.aat3", "1" }, + { "uni0600.sp1", "1" }, + { "uni0600.sp2", "1" }, + { "uni0600.sp3", "1" }, + { "uni0601", "1" }, + { "uni0601.2", "1" }, + { "uni0601.3", "1" }, + { "uni0601.4", "1" }, + { "uni0601.aat1", "1" }, + { "uni0601.aat2", "1" }, + { "uni0601.aat3", "1" }, + { "uni0601.aat4", "1" }, + { "uni0601.sp1", "1" }, + { "uni0601.sp2", "1" }, + { "uni0601.sp3", "1" }, + { "uni0601.sp4", "1" }, + { "uni0602", "1" }, + { "uni0602.2", "1" }, + { "uni0602.aat1", "1" }, + { "uni0602.aat2", "1" }, + { "uni0602.sp1", "1" }, + { "uni0602.sp2", "1" }, + { "uni0603", "1" }, + { "uni0603.2", "1" }, + { "uni0603.3", "1" }, + { "uni0603.aat1", "1" }, + { "uni0603.aat2", "1" }, + { "uni0603.aat3", "1" }, + { "uni0603.sp1", "1" }, + { "uni0603.sp2", "1" }, + { "uni0603.sp3", "1" }, + { "uni060B", "1" }, + { "uni060C", "1" }, + { "uni060C.downward", "1" }, + { "uni060D", "1" }, + { "uni060E", "1" }, + { "uni060F", "1" }, + { "uni0610", "3" }, + { "uni0611", "3" }, + { "uni0612", "3" }, + { "uni0613", "3" }, + { "uni0614", "3" }, + { "uni0615", "3" }, + { "uni061B", "1" }, + { "uni061B.downward", "1" }, + { "uni061E", "1" }, + { "uni061F", "1" }, + { "uni0621", "1" }, + { "uni0622", "1" }, + { "uni0622.fina", "1" }, + { "uni0622.fina.postLamIni", "1" }, + { "uni0622.fina.postLamMed", "1" }, + { "uni0623", "1" }, + { "uni0623.fina", "1" }, + { "uni0623.fina.postLamIni", "1" }, + { "uni0623.fina.postLamMed", "1" }, + { "uni0624", "1" }, + { "uni0624.fina", "1" }, + { "uni0625", "1" }, + { "uni0625.fina", "1" }, + { "uni0625.fina.postLamIni", "1" }, + { "uni0625.fina.postLamMed", "1" }, + { "uni0626", "1" }, + { "uni0626.fina", "1" }, + { "uni0626.init", "1" }, + { "uni0626.medi", "1" }, + { "uni0627", "1" }, + { "uni0627.fina", "1" }, + { "uni0627.fina.postLamIni", "1" }, + { "uni0627.fina.postLamMed", "1" }, + { "uni0628", "1" }, + { "uni0628.fina", "1" }, + { "uni0628.init", "1" }, + { "uni0628.medi", "1" }, + { "uni0629", "1" }, + { "uni0629.fina", "1" }, + { "uni062A", "1" }, + { "uni062A.fina", "1" }, + { "uni062A.init", "1" }, + { "uni062A.medi", "1" }, + { "uni062B", "1" }, + { "uni062B.fina", "1" }, + { "uni062B.init", "1" }, + { "uni062B.medi", "1" }, + { "uni062C", "1" }, + { "uni062C.fina", "1" }, + { "uni062C.init", "1" }, + { "uni062C.medi", "1" }, + { "uni062D", "1" }, + { "uni062D.fina", "1" }, + { "uni062D.init", "1" }, + { "uni062D.medi", "1" }, + { "uni062E", "1" }, + { "uni062E.fina", "1" }, + { "uni062E.init", "1" }, + { "uni062E.medi", "1" }, + { "uni062F", "1" }, + { "uni062F.fina", "1" }, + { "uni0630", "1" }, + { "uni0630.fina", "1" }, + { "uni0631", "1" }, + { "uni0631.fina", "1" }, + { "uni0632", "1" }, + { "uni0632.fina", "1" }, + { "uni0633", "1" }, + { "uni0633.fina", "1" }, + { "uni0633.init", "1" }, + { "uni0633.medi", "1" }, + { "uni0634", "1" }, + { "uni0634.fina", "1" }, + { "uni0634.init", "1" }, + { "uni0634.medi", "1" }, + { "uni0635", "1" }, + { "uni0635.fina", "1" }, + { "uni0635.init", "1" }, + { "uni0635.medi", "1" }, + { "uni0636", "1" }, + { "uni0636.fina", "1" }, + { "uni0636.init", "1" }, + { "uni0636.medi", "1" }, + { "uni0637", "1" }, + { "uni0637.fina", "1" }, + { "uni0637.init", "1" }, + { "uni0637.medi", "1" }, + { "uni0638", "1" }, + { "uni0638.fina", "1" }, + { "uni0638.init", "1" }, + { "uni0638.medi", "1" }, + { "uni0639", "1" }, + { "uni0639.fina", "1" }, + { "uni0639.init", "1" }, + { "uni0639.medi", "1" }, + { "uni063A", "1" }, + { "uni063A.fina", "1" }, + { "uni063A.init", "1" }, + { "uni063A.medi", "1" }, + { "uni0640", "1" }, + { "uni0641", "1" }, + { "uni0641.fina", "1" }, + { "uni0641.init", "1" }, + { "uni0641.medi", "1" }, + { "uni0642", "1" }, + { "uni0642.fina", "1" }, + { "uni0642.init", "1" }, + { "uni0642.medi", "1" }, + { "uni0643", "1" }, + { "uni0643.fina", "1" }, + { "uni0643.init", "1" }, + { "uni0643.medi", "1" }, + { "uni0644", "1" }, + { "uni0644.fina", "1" }, + { "uni0644.init", "1" }, + { "uni0644.init.preAlef", "1" }, + { "uni0644.medi", "1" }, + { "uni0644.medi.preAlef", "1" }, + { "uni06440627", "2" }, + { "uni06440627.fina", "2" }, + { "uni0645", "1" }, + { "uni0645.fina", "1" }, + { "uni0645.fina.sindhi", "1" }, + { "uni0645.init", "1" }, + { "uni0645.medi", "1" }, + { "uni0645.sindhi", "1" }, + { "uni0646", "1" }, + { "uni0646.fina", "1" }, + { "uni0646.init", "1" }, + { "uni0646.medi", "1" }, + { "uni0647", "1" }, + { "uni0647.fina", "1" }, + { "uni0647.fina.hooked", "1" }, + { "uni0647.fina.knottedFlat", "1" }, + { "uni0647.fina.knottedHigh", "1" }, + { "uni0647.init", "1" }, + { "uni0647.init.hooked", "1" }, + { "uni0647.knotted", "1" }, + { "uni0647.medi", "1" }, + { "uni0647.medi.hooked", "1" }, + { "uni0647.medi.knottedHigh", "1" }, + { "uni0648", "1" }, + { "uni0648.fina", "1" }, + { "uni0649", "1" }, + { "uni0649.fina", "1" }, + { "uni0649.init", "1" }, + { "uni0649.medi", "1" }, + { "uni064A", "1" }, + { "uni064A.fina", "1" }, + { "uni064A.fina.noDots", "1" }, + { "uni064A.init", "1" }, + { "uni064A.init.noDots", "1" }, + { "uni064A.medi", "1" }, + { "uni064A.medi.noDots", "1" }, + { "uni064A.noDots", "1" }, + { "uni064B", "3" }, + { "uni064C", "3" }, + { "uni064C.sixNine", "3" }, + { "uni064D", "3" }, + { "uni064E", "3" }, + { "uni064F", "3" }, + { "uni0650", "3" }, + { "uni0651", "3" }, + { "uni0651064B", "3" }, + { "uni0651064C", "3" }, + { "uni0651064D", "3" }, + { "uni0651064E", "3" }, + { "uni0651064F", "3" }, + { "uni06510650", "3" }, + { "uni0652", "3" }, + { "uni0652.downOpen", "3" }, + { "uni0652.leftOpen", "3" }, + { "uni0653", "3" }, + { "uni0654", "3" }, + { "uni0654064E", "3" }, + { "uni0654064F", "3" }, + { "uni0655", "3" }, + { "uni0656", "3" }, + { "uni0657", "3" }, + { "uni0658", "3" }, + { "uni0659", "3" }, + { "uni065A", "3" }, + { "uni065B", "3" }, + { "uni065C", "3" }, + { "uni065D", "3" }, + { "uni065E", "3" }, + { "uni0660", "1" }, + { "uni0660.Medium", "3" }, + { "uni0660.Small", "3" }, + { "uni0661", "1" }, + { "uni0661.Medium", "3" }, + { "uni0661.Small", "3" }, + { "uni0662", "1" }, + { "uni0662.Medium", "3" }, + { "uni0662.Small", "3" }, + { "uni0663", "1" }, + { "uni0663.Medium", "3" }, + { "uni0663.Small", "3" }, + { "uni0664", "1" }, + { "uni0664.Medium", "3" }, + { "uni0664.Small", "3" }, + { "uni0665", "1" }, + { "uni0665.Medium", "3" }, + { "uni0665.Small", "3" }, + { "uni0666", "1" }, + { "uni0666.Medium", "3" }, + { "uni0666.Small", "3" }, + { "uni0667", "1" }, + { "uni0667.Medium", "3" }, + { "uni0667.Small", "3" }, + { "uni0668", "1" }, + { "uni0668.Medium", "3" }, + { "uni0668.Small", "3" }, + { "uni0669", "1" }, + { "uni0669.Medium", "3" }, + { "uni0669.Small", "3" }, + { "uni066A", "1" }, + { "uni066B", "1" }, + { "uni066C", "1" }, + { "uni066D", "1" }, + { "uni066E", "1" }, + { "uni066E.fina", "1" }, + { "uni066E.init", "1" }, + { "uni066E.medi", "1" }, + { "uni066F", "1" }, + { "uni066F.fina", "1" }, + { "uni066F.init", "1" }, + { "uni066F.medi", "1" }, + { "uni0670", "3" }, + { "uni0670.large", "3" }, + { "uni0671", "1" }, + { "uni0671.fina", "1" }, + { "uni0671.fina.postLamIni", "1" }, + { "uni0671.fina.postLamMed", "1" }, + { "uni0672", "1" }, + { "uni0672.fina", "1" }, + { "uni0672.fina.postLamIni", "1" }, + { "uni0672.fina.postLamMed", "1" }, + { "uni0673", "1" }, + { "uni0673.fina", "1" }, + { "uni0673.fina.postLamIni", "1" }, + { "uni0673.fina.postLamMed", "1" }, + { "uni0674", "3" }, + { "uni0675", "1" }, + { "uni0675.fina", "1" }, + { "uni0675.fina.postLamIni", "1" }, + { "uni0675.fina.postLamMed", "1" }, + { "uni0676", "1" }, + { "uni0676.fina", "1" }, + { "uni0677", "1" }, + { "uni0677.fina", "1" }, + { "uni0678", "1" }, + { "uni0678.fina", "1" }, + { "uni0678.init", "1" }, + { "uni0678.medi", "1" }, + { "uni0679", "1" }, + { "uni0679.fina", "1" }, + { "uni0679.init", "1" }, + { "uni0679.medi", "1" }, + { "uni067A", "1" }, + { "uni067A.fina", "1" }, + { "uni067A.init", "1" }, + { "uni067A.medi", "1" }, + { "uni067B", "1" }, + { "uni067B.fina", "1" }, + { "uni067B.init", "1" }, + { "uni067B.medi", "1" }, + { "uni067C", "1" }, + { "uni067C.fina", "1" }, + { "uni067C.init", "1" }, + { "uni067C.medi", "1" }, + { "uni067D", "1" }, + { "uni067D.fina", "1" }, + { "uni067D.init", "1" }, + { "uni067D.medi", "1" }, + { "uni067E", "1" }, + { "uni067E.fina", "1" }, + { "uni067E.init", "1" }, + { "uni067E.medi", "1" }, + { "uni067F", "1" }, + { "uni067F.fina", "1" }, + { "uni067F.init", "1" }, + { "uni067F.medi", "1" }, + { "uni0680", "1" }, + { "uni0680.fina", "1" }, + { "uni0680.init", "1" }, + { "uni0680.medi", "1" }, + { "uni0681", "1" }, + { "uni0681.fina", "1" }, + { "uni0681.init", "1" }, + { "uni0681.medi", "1" }, + { "uni0682", "1" }, + { "uni0682.fina", "1" }, + { "uni0682.init", "1" }, + { "uni0682.medi", "1" }, + { "uni0683", "1" }, + { "uni0683.fina", "1" }, + { "uni0683.init", "1" }, + { "uni0683.medi", "1" }, + { "uni0684", "1" }, + { "uni0684.fina", "1" }, + { "uni0684.init", "1" }, + { "uni0684.medi", "1" }, + { "uni0685", "1" }, + { "uni0685.fina", "1" }, + { "uni0685.init", "1" }, + { "uni0685.medi", "1" }, + { "uni0686", "1" }, + { "uni0686.fina", "1" }, + { "uni0686.init", "1" }, + { "uni0686.medi", "1" }, + { "uni0687", "1" }, + { "uni0687.fina", "1" }, + { "uni0687.init", "1" }, + { "uni0687.medi", "1" }, + { "uni0688", "1" }, + { "uni0688.fina", "1" }, + { "uni0689", "1" }, + { "uni0689.fina", "1" }, + { "uni068A", "1" }, + { "uni068A.fina", "1" }, + { "uni068B", "1" }, + { "uni068B.fina", "1" }, + { "uni068C", "1" }, + { "uni068C.fina", "1" }, + { "uni068D", "1" }, + { "uni068D.fina", "1" }, + { "uni068E", "1" }, + { "uni068E.fina", "1" }, + { "uni068F", "1" }, + { "uni068F.fina", "1" }, + { "uni0690", "1" }, + { "uni0690.fina", "1" }, + { "uni0691", "1" }, + { "uni0691.fina", "1" }, + { "uni0692", "1" }, + { "uni0692.fina", "1" }, + { "uni0693", "1" }, + { "uni0693.fina", "1" }, + { "uni0694", "1" }, + { "uni0694.fina", "1" }, + { "uni0695", "1" }, + { "uni0695.fina", "1" }, + { "uni0696", "1" }, + { "uni0696.fina", "1" }, + { "uni0697", "1" }, + { "uni0697.fina", "1" }, + { "uni0698", "1" }, + { "uni0698.dotHat", "1" }, + { "uni0698.fina", "1" }, + { "uni0698.fina.dotHat", "1" }, + { "uni0699", "1" }, + { "uni0699.fina", "1" }, + { "uni069A", "1" }, + { "uni069A.fina", "1" }, + { "uni069A.init", "1" }, + { "uni069A.medi", "1" }, + { "uni069B", "1" }, + { "uni069B.fina", "1" }, + { "uni069B.init", "1" }, + { "uni069B.medi", "1" }, + { "uni069C", "1" }, + { "uni069C.fina", "1" }, + { "uni069C.init", "1" }, + { "uni069C.medi", "1" }, + { "uni069D", "1" }, + { "uni069D.fina", "1" }, + { "uni069D.init", "1" }, + { "uni069D.medi", "1" }, + { "uni069E", "1" }, + { "uni069E.fina", "1" }, + { "uni069E.init", "1" }, + { "uni069E.medi", "1" }, + { "uni069F", "1" }, + { "uni069F.fina", "1" }, + { "uni069F.init", "1" }, + { "uni069F.medi", "1" }, + { "uni06A0", "1" }, + { "uni06A0.fina", "1" }, + { "uni06A0.init", "1" }, + { "uni06A0.medi", "1" }, + { "uni06A1", "1" }, + { "uni06A1.fina", "1" }, + { "uni06A1.init", "1" }, + { "uni06A1.medi", "1" }, + { "uni06A2", "1" }, + { "uni06A2.fina", "1" }, + { "uni06A2.init", "1" }, + { "uni06A2.medi", "1" }, + { "uni06A3", "1" }, + { "uni06A3.fina", "1" }, + { "uni06A3.init", "1" }, + { "uni06A3.medi", "1" }, + { "uni06A4", "1" }, + { "uni06A4.fina", "1" }, + { "uni06A4.init", "1" }, + { "uni06A4.medi", "1" }, + { "uni06A5", "1" }, + { "uni06A5.fina", "1" }, + { "uni06A5.init", "1" }, + { "uni06A5.medi", "1" }, + { "uni06A6", "1" }, + { "uni06A6.fina", "1" }, + { "uni06A6.init", "1" }, + { "uni06A6.medi", "1" }, + { "uni06A7", "1" }, + { "uni06A7.fina", "1" }, + { "uni06A7.init", "1" }, + { "uni06A7.medi", "1" }, + { "uni06A8", "1" }, + { "uni06A8.fina", "1" }, + { "uni06A8.init", "1" }, + { "uni06A8.medi", "1" }, + { "uni06A9", "1" }, + { "uni06A9.fina", "1" }, + { "uni06A9.init", "1" }, + { "uni06A9.medi", "1" }, + { "uni06AA", "1" }, + { "uni06AA.fina", "1" }, + { "uni06AA.init", "1" }, + { "uni06AA.medi", "1" }, + { "uni06AB", "1" }, + { "uni06AB.fina", "1" }, + { "uni06AB.init", "1" }, + { "uni06AB.medi", "1" }, + { "uni06AC", "1" }, + { "uni06AC.fina", "1" }, + { "uni06AC.init", "1" }, + { "uni06AC.medi", "1" }, + { "uni06AD", "1" }, + { "uni06AD.fina", "1" }, + { "uni06AD.init", "1" }, + { "uni06AD.medi", "1" }, + { "uni06AE", "1" }, + { "uni06AE.fina", "1" }, + { "uni06AE.init", "1" }, + { "uni06AE.medi", "1" }, + { "uni06AF", "1" }, + { "uni06AF.fina", "1" }, + { "uni06AF.init", "1" }, + { "uni06AF.medi", "1" }, + { "uni06B0", "1" }, + { "uni06B0.fina", "1" }, + { "uni06B0.init", "1" }, + { "uni06B0.medi", "1" }, + { "uni06B1", "1" }, + { "uni06B1.fina", "1" }, + { "uni06B1.init", "1" }, + { "uni06B1.medi", "1" }, + { "uni06B2", "1" }, + { "uni06B2.fina", "1" }, + { "uni06B2.init", "1" }, + { "uni06B2.medi", "1" }, + { "uni06B3", "1" }, + { "uni06B3.fina", "1" }, + { "uni06B3.init", "1" }, + { "uni06B3.medi", "1" }, + { "uni06B4", "1" }, + { "uni06B4.fina", "1" }, + { "uni06B4.init", "1" }, + { "uni06B4.medi", "1" }, + { "uni06B5", "1" }, + { "uni06B5.fina", "1" }, + { "uni06B5.init", "1" }, + { "uni06B5.init.preAlef", "1" }, + { "uni06B5.medi", "1" }, + { "uni06B5.medi.preAlef", "1" }, + { "uni06B50627", "2" }, + { "uni06B50627.fina", "2" }, + { "uni06B6", "1" }, + { "uni06B6.fina", "1" }, + { "uni06B6.init", "1" }, + { "uni06B6.init.preAlef", "1" }, + { "uni06B6.medi", "1" }, + { "uni06B6.medi.preAlef", "1" }, + { "uni06B60627", "2" }, + { "uni06B60627.fina", "2" }, + { "uni06B7", "1" }, + { "uni06B7.fina", "1" }, + { "uni06B7.init", "1" }, + { "uni06B7.init.preAlef", "1" }, + { "uni06B7.medi", "1" }, + { "uni06B7.medi.preAlef", "1" }, + { "uni06B70627", "2" }, + { "uni06B70627.fina", "2" }, + { "uni06B8", "1" }, + { "uni06B8.fina", "1" }, + { "uni06B8.init", "1" }, + { "uni06B8.init.preAlef", "1" }, + { "uni06B8.medi", "1" }, + { "uni06B8.medi.preAlef", "1" }, + { "uni06B80627", "2" }, + { "uni06B80627.fina", "2" }, + { "uni06B9", "1" }, + { "uni06B9.fina", "1" }, + { "uni06B9.init", "1" }, + { "uni06B9.medi", "1" }, + { "uni06BA", "1" }, + { "uni06BA.fina", "1" }, + { "uni06BA.init", "1" }, + { "uni06BA.medi", "1" }, + { "uni06BB", "1" }, + { "uni06BB.fina", "1" }, + { "uni06BB.init", "1" }, + { "uni06BB.medi", "1" }, + { "uni06BC", "1" }, + { "uni06BC.fina", "1" }, + { "uni06BC.init", "1" }, + { "uni06BC.medi", "1" }, + { "uni06BD", "1" }, + { "uni06BD.fina", "1" }, + { "uni06BD.init", "1" }, + { "uni06BD.medi", "1" }, + { "uni06BE", "1" }, + { "uni06BE.fina", "1" }, + { "uni06BE.init", "1" }, + { "uni06BE.medi", "1" }, + { "uni06BF", "1" }, + { "uni06BF.fina", "1" }, + { "uni06BF.init", "1" }, + { "uni06BF.medi", "1" }, + { "uni06C0", "1" }, + { "uni06C0.fina", "1" }, + { "uni06C0.init", "1" }, + { "uni06C0.medi", "1" }, + { "uni06C1", "1" }, + { "uni06C1.fina", "1" }, + { "uni06C1.init", "1" }, + { "uni06C1.medi", "1" }, + { "uni06C2", "1" }, + { "uni06C2.fina", "1" }, + { "uni06C2.init", "1" }, + { "uni06C2.medi", "1" }, + { "uni06C3", "1" }, + { "uni06C3.fina", "1" }, + { "uni06C4", "1" }, + { "uni06C4.fina", "1" }, + { "uni06C5", "1" }, + { "uni06C5.fina", "1" }, + { "uni06C6", "1" }, + { "uni06C6.fina", "1" }, + { "uni06C7", "1" }, + { "uni06C7.fina", "1" }, + { "uni06C8", "1" }, + { "uni06C8.fina", "1" }, + { "uni06C9", "1" }, + { "uni06C9.fina", "1" }, + { "uni06CA", "1" }, + { "uni06CA.fina", "1" }, + { "uni06CB", "1" }, + { "uni06CB.fina", "1" }, + { "uni06CC", "1" }, + { "uni06CC.fina", "1" }, + { "uni06CC.init", "1" }, + { "uni06CC.medi", "1" }, + { "uni06CD", "1" }, + { "uni06CD.fina", "1" }, + { "uni06CE", "1" }, + { "uni06CE.fina", "1" }, + { "uni06CE.init", "1" }, + { "uni06CE.medi", "1" }, + { "uni06CF", "1" }, + { "uni06CF.fina", "1" }, + { "uni06D0", "1" }, + { "uni06D0.fina", "1" }, + { "uni06D0.init", "1" }, + { "uni06D0.medi", "1" }, + { "uni06D1", "1" }, + { "uni06D1.fina", "1" }, + { "uni06D1.init", "1" }, + { "uni06D1.medi", "1" }, + { "uni06D2", "1" }, + { "uni06D2.fina", "1" }, + { "uni06D3", "1" }, + { "uni06D3.fina", "1" }, + { "uni06D4", "1" }, + { "uni06D5", "1" }, + { "uni06D6", "3" }, + { "uni06D7", "3" }, + { "uni06D8", "3" }, + { "uni06D9", "3" }, + { "uni06DA", "3" }, + { "uni06DB", "3" }, + { "uni06DC", "3" }, + { "uni06DD", "1" }, + { "uni06DD.2", "1" }, + { "uni06DD.3", "1" }, + { "uni06DD.aat1", "1" }, + { "uni06DD.aat2", "1" }, + { "uni06DD.aat3", "1" }, + { "uni06DD.alt", "1" }, + { "uni06DD.alt.2", "1" }, + { "uni06DD.alt.3", "1" }, + { "uni06DD.alt.aat1", "1" }, + { "uni06DD.alt.aat2", "1" }, + { "uni06DD.alt.aat3", "1" }, + { "uni06DD.altB", "1" }, + { "uni06DD.altB.2", "1" }, + { "uni06DD.altB.3", "1" }, + { "uni06DD.altB.aat1", "1" }, + { "uni06DD.altB.aat2", "1" }, + { "uni06DD.altB.aat3", "1" }, + { "uni06DD.sp1", "1" }, + { "uni06DD.sp2", "1" }, + { "uni06DD.sp3", "1" }, + { "uni06DE", "1" }, + { "uni06DF", "3" }, + { "uni06E0", "3" }, + { "uni06E1", "3" }, + { "uni06E2", "3" }, + { "uni06E3", "3" }, + { "uni06E4", "3" }, + { "uni06E5", "3" }, + { "uni06E6", "3" }, + { "uni06E7", "3" }, + { "uni06E8", "3" }, + { "uni06E9", "1" }, + { "uni06EA", "3" }, + { "uni06EB", "3" }, + { "uni06EC", "3" }, + { "uni06ED", "3" }, + { "uni06EE", "1" }, + { "uni06EE.fina", "1" }, + { "uni06EF", "1" }, + { "uni06EF.fina", "1" }, + { "uni06F0", "1" }, + { "uni06F0.Medium", "3" }, + { "uni06F0.Small", "3" }, + { "uni06F1", "1" }, + { "uni06F1.Medium", "3" }, + { "uni06F1.Small", "3" }, + { "uni06F2", "1" }, + { "uni06F2.Medium", "3" }, + { "uni06F2.Small", "3" }, + { "uni06F3", "1" }, + { "uni06F3.Medium", "3" }, + { "uni06F3.Small", "3" }, + { "uni06F4", "1" }, + { "uni06F4.Medium", "3" }, + { "uni06F4.Medium.urdu", "3" }, + { "uni06F4.Small", "3" }, + { "uni06F4.Small.urdu", "3" }, + { "uni06F4.urdu", "1" }, + { "uni06F5", "1" }, + { "uni06F5.Medium", "3" }, + { "uni06F5.Small", "3" }, + { "uni06F6", "1" }, + { "uni06F6.Medium", "3" }, + { "uni06F6.Medium.urdu", "3" }, + { "uni06F6.Small", "3" }, + { "uni06F6.Small.urdu", "3" }, + { "uni06F6.urdu", "1" }, + { "uni06F7", "1" }, + { "uni06F7.Medium", "3" }, + { "uni06F7.Medium.urdu", "3" }, + { "uni06F7.Small", "3" }, + { "uni06F7.Small.urdu", "3" }, + { "uni06F7.urdu", "1" }, + { "uni06F8", "1" }, + { "uni06F8.Medium", "3" }, + { "uni06F8.Small", "3" }, + { "uni06F9", "1" }, + { "uni06F9.Medium", "3" }, + { "uni06F9.Small", "3" }, + { "uni06FA", "1" }, + { "uni06FA.fina", "1" }, + { "uni06FA.init", "1" }, + { "uni06FA.medi", "1" }, + { "uni06FB", "1" }, + { "uni06FB.fina", "1" }, + { "uni06FB.init", "1" }, + { "uni06FB.medi", "1" }, + { "uni06FC", "1" }, + { "uni06FC.fina", "1" }, + { "uni06FC.init", "1" }, + { "uni06FC.medi", "1" }, + { "uni06FD", "1" }, + { "uni06FE", "1" }, + { "uni06FF", "1" }, + { "uni06FF.fina", "1" }, + { "uni06FF.init", "1" }, + { "uni06FF.medi", "1" }, + { "uni0750", "1" }, + { "uni0750.fina", "1" }, + { "uni0750.init", "1" }, + { "uni0750.medi", "1" }, + { "uni0751", "1" }, + { "uni0751.fina", "1" }, + { "uni0751.init", "1" }, + { "uni0751.medi", "1" }, + { "uni0752", "1" }, + { "uni0752.fina", "1" }, + { "uni0752.init", "1" }, + { "uni0752.medi", "1" }, + { "uni0753", "1" }, + { "uni0753.fina", "1" }, + { "uni0753.init", "1" }, + { "uni0753.medi", "1" }, + { "uni0754", "1" }, + { "uni0754.fina", "1" }, + { "uni0754.init", "1" }, + { "uni0754.medi", "1" }, + { "uni0755", "1" }, + { "uni0755.fina", "1" }, + { "uni0755.init", "1" }, + { "uni0755.medi", "1" }, + { "uni0756", "1" }, + { "uni0756.fina", "1" }, + { "uni0756.init", "1" }, + { "uni0756.medi", "1" }, + { "uni0757", "1" }, + { "uni0757.fina", "1" }, + { "uni0757.init", "1" }, + { "uni0757.medi", "1" }, + { "uni0758", "1" }, + { "uni0758.fina", "1" }, + { "uni0758.init", "1" }, + { "uni0758.medi", "1" }, + { "uni0759", "1" }, + { "uni0759.fina", "1" }, + { "uni075A", "1" }, + { "uni075A.fina", "1" }, + { "uni075B", "1" }, + { "uni075B.fina", "1" }, + { "uni075C", "1" }, + { "uni075C.fina", "1" }, + { "uni075C.init", "1" }, + { "uni075C.medi", "1" }, + { "uni075D", "1" }, + { "uni075D.fina", "1" }, + { "uni075D.init", "1" }, + { "uni075D.medi", "1" }, + { "uni075E", "1" }, + { "uni075E.fina", "1" }, + { "uni075E.init", "1" }, + { "uni075E.medi", "1" }, + { "uni075F", "1" }, + { "uni075F.fina", "1" }, + { "uni075F.init", "1" }, + { "uni075F.medi", "1" }, + { "uni0760", "1" }, + { "uni0760.fina", "1" }, + { "uni0760.init", "1" }, + { "uni0760.medi", "1" }, + { "uni0761", "1" }, + { "uni0761.fina", "1" }, + { "uni0761.init", "1" }, + { "uni0761.medi", "1" }, + { "uni0762", "1" }, + { "uni0762.fina", "1" }, + { "uni0762.init", "1" }, + { "uni0762.medi", "1" }, + { "uni0763", "1" }, + { "uni0763.fina", "1" }, + { "uni0763.init", "1" }, + { "uni0763.medi", "1" }, + { "uni0764", "1" }, + { "uni0764.fina", "1" }, + { "uni0764.init", "1" }, + { "uni0764.medi", "1" }, + { "uni0765", "1" }, + { "uni0765.fina", "1" }, + { "uni0765.init", "1" }, + { "uni0765.medi", "1" }, + { "uni0766", "1" }, + { "uni0766.fina", "1" }, + { "uni0766.init", "1" }, + { "uni0766.medi", "1" }, + { "uni0767", "1" }, + { "uni0767.fina", "1" }, + { "uni0767.init", "1" }, + { "uni0767.medi", "1" }, + { "uni0768", "1" }, + { "uni0768.fina", "1" }, + { "uni0768.init", "1" }, + { "uni0768.medi", "1" }, + { "uni0769", "1" }, + { "uni0769.fina", "1" }, + { "uni0769.init", "1" }, + { "uni0769.medi", "1" }, + { "uni076A", "1" }, + { "uni076A.fina", "1" }, + { "uni076A.init", "1" }, + { "uni076A.init.preAlef", "1" }, + { "uni076A.medi", "1" }, + { "uni076A.medi.preAlef", "1" }, + { "uni076A0627", "2" }, + { "uni076A0627.fina", "2" }, + { "uni076B", "1" }, + { "uni076B.fina", "1" }, + { "uni076C", "1" }, + { "uni076C.fina", "1" }, + { "uni076D", "1" }, + { "uni076D.fina", "1" }, + { "uni076D.init", "1" }, + { "uni076D.medi", "1" }, + { "uni2000", "1" }, + { "uni2001", "1" }, + { "uni2002", "1" }, + { "uni2003", "1" }, + { "uni2004", "1" }, + { "uni2005", "1" }, + { "uni2006", "1" }, + { "uni2007", "1" }, + { "uni2008", "1" }, + { "uni2009", "1" }, + { "uni200A", "1" }, + { "uni200B", "1" }, + { "uni200C", "1" }, + { "uni200D", "1" }, + { "uni200E", "1" }, + { "uni200F", "1" }, + { "uni202A", "1" }, + { "uni202B", "1" }, + { "uni202C", "1" }, + { "uni202D", "1" }, + { "uni202E", "1" }, + { "uni2060", "1" }, + { "uni206C", "1" }, + { "uni206D", "1" }, + { "uni25CC", "1" }, + { "uniFD3E", "1" }, + { "uniFD3F", "1" }, + { "uniFDF2", "1" }, + { "uniFDFC", "1" }, + { "uniFEFF", "1" }, + { "v", "1" }, + { "w", "1" }, + { "x", "1" }, + { "y", "1" }, + { "z", "1" }, + { "zero", "1" }, + { "zeroMedium", "3" }, + { "zeroSmall", "3" }, + }, + }, + }; + + private static Object[][] ltAttachmentPoint = { + { GlyphDefinitionTable.GDEF_LOOKUP_TYPE_ATTACHMENT_POINT }, + // arab-001.ttx - not present + // arab-002.ttx - maybe add tests + // arab-003.ttx - maybe add tests + // arab-004.ttx - maybe add tests + }; + + private static Object[][] ltLigatureCaret = { + { GlyphDefinitionTable.GDEF_LOOKUP_TYPE_LIGATURE_CARET }, + // arab-001.ttx - not present + // arab-002.ttx - maybe add tests + // arab-003.ttx - maybe add tests + // arab-004.ttx - maybe add tests + }; + + private static Object[][] ltMarkAttachment = { + { GlyphDefinitionTable.GDEF_LOOKUP_TYPE_MARK_ATTACHMENT }, + // arab-001.ttx - not present + // arab-002.ttx - maybe add tests + // arab-003.ttx - maybe add tests + // arab-004.ttx - maybe add tests + }; + + @Test + public void testGDEFGlyphClass() throws Exception { + performLookups(ltGlyphClass); + } + + @Test + public void testGDEFAttachmentPoint() throws Exception { + performLookups(ltAttachmentPoint); + } + + @Test + public void testGDEFLigatureCaret() throws Exception { + performLookups(ltLigatureCaret); + } + + @Test + public void testGDEFMarkAttachment() throws Exception { + performLookups(ltMarkAttachment); + } + + /** + * Perform lookups on all test data in test specification TS. + * @param ts test specification + */ + private void performLookups(Object[][] ts) { + assert ts.length > 0; + Object[] tp = ts[0]; + for (int i = 1; i < ts.length; i++) { + performLookups(tp, ts[i]); + } + } + + /** + * Perform lookups on all test data TD using test parameters TP. + * @param tp test parameters + * @param td test data + */ + private void performLookups(Object[] tp, Object[] td) { + assert tp.length > 0; + if (td.length > 1) { + String fid = (String) td[0]; + String lid = (String) td[1]; + TTXFile tf = findTTX(fid); + assertTrue(tf != null); + GlyphDefinitionTable gdef = tf.getGDEF(); + assertTrue(gdef != null); + String[][] tia = (String[][]) td[2]; + switch ((int) ((Integer) tp[0])) { + case GlyphDefinitionTable.GDEF_LOOKUP_TYPE_GLYPH_CLASS: + performGlyphClassLookups(tf, lid, tia); + break; + case GlyphDefinitionTable.GDEF_LOOKUP_TYPE_ATTACHMENT_POINT: + performAttachmentPointLookups(tf, lid, tia); + break; + case GlyphDefinitionTable.GDEF_LOOKUP_TYPE_LIGATURE_CARET: + performLigatureCaretLookups(tf, lid, tia); + break; + case GlyphDefinitionTable.GDEF_LOOKUP_TYPE_MARK_ATTACHMENT: + performMarkAttachmentLookups(tf, lid, tia); + break; + default: + assertTrue("bad lookup type", false); + break; + } + } + } + + private void performGlyphClassLookups(TTXFile tf, String lid, String[][] tia) { + GlyphDefinitionTable gdef = tf.getGDEF(); + assert gdef != null; + for (String[] ti : tia) { + assert ti != null; + assert ti.length > 1; + String gn = ti[0]; + assert gn != null; + String cn = ti[1]; + assert cn != null; + int g = tf.getGlyph(gn); + assertTrue(g >= 0); + int oc = Integer.parseInt(cn); + int tc = gdef.getGlyphClass(g); + assertEquals("bad glyph class for glyph \'" + gn + "\', gid(" + g + ")", oc, tc); + } + } + + private void performAttachmentPointLookups(TTXFile tf, String lid, String[][] tia) { + // not yet supported by GDEF or test TTX files + } + + private void performLigatureCaretLookups(TTXFile tf, String lid, String[][] tia) { + // not yet supported by GDEF or test TTX files + } + + private void performMarkAttachmentLookups(TTXFile tf, String lid, String[][] tia) { + // not yet supported by GDEF or test TTX files + } + + private String findTTXPath(String fid) { + for (String[] fs : ttxFonts) { + if ((fs != null) && (fs.length > 1)) { + if (fs[0].equals(fid)) { + return ttxFilesRoot + File.separator + fs[1]; + } + } + } + return null; + } + + private TTXFile findTTX(String fid) { + String pn = findTTXPath(fid); + assertTrue(pn != null); + try { + TTXFile tf = TTXFile.getFromCache(pn); + return tf; + } catch (Exception e) { + fail(e.getMessage()); + return null; + } + } + +} diff --git a/src/test/java/org/apache/fop/complexscripts/fonts/GPOSTestCase.java b/src/test/java/org/apache/fop/complexscripts/fonts/GPOSTestCase.java new file mode 100644 index 000000000..cf63b4eff --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/fonts/GPOSTestCase.java @@ -0,0 +1,469 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.complexscripts.fonts; + +import java.io.File; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import org.apache.fop.complexscripts.fonts.GlyphTable.LookupTable; +import org.apache.fop.complexscripts.fonts.ttx.TTXFile; +import org.apache.fop.complexscripts.util.GlyphContextTester; +import org.apache.fop.complexscripts.util.GlyphSequence; +import org.apache.fop.complexscripts.util.ScriptContextTester; + +// CSOFF: LineLength + +public class GPOSTestCase implements ScriptContextTester, GlyphContextTester { + + private static String ttxFilesRoot = "test/resources/complexscripts"; + + private static String[][] ttxFonts = { + { "f0", "arab/ttx/arab-001.ttx" }, // simplified arabic + { "f1", "arab/ttx/arab-002.ttx" }, // traditional arabic + { "f2", "arab/ttx/arab-003.ttx" }, // lateef + { "f3", "arab/ttx/arab-004.ttx" }, // scheherazade + }; + + private static Object[][] ltSingle = { + { GlyphPositioningTable.GPOS_LOOKUP_TYPE_SINGLE }, + // arab-001.ttx + { "f0", "lu1", "arab", "dflt", "mark", + new Object[][] { + { + new String[] { "fathatan" }, + new int[][] { + { 0, 0, -412, 0 } + } + }, + { + new String[] { "fatha" }, + new int[][] { + { 0, 0, -410, 0 } + } + }, + }, + }, + { "f0", "lu9", "arab", "*", "*", + new Object[][] { + { + new String[] { "fathatan" }, + new int[][] { + { 50, 0, 0, 0 } + } + }, + { + new String[] { "fatha" }, + new int[][] { + { 50, 0, 0, 0 } + } + }, + }, + }, + { "f0", "lu10", "arab", "*", "*", + new Object[][] { + { + new String[] { "kasratan" }, + new int[][] { + { 0, -200, 0, 0 } + } + }, + { + new String[] { "kasra" }, + new int[][] { + { 0, -200, 0, 0 } + } + }, + }, + }, + { "f0", "lu11", "arab", "*", "*", + new Object[][] { + { + new String[] { "kasratan" }, + new int[][] { + { 0, -300, 0, 0 } + } + }, + { + new String[] { "kasra" }, + new int[][] { + { 0, -300, 0, 0 } + } + }, + { + new String[] { "uni0655" }, + new int[][] { + { 0, -250, 0, 0 } + } + }, + }, + }, + // arab-002.ttx - maybe add tests + // arab-003.ttx - maybe add tests + // arab-004.ttx - maybe add tests + }; + + private static Object[][] ltPair = { + { GlyphPositioningTable.GPOS_LOOKUP_TYPE_PAIR }, + // arab-001.ttx + { "f0", "lu0", "arab", "dflt", "kern", + new Object[][] { + { + new String[] { "wawwithhamzaabove", "hamza" }, + new int[][] { + { -300, 0, -300, 0 }, { 0, 0, 0, 0 } + } + }, + { + new String[] { "reh", "alefwithmaddaabove" }, + new int[][] { + { -500, 0, -500, 0 }, { 0, 0, 0, 0 } + } + }, + { + new String[] { "zain", "zain" }, + new int[][] { + { -190, 0, -190, 0 }, { 0, 0, 0, 0 } + } + }, + { + new String[] { "waw", "uni0649.init" }, + new int[][] { + { -145, 0, -145, 0 }, { 0, 0, 0, 0 } + } + }, + { + new String[] { "jeh", "uni06A5.init" }, + new int[][] { + { -345, 0, -345, 0 }, { 0, 0, 0, 0 } + } + }, + }, + }, + // arab-002.ttx - maybe add tests + // arab-003.ttx - maybe add tests + // arab-004.ttx - maybe add tests + }; + + private static Object[][] ltCursive = { + { GlyphPositioningTable.GPOS_LOOKUP_TYPE_CURSIVE }, + // arab-001.ttx - none used + // arab-002.ttx - none used + // arab-003.ttx - maybe add tests + { "f2", "lu0", "arab", "dflt", "curs", + new Object[][] { + { + new String[] { "uni0644.init.preAlef", "uni0622.fina.postLamIni" }, + new int[][] { + // { 576, 0, 0, 0 }, { 0, 0, 0, 0 } - with zero widths + { 295, 0, 0, 0 }, { 0, 0, 0, 0 } + } + }, + { + new String[] { "uni0644.medi.preAlef", "uni0622.fina.postLamMed" }, + new int[][] { + // { 550, 0, 0, 0 }, { 0, 0, 0, 0 } - with zero widths + { 282, 0, 0, 0 }, { 0, 0, 0, 0 } + } + }, + }, + }, + // arab-004.ttx - none used + }; + + private static Object[][] ltMarkToBase = { + { GlyphPositioningTable.GPOS_LOOKUP_TYPE_MARK_TO_BASE }, + // arab-001.ttx - maybe add tests + // arab-002.ttx + { "f1", "lu4", "arab", "dflt", "mark", + new Object[][] { + { + new String[] { "beh", "fatha" }, + new int[][] { + // { 0, 0, 0, 0 }, { 266, -672, 0, 0 } - with zero widths + { 0, 0, 0, 0 }, { 266, -672, -199, 0 } + } + }, + { + new String[] { "alefwithhamzabelow", "kasra" }, + new int[][] { + // { 0, 0, 0, 0 }, { -48, 344, 0, 0 } - with zero widths + { 0, 0, 0, 0 }, { -48, 344, -199, 0 } + } + }, + }, + }, + // arab-003.ttx - maybe add tests + // arab-004.ttx - maybe add tests + }; + + private static Object[][] ltMarkToLigature = { + { GlyphPositioningTable.GPOS_LOOKUP_TYPE_MARK_TO_LIGATURE }, + // arab-001.ttx + { "f0", "lu4", "arab", "dflt", "mark", + new Object[][] { + { + new String[] { "rayaleflam", "fatha", "fatha", "fatha", "fatha" }, + new int[][] { + { 0, 0, 0, 0 }, { 1260, -1150, 0, 0 }, { 910, -1020, 0, 0 }, { 590, -630, 0, 0 }, { 110, -720, 0, 0 } + } + }, + { + new String[] { "rayaleflam", "kasra", "kasra", "kasra", "kasra" }, + new int[][] { + { 0, 0, 0, 0 }, { 1110 , 225, 0, 0 }, { 760, 275, 0, 0 }, { 520, 475, 0, 0 }, { 110, 425, 0, 0 } + } + }, + }, + }, + // arab-002.ttx - maybe add tests + // arab-003.ttx - maybe add tests + // arab-004.ttx - maybe add tests + }; + + private static Object[][] ltMarkToMark = { + { GlyphPositioningTable.GPOS_LOOKUP_TYPE_MARK_TO_MARK }, + // arab-001.ttx - maybe add tests + // arab-002.ttx - maybe add tests + // arab-003.ttx - maybe add tests + // arab-004.ttx + { "f3", "lu3", "arab", "dflt", "mkmk", + new Object[][] { + { + new String[] { "uni064F", "uni064E" }, + new int[][] { + { 0, 0, 0, 0 }, { -15, 495, 0, 0 } + } + }, + { + new String[] { "uni0651", "uni0670" }, + new int[][] { + { 0, 0, 0, 0 }, { -30, 705, 0, 0 } + } + }, + }, + }, + }; + + private static Object[][] ltContextual = { + { GlyphPositioningTable.GPOS_LOOKUP_TYPE_CONTEXTUAL }, + // arab-001.ttx - none used + // arab-002.ttx - none used + // arab-003.ttx - none used + // arab-004.ttx - none used + }; + + private static Object[][] ltChainedContextual = { + { GlyphPositioningTable.GPOS_LOOKUP_TYPE_CHAINED_CONTEXTUAL }, + // arab-001.ttx + { "f0", "lu3", "arab", "dflt", "mark", + new Object[][] { + { + new String[] { "behmedial", "fatha", "lam" }, + new int[][] { + { 0, 0, 0, 0 }, { 50, 0, 0, 0 }, { 0, 0, 0, 0 } + } + }, + }, + }, + // arab-002.ttx + { "f1", "lu6", "arab", "dflt", "mark", + new Object[][] { + { + new String[] { "zain", "fatha", "kafinitial" }, + new int[][] { + { 0, 250, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 } + } + }, + }, + }, + // arab-003.ttx - none used + // arab-004.ttx + { "f3", "lu5", "arab", "dflt", "mark", + new Object[][] { + { + new String[] { "uni064D", "uni0622.fina.postLamIni", "uni0650" }, + new int[][] { + { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 55, 424, 0, 0 } + } + }, + }, + }, + }; + + @Test + public void testGPOSSingle() throws Exception { + performPositioning(ltSingle); + } + + @Test + public void testGPOSPair() throws Exception { + performPositioning(ltPair); + } + + @Test + public void testGPOSCursive() throws Exception { + performPositioning(ltCursive); + } + + @Test + public void testGPOSMarkToBase() throws Exception { + performPositioning(ltMarkToBase); + } + + @Test + public void testGPOSMarkToLigature() throws Exception { + performPositioning(ltMarkToLigature); + } + + @Test + public void testGPOSMarkToMark() throws Exception { + performPositioning(ltMarkToMark); + } + + @Test + public void testGPOSContextual() throws Exception { + performPositioning(ltContextual); + } + + @Test + public void testGPOSChainedContextual() throws Exception { + performPositioning(ltChainedContextual); + } + + /** + * Perform positioning on all test data in test specification TS. + * @param ts test specification + */ + private void performPositioning(Object[][] ts) { + assert ts.length > 0; + Object[] tp = ts[0]; + for (int i = 1; i < ts.length; i++) { + performPositioning(tp, ts[i]); + } + } + + /** + * Perform positioning on all test data TD using test parameters TP. + * @param tp test parameters + * @param td test data + */ + private void performPositioning(Object[] tp, Object[] td) { + assert tp.length > 0; + if (td.length > 5) { + String fid = (String) td[0]; + String lid = (String) td[1]; + String script = (String) td[2]; + String language = (String) td[3]; + String feature = (String) td[4]; + TTXFile tf = findTTX(fid); + assertTrue(tf != null); + GlyphPositioningTable gpos = tf.getGPOS(); + assertTrue(gpos != null); + GlyphPositioningSubtable[] sta = findGPOSSubtables(gpos, script, language, feature, lid); + assertTrue(sta != null); + assertTrue(sta.length > 0); + ScriptContextTester sct = findScriptContextTester(script, language, feature); + Object[][] tia = (Object[][]) td[5]; // test instance array + for (Object[] ti : tia) { // test instance + if (ti != null) { + if (ti.length > 0) { // must have at least input glyphs + String[] igia = (String[]) ti[0]; // input glyph id array + int[][] ogpa = (int[][]) ti[1]; // output glyph positioning array + GlyphSequence igs = tf.getGlyphSequence(igia); + int[] widths = tf.getWidths(); + int[][] tgpa = new int [ igia.length ] [ 4 ]; + boolean adjusted = GlyphPositioningSubtable.position(igs, script, language, feature, 1000, sta, widths, tgpa, sct); + assertTrue(adjusted); + assertSamePositions(ogpa, tgpa); + } + } + } + } + } + + private String findTTXPath(String fid) { + for (String[] fs : ttxFonts) { + if ((fs != null) && (fs.length > 1)) { + if (fs[0].equals(fid)) { + return ttxFilesRoot + File.separator + fs[1]; + } + } + } + return null; + } + + private TTXFile findTTX(String fid) { + String pn = findTTXPath(fid); + assertTrue(pn != null); + try { + TTXFile tf = TTXFile.getFromCache(pn); + return tf; + } catch (Exception e) { + fail(e.getMessage()); + return null; + } + } + + private GlyphPositioningSubtable[] findGPOSSubtables(GlyphPositioningTable gpos, String script, String language, String feature, String lid) { + LookupTable lt = gpos.getLookupTable(lid); + if (lt != null) { + return (GlyphPositioningSubtable[]) lt.getSubtables(); + } else { + return null; + } + } + + private ScriptContextTester findScriptContextTester(String script, String language, String feature) { + return this; + } + + public GlyphContextTester getTester(String feature) { + return this; + } + + public boolean test(String script, String language, String feature, GlyphSequence gs, int index, int flags) { + return true; + } + + private void assertSamePositions(int[][] pa1, int[][] pa2) { + assertNotNull(pa1); + assertNotNull(pa2); + assertEquals("unequal adjustment count", pa1.length, pa2.length); + for (int i = 0; i < pa1.length; i++) { + int[] a1 = pa1 [ i ]; + int[] a2 = pa2 [ i ]; + assertNotNull(a1); + assertNotNull(a2); + assertEquals("bad adjustment array length", 4, a1.length); + assertEquals("bad adjustment array length", 4, a2.length); + for (int k = 0; k < a1.length; k++) { + int p1 = a1[k]; + int p2 = a2[k]; + assertEquals("bad adjustment", p1, p2); + } + } + } +} diff --git a/src/test/java/org/apache/fop/complexscripts/fonts/GSUBTestCase.java b/src/test/java/org/apache/fop/complexscripts/fonts/GSUBTestCase.java new file mode 100644 index 000000000..3f23d9ab3 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/fonts/GSUBTestCase.java @@ -0,0 +1,2262 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.complexscripts.fonts; + +import java.io.File; +import java.nio.IntBuffer; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import org.apache.fop.complexscripts.fonts.GlyphTable.LookupTable; +import org.apache.fop.complexscripts.fonts.ttx.TTXFile; +import org.apache.fop.complexscripts.util.GlyphContextTester; +import org.apache.fop.complexscripts.util.GlyphSequence; +import org.apache.fop.complexscripts.util.ScriptContextTester; + +// CSOFF: LineLength + +public class GSUBTestCase implements ScriptContextTester, GlyphContextTester { + + private static String ttxFilesRoot = "test/resources/complexscripts"; + + private static String[][] ttxFonts = { + { "f0", "arab/ttx/arab-001.ttx" }, // simplified arabic + { "f1", "arab/ttx/arab-002.ttx" }, // traditional arabic + { "f2", "arab/ttx/arab-003.ttx" }, // lateef + { "f3", "arab/ttx/arab-004.ttx" }, // scheherazade + }; + + private static Object[][] ltSingle = { + { GlyphSubstitutionTable.GSUB_LOOKUP_TYPE_SINGLE }, + // arab-001.ttx + { "f0", "lu2", "arab", "dflt", "isol", + new String[][][] { + { { "ainisolated" }, { "ain" } }, + { { "alefmaksuraisolated" }, { "alefmaksura" } }, + { { "behisolated" }, { "beh" } }, + { { "dadisolated" }, { "dad" } }, + { { "dalisolated" }, { "dal" } }, + { { "farsiyehisolated" }, { "farsiyeh" } }, + { { "fehisolated" }, { "feh" } }, + { { "gafisolated" }, { "gaf" } }, + { { "ghainisolated" }, { "ghain" } }, + { { "hahisolated" }, { "hah" } }, + { { "jeemisolated" }, { "jeem" } }, + { { "jehisolated" }, { "jeh" } }, + { { "kafisolated" }, { "arabickaf" } }, + { { "kehehisolated" }, { "keheh" } }, + { { "khahisolated" }, { "khah" } }, + { { "meemisolated" }, { "meem" } }, + { { "noonisolated" }, { "noon" } }, + { { "pehisolated" }, { "peh" } }, + { { "qafisolated" }, { "qaf" } }, + { { "rehisolated" }, { "reh" } }, + { { "sadisolated" }, { "sad" } }, + { { "seenisolated" }, { "seen" } }, + { { "sheenisolated" }, { "sheen" } }, + { { "tahisolated" }, { "tah" } }, + { { "tchehisolated" }, { "tcheh" } }, + { { "tehisolated" }, { "teh" } }, + { { "tehmarbutaisolated" }, { "tehmarbuta" } }, + { { "thalisolated" }, { "thal" } }, + { { "thehisolated" }, { "theh" } }, + { { "vehisolated" }, { "veh" } }, + { { "wawisolated" }, { "waw" } }, + { { "yehisolated" }, { "yeh" } }, + { { "yehwithhamzaaboveisolated" }, { "yehwithhamzaabove" } }, + { { "zahisolated" }, { "zah" } }, + { { "zainisolated" }, { "zain" } }, + }, + }, + { "f0", "lu4", "arab", "dflt", "fina", + new String[][][] { + { { "ain" }, { "ainfinal" } }, + { { "alefmaksura" }, { "alefmaksurafinal" } }, + { { "alefwasla" }, { "alefwaslafinal" } }, + { { "alefwithhamzaabove" }, { "alefwithhamzaabovefinal" } }, + { { "alefwithhamzabelow" }, { "alefwithhamzabelowfinal" } }, + { { "alefwithmaddaabove" }, { "alefwithmaddaabovefinal" } }, + { { "arabicae" }, { "hehfinal" } }, + { { "arabicalef" }, { "aleffinal" } }, + { { "arabickaf" }, { "arabickaf" } }, + { { "beh" }, { "beh" } }, + { { "dad" }, { "dad" } }, + { { "dal" }, { "dal" } }, + { { "farsiyeh" }, { "farsiyehfinal" } }, + { { "feh" }, { "feh" } }, + { { "gaf" }, { "gaffinal" } }, + { { "ghain" }, { "ghainfinal" } }, + { { "hah" }, { "hahfinal" } }, + { { "heh" }, { "hehfinal" } }, + { { "jeem" }, { "jeemfinal" } }, + { { "jeh" }, { "jeh" } }, + { { "keheh" }, { "kehehfinal" } }, + { { "khah" }, { "khahfinal" } }, + { { "lam" }, { "lam" } }, + { { "meem" }, { "meem" } }, + { { "noon" }, { "noon" } }, + { { "peh" }, { "peh" } }, + { { "qaf" }, { "qaf" } }, + { { "reh" }, { "reh" } }, + { { "sad" }, { "sad" } }, + { { "seen" }, { "seen" } }, + { { "sheen" }, { "sheen" } }, + { { "tah" }, { "tah" } }, + { { "tcheh" }, { "tchehfinal" } }, + { { "teh" }, { "teh" } }, + { { "tehmarbuta" }, { "tehmarbutafinal" } }, + { { "thal" }, { "thal" } }, + { { "theh" }, { "theh" } }, + { { "veh" }, { "veh" } }, + { { "waw" }, { "waw" } }, + { { "wawwithhamzaabove" }, { "wawwithhamzaabove" } }, + { { "yeh" }, { "yehfinal" } }, + { { "yehwithhamzaabove" }, { "yehwithhamzaabovefinal" } }, + { { "zah" }, { "zah" } }, + { { "zain" }, { "zain" } }, + } + }, + { "f0", "lu5", "arab", "dflt", "init", + new String[][][] { + { { "ain" }, { "aininitial" } }, + { { "alefmaksura" }, { "uni0649.init" } }, + { { "arabickaf" }, { "kafmedial" } }, + { { "beh" }, { "behmedial" } }, + { { "dad" }, { "dadmedial" } }, + { { "farsiyeh" }, { "yehmedial" } }, + { { "feh" }, { "fehinitial" } }, + { { "gaf" }, { "gafinitial" } }, + { { "ghain" }, { "ghaininitial" } }, + { { "hah" }, { "hahmedial" } }, + { { "heh" }, { "hehinitial" } }, + { { "jeem" }, { "jeemmedial" } }, + { { "keheh" }, { "kehehinitial" } }, + { { "khah" }, { "khahmedial" } }, + { { "lam" }, { "lamisolated" } }, + { { "meem" }, { "meemmedial" } }, + { { "noon" }, { "noonmedial" } }, + { { "peh" }, { "pehmedial" } }, + { { "qaf" }, { "qafinitial" } }, + { { "sad" }, { "sadmedial" } }, + { { "seen" }, { "seenmedial" } }, + { { "sheen" }, { "sheenmedial" } }, + { { "tah" }, { "tah" } }, + { { "tcheh" }, { "tchehmedial" } }, + { { "teh" }, { "tehmedial" } }, + { { "theh" }, { "thehmedial" } }, + { { "veh" }, { "uni06A5.init" } }, + { { "yeh" }, { "yehmedial" } }, + { { "yehwithhamzaabove" }, { "yehwithhamzaabovemedial" } }, + { { "zah" }, { "zah" } }, + } + }, + { "f0", "lu6", "arab", "dflt", "medi", + new String[][][] { + { { "ain" }, { "ainmedial" } }, + { { "alefmaksura" }, { "uni0649.init" } }, + { { "arabickaf" }, { "kafmedial" } }, + { { "beh" }, { "behmedial" } }, + { { "dad" }, { "dadmedial" } }, + { { "farsiyeh" }, { "yehmedial" } }, + { { "feh" }, { "fehmedial" } }, + { { "gaf" }, { "gafmedial" } }, + { { "ghain" }, { "ghainmedial" } }, + { { "hah" }, { "hahmedial" } }, + { { "heh" }, { "hehmedial" } }, + { { "jeem" }, { "jeemmedial" } }, + { { "keheh" }, { "kehehmedial" } }, + { { "khah" }, { "khahmedial" } }, + { { "lam" }, { "lammedial" } }, + { { "meem" }, { "meemmedial" } }, + { { "noon" }, { "noonmedial" } }, + { { "peh" }, { "pehmedial" } }, + { { "qaf" }, { "qafmedial" } }, + { { "sad" }, { "sadmedial" } }, + { { "seen" }, { "seenmedial" } }, + { { "sheen" }, { "sheenmedial" } }, + { { "tah" }, { "tah" } }, + { { "tcheh" }, { "tchehmedial" } }, + { { "teh" }, { "tehmedial" } }, + { { "theh" }, { "thehmedial" } }, + { { "veh" }, { "vehmedial" } }, + { { "yeh" }, { "yehmedial" } }, + { { "yehwithhamzaabove" }, { "yehwithhamzaabovemedial" } }, + { { "zah" }, { "zah" } }, + } + }, + // arab-002.ttx + { "f1", "lu1", "arab", "*", "isol", + new String[][][] { + { { "ainisolated" }, { "ain" } }, + { { "alefmaksuraisolated" }, { "alefmaksura" } }, + { { "behisolated" }, { "beh" } }, + { { "dadisolated" }, { "dad" } }, + { { "dalisolated" }, { "dal" } }, + { { "farsiyehisolated" }, { "farsiyeh" } }, + { { "fehisolated" }, { "feh" } }, + { { "gafisolated" }, { "gaf" } }, + { { "ghainisolated" }, { "ghain" } }, + { { "hahisolated" }, { "hah" } }, + { { "jeemisolated" }, { "jeem" } }, + { { "jehisolated" }, { "jeh" } }, + { { "kafisolated" }, { "arabickaf" } }, + { { "kehehisolated" }, { "keheh" } }, + { { "khahisolated" }, { "khah" } }, + { { "meemisolated" }, { "meem" } }, + { { "noonisolated" }, { "noon" } }, + { { "pehisolated" }, { "peh" } }, + { { "qafisolated" }, { "qaf" } }, + { { "rehisolated" }, { "reh" } }, + { { "sadisolated" }, { "sad" } }, + { { "seenisolated" }, { "seen" } }, + { { "sheenisolated" }, { "sheen" } }, + { { "tahisolated" }, { "tah" } }, + { { "tchehisolated" }, { "tcheh" } }, + { { "tehisolated" }, { "teh" } }, + { { "tehmarbutaisolated" }, { "tehmarbuta" } }, + { { "thalisolated" }, { "thal" } }, + { { "thehisolated" }, { "theh" } }, + { { "vehisolated" }, { "veh" } }, + { { "wawisolated" }, { "waw" } }, + { { "yehisolated" }, { "yeh" } }, + { { "yehwithhamzaaboveisolated" }, { "yehwithhamzaabove" } }, + { { "zahisolated" }, { "zah" } }, + { { "zainisolated" }, { "zain" } }, + } + }, + { "f1", "lu3", "arab", "*", "fina", + new String[][][] { + { { "ain" }, { "ainfinal" } }, + { { "alefmaksura" }, { "alefmaksurafinal" } }, + { { "alefwasla" }, { "alefwaslafinal" } }, + { { "alefwithhamzaabove" }, { "alefwithhamzaabovefinal" } }, + { { "alefwithhamzabelow" }, { "alefwithhamzabelowfinal" } }, + { { "alefwithmaddaabove" }, { "alefwithmaddaabovefinal" } }, + { { "arabicae" }, { "hehfinal" } }, + { { "arabicalef" }, { "aleffinal" } }, + { { "arabickaf" }, { "arabickaffinal" } }, + { { "beh" }, { "behfinal" } }, + { { "dad" }, { "dadfinal" } }, + { { "dal" }, { "dalfinal" } }, + { { "farsiyeh" }, { "farsiyehfinal" } }, + { { "feh" }, { "fehfinal" } }, + { { "gaf" }, { "gaffinal" } }, + { { "ghain" }, { "ghainfinal" } }, + { { "hah" }, { "hahfinal" } }, + { { "heh" }, { "hehfinal" } }, + { { "jeem" }, { "jeemfinal" } }, + { { "jeh" }, { "jehfinal" } }, + { { "keheh" }, { "kehehfinal" } }, + { { "khah" }, { "khahfinal" } }, + { { "lam" }, { "lamfinal" } }, + { { "meem" }, { "meemfinal" } }, + { { "noon" }, { "noonfinal" } }, + { { "peh" }, { "pehfinal" } }, + { { "qaf" }, { "qaffinal" } }, + { { "reh" }, { "rehfinal" } }, + { { "sad" }, { "sadfinal" } }, + { { "seen" }, { "seenfinal" } }, + { { "sheen" }, { "sheenfinal" } }, + { { "tah" }, { "tahfinal" } }, + { { "tcheh" }, { "tchehfinal" } }, + { { "teh" }, { "tehfinal" } }, + { { "tehmarbuta" }, { "tehmarbutafinal" } }, + { { "thal" }, { "thalfinal" } }, + { { "theh" }, { "thehfinal" } }, + { { "veh" }, { "vehfinal" } }, + { { "waw" }, { "wawfinal" } }, + { { "wawwithhamzaabove" }, { "wawwithhamzaabovefinal" } }, + { { "yeh" }, { "yehfinal" } }, + { { "yehwithhamzaabove" }, { "yehwithhamzaabovefinal" } }, + { { "zah" }, { "zahfinal" } }, + { { "zain" }, { "zainfinal" } }, + } + }, + { "f1", "lu4", "arab", "*", "init", + new String[][][] { + { { "ain" }, { "aininitial" } }, + { { "alefmaksura" }, { "uni0649.init" } }, + { { "arabickaf" }, { "kafinitial" } }, + { { "beh" }, { "behinitial" } }, + { { "dad" }, { "dadinitial" } }, + { { "farsiyeh" }, { "yehinitial" } }, + { { "feh" }, { "fehinitial" } }, + { { "gaf" }, { "gafinitial" } }, + { { "ghain" }, { "ghaininitial" } }, + { { "hah" }, { "hahinitial" } }, + { { "heh" }, { "hehinitial" } }, + { { "jeem" }, { "jeeminitial" } }, + { { "keheh" }, { "kehehinitial" } }, + { { "khah" }, { "khahinitial" } }, + { { "lam" }, { "laminitial" } }, + { { "meem" }, { "meeminitial" } }, + { { "noon" }, { "nooninitial" } }, + { { "peh" }, { "pehinitial" } }, + { { "qaf" }, { "qafinitial" } }, + { { "sad" }, { "sadinitial" } }, + { { "seen" }, { "seeninitial" } }, + { { "sheen" }, { "sheeninitial" } }, + { { "tah" }, { "tahinitial" } }, + { { "tcheh" }, { "tchehinitial" } }, + { { "teh" }, { "tehinitial" } }, + { { "theh" }, { "thehinitial" } }, + { { "veh" }, { "vehinitial" } }, + { { "yeh" }, { "yehinitial" } }, + { { "yehwithhamzaabove" }, { "yehwithhamzaaboveinitial" } }, + { { "zah" }, { "zahinitial" } }, + } + }, + { "f1", "lu5", "arab", "*", "medi", + new String[][][] { + { { "ain" }, { "ainmedial" } }, + { { "alefmaksura" }, { "uni0649.medi" } }, + { { "arabickaf" }, { "kafmedial" } }, + { { "beh" }, { "behmedial" } }, + { { "dad" }, { "dadmedial" } }, + { { "farsiyeh" }, { "yehmedial" } }, + { { "feh" }, { "fehmedial" } }, + { { "gaf" }, { "gafmedial" } }, + { { "ghain" }, { "ghainmedial" } }, + { { "hah" }, { "hahmedial" } }, + { { "heh" }, { "hehmedial" } }, + { { "jeem" }, { "jeemmedial" } }, + { { "keheh" }, { "kehehmedial" } }, + { { "khah" }, { "khahmedial" } }, + { { "lam" }, { "lammedial" } }, + { { "meem" }, { "meemmedial" } }, + { { "noon" }, { "noonmedial" } }, + { { "peh" }, { "pehmedial" } }, + { { "qaf" }, { "qafmedial" } }, + { { "sad" }, { "sadmedial" } }, + { { "seen" }, { "seenmedial" } }, + { { "sheen" }, { "sheenmedial" } }, + { { "tah" }, { "tahmedial" } }, + { { "tcheh" }, { "tchehmedial" } }, + { { "teh" }, { "tehmedial" } }, + { { "theh" }, { "thehmedial" } }, + { { "veh" }, { "vehmedial" } }, + { { "yeh" }, { "yehmedial" } }, + { { "yehwithhamzaabove" }, { "yehwithhamzaabovemedial" } }, + { { "zah" }, { "zahmedial" } }, + } + }, + { "f1", "lu13", "arab", "*", "*", + new String[][][] { + { { "heh" }, { "hehisolated" } }, + } + }, + // arab-003.ttx + { "f2", "lu1", "arab", "dflt", "init", + new String[][][] { + { { "absJeemRetro1" }, { "absJeemRetro1Ini" } }, + { { "absJeemRetro2" }, { "absJeemRetro2Ini" } }, + { { "absJeemRetro3" }, { "absJeemRetro3Ini" } }, + { { "absLamRetro" }, { "absLamRetroIni" } }, + { { "absSheenRetro1" }, { "absSheenRetro1Ini" } }, + { { "absSheenRetro2" }, { "absSheenRetro2Ini" } }, + { { "absTchehRetro1" }, { "absTchehRetro1Ini" } }, + { { "absTchehRetro2" }, { "absTchehRetro2Ini" } }, + { { "uni0626" }, { "uni0626.init" } }, + { { "uni0628" }, { "uni0628.init" } }, + { { "uni062A" }, { "uni062A.init" } }, + { { "uni062B" }, { "uni062B.init" } }, + { { "uni062C" }, { "uni062C.init" } }, + { { "uni062D" }, { "uni062D.init" } }, + { { "uni062E" }, { "uni062E.init" } }, + { { "uni0633" }, { "uni0633.init" } }, + { { "uni0634" }, { "uni0634.init" } }, + { { "uni0635" }, { "uni0635.init" } }, + { { "uni0636" }, { "uni0636.init" } }, + { { "uni0637" }, { "uni0637.init" } }, + { { "uni0638" }, { "uni0638.init" } }, + { { "uni0639" }, { "uni0639.init" } }, + { { "uni063A" }, { "uni063A.init" } }, + { { "uni0641" }, { "uni0641.init" } }, + { { "uni0642" }, { "uni0642.init" } }, + { { "uni0643" }, { "uni0643.init" } }, + { { "uni0644" }, { "uni0644.init" } }, + { { "uni0645" }, { "uni0645.init" } }, + { { "uni0646" }, { "uni0646.init" } }, + { { "uni0647" }, { "uni0647.init" } }, + { { "uni0649" }, { "uni0649.init" } }, + { { "uni064A" }, { "uni064A.init" } }, + { { "uni064A.noDots" }, { "uni064A.init.noDots" } }, + { { "uni066E" }, { "uni066E.init" } }, + { { "uni066F" }, { "uni066F.init" } }, + { { "uni0678" }, { "uni0678.init" } }, + { { "uni0679" }, { "uni0679.init" } }, + { { "uni067A" }, { "uni067A.init" } }, + { { "uni067B" }, { "uni067B.init" } }, + { { "uni067C" }, { "uni067C.init" } }, + { { "uni067D" }, { "uni067D.init" } }, + { { "uni067E" }, { "uni067E.init" } }, + { { "uni067F" }, { "uni067F.init" } }, + { { "uni0680" }, { "uni0680.init" } }, + { { "uni0681" }, { "uni0681.init" } }, + { { "uni0682" }, { "uni0682.init" } }, + { { "uni0683" }, { "uni0683.init" } }, + { { "uni0684" }, { "uni0684.init" } }, + { { "uni0685" }, { "uni0685.init" } }, + { { "uni0686" }, { "uni0686.init" } }, + { { "uni0687" }, { "uni0687.init" } }, + { { "uni069A" }, { "uni069A.init" } }, + { { "uni069B" }, { "uni069B.init" } }, + { { "uni069C" }, { "uni069C.init" } }, + { { "uni069D" }, { "uni069D.init" } }, + { { "uni069E" }, { "uni069E.init" } }, + { { "uni069F" }, { "uni069F.init" } }, + { { "uni06A0" }, { "uni06A0.init" } }, + { { "uni06A1" }, { "uni06A1.init" } }, + { { "uni06A2" }, { "uni06A2.init" } }, + { { "uni06A3" }, { "uni06A3.init" } }, + { { "uni06A4" }, { "uni06A4.init" } }, + { { "uni06A5" }, { "uni06A5.init" } }, + { { "uni06A6" }, { "uni06A6.init" } }, + { { "uni06A7" }, { "uni06A7.init" } }, + { { "uni06A8" }, { "uni06A8.init" } }, + { { "uni06A9" }, { "uni06A9.init" } }, + { { "uni06AA" }, { "uni06AA.init" } }, + { { "uni06AB" }, { "uni06AB.init" } }, + { { "uni06AC" }, { "uni06AC.init" } }, + { { "uni06AD" }, { "uni06AD.init" } }, + { { "uni06AE" }, { "uni06AE.init" } }, + { { "uni06AF" }, { "uni06AF.init" } }, + { { "uni06B0" }, { "uni06B0.init" } }, + { { "uni06B1" }, { "uni06B1.init" } }, + { { "uni06B2" }, { "uni06B2.init" } }, + { { "uni06B3" }, { "uni06B3.init" } }, + { { "uni06B4" }, { "uni06B4.init" } }, + { { "uni06B5" }, { "uni06B5.init" } }, + { { "uni06B6" }, { "uni06B6.init" } }, + { { "uni06B7" }, { "uni06B7.init" } }, + { { "uni06B8" }, { "uni06B8.init" } }, + { { "uni06B9" }, { "uni06B9.init" } }, + { { "uni06BA" }, { "uni06BA.init" } }, + { { "uni06BB" }, { "uni06BB.init" } }, + { { "uni06BC" }, { "uni06BC.init" } }, + { { "uni06BD" }, { "uni06BD.init" } }, + { { "uni06BE" }, { "uni06BE.init" } }, + { { "uni06BF" }, { "uni06BF.init" } }, + { { "uni06C1" }, { "uni06C1.init" } }, + { { "uni06C2" }, { "uni06C2.init" } }, + { { "uni06CC" }, { "uni06CC.init" } }, + { { "uni06CE" }, { "uni06CE.init" } }, + { { "uni06D0" }, { "uni06D0.init" } }, + { { "uni06D1" }, { "uni06D1.init" } }, + { { "uni06FA" }, { "uni06FA.init" } }, + { { "uni06FB" }, { "uni06FB.init" } }, + { { "uni06FC" }, { "uni06FC.init" } }, + { { "uni06FF" }, { "uni06FF.init" } }, + { { "uni0750" }, { "uni0750.init" } }, + { { "uni0751" }, { "uni0751.init" } }, + { { "uni0752" }, { "uni0752.init" } }, + { { "uni0753" }, { "uni0753.init" } }, + { { "uni0754" }, { "uni0754.init" } }, + { { "uni0755" }, { "uni0755.init" } }, + { { "uni0756" }, { "uni0756.init" } }, + { { "uni0757" }, { "uni0757.init" } }, + { { "uni0758" }, { "uni0758.init" } }, + { { "uni075C" }, { "uni075C.init" } }, + { { "uni075D" }, { "uni075D.init" } }, + { { "uni075E" }, { "uni075E.init" } }, + { { "uni075F" }, { "uni075F.init" } }, + { { "uni0760" }, { "uni0760.init" } }, + { { "uni0761" }, { "uni0761.init" } }, + { { "uni0762" }, { "uni0762.init" } }, + { { "uni0763" }, { "uni0763.init" } }, + { { "uni0764" }, { "uni0764.init" } }, + { { "uni0765" }, { "uni0765.init" } }, + { { "uni0766" }, { "uni0766.init" } }, + { { "uni0767" }, { "uni0767.init" } }, + { { "uni0768" }, { "uni0768.init" } }, + { { "uni0769" }, { "uni0769.init" } }, + { { "uni076A" }, { "uni076A.init" } }, + { { "uni076D" }, { "uni076D.init" } }, + } + }, + { "f2", "lu2", "arab", "dflt", "fina", + new String[][][] { + { { "absJeemRetro1" }, { "absJeemRetro1Fin" } }, + { { "absJeemRetro2" }, { "absJeemRetro2Fin" } }, + { { "absJeemRetro3" }, { "absJeemRetro3Fin" } }, + { { "absJehRetro1" }, { "absJehRetro1Fin" } }, + { { "absJehRetro2" }, { "absJehRetro2Fin" } }, + { { "absLamRetro" }, { "absLamRetroFin" } }, + { { "absSheenRetro1" }, { "absSheenRetro1Fin" } }, + { { "absSheenRetro2" }, { "absSheenRetro2Fin" } }, + { { "absTchehRetro1" }, { "absTchehRetro1Fin" } }, + { { "absTchehRetro2" }, { "absTchehRetro2Fin" } }, + { { "absWawDotBelow" }, { "absWawDotBelowFin" } }, + { { "uni0622" }, { "uni0622.fina" } }, + { { "uni0623" }, { "uni0623.fina" } }, + { { "uni0624" }, { "uni0624.fina" } }, + { { "uni0625" }, { "uni0625.fina" } }, + { { "uni0626" }, { "uni0626.fina" } }, + { { "uni0627" }, { "uni0627.fina" } }, + { { "uni0628" }, { "uni0628.fina" } }, + { { "uni0629" }, { "uni0629.fina" } }, + { { "uni062A" }, { "uni062A.fina" } }, + { { "uni062B" }, { "uni062B.fina" } }, + { { "uni062C" }, { "uni062C.fina" } }, + { { "uni062D" }, { "uni062D.fina" } }, + { { "uni062E" }, { "uni062E.fina" } }, + { { "uni062F" }, { "uni062F.fina" } }, + { { "uni0630" }, { "uni0630.fina" } }, + { { "uni0631" }, { "uni0631.fina" } }, + { { "uni0632" }, { "uni0632.fina" } }, + { { "uni0633" }, { "uni0633.fina" } }, + { { "uni0634" }, { "uni0634.fina" } }, + { { "uni0635" }, { "uni0635.fina" } }, + { { "uni0636" }, { "uni0636.fina" } }, + { { "uni0637" }, { "uni0637.fina" } }, + { { "uni0638" }, { "uni0638.fina" } }, + { { "uni0639" }, { "uni0639.fina" } }, + { { "uni063A" }, { "uni063A.fina" } }, + { { "uni0641" }, { "uni0641.fina" } }, + { { "uni0642" }, { "uni0642.fina" } }, + { { "uni0643" }, { "uni0643.fina" } }, + { { "uni0644" }, { "uni0644.fina" } }, + { { "uni0645" }, { "uni0645.fina" } }, + { { "uni0646" }, { "uni0646.fina" } }, + { { "uni0647" }, { "uni0647.fina" } }, + { { "uni0648" }, { "uni0648.fina" } }, + { { "uni0649" }, { "uni0649.fina" } }, + { { "uni064A" }, { "uni064A.fina" } }, + { { "uni064A.noDots" }, { "uni064A.fina.noDots" } }, + { { "uni066E" }, { "uni066E.fina" } }, + { { "uni066F" }, { "uni066F.fina" } }, + { { "uni0671" }, { "uni0671.fina" } }, + { { "uni0672" }, { "uni0672.fina" } }, + { { "uni0673" }, { "uni0673.fina" } }, + { { "uni0675" }, { "uni0675.fina" } }, + { { "uni0676" }, { "uni0676.fina" } }, + { { "uni0677" }, { "uni0677.fina" } }, + { { "uni0678" }, { "uni0678.fina" } }, + { { "uni0679" }, { "uni0679.fina" } }, + { { "uni067A" }, { "uni067A.fina" } }, + { { "uni067B" }, { "uni067B.fina" } }, + { { "uni067C" }, { "uni067C.fina" } }, + { { "uni067D" }, { "uni067D.fina" } }, + { { "uni067E" }, { "uni067E.fina" } }, + { { "uni067F" }, { "uni067F.fina" } }, + { { "uni0680" }, { "uni0680.fina" } }, + { { "uni0681" }, { "uni0681.fina" } }, + { { "uni0682" }, { "uni0682.fina" } }, + { { "uni0683" }, { "uni0683.fina" } }, + { { "uni0684" }, { "uni0684.fina" } }, + { { "uni0685" }, { "uni0685.fina" } }, + { { "uni0686" }, { "uni0686.fina" } }, + { { "uni0687" }, { "uni0687.fina" } }, + { { "uni0688" }, { "uni0688.fina" } }, + { { "uni0689" }, { "uni0689.fina" } }, + { { "uni068A" }, { "uni068A.fina" } }, + { { "uni068B" }, { "uni068B.fina" } }, + { { "uni068C" }, { "uni068C.fina" } }, + { { "uni068D" }, { "uni068D.fina" } }, + { { "uni068E" }, { "uni068E.fina" } }, + { { "uni068F" }, { "uni068F.fina" } }, + { { "uni0690" }, { "uni0690.fina" } }, + { { "uni0691" }, { "uni0691.fina" } }, + { { "uni0692" }, { "uni0692.fina" } }, + { { "uni0693" }, { "uni0693.fina" } }, + { { "uni0694" }, { "uni0694.fina" } }, + { { "uni0695" }, { "uni0695.fina" } }, + { { "uni0696" }, { "uni0696.fina" } }, + { { "uni0697" }, { "uni0697.fina" } }, + { { "uni0698" }, { "uni0698.fina" } }, + { { "uni0698.dotHat" }, { "uni0698.fina.dotHat" } }, + { { "uni0699" }, { "uni0699.fina" } }, + { { "uni069A" }, { "uni069A.fina" } }, + { { "uni069B" }, { "uni069B.fina" } }, + { { "uni069C" }, { "uni069C.fina" } }, + { { "uni069D" }, { "uni069D.fina" } }, + { { "uni069E" }, { "uni069E.fina" } }, + { { "uni069F" }, { "uni069F.fina" } }, + { { "uni06A0" }, { "uni06A0.fina" } }, + { { "uni06A1" }, { "uni06A1.fina" } }, + { { "uni06A2" }, { "uni06A2.fina" } }, + { { "uni06A3" }, { "uni06A3.fina" } }, + { { "uni06A4" }, { "uni06A4.fina" } }, + { { "uni06A5" }, { "uni06A5.fina" } }, + { { "uni06A6" }, { "uni06A6.fina" } }, + { { "uni06A7" }, { "uni06A7.fina" } }, + { { "uni06A8" }, { "uni06A8.fina" } }, + { { "uni06A9" }, { "uni06A9.fina" } }, + { { "uni06AA" }, { "uni06AA.fina" } }, + { { "uni06AB" }, { "uni06AB.fina" } }, + { { "uni06AC" }, { "uni06AC.fina" } }, + { { "uni06AD" }, { "uni06AD.fina" } }, + { { "uni06AE" }, { "uni06AE.fina" } }, + { { "uni06AF" }, { "uni06AF.fina" } }, + { { "uni06B0" }, { "uni06B0.fina" } }, + { { "uni06B1" }, { "uni06B1.fina" } }, + { { "uni06B2" }, { "uni06B2.fina" } }, + { { "uni06B3" }, { "uni06B3.fina" } }, + { { "uni06B4" }, { "uni06B4.fina" } }, + { { "uni06B5" }, { "uni06B5.fina" } }, + { { "uni06B6" }, { "uni06B6.fina" } }, + { { "uni06B7" }, { "uni06B7.fina" } }, + { { "uni06B8" }, { "uni06B8.fina" } }, + { { "uni06B9" }, { "uni06B9.fina" } }, + { { "uni06BA" }, { "uni06BA.fina" } }, + { { "uni06BB" }, { "uni06BB.fina" } }, + { { "uni06BC" }, { "uni06BC.fina" } }, + { { "uni06BD" }, { "uni06BD.fina" } }, + { { "uni06BE" }, { "uni06BE.fina" } }, + { { "uni06BF" }, { "uni06BF.fina" } }, + { { "uni06C0" }, { "uni06C0.fina" } }, + { { "uni06C1" }, { "uni06C1.fina" } }, + { { "uni06C2" }, { "uni06C2.fina" } }, + { { "uni06C3" }, { "uni06C3.fina" } }, + { { "uni06C4" }, { "uni06C4.fina" } }, + { { "uni06C5" }, { "uni06C5.fina" } }, + { { "uni06C6" }, { "uni06C6.fina" } }, + { { "uni06C7" }, { "uni06C7.fina" } }, + { { "uni06C8" }, { "uni06C8.fina" } }, + { { "uni06C9" }, { "uni06C9.fina" } }, + { { "uni06CA" }, { "uni06CA.fina" } }, + { { "uni06CB" }, { "uni06CB.fina" } }, + { { "uni06CC" }, { "uni06CC.fina" } }, + { { "uni06CD" }, { "uni06CD.fina" } }, + { { "uni06CE" }, { "uni06CE.fina" } }, + { { "uni06CF" }, { "uni06CF.fina" } }, + { { "uni06D0" }, { "uni06D0.fina" } }, + { { "uni06D1" }, { "uni06D1.fina" } }, + { { "uni06D2" }, { "uni06D2.fina" } }, + { { "uni06D3" }, { "uni06D3.fina" } }, + { { "uni06D5" }, { "uni06D5.fina" } }, + { { "uni06EE" }, { "uni06EE.fina" } }, + { { "uni06EF" }, { "uni06EF.fina" } }, + { { "uni06FA" }, { "uni06FA.fina" } }, + { { "uni06FB" }, { "uni06FB.fina" } }, + { { "uni06FC" }, { "uni06FC.fina" } }, + { { "uni06FF" }, { "uni06FF.fina" } }, + { { "uni0750" }, { "uni0750.fina" } }, + { { "uni0751" }, { "uni0751.fina" } }, + { { "uni0752" }, { "uni0752.fina" } }, + { { "uni0753" }, { "uni0753.fina" } }, + { { "uni0754" }, { "uni0754.fina" } }, + { { "uni0755" }, { "uni0755.fina" } }, + { { "uni0756" }, { "uni0756.fina" } }, + { { "uni0757" }, { "uni0757.fina" } }, + { { "uni0758" }, { "uni0758.fina" } }, + { { "uni0759" }, { "uni0759.fina" } }, + { { "uni075A" }, { "uni075A.fina" } }, + { { "uni075B" }, { "uni075B.fina" } }, + { { "uni075C" }, { "uni075C.fina" } }, + { { "uni075D" }, { "uni075D.fina" } }, + { { "uni075E" }, { "uni075E.fina" } }, + { { "uni075F" }, { "uni075F.fina" } }, + { { "uni0760" }, { "uni0760.fina" } }, + { { "uni0761" }, { "uni0761.fina" } }, + { { "uni0762" }, { "uni0762.fina" } }, + { { "uni0763" }, { "uni0763.fina" } }, + { { "uni0764" }, { "uni0764.fina" } }, + { { "uni0765" }, { "uni0765.fina" } }, + { { "uni0766" }, { "uni0766.fina" } }, + { { "uni0767" }, { "uni0767.fina" } }, + { { "uni0768" }, { "uni0768.fina" } }, + { { "uni0769" }, { "uni0769.fina" } }, + { { "uni076A" }, { "uni076A.fina" } }, + { { "uni076B" }, { "uni076B.fina" } }, + { { "uni076C" }, { "uni076C.fina" } }, + { { "uni076D" }, { "uni076D.fina" } }, + } + }, + { "f2", "lu3", "arab", "dflt", "medi", + new String[][][] { + { { "absJeemRetro1" }, { "absJeemRetro1Med" } }, + { { "absJeemRetro2" }, { "absJeemRetro2Med" } }, + { { "absJeemRetro3" }, { "absJeemRetro3Med" } }, + { { "absLamRetro" }, { "absLamRetroMed" } }, + { { "absSheenRetro1" }, { "absSheenRetro1Med" } }, + { { "absSheenRetro2" }, { "absSheenRetro2Med" } }, + { { "absTchehRetro1" }, { "absTchehRetro1Med" } }, + { { "absTchehRetro2" }, { "absTchehRetro2Med" } }, + { { "uni0626" }, { "uni0626.medi" } }, + { { "uni0628" }, { "uni0628.medi" } }, + { { "uni062A" }, { "uni062A.medi" } }, + { { "uni062B" }, { "uni062B.medi" } }, + { { "uni062C" }, { "uni062C.medi" } }, + { { "uni062D" }, { "uni062D.medi" } }, + { { "uni062E" }, { "uni062E.medi" } }, + { { "uni0633" }, { "uni0633.medi" } }, + { { "uni0634" }, { "uni0634.medi" } }, + { { "uni0635" }, { "uni0635.medi" } }, + { { "uni0636" }, { "uni0636.medi" } }, + { { "uni0637" }, { "uni0637.medi" } }, + { { "uni0638" }, { "uni0638.medi" } }, + { { "uni0639" }, { "uni0639.medi" } }, + { { "uni063A" }, { "uni063A.medi" } }, + { { "uni0641" }, { "uni0641.medi" } }, + { { "uni0642" }, { "uni0642.medi" } }, + { { "uni0643" }, { "uni0643.medi" } }, + { { "uni0644" }, { "uni0644.medi" } }, + { { "uni0645" }, { "uni0645.medi" } }, + { { "uni0646" }, { "uni0646.medi" } }, + { { "uni0647" }, { "uni0647.medi" } }, + { { "uni0649" }, { "uni0649.medi" } }, + { { "uni064A" }, { "uni064A.medi" } }, + { { "uni064A.noDots" }, { "uni064A.medi.noDots" } }, + { { "uni066E" }, { "uni066E.medi" } }, + { { "uni066F" }, { "uni066F.medi" } }, + { { "uni0678" }, { "uni0678.medi" } }, + { { "uni0679" }, { "uni0679.medi" } }, + { { "uni067A" }, { "uni067A.medi" } }, + { { "uni067B" }, { "uni067B.medi" } }, + { { "uni067C" }, { "uni067C.medi" } }, + { { "uni067D" }, { "uni067D.medi" } }, + { { "uni067E" }, { "uni067E.medi" } }, + { { "uni067F" }, { "uni067F.medi" } }, + { { "uni0680" }, { "uni0680.medi" } }, + { { "uni0681" }, { "uni0681.medi" } }, + { { "uni0682" }, { "uni0682.medi" } }, + { { "uni0683" }, { "uni0683.medi" } }, + { { "uni0684" }, { "uni0684.medi" } }, + { { "uni0685" }, { "uni0685.medi" } }, + { { "uni0686" }, { "uni0686.medi" } }, + { { "uni0687" }, { "uni0687.medi" } }, + { { "uni069A" }, { "uni069A.medi" } }, + { { "uni069B" }, { "uni069B.medi" } }, + { { "uni069C" }, { "uni069C.medi" } }, + { { "uni069D" }, { "uni069D.medi" } }, + { { "uni069E" }, { "uni069E.medi" } }, + { { "uni069F" }, { "uni069F.medi" } }, + { { "uni06A0" }, { "uni06A0.medi" } }, + { { "uni06A1" }, { "uni06A1.medi" } }, + { { "uni06A2" }, { "uni06A2.medi" } }, + { { "uni06A3" }, { "uni06A3.medi" } }, + { { "uni06A4" }, { "uni06A4.medi" } }, + { { "uni06A5" }, { "uni06A5.medi" } }, + { { "uni06A6" }, { "uni06A6.medi" } }, + { { "uni06A7" }, { "uni06A7.medi" } }, + { { "uni06A8" }, { "uni06A8.medi" } }, + { { "uni06A9" }, { "uni06A9.medi" } }, + { { "uni06AA" }, { "uni06AA.medi" } }, + { { "uni06AB" }, { "uni06AB.medi" } }, + { { "uni06AC" }, { "uni06AC.medi" } }, + { { "uni06AD" }, { "uni06AD.medi" } }, + { { "uni06AE" }, { "uni06AE.medi" } }, + { { "uni06AF" }, { "uni06AF.medi" } }, + { { "uni06B0" }, { "uni06B0.medi" } }, + { { "uni06B1" }, { "uni06B1.medi" } }, + { { "uni06B2" }, { "uni06B2.medi" } }, + { { "uni06B3" }, { "uni06B3.medi" } }, + { { "uni06B4" }, { "uni06B4.medi" } }, + { { "uni06B5" }, { "uni06B5.medi" } }, + { { "uni06B6" }, { "uni06B6.medi" } }, + { { "uni06B7" }, { "uni06B7.medi" } }, + { { "uni06B8" }, { "uni06B8.medi" } }, + { { "uni06B9" }, { "uni06B9.medi" } }, + { { "uni06BA" }, { "uni06BA.medi" } }, + { { "uni06BB" }, { "uni06BB.medi" } }, + { { "uni06BC" }, { "uni06BC.medi" } }, + { { "uni06BD" }, { "uni06BD.medi" } }, + { { "uni06BE" }, { "uni06BE.medi" } }, + { { "uni06BF" }, { "uni06BF.medi" } }, + { { "uni06C1" }, { "uni06C1.medi" } }, + { { "uni06C2" }, { "uni06C2.medi" } }, + { { "uni06CC" }, { "uni06CC.medi" } }, + { { "uni06CE" }, { "uni06CE.medi" } }, + { { "uni06D0" }, { "uni06D0.medi" } }, + { { "uni06D1" }, { "uni06D1.medi" } }, + { { "uni06FA" }, { "uni06FA.medi" } }, + { { "uni06FB" }, { "uni06FB.medi" } }, + { { "uni06FC" }, { "uni06FC.medi" } }, + { { "uni06FF" }, { "uni06FF.medi" } }, + { { "uni0750" }, { "uni0750.medi" } }, + { { "uni0751" }, { "uni0751.medi" } }, + { { "uni0752" }, { "uni0752.medi" } }, + { { "uni0753" }, { "uni0753.medi" } }, + { { "uni0754" }, { "uni0754.medi" } }, + { { "uni0755" }, { "uni0755.medi" } }, + { { "uni0756" }, { "uni0756.medi" } }, + { { "uni0757" }, { "uni0757.medi" } }, + { { "uni0758" }, { "uni0758.medi" } }, + { { "uni075C" }, { "uni075C.medi" } }, + { { "uni075D" }, { "uni075D.medi" } }, + { { "uni075E" }, { "uni075E.medi" } }, + { { "uni075F" }, { "uni075F.medi" } }, + { { "uni0760" }, { "uni0760.medi" } }, + { { "uni0761" }, { "uni0761.medi" } }, + { { "uni0762" }, { "uni0762.medi" } }, + { { "uni0763" }, { "uni0763.medi" } }, + { { "uni0764" }, { "uni0764.medi" } }, + { { "uni0765" }, { "uni0765.medi" } }, + { { "uni0766" }, { "uni0766.medi" } }, + { { "uni0767" }, { "uni0767.medi" } }, + { { "uni0768" }, { "uni0768.medi" } }, + { { "uni0769" }, { "uni0769.medi" } }, + { { "uni076A" }, { "uni076A.medi" } }, + { { "uni076D" }, { "uni076D.medi" } }, + } + }, + { "f2", "lu9", "arab", "SND ", "calt", + new String[][][] { + { { "uni060C" }, { "uni060C.downward" } }, + { { "uni061B" }, { "uni061B.downward" } }, + { { "uni0645" }, { "uni0645.sindhi" } }, + { { "uni0645.fina" }, { "uni0645.fina.sindhi" } }, + { { "uni0647" }, { "uni0647.knotted" } }, + { { "uni0647.fina" }, { "uni0647.fina.knottedHigh" } }, + { { "uni0647.medi" }, { "uni0647.medi.knottedHigh" } }, + { { "uni064C" }, { "uni064C.sixNine" } }, + { { "uni06F6" }, { "uni06F6.urdu" } }, + { { "uni06F7" }, { "uni06F7.urdu" } }, + } + }, + { "f2", "lu10", "arab", "URD ", "calt", + new String[][][] { + { { "uni0647.fina" }, { "uni0647.fina.hooked" } }, + { { "uni0647.init" }, { "uni0647.init.hooked" } }, + { { "uni0647.medi" }, { "uni0647.medi.hooked" } }, + { { "uni06F4" }, { "uni06F4.urdu" } }, + { { "uni06F6" }, { "uni06F6.urdu" } }, + { { "uni06F7" }, { "uni06F7.urdu" } }, + } + }, + { "f2", "lu11", "arab", "KUR ", "calt", + new String[][][] { + { { "uni0647" }, { "uni0647.knotted" } }, + { { "uni0647.fina" }, { "uni0647.fina.knottedHigh" } }, + } + }, + { "f2", "lu12", "latn", "dflt", "ccmp", + new String[][][] { + { { "asterisk.arab" }, { "asterisk" } }, + { { "colon.arab" }, { "colon" } }, + { { "exclam.arab" }, { "exclam" } }, + { { "parenleft.arab" }, { "parenleft" } }, + { { "parenright.arab" }, { "parenright" } }, + { { "quotedblleft.arab" }, { "quotedblleft" } }, + { { "quotedblright.arab" }, { "quotedblright" } }, + { { "quoteleft.arab" }, { "quoteleft" } }, + { { "quoteright.arab" }, { "quoteright" } }, + } + }, + { "f2", "lu14", "arab", "*", "*", + new String[][][] { + { { "absLamRetroIni" }, { "absLamRetroIni.preAlef" } }, + { { "absLamRetroMed" }, { "absLamRetroMed.preAlef" } }, + { { "uni0644.init" }, { "uni0644.init.preAlef" } }, + { { "uni0644.medi" }, { "uni0644.medi.preAlef" } }, + { { "uni06B5.init" }, { "uni06B5.init.preAlef" } }, + { { "uni06B5.medi" }, { "uni06B5.medi.preAlef" } }, + { { "uni06B6.init" }, { "uni06B6.init.preAlef" } }, + { { "uni06B6.medi" }, { "uni06B6.medi.preAlef" } }, + { { "uni06B7.init" }, { "uni06B7.init.preAlef" } }, + { { "uni06B7.medi" }, { "uni06B7.medi.preAlef" } }, + { { "uni06B8.init" }, { "uni06B8.init.preAlef" } }, + { { "uni06B8.medi" }, { "uni06B8.medi.preAlef" } }, + { { "uni076A.init" }, { "uni076A.init.preAlef" } }, + { { "uni076A.medi" }, { "uni076A.medi.preAlef" } }, + } + }, + { "f2", "lu15", "arab", "*", "*", + new String[][][] { + { { "uni0622.fina" }, { "uni0622.fina.postLamIni" } }, + { { "uni0623.fina" }, { "uni0623.fina.postLamIni" } }, + { { "uni0625.fina" }, { "uni0625.fina.postLamIni" } }, + { { "uni0627.fina" }, { "uni0627.fina.postLamIni" } }, + { { "uni0671.fina" }, { "uni0671.fina.postLamIni" } }, + { { "uni0672.fina" }, { "uni0672.fina.postLamIni" } }, + { { "uni0673.fina" }, { "uni0673.fina.postLamIni" } }, + { { "uni0675.fina" }, { "uni0675.fina.postLamIni" } }, + } + }, + { "f2", "lu16", "arab", "*", "*", + new String[][][] { + { { "uni0622.fina" }, { "uni0622.fina.postLamMed" } }, + { { "uni0623.fina" }, { "uni0623.fina.postLamMed" } }, + { { "uni0625.fina" }, { "uni0625.fina.postLamMed" } }, + { { "uni0627.fina" }, { "uni0627.fina.postLamMed" } }, + { { "uni0671.fina" }, { "uni0671.fina.postLamMed" } }, + { { "uni0672.fina" }, { "uni0672.fina.postLamMed" } }, + { { "uni0673.fina" }, { "uni0673.fina.postLamMed" } }, + { { "uni0675.fina" }, { "uni0675.fina.postLamMed" } }, + } + }, + { "f2", "lu17", "arab", "*", "*", + new String[][][] { + { { "uni0670" }, { "uni0670.large" } }, + } + }, + { "f2", "lu18", "arab", "*", "*", + new String[][][] { + { { "uni06DD" }, { "uni06DD.3" } }, + } + }, + { "f2", "lu19", "arab", "*", "*", + new String[][][] { + { { "uni06DD" }, { "uni06DD.2" } }, + } + }, + { "f2", "lu20", "arab", "*", "*", + new String[][][] { + { { "eight" }, { "eightMedium" } }, + { { "five" }, { "fiveMedium" } }, + { { "four" }, { "fourMedium" } }, + { { "nine" }, { "nineMedium" } }, + { { "one" }, { "oneMedium" } }, + { { "seven" }, { "sevenMedium" } }, + { { "six" }, { "sixMedium" } }, + { { "three" }, { "threeMedium" } }, + { { "two" }, { "twoMedium" } }, + { { "uni0660" }, { "uni0660.Medium" } }, + { { "uni0661" }, { "uni0661.Medium" } }, + { { "uni0662" }, { "uni0662.Medium" } }, + { { "uni0663" }, { "uni0663.Medium" } }, + { { "uni0664" }, { "uni0664.Medium" } }, + { { "uni0665" }, { "uni0665.Medium" } }, + { { "uni0666" }, { "uni0666.Medium" } }, + { { "uni0667" }, { "uni0667.Medium" } }, + { { "uni0668" }, { "uni0668.Medium" } }, + { { "uni0669" }, { "uni0669.Medium" } }, + { { "uni06F0" }, { "uni06F0.Medium" } }, + { { "uni06F1" }, { "uni06F1.Medium" } }, + { { "uni06F2" }, { "uni06F2.Medium" } }, + { { "uni06F3" }, { "uni06F3.Medium" } }, + { { "uni06F4" }, { "uni06F4.Medium" } }, + { { "uni06F4.urdu" }, { "uni06F4.Medium.urdu" } }, + { { "uni06F5" }, { "uni06F5.Medium" } }, + { { "uni06F6" }, { "uni06F6.Medium" } }, + { { "uni06F6.urdu" }, { "uni06F6.Medium.urdu" } }, + { { "uni06F7" }, { "uni06F7.Medium" } }, + { { "uni06F7.urdu" }, { "uni06F7.Medium.urdu" } }, + { { "uni06F8" }, { "uni06F8.Medium" } }, + { { "uni06F9" }, { "uni06F9.Medium" } }, + { { "zero" }, { "zeroMedium" } }, + } + }, + { "f2", "lu21", "arab", "*", "*", + new String[][][] { + { { "eight" }, { "eightSmall" } }, + { { "five" }, { "fiveSmall" } }, + { { "four" }, { "fourSmall" } }, + { { "nine" }, { "nineSmall" } }, + { { "one" }, { "oneSmall" } }, + { { "seven" }, { "sevenSmall" } }, + { { "six" }, { "sixSmall" } }, + { { "three" }, { "threeSmall" } }, + { { "two" }, { "twoSmall" } }, + { { "uni0660" }, { "uni0660.Small" } }, + { { "uni0661" }, { "uni0661.Small" } }, + { { "uni0662" }, { "uni0662.Small" } }, + { { "uni0663" }, { "uni0663.Small" } }, + { { "uni0664" }, { "uni0664.Small" } }, + { { "uni0665" }, { "uni0665.Small" } }, + { { "uni0666" }, { "uni0666.Small" } }, + { { "uni0667" }, { "uni0667.Small" } }, + { { "uni0668" }, { "uni0668.Small" } }, + { { "uni0669" }, { "uni0669.Small" } }, + { { "uni06F0" }, { "uni06F0.Small" } }, + { { "uni06F1" }, { "uni06F1.Small" } }, + { { "uni06F2" }, { "uni06F2.Small" } }, + { { "uni06F3" }, { "uni06F3.Small" } }, + { { "uni06F4" }, { "uni06F4.Small" } }, + { { "uni06F4.urdu" }, { "uni06F4.Small.urdu" } }, + { { "uni06F5" }, { "uni06F5.Small" } }, + { { "uni06F6" }, { "uni06F6.Small" } }, + { { "uni06F6.urdu" }, { "uni06F6.Small.urdu" } }, + { { "uni06F7" }, { "uni06F7.Small" } }, + { { "uni06F7.urdu" }, { "uni06F7.Small.urdu" } }, + { { "uni06F8" }, { "uni06F8.Small" } }, + { { "uni06F9" }, { "uni06F9.Small" } }, + { { "zero" }, { "zeroSmall" } }, + } + }, + // arab-004.ttx + { "f3", "lu1", "arab", "dflt", "init", + new String[][][] { + { { "absJeemRetro1" }, { "absJeemRetro1Ini" } }, + { { "absJeemRetro2" }, { "absJeemRetro2Ini" } }, + { { "absJeemRetro3" }, { "absJeemRetro3Ini" } }, + { { "absLamRetro" }, { "absLamRetroIni" } }, + { { "absSheenRetro1" }, { "absSheenRetro1Ini" } }, + { { "absSheenRetro2" }, { "absSheenRetro2Ini" } }, + { { "absTchehRetro1" }, { "absTchehRetro1Ini" } }, + { { "absTchehRetro2" }, { "absTchehRetro2Ini" } }, + { { "uni0626" }, { "uni0626.init" } }, + { { "uni0628" }, { "uni0628.init" } }, + { { "uni062A" }, { "uni062A.init" } }, + { { "uni062B" }, { "uni062B.init" } }, + { { "uni062C" }, { "uni062C.init" } }, + { { "uni062D" }, { "uni062D.init" } }, + { { "uni062E" }, { "uni062E.init" } }, + { { "uni0633" }, { "uni0633.init" } }, + { { "uni0634" }, { "uni0634.init" } }, + { { "uni0635" }, { "uni0635.init" } }, + { { "uni0636" }, { "uni0636.init" } }, + { { "uni0637" }, { "uni0637.init" } }, + { { "uni0638" }, { "uni0638.init" } }, + { { "uni0639" }, { "uni0639.init" } }, + { { "uni063A" }, { "uni063A.init" } }, + { { "uni0641" }, { "uni0641.init" } }, + { { "uni0642" }, { "uni0642.init" } }, + { { "uni0643" }, { "uni0643.init" } }, + { { "uni0644" }, { "uni0644.init" } }, + { { "uni0645" }, { "uni0645.init" } }, + { { "uni0646" }, { "uni0646.init" } }, + { { "uni0647" }, { "uni0647.init" } }, + { { "uni0649" }, { "uni0649.init" } }, + { { "uni064A" }, { "uni064A.init" } }, + { { "uni064A.noDots" }, { "uni064A.init.noDots" } }, + { { "uni066E" }, { "uni066E.init" } }, + { { "uni066F" }, { "uni066F.init" } }, + { { "uni0678" }, { "uni0678.init" } }, + { { "uni0679" }, { "uni0679.init" } }, + { { "uni067A" }, { "uni067A.init" } }, + { { "uni067B" }, { "uni067B.init" } }, + { { "uni067C" }, { "uni067C.init" } }, + { { "uni067D" }, { "uni067D.init" } }, + { { "uni067E" }, { "uni067E.init" } }, + { { "uni067F" }, { "uni067F.init" } }, + { { "uni0680" }, { "uni0680.init" } }, + { { "uni0681" }, { "uni0681.init" } }, + { { "uni0682" }, { "uni0682.init" } }, + { { "uni0683" }, { "uni0683.init" } }, + { { "uni0684" }, { "uni0684.init" } }, + { { "uni0685" }, { "uni0685.init" } }, + { { "uni0686" }, { "uni0686.init" } }, + { { "uni0687" }, { "uni0687.init" } }, + { { "uni069A" }, { "uni069A.init" } }, + { { "uni069B" }, { "uni069B.init" } }, + { { "uni069C" }, { "uni069C.init" } }, + { { "uni069D" }, { "uni069D.init" } }, + { { "uni069E" }, { "uni069E.init" } }, + { { "uni069F" }, { "uni069F.init" } }, + { { "uni06A0" }, { "uni06A0.init" } }, + { { "uni06A1" }, { "uni06A1.init" } }, + { { "uni06A2" }, { "uni06A2.init" } }, + { { "uni06A3" }, { "uni06A3.init" } }, + { { "uni06A4" }, { "uni06A4.init" } }, + { { "uni06A5" }, { "uni06A5.init" } }, + { { "uni06A6" }, { "uni06A6.init" } }, + { { "uni06A7" }, { "uni06A7.init" } }, + { { "uni06A8" }, { "uni06A8.init" } }, + { { "uni06A9" }, { "uni06A9.init" } }, + { { "uni06AA" }, { "uni06AA.init" } }, + { { "uni06AB" }, { "uni06AB.init" } }, + { { "uni06AC" }, { "uni06AC.init" } }, + { { "uni06AD" }, { "uni06AD.init" } }, + { { "uni06AE" }, { "uni06AE.init" } }, + { { "uni06AF" }, { "uni06AF.init" } }, + { { "uni06B0" }, { "uni06B0.init" } }, + { { "uni06B1" }, { "uni06B1.init" } }, + { { "uni06B2" }, { "uni06B2.init" } }, + { { "uni06B3" }, { "uni06B3.init" } }, + { { "uni06B4" }, { "uni06B4.init" } }, + { { "uni06B5" }, { "uni06B5.init" } }, + { { "uni06B6" }, { "uni06B6.init" } }, + { { "uni06B7" }, { "uni06B7.init" } }, + { { "uni06B8" }, { "uni06B8.init" } }, + { { "uni06B9" }, { "uni06B9.init" } }, + { { "uni06BA" }, { "uni06BA.init" } }, + { { "uni06BB" }, { "uni06BB.init" } }, + { { "uni06BC" }, { "uni06BC.init" } }, + { { "uni06BD" }, { "uni06BD.init" } }, + { { "uni06BE" }, { "uni06BE.init" } }, + { { "uni06BF" }, { "uni06BF.init" } }, + { { "uni06C1" }, { "uni06C1.init" } }, + { { "uni06CC" }, { "uni06CC.init" } }, + { { "uni06CE" }, { "uni06CE.init" } }, + { { "uni06D0" }, { "uni06D0.init" } }, + { { "uni06D1" }, { "uni06D1.init" } }, + { { "uni06FA" }, { "uni06FA.init" } }, + { { "uni06FB" }, { "uni06FB.init" } }, + { { "uni06FC" }, { "uni06FC.init" } }, + { { "uni06FF" }, { "uni06FF.init" } }, + { { "uni0750" }, { "uni0750.init" } }, + { { "uni0751" }, { "uni0751.init" } }, + { { "uni0752" }, { "uni0752.init" } }, + { { "uni0753" }, { "uni0753.init" } }, + { { "uni0754" }, { "uni0754.init" } }, + { { "uni0755" }, { "uni0755.init" } }, + { { "uni0756" }, { "uni0756.init" } }, + { { "uni0757" }, { "uni0757.init" } }, + { { "uni0758" }, { "uni0758.init" } }, + { { "uni075C" }, { "uni075C.init" } }, + { { "uni075D" }, { "uni075D.init" } }, + { { "uni075E" }, { "uni075E.init" } }, + { { "uni075F" }, { "uni075F.init" } }, + { { "uni0760" }, { "uni0760.init" } }, + { { "uni0761" }, { "uni0761.init" } }, + { { "uni0762" }, { "uni0762.init" } }, + { { "uni0763" }, { "uni0763.init" } }, + { { "uni0764" }, { "uni0764.init" } }, + { { "uni0765" }, { "uni0765.init" } }, + { { "uni0766" }, { "uni0766.init" } }, + { { "uni0767" }, { "uni0767.init" } }, + { { "uni0768" }, { "uni0768.init" } }, + { { "uni0769" }, { "uni0769.init" } }, + { { "uni076A" }, { "uni076A.init" } }, + { { "uni076D" }, { "uni076D.init" } }, + } + }, + { "f3", "lu2", "arab", "dflt", "fina", + new String[][][] { + { { "absJeemRetro1" }, { "absJeemRetro1Fin" } }, + { { "absJeemRetro2" }, { "absJeemRetro2Fin" } }, + { { "absJeemRetro3" }, { "absJeemRetro3Fin" } }, + { { "absJehRetro1" }, { "absJehRetro1Fin" } }, + { { "absJehRetro2" }, { "absJehRetro2Fin" } }, + { { "absLamRetro" }, { "absLamRetroFin" } }, + { { "absSheenRetro1" }, { "absSheenRetro1Fin" } }, + { { "absSheenRetro2" }, { "absSheenRetro2Fin" } }, + { { "absTchehRetro1" }, { "absTchehRetro1Fin" } }, + { { "absTchehRetro2" }, { "absTchehRetro2Fin" } }, + { { "absWawDotBelow" }, { "absWawDotBelowFin" } }, + { { "uni0622" }, { "uni0622.fina" } }, + { { "uni0623" }, { "uni0623.fina" } }, + { { "uni0624" }, { "uni0624.fina" } }, + { { "uni0625" }, { "uni0625.fina" } }, + { { "uni0626" }, { "uni0626.fina" } }, + { { "uni0627" }, { "uni0627.fina" } }, + { { "uni0628" }, { "uni0628.fina" } }, + { { "uni0629" }, { "uni0629.fina" } }, + { { "uni062A" }, { "uni062A.fina" } }, + { { "uni062B" }, { "uni062B.fina" } }, + { { "uni062C" }, { "uni062C.fina" } }, + { { "uni062D" }, { "uni062D.fina" } }, + { { "uni062E" }, { "uni062E.fina" } }, + { { "uni062F" }, { "uni062F.fina" } }, + { { "uni0630" }, { "uni0630.fina" } }, + { { "uni0631" }, { "uni0631.fina" } }, + { { "uni0632" }, { "uni0632.fina" } }, + { { "uni0633" }, { "uni0633.fina" } }, + { { "uni0634" }, { "uni0634.fina" } }, + { { "uni0635" }, { "uni0635.fina" } }, + { { "uni0636" }, { "uni0636.fina" } }, + { { "uni0637" }, { "uni0637.fina" } }, + { { "uni0638" }, { "uni0638.fina" } }, + { { "uni0639" }, { "uni0639.fina" } }, + { { "uni063A" }, { "uni063A.fina" } }, + { { "uni0641" }, { "uni0641.fina" } }, + { { "uni0642" }, { "uni0642.fina" } }, + { { "uni0643" }, { "uni0643.fina" } }, + { { "uni0644" }, { "uni0644.fina" } }, + { { "uni0645" }, { "uni0645.fina" } }, + { { "uni0646" }, { "uni0646.fina" } }, + { { "uni0647" }, { "uni0647.fina" } }, + { { "uni0648" }, { "uni0648.fina" } }, + { { "uni0649" }, { "uni0649.fina" } }, + { { "uni064A" }, { "uni064A.fina" } }, + { { "uni064A.noDots" }, { "uni064A.fina.noDots" } }, + { { "uni066E" }, { "uni066E.fina" } }, + { { "uni066F" }, { "uni066F.fina" } }, + { { "uni0671" }, { "uni0671.fina" } }, + { { "uni0672" }, { "uni0672.fina" } }, + { { "uni0673" }, { "uni0673.fina" } }, + { { "uni0675" }, { "uni0675.fina" } }, + { { "uni0676" }, { "uni0676.fina" } }, + { { "uni0677" }, { "uni0677.fina" } }, + { { "uni0678" }, { "uni0678.fina" } }, + { { "uni0679" }, { "uni0679.fina" } }, + { { "uni067A" }, { "uni067A.fina" } }, + { { "uni067B" }, { "uni067B.fina" } }, + { { "uni067C" }, { "uni067C.fina" } }, + { { "uni067D" }, { "uni067D.fina" } }, + { { "uni067E" }, { "uni067E.fina" } }, + { { "uni067F" }, { "uni067F.fina" } }, + { { "uni0680" }, { "uni0680.fina" } }, + { { "uni0681" }, { "uni0681.fina" } }, + { { "uni0682" }, { "uni0682.fina" } }, + { { "uni0683" }, { "uni0683.fina" } }, + { { "uni0684" }, { "uni0684.fina" } }, + { { "uni0685" }, { "uni0685.fina" } }, + { { "uni0686" }, { "uni0686.fina" } }, + { { "uni0687" }, { "uni0687.fina" } }, + { { "uni0688" }, { "uni0688.fina" } }, + { { "uni0689" }, { "uni0689.fina" } }, + { { "uni068A" }, { "uni068A.fina" } }, + { { "uni068B" }, { "uni068B.fina" } }, + { { "uni068C" }, { "uni068C.fina" } }, + { { "uni068D" }, { "uni068D.fina" } }, + { { "uni068E" }, { "uni068E.fina" } }, + { { "uni068F" }, { "uni068F.fina" } }, + { { "uni0690" }, { "uni0690.fina" } }, + { { "uni0691" }, { "uni0691.fina" } }, + { { "uni0692" }, { "uni0692.fina" } }, + { { "uni0693" }, { "uni0693.fina" } }, + { { "uni0694" }, { "uni0694.fina" } }, + { { "uni0695" }, { "uni0695.fina" } }, + { { "uni0696" }, { "uni0696.fina" } }, + { { "uni0697" }, { "uni0697.fina" } }, + { { "uni0698" }, { "uni0698.fina" } }, + { { "uni0698.dotHat" }, { "uni0698.fina.dotHat" } }, + { { "uni0699" }, { "uni0699.fina" } }, + { { "uni069A" }, { "uni069A.fina" } }, + { { "uni069B" }, { "uni069B.fina" } }, + { { "uni069C" }, { "uni069C.fina" } }, + { { "uni069D" }, { "uni069D.fina" } }, + { { "uni069E" }, { "uni069E.fina" } }, + { { "uni069F" }, { "uni069F.fina" } }, + { { "uni06A0" }, { "uni06A0.fina" } }, + { { "uni06A1" }, { "uni06A1.fina" } }, + { { "uni06A2" }, { "uni06A2.fina" } }, + { { "uni06A3" }, { "uni06A3.fina" } }, + { { "uni06A4" }, { "uni06A4.fina" } }, + { { "uni06A5" }, { "uni06A5.fina" } }, + { { "uni06A6" }, { "uni06A6.fina" } }, + { { "uni06A7" }, { "uni06A7.fina" } }, + { { "uni06A8" }, { "uni06A8.fina" } }, + { { "uni06A9" }, { "uni06A9.fina" } }, + { { "uni06AA" }, { "uni06AA.fina" } }, + { { "uni06AB" }, { "uni06AB.fina" } }, + { { "uni06AC" }, { "uni06AC.fina" } }, + { { "uni06AD" }, { "uni06AD.fina" } }, + { { "uni06AE" }, { "uni06AE.fina" } }, + { { "uni06AF" }, { "uni06AF.fina" } }, + { { "uni06B0" }, { "uni06B0.fina" } }, + { { "uni06B1" }, { "uni06B1.fina" } }, + { { "uni06B2" }, { "uni06B2.fina" } }, + { { "uni06B3" }, { "uni06B3.fina" } }, + { { "uni06B4" }, { "uni06B4.fina" } }, + { { "uni06B5" }, { "uni06B5.fina" } }, + { { "uni06B6" }, { "uni06B6.fina" } }, + { { "uni06B7" }, { "uni06B7.fina" } }, + { { "uni06B8" }, { "uni06B8.fina" } }, + { { "uni06B9" }, { "uni06B9.fina" } }, + { { "uni06BA" }, { "uni06BA.fina" } }, + { { "uni06BB" }, { "uni06BB.fina" } }, + { { "uni06BC" }, { "uni06BC.fina" } }, + { { "uni06BD" }, { "uni06BD.fina" } }, + { { "uni06BE" }, { "uni06BE.fina" } }, + { { "uni06BF" }, { "uni06BF.fina" } }, + { { "uni06C0" }, { "uni06C0.fina" } }, + { { "uni06C1" }, { "uni06C1.fina" } }, + { { "uni06C2" }, { "uni06C2.fina" } }, + { { "uni06C3" }, { "uni06C3.fina" } }, + { { "uni06C4" }, { "uni06C4.fina" } }, + { { "uni06C5" }, { "uni06C5.fina" } }, + { { "uni06C6" }, { "uni06C6.fina" } }, + { { "uni06C7" }, { "uni06C7.fina" } }, + { { "uni06C8" }, { "uni06C8.fina" } }, + { { "uni06C9" }, { "uni06C9.fina" } }, + { { "uni06CA" }, { "uni06CA.fina" } }, + { { "uni06CB" }, { "uni06CB.fina" } }, + { { "uni06CC" }, { "uni06CC.fina" } }, + { { "uni06CD" }, { "uni06CD.fina" } }, + { { "uni06CE" }, { "uni06CE.fina" } }, + { { "uni06CF" }, { "uni06CF.fina" } }, + { { "uni06D0" }, { "uni06D0.fina" } }, + { { "uni06D1" }, { "uni06D1.fina" } }, + { { "uni06D2" }, { "uni06D2.fina" } }, + { { "uni06D3" }, { "uni06D3.fina" } }, + { { "uni06D5" }, { "uni06D5.fina" } }, + { { "uni06EE" }, { "uni06EE.fina" } }, + { { "uni06EF" }, { "uni06EF.fina" } }, + { { "uni06FA" }, { "uni06FA.fina" } }, + { { "uni06FB" }, { "uni06FB.fina" } }, + { { "uni06FC" }, { "uni06FC.fina" } }, + { { "uni06FF" }, { "uni06FF.fina" } }, + { { "uni0750" }, { "uni0750.fina" } }, + { { "uni0751" }, { "uni0751.fina" } }, + { { "uni0752" }, { "uni0752.fina" } }, + { { "uni0753" }, { "uni0753.fina" } }, + { { "uni0754" }, { "uni0754.fina" } }, + { { "uni0755" }, { "uni0755.fina" } }, + { { "uni0756" }, { "uni0756.fina" } }, + { { "uni0757" }, { "uni0757.fina" } }, + { { "uni0758" }, { "uni0758.fina" } }, + { { "uni0759" }, { "uni0759.fina" } }, + { { "uni075A" }, { "uni075A.fina" } }, + { { "uni075B" }, { "uni075B.fina" } }, + { { "uni075C" }, { "uni075C.fina" } }, + { { "uni075D" }, { "uni075D.fina" } }, + { { "uni075E" }, { "uni075E.fina" } }, + { { "uni075F" }, { "uni075F.fina" } }, + { { "uni0760" }, { "uni0760.fina" } }, + { { "uni0761" }, { "uni0761.fina" } }, + { { "uni0762" }, { "uni0762.fina" } }, + { { "uni0763" }, { "uni0763.fina" } }, + { { "uni0764" }, { "uni0764.fina" } }, + { { "uni0765" }, { "uni0765.fina" } }, + { { "uni0766" }, { "uni0766.fina" } }, + { { "uni0767" }, { "uni0767.fina" } }, + { { "uni0768" }, { "uni0768.fina" } }, + { { "uni0769" }, { "uni0769.fina" } }, + { { "uni076A" }, { "uni076A.fina" } }, + { { "uni076B" }, { "uni076B.fina" } }, + { { "uni076C" }, { "uni076C.fina" } }, + { { "uni076D" }, { "uni076D.fina" } }, + } + }, + { "f3", "lu3", "arab", "dflt", "medi", + new String[][][] { + { { "absJeemRetro1" }, { "absJeemRetro1Med" } }, + { { "absJeemRetro2" }, { "absJeemRetro2Med" } }, + { { "absJeemRetro3" }, { "absJeemRetro3Med" } }, + { { "absLamRetro" }, { "absLamRetroMed" } }, + { { "absSheenRetro1" }, { "absSheenRetro1Med" } }, + { { "absSheenRetro2" }, { "absSheenRetro2Med" } }, + { { "absTchehRetro1" }, { "absTchehRetro1Med" } }, + { { "absTchehRetro2" }, { "absTchehRetro2Med" } }, + { { "uni0626" }, { "uni0626.medi" } }, + { { "uni0628" }, { "uni0628.medi" } }, + { { "uni062A" }, { "uni062A.medi" } }, + { { "uni062B" }, { "uni062B.medi" } }, + { { "uni062C" }, { "uni062C.medi" } }, + { { "uni062D" }, { "uni062D.medi" } }, + { { "uni062E" }, { "uni062E.medi" } }, + { { "uni0633" }, { "uni0633.medi" } }, + { { "uni0634" }, { "uni0634.medi" } }, + { { "uni0635" }, { "uni0635.medi" } }, + { { "uni0636" }, { "uni0636.medi" } }, + { { "uni0637" }, { "uni0637.medi" } }, + { { "uni0638" }, { "uni0638.medi" } }, + { { "uni0639" }, { "uni0639.medi" } }, + { { "uni063A" }, { "uni063A.medi" } }, + { { "uni0641" }, { "uni0641.medi" } }, + { { "uni0642" }, { "uni0642.medi" } }, + { { "uni0643" }, { "uni0643.medi" } }, + { { "uni0644" }, { "uni0644.medi" } }, + { { "uni0645" }, { "uni0645.medi" } }, + { { "uni0646" }, { "uni0646.medi" } }, + { { "uni0647" }, { "uni0647.medi" } }, + { { "uni0649" }, { "uni0649.medi" } }, + { { "uni064A" }, { "uni064A.medi" } }, + { { "uni064A.noDots" }, { "uni064A.medi.noDots" } }, + { { "uni066E" }, { "uni066E.medi" } }, + { { "uni066F" }, { "uni066F.medi" } }, + { { "uni0678" }, { "uni0678.medi" } }, + { { "uni0679" }, { "uni0679.medi" } }, + { { "uni067A" }, { "uni067A.medi" } }, + { { "uni067B" }, { "uni067B.medi" } }, + { { "uni067C" }, { "uni067C.medi" } }, + { { "uni067D" }, { "uni067D.medi" } }, + { { "uni067E" }, { "uni067E.medi" } }, + { { "uni067F" }, { "uni067F.medi" } }, + { { "uni0680" }, { "uni0680.medi" } }, + { { "uni0681" }, { "uni0681.medi" } }, + { { "uni0682" }, { "uni0682.medi" } }, + { { "uni0683" }, { "uni0683.medi" } }, + { { "uni0684" }, { "uni0684.medi" } }, + { { "uni0685" }, { "uni0685.medi" } }, + { { "uni0686" }, { "uni0686.medi" } }, + { { "uni0687" }, { "uni0687.medi" } }, + { { "uni069A" }, { "uni069A.medi" } }, + { { "uni069B" }, { "uni069B.medi" } }, + { { "uni069C" }, { "uni069C.medi" } }, + { { "uni069D" }, { "uni069D.medi" } }, + { { "uni069E" }, { "uni069E.medi" } }, + { { "uni069F" }, { "uni069F.medi" } }, + { { "uni06A0" }, { "uni06A0.medi" } }, + { { "uni06A1" }, { "uni06A1.medi" } }, + { { "uni06A2" }, { "uni06A2.medi" } }, + { { "uni06A3" }, { "uni06A3.medi" } }, + { { "uni06A4" }, { "uni06A4.medi" } }, + { { "uni06A5" }, { "uni06A5.medi" } }, + { { "uni06A6" }, { "uni06A6.medi" } }, + { { "uni06A7" }, { "uni06A7.medi" } }, + { { "uni06A8" }, { "uni06A8.medi" } }, + { { "uni06A9" }, { "uni06A9.medi" } }, + { { "uni06AA" }, { "uni06AA.medi" } }, + { { "uni06AB" }, { "uni06AB.medi" } }, + { { "uni06AC" }, { "uni06AC.medi" } }, + { { "uni06AD" }, { "uni06AD.medi" } }, + { { "uni06AE" }, { "uni06AE.medi" } }, + { { "uni06AF" }, { "uni06AF.medi" } }, + { { "uni06B0" }, { "uni06B0.medi" } }, + { { "uni06B1" }, { "uni06B1.medi" } }, + { { "uni06B2" }, { "uni06B2.medi" } }, + { { "uni06B3" }, { "uni06B3.medi" } }, + { { "uni06B4" }, { "uni06B4.medi" } }, + { { "uni06B5" }, { "uni06B5.medi" } }, + { { "uni06B6" }, { "uni06B6.medi" } }, + { { "uni06B7" }, { "uni06B7.medi" } }, + { { "uni06B8" }, { "uni06B8.medi" } }, + { { "uni06B9" }, { "uni06B9.medi" } }, + { { "uni06BA" }, { "uni06BA.medi" } }, + { { "uni06BB" }, { "uni06BB.medi" } }, + { { "uni06BC" }, { "uni06BC.medi" } }, + { { "uni06BD" }, { "uni06BD.medi" } }, + { { "uni06BE" }, { "uni06BE.medi" } }, + { { "uni06BF" }, { "uni06BF.medi" } }, + { { "uni06C1" }, { "uni06C1.medi" } }, + { { "uni06CC" }, { "uni06CC.medi" } }, + { { "uni06CE" }, { "uni06CE.medi" } }, + { { "uni06D0" }, { "uni06D0.medi" } }, + { { "uni06D1" }, { "uni06D1.medi" } }, + { { "uni06FA" }, { "uni06FA.medi" } }, + { { "uni06FB" }, { "uni06FB.medi" } }, + { { "uni06FC" }, { "uni06FC.medi" } }, + { { "uni06FF" }, { "uni06FF.medi" } }, + { { "uni0750" }, { "uni0750.medi" } }, + { { "uni0751" }, { "uni0751.medi" } }, + { { "uni0752" }, { "uni0752.medi" } }, + { { "uni0753" }, { "uni0753.medi" } }, + { { "uni0754" }, { "uni0754.medi" } }, + { { "uni0755" }, { "uni0755.medi" } }, + { { "uni0756" }, { "uni0756.medi" } }, + { { "uni0757" }, { "uni0757.medi" } }, + { { "uni0758" }, { "uni0758.medi" } }, + { { "uni075C" }, { "uni075C.medi" } }, + { { "uni075D" }, { "uni075D.medi" } }, + { { "uni075E" }, { "uni075E.medi" } }, + { { "uni075F" }, { "uni075F.medi" } }, + { { "uni0760" }, { "uni0760.medi" } }, + { { "uni0761" }, { "uni0761.medi" } }, + { { "uni0762" }, { "uni0762.medi" } }, + { { "uni0763" }, { "uni0763.medi" } }, + { { "uni0764" }, { "uni0764.medi" } }, + { { "uni0765" }, { "uni0765.medi" } }, + { { "uni0766" }, { "uni0766.medi" } }, + { { "uni0767" }, { "uni0767.medi" } }, + { { "uni0768" }, { "uni0768.medi" } }, + { { "uni0769" }, { "uni0769.medi" } }, + { { "uni076A" }, { "uni076A.medi" } }, + { { "uni076D" }, { "uni076D.medi" } }, + } + }, + { "f3", "lu11", "arab", "SND ", "calt", + new String[][][] { + { { "uni0645" }, { "uni0645.sindhi" } }, + { { "uni0645.fina" }, { "uni0645.fina.sindhi" } }, + { { "uni0647" }, { "uni0647.knotted" } }, + { { "uni0647.fina" }, { "uni0647.fina.knottedHigh" } }, + { { "uni0647.medi" }, { "uni0647.medi.knottedHigh" } }, + { { "uni06F6" }, { "uni06F6.urdu" } }, + { { "uni06F7" }, { "uni06F7.urdu" } }, + } + }, + { "f3", "lu12", "arab", "KUR ", "calt", + new String[][][] { + { { "uni0647" }, { "uni0647.knotted" } }, + { { "uni0647.fina" }, { "uni0647.fina.knottedHigh" } }, + } + }, + { "f3", "lu13", "arab", "URD ", "calt", + new String[][][] { + { { "uni0647.fina" }, { "uni0647.fina.hooked" } }, + { { "uni0647.init" }, { "uni0647.init.hooked" } }, + { { "uni0647.medi" }, { "uni0647.medi.hooked" } }, + { { "uni06F4" }, { "uni06F4.urdu" } }, + { { "uni06F6" }, { "uni06F6.urdu" } }, + { { "uni06F7" }, { "uni06F7.urdu" } }, + } + }, + { "f3", "lu15", "arab", "*", "*", + new String[][][] { + { { "absLamRetroIni" }, { "absLamRetroIni.preAlef" } }, + { { "absLamRetroMed" }, { "absLamRetroMed.preAlef" } }, + { { "uni0644.init" }, { "uni0644.init.preAlef" } }, + { { "uni0644.medi" }, { "uni0644.medi.preAlef" } }, + { { "uni06B5.init" }, { "uni06B5.init.preAlef" } }, + { { "uni06B5.medi" }, { "uni06B5.medi.preAlef" } }, + { { "uni06B6.init" }, { "uni06B6.init.preAlef" } }, + { { "uni06B6.medi" }, { "uni06B6.medi.preAlef" } }, + { { "uni06B7.init" }, { "uni06B7.init.preAlef" } }, + { { "uni06B7.medi" }, { "uni06B7.medi.preAlef" } }, + { { "uni06B8.init" }, { "uni06B8.init.preAlef" } }, + { { "uni06B8.medi" }, { "uni06B8.medi.preAlef" } }, + { { "uni076A.init" }, { "uni076A.init.preAlef" } }, + { { "uni076A.medi" }, { "uni076A.medi.preAlef" } }, + } + }, + { "f3", "lu16", "arab", "*", "*", + new String[][][] { + { { "uni0622.fina" }, { "uni0622.fina.postLamIni" } }, + { { "uni0623.fina" }, { "uni0623.fina.postLamIni" } }, + { { "uni0625.fina" }, { "uni0625.fina.postLamIni" } }, + { { "uni0627.fina" }, { "uni0627.fina.postLamIni" } }, + { { "uni0671.fina" }, { "uni0671.fina.postLamIni" } }, + { { "uni0672.fina" }, { "uni0672.fina.postLamIni" } }, + { { "uni0673.fina" }, { "uni0673.fina.postLamIni" } }, + { { "uni0675.fina" }, { "uni0675.fina.postLamIni" } }, + } + }, + { "f3", "lu17", "arab", "*", "*", + new String[][][] { + { { "uni0622.fina" }, { "uni0622.fina.postLamMed" } }, + { { "uni0623.fina" }, { "uni0623.fina.postLamMed" } }, + { { "uni0625.fina" }, { "uni0625.fina.postLamMed" } }, + { { "uni0627.fina" }, { "uni0627.fina.postLamMed" } }, + { { "uni0671.fina" }, { "uni0671.fina.postLamMed" } }, + { { "uni0672.fina" }, { "uni0672.fina.postLamMed" } }, + { { "uni0673.fina" }, { "uni0673.fina.postLamMed" } }, + { { "uni0675.fina" }, { "uni0675.fina.postLamMed" } }, + } + }, + { "f3", "lu18", "arab", "*", "*", + new String[][][] { + { { "uni0601" }, { "uni0601.4" } }, + } + }, + { "f3", "lu19", "arab", "*", "*", + new String[][][] { + { { "uni0600" }, { "uni0600.3" } }, + { { "uni0601" }, { "uni0601.3" } }, + { { "uni0603" }, { "uni0603.3" } }, + { { "uni06DD" }, { "uni06DD.3" } }, + { { "uni06DD.alt" }, { "uni06DD.alt.3" } }, + { { "uni06DD.altB" }, { "uni06DD.altB.3" } }, + } + }, + { "f3", "lu20", "arab", "*", "*", + new String[][][] { + { { "uni0600" }, { "uni0600.2" } }, + { { "uni0601" }, { "uni0601.2" } }, + { { "uni0602" }, { "uni0602.2" } }, + { { "uni0603" }, { "uni0603.2" } }, + { { "uni06DD" }, { "uni06DD.2" } }, + { { "uni06DD.alt" }, { "uni06DD.alt.2" } }, + { { "uni06DD.altB" }, { "uni06DD.altB.2" } }, + } + }, + { "f3", "lu21", "arab", "*", "*", + new String[][][] { + { { "eight" }, { "eightMedium" } }, + { { "five" }, { "fiveMedium" } }, + { { "four" }, { "fourMedium" } }, + { { "nine" }, { "nineMedium" } }, + { { "one" }, { "oneMedium" } }, + { { "seven" }, { "sevenMedium" } }, + { { "six" }, { "sixMedium" } }, + { { "three" }, { "threeMedium" } }, + { { "two" }, { "twoMedium" } }, + { { "uni0660" }, { "uni0660.Medium" } }, + { { "uni0661" }, { "uni0661.Medium" } }, + { { "uni0662" }, { "uni0662.Medium" } }, + { { "uni0663" }, { "uni0663.Medium" } }, + { { "uni0664" }, { "uni0664.Medium" } }, + { { "uni0665" }, { "uni0665.Medium" } }, + { { "uni0666" }, { "uni0666.Medium" } }, + { { "uni0667" }, { "uni0667.Medium" } }, + { { "uni0668" }, { "uni0668.Medium" } }, + { { "uni0669" }, { "uni0669.Medium" } }, + { { "uni06F0" }, { "uni06F0.Medium" } }, + { { "uni06F1" }, { "uni06F1.Medium" } }, + { { "uni06F2" }, { "uni06F2.Medium" } }, + { { "uni06F3" }, { "uni06F3.Medium" } }, + { { "uni06F4" }, { "uni06F4.Medium" } }, + { { "uni06F4.urdu" }, { "uni06F4.Medium.urdu" } }, + { { "uni06F5" }, { "uni06F5.Medium" } }, + { { "uni06F6" }, { "uni06F6.Medium" } }, + { { "uni06F6.urdu" }, { "uni06F6.Medium.urdu" } }, + { { "uni06F7" }, { "uni06F7.Medium" } }, + { { "uni06F7.urdu" }, { "uni06F7.Medium.urdu" } }, + { { "uni06F8" }, { "uni06F8.Medium" } }, + { { "uni06F9" }, { "uni06F9.Medium" } }, + { { "zero" }, { "zeroMedium" } }, + } + }, + { "f3", "lu22", "arab", "*", "*", + new String[][][] { + { { "eight" }, { "eightSmall" } }, + { { "five" }, { "fiveSmall" } }, + { { "four" }, { "fourSmall" } }, + { { "nine" }, { "nineSmall" } }, + { { "one" }, { "oneSmall" } }, + { { "seven" }, { "sevenSmall" } }, + { { "six" }, { "sixSmall" } }, + { { "three" }, { "threeSmall" } }, + { { "two" }, { "twoSmall" } }, + { { "uni0660" }, { "uni0660.Small" } }, + { { "uni0661" }, { "uni0661.Small" } }, + { { "uni0662" }, { "uni0662.Small" } }, + { { "uni0663" }, { "uni0663.Small" } }, + { { "uni0664" }, { "uni0664.Small" } }, + { { "uni0665" }, { "uni0665.Small" } }, + { { "uni0666" }, { "uni0666.Small" } }, + { { "uni0667" }, { "uni0667.Small" } }, + { { "uni0668" }, { "uni0668.Small" } }, + { { "uni0669" }, { "uni0669.Small" } }, + { { "uni06F0" }, { "uni06F0.Small" } }, + { { "uni06F1" }, { "uni06F1.Small" } }, + { { "uni06F2" }, { "uni06F2.Small" } }, + { { "uni06F3" }, { "uni06F3.Small" } }, + { { "uni06F4" }, { "uni06F4.Small" } }, + { { "uni06F4.urdu" }, { "uni06F4.Small.urdu" } }, + { { "uni06F5" }, { "uni06F5.Small" } }, + { { "uni06F6" }, { "uni06F6.Small" } }, + { { "uni06F6.urdu" }, { "uni06F6.Small.urdu" } }, + { { "uni06F7" }, { "uni06F7.Small" } }, + { { "uni06F7.urdu" }, { "uni06F7.Small.urdu" } }, + { { "uni06F8" }, { "uni06F8.Small" } }, + { { "uni06F9" }, { "uni06F9.Small" } }, + { { "zero" }, { "zeroSmall" } }, + } + }, + { "f3", "lu23", "arab", "*", "*", + new String[][][] { + { { "uni0670" }, { "uni0670.large" } }, + } + }, + }; + + private static Object[][] ltMultiple = { + { GlyphSubstitutionTable.GSUB_LOOKUP_TYPE_MULTIPLE }, + // arab-001.ttx + { "f0", "lu9", "arab", "*", "*", + new String[][][] { + { { "alefwithhamzabelow" }, { "arabicalef", "uni0655" } }, + } + }, + // arab-002.ttx + { "f1", "lu14", "arab", "*", "*", + new String[][][] { + { { "pehinitial" }, { "pehinitial", "tatweel" } }, + { { "yehwithhamzaaboveinitial" }, { "yehwithhamzaaboveinitial", "tatweel" } }, + { { "behinitial" }, { "behinitial", "tatweel" } }, + { { "tehinitial" }, { "tehinitial", "tatweel" } }, + { { "thehinitial" }, { "thehinitial", "tatweel" } }, + { { "fehinitial" }, { "fehinitial", "tatweel" } }, + { { "qafinitial" }, { "qafinitial", "tatweel" } }, + { { "nooninitial" }, { "nooninitial", "tatweel" } }, + { { "yehinitial" }, { "yehinitial", "tatweel" } }, + { { "uni0649.init" }, { "uni0649.init", "tatweel" } }, + } + }, + { "f1", "lu15", "arab", "*", "*", + new String[][][] { + { { "pehmedial" }, { "pehmedial", "tatweel" } }, + { { "yehwithhamzaabovemedial" }, { "yehwithhamzaabovemedial", "tatweel" } }, + { { "behmedial" }, { "behmedial", "tatweel" } }, + { { "tehmedial" }, { "tehmedial", "tatweel" } }, + { { "thehmedial" }, { "thehmedial", "tatweel" } }, + { { "noonmedial" }, { "noonmedial", "tatweel" } }, + { { "yehmedial" }, { "yehmedial", "tatweel" } }, + { { "uni0649.medi" }, { "uni0649.medi", "tatweel" } }, + } + }, + // arab-003.ttx + { "f2", "lu0", "arab", "dflt", "ccmp", + new String[][][] { + { { "uni0622" }, { "uni0627", "uni0653" } }, + { { "uni0623" }, { "uni0627", "uni0654" } }, + { { "uni0625" }, { "uni0627", "uni0655" } }, + { { "uni0626" }, { "uni064A", "uni0654" } }, + } + }, + // arab-004.ttx + { "f3", "lu0", "arab", "dflt", "ccmp", + new String[][][] { + { { "uni0622" }, { "uni0627", "uni0653" } }, + { { "uni0623" }, { "uni0627", "uni0654" } }, + { { "uni0625" }, { "uni0627", "uni0655" } }, + } + }, + }; + + private static Object[][] ltAlternate = { + { GlyphSubstitutionTable.GSUB_LOOKUP_TYPE_ALTERNATE }, + // arab-001.ttx - none used + // arab-002.ttx - none used + // arab-003.ttx - none used + // arab-004.ttx - add tests + { "f3", "lu14", "arab", "dflt", "salt" }, + }; + + private static Object[][] ltLigature = { + { GlyphSubstitutionTable.GSUB_LOOKUP_TYPE_LIGATURE }, + // arab-001.ttx + { "f0", "lu0", "arab", "dflt", "ccmp", + new String[][][] { + { { "damma", "shadda" }, { "shaddawithdammalow" } }, + { { "damma", "highhamza" }, { "dammaonhamza" } }, + { { "dammatan", "shadda" }, { "shaddawithdammatanlow" } }, + { { "dammatan", "highhamza" }, { "dammatanonhamza" } }, + { { "fatha", "shadda" }, { "shaddawithfathalow" } }, + { { "fatha", "highhamza" }, { "fathaonhamza" } }, + { { "fathatan", "shadda" }, { "shaddawithfathatanlow" } }, + { { "fathatan", "highhamza" }, { "fathatanonhamza" } }, + { { "highhamza", "fatha" }, { "fathaonhamza" } }, + { { "highhamza", "fathatan" }, { "fathatanonhamza" } }, + { { "highhamza", "sukun" }, { "sukunonhamza" } }, + { { "highhamza", "damma" }, { "dammaonhamza" } }, + { { "highhamza", "dammatan" }, { "dammatanonhamza" } }, + { { "kasra", "shadda" }, { "shaddawithkasralow" } }, + { { "kasra", "uni0655" }, { "uni06550650" } }, + { { "kasratan", "shadda" }, { "shaddawithkasratanlow" } }, + { { "kasratan", "uni0655" }, { "uni0655064D" } }, + { { "shadda", "dammatan" }, { "shaddawithdammatanlow" } }, + { { "shadda", "fatha" }, { "shaddawithfathalow" } }, + { { "shadda", "damma" }, { "shaddawithdammalow" } }, + { { "shadda", "fathatan" }, { "shaddawithfathatanlow" } }, + { { "shadda", "kasratan" }, { "shaddawithkasratanlow" } }, + { { "shadda", "kasra" }, { "shaddawithkasralow" } }, + { { "sukun", "highhamza" }, { "sukunonhamza" } }, + { { "uni0655", "kasratan" }, { "uni0655064D" } }, + { { "uni0655", "kasra" }, { "uni06550650" } }, + } + }, + { "f0", "lu7", "arab", "dflt", "rlig", + new String[][][] { + { { "lamisolated", "alefwithmaddaabovefinal" }, { "lamwithalefmaddaaboveisolatedd" } }, + { { "lamisolated", "alefwithhamzaabovefinal" }, { "lamwithalefhamzaaboveisolatedd" } }, + { { "lamisolated", "alefwithhamzabelowfinal" }, { "lamwithalefhamzabelowisolated" } }, + { { "lamisolated", "aleffinal" }, { "lamwithalefisolated" } }, + { { "lammedial", "alefwithmaddaabovefinal" }, { "lamwithalefmaddaabovefinal" } }, + { { "lammedial", "alefwithhamzaabovefinal" }, { "lamwithalefhamzaabovefinal" } }, + { { "lammedial", "alefwithhamzabelowfinal" }, { "lamwithalefhamzabelowfinal" } }, + { { "lammedial", "aleffinal" }, { "lamwithaleffinal" } }, + } + }, + { "f0", "lu8", "arab", "dflt", "liga", + new String[][][] { + { { "lamisolated", "lammedial", "hehfinal" }, { "allahisolated" } }, + { { "reh", "yehmedial", "aleffinal", "lam" }, { "rayaleflam" } }, + } + }, + // arab-002.ttx + { "f1", "lu0", "arab", "dflt", "ccmp", + new String[][][] { + { { "damma", "shadda" }, { "shaddawithdammaisolatedlow" } }, + { { "damma", "highhamza" }, { "dammaonhamza" } }, + { { "dammatan", "shadda" }, { "shaddawithdammatanisolatedlow" } }, + { { "dammatan", "highhamza" }, { "dammatanonhamza" } }, + { { "fatha", "shadda" }, { "shaddawithfathaisolatedlow" } }, + { { "fatha", "highhamza" }, { "fathaonhamza" } }, + { { "fathatan", "shadda" }, { "shaddawithfathatanisolatedlow" } }, + { { "fathatan", "highhamza" }, { "fathatanonhamza" } }, + { { "highhamza", "fatha" }, { "fathaonhamza" } }, + { { "highhamza", "fathatan" }, { "fathatanonhamza" } }, + { { "highhamza", "sukun" }, { "sukunonhamza" } }, + { { "highhamza", "damma" }, { "dammaonhamza" } }, + { { "highhamza", "dammatan" }, { "dammatanonhamza" } }, + { { "kasra", "shadda" }, { "shaddawithkasraisolatedlow" } }, + { { "kasra", "uni0655" }, { "uni06550650" } }, + { { "kasratan", "shadda" }, { "shaddawithkasratanisolatedlow" } }, + { { "kasratan", "uni0655" }, { "uni0655064D" } }, + { { "shadda", "dammatan" }, { "shaddawithdammatanisolatedlow" } }, + { { "shadda", "fatha" }, { "shaddawithfathaisolatedlow" } }, + { { "shadda", "damma" }, { "shaddawithdammaisolatedlow" } }, + { { "shadda", "fathatan" }, { "shaddawithfathatanisolatedlow" } }, + { { "shadda", "kasratan" }, { "shaddawithkasratanisolatedlow" } }, + { { "shadda", "kasra" }, { "shaddawithkasraisolatedlow" } }, + { { "sukun", "highhamza" }, { "sukunonhamza" } }, + { { "uni0655", "kasratan" }, { "uni0655064D" } }, + { { "uni0655", "kasra" }, { "uni06550650" } }, + } + }, + { "f1", "lu6", "arab", "dflt", "liga", + new String[][][] { + { { "behinitial", "hehmedial" }, { "behwithhehinitial" } }, + { { "behinitial", "meemfinal" }, { "behwithmeemisolated" } }, + { { "behinitial", "meemmedial" }, { "behwithmeeminitial" } }, + { { "behinitial", "alefmaksurafinal" }, { "behwithalefmaksuraisolated" } }, + { { "behinitial", "yehfinal" }, { "behwithyehisolated" } }, + { { "behinitial", "jeemmedial" }, { "behwithjeeminitial" } }, + { { "behinitial", "hahmedial" }, { "behwithhahinitial" } }, + { { "behinitial", "khahmedial" }, { "behwithkhahinitial" } }, + { { "behmedial", "alefmaksurafinal" }, { "behwithalefmaksurafinal" } }, + { { "behmedial", "yehfinal" }, { "behwithyehfinal" } }, + { { "behmedial", "rehfinal" }, { "behwithrehfinal" } }, + { { "behmedial", "noonfinal" }, { "behwithnoonfinal" } }, + { { "fehinitial", "alefmaksurafinal" }, { "fehwithalefmaksuraisolated" } }, + { { "fehinitial", "yehfinal" }, { "fehwithyehisolated" } }, + { { "hahinitial", "meemmedial" }, { "hahwithmeeminitial" } }, + { { "hehinitial", "meemmedial" }, { "hehwithmeeminitial" } }, + { { "jeeminitial", "meemmedial" }, { "jeemwithmeeminitial" } }, + { { "khahinitial", "meemmedial" }, { "khahwithmeeminitial" } }, + { { "laminitial", "jeemmedial" }, { "lamwithjeeminitial" } }, + { { "laminitial", "hahmedial" }, { "lamwithhahinitial" } }, + { { "laminitial", "khahmedial" }, { "lamwithkhahinitial" } }, + { { "laminitial", "hehmedial" }, { "lamwithhehinitial" } }, + { { "laminitial", "meemfinal" }, { "lamwithmeemisolated" } }, + { { "laminitial", "alefmaksurafinal" }, { "lamwithalefmaksuraisolated" } }, + { { "laminitial", "yehfinal" }, { "lamwithyehisolated" } }, + { { "meeminitial", "jeemmedial" }, { "meemwithjeeminitial" } }, + { { "meeminitial", "hahmedial" }, { "meemwithhahinitial" } }, + { { "meeminitial", "khahmedial" }, { "meemwithkhahinitial" } }, + { { "meeminitial", "meemmedial" }, { "meemwithmeeminitial" } }, + { { "nooninitial", "hehmedial" }, { "noonwithhehinitial" } }, + { { "nooninitial", "meemfinal" }, { "noonwithmeemisolated" } }, + { { "nooninitial", "meemmedial" }, { "noonwithmeeminitial" } }, + { { "nooninitial", "alefmaksurafinal" }, { "noonwithalefmaksuraisolated" } }, + { { "nooninitial", "yehfinal" }, { "noonwithyehisolated" } }, + { { "nooninitial", "jeemmedial" }, { "noonwithjeeminitial" } }, + { { "nooninitial", "hahmedial" }, { "noonwithhahinitial" } }, + { { "nooninitial", "khahmedial" }, { "noonwithkhahinitial" } }, + { { "noonmedial", "alefmaksurafinal" }, { "noonwithalefmaksurafinal" } }, + { { "noonmedial", "yehfinal" }, { "noonwithyehfinal" } }, + { { "pehinitial", "hehmedial" }, { "pehwithhehinitial" } }, + { { "seeninitial", "meemmedial" }, { "seenwithmeeminitial" } }, + { { "sheeninitial", "meemmedial" }, { "sheenwithmeeminitial" } }, + { { "tchehinitial", "meemmedial" }, { "uniE817" } }, + { { "tehinitial", "hehmedial" }, { "tehwithhehinitial" } }, + { { "tehinitial", "meemfinal" }, { "tehwithmeemisolated" } }, + { { "tehinitial", "meemmedial" }, { "tehwithmeeminitial" } }, + { { "tehinitial", "yehfinal" }, { "tehwithyehisolated" } }, + { { "tehinitial", "jeemmedial" }, { "tehwithjeeminitial" } }, + { { "tehinitial", "hahmedial" }, { "tehwithhahinitial" } }, + { { "tehinitial", "khahmedial" }, { "tehwithkhahinitial" } }, + { { "tehmedial", "alefmaksurafinal" }, { "tehwithalefmaksurafinal" } }, + { { "tehmedial", "yehfinal" }, { "tehwithyehfinal" } }, + { { "tehmedial", "rehfinal" }, { "noonwithzainfinal" } }, + { { "tehmedial", "noonfinal" }, { "tehwithnoonfinal" } }, + { { "thehinitial", "meemfinal" }, { "thehwithmeemisolated" } }, + { { "thehinitial", "meemmedial" }, { "thehwithmeeminitial" } }, + { { "yehinitial", "meemfinal" }, { "yehwithmeemisolated" } }, + { { "yehinitial", "meemmedial" }, { "yehwithmeeminitial" } }, + { { "yehinitial", "alefmaksurafinal" }, { "yehwithalefmaksuraisolated" } }, + { { "yehinitial", "jeemmedial" }, { "yehwithjeeminitial" } }, + { { "yehinitial", "hahmedial" }, { "yehwithhahinitial" } }, + { { "yehinitial", "khahmedial" }, { "yehwithkhahinitial" } }, + { { "yehmedial", "alefmaksurafinal" }, { "yehwithalefmaksurafinal" } }, + { { "yehmedial", "rehfinal" }, { "yehwithrehfinal" } }, + { { "yehmedial", "noonfinal" }, { "yehwithnoonfinal" } }, + } + }, + { "f1", "lu7", "arab", "dflt", "liga", + new String[][][] { + { { "laminitial", "meemmedial", "jeemmedial" }, { "lamwithmeemwithjeeminitial" } }, + { { "laminitial", "meemmedial", "hahmedial" }, { "lamwithmeemwithhahinitial" } }, + { { "laminitial", "meemmedial" }, { "lamwithmeeminitial" } }, + } + }, + { "f1", "lu8", "arab", "dflt", "liga", + new String[][][] { + { { "laminitial", "jeemfinal" }, { "lamwithjeemisolated" } }, + { { "laminitial", "hahfinal" }, { "lamwithhahisolated" } }, + { { "laminitial", "khahfinal" }, { "lamwithkhahisolated" } }, + } + }, + { "f1", "lu9", "arab", "dflt", "rlig", + new String[][][] { + { { "laminitial", "alefwithmaddaabovefinal" }, { "lamwithalefmaddaaboveisolatedd" } }, + { { "laminitial", "alefwithhamzaabovefinal" }, { "lamwithalefhamzaaboveisolatedd" } }, + { { "laminitial", "alefwithhamzabelowfinal" }, { "lamwithalefhamzabelowisolated" } }, + { { "laminitial", "aleffinal" }, { "lamwithalefisolated" } }, + { { "lammedial", "alefwithmaddaabovefinal" }, { "lamwithalefmaddaabovefinal" } }, + { { "lammedial", "alefwithhamzaabovefinal" }, { "lamwithalefhamzaabovefinal" } }, + { { "lammedial", "alefwithhamzabelowfinal" }, { "lamwithalefhamzabelowfinal" } }, + { { "lammedial", "aleffinal" }, { "lamwithaleffinal" } }, + } + }, + { "f1", "lu10", "arab", "dflt", "liga", + new String[][][] { + { { "laminitial", "lammedial", "hehfinal" }, { "allahisolated" } }, + { { "reh", "yehinitial", "aleffinal", "lam" }, { "rayaleflam" } }, + } + }, + // arab-003.ttx + { "f2", "lu5", "arab", "dflt", "rlig", + new String[][][] { + { { "uni064B", "uni0651" }, { "uni0651064B" } }, + { { "uni064C", "uni0651" }, { "uni0651064C" } }, + { { "uni064E", "uni0651" }, { "uni0651064E" } }, + { { "uni064F", "uni0651" }, { "uni0651064F" } }, + { { "uni0651", "uni064B" }, { "uni0651064B" } }, + { { "uni0651", "uni064C" }, { "uni0651064C" } }, + { { "uni0651", "uni064E" }, { "uni0651064E" } }, + { { "uni0651", "uni064F" }, { "uni0651064F" } }, + { { "uni0651", "uni0670" }, { "absShaddaAlef" } }, + { { "uni0670", "uni0651" }, { "absShaddaAlef" } }, + } + }, + { "f2", "lu6", "arab", "dflt", "rlig", + new String[][][] { + { { "uni064D", "uni0651" }, { "uni0651064D" } }, + { { "uni0650", "uni0651" }, { "uni06510650" } }, + { { "uni0651", "uni0650" }, { "uni06510650" } }, + { { "uni0651", "uni064D" }, { "uni0651064D" } }, + } + }, + { "f2", "lu7", "arab", "dflt", "rlig", + new String[][][] { + { { "uni0647", "uni0654" }, { "uni06C0" } }, + { { "uni0647.fina", "uni0654" }, { "uni06C0.fina" } }, + { { "uni0647.init", "uni0654" }, { "uni06C0.init" } }, + { { "uni0647.medi", "uni0654" }, { "uni06C0.medi" } }, + { { "uni0648", "uni0654" }, { "uni0624" } }, + { { "uni0648.fina", "uni0654" }, { "uni0624.fina" } }, + { { "uni064A", "uni0654" }, { "uni0626" } }, + { { "uni064A.fina", "uni0654" }, { "uni0626.fina" } }, + { { "uni064A.init", "uni0654" }, { "uni0626.init" } }, + { { "uni064A.medi", "uni0654" }, { "uni0626.medi" } }, + { { "uni06C1", "uni0654" }, { "uni06C2" } }, + { { "uni06C1.fina", "uni0654" }, { "uni06C2.fina" } }, + { { "uni06C1.init", "uni0654" }, { "uni06C2.init" } }, + { { "uni06C1.medi", "uni0654" }, { "uni06C2.medi" } }, + } + }, + // arab-004.ttx + { "f3", "lu5", "arab", "dflt", "rlig", + new String[][][] { + { { "uni064B", "uni0651" }, { "uni0651064B" } }, + { { "uni064C", "uni0651" }, { "uni0651064C" } }, + { { "uni064E", "uni0651" }, { "uni0651064E" } }, + { { "uni064F", "uni0651" }, { "uni0651064F" } }, + { { "uni0651", "uni064B" }, { "uni0651064B" } }, + { { "uni0651", "uni064C" }, { "uni0651064C" } }, + { { "uni0651", "uni064E" }, { "uni0651064E" } }, + { { "uni0651", "uni064F" }, { "uni0651064F" } }, + { { "uni0651", "uni0670" }, { "absShaddaAlef" } }, + { { "uni0670", "uni0651" }, { "absShaddaAlef" } }, + } + }, + { "f3", "lu6", "arab", "dflt", "rlig", + new String[][][] { + { { "uni064D", "uni0651" }, { "uni0651064D" } }, + { { "uni0650", "uni0651" }, { "uni06510650" } }, + { { "uni0651", "uni0650" }, { "uni06510650" } }, + { { "uni0651", "uni064D" }, { "uni0651064D" } }, + } + }, + { "f3", "lu7", "arab", "dflt", "rlig", + new String[][][] { + { { "uni0647", "uni0654" }, { "uni06C0" } }, + { { "uni0647.fina", "uni0654" }, { "uni06C0.fina" } }, + { { "uni0647.init", "uni0654" }, { "uni06C0.init" } }, + { { "uni0647.medi", "uni0654" }, { "uni06C0.medi" } }, + { { "uni0648", "uni0654" }, { "uni0624" } }, + { { "uni0648.fina", "uni0654" }, { "uni0624.fina" } }, + { { "uni064A", "uni0654" }, { "uni0626" } }, + { { "uni064A.fina", "uni0654" }, { "uni0626.fina" } }, + { { "uni064A.init", "uni0654" }, { "uni0626.init" } }, + { { "uni064A.medi", "uni0654" }, { "uni0626.medi" } }, + { { "uni06C1", "uni0654" }, { "uni06C2" } }, + { { "uni06C1.fina", "uni0654" }, { "uni06C2.fina" } }, + { { "uni06C1.init", "uni0654" }, { "uni06C2.init" } }, + { { "uni06C1.medi", "uni0654" }, { "uni06C2.medi" } }, + } + }, + { "f3", "lu8", "arab", "dflt", "rlig", + new String[][][] { + { { "uni064E", "uni0654" }, { "uni0654064E" } }, + { { "uni064F", "uni0654" }, { "uni0654064F" } }, + { { "uni0654", "uni064E" }, { "uni0654064E" } }, + { { "uni0654", "uni064F" }, { "uni0654064F" } }, + } + }, + }; + + private static Object[][] ltContextual = { + { GlyphSubstitutionTable.GSUB_LOOKUP_TYPE_CONTEXTUAL }, + // arab-001.ttx - none used + // arab-002.ttx - none used + // arab-003.ttx - none used + // arab-004.ttx - none used + }; + + private static Object[][] ltChainedContextual = { + { GlyphSubstitutionTable.GSUB_LOOKUP_TYPE_CHAINED_CONTEXTUAL }, + // arab-001.ttx + { "f0", "lu1", "arab", "dflt", "ccmp", + new String[][][] { + { { "wawwithhamzaabove", "alefwithhamzabelow" }, { "wawwithhamzaabove", "arabicalef", "uni0655" } }, + { { "reh", "alefwithhamzabelow" }, { "reh", "arabicalef", "uni0655" } }, + { { "zain", "alefwithhamzabelow" }, { "zain", "arabicalef", "uni0655" } }, + { { "waw", "alefwithhamzabelow" }, { "waw", "arabicalef", "uni0655" } }, + { { "jeh", "alefwithhamzabelow" }, { "jeh", "arabicalef", "uni0655" } }, + } + }, + { "f0", "lu3", "arab", "dflt", "isol", + new String[][][] { + { { "hamza", "heh" }, { "hamza", "hehisolated" } }, + { { "alefwithmaddaabove", "heh" }, { "alefwithmaddaabove", "hehisolated" } }, + { { "alefwithhamzaabove", "heh" }, { "alefwithhamzaabove", "hehisolated" } }, + { { "wawwithhamzaabove", "heh" }, { "wawwithhamzaabove", "hehisolated" } }, + { { "alefwithhamzabelow", "heh" }, { "alefwithhamzabelow", "hehisolated" } }, + { { "arabicalef", "heh" }, { "arabicalef", "hehisolated" } }, + { { "tehmarbuta", "heh" }, { "tehmarbuta", "hehisolated" } }, + { { "dal", "heh" }, { "dal", "hehisolated" } }, + { { "thal", "heh" }, { "thal", "hehisolated" } }, + { { "reh", "heh" }, { "reh", "hehisolated" } }, + { { "zain", "heh" }, { "zain", "hehisolated" } }, + { { "waw", "heh" }, { "waw", "hehisolated" } }, + { { "alefwasla", "heh" }, { "alefwasla", "hehisolated" } }, + { { "jeh", "heh" }, { "jeh", "hehisolated" } }, + { { "arabicae", "heh" }, { "arabicae", "hehisolated" } }, + { { "alefwaslafinal", "heh" }, { "alefwaslafinal", "hehisolated" } }, + { { "alefwithmaddaabovefinal", "heh" }, { "alefwithmaddaabovefinal", "hehisolated" } }, + { { "alefwithhamzaabovefinal", "heh" }, { "alefwithhamzaabovefinal", "hehisolated" } }, + { { "alefwithhamzabelowfinal", "heh" }, { "alefwithhamzabelowfinal", "hehisolated" } }, + { { "aleffinal", "heh" }, { "aleffinal", "hehisolated" } }, + { { "tehmarbutafinal", "heh" }, { "tehmarbutafinal", "hehisolated" } }, + { { "lamwithalefmaddaaboveisolatedd", "heh" }, { "lamwithalefmaddaaboveisolatedd", "hehisolated" } }, + { { "lamwithalefmaddaabovefinal", "heh" }, { "lamwithalefmaddaabovefinal", "hehisolated" } }, + { { "lamwithalefhamzaaboveisolatedd", "heh" }, { "lamwithalefhamzaaboveisolatedd", "hehisolated" } }, + { { "lamwithalefhamzaabovefinal", "heh" }, { "lamwithalefhamzaabovefinal", "hehisolated" } }, + { { "lamwithalefhamzabelowisolated", "heh" }, { "lamwithalefhamzabelowisolated", "hehisolated" } }, + { { "lamwithalefhamzabelowfinal", "heh" }, { "lamwithalefhamzabelowfinal", "hehisolated" } }, + { { "lamwithalefisolated", "heh" }, { "lamwithalefisolated", "hehisolated" } }, + { { "lamwithaleffinal", "heh" }, { "lamwithaleffinal", "hehisolated" } }, + } + }, + // arab-002.ttx + { "f1", "lu2", "arab", "dflt", "isol", + new String[][][] { + { { "hamza", "heh" }, { "hamza", "hehisolated" } }, + { { "alefwithmaddaabove", "heh" }, { "alefwithmaddaabove", "hehisolated" } }, + { { "alefwithhamzaabove", "heh" }, { "alefwithhamzaabove", "hehisolated" } }, + { { "wawwithhamzaabove", "heh" }, { "wawwithhamzaabove", "hehisolated" } }, + { { "alefwithhamzabelow", "heh" }, { "alefwithhamzabelow", "hehisolated" } }, + { { "arabicalef", "heh" }, { "arabicalef", "hehisolated" } }, + { { "tehmarbuta", "heh" }, { "tehmarbuta", "hehisolated" } }, + { { "dal", "heh" }, { "dal", "hehisolated" } }, + { { "thal", "heh" }, { "thal", "hehisolated" } }, + { { "reh", "heh" }, { "reh", "hehisolated" } }, + { { "zain", "heh" }, { "zain", "hehisolated" } }, + { { "waw", "heh" }, { "waw", "hehisolated" } }, + { { "alefwasla", "heh" }, { "alefwasla", "hehisolated" } }, + { { "jeh", "heh" }, { "jeh", "hehisolated" } }, + { { "arabicae", "heh" }, { "arabicae", "hehisolated" } }, + { { "alefwaslafinal", "heh" }, { "alefwaslafinal", "hehisolated" } }, + { { "alefwithmaddaabovefinal", "heh" }, { "alefwithmaddaabovefinal", "hehisolated" } }, + { { "alefwithhamzaabovefinal", "heh" }, { "alefwithhamzaabovefinal", "hehisolated" } }, + { { "alefwithhamzabelowfinal", "heh" }, { "alefwithhamzabelowfinal", "hehisolated" } }, + { { "aleffinal", "heh" }, { "aleffinal", "hehisolated" } }, + { { "tehmarbutafinal", "heh" }, { "tehmarbutafinal", "hehisolated" } }, + { { "lamwithalefmaddaaboveisolatedd", "heh" }, { "lamwithalefmaddaaboveisolatedd", "hehisolated" } }, + { { "lamwithalefmaddaabovefinal", "heh" }, { "lamwithalefmaddaabovefinal", "hehisolated" } }, + { { "lamwithalefhamzaaboveisolatedd", "heh" }, { "lamwithalefhamzaaboveisolatedd", "hehisolated" } }, + { { "lamwithalefhamzaabovefinal", "heh" }, { "lamwithalefhamzaabovefinal", "hehisolated" } }, + { { "lamwithalefhamzabelowisolated", "heh" }, { "lamwithalefhamzabelowisolated", "hehisolated" } }, + { { "lamwithalefhamzabelowfinal", "heh" }, { "lamwithalefhamzabelowfinal", "hehisolated" } }, + { { "lamwithalefisolated", "heh" }, { "lamwithalefisolated", "hehisolated" } }, + { { "lamwithaleffinal", "heh" }, { "lamwithaleffinal", "hehisolated" } }, + } + }, + { "f1", "lu11", "arab", "dflt", "calt", + new String[][][] { + { { "pehinitial", "fatha", "pehmedial", "fatha" }, { "pehinitial", "tatweel", "fatha", "pehmedial", "fatha" } }, + { { "yehwithhamzaaboveinitial", "damma", "vehmedial", "damma" }, { "yehwithhamzaaboveinitial", "tatweel", "damma", "vehmedial", "damma" } }, + { { "behinitial", "shadda", "jehfinal", "shadda" }, { "behinitial", "tatweel", "shadda", "jehfinal", "shadda" } }, + { { "tehinitial", "sukun", "behmedial", "sukun" }, { "tehinitial", "tatweel", "sukun", "behmedial", "sukun" } }, + { { "thehinitial", "smallhighmadda", "tehmedial", "smallhighmadda" }, { "thehinitial", "tatweel", "smallhighmadda", "tehmedial", "smallhighmadda" } }, + { { "fehinitial", "fathaonhamza", "ainmedial", "fathaonhamza" }, { "fehinitial", "tatweel", "fathaonhamza", "ainmedial", "fathaonhamza" } }, + { { "qafinitial", "dammaonhamza", "qafmedial", "dammaonhamza" }, { "qafinitial", "tatweel", "dammaonhamza", "qafmedial", "dammaonhamza" } }, + { { "nooninitial", "superscriptalef", "wawfinal", "superscriptalef" }, { "nooninitial", "tatweel", "superscriptalef", "wawfinal", "superscriptalef" } }, + { { "yehinitial", "dammatanonhamza", "rehfinal", "dammatanonhamza" }, { "yehinitial", "tatweel", "dammatanonhamza", "rehfinal", "dammatanonhamza" } }, + { { "uni0649.init", "uni0654", "wawwithhamzaabovefinal", "uni0654" }, { "uni0649.init", "tatweel", "uni0654", "wawwithhamzaabovefinal", "uni0654" } }, + } + }, + { "f1", "lu12", "arab", "dflt", "calt", + new String[][][] { + { { "pehmedial", "fatha", "pehmedial", "fatha" }, { "pehmedial", "tatweel", "fatha", "pehmedial", "fatha" } }, + { { "yehwithhamzaabovemedial", "damma", "vehmedial", "damma" }, { "yehwithhamzaabovemedial", "tatweel", "damma", "vehmedial", "damma" } }, + { { "behmedial", "shadda", "wawwithhamzaabovefinal", "shadda" }, { "behmedial", "tatweel", "shadda", "wawwithhamzaabovefinal", "shadda" } }, + { { "tehmedial", "sukun", "rehfinal", "sukun" }, { "tehmedial", "tatweel", "sukun", "rehfinal", "sukun" } }, + { { "thehmedial", "smallhighmadda", "zainfinal", "smallhighmadda" }, { "thehmedial", "tatweel", "smallhighmadda", "zainfinal", "smallhighmadda" } }, + { { "noonmedial", "superscriptalef", "ainmedial", "superscriptalef" }, { "noonmedial", "tatweel", "superscriptalef", "ainmedial", "superscriptalef" } }, + { { "yehmedial", "dammatanonhamza", "wawfinal", "dammatanonhamza" }, { "yehmedial", "tatweel", "dammatanonhamza", "wawfinal", "dammatanonhamza" } }, + { { "uni0649.medi", "uni0654", "yehmedial", "uni0654" }, { "uni0649.medi", "tatweel", "uni0654", "yehmedial", "uni0654" } }, + } + }, + // arab-003.ttx + { "f2", "lu4", "arab", "dflt", "rlig", + new String[][][] { + { { "uni0644.medi", "uni0622.fina" }, { "uni0644.medi.preAlef", "uni0622.fina.postLamMed" } }, + { { "uni06B5.medi", "uni0622.fina" }, { "uni06B5.medi.preAlef", "uni0622.fina.postLamMed" } }, + { { "uni06B6.medi", "uni0622.fina" }, { "uni06B6.medi.preAlef", "uni0622.fina.postLamMed" } }, + { { "uni06B7.medi", "uni0622.fina" }, { "uni06B7.medi.preAlef", "uni0622.fina.postLamMed" } }, + { { "uni06B8.medi", "uni0622.fina" }, { "uni06B8.medi.preAlef", "uni0622.fina.postLamMed" } }, + { { "absLamRetroMed", "uni0622.fina" }, { "absLamRetroMed.preAlef", "uni0622.fina.postLamMed" } }, + { { "uni076A.medi", "uni0622.fina" }, { "uni076A.medi.preAlef", "uni0622.fina.postLamMed" } }, + { { "uni0644.init", "uni0622.fina" }, { "uni0644.init.preAlef", "uni0622.fina.postLamIni" } }, + { { "uni06B5.init", "uni0622.fina" }, { "uni06B5.init.preAlef", "uni0622.fina.postLamIni" } }, + { { "uni06B6.init", "uni0622.fina" }, { "uni06B6.init.preAlef", "uni0622.fina.postLamIni" } }, + { { "uni06B7.init", "uni0622.fina" }, { "uni06B7.init.preAlef", "uni0622.fina.postLamIni" } }, + { { "uni06B8.init", "uni0622.fina" }, { "uni06B8.init.preAlef", "uni0622.fina.postLamIni" } }, + { { "absLamRetroIni", "uni0622.fina" }, { "absLamRetroIni.preAlef", "uni0622.fina.postLamIni" } }, + { { "uni076A.init", "uni0622.fina" }, { "uni076A.init.preAlef", "uni0622.fina.postLamIni" } }, + } + }, + { "f2", "lu8", "arab", "dflt", "calt", + new String[][][] { + { { "uni064A", "uni0670" }, { "uni064A", "uni0670.large" } }, + } + }, + { "f2", "lu13", "arab", "dflt", "calt", + new String[][][] { + { { "uni06DD", "one" }, { "uni06DD", "oneMedium" } }, + { { "uni06DD", "one", "two" }, { "uni06DD.2", "oneMedium", "twoMedium" } }, + { { "uni06DD", "one", "two", "three" }, { "uni06DD.3", "oneSmall", "twoSmall", "threeSmall" } }, + } + }, + // arab-004.ttx + { "f3", "lu4", "arab", "dflt", "rlig", + new String[][][] { + { { "uni0644.medi", "uni0622.fina" }, { "uni0644.medi.preAlef", "uni0622.fina.postLamMed" } }, + { { "uni06B5.medi", "uni0622.fina" }, { "uni06B5.medi.preAlef", "uni0622.fina.postLamMed" } }, + { { "uni06B6.medi", "uni0622.fina" }, { "uni06B6.medi.preAlef", "uni0622.fina.postLamMed" } }, + { { "uni06B7.medi", "uni0622.fina" }, { "uni06B7.medi.preAlef", "uni0622.fina.postLamMed" } }, + { { "uni06B8.medi", "uni0622.fina" }, { "uni06B8.medi.preAlef", "uni0622.fina.postLamMed" } }, + { { "absLamRetroMed", "uni0622.fina" }, { "absLamRetroMed.preAlef", "uni0622.fina.postLamMed" } }, + { { "uni076A.medi", "uni0622.fina" }, { "uni076A.medi.preAlef", "uni0622.fina.postLamMed" } }, + { { "uni0644.init", "uni0622.fina" }, { "uni0644.init.preAlef", "uni0622.fina.postLamIni" } }, + { { "uni06B5.init", "uni0622.fina" }, { "uni06B5.init.preAlef", "uni0622.fina.postLamIni" } }, + { { "uni06B6.init", "uni0622.fina" }, { "uni06B6.init.preAlef", "uni0622.fina.postLamIni" } }, + { { "uni06B7.init", "uni0622.fina" }, { "uni06B7.init.preAlef", "uni0622.fina.postLamIni" } }, + { { "uni06B8.init", "uni0622.fina" }, { "uni06B8.init.preAlef", "uni0622.fina.postLamIni" } }, + { { "absLamRetroIni", "uni0622.fina" }, { "absLamRetroIni.preAlef", "uni0622.fina.postLamIni" } }, + { { "uni076A.init", "uni0622.fina" }, { "uni076A.init.preAlef", "uni0622.fina.postLamIni" } }, + } + }, + { "f3", "lu9", "arab", "dflt", "calt", + new String[][][] { + { { "uni0601", "uni0661" }, { "uni0601", "uni0661.Medium" } }, + { { "uni0601", "uni0661", "uni0662" }, { "uni0601.2", "uni0661.Medium", "uni0662.Medium" } }, + { { "uni0601", "uni0661", "uni0662", "uni0663" }, { "uni0601.3", "uni0661.Medium", "uni0662.Medium", "uni0663.Medium", } }, + { { "uni0601", "uni0661", "uni0662", "uni0663", "uni0664" }, { "uni0601.4", "uni0661.Medium", "uni0662.Medium", "uni0663.Medium", "uni0664.Medium" } }, + } + }, + { "f3", "lu10", "arab", "dflt", "calt", + new String[][][] { + { { "uni064A", "uni0670" }, { "uni064A", "uni0670.large" } }, + } + }, + }; + + @Test + public void testGSUBSingle() throws Exception { + performSubstitutions(ltSingle); + } + + @Test + public void testGSUBMultiple() throws Exception { + performSubstitutions(ltMultiple); + } + + @Test + public void testGSUBAlternate() throws Exception { + performSubstitutions(ltAlternate); + } + + @Test + public void testGSUBLigature() throws Exception { + performSubstitutions(ltLigature); + } + + @Test + public void testGSUBContextual() throws Exception { + performSubstitutions(ltContextual); + } + + @Test + public void testGSUBChainedContextual() throws Exception { + performSubstitutions(ltChainedContextual); + } + + /** + * Perform substitutions on all test data in test specification TS. + * @param ts test specification + */ + private void performSubstitutions(Object[][] ts) { + assert ts.length > 0; + Object[] tp = ts[0]; + for (int i = 1; i < ts.length; i++) { + performSubstitutions(tp, ts[i]); + } + } + + /** + * Perform substitutions on all test data TD using test parameters TP. + * @param tp test parameters + * @param td test data + */ + private void performSubstitutions(Object[] tp, Object[] td) { + assert tp.length > 0; + if (td.length > 5) { + String fid = (String) td[0]; + String lid = (String) td[1]; + String script = (String) td[2]; + String language = (String) td[3]; + String feature = (String) td[4]; + TTXFile tf = findTTX(fid); + assertTrue(tf != null); + GlyphSubstitutionTable gsub = tf.getGSUB(); + assertTrue(gsub != null); + GlyphSubstitutionSubtable[] sta = findGSUBSubtables(gsub, script, language, feature, lid); + assertTrue(sta != null); + assertTrue(sta.length > 0); + ScriptContextTester sct = findScriptContextTester(script, language, feature); + String[][][] tia = (String[][][]) td[5]; // test instance array + for (String[][] ti : tia) { // test instance + if (ti != null) { + if (ti.length > 1) { // must have at least input and output glyph id arrays + String[] igia = ti[0]; // input glyph id array + String[] ogia = ti[1]; // output glyph id array + GlyphSequence igs = tf.getGlyphSequence(igia); + GlyphSequence ogs = tf.getGlyphSequence(ogia); + GlyphSequence tgs = GlyphSubstitutionSubtable.substitute(igs, script, language, feature, sta, sct); + assertSameGlyphs(ogs, tgs); + } + } + } + } + } + + private String findTTXPath(String fid) { + for (String[] fs : ttxFonts) { + if ((fs != null) && (fs.length > 1)) { + if (fs[0].equals(fid)) { + return ttxFilesRoot + File.separator + fs[1]; + } + } + } + return null; + } + + private TTXFile findTTX(String fid) { + String pn = findTTXPath(fid); + assertTrue(pn != null); + try { + TTXFile tf = TTXFile.getFromCache(pn); + return tf; + } catch (Exception e) { + fail(e.getMessage()); + return null; + } + } + + private GlyphSubstitutionSubtable[] findGSUBSubtables(GlyphSubstitutionTable gsub, String script, String language, String feature, String lid) { + LookupTable lt = gsub.getLookupTable(lid); + if (lt != null) { + return (GlyphSubstitutionSubtable[]) lt.getSubtables(); + } else { + return null; + } + } + + private ScriptContextTester findScriptContextTester(String script, String language, String feature) { + return this; + } + + public GlyphContextTester getTester(String feature) { + return this; + } + + public boolean test(String script, String language, String feature, GlyphSequence gs, int index, int flags) { + return true; + } + + private void assertSameGlyphs(GlyphSequence gs1, GlyphSequence gs2) { + assertNotNull(gs1); + assertNotNull(gs2); + IntBuffer gb1 = gs1.getGlyphs(); + IntBuffer gb2 = gs2.getGlyphs(); + assertEquals("unequal glyph count", gb1.limit(), gb2.limit()); + for (int i = 0; i < gb1.limit(); i++) { + int g1 = gb1.get(i); + int g2 = gb2.get(i); + assertEquals("unequal glyph code", g1, g2); + } + } + +} diff --git a/src/test/java/org/apache/fop/complexscripts/fonts/ttx/TTXFile.java b/src/test/java/org/apache/fop/complexscripts/fonts/ttx/TTXFile.java new file mode 100644 index 000000000..178203ff6 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/fonts/ttx/TTXFile.java @@ -0,0 +1,3438 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.complexscripts.fonts.ttx; + +import java.io.File; +import java.io.IOException; +import java.nio.IntBuffer; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Comparator; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Stack; +import java.util.TreeMap; +import java.util.Vector; + +import javax.xml.parsers.FactoryConfigurationError; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.parsers.SAXParser; +import javax.xml.parsers.SAXParserFactory; + +import org.xml.sax.Attributes; +import org.xml.sax.Locator; +import org.xml.sax.SAXException; +import org.xml.sax.helpers.DefaultHandler; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import org.apache.fop.complexscripts.fonts.GlyphClassTable; +import org.apache.fop.complexscripts.fonts.GlyphCoverageTable; +import org.apache.fop.complexscripts.fonts.GlyphDefinitionTable; +import org.apache.fop.complexscripts.fonts.GlyphMappingTable; +import org.apache.fop.complexscripts.fonts.GlyphPositioningTable; +import org.apache.fop.complexscripts.fonts.GlyphPositioningTable.Anchor; +import org.apache.fop.complexscripts.fonts.GlyphPositioningTable.MarkAnchor; +import org.apache.fop.complexscripts.fonts.GlyphPositioningTable.PairValues; +import org.apache.fop.complexscripts.fonts.GlyphPositioningTable.Value; +import org.apache.fop.complexscripts.fonts.GlyphSubstitutionTable; +import org.apache.fop.complexscripts.fonts.GlyphSubstitutionTable.Ligature; +import org.apache.fop.complexscripts.fonts.GlyphSubstitutionTable.LigatureSet; +import org.apache.fop.complexscripts.fonts.GlyphSubtable; +import org.apache.fop.complexscripts.fonts.GlyphTable; +import org.apache.fop.complexscripts.fonts.GlyphTable.RuleLookup; +import org.apache.fop.complexscripts.util.GlyphSequence; +import org.apache.fop.complexscripts.util.UTF32; +import org.apache.fop.util.CharUtilities; + + +// CSOFF: LineLengthCheck + +/** + * This class supports a subset of the <code>TTX</code> file as produced by the Adobe FLEX + * SDK (AFDKO). In particular, it is used to parse a <code>TTX</code> file in order to + * extract character to glyph code mapping data, glyph definition data, glyph substitution + * data, and glyph positioning data. + * + * <code>TTX</code> files are used in FOP for testing and debugging purposes only. Such + * files are used to represent font data employed by complex script processing, and + * normally extracted directly from an opentype (or truetype) file. However, due to + * copyright restrictions, it is not possible to include most opentype (or truetype) font + * files directly in the FOP distribution. In such cases, <code>TTX</code> files are used + * to distribute a subset of the complex script advanced table information contained in + * certain font files to facilitate testing. + */ +public class TTXFile { + + /** logging instance */ + private static final Log log = LogFactory.getLog(TTXFile.class); // CSOK: ConstantNameCheck + /** default script tag */ + private static final String DEFAULT_SCRIPT_TAG = "dflt"; + /** default language tag */ + private static final String DEFAULT_LANGUAGE_TAG = "dflt"; + + /** ttxfile cache */ + private static Map<String, TTXFile> cache = new HashMap<String, TTXFile>(); + + // transient parsing state + private Locator locator; // current document locator + private Stack<String[]> elements; // stack of ttx elements being parsed + private Map<String, Integer> glyphIds; // map of glyph names to glyph identifiers + private List<int[]> cmapEntries; // list of <charCode,glyphCode> pairs + private Vector<int[]> hmtxEntries; // vector of <width,lsb> pairs + private Map<String, Integer> glyphClasses; // map of glyph names to glyph classes + private Map<String, Map<String, List<String>>> scripts; // map of script tag to Map<language-tag,List<features-id>>> + private Map<String, List<String>> languages; // map of language tag to List<feature-id> + private Map<String, Object[]> features; // map of feature id to Object[2] : { feature-tag, List<lookup-id> } + private List<String> languageFeatures; // list of language system feature ids, where first is (possibly null) required feature id + private List<String> featureLookups; // list of lookup ids for feature being constructed + private List<Integer> coverageEntries; // list of entries for coverage table being constructed + private Map<String, GlyphCoverageTable> coverages; // map of coverage table keys to coverage tables + private List subtableEntries; // list of lookup subtable entries + private List<GlyphSubtable> subtables; // list of constructed subtables + private List<Integer> alternates; // list of alternates in alternate set being constructed + private List<Ligature> ligatures; // list of ligatures in ligature set being constructed + private List<Integer> substitutes; // list of substitutes in (multiple substitution) sequence being constructed + private List<PairValues> pairs; // list of pair value records being constructed + private List<PairValues[]> pairSets; // list of pair value sets (as arrays) being constructed + private List<Anchor> anchors; // list of anchors of base|mark|component record being constructed + private List<Anchor[]> components; // list of ligature component anchors being constructed + private List<MarkAnchor> markAnchors; // list of mark anchors being constructed + private List<Anchor[]> baseOrMarkAnchors; // list of base|mark2 anchors being constructed + private List<Anchor[][]> ligatureAnchors; // list of ligature anchors being constructed + private List<Anchor[]> attachmentAnchors; // list of entry|exit attachment anchors being constructed + private List<RuleLookup> ruleLookups; // list of rule lookups being constructed + private int glyphIdMax; // maximum glyph id + private int cmPlatform; // plaform id of cmap being constructed + private int cmEncoding; // plaform id of cmap being constructed + private int cmLanguage; // plaform id of cmap being constructed + private int flIndex; // index of feature being constructed + private int flSequence; // feature sequence within feature list + private int ltIndex; // index of lookup table being constructed + private int ltSequence; // lookup sequence within table + private int ltFlags; // flags of current lookup being constructed + private int stSequence; // subtable sequence number within lookup + private int stFormat; // format of current subtable being constructed + private int ctFormat; // format of coverage table being constructed + private int ctIndex; // index of coverage table being constructed + private int rlSequence; // rule lookup sequence index + private int rlLookup; // rule lookup lookup index + private int psIndex; // pair set index + private int vf1; // value format 1 (used with pair pos and single pos) + private int vf2; // value format 2 (used with pair pos) + private int g2; // glyph id 2 (used with pair pos) + private int xCoord; // x coordinate of anchor being constructed + private int yCoord; // y coordinate of anchor being constructed + private int markClass; // mark class of mark anchor being constructed + private String defaultScriptTag; // tag of default script + private String scriptTag; // tag of script being constructed + private String defaultLanguageTag; // tag of default language system + private String languageTag; // tag of language system being constructed + private String featureTag; // tag of feature being constructed + private Value v1; // positioining value 1 + private Value v2; // positioining value 2 + + // resultant state + private int upem; // units per em + private Map<Integer, Integer> cmap; // constructed character map + private Map<Integer, Integer> gmap; // constructed glyph map + private int[][] hmtx; // constructed horizontal metrics - array of design { width, lsb } pairs, indexed by glyph code + private int[] widths; // pdf normalized widths (millipoints) + private GlyphDefinitionTable gdef; // constructed glyph definition table + private GlyphSubstitutionTable gsub; // constructed glyph substitution table + private GlyphPositioningTable gpos; // constructed glyph positioning table + + public TTXFile() { + elements = new Stack<String[]>(); + glyphIds = new HashMap<String, Integer>(); + cmapEntries = new ArrayList<int[]>(); + hmtxEntries = new Vector<int[]>(); + glyphClasses = new HashMap<String, Integer>(); + scripts = new HashMap<String, Map<String, List<String>>>(); + languages = new HashMap<String, List<String>>(); + features = new HashMap<String, Object[]>(); + languageFeatures = new ArrayList<String>(); + featureLookups = new ArrayList<String>(); + coverageEntries = new ArrayList<Integer>(); + coverages = new HashMap<String, GlyphCoverageTable>(); + subtableEntries = new ArrayList(); + subtables = new ArrayList<GlyphSubtable>(); + alternates = new ArrayList<Integer>(); + ligatures = new ArrayList<Ligature>(); + substitutes = new ArrayList<Integer>(); + pairs = new ArrayList<PairValues>(); + pairSets = new ArrayList<PairValues[]>(); + anchors = new ArrayList<Anchor>(); + markAnchors = new ArrayList<MarkAnchor>(); + baseOrMarkAnchors = new ArrayList<Anchor[]>(); + ligatureAnchors = new ArrayList<Anchor[][]>(); + components = new ArrayList<Anchor[]>(); + attachmentAnchors = new ArrayList<Anchor[]>(); + ruleLookups = new ArrayList<RuleLookup>(); + glyphIdMax = -1; + cmPlatform = -1; + cmEncoding = -1; + cmLanguage = -1; + flIndex = -1; + flSequence = 0; + ltIndex = -1; + ltSequence = 0; + ltFlags = 0; + stSequence = 0; + stFormat = 0; + ctFormat = -1; + ctIndex = -1; + rlSequence = -1; + rlLookup = -1; + psIndex = -1; + vf1 = -1; + vf2 = -1; + g2 = -1; + xCoord = Integer.MIN_VALUE; + yCoord = Integer.MIN_VALUE; + markClass = -1; + defaultScriptTag = DEFAULT_SCRIPT_TAG; + scriptTag = null; + defaultLanguageTag = DEFAULT_LANGUAGE_TAG; + languageTag = null; + featureTag = null; + v1 = null; + v2 = null; + upem = -1; + } + public void parse(String filename) { + parse(new File(filename)); + } + public void parse(File f) { + assert f != null; + try { + SAXParserFactory spf = SAXParserFactory.newInstance(); + SAXParser sp = spf.newSAXParser(); + sp.parse(f, new Handler()); + } catch (FactoryConfigurationError e) { + throw new RuntimeException(e.getMessage()); + } catch (ParserConfigurationException e) { + throw new RuntimeException(e.getMessage()); + } catch (SAXException e) { + throw new RuntimeException(e.getMessage()); + } catch (IOException e) { + throw new RuntimeException(e.getMessage()); + } + } + public GlyphSequence mapCharsToGlyphs(String s) { + Integer[] ca = UTF32.toUTF32(s, 0, true); + int ng = ca.length; + IntBuffer cb = IntBuffer.allocate(ng); + IntBuffer gb = IntBuffer.allocate(ng); + for (Integer c : ca) { + int g = mapCharToGlyph((int) c); + if (g >= 0) { + cb.put(c); + gb.put(g); + } else { + throw new IllegalArgumentException("character " + CharUtilities.format(c) + " has no corresponding glyph"); + } + } + cb.rewind(); + gb.rewind(); + return new GlyphSequence(cb, gb, null); + } + public int mapCharToGlyph(int c) { + if (cmap != null) { + Integer g = cmap.get(Integer.valueOf(c)); + if (g != null) { + return (int) g; + } else { + return -1; + } + } else { + return -1; + } + } + public int getGlyph(String gid) { + return mapGlyphId0(gid); + } + public GlyphSequence getGlyphSequence(String[] gids) { + assert gids != null; + int ng = gids.length; + IntBuffer cb = IntBuffer.allocate(ng); + IntBuffer gb = IntBuffer.allocate(ng); + for (String gid : gids) { + int g = mapGlyphId0(gid); + if (g >= 0) { + int c = mapGlyphIdToChar(gid); + if (c < 0) { + c = CharUtilities.NOT_A_CHARACTER; + } + cb.put(c); + gb.put(g); + } else { + throw new IllegalArgumentException("unmapped glyph id \"" + gid + "\""); + } + } + cb.rewind(); + gb.rewind(); + return new GlyphSequence(cb, gb, null); + } + public int[] getWidths(String[] gids) { + assert gids != null; + int ng = gids.length; + int[] widths = new int [ ng ]; + int i = 0; + for (String gid : gids) { + int g = mapGlyphId0(gid); + int w = 0; + if (g >= 0) { + if ((hmtx != null) && (g < hmtx.length)) { + int[] mtx = hmtx [ g ]; + assert mtx != null; + assert mtx.length > 0; + w = mtx[0]; + } + } + widths [ i++ ] = w; + } + assert i == ng; + return widths; + } + public int[] getWidths() { + if (this.widths == null) { + if ((hmtx != null) && (upem > 0)) { + int[] widths = new int [ hmtx.length ]; + for (int i = 0, n = widths.length; i < n; i++) { + widths [ i ] = getPDFWidth(hmtx [ i ] [ 0 ], upem); + } + this.widths = widths; + } + } + return this.widths; + } + public static int getPDFWidth(int tw, int upem) { + // N.B. The following is copied (with minor edits) from TTFFile to insure same results + int pw; + if (tw < 0) { + long rest1 = tw % upem; + long storrest = 1000 * rest1; + long ledd2 = (storrest != 0) ? (rest1 / storrest) : 0; + pw = -((-1000 * tw) / upem - (int) ledd2); + } else { + pw = (tw / upem) * 1000 + ((tw % upem) * 1000) / upem; + } + return pw; + } + public GlyphDefinitionTable getGDEF() { + return gdef; + } + public GlyphSubstitutionTable getGSUB() { + return gsub; + } + public GlyphPositioningTable getGPOS() { + return gpos; + } + public static synchronized TTXFile getFromCache(String filename) { + assert cache != null; + TTXFile f; + if ((f = (TTXFile) cache.get(filename)) == null) { + f = new TTXFile(); + f.parse(filename); + cache.put(filename, f); + } + return f; + } + public static synchronized void clearCache() { + cache.clear(); + } + private final class Handler extends DefaultHandler { + private Handler() { + } + @Override + public void startDocument() { + } + @Override + public void endDocument() { + } + @Override + public void setDocumentLocator(Locator locator) { + TTXFile.this.locator = locator; + } + @Override + public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { + String[] en = makeExpandedName(uri, localName, qName); + if (en[0] != null) { + unsupportedElement(en); + } else if (en[1].equals("Alternate")) { + String[] pn = new String[] { null, "AlternateSet" }; + if (isParent(pn)) { + String glyph = attrs.getValue("glyph"); + if (glyph == null) { + missingRequiredAttribute(en, "glyph"); + } + int gid = mapGlyphId(glyph, en); + alternates.add(Integer.valueOf(gid)); + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("AlternateSet")) { + String[] pn = new String[] { null, "AlternateSubst" }; + if (isParent(pn)) { + String glyph = attrs.getValue("glyph"); + if (glyph == null) { + missingRequiredAttribute(en, "glyph"); + } + int gid = mapGlyphId(glyph, en); + coverageEntries.add(Integer.valueOf(gid)); + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("AlternateSubst")) { + String[] pn = new String[] { null, "Lookup" }; + if (isParent(pn)) { + String index = attrs.getValue("index"); + if (index == null) { + missingRequiredAttribute(en, "index"); + } + String format = attrs.getValue("Format"); + int sf = -1; + if (format == null) { + missingRequiredAttribute(en, "Format"); + } else { + sf = Integer.parseInt(format); + switch (sf) { + case 1: + break; + default: + unsupportedFormat(en, sf); + break; + } + } + assertCoverageClear(); + ctIndex = 0; + ctFormat = 1; + assertSubtableClear(); + assert sf >= 0; + stFormat = sf; + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("BacktrackCoverage")) { + String[] pn1 = new String[] { null, "ChainContextSubst" }; + String[] pn2 = new String[] { null, "ChainContextPos" }; + String[][] pnx = new String[][] { pn1, pn2 }; + if (isParent(pnx)) { + String index = attrs.getValue("index"); + int ci = -1; + if (index == null) { + missingRequiredAttribute(en, "index"); + } else { + ci = Integer.parseInt(index); + } + String format = attrs.getValue("Format"); + int cf = -1; + if (format == null) { + missingRequiredAttribute(en, "Format"); + } else { + cf = Integer.parseInt(format); + switch (cf) { + case 1: + case 2: + break; + default: + unsupportedFormat(en, cf); + break; + } + } + assertCoverageClear(); + ctIndex = ci; + ctFormat = cf; + } else { + notPermittedInElementContext(en, getParent(), pnx); + } + } else if (en[1].equals("BaseAnchor")) { + String[] pn = new String[] { null, "BaseRecord" }; + if (isParent(pn)) { + String index = attrs.getValue("index"); + if (index == null) { + missingRequiredAttribute(en, "index"); + } + String format = attrs.getValue("Format"); + if (format == null) { + missingRequiredAttribute(en, "Format"); + } + assert xCoord == Integer.MIN_VALUE; + assert yCoord == Integer.MIN_VALUE; + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("BaseArray")) { + String[] pn = new String[] { null, "MarkBasePos" }; + if (!isParent(pn)) { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("BaseCoverage")) { + String[] pn = new String[] { null, "MarkBasePos" }; + if (isParent(pn)) { + String format = attrs.getValue("Format"); + int cf = -1; + if (format == null) { + missingRequiredAttribute(en, "Format"); + } else { + cf = Integer.parseInt(format); + switch (cf) { + case 1: + case 2: + break; + default: + unsupportedFormat(en, cf); + break; + } + } + assertCoverageClear(); + ctIndex = 0; + ctFormat = cf; + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("BaseRecord")) { + String[] pn = new String[] { null, "BaseArray" }; + if (isParent(pn)) { + String index = attrs.getValue("index"); + if (index == null) { + missingRequiredAttribute(en, "index"); + } + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("ChainContextPos") || en[1].equals("ChainContextSubst")) { + String[] pn = new String[] { null, "Lookup" }; + if (isParent(pn)) { + String index = attrs.getValue("index"); + if (index == null) { + missingRequiredAttribute(en, "index"); + } + String format = attrs.getValue("Format"); + int sf = -1; + if (format == null) { + missingRequiredAttribute(en, "Format"); + } else { + sf = Integer.parseInt(format); + switch (sf) { + case 1: + case 2: + case 3: + break; + default: + unsupportedFormat(en, sf); + break; + } + } + assertSubtableClear(); + assert sf >= 0; + stFormat = sf; + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("Class")) { + String[] pn = new String[] { null, "MarkRecord" }; + if (isParent(pn)) { + String value = attrs.getValue("value"); + int v = -1; + if (value == null) { + missingRequiredAttribute(en, "value"); + } else { + v = Integer.parseInt(value); + } + assert markClass == -1; + markClass = v; + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("ClassDef")) { + String[] pn1 = new String[] { null, "GlyphClassDef" }; + String[] pn2 = new String[] { null, "MarkAttachClassDef" }; + String[][] pnx = new String[][] { pn1, pn2 }; + if (isParent(pnx)) { + String glyph = attrs.getValue("glyph"); + if (glyph == null) { + missingRequiredAttribute(en, "glyph"); + } + String glyphClass = attrs.getValue("class"); + if (glyphClass == null) { + missingRequiredAttribute(en, "class"); + } + if (!glyphIds.containsKey(glyph)) { + unsupportedGlyph(en, glyph); + } else if (isParent(pn1)) { + if (glyphClasses.containsKey(glyph)) { + duplicateGlyphClass(en, glyph, glyphClass); + } else { + glyphClasses.put(glyph, Integer.parseInt(glyphClass)); + } + } else if (isParent(pn2)) { + if (glyphClasses.containsKey(glyph)) { + duplicateGlyphClass(en, glyph, glyphClass); + } else { + glyphClasses.put(glyph, Integer.parseInt(glyphClass)); + } + } + } else { + notPermittedInElementContext(en, getParent(), pnx); + } + } else if (en[1].equals("ComponentRecord")) { + String[] pn = new String[] { null, "LigatureAttach" }; + if (isParent(pn)) { + String index = attrs.getValue("index"); + if (index == null) { + missingRequiredAttribute(en, "index"); + } + assert anchors.size() == 0; + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("Coverage")) { + String[] pn1 = new String[] { null, "CursivePos" }; + String[] pn2 = new String[] { null, "LigCaretList" }; + String[] pn3 = new String[] { null, "MultipleSubst" }; + String[] pn4 = new String[] { null, "PairPos" }; + String[] pn5 = new String[] { null, "SinglePos" }; + String[][] pnx = new String[][] { pn1, pn2, pn3, pn4, pn5 }; + if (isParent(pnx)) { + String format = attrs.getValue("Format"); + int cf = -1; + if (format == null) { + missingRequiredAttribute(en, "Format"); + } else { + cf = Integer.parseInt(format); + switch (cf) { + case 1: + case 2: + break; + default: + unsupportedFormat(en, cf); + break; + } + } + assertCoverageClear(); + ctIndex = 0; + ctFormat = cf; + } else { + notPermittedInElementContext(en, getParent(), pnx); + } + } else if (en[1].equals("CursivePos")) { + String[] pn = new String[] { null, "Lookup" }; + if (isParent(pn)) { + String index = attrs.getValue("index"); + if (index == null) { + missingRequiredAttribute(en, "index"); + } + String format = attrs.getValue("Format"); + int sf = -1; + if (format == null) { + missingRequiredAttribute(en, "Format"); + } else { + sf = Integer.parseInt(format); + switch (sf) { + case 1: + break; + default: + unsupportedFormat(en, sf); + break; + } + } + assertSubtableClear(); + assert sf >= 0; + stFormat = sf; + assert attachmentAnchors.size() == 0; + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("DefaultLangSys")) { + String[] pn = new String[] { null, "Script" }; + if (!isParent(pn)) { + notPermittedInElementContext(en, getParent(), pn); + } else { + assertLanguageFeaturesClear(); + assert languageTag == null; + languageTag = defaultLanguageTag; + } + } else if (en[1].equals("EntryAnchor")) { + String[] pn = new String[] { null, "EntryExitRecord" }; + if (isParent(pn)) { + String format = attrs.getValue("Format"); + if (format == null) { + missingRequiredAttribute(en, "Format"); + } + assert xCoord == Integer.MIN_VALUE; + assert yCoord == Integer.MIN_VALUE; + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("EntryExitRecord")) { + String[] pn = new String[] { null, "CursivePos" }; + if (isParent(pn)) { + String index = attrs.getValue("index"); + if (index == null) { + missingRequiredAttribute(en, "index"); + } + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("ExitAnchor")) { + String[] pn = new String[] { null, "EntryExitRecord" }; + if (isParent(pn)) { + String format = attrs.getValue("Format"); + if (format == null) { + missingRequiredAttribute(en, "Format"); + } + assert xCoord == Integer.MIN_VALUE; + assert yCoord == Integer.MIN_VALUE; + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("Feature")) { + String[] pn = new String[] { null, "FeatureRecord" }; + if (!isParent(pn)) { + notPermittedInElementContext(en, getParent(), pn); + } else { + assertFeatureLookupsClear(); + } + } else if (en[1].equals("FeatureIndex")) { + String[] pn1 = new String[] { null, "DefaultLangSys" }; + String[] pn2 = new String[] { null, "LangSys" }; + String[][] pnx = new String[][] { pn1, pn2 }; + if (isParent(pnx)) { + String index = attrs.getValue("index"); + if (index == null) { + missingRequiredAttribute(en, "index"); + } + String value = attrs.getValue("value"); + int v = -1; + if (value == null) { + missingRequiredAttribute(en, "value"); + } else { + v = Integer.parseInt(value); + } + if (languageFeatures.size() == 0) { + languageFeatures.add(null); + } + if ((v >= 0) && (v < 65535)) { + languageFeatures.add(makeFeatureId(v)); + } + } else { + notPermittedInElementContext(en, getParent(), pnx); + } + } else if (en[1].equals("FeatureList")) { + String[] pn1 = new String[] { null, "GSUB" }; + String[] pn2 = new String[] { null, "GPOS" }; + String[][] pnx = new String[][] { pn1, pn2 }; + if (!isParent(pnx)) { + notPermittedInElementContext(en, getParent(), pnx); + } + } else if (en[1].equals("FeatureRecord")) { + String[] pn = new String[] { null, "FeatureList" }; + if (isParent(pn)) { + String index = attrs.getValue("index"); + int fi = -1; + if (index == null) { + missingRequiredAttribute(en, "index"); + } else { + fi = Integer.parseInt(index); + } + assertFeatureClear(); + assert flIndex == -1; + flIndex = fi; + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("FeatureTag")) { + String[] pn = new String[] { null, "FeatureRecord" }; + if (isParent(pn)) { + String value = attrs.getValue("value"); + if (value == null) { + missingRequiredAttribute(en, "value"); + } else { + assert featureTag == null; + featureTag = value; + } + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("GDEF")) { + String[] pn = new String[] { null, "ttFont" }; + if (isParent(pn)) { + assertSubtablesClear(); + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("GPOS")) { + String[] pn = new String[] { null, "ttFont" }; + if (isParent(pn)) { + assertCoveragesClear(); + assertSubtablesClear(); + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("GSUB")) { + String[] pn = new String[] { null, "ttFont" }; + if (isParent(pn)) { + assertCoveragesClear(); + assertSubtablesClear(); + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("Glyph")) { + String[] pn1 = new String[] { null, "Coverage" }; + String[] pn2 = new String[] { null, "InputCoverage" }; + String[] pn3 = new String[] { null, "LookAheadCoverage" }; + String[] pn4 = new String[] { null, "BacktrackCoverage" }; + String[] pn5 = new String[] { null, "MarkCoverage" }; + String[] pn6 = new String[] { null, "Mark1Coverage" }; + String[] pn7 = new String[] { null, "Mark2Coverage" }; + String[] pn8 = new String[] { null, "BaseCoverage" }; + String[] pn9 = new String[] { null, "LigatureCoverage" }; + String[][] pnx = new String[][] { pn1, pn2, pn3, pn4, pn5, pn6, pn7, pn8, pn9 }; + if (isParent(pnx)) { + String value = attrs.getValue("value"); + if (value == null) { + missingRequiredAttribute(en, "value"); + } else { + int gid = mapGlyphId(value, en); + coverageEntries.add(Integer.valueOf(gid)); + } + } else { + notPermittedInElementContext(en, getParent(), pnx); + } + } else if (en[1].equals("GlyphClassDef")) { + String[] pn = new String[] { null, "GDEF" }; + if (isParent(pn)) { + String format = attrs.getValue("Format"); + int sf = -1; + if (format == null) { + missingRequiredAttribute(en, "Format"); + } else { + sf = Integer.parseInt(format); + switch (sf) { + case 1: + case 2: + break; + default: + unsupportedFormat(en, sf); + break; + } + } + assertSubtableClear(); + assert sf >= 0; + // force format 1 since TTX always writes entries as non-range entries + if (sf != 1) { + sf = 1; + } + stFormat = sf; + assert glyphClasses.isEmpty(); + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("GlyphID")) { + String[] pn = new String[] { null, "GlyphOrder" }; + if (isParent(pn)) { + String id = attrs.getValue("id"); + int gid = -1; + if (id == null) { + missingRequiredAttribute(en, "id"); + } else { + gid = Integer.parseInt(id); + } + String name = attrs.getValue("name"); + if (name == null) { + missingRequiredAttribute(en, "name"); + } + if (glyphIds.containsKey(name)) { + duplicateGlyph(en, name, gid); + } else { + if (gid > glyphIdMax) { + glyphIdMax = gid; + } + glyphIds.put(name, gid); + } + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("GlyphOrder")) { + String[] pn = new String[] { null, "ttFont" }; + if (!isParent(pn)) { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("InputCoverage")) { + String[] pn1 = new String[] { null, "ChainContextSubst" }; + String[] pn2 = new String[] { null, "ChainContextPos" }; + String[][] pnx = new String[][] { pn1, pn2 }; + if (isParent(pnx)) { + String index = attrs.getValue("index"); + int ci = -1; + if (index == null) { + missingRequiredAttribute(en, "index"); + } else { + ci = Integer.parseInt(index); + } + String format = attrs.getValue("Format"); + int cf = -1; + if (format == null) { + missingRequiredAttribute(en, "Format"); + } else { + cf = Integer.parseInt(format); + switch (cf) { + case 1: + case 2: + break; + default: + unsupportedFormat(en, cf); + break; + } + } + assertCoverageClear(); + ctIndex = ci; + ctFormat = cf; + } else { + notPermittedInElementContext(en, getParent(), pnx); + } + } else if (en[1].equals("LangSys")) { + String[] pn = new String[] { null, "LangSysRecord" }; + if (!isParent(pn)) { + notPermittedInElementContext(en, getParent(), pn); + } else { + assertLanguageFeaturesClear(); + } + } else if (en[1].equals("LangSysRecord")) { + String[] pn = new String[] { null, "Script" }; + if (isParent(pn)) { + String index = attrs.getValue("index"); + if (index == null) { + missingRequiredAttribute(en, "index"); + } + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("LangSysTag")) { + String[] pn = new String[] { null, "LangSysRecord" }; + if (isParent(pn)) { + String value = attrs.getValue("value"); + if (value == null) { + missingRequiredAttribute(en, "value"); + } else { + assert languageTag == null; + languageTag = value; + } + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("LigCaretList")) { + String[] pn = new String[] { null, "GDEF" }; + if (!isParent(pn)) { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("Ligature")) { + String[] pn = new String[] { null, "LigatureSet" }; + if (isParent(pn)) { + String components = attrs.getValue("components"); + if (components == null) { + missingRequiredAttribute(en, "components"); + } + int[] cids = mapGlyphIds(components, en); + String glyph = attrs.getValue("glyph"); + if (glyph == null) { + missingRequiredAttribute(en, "glyph"); + } + int gid = mapGlyphId(glyph, en); + ligatures.add(new Ligature(gid, cids)); + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("LigatureAnchor")) { + String[] pn = new String[] { null, "ComponentRecord" }; + if (isParent(pn)) { + String index = attrs.getValue("index"); + if (index == null) { + missingRequiredAttribute(en, "index"); + } + String format = attrs.getValue("Format"); + if (format == null) { + missingRequiredAttribute(en, "Format"); + } + assert xCoord == Integer.MIN_VALUE; + assert yCoord == Integer.MIN_VALUE; + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("LigatureArray")) { + String[] pn = new String[] { null, "MarkLigPos" }; + if (!isParent(pn)) { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("LigatureAttach")) { + String[] pn = new String[] { null, "LigatureArray" }; + if (isParent(pn)) { + String index = attrs.getValue("index"); + if (index == null) { + missingRequiredAttribute(en, "index"); + } + assert components.size() == 0; + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("LigatureCoverage")) { + String[] pn = new String[] { null, "MarkLigPos" }; + if (isParent(pn)) { + String format = attrs.getValue("Format"); + int cf = -1; + if (format == null) { + missingRequiredAttribute(en, "Format"); + } else { + cf = Integer.parseInt(format); + switch (cf) { + case 1: + case 2: + break; + default: + unsupportedFormat(en, cf); + break; + } + } + assertCoverageClear(); + ctIndex = 0; + ctFormat = cf; + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("LigatureSet")) { + String[] pn = new String[] { null, "LigatureSubst" }; + if (isParent(pn)) { + String glyph = attrs.getValue("glyph"); + if (glyph == null) { + missingRequiredAttribute(en, "glyph"); + } + int gid = mapGlyphId(glyph, en); + coverageEntries.add(Integer.valueOf(gid)); + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("LigatureSubst")) { + String[] pn = new String[] { null, "Lookup" }; + if (isParent(pn)) { + String index = attrs.getValue("index"); + if (index == null) { + missingRequiredAttribute(en, "index"); + } + String format = attrs.getValue("Format"); + int sf = -1; + if (format == null) { + missingRequiredAttribute(en, "Format"); + } else { + sf = Integer.parseInt(format); + switch (sf) { + case 1: + break; + default: + unsupportedFormat(en, sf); + break; + } + } + assertCoverageClear(); + ctIndex = 0; + ctFormat = 1; + assertSubtableClear(); + assert sf >= 0; + stFormat = sf; + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("LookAheadCoverage")) { + String[] pn1 = new String[] { null, "ChainContextSubst" }; + String[] pn2 = new String[] { null, "ChainContextPos" }; + String[][] pnx = new String[][] { pn1, pn2 }; + if (isParent(pnx)) { + String index = attrs.getValue("index"); + int ci = -1; + if (index == null) { + missingRequiredAttribute(en, "index"); + } else { + ci = Integer.parseInt(index); + } + String format = attrs.getValue("Format"); + int cf = -1; + if (format == null) { + missingRequiredAttribute(en, "Format"); + } else { + cf = Integer.parseInt(format); + switch (cf) { + case 1: + case 2: + break; + default: + unsupportedFormat(en, cf); + break; + } + } + assertCoverageClear(); + ctIndex = ci; + ctFormat = cf; + } else { + notPermittedInElementContext(en, getParent(), pnx); + } + } else if (en[1].equals("Lookup")) { + String[] pn = new String[] { null, "LookupList" }; + if (isParent(pn)) { + String index = attrs.getValue("index"); + int li = -1; + if (index == null) { + missingRequiredAttribute(en, "index"); + } else { + li = Integer.parseInt(index); + } + assertLookupClear(); + assert ltIndex == -1; + ltIndex = li; + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("LookupFlag")) { + String[] pn = new String[] { null, "Lookup" }; + if (isParent(pn)) { + String value = attrs.getValue("value"); + int lf = 0; + if (value == null) { + missingRequiredAttribute(en, "value"); + } else { + lf = Integer.parseInt(value); + } + assert ltFlags == 0; + ltFlags = lf; + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("LookupList")) { + String[] pn1 = new String[] { null, "GSUB" }; + String[] pn2 = new String[] { null, "GPOS" }; + String[][] pnx = new String[][] { pn1, pn2 }; + if (!isParent(pnx)) { + notPermittedInElementContext(en, getParent(), pnx); + } + } else if (en[1].equals("LookupListIndex")) { + String[] pn1 = new String[] { null, "Feature" }; + String[] pn2 = new String[] { null, "SubstLookupRecord" }; + String[] pn3 = new String[] { null, "PosLookupRecord" }; + String[][] pnx = new String[][] { pn1, pn2, pn3 }; + if (isParent(pnx)) { + String index = attrs.getValue("index"); + String value = attrs.getValue("value"); + int v = -1; + if (value == null) { + missingRequiredAttribute(en, "value"); + } else { + v = Integer.parseInt(value); + } + String[][] pny = new String[][] { pn2, pn3 }; + if (isParent(pny)) { + assert rlLookup == -1; + assert v != -1; + rlLookup = v; + } else { + featureLookups.add(makeLookupId(v)); + } + } else { + notPermittedInElementContext(en, getParent(), pnx); + } + } else if (en[1].equals("LookupType")) { + String[] pn = new String[] { null, "Lookup" }; + if (isParent(pn)) { + String value = attrs.getValue("value"); + if (value == null) { + missingRequiredAttribute(en, "value"); + } + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("Mark1Array")) { + String[] pn = new String[] { null, "MarkMarkPos" }; + if (!isParent(pn)) { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("Mark1Coverage")) { + String[] pn = new String[] { null, "MarkMarkPos" }; + if (isParent(pn)) { + String format = attrs.getValue("Format"); + int cf = -1; + if (format == null) { + missingRequiredAttribute(en, "Format"); + } else { + cf = Integer.parseInt(format); + switch (cf) { + case 1: + case 2: + break; + default: + unsupportedFormat(en, cf); + break; + } + } + assertCoverageClear(); + ctIndex = 0; + ctFormat = cf; + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("Mark2Anchor")) { + String[] pn = new String[] { null, "Mark2Record" }; + if (isParent(pn)) { + String format = attrs.getValue("Format"); + if (format == null) { + missingRequiredAttribute(en, "Format"); + } + assert xCoord == Integer.MIN_VALUE; + assert yCoord == Integer.MIN_VALUE; + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("Mark2Array")) { + String[] pn = new String[] { null, "MarkMarkPos" }; + if (!isParent(pn)) { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("Mark2Coverage")) { + String[] pn = new String[] { null, "MarkMarkPos" }; + if (isParent(pn)) { + String format = attrs.getValue("Format"); + int cf = -1; + if (format == null) { + missingRequiredAttribute(en, "Format"); + } else { + cf = Integer.parseInt(format); + switch (cf) { + case 1: + case 2: + break; + default: + unsupportedFormat(en, cf); + break; + } + } + assertCoverageClear(); + ctIndex = 0; + ctFormat = cf; + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("Mark2Record")) { + String[] pn = new String[] { null, "Mark2Array" }; + if (isParent(pn)) { + String index = attrs.getValue("index"); + if (index == null) { + missingRequiredAttribute(en, "index"); + } + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("MarkAnchor")) { + String[] pn = new String[] { null, "MarkRecord" }; + if (isParent(pn)) { + String format = attrs.getValue("Format"); + if (format == null) { + missingRequiredAttribute(en, "Format"); + } + assert xCoord == Integer.MIN_VALUE; + assert yCoord == Integer.MIN_VALUE; + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("MarkArray")) { + String[] pn1 = new String[] { null, "MarkBasePos" }; + String[] pn2 = new String[] { null, "MarkLigPos" }; + String[][] pnx = new String[][] { pn1, pn2 }; + if (!isParent(pnx)) { + notPermittedInElementContext(en, getParent(), pnx); + } + } else if (en[1].equals("MarkAttachClassDef")) { + String[] pn = new String[] { null, "GDEF" }; + if (isParent(pn)) { + String format = attrs.getValue("Format"); + int sf = -1; + if (format == null) { + missingRequiredAttribute(en, "Format"); + } else { + sf = Integer.parseInt(format); + switch (sf) { + case 1: + case 2: + break; + default: + unsupportedFormat(en, sf); + break; + } + } + assertSubtableClear(); + assert sf >= 0; + // force format 1 since TTX always writes entries as non-range entries + if (sf != 1) { + sf = 1; + } + stFormat = sf; + assert glyphClasses.isEmpty(); + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("MarkBasePos")) { + String[] pn = new String[] { null, "Lookup" }; + if (isParent(pn)) { + String index = attrs.getValue("index"); + if (index == null) { + missingRequiredAttribute(en, "index"); + } + String format = attrs.getValue("Format"); + int sf = -1; + if (format == null) { + missingRequiredAttribute(en, "Format"); + } else { + sf = Integer.parseInt(format); + switch (sf) { + case 1: + break; + default: + unsupportedFormat(en, sf); + break; + } + } + assertSubtableClear(); + assert sf >= 0; + stFormat = sf; + assert markAnchors.size() == 0; + assert baseOrMarkAnchors.size() == 0; + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("MarkCoverage")) { + String[] pn1 = new String[] { null, "MarkBasePos" }; + String[] pn2 = new String[] { null, "MarkLigPos" }; + String[][] pnx = new String[][] { pn1, pn2 }; + if (isParent(pnx)) { + String format = attrs.getValue("Format"); + int cf = -1; + if (format == null) { + missingRequiredAttribute(en, "Format"); + } else { + cf = Integer.parseInt(format); + switch (cf) { + case 1: + case 2: + break; + default: + unsupportedFormat(en, cf); + break; + } + } + assertCoverageClear(); + ctIndex = 0; + ctFormat = cf; + } else { + notPermittedInElementContext(en, getParent(), pnx); + } + } else if (en[1].equals("MarkLigPos")) { + String[] pn = new String[] { null, "Lookup" }; + if (isParent(pn)) { + String index = attrs.getValue("index"); + if (index == null) { + missingRequiredAttribute(en, "index"); + } + String format = attrs.getValue("Format"); + int sf = -1; + if (format == null) { + missingRequiredAttribute(en, "Format"); + } else { + sf = Integer.parseInt(format); + switch (sf) { + case 1: + break; + default: + unsupportedFormat(en, sf); + break; + } + } + assertSubtableClear(); + assert sf >= 0; + stFormat = sf; + assert markAnchors.size() == 0; + assert ligatureAnchors.size() == 0; + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("MarkMarkPos")) { + String[] pn = new String[] { null, "Lookup" }; + if (isParent(pn)) { + String index = attrs.getValue("index"); + if (index == null) { + missingRequiredAttribute(en, "index"); + } + String format = attrs.getValue("Format"); + int sf = -1; + if (format == null) { + missingRequiredAttribute(en, "Format"); + } else { + sf = Integer.parseInt(format); + switch (sf) { + case 1: + break; + default: + unsupportedFormat(en, sf); + break; + } + } + assertSubtableClear(); + assert sf >= 0; + stFormat = sf; + assert markAnchors.size() == 0; + assert baseOrMarkAnchors.size() == 0; + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("MarkRecord")) { + String[] pn1 = new String[] { null, "MarkArray" }; + String[] pn2 = new String[] { null, "Mark1Array" }; + String[][] pnx = new String[][] { pn1, pn2 }; + if (isParent(pnx)) { + String index = attrs.getValue("index"); + if (index == null) { + missingRequiredAttribute(en, "index"); + } + } else { + notPermittedInElementContext(en, getParent(), pnx); + } + } else if (en[1].equals("MultipleSubst")) { + String[] pn = new String[] { null, "Lookup" }; + if (isParent(pn)) { + String index = attrs.getValue("index"); + if (index == null) { + missingRequiredAttribute(en, "index"); + } + String format = attrs.getValue("Format"); + int sf = -1; + if (format == null) { + missingRequiredAttribute(en, "Format"); + } else { + sf = Integer.parseInt(format); + switch (sf) { + case 1: + break; + default: + unsupportedFormat(en, sf); + break; + } + } + assertSubtableClear(); + assert sf >= 0; + stFormat = sf; + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("PairPos")) { + String[] pn = new String[] { null, "Lookup" }; + if (isParent(pn)) { + String index = attrs.getValue("index"); + if (index == null) { + missingRequiredAttribute(en, "index"); + } + String format = attrs.getValue("Format"); + int sf = -1; + if (format == null) { + missingRequiredAttribute(en, "Format"); + } else { + sf = Integer.parseInt(format); + switch (sf) { + case 1: + case 2: + break; + default: + unsupportedFormat(en, sf); + break; + } + } + assertSubtableClear(); + assert sf >= 0; + stFormat = sf; + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("PairSet")) { + String[] pn = new String[] { null, "PairPos" }; + if (isParent(pn)) { + String index = attrs.getValue("index"); + int psi = -1; + if (index == null) { + missingRequiredAttribute(en, "index"); + } else { + psi = Integer.parseInt(index); + } + assert psIndex == -1; + psIndex = psi; + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("PairValueRecord")) { + String[] pn = new String[] { null, "PairSet" }; + if (isParent(pn)) { + String index = attrs.getValue("index"); + if (index == null) { + missingRequiredAttribute(en, "index"); + } else { + assertPairClear(); + } + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("PosLookupRecord")) { + String[] pn1 = new String[] { null, "ChainContextSubst" }; + String[] pn2 = new String[] { null, "ChainContextPos" }; + String[][] pnx = new String[][] { pn1, pn2 }; + if (isParent(pnx)) { + String index = attrs.getValue("index"); + if (index == null) { + missingRequiredAttribute(en, "index"); + } + } else { + notPermittedInElementContext(en, getParent(), pnx); + } + } else if (en[1].equals("ReqFeatureIndex")) { + String[] pn1 = new String[] { null, "DefaultLangSys" }; + String[] pn2 = new String[] { null, "LangSys" }; + String[][] pnx = new String[][] { pn1, pn2 }; + if (isParent(pnx)) { + String value = attrs.getValue("value"); + int v = -1; + if (value == null) { + missingRequiredAttribute(en, "value"); + } else { + v = Integer.parseInt(value); + } + String fid; + if ((v >= 0) && (v < 65535)) { + fid = makeFeatureId(v); + } else { + fid = null; + } + assertLanguageFeaturesClear(); + languageFeatures.add(fid); + } else { + notPermittedInElementContext(en, getParent(), pnx); + } + } else if (en[1].equals("Script")) { + String[] pn = new String[] { null, "ScriptRecord" }; + if (!isParent(pn)) { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("ScriptList")) { + String[] pn1 = new String[] { null, "GSUB" }; + String[] pn2 = new String[] { null, "GPOS" }; + String[][] pnx = new String[][] { pn1, pn2 }; + if (!isParent(pnx)) { + notPermittedInElementContext(en, getParent(), pnx); + } + } else if (en[1].equals("ScriptRecord")) { + String[] pn = new String[] { null, "ScriptList" }; + if (isParent(pn)) { + String index = attrs.getValue("index"); + if (index == null) { + missingRequiredAttribute(en, "index"); + } + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("ScriptTag")) { + String[] pn = new String[] { null, "ScriptRecord" }; + if (isParent(pn)) { + String value = attrs.getValue("value"); + if (value == null) { + missingRequiredAttribute(en, "value"); + } else { + assert scriptTag == null; + scriptTag = value; + } + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("SecondGlyph")) { + String[] pn = new String[] { null, "PairValueRecord" }; + if (isParent(pn)) { + String value = attrs.getValue("value"); + if (value == null) { + missingRequiredAttribute(en, "value"); + } else { + int gid = mapGlyphId(value, en); + assert g2 == -1; + g2 = gid; + } + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("Sequence")) { + String[] pn = new String[] { null, "MultipleSubst" }; + if (isParent(pn)) { + String index = attrs.getValue("index"); + if (index == null) { + missingRequiredAttribute(en, "index"); + } else { + int i = Integer.parseInt(index); + if (i != subtableEntries.size()) { + invalidIndex(en, i, subtableEntries.size()); + } + } + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("SequenceIndex")) { + String[] pn1 = new String[] { null, "PosLookupRecord" }; + String[] pn2 = new String[] { null, "SubstLookupRecord" }; + String[][] pnx = new String[][] { pn1, pn2 }; + if (isParent(pnx)) { + String value = attrs.getValue("value"); + int v = -1; + if (value == null) { + missingRequiredAttribute(en, "value"); + } else { + v = Integer.parseInt(value); + } + assert rlSequence == -1; + assert v != -1; + rlSequence = v; + } else { + notPermittedInElementContext(en, getParent(), pnx); + } + } else if (en[1].equals("SinglePos")) { + String[] pn = new String[] { null, "Lookup" }; + if (isParent(pn)) { + String index = attrs.getValue("index"); + if (index == null) { + missingRequiredAttribute(en, "index"); + } + String format = attrs.getValue("Format"); + int sf = -1; + if (format == null) { + missingRequiredAttribute(en, "Format"); + } else { + sf = Integer.parseInt(format); + switch (sf) { + case 1: + case 2: + break; + default: + unsupportedFormat(en, sf); + break; + } + } + assertSubtableClear(); + assert sf >= 0; + stFormat = sf; + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("SingleSubst")) { + String[] pn = new String[] { null, "Lookup" }; + if (isParent(pn)) { + String index = attrs.getValue("index"); + if (index == null) { + missingRequiredAttribute(en, "index"); + } + String format = attrs.getValue("Format"); + int sf = -1; + if (format == null) { + missingRequiredAttribute(en, "Format"); + } else { + sf = Integer.parseInt(format); + switch (sf) { + case 1: + case 2: + break; + default: + unsupportedFormat(en, sf); + break; + } + } + assertCoverageClear(); + ctIndex = 0; + ctFormat = 1; + assertSubtableClear(); + assert sf >= 0; + stFormat = sf; + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("SubstLookupRecord")) { + String[] pn = new String[] { null, "ChainContextSubst" }; + if (isParent(pn)) { + String index = attrs.getValue("index"); + if (index == null) { + missingRequiredAttribute(en, "index"); + } + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("Substitute")) { + String[] pn = new String[] { null, "Sequence" }; + if (isParent(pn)) { + String index = attrs.getValue("index"); + if (index == null) { + missingRequiredAttribute(en, "index"); + } else { + int i = Integer.parseInt(index); + if (i != substitutes.size()) { + invalidIndex(en, i, substitutes.size()); + } + } + String value = attrs.getValue("value"); + if (value == null) { + missingRequiredAttribute(en, "value"); + } else { + int gid = mapGlyphId(value, en); + substitutes.add(Integer.valueOf(gid)); + } + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("Substitution")) { + String[] pn = new String[] { null, "SingleSubst" }; + if (isParent(pn)) { + String in = attrs.getValue("in"); + int igid = -1; + int ogid = -1; + if (in == null) { + missingRequiredAttribute(en, "in"); + } else { + igid = mapGlyphId(in, en); + } + String out = attrs.getValue("out"); + if (out == null) { + missingRequiredAttribute(en, "out"); + } else { + ogid = mapGlyphId(out, en); + } + coverageEntries.add(Integer.valueOf(igid)); + subtableEntries.add(Integer.valueOf(ogid)); + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("Value")) { + String[] pn = new String[] { null, "SinglePos" }; + if (isParent(pn)) { + String index = attrs.getValue("index"); + if (vf1 < 0) { + missingParameter(en, "value format"); + } else { + subtableEntries.add(parseValue(en, attrs, vf1)); + } + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("Value1")) { + String[] pn = new String[] { null, "PairValueRecord" }; + if (isParent(pn)) { + if (vf1 < 0) { + missingParameter(en, "value format 1"); + } else { + assert v1 == null; + v1 = parseValue(en, attrs, vf1); + } + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("Value2")) { + String[] pn = new String[] { null, "PairValueRecord" }; + if (isParent(pn)) { + if (vf2 < 0) { + missingParameter(en, "value format 2"); + } else { + assert v2 == null; + v2 = parseValue(en, attrs, vf2); + } + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("ValueFormat")) { + String[] pn = new String[] { null, "SinglePos" }; + if (isParent(pn)) { + String value = attrs.getValue("value"); + int vf = -1; + if (value == null) { + missingRequiredAttribute(en, "value"); + } else { + vf = Integer.parseInt(value); + } + assert vf1 == -1; + vf1 = vf; + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("ValueFormat1")) { + String[] pn = new String[] { null, "PairPos" }; + if (isParent(pn)) { + String value = attrs.getValue("value"); + int vf = -1; + if (value == null) { + missingRequiredAttribute(en, "value"); + } else { + vf = Integer.parseInt(value); + } + assert vf1 == -1; + vf1 = vf; + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("ValueFormat2")) { + String[] pn = new String[] { null, "PairPos" }; + if (isParent(pn)) { + String value = attrs.getValue("value"); + int vf = -1; + if (value == null) { + missingRequiredAttribute(en, "value"); + } else { + vf = Integer.parseInt(value); + } + assert vf2 == -1; + vf2 = vf; + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("Version")) { + String[] pn1 = new String[] { null, "GDEF" }; + String[] pn2 = new String[] { null, "GPOS" }; + String[] pn3 = new String[] { null, "GSUB" }; + String[][] pnx = new String[][] { pn1, pn2, pn3 }; + if (isParent(pnx)) { + String value = attrs.getValue("value"); + if (value == null) { + missingRequiredAttribute(en, "value"); + } + } else { + notPermittedInElementContext(en, getParent(), pnx); + } + } else if (en[1].equals("XCoordinate")) { + String[] pn1 = new String[] { null, "BaseAnchor" }; + String[] pn2 = new String[] { null, "EntryAnchor" }; + String[] pn3 = new String[] { null, "ExitAnchor" }; + String[] pn4 = new String[] { null, "LigatureAnchor" }; + String[] pn5 = new String[] { null, "MarkAnchor" }; + String[] pn6 = new String[] { null, "Mark2Anchor" }; + String[][] pnx = new String[][] { pn1, pn2, pn3, pn4, pn5, pn6 }; + if (isParent(pnx)) { + String value = attrs.getValue("value"); + int x = 0; + if (value == null) { + missingRequiredAttribute(en, "value"); + } else { + x = Integer.parseInt(value); + } + assert xCoord == Integer.MIN_VALUE; + xCoord = x; + } else { + notPermittedInElementContext(en, getParent(), pnx); + } + } else if (en[1].equals("YCoordinate")) { + String[] pn1 = new String[] { null, "BaseAnchor" }; + String[] pn2 = new String[] { null, "EntryAnchor" }; + String[] pn3 = new String[] { null, "ExitAnchor" }; + String[] pn4 = new String[] { null, "LigatureAnchor" }; + String[] pn5 = new String[] { null, "MarkAnchor" }; + String[] pn6 = new String[] { null, "Mark2Anchor" }; + String[][] pnx = new String[][] { pn1, pn2, pn3, pn4, pn5, pn6 }; + if (isParent(pnx)) { + String value = attrs.getValue("value"); + int y = 0; + if (value == null) { + missingRequiredAttribute(en, "value"); + } else { + y = Integer.parseInt(value); + } + assert yCoord == Integer.MIN_VALUE; + yCoord = y; + } else { + notPermittedInElementContext(en, getParent(), pnx); + } + } else if (en[1].equals("checkSumAdjustment")) { + String[] pn = new String[] { null, "head" }; + if (isParent(pn)) { + String value = attrs.getValue("value"); + if (value == null) { + missingRequiredAttribute(en, "value"); + } + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("cmap")) { + String[] pn = new String[] { null, "ttFont" }; + if (!isParent(pn)) { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("cmap_format_0")) { + String[] pn = new String[] { null, "cmap" }; + if (isParent(pn)) { + String platformID = attrs.getValue("platformID"); + if (platformID == null) { + missingRequiredAttribute(en, "platformID"); + } + String platEncID = attrs.getValue("platEncID"); + if (platEncID == null) { + missingRequiredAttribute(en, "platEncID"); + } + String language = attrs.getValue("language"); + if (language == null) { + missingRequiredAttribute(en, "language"); + } + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("cmap_format_4")) { + String[] pn = new String[] { null, "cmap" }; + if (isParent(pn)) { + String platformID = attrs.getValue("platformID"); + int pid = -1; + if (platformID == null) { + missingRequiredAttribute(en, "platformID"); + } else { + pid = Integer.parseInt(platformID); + } + String platEncID = attrs.getValue("platEncID"); + int eid = -1; + if (platEncID == null) { + missingRequiredAttribute(en, "platEncID"); + } else { + eid = Integer.parseInt(platEncID); + } + String language = attrs.getValue("language"); + int lid = -1; + if (language == null) { + missingRequiredAttribute(en, "language"); + } else { + lid = Integer.parseInt(language); + } + assert cmapEntries.size() == 0; + assert cmPlatform == -1; + assert cmEncoding == -1; + assert cmLanguage == -1; + cmPlatform = pid; + cmEncoding = eid; + cmLanguage = lid; + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("created")) { + String[] pn = new String[] { null, "head" }; + if (isParent(pn)) { + String value = attrs.getValue("value"); + if (value == null) { + missingRequiredAttribute(en, "value"); + } + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("flags")) { + String[] pn = new String[] { null, "head" }; + if (isParent(pn)) { + String value = attrs.getValue("value"); + if (value == null) { + missingRequiredAttribute(en, "value"); + } + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("fontDirectionHint")) { + String[] pn = new String[] { null, "head" }; + if (isParent(pn)) { + String value = attrs.getValue("value"); + if (value == null) { + missingRequiredAttribute(en, "value"); + } + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("fontRevision")) { + String[] pn = new String[] { null, "head" }; + if (isParent(pn)) { + String value = attrs.getValue("value"); + if (value == null) { + missingRequiredAttribute(en, "value"); + } + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("glyphDataFormat")) { + String[] pn = new String[] { null, "head" }; + if (isParent(pn)) { + String value = attrs.getValue("value"); + if (value == null) { + missingRequiredAttribute(en, "value"); + } + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("head")) { + String[] pn = new String[] { null, "ttFont" }; + if (!isParent(pn)) { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("hmtx")) { + String[] pn = new String[] { null, "ttFont" }; + if (!isParent(pn)) { + notPermittedInElementContext(en, getParent(), pn); + } else if (glyphIdMax > 0) { + hmtxEntries.setSize(glyphIdMax + 1); + } + } else if (en[1].equals("indexToLocFormat")) { + String[] pn = new String[] { null, "head" }; + if (isParent(pn)) { + String value = attrs.getValue("value"); + if (value == null) { + missingRequiredAttribute(en, "value"); + } + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("lowestRecPPEM")) { + String[] pn = new String[] { null, "head" }; + if (isParent(pn)) { + String value = attrs.getValue("value"); + if (value == null) { + missingRequiredAttribute(en, "value"); + } + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("macStyle")) { + String[] pn = new String[] { null, "head" }; + if (isParent(pn)) { + String value = attrs.getValue("value"); + if (value == null) { + missingRequiredAttribute(en, "value"); + } + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("magicNumber")) { + String[] pn = new String[] { null, "head" }; + if (isParent(pn)) { + String value = attrs.getValue("value"); + if (value == null) { + missingRequiredAttribute(en, "value"); + } + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("map")) { + String[] pn1 = new String[] { null, "cmap_format_0" }; + String[] pn2 = new String[] { null, "cmap_format_4" }; + String[][] pnx = new String[][] { pn1, pn2 }; + if (isParent(pnx)) { + String code = attrs.getValue("code"); + int cid = -1; + if (code == null) { + missingRequiredAttribute(en, "code"); + } else { + code = code.toLowerCase(); + if (code.startsWith("0x")) { + cid = Integer.parseInt(code.substring(2), 16); + } else { + cid = Integer.parseInt(code, 10); + } + } + String name = attrs.getValue("name"); + int gid = -1; + if (name == null) { + missingRequiredAttribute(en, "name"); + } else { + gid = mapGlyphId(name, en); + } + if ((cmPlatform == 3) && (cmEncoding == 1)) { + cmapEntries.add(new int[] { cid, gid }); + } + } else { + notPermittedInElementContext(en, getParent(), pnx); + } + } else if (en[1].equals("modified")) { + String[] pn = new String[] { null, "head" }; + if (isParent(pn)) { + String value = attrs.getValue("value"); + if (value == null) { + missingRequiredAttribute(en, "value"); + } + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("mtx")) { + String[] pn = new String[] { null, "hmtx" }; + if (isParent(pn)) { + String name = attrs.getValue("name"); + int gid = -1; + if (name == null) { + missingRequiredAttribute(en, "name"); + } else { + gid = mapGlyphId(name, en); + } + String width = attrs.getValue("width"); + int w = -1; + if (width == null) { + missingRequiredAttribute(en, "width"); + } else { + w = Integer.parseInt(width); + } + String lsb = attrs.getValue("lsb"); + int l = -1; + if (lsb == null) { + missingRequiredAttribute(en, "lsb"); + } else { + l = Integer.parseInt(lsb); + } + hmtxEntries.set(gid, new int[] { w, l }); + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("tableVersion")) { + String[] pn1 = new String[] { null, "cmap" }; + String[] pn2 = new String[] { null, "head" }; + String[][] pnx = new String[][] { pn1, pn2 }; + if (isParent(pn1)) { // child of cmap + String version = attrs.getValue("version"); + if (version == null) { + missingRequiredAttribute(en, "version"); + } + } else if (isParent(pn2)) { // child of head + String value = attrs.getValue("value"); + if (value == null) { + missingRequiredAttribute(en, "value"); + } + } else { + notPermittedInElementContext(en, getParent(), pnx); + } + } else if (en[1].equals("ttFont")) { + String[] pn = new String[] { null, null }; + if (isParent(pn)) { + String sfntVersion = attrs.getValue("sfntVersion"); + if (sfntVersion == null) { + missingRequiredAttribute(en, "sfntVersion"); + } + String ttLibVersion = attrs.getValue("ttLibVersion"); + if (ttLibVersion == null) { + missingRequiredAttribute(en, "ttLibVersion"); + } + } else { + notPermittedInElementContext(en, getParent(), null); + } + } else if (en[1].equals("unitsPerEm")) { + String[] pn = new String[] { null, "head" }; + if (isParent(pn)) { + String value = attrs.getValue("value"); + int v = -1; + if (value == null) { + missingRequiredAttribute(en, "value"); + } else { + v = Integer.parseInt(value); + } + assert upem == -1; + upem = v; + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("xMax")) { + String[] pn = new String[] { null, "head" }; + if (isParent(pn)) { + String value = attrs.getValue("value"); + if (value == null) { + missingRequiredAttribute(en, "value"); + } + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("xMin")) { + String[] pn = new String[] { null, "head" }; + if (isParent(pn)) { + String value = attrs.getValue("value"); + if (value == null) { + missingRequiredAttribute(en, "value"); + } + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("yMax")) { + String[] pn = new String[] { null, "head" }; + if (isParent(pn)) { + String value = attrs.getValue("value"); + if (value == null) { + missingRequiredAttribute(en, "value"); + } + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else if (en[1].equals("yMin")) { + String[] pn = new String[] { null, "head" }; + if (isParent(pn)) { + String value = attrs.getValue("value"); + if (value == null) { + missingRequiredAttribute(en, "value"); + } + } else { + notPermittedInElementContext(en, getParent(), pn); + } + } else { + unsupportedElement(en); + } + elements.push(en); + } + @Override + public void endElement(String uri, String localName, String qName) throws SAXException { + if (elements.empty()) { + throw new SAXException("element stack is unbalanced, no elements on stack!"); + } + String[] enParent = elements.peek(); + if (enParent == null) { + throw new SAXException("element stack is empty, elements are not balanced"); + } + String[] en = makeExpandedName(uri, localName, qName); + if (!sameExpandedName(enParent, en)) { + throw new SAXException("element stack is unbalanced, expanded name mismatch"); + } + if (en[0] != null) { + unsupportedElement(en); + } else if (isAnchorElement(en[1])) { + if (xCoord == Integer.MIN_VALUE) { + missingParameter(en, "x coordinate"); + } else if (yCoord == Integer.MIN_VALUE) { + missingParameter(en, "y coordinate"); + } else { + if (en[1].equals("EntryAnchor")) { + if (anchors.size() > 0) { + duplicateParameter(en, "entry anchor"); + } + } else if (en[1].equals("ExitAnchor")) { + if (anchors.size() > 1) { + duplicateParameter(en, "exit anchor"); + } else if (anchors.size() == 0) { + anchors.add(null); + } + } + anchors.add(new GlyphPositioningTable.Anchor(xCoord, yCoord)); + xCoord = yCoord = Integer.MIN_VALUE; + } + } else if (en[1].equals("AlternateSet")) { + subtableEntries.add(extractAlternates()); + } else if (en[1].equals("AlternateSubst")) { + if (!sortEntries(coverageEntries, subtableEntries)) { + mismatchedEntries(en, coverageEntries.size(), subtableEntries.size()); + } + addGSUBSubtable(GlyphSubstitutionTable.GSUB_LOOKUP_TYPE_ALTERNATE, extractCoverage()); + } else if (en[1].equals("BacktrackCoverage")) { + String ck = makeCoverageKey("bk", ctIndex); + if (coverages.containsKey(ck)) { + duplicateCoverageIndex(en, ctIndex); + } else { + coverages.put(ck, extractCoverage()); + } + } else if (en[1].equals("BaseCoverage")) { + coverages.put("base", extractCoverage()); + } else if (en[1].equals("BaseRecord")) { + baseOrMarkAnchors.add(extractAnchors()); + } else if (en[1].equals("ChainContextPos") || en[1].equals("ChainContextSubst")) { + GlyphCoverageTable coverage = null; + if (stFormat == 3) { + GlyphCoverageTable[] igca = getCoveragesWithPrefix("in"); + GlyphCoverageTable[] bgca = getCoveragesWithPrefix("bk"); + GlyphCoverageTable[] lgca = getCoveragesWithPrefix("la"); + if ((igca.length == 0) || hasMissingCoverage(igca)) { + missingCoverage(en, "input", igca.length); + } else if (hasMissingCoverage(bgca)) { + missingCoverage(en, "backtrack", bgca.length); + } else if (hasMissingCoverage(lgca)) { + missingCoverage(en, "lookahead", lgca.length); + } else { + GlyphTable.Rule r = new GlyphTable.ChainedCoverageSequenceRule(extractRuleLookups(), igca.length, igca, bgca, lgca); + GlyphTable.RuleSet rs = new GlyphTable.HomogeneousRuleSet(new GlyphTable.Rule[] {r}); + GlyphTable.RuleSet[] rsa = new GlyphTable.RuleSet[] {rs}; + coverage = igca [ 0 ]; + subtableEntries.add(rsa); + } + } else { + unsupportedFormat(en, stFormat); + } + if (en[1].equals("ChainContextPos")) { + addGPOSSubtable(GlyphPositioningTable.GPOS_LOOKUP_TYPE_CHAINED_CONTEXTUAL, coverage); + } else if (en[1].equals("ChainContextSubst")) { + addGSUBSubtable(GlyphSubstitutionTable.GSUB_LOOKUP_TYPE_CHAINED_CONTEXTUAL, coverage); + } + } else if (en[1].equals("ComponentRecord")) { + components.add(extractAnchors()); + } else if (en[1].equals("Coverage")) { + coverages.put("main", extractCoverage()); + } else if (en[1].equals("DefaultLangSys") || en[1].equals("LangSysRecord")) { + if (languageTag == null) { + missingTag(en, "language"); + } else if (languages.containsKey(languageTag)) { + duplicateTag(en, "language", languageTag); + } else { + languages.put(languageTag, extractLanguageFeatures()); + languageTag = null; + } + } else if (en[1].equals("CursivePos")) { + GlyphCoverageTable ct = coverages.get("main"); + if (ct == null) { + missingParameter(en, "coverages"); + } else if (stFormat == 1) { + subtableEntries.add(extractAttachmentAnchors()); + } else { + unsupportedFormat(en, stFormat); + } + addGPOSSubtable(GlyphPositioningTable.GPOS_LOOKUP_TYPE_CURSIVE, ct); + } else if (en[1].equals("EntryExitRecord")) { + int na = anchors.size(); + if (na == 0) { + missingParameter(en, "entry or exit anchor"); + } else if (na == 1) { + anchors.add(null); + } else if (na > 2) { + duplicateParameter(en, "entry or exit anchor"); + } + attachmentAnchors.add(extractAnchors()); + } else if (en[1].equals("BaseRecord")) { + baseOrMarkAnchors.add(extractAnchors()); + } else if (en[1].equals("FeatureRecord")) { + if (flIndex != flSequence) { + mismatchedIndex(en, "feature", flIndex, flSequence); + } else if (featureTag == null) { + missingTag(en, "feature"); + } else { + String fid = makeFeatureId(flIndex); + features.put(fid, extractFeature()); + nextFeature(); + } + } else if (en[1].equals("GDEF")) { + if (subtables.size() > 0) { + gdef = new GlyphDefinitionTable(subtables); + } + clearTable(); + } else if (en[1].equals("GPOS")) { + if (subtables.size() > 0) { + gpos = new GlyphPositioningTable(gdef, extractLookups(), subtables); + } + clearTable(); + } else if (en[1].equals("GSUB")) { + if (subtables.size() > 0) { + gsub = new GlyphSubstitutionTable(gdef, extractLookups(), subtables); + } + clearTable(); + } else if (en[1].equals("GlyphClassDef")) { + GlyphMappingTable mapping = extractClassDefMapping(glyphClasses, stFormat, true); + addGDEFSubtable(GlyphDefinitionTable.GDEF_LOOKUP_TYPE_GLYPH_CLASS, mapping); + } else if (en[1].equals("InputCoverage")) { + String ck = makeCoverageKey("in", ctIndex); + if (coverages.containsKey(ck)) { + duplicateCoverageIndex(en, ctIndex); + } else { + coverages.put(ck, extractCoverage()); + } + } else if (en[1].equals("LigatureAttach")) { + ligatureAnchors.add(extractComponents()); + } else if (en[1].equals("LigatureCoverage")) { + coverages.put("liga", extractCoverage()); + } else if (en[1].equals("LigatureSet")) { + subtableEntries.add(extractLigatures()); + } else if (en[1].equals("LigatureSubst")) { + if (!sortEntries(coverageEntries, subtableEntries)) { + mismatchedEntries(en, coverageEntries.size(), subtableEntries.size()); + } + GlyphCoverageTable coverage = extractCoverage(); + addGSUBSubtable(GlyphSubstitutionTable.GSUB_LOOKUP_TYPE_LIGATURE, coverage); + } else if (en[1].equals("LookAheadCoverage")) { + String ck = makeCoverageKey("la", ctIndex); + if (coverages.containsKey(ck)) { + duplicateCoverageIndex(en, ctIndex); + } else { + coverages.put(ck, extractCoverage()); + } + } else if (en[1].equals("Lookup")) { + if (ltIndex != ltSequence) { + mismatchedIndex(en, "lookup", ltIndex, ltSequence); + } else { + nextLookup(); + } + } else if (en[1].equals("MarkAttachClassDef")) { + GlyphMappingTable mapping = extractClassDefMapping(glyphClasses, stFormat, true); + addGDEFSubtable(GlyphDefinitionTable.GDEF_LOOKUP_TYPE_MARK_ATTACHMENT, mapping); + } else if (en[1].equals("MarkCoverage")) { + coverages.put("mark", extractCoverage()); + } else if (en[1].equals("Mark1Coverage")) { + coverages.put("mrk1", extractCoverage()); + } else if (en[1].equals("Mark2Coverage")) { + coverages.put("mrk2", extractCoverage()); + } else if (en[1].equals("MarkBasePos")) { + GlyphCoverageTable mct = coverages.get("mark"); + GlyphCoverageTable bct = coverages.get("base"); + if (mct == null) { + missingParameter(en, "mark coverages"); + } else if (bct == null) { + missingParameter(en, "base coverages"); + } else if (stFormat == 1) { + MarkAnchor[] maa = extractMarkAnchors(); + Anchor[][] bam = extractBaseOrMarkAnchors(); + subtableEntries.add(bct); + subtableEntries.add(computeClassCount(bam)); + subtableEntries.add(maa); + subtableEntries.add(bam); + } else { + unsupportedFormat(en, stFormat); + } + addGPOSSubtable(GlyphPositioningTable.GPOS_LOOKUP_TYPE_MARK_TO_BASE, mct); + } else if (en[1].equals("MarkLigPos")) { + GlyphCoverageTable mct = coverages.get("mark"); + GlyphCoverageTable lct = coverages.get("liga"); + if (mct == null) { + missingParameter(en, "mark coverages"); + } else if (lct == null) { + missingParameter(en, "ligature coverages"); + } else if (stFormat == 1) { + MarkAnchor[] maa = extractMarkAnchors(); + Anchor[][][] lam = extractLigatureAnchors(); + subtableEntries.add(lct); + subtableEntries.add(computeLigaturesClassCount(lam)); + subtableEntries.add(computeLigaturesComponentCount(lam)); + subtableEntries.add(maa); + subtableEntries.add(lam); + } else { + unsupportedFormat(en, stFormat); + } + addGPOSSubtable(GlyphPositioningTable.GPOS_LOOKUP_TYPE_MARK_TO_LIGATURE, mct); + } else if (en[1].equals("MarkMarkPos")) { + GlyphCoverageTable mct1 = coverages.get("mrk1"); + GlyphCoverageTable mct2 = coverages.get("mrk2"); + if (mct1 == null) { + missingParameter(en, "mark coverages 1"); + } else if (mct2 == null) { + missingParameter(en, "mark coverages 2"); + } else if (stFormat == 1) { + MarkAnchor[] maa = extractMarkAnchors(); + Anchor[][] mam = extractBaseOrMarkAnchors(); + subtableEntries.add(mct2); + subtableEntries.add(computeClassCount(mam)); + subtableEntries.add(maa); + subtableEntries.add(mam); + } else { + unsupportedFormat(en, stFormat); + } + addGPOSSubtable(GlyphPositioningTable.GPOS_LOOKUP_TYPE_MARK_TO_MARK, mct1); + } else if (en[1].equals("MarkRecord")) { + if (markClass == -1) { + missingParameter(en, "mark class"); + } else if (anchors.size() == 0) { + missingParameter(en, "mark anchor"); + } else if (anchors.size() > 1) { + duplicateParameter(en, "mark anchor"); + } else { + markAnchors.add(new GlyphPositioningTable.MarkAnchor(markClass, anchors.get(0))); + markClass = -1; + anchors.clear(); + } + } else if (en[1].equals("Mark2Record")) { + baseOrMarkAnchors.add(extractAnchors()); + } else if (en[1].equals("MultipleSubst")) { + GlyphCoverageTable coverage = coverages.get("main"); + addGSUBSubtable(GlyphSubstitutionTable.GSUB_LOOKUP_TYPE_MULTIPLE, coverage, extractSequenceEntries()); + } else if (en[1].equals("PairPos")) { + assertSubtableEntriesClear(); + if (stFormat == 1) { + if (pairSets.size() == 0) { + missingParameter(en, "pair set"); + } else { + subtableEntries.add(extractPairSets()); + } + } else if (stFormat == 2) { + unsupportedFormat(en, stFormat); + } + GlyphCoverageTable coverage = coverages.get("main"); + addGPOSSubtable(GlyphPositioningTable.GPOS_LOOKUP_TYPE_PAIR, coverage); + vf1 = vf2 = -1; + psIndex = -1; + } else if (en[1].equals("PairSet")) { + if (psIndex != pairSets.size()) { + invalidIndex(en, psIndex, pairSets.size()); + } else { + pairSets.add(extractPairs()); + } + } else if (en[1].equals("PairValueRecord")) { + if (g2 == -1) { + missingParameter(en, "second glyph"); + } else if ((v1 == null) && (v2 == null)) { + missingParameter(en, "first or second value"); + } else { + pairs.add(new PairValues(g2, v1, v2)); + clearPair(); + } + } else if (en[1].equals("PosLookupRecord") || en[1].equals("SubstLookupRecord")) { + if (rlSequence < 0) { + missingParameter(en, "sequence index"); + } else if (rlLookup < 0) { + missingParameter(en, "lookup index"); + } else { + ruleLookups.add(new GlyphTable.RuleLookup(rlSequence, rlLookup)); + rlSequence = rlLookup = -1; + } + } else if (en[1].equals("Script")) { + if (scriptTag == null) { + missingTag(en, "script"); + } else if (scripts.containsKey(scriptTag)) { + duplicateTag(en, "script", scriptTag); + } else { + scripts.put(scriptTag, extractLanguages()); + scriptTag = null; + } + } else if (en[1].equals("Sequence")) { + subtableEntries.add(extractSubstitutes()); + } else if (en[1].equals("SinglePos")) { + int nv = subtableEntries.size(); + if (stFormat == 1) { + if (nv < 0) { + missingParameter(en, "value"); + } else if (nv > 1) { + duplicateParameter(en, "value"); + } + } else if (stFormat == 2) { + GlyphPositioningTable.Value[] pva = (GlyphPositioningTable.Value[]) subtableEntries.toArray(new GlyphPositioningTable.Value [ nv ]); + subtableEntries.clear(); + subtableEntries.add(pva); + } + GlyphCoverageTable coverage = coverages.get("main"); + addGPOSSubtable(GlyphPositioningTable.GPOS_LOOKUP_TYPE_SINGLE, coverage); + vf1 = -1; + } else if (en[1].equals("SingleSubst")) { + if (!sortEntries(coverageEntries, subtableEntries)) { + mismatchedEntries(en, coverageEntries.size(), subtableEntries.size()); + } + GlyphCoverageTable coverage = extractCoverage(); + addGSUBSubtable(GlyphSubstitutionTable.GSUB_LOOKUP_TYPE_SINGLE, coverage); + } else if (en[1].equals("cmap")) { + cmap = getCMAP(); + gmap = getGMAP(); + cmapEntries.clear(); + } else if (en[1].equals("cmap_format_4")) { + cmPlatform = cmEncoding = cmLanguage = -1; + } else if (en[1].equals("hmtx")) { + hmtx = getHMTX(); + hmtxEntries.clear(); + } else if (en[1].equals("ttFont")) { + if (cmap == null) { + missingParameter(en, "cmap"); + } + if (hmtx == null) { + missingParameter(en, "hmtx"); + } + } + elements.pop(); + } + @Override + public void characters(char[] chars, int start, int length) { + } + private String[] getParent() { + if (!elements.empty()) { + return elements.peek(); + } else { + return new String[] { null, null }; + } + } + private boolean isParent(Object enx) { + if (enx instanceof String[][]) { + for (String[] en : (String[][]) enx) { + if (isParent(en)) { + return true; + } + } + return false; + } else if (enx instanceof String[]) { + String[] en = (String[]) enx; + if (!elements.empty()) { + String[] pn = elements.peek(); + return (pn != null) && sameExpandedName(en, pn); + } else { + return ((en[0] == null) && (en[1] == null)); + } + } else { + return false; + } + } + private boolean isAnchorElement(String ln) { + if (ln.equals("BaseAnchor")) { + return true; + } else if (ln.equals("EntryAnchor")) { + return true; + } else if (ln.equals("ExitAnchor")) { + return true; + } else if (ln.equals("LigatureAnchor")) { + return true; + } else if (ln.equals("MarkAnchor")) { + return true; + } else { + return ln.equals("Mark2Anchor"); + } + } + private Map<Integer, Integer> getCMAP() { + Map<Integer, Integer> cmap = new TreeMap(); + for (int[] cme : cmapEntries) { + Integer c = Integer.valueOf(cme[0]); + Integer g = Integer.valueOf(cme[1]); + cmap.put(c, g); + } + return cmap; + } + private Map<Integer, Integer> getGMAP() { + Map<Integer, Integer> gmap = new TreeMap(); + for (int[] cme : cmapEntries) { + Integer c = Integer.valueOf(cme[0]); + Integer g = Integer.valueOf(cme[1]); + gmap.put(g, c); + } + return gmap; + } + private int[][] getHMTX() { + int ne = hmtxEntries.size(); + int[][] hmtx = new int [ ne ] [ 2 ]; + for (int i = 0; i < ne; i++) { + int[] ea = hmtxEntries.get(i); + if (ea != null) { + hmtx [ i ] [ 0 ] = ea[0]; + hmtx [ i ] [ 1 ] = ea[1]; + } + } + return hmtx; + } + private GlyphClassTable extractClassDefMapping(Map<String, Integer> glyphClasses, int format, boolean clearSourceMap) { + GlyphClassTable ct; + if (format == 1) { + ct = extractClassDefMapping1(extractClassMappings(glyphClasses, clearSourceMap)); + } else if (format == 2) { + ct = extractClassDefMapping2(extractClassMappings(glyphClasses, clearSourceMap)); + } else { + ct = null; + } + return ct; + } + private GlyphClassTable extractClassDefMapping1(int[][] cma) { + List entries = new ArrayList<Integer>(); + int s = -1; + int l = -1; + Integer zero = Integer.valueOf(0); + for (int[] m : cma) { + int g = m[0]; + int c = m[1]; + if (s < 0) { + s = g; + l = g - 1; + entries.add(Integer.valueOf(s)); + } + while (g > (l + 1)) { + entries.add(zero); + l++; + } + assert l == (g - 1); + entries.add(Integer.valueOf(c)); + l = g; + } + return GlyphClassTable.createClassTable(entries); + } + private GlyphClassTable extractClassDefMapping2(int[][] cma) { + List entries = new ArrayList<Integer>(); + int s = -1; + int e = s; + int l = -1; + for (int[] m : cma) { + int g = m[0]; + int c = m[1]; + if (c != l) { + if (s >= 0) { + entries.add(new GlyphClassTable.MappingRange(s, e, l)); + } + s = e = g; + } else { + e = g; + } + l = c; + } + return GlyphClassTable.createClassTable(entries); + } + private int[][] extractClassMappings(Map<String, Integer> glyphClasses, boolean clearSourceMap) { + int nc = glyphClasses.size(); + int i = 0; + int[][] cma = new int [ nc ] [ 2 ]; + for (Map.Entry<String, Integer> e : glyphClasses.entrySet()) { + Integer gid = glyphIds.get(e.getKey()); + assert gid != null; + int[] m = cma [ i ]; + m [ 0 ] = (int) gid; + m [ 1 ] = (int) e.getValue(); + i++; + } + if (clearSourceMap) { + glyphClasses.clear(); + } + return sortClassMappings(cma); + } + private int[][] sortClassMappings(int[][] cma) { + Arrays.sort(cma, new Comparator<int[]>() { + public int compare(int[] m1, int[] m2) { + assert m1.length > 0; + assert m2.length > 0; + if (m1[0] < m2[0]) { + return -1; + } else if (m1[0] > m2[0]) { + return 1; + } else { + return 0; + } + } + } + ); + return cma; + } + // sort coverage entries and subtable entries together + private boolean sortEntries(List cel, List sel) { + assert cel != null; + assert sel != null; + if (cel.size() == sel.size()) { + int np = cel.size(); + Object[][] pa = new Object [ np ] [ 2 ]; + for (int i = 0; i < np; i++) { + pa [ i ] [ 0 ] = cel.get(i); + pa [ i ] [ 1 ] = sel.get(i); + } + Arrays.sort(pa, new Comparator<Object[]>() { + public int compare(Object[] p1, Object[] p2) { + assert p1.length == 2; + assert p2.length == 2; + int c1 = (Integer) p1[0]; + int c2 = (Integer) p2[0]; + if (c1 < c2) { + return -1; + } else if (c1 > c2) { + return 1; + } else { + return 0; + } + } + } + ); + cel.clear(); + sel.clear(); + for (int i = 0; i < np; i++) { + cel.add(pa [ i ] [ 0 ]); + sel.add(pa [ i ] [ 1 ]); + } + assert cel.size() == sel.size(); + return true; + } else { + return false; + } + } + private String makeCoverageKey(String prefix, int index) { + assert prefix != null; + assert prefix.length() == 2; + assert index < 100; + return prefix + CharUtilities.padLeft(Integer.toString(index, 10), 2, '0'); + } + private List extractCoverageEntries() { + List entries = new ArrayList<Integer>(coverageEntries); + clearCoverage(); + return entries; + } + private void clearCoverageEntries() { + coverageEntries.clear(); + ctFormat = -1; + ctIndex = -1; + } + private void assertCoverageEntriesClear() { + assert coverageEntries.size() == 0; + } + private GlyphCoverageTable extractCoverage() { + assert (ctFormat == 1) || (ctFormat == 2); + assert ctIndex >= 0; + GlyphCoverageTable coverage = GlyphCoverageTable.createCoverageTable(extractCoverageEntries()); + clearCoverage(); + return coverage; + } + private void clearCoverages() { + coverages.clear(); + } + private void assertCoverageClear() { + assert ctFormat == -1; + assert ctIndex == -1; + assertCoverageEntriesClear(); + } + private void clearCoverage() { + ctFormat = -1; + ctIndex = -1; + clearCoverageEntries(); + } + private void assertCoveragesClear() { + assert coverages.size() == 0; + } + private GlyphCoverageTable[] getCoveragesWithPrefix(String prefix) { + assert prefix != null; + int prefixLength = prefix.length(); + Set<String> keys = coverages.keySet(); + int mi = -1; // maximum coverage table index + for (String k : keys) { + if (k.startsWith(prefix)) { + int i = Integer.parseInt(k.substring(prefixLength)); + if (i > mi) { + mi = i; + } + } + } + GlyphCoverageTable[] gca = new GlyphCoverageTable [ mi + 1 ]; + for (String k : keys) { + if (k.startsWith(prefix)) { + int i = Integer.parseInt(k.substring(prefixLength)); + if (i >= 0) { + gca [ i ] = coverages.get(k); + } + } + } + return gca; + } + private boolean hasMissingCoverage(GlyphCoverageTable[] gca) { + assert gca != null; + int nc = 0; + for (int i = 0, n = gca.length; i < n; i++) { + if (gca [ i ] != null) { + nc++; + } + } + return nc != gca.length; + } + private String makeFeatureId(int fid) { + assert fid >= 0; + return "f" + fid; + } + private String makeLookupId(int lid) { + assert lid >= 0; + return "lu" + lid; + } + private void clearScripts() { + scripts.clear(); + } + private List<String> extractLanguageFeatures() { + List<String> lfl = new ArrayList<String>(languageFeatures); + clearLanguageFeatures(); + return lfl; + } + private void assertLanguageFeaturesClear() { + assert languageFeatures.size() == 0; + } + private void clearLanguageFeatures() { + languageFeatures.clear(); + } + private Map<String, List<String>> extractLanguages() { + Map<String, List<String>> lm = new HashMap(languages); + clearLanguages(); + return lm; + } + private void clearLanguages() { + languages.clear(); + } + private void assertFeatureLookupsClear() { + assert featureLookups.size() == 0; + } + private List extractFeatureLookups() { + List lookups = new ArrayList<String>(featureLookups); + clearFeatureLookups(); + return lookups; + } + private void clearFeatureLookups() { + featureLookups.clear(); + } + private void assertFeatureClear() { + assert flIndex == -1; + assert featureTag == null; + assertFeatureLookupsClear(); + } + private Object[] extractFeature() { + Object[] fa = new Object [ 2 ]; + fa[0] = featureTag; + fa[1] = extractFeatureLookups(); + clearFeature(); + return fa; + } + private void clearFeature() { + flIndex = -1; + featureTag = null; + clearFeatureLookups(); + } + private void nextFeature() { + flSequence++; + } + private void clearFeatures() { + features.clear(); + } + private void clearSubtableInLookup() { + stFormat = 0; + clearCoverages(); + } + private void clearSubtablesInLookup() { + clearSubtableInLookup(); + stSequence = 0; + } + private void clearSubtablesInTable() { + clearSubtablesInLookup(); + subtables.clear(); + } + private void nextSubtableInLookup() { + stSequence++; + clearSubtableInLookup(); + } + private void assertLookupClear() { + assert ltIndex == -1; + assert ltFlags == 0; + } + private void clearLookup() { + ltIndex = -1; + ltFlags = 0; + clearSubtablesInLookup(); + } + private Map<GlyphTable.LookupSpec, List<String>> extractLookups() { + Map<GlyphTable.LookupSpec, List<String>> lookups = new LinkedHashMap<GlyphTable.LookupSpec, List<String>>(); + for (String st : scripts.keySet()) { + Map<String, List<String>> lm = scripts.get(st); + if (lm != null) { + for (String lt : lm.keySet()) { + List<String> fids = lm.get(lt); + if (fids != null) { + for (String fid : fids) { + if (fid != null) { + Object[] fa = features.get(fid); + if (fa != null) { + assert fa.length == 2; + String ft = (String) fa[0]; + List<String> lids = (List<String>) fa[1]; + if ((lids != null) && (lids.size() > 0)) { + GlyphTable.LookupSpec ls = new GlyphTable.LookupSpec(st, lt, ft); + lookups.put(ls, lids); + } + } + } + } + } + } + } + } + clearScripts(); + clearLanguages(); + clearFeatures(); + return lookups; + } + private void clearLookups() { + clearLookup(); + clearSubtablesInTable(); + ltSequence = 0; + flSequence = 0; + } + private void nextLookup() { + ltSequence++; + clearLookup(); + } + private void clearTable() { + clearLookups(); + } + private void assertSubtableClear() { + assert stFormat == 0; + assertCoverageEntriesClear(); + } + private void assertSubtablesClear() { + assertSubtableClear(); + assert subtables.size() == 0; + } + private void clearSubtableEntries() { + subtableEntries.clear(); + } + private void assertSubtableEntriesClear() { + assert subtableEntries.size() == 0; + } + private List extractSubtableEntries() { + List entries = new ArrayList(subtableEntries); + clearSubtableEntries(); + return entries; + } + private int[] extractAlternates() { + int[] aa = new int [ alternates.size() ]; + int i = 0; + for (Integer a : alternates) { + aa[i++] = (int) a; + } + clearAlternates(); + return aa; + } + private void clearAlternates() { + alternates.clear(); + } + private LigatureSet extractLigatures() { + LigatureSet ls = new LigatureSet(ligatures); + clearLigatures(); + return ls; + } + private void clearLigatures() { + ligatures.clear(); + } + private int[] extractSubstitutes() { + int[] aa = new int [ substitutes.size() ]; + int i = 0; + for (Integer a : substitutes) { + aa[i++] = (int) a; + } + clearSubstitutes(); + return aa; + } + private void clearSubstitutes() { + substitutes.clear(); + } + private List extractSequenceEntries() { + List sequences = extractSubtableEntries(); + int[][] sa = new int [ sequences.size() ] []; + int i = 0; + for (Object s : sequences) { + if (s instanceof int[]) { + sa[i++] = (int[]) s; + } + } + List entries = new ArrayList(); + entries.add(sa); + return entries; + } + private RuleLookup[] extractRuleLookups() { + RuleLookup[] lookups = (RuleLookup[]) ruleLookups.toArray(new RuleLookup [ ruleLookups.size() ]); + clearRuleLookups(); + return lookups; + } + private void clearRuleLookups() { + ruleLookups.clear(); + } + private GlyphPositioningTable.Value parseValue(String[] en, Attributes attrs, int format) throws SAXException { + String xPlacement = attrs.getValue("XPlacement"); + int xp = 0; + if (xPlacement != null) { + xp = Integer.parseInt(xPlacement); + } else if ((format & GlyphPositioningTable.Value.X_PLACEMENT) != 0) { + missingParameter(en, "xPlacement"); + } + String yPlacement = attrs.getValue("YPlacement"); + int yp = 0; + if (yPlacement != null) { + yp = Integer.parseInt(yPlacement); + } else if ((format & GlyphPositioningTable.Value.Y_PLACEMENT) != 0) { + missingParameter(en, "yPlacement"); + } + String xAdvance = attrs.getValue("XAdvance"); + int xa = 0; + if (xAdvance != null) { + xa = Integer.parseInt(xAdvance); + } else if ((format & GlyphPositioningTable.Value.X_ADVANCE) != 0) { + missingParameter(en, "xAdvance"); + } + String yAdvance = attrs.getValue("YAdvance"); + int ya = 0; + if (yAdvance != null) { + ya = Integer.parseInt(yAdvance); + } else if ((format & GlyphPositioningTable.Value.Y_ADVANCE) != 0) { + missingParameter(en, "yAdvance"); + } + return new GlyphPositioningTable.Value(xp, yp, xa, ya, null, null, null, null); + } + private void assertPairClear() { + assert g2 == -1; + assert v1 == null; + assert v2 == null; + } + private void clearPair() { + g2 = -1; + v1 = null; + v2 = null; + } + private void assertPairsClear() { + assert pairs.size() == 0; + } + private void clearPairs() { + pairs.clear(); + psIndex = -1; + } + private PairValues[] extractPairs() { + PairValues[] pva = (PairValues[]) pairs.toArray(new PairValues [ pairs.size() ]); + clearPairs(); + return pva; + } + private void assertPairSetsClear() { + assert pairSets.size() == 0; + } + private void clearPairSets() { + pairSets.clear(); + } + private PairValues[][] extractPairSets() { + PairValues[][] pvm = (PairValues[][]) pairSets.toArray(new PairValues [ pairSets.size() ][]); + clearPairSets(); + return pvm; + } + private Anchor[] extractAnchors() { + Anchor[] aa = (Anchor[]) anchors.toArray(new Anchor [ anchors.size() ]); + anchors.clear(); + return aa; + } + private MarkAnchor[] extractMarkAnchors() { + MarkAnchor[] maa = new MarkAnchor [ markAnchors.size() ]; + maa = (MarkAnchor[]) markAnchors.toArray(new MarkAnchor [ maa.length ]); + markAnchors.clear(); + return maa; + } + private Anchor[][] extractBaseOrMarkAnchors() { + int na = baseOrMarkAnchors.size(); + int ncMax = 0; + for (Anchor[] aa : baseOrMarkAnchors) { + if (aa != null) { + int nc = aa.length; + if (nc > ncMax) { + ncMax = nc; + } + } + } + Anchor[][] am = new Anchor [ na ][ ncMax ]; + for (int i = 0; i < na; i++) { + Anchor[] aa = baseOrMarkAnchors.get(i); + if (aa != null) { + for (int j = 0; j < ncMax; j++) { + if (j < aa.length) { + am [ i ] [ j ] = aa [ j ]; + } + } + } + } + baseOrMarkAnchors.clear(); + return am; + } + private Integer computeClassCount(Anchor[][] am) { + int ncMax = 0; + for (int i = 0, n = am.length; i < n; i++) { + Anchor[] aa = am [ i ]; + if (aa != null) { + int nc = aa.length; + if (nc > ncMax) { + ncMax = nc; + } + } + } + return Integer.valueOf(ncMax); + } + private Anchor[][] extractComponents() { + Anchor[][] cam = new Anchor [ components.size() ][]; + cam = (Anchor[][]) components.toArray(new Anchor [ cam.length ][]); + components.clear(); + return cam; + } + private Anchor[][][] extractLigatureAnchors() { + int na = ligatureAnchors.size(); + int ncMax = 0; + int nxMax = 0; + for (Anchor[][] cm : ligatureAnchors) { + if (cm != null) { + int nx = cm.length; + if (nx > nxMax) { + nxMax = nx; + } + for (Anchor[] aa : cm) { + if (aa != null) { + int nc = aa.length; + if (nc > ncMax) { + ncMax = nc; + } + } + } + + } + } + Anchor[][][] lam = new Anchor [ na ] [ nxMax ] [ ncMax ]; + for (int i = 0; i < na; i++) { + Anchor[][] cm = ligatureAnchors.get(i); + if (cm != null) { + for (int j = 0; j < nxMax; j++) { + if (j < cm.length) { + Anchor[] aa = cm [ j ]; + if (aa != null) { + for (int k = 0; k < ncMax; k++) { + if (k < aa.length) { + lam [ i ] [ j ] [ k ] = aa [ k ]; + } + } + } + } + } + } + } + ligatureAnchors.clear(); + return lam; + } + private Integer computeLigaturesClassCount(Anchor[][][] lam) { + int ncMax = 0; + if (lam != null) { + for (Anchor[][] cm : lam) { + if (cm != null) { + for (Anchor[] aa : cm) { + if (aa != null) { + int nc = aa.length; + if (nc > ncMax) { + ncMax = nc; + } + } + } + } + } + } + return Integer.valueOf(ncMax); + } + private Integer computeLigaturesComponentCount(Anchor[][][] lam) { + int nxMax = 0; + if (lam != null) { + for (Anchor[][] cm : lam) { + if (cm != null) { + int nx = cm.length; + if (nx > nxMax) { + nxMax = nx; + } + } + } + } + return Integer.valueOf(nxMax); + } + private Anchor[] extractAttachmentAnchors() { + int na = attachmentAnchors.size(); + Anchor[] aa = new Anchor [ na * 2 ]; + for (int i = 0; i < na; i++) { + Anchor[] ea = attachmentAnchors.get(i); + int ne = ea.length; + if (ne > 0) { + aa [ (i * 2) + 0 ] = ea[0]; + } + if (ne > 1) { + aa [ (i * 2) + 1 ] = ea[1]; + } + } + attachmentAnchors.clear(); + return aa; + } + private void addGDEFSubtable(int stType, GlyphMappingTable mapping) { + subtables.add(GlyphDefinitionTable.createSubtable(stType, makeLookupId(ltSequence), stSequence, ltFlags, stFormat, mapping, extractSubtableEntries())); + nextSubtableInLookup(); + } + private void addGSUBSubtable(int stType, GlyphCoverageTable coverage, List entries) { + subtables.add(GlyphSubstitutionTable.createSubtable(stType, makeLookupId(ltSequence), stSequence, ltFlags, stFormat, coverage, entries)); + nextSubtableInLookup(); + } + private void addGSUBSubtable(int stType, GlyphCoverageTable coverage) { + addGSUBSubtable(stType, coverage, extractSubtableEntries()); + } + private void addGPOSSubtable(int stType, GlyphCoverageTable coverage, List entries) { + subtables.add(GlyphPositioningTable.createSubtable(stType, makeLookupId(ltSequence), stSequence, ltFlags, stFormat, coverage, entries)); + nextSubtableInLookup(); + } + private void addGPOSSubtable(int stType, GlyphCoverageTable coverage) { + addGPOSSubtable(stType, coverage, extractSubtableEntries()); + } + } + private int mapGlyphId0(String glyph) { + assert glyphIds != null; + Integer gid = glyphIds.get(glyph); + if (gid != null) { + return (int) gid; + } else { + return -1; + } + } + private int mapGlyphId(String glyph, String[] currentElement) throws SAXException { + int g = mapGlyphId0(glyph); + if (g < 0) { + unsupportedGlyph(currentElement, glyph); + return -1; + } else { + return g; + } + } + private int[] mapGlyphIds(String glyphs, String[] currentElement) throws SAXException { + String[] ga = glyphs.split(","); + int[] gids = new int [ ga.length ]; + int i = 0; + for (String glyph : ga) { + gids[i++] = mapGlyphId(glyph, currentElement); + } + return gids; + } + private int mapGlyphIdToChar(String glyph) { + assert glyphIds != null; + Integer gid = glyphIds.get(glyph); + if (gid != null) { + if (gmap != null) { + Integer cid = gmap.get(gid); + if (cid != null) { + return cid.intValue(); + } + } + } + return -1; + } + private String formatLocator() { + if (locator == null) { + return "{null}"; + } else { + return "{" + locator.getSystemId() + ":" + locator.getLineNumber() + ":" + locator.getColumnNumber() + "}"; + } + } + private void unsupportedElement(String[] en) throws SAXException { + throw new SAXException(formatLocator() + ": unsupported element " + formatExpandedName(en)); + } + private void notPermittedInElementContext(String[] en, String[] cn, Object xns) throws SAXException { + assert en != null; + assert cn != null; + String s = "element " + formatExpandedName(en) + " not permitted in current element context " + formatExpandedName(cn); + if (xns == null) { + s += ", expected root context"; + } else if (xns instanceof String[][]) { + int nxn = 0; + s += ", expected one of { "; + for (String[] xn : (String[][]) xns) { + if (nxn++ > 0) { + s += ", "; + } + s += formatExpandedName(xn); + } + s += " }"; + } else if (xns instanceof String[]) { + s += ", expected " + formatExpandedName((String[]) xns); + } + throw new SAXException(formatLocator() + ": " + s); + } + private void missingRequiredAttribute(String[] en, String name) throws SAXException { + throw new SAXException(formatLocator() + ": element " + formatExpandedName(en) + " missing required attribute " + name); + } + private void duplicateGlyph(String[] en, String name, int gid) throws SAXException { + throw new SAXException(formatLocator() + ": element " + formatExpandedName(en) + " contains duplicate name \"" + name + "\", with identifier value " + gid); + } + private void unsupportedGlyph(String[] en, String name) throws SAXException { + throw new SAXException(formatLocator() + ": element " + formatExpandedName(en) + " refers to unsupported glyph id \"" + name + "\""); + } + private void duplicateCMAPCharacter(String[] en, int cid) throws SAXException { + throw new SAXException(formatLocator() + ": element " + formatExpandedName(en) + " contains duplicate cmap character code: " + CharUtilities.format(cid)); + } + private void duplicateCMAPGlyph(String[] en, int gid) throws SAXException { + throw new SAXException(formatLocator() + ": element " + formatExpandedName(en) + " contains duplicate cmap glyph code: " + gid); + } + private void duplicateGlyphClass(String[] en, String name, String glyphClass) throws SAXException { + throw new SAXException(formatLocator() + ": element " + formatExpandedName(en) + " contains duplicate glyph class for \"" + name + "\", with class value " + glyphClass); + } + private void unsupportedFormat(String[] en, int format) throws SAXException { + throw new SAXException(formatLocator() + ": element " + formatExpandedName(en) + " refers to unsupported table format \"" + format + "\""); + } + private void invalidIndex(String[] en, int actual, int expected) throws SAXException { + throw new SAXException(formatLocator() + ": element " + formatExpandedName(en) + " specifies invalid index " + actual + ", expected " + expected); + } + private void mismatchedIndex(String[] en, String label, int actual, int expected) throws SAXException { + throw new SAXException(formatLocator() + ": element " + formatExpandedName(en) + " mismatched " + label + " index: got " + actual + ", expected " + expected); + } + private void mismatchedEntries(String[] en, int nce, int nse) throws SAXException { + throw new SAXException(formatLocator() + ": element " + formatExpandedName(en) + " mismatched coverage and subtable entry counts, # coverages " + nce + ", # entries " + nse); + } + private void missingParameter(String[] en, String label) throws SAXException { + throw new SAXException(formatLocator() + ": element " + formatExpandedName(en) + " missing " + label + " parameter"); + } + private void duplicateParameter(String[] en, String label) throws SAXException { + throw new SAXException(formatLocator() + ": element " + formatExpandedName(en) + " duplicate " + label + " parameter"); + } + private void duplicateCoverageIndex(String[] en, int index) throws SAXException { + throw new SAXException(formatLocator() + ": element " + formatExpandedName(en) + " duplicate coverage table index " + index); + } + private void missingCoverage(String[] en, String type, int expected) throws SAXException { + throw new SAXException(formatLocator() + ": element " + formatExpandedName(en) + " missing " + type + " coverage table, expected " + ((expected > 0) ? expected : 1) + " table(s)"); + } + private void missingTag(String[] en, String label) throws SAXException { + throw new SAXException(formatLocator() + ": element " + formatExpandedName(en) + " missing " + label + " tag"); + } + private void duplicateTag(String[] en, String label, String tag) throws SAXException { + throw new SAXException(formatLocator() + ": element " + formatExpandedName(en) + " duplicate " + label + " tag: " + tag); + } + private static String[] makeExpandedName(String uri, String localName, String qName) { + if ((uri != null) && (uri.length() == 0)) { + uri = null; + } + if ((localName != null) && (localName.length() == 0)) { + localName = null; + } + if ((uri == null) && (localName == null)) { + uri = extractPrefix(qName); + localName = extractLocalName(qName); + } + return new String[] { uri, localName }; + } + private static String extractPrefix(String qName) { + String[] sa = qName.split(":"); + if (sa.length == 2) { + return sa[0]; + } else { + return null; + } + } + private static String extractLocalName(String qName) { + String[] sa = qName.split(":"); + if (sa.length == 2) { + return sa[1]; + } else if (sa.length == 1) { + return sa[0]; + } else { + return null; + } + } + private static boolean sameExpandedName(String[] n1, String[] n2) { + String u1 = n1[0]; + String u2 = n2[0]; + if ((u1 == null) ^ (u2 == null)) { + return false; + } + if ((u1 != null) && (u2 != null)) { + if (!u1.equals(u2)) { + return false; + } + } + String l1 = n1[1]; + String l2 = n2[1]; + if ((l1 == null) ^ (l2 == null)) { + return false; + } + if ((l1 != null) && (l2 != null)) { + if (!l1.equals(l2)) { + return false; + } + } + return true; + } + private static String formatExpandedName(String[] n) { + String u = (n[0] != null) ? n[0] : "null"; + String l = (n[1] != null) ? n[1] : "null"; + return "{" + u + "}" + l; + } +} diff --git a/src/test/java/org/apache/fop/complexscripts/fonts/ttx/TTXFileTestCase.java b/src/test/java/org/apache/fop/complexscripts/fonts/ttx/TTXFileTestCase.java new file mode 100644 index 000000000..f4b7d34e8 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/fonts/ttx/TTXFileTestCase.java @@ -0,0 +1,52 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.complexscripts.fonts.ttx; + +import java.io.File; + +import org.junit.Test; + +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +public class TTXFileTestCase { + + private static String ttxFilesRoot = "test/resources/complexscripts"; + + private static String[] ttxFiles = { + "arab/ttx/arab-001.ttx", + "arab/ttx/arab-002.ttx", + "arab/ttx/arab-003.ttx", + "arab/ttx/arab-004.ttx", + }; + + @Test + public void testTTXFiles() throws Exception { + for (String tfn : ttxFiles) { + try { + TTXFile tf = TTXFile.getFromCache(ttxFilesRoot + File.separator + tfn); + assertTrue(tf != null); + } catch (Exception e) { + fail(e.getMessage()); + } + } + } + +} diff --git a/src/test/java/org/apache/fop/complexscripts/layout/ComplexScriptsLayoutTestCase.java b/src/test/java/org/apache/fop/complexscripts/layout/ComplexScriptsLayoutTestCase.java new file mode 100644 index 000000000..416cbf8d0 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/layout/ComplexScriptsLayoutTestCase.java @@ -0,0 +1,387 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.complexscripts.layout; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.Source; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMResult; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.sax.SAXResult; +import javax.xml.transform.sax.TransformerHandler; + +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.ContentHandler; +import org.xml.sax.SAXException; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import org.apache.commons.io.FileUtils; +import org.apache.commons.io.filefilter.AndFileFilter; +import org.apache.commons.io.filefilter.IOFileFilter; +import org.apache.commons.io.filefilter.NameFileFilter; +import org.apache.commons.io.filefilter.PrefixFileFilter; +import org.apache.commons.io.filefilter.SuffixFileFilter; +import org.apache.commons.io.filefilter.TrueFileFilter; + +import org.apache.fop.DebugHelper; +import org.apache.fop.apps.EnvironmentProfile; +import org.apache.fop.apps.EnvironmentalProfileFactory; +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.apps.Fop; +import org.apache.fop.apps.FopConfBuilder; +import org.apache.fop.apps.FopConfParser; +import org.apache.fop.apps.FopFactory; +import org.apache.fop.apps.FopFactoryBuilder; +import org.apache.fop.apps.FormattingResults; +import org.apache.fop.apps.MimeConstants; +import org.apache.fop.apps.PDFRendererConfBuilder; +import org.apache.fop.apps.io.ResourceResolverFactory; +import org.apache.fop.area.AreaTreeModel; +import org.apache.fop.area.AreaTreeParser; +import org.apache.fop.area.RenderPagesModel; +import org.apache.fop.events.Event; +import org.apache.fop.events.EventListener; +import org.apache.fop.events.model.EventSeverity; +import org.apache.fop.fonts.FontInfo; +import org.apache.fop.intermediate.IFTester; +import org.apache.fop.intermediate.TestAssistant; +import org.apache.fop.layoutengine.ElementListCollector; +import org.apache.fop.layoutengine.LayoutEngineCheck; +import org.apache.fop.layoutengine.LayoutEngineChecksFactory; +import org.apache.fop.layoutengine.LayoutResult; +import org.apache.fop.layoutengine.TestFilesConfiguration; +import org.apache.fop.layoutmgr.ElementListObserver; +import org.apache.fop.render.Renderer; +import org.apache.fop.render.intermediate.IFContext; +import org.apache.fop.render.intermediate.IFRenderer; +import org.apache.fop.render.intermediate.IFSerializer; +import org.apache.fop.render.xml.XMLRenderer; +import org.apache.fop.util.ConsoleEventListenerForTests; +import org.apache.fop.util.DelegatingContentHandler; + +// CSOFF: LineLengthCheck + +/** + * Test complex script layout (end-to-end) functionality. + */ +@RunWith(Parameterized.class) +public class ComplexScriptsLayoutTestCase { + + private static final boolean DEBUG = false; + private static final String AREA_TREE_OUTPUT_DIRECTORY = "build/test-results/complexscripts"; + private static File areaTreeOutputDir; + + private TestAssistant testAssistant = new TestAssistant(); + private LayoutEngineChecksFactory layoutEngineChecksFactory = new LayoutEngineChecksFactory(); + private TestFilesConfiguration testConfig; + private File testFile; + private IFTester ifTester; + private TransformerFactory tfactory = TransformerFactory.newInstance(); + + public ComplexScriptsLayoutTestCase(TestFilesConfiguration testConfig, File testFile) { + this.testConfig = testConfig; + this.testFile = testFile; + this.ifTester = new IFTester(tfactory, areaTreeOutputDir); + } + + @Parameters + public static Collection<Object[]> getParameters() throws IOException { + return getTestFiles(); + } + + @BeforeClass + public static void makeDirAndRegisterDebugHelper() throws IOException { + DebugHelper.registerStandardElementListObservers(); + areaTreeOutputDir = new File(AREA_TREE_OUTPUT_DIRECTORY); + if (!areaTreeOutputDir.mkdirs() && !areaTreeOutputDir.exists()) { + throw new IOException("Failed to create the AT output directory at " + AREA_TREE_OUTPUT_DIRECTORY); + } + } + + @Test + public void runTest() throws TransformerException, SAXException, IOException, ParserConfigurationException { + DOMResult domres = new DOMResult(); + ElementListCollector elCollector = new ElementListCollector(); + ElementListObserver.addObserver(elCollector); + Fop fop; + FopFactory effFactory; + EventsChecker eventsChecker = new EventsChecker(new ConsoleEventListenerForTests(testFile.getName(), EventSeverity.WARN)); + try { + Document testDoc = testAssistant.loadTestCase(testFile); + effFactory = getFopFactory(testConfig, testDoc); + // Setup Transformer to convert the testcase XML to XSL-FO + Transformer transformer = testAssistant.getTestcase2FOStylesheet().newTransformer(); + Source src = new DOMSource(testDoc); + // Setup Transformer to convert the area tree to a DOM + TransformerHandler athandler; + athandler = testAssistant.getTransformerFactory().newTransformerHandler(); + athandler.setResult(domres); + // Setup FOP for area tree rendering + FOUserAgent ua = effFactory.newFOUserAgent(); + ua.getEventBroadcaster().addEventListener(eventsChecker); + XMLRenderer atrenderer = new XMLRenderer(ua); + Renderer targetRenderer = ua.getRendererFactory().createRenderer(ua, MimeConstants.MIME_PDF); + atrenderer.mimicRenderer(targetRenderer); + atrenderer.setContentHandler(athandler); + ua.setRendererOverride(atrenderer); + fop = effFactory.newFop(ua); + SAXResult fores = new SAXResult(fop.getDefaultHandler()); + transformer.transform(src, fores); + } finally { + ElementListObserver.removeObserver(elCollector); + } + Document doc = (Document)domres.getNode(); + if (areaTreeOutputDir != null) { + testAssistant.saveDOM(doc, new File(areaTreeOutputDir, testFile.getName() + ".at.xml")); + } + FormattingResults results = fop.getResults(); + LayoutResult result = new LayoutResult(doc, elCollector, results); + checkAll(effFactory, testFile, result, eventsChecker); + } + + private FopFactory getFopFactory(TestFilesConfiguration testConfig, Document testDoc) throws SAXException, IOException { + EnvironmentProfile profile = EnvironmentalProfileFactory.createRestrictedIO( + testConfig.getTestDirectory().getParentFile().toURI(), + ResourceResolverFactory.createDefaultResourceResolver()); + InputStream confStream = + new FopConfBuilder().setStrictValidation(true) + .setFontBaseURI("test/resources/fonts/ttf/") + .startRendererConfig(PDFRendererConfBuilder.class) + .startFontsConfig() + .startFont(null, "DejaVuLGCSerif.ttf") + .addTriplet("DejaVu LGC Serif", "normal", "normal") + .endFont() + .endFontConfig() + .endRendererConfig().build(); + FopFactoryBuilder builder = + new FopConfParser(confStream, new File(".").toURI(), profile).getFopFactoryBuilder(); + // builder.setStrictFOValidation(isStrictValidation(testDoc)); + // builder.getFontManager().setBase14KerningEnabled(isBase14KerningEnabled(testDoc)); + return builder.build(); + } + + private void checkAll(FopFactory fopFactory, File testFile, LayoutResult result, EventsChecker eventsChecker) throws TransformerException { + Element testRoot = testAssistant.getTestRoot(testFile); + NodeList nodes; + nodes = testRoot.getElementsByTagName("at-checks"); + if (nodes.getLength() > 0) { + Element atChecks = (Element)nodes.item(0); + doATChecks(atChecks, result); + } + nodes = testRoot.getElementsByTagName("if-checks"); + if (nodes.getLength() > 0) { + Element ifChecks = (Element)nodes.item(0); + Document ifDocument = createIF(fopFactory, testFile, result.getAreaTree()); + ifTester.doIFChecks(testFile.getName(), ifChecks, ifDocument); + } + nodes = testRoot.getElementsByTagName("event-checks"); + if (nodes.getLength() > 0) { + Element eventChecks = (Element) nodes.item(0); + doEventChecks(eventChecks, eventsChecker); + } + eventsChecker.emitUncheckedEvents(); + } + + private Document createIF(FopFactory fopFactory, File testFile, Document areaTreeXML) throws TransformerException { + try { + FOUserAgent ua = fopFactory.newFOUserAgent(); + ua.getEventBroadcaster().addEventListener(new ConsoleEventListenerForTests(testFile.getName(), EventSeverity.WARN)); + IFRenderer ifRenderer = new IFRenderer(ua); + IFSerializer serializer = new IFSerializer(new IFContext(ua)); + DOMResult result = new DOMResult(); + serializer.setResult(result); + ifRenderer.setDocumentHandler(serializer); + ua.setRendererOverride(ifRenderer); + FontInfo fontInfo = new FontInfo(); + //Construct the AreaTreeModel that will received the individual pages + final AreaTreeModel treeModel = new RenderPagesModel(ua, null, fontInfo, null); + //Iterate over all intermediate files + AreaTreeParser parser = new AreaTreeParser(); + ContentHandler handler = parser.getContentHandler(treeModel, ua); + DelegatingContentHandler proxy = new DelegatingContentHandler() { + public void endDocument() throws SAXException { + super.endDocument(); + treeModel.endDocument(); + } + }; + proxy.setDelegateContentHandler(handler); + Transformer transformer = tfactory.newTransformer(); + transformer.transform(new DOMSource(areaTreeXML), new SAXResult(proxy)); + return (Document)result.getNode(); + } catch (Exception e) { + throw new TransformerException("Error while generating intermediate format file: " + e.getMessage(), e); + } + } + + private void doATChecks(Element checksRoot, LayoutResult result) { + List<LayoutEngineCheck> checks = layoutEngineChecksFactory.createCheckList(checksRoot); + if (checks.size() == 0) { + throw new RuntimeException("No available area tree check"); + } + for (LayoutEngineCheck check : checks) { + check.check(result); + } + } + + private void doEventChecks(Element eventChecks, EventsChecker eventsChecker) { + NodeList events = eventChecks.getElementsByTagName("event"); + for (int i = 0; i < events.getLength(); i++) { + Element event = (Element) events.item(i); + NamedNodeMap attributes = event.getAttributes(); + Map<String, String> params = new HashMap<String, String>(); + String key = null; + for (int j = 0; j < attributes.getLength(); j++) { + Node attribute = attributes.item(j); + String name = attribute.getNodeName(); + String value = attribute.getNodeValue(); + if ("key".equals(name)) { + key = value; + } else { + params.put(name, value); + } + } + if (key == null) { + throw new RuntimeException("An event element must have a \"key\" attribute"); + } + eventsChecker.checkEvent(key, params); + } + } + + private static Collection<Object[]> getTestFiles(TestFilesConfiguration testConfig) { + File mainDir = testConfig.getTestDirectory(); + IOFileFilter filter; + String single = testConfig.getSingleTest(); + String startsWith = testConfig.getStartsWith(); + if (single != null) { + filter = new NameFileFilter(single); + } else if (startsWith != null) { + filter = new PrefixFileFilter(startsWith); + filter = new AndFileFilter(filter, new SuffixFileFilter(testConfig.getFileSuffix())); + } else { + filter = new SuffixFileFilter(testConfig.getFileSuffix()); + } + String testset = testConfig.getTestSet(); + Collection<File> files = FileUtils.listFiles(new File(mainDir, testset), filter, TrueFileFilter.INSTANCE); + if (testConfig.hasPrivateTests()) { + Collection<File> privateFiles = + FileUtils.listFiles(new File(mainDir, "private-testcases"), filter, TrueFileFilter.INSTANCE); + files.addAll(privateFiles); + } + Collection<Object[]> parametersForJUnit4 = new ArrayList<Object[]>(); + int index = 0; + for (File f : files) { + parametersForJUnit4.add(new Object[] { testConfig, f }); + if (DEBUG) { + System.out.println(String.format("%3d %s", index++, f)); + } + } + return parametersForJUnit4; + } + + private static Collection<Object[]> getTestFiles() { + String testSet = System.getProperty("fop.complexscripts.testset"); + testSet = (testSet != null ? testSet : "standard") + "-testcases"; + return getTestFiles(testSet); + } + + private static Collection<Object[]> getTestFiles(String testSetName) { + TestFilesConfiguration.Builder builder = new TestFilesConfiguration.Builder(); + builder.testDir("test/resources/complexscripts/layout") + .singleProperty("fop.complexscripts.single") + .startsWithProperty("fop.complexscripts.starts-with") + .suffix(".xml") + .testSet(testSetName) + .privateTestsProperty("fop.complexscripts.private"); + return getTestFiles(builder.build()); + } + + private static class EventsChecker implements EventListener { + + private final List<Event> events = new ArrayList<Event>(); + private final EventListener defaultListener; + + public EventsChecker(EventListener fallbackListener) { + this.defaultListener = fallbackListener; + } + + public void processEvent(Event event) { + events.add(event); + } + + public void checkEvent(String expectedKey, Map<String, String> expectedParams) { + boolean eventFound = false; + for (Iterator<Event> iter = events.iterator(); !eventFound && iter.hasNext();) { + Event event = iter.next(); + if (event.getEventKey().equals(expectedKey)) { + eventFound = true; + iter.remove(); + checkParameters(event, expectedParams); + } + } + if (!eventFound) { + fail("Event did not occur but was expected to: " + expectedKey + expectedParams); + } + } + + private void checkParameters(Event event, Map<String, String> expectedParams) { + Map<String, Object> actualParams = event.getParams(); + for (Map.Entry<String, String> expectedParam : expectedParams.entrySet()) { + assertTrue("Event \"" + event.getEventKey() + + "\" is missing parameter \"" + expectedParam.getKey() + '"', + actualParams.containsKey(expectedParam.getKey())); + assertEquals("Event \"" + event.getEventKey() + + "\" has wrong value for parameter \"" + expectedParam.getKey() + "\";", + actualParams.get(expectedParam.getKey()).toString(), + expectedParam.getValue()); + } + } + + public void emitUncheckedEvents() { + for (Event event : events) { + defaultListener.processEvent(event); + } + } + } + +} diff --git a/src/test/java/org/apache/fop/complexscripts/layout/ComplexScriptsLayoutTestSuite.java b/src/test/java/org/apache/fop/complexscripts/layout/ComplexScriptsLayoutTestSuite.java new file mode 100644 index 000000000..e55ead635 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/layout/ComplexScriptsLayoutTestSuite.java @@ -0,0 +1,32 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.complexscripts.layout; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +/** + * Test suite for running complex script layout tests under JUnit control. + */ +@RunWith(Suite.class) +@SuiteClasses(ComplexScriptsLayoutTestCase.class) +public class ComplexScriptsLayoutTestSuite { +} diff --git a/src/test/java/org/apache/fop/complexscripts/scripts/ScriptsTestSuite.java b/src/test/java/org/apache/fop/complexscripts/scripts/ScriptsTestSuite.java new file mode 100644 index 000000000..27914450a --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/scripts/ScriptsTestSuite.java @@ -0,0 +1,38 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.complexscripts.scripts; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +import org.apache.fop.complexscripts.scripts.arabic.ArabicJoinersTestCase; +import org.apache.fop.complexscripts.scripts.arabic.ArabicWordFormsTestCase; + +/** + * Test suite for script specific functionality related to complex scripts. + */ +@RunWith(Suite.class) +@SuiteClasses({ + ArabicJoinersTestCase.class, + ArabicWordFormsTestCase.class +}) +public class ScriptsTestSuite { +} diff --git a/src/test/java/org/apache/fop/complexscripts/scripts/arabic/ArabicJoinersTestCase.java b/src/test/java/org/apache/fop/complexscripts/scripts/arabic/ArabicJoinersTestCase.java new file mode 100644 index 000000000..092bebd41 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/scripts/arabic/ArabicJoinersTestCase.java @@ -0,0 +1,138 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.complexscripts.scripts.arabic; + +import java.nio.IntBuffer; +import java.util.BitSet; + +import org.junit.Test; + +import static org.junit.Assert.assertTrue; + +import org.apache.fop.complexscripts.scripts.ScriptProcessor; +import org.apache.fop.complexscripts.util.CharScript; +import org.apache.fop.complexscripts.util.GlyphContextTester; +import org.apache.fop.complexscripts.util.GlyphSequence; +import org.apache.fop.complexscripts.util.ScriptContextTester; +import org.apache.fop.complexscripts.util.UTF32; + +// CSOFF: LineLength + +/** + * Tests for joiner (ZWJ, ZWNJ) functionality related to the arabic script. + */ +public class ArabicJoinersTestCase { + + private static final String[][] ZWJ_TESTS_ISOL = new String[][] { + { "\u0643", "1", }, + { "\u0643\u200D", "00", }, + { "\u200D\u0643", "00", }, + { "\u200D\u0643\u200D", "000", }, + }; + + private static final String[][] ZWJ_TESTS_INIT = new String[][] { + { "\u0643", "0", }, + { "\u0643\u200D", "10", }, + { "\u200D\u0643", "00", }, + { "\u200D\u0643\u200D", "000", }, + }; + + private static final String[][] ZWJ_TESTS_MEDI = new String[][] { + { "\u0643", "0", }, + { "\u0643\u200D", "00", }, + { "\u200D\u0643", "00", }, + { "\u200D\u0643\u200D", "010", }, + }; + + private static final String[][] ZWJ_TESTS_FINA = new String[][] { + { "\u0643", "0", }, + { "\u0643\u200D", "00", }, + { "\u200D\u0643", "01", }, + { "\u200D\u0643\u200D", "000", }, + }; + + private static final String[][] ZWJ_TESTS_LIGA = new String[][] { + }; + + @Test + public void testArabicJoiners() { + String script = CharScript.scriptTagFromCode(CharScript.SCRIPT_ARABIC); + ScriptProcessor sp = ScriptProcessor.getInstance(script); + assertTrue(sp != null); + ScriptContextTester sct = sp.getSubstitutionContextTester(); + assertTrue(sct != null); + String language = "dflt"; + int flags = 0; + testZWJ(sct, script, language, "isol", flags, ZWJ_TESTS_ISOL); + testZWJ(sct, script, language, "init", flags, ZWJ_TESTS_INIT); + testZWJ(sct, script, language, "medi", flags, ZWJ_TESTS_MEDI); + testZWJ(sct, script, language, "fina", flags, ZWJ_TESTS_FINA); + testZWJ(sct, script, language, "liga", flags, ZWJ_TESTS_LIGA); + } + + private void testZWJ(ScriptContextTester sct, String script, String language, String feature, int flags, String[][] tests) { + GlyphContextTester gct = sct.getTester(feature); + assertTrue(gct != null); + for (String[] t : tests) { + testZWJ(gct, script, language, feature, flags, t); + } + } + + private void testZWJ(GlyphContextTester gct, String script, String language, String feature, int flags, String[] test) { + assert test.length == 2; + String str = test[0]; + BitSet act = new BitSet(); + GlyphSequence gs = makeGlyphSequence(str); + for (int i = 0, n = str.length(); i < n; ++i) { + if (gct.test(script, language, feature, gs, i, flags)) { + act.set(i); + } + } + BitSet exp = parseBitSet(test[1]); + assertTrue(act.equals(exp)); + } + + private GlyphSequence makeGlyphSequence(String s) { + Integer[] ca = UTF32.toUTF32(s, 0, true); + IntBuffer cb = IntBuffer.allocate(ca.length); + for (Integer c : ca) { + cb.put(c); + } + cb.rewind(); + return new GlyphSequence(cb, null, null); + } + + private BitSet parseBitSet(String s) { + BitSet bits = new BitSet(); + for (int i = 0, n = s.length(); i < n; ++i) { + char c = s.charAt(i); + assert (c == '0') || (c == '1'); + if (c == '1') { + bits.set(i); + } + } + return bits; + } + + @Test + public void testArabicNonJoiners() { + } + +} diff --git a/src/test/java/org/apache/fop/complexscripts/scripts/arabic/ArabicWordFormsConstants.java b/src/test/java/org/apache/fop/complexscripts/scripts/arabic/ArabicWordFormsConstants.java new file mode 100644 index 000000000..41094b687 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/scripts/arabic/ArabicWordFormsConstants.java @@ -0,0 +1,49 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.complexscripts.scripts.arabic; + +/** + * Constants for test functionality related to the arabic script. + */ +public interface ArabicWordFormsConstants { + + String WF_FILE_SCRIPT = "arab"; + String WF_FILE_LANGUAGE = "dflt"; + + String SRC_FILES_DIR = "test/resources/complexscripts/arab/data"; + String DAT_FILES_DIR = "test/resources/complexscripts/arab/data"; + + String[] SRC_FILES = { + "arab-001", // unpointed word forms + }; + + String WF_FILE_SRC_EXT = "txt"; + String WF_FILE_DAT_EXT = "ser"; + + String TTX_FONTS_DIR = "test/resources/complexscripts/arab/ttx"; + + String[] TTX_FONTS = { + "arab-001.ttx", // simplified arabic + "arab-002.ttx", // traditional arabic + "arab-003.ttx", // lateef + "arab-004.ttx", // scheherazade + }; + +} diff --git a/src/test/java/org/apache/fop/complexscripts/scripts/arabic/ArabicWordFormsTestCase.java b/src/test/java/org/apache/fop/complexscripts/scripts/arabic/ArabicWordFormsTestCase.java new file mode 100644 index 000000000..abe4f513a --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/scripts/arabic/ArabicWordFormsTestCase.java @@ -0,0 +1,191 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.complexscripts.scripts.arabic; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FilenameFilter; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.nio.IntBuffer; +import java.util.List; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import org.apache.fop.complexscripts.fonts.GlyphPositioningTable; +import org.apache.fop.complexscripts.fonts.GlyphSubstitutionTable; +import org.apache.fop.complexscripts.fonts.ttx.TTXFile; +import org.apache.fop.complexscripts.util.GlyphSequence; + +// CSOFF: LineLength + +/** + * Tests for functionality related to the arabic script. + */ +public class ArabicWordFormsTestCase implements ArabicWordFormsConstants { + + @Test + public void testArabicWordForms() { + for (String sfn : SRC_FILES) { + try { + processWordForms(new File(DAT_FILES_DIR)); + } catch (Exception e) { + fail(e.getMessage()); + } + } + } + + private void processWordForms(File dfd) { + String[] files = listWordFormFiles(dfd); + for (String fn : files) { + File dff = new File(dfd, fn); + processWordForms(dff.getAbsolutePath()); + } + } + + private String[] listWordFormFiles(File dfd) { + return dfd.list(new FilenameFilter() { + public boolean accept(File f, String name) { + return hasPrefixFrom(name, SRC_FILES) && hasExtension(name, WF_FILE_DAT_EXT); + } + private boolean hasPrefixFrom(String name, String[] prefixes) { + for (String p : prefixes) { + if (name.startsWith(p)) { + return true; + } + } + return false; + } + private boolean hasExtension(String name, String extension) { + return name.endsWith("." + extension); + } + }); + } + + private void processWordForms(String dpn) { + FileInputStream fis = null; + try { + fis = new FileInputStream(dpn); + if (fis != null) { + ObjectInputStream ois = new ObjectInputStream(fis); + List<Object[]> data = (List<Object[]>) ois.readObject(); + if (data != null) { + processWordForms(data); + } + ois.close(); + } + } catch (FileNotFoundException e) { + throw new RuntimeException(e.getMessage(), e); + } catch (IOException e) { + throw new RuntimeException(e.getMessage(), e); + } catch (Exception e) { + throw new RuntimeException(e.getMessage(), e); + } finally { + if (fis != null) { + try { fis.close(); } catch (Exception e) { /* NOP */ } + } + } + } + + private void processWordForms(List<Object[]> data) { + assert data != null; + assert data.size() > 0; + String script = null; + String language = null; + String tfn = null; + TTXFile tf = null; + GlyphSubstitutionTable gsub = null; + GlyphPositioningTable gpos = null; + int[] widths = null; + for (Object[] d : data) { + if (script == null) { + assert d.length >= 4; + script = (String) d[0]; + language = (String) d[1]; + tfn = (String) d[3]; + tf = TTXFile.getFromCache(TTX_FONTS_DIR + File.separator + tfn); + assertTrue(tf != null); + gsub = tf.getGSUB(); + assertTrue(gsub != null); + gpos = tf.getGPOS(); + assertTrue(gpos != null); + widths = tf.getWidths(); + assertTrue(widths != null); + } else { + assert tf != null; + assert gsub != null; + assert gpos != null; + assert tfn != null; + assert d.length >= 4; + String wf = (String) d[0]; + int[] iga = (int[]) d[1]; + int[] oga = (int[]) d[2]; + int[][] paa = (int[][]) d[3]; + GlyphSequence tigs = tf.mapCharsToGlyphs(wf); + assertSameGlyphs(iga, getGlyphs(tigs), "input glyphs", wf, tfn); + GlyphSequence togs = gsub.substitute(tigs, script, language); + assertSameGlyphs(oga, getGlyphs(togs), "output glyphs", wf, tfn); + int[][] tpaa = new int [ togs.getGlyphCount() ] [ 4 ]; + if (gpos.position(togs, script, language, 1000, widths, tpaa)) { + assertSameAdjustments(paa, tpaa, wf, tfn); + } else if (paa != null) { + assertEquals("unequal adjustment count, word form(" + wf + "), font (" + tfn + ")", paa.length, 0); + } + } + } + } + + private void assertSameGlyphs(int[] expected, int[] actual, String label, String wf, String tfn) { + assertEquals(label + ": unequal glyph count, word form(" + wf + "), font (" + tfn + ")", expected.length, actual.length); + for (int i = 0, n = expected.length; i < n; i++) { + int e = expected[i]; + int a = actual[i]; + assertEquals(label + ": unequal glyphs[" + i + "], word form(" + wf + "), font (" + tfn + ")", e, a); + } + } + + private void assertSameAdjustments(int[][] expected, int[][] actual, String wf, String tfn) { + assertEquals("unequal adjustment count, word form(" + wf + "), font (" + tfn + ")", expected.length, actual.length); + for (int i = 0, n = expected.length; i < n; i++) { + int[] ea = expected[i]; + int[] aa = actual[i]; + assertEquals("bad adjustments length, word form(" + wf + "), font (" + tfn + ")", ea.length, aa.length); + for (int k = 0; k < 4; k++) { + int e = ea[k]; + int a = aa[k]; + assertEquals("unequal adjustment[" + i + "][" + k + "], word form(" + wf + "), font (" + tfn + ")", e, a); + } + } + } + + private static int[] getGlyphs(GlyphSequence gs) { + IntBuffer gb = gs.getGlyphs(); + int[] ga = new int [ gb.limit() ]; + gb.rewind(); + gb.get(ga); + return ga; + } + +} diff --git a/src/test/java/org/apache/fop/complexscripts/scripts/arabic/GenerateArabicTestData.java b/src/test/java/org/apache/fop/complexscripts/scripts/arabic/GenerateArabicTestData.java new file mode 100644 index 000000000..35bfb3128 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/scripts/arabic/GenerateArabicTestData.java @@ -0,0 +1,182 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.complexscripts.scripts.arabic; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.LineNumberReader; +import java.io.ObjectOutputStream; +import java.nio.IntBuffer; +import java.nio.charset.Charset; +import java.util.ArrayList; +import java.util.List; + +import org.apache.fop.complexscripts.fonts.GlyphPositioningTable; +import org.apache.fop.complexscripts.fonts.GlyphSubstitutionTable; +import org.apache.fop.complexscripts.fonts.ttx.TTXFile; +import org.apache.fop.complexscripts.util.GlyphSequence; + +/** + * Tests for functionality related to the arabic script. + */ +public final class GenerateArabicTestData implements ArabicWordFormsConstants { + + private GenerateArabicTestData() { + } + + public static void main(String[] args) { + boolean compile = false; + boolean help = false; + for (String a : args) { + if (a.equals("-c")) { + compile = true; + } + if (a.equals("-?")) { + help = true; + } + } + if (help) { + help(); + } else if (compile) { + compile(); + } + } + + private static void help() { + StringBuffer sb = new StringBuffer(); + sb.append("org.apache.fop.complexscripts.arabic.ArabicTestCase"); + sb.append(" [-compile]"); + sb.append(" [-?]"); + System.out.println(sb.toString()); + } + + private static void compile() { + for (String sfn : SRC_FILES) { + try { + String spn = SRC_FILES_DIR + File.separator + sfn + "." + WF_FILE_SRC_EXT; + compile(WF_FILE_SCRIPT, WF_FILE_LANGUAGE, spn); + } catch (Exception e) { + System.err.println(e.getMessage()); + } + } + } + + private static void compile(String script, String language, String spn) { + int fno = 0; + for (String tfn : TTX_FONTS) { + TTXFile tf = TTXFile.getFromCache(TTX_FONTS_DIR + File.separator + tfn); + assert tf != null; + List data = compile(script, language, spn, tfn, tf); + output(makeDataPathName(spn, fno++), data); + } + } + + private static List compile(String script, String language, String spn, String tfn, TTXFile tf) { + List<Object[]> data = new ArrayList<Object[]>(); + data.add(new Object[] { script, language, spn, tfn }); + GlyphSubstitutionTable gsub = tf.getGSUB(); + GlyphPositioningTable gpos = tf.getGPOS(); + int[] widths = tf.getWidths(); + if ((gsub != null) && (gpos != null)) { + FileInputStream fis = null; + try { + fis = new FileInputStream(spn); + if (fis != null) { + LineNumberReader lr = new LineNumberReader(new InputStreamReader(fis, Charset.forName("UTF-8"))); + String wf; + while ((wf = lr.readLine()) != null) { + GlyphSequence igs = tf.mapCharsToGlyphs(wf); + GlyphSequence ogs = gsub.substitute(igs, script, language); + int[][] paa = new int [ ogs.getGlyphCount() ] [ 4 ]; + if (!gpos.position(ogs, script, language, 1000, widths, paa)) { + paa = null; + } + data.add(new Object[] { wf, getGlyphs(igs), getGlyphs(ogs), paa }); + } + lr.close(); + } + } catch (FileNotFoundException e) { + throw new RuntimeException(e.getMessage(), e); + } catch (IOException e) { + throw new RuntimeException(e.getMessage(), e); + } catch (Exception e) { + throw new RuntimeException(e.getMessage(), e); + } finally { + if (fis != null) { + try { fis.close(); } catch (Exception e) { /* NOP */ } + } + } + } else { + assert gsub != null; + assert gpos != null; + } + System.err.println("compiled " + (data.size() - 1) + " word forms using font " + tfn); + return data; + } + + private static int[] getGlyphs(GlyphSequence gs) { + IntBuffer gb = gs.getGlyphs(); + int[] ga = new int [ gb.limit() ]; + gb.rewind(); + gb.get(ga); + return ga; + } + + private static String makeDataPathName(String spn, int fno) { + File f = new File(spn); + return DAT_FILES_DIR + File.separator + stripExtension(f.getName()) + "-f" + fno + "." + WF_FILE_DAT_EXT; + } + + private static String stripExtension(String s) { + int i = s.lastIndexOf('.'); + if (i >= 0) { + return s.substring(0, i); + } else { + return s; + } + } + + private static void output(String dpn, List<Object[]> data) { + FileOutputStream fos = null; + try { + fos = new FileOutputStream(dpn); + if (fos != null) { + ObjectOutputStream oos = new ObjectOutputStream(fos); + oos.writeObject(data); + oos.close(); + } + } catch (FileNotFoundException e) { + throw new RuntimeException(e.getMessage(), e); + } catch (IOException e) { + throw new RuntimeException(e.getMessage(), e); + } catch (Exception e) { + throw new RuntimeException(e.getMessage(), e); + } finally { + if (fos != null) { + try { fos.close(); } catch (Exception e) { /* NOP */ } + } + } + } + +} diff --git a/src/test/java/org/apache/fop/complexscripts/util/NumberConverterTestCase.java b/src/test/java/org/apache/fop/complexscripts/util/NumberConverterTestCase.java new file mode 100644 index 000000000..4e1db5fb3 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/util/NumberConverterTestCase.java @@ -0,0 +1,1562 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.complexscripts.util; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +// CSOFF: LineLengthCheck + +/** + * Test number converter functionality. + */ +public class NumberConverterTestCase { + + private static String[][] formatDecimal = + { + { "1" }, + { "0", "0" }, + { "1", "1" }, + { "1000", "1000" }, + { "1000000", "1000000" }, + { "1000000000", "1000000000" }, + }; + + private static String[][] formatDecimalPadded = + { + { "001" }, + { "0", "000" }, + { "1", "001" }, + { "9", "009" }, + { "10", "010" }, + { "99", "099" }, + { "100", "100" }, + { "999", "999" }, + { "1000", "1000" }, + }; + + private static String[][] formatDecimalGrouped = + { + { "1", ",", "1" }, + { "0", "0" }, + { "1", "1" }, + { "1000", "1,0,0,0" }, + { "1000000", "1,0,0,0,0,0,0" }, + { "1000000000", "1,0,0,0,0,0,0,0,0,0" }, + }; + + private static String[][] formatDecimalGroupedPadded = + { + { "001", ",", "2" }, + { "0", "0,00" }, + { "1", "0,01" }, + { "9", "0,09" }, + { "10", "0,10" }, + { "99", "0,99" }, + { "100", "1,00" }, + { "999", "9,99" }, + { "1000", "10,00" }, + }; + + private static String[][] formatDecimalArabic = + { + { "\u0661" }, + { "0", "\u0660" }, + { "1", "\u0661" }, + { "2", "\u0662" }, + { "3", "\u0663" }, + { "4", "\u0664" }, + { "5", "\u0665" }, + { "6", "\u0666" }, + { "7", "\u0667" }, + { "8", "\u0668" }, + { "9", "\u0669" }, + { "10", "\u0661\u0660" }, + { "1000", "\u0661\u0660\u0660\u0660" }, + { "1000000", "\u0661\u0660\u0660\u0660\u0660\u0660\u0660" }, + { "1000000000", "\u0661\u0660\u0660\u0660\u0660\u0660\u0660\u0660\u0660\u0660" }, + }; + + private static String[][] formatDecimalArabicPadded = + { + { "\u0660\u0660\u0661" }, + { "0", "\u0660\u0660\u0660" }, + { "1", "\u0660\u0660\u0661" }, + { "9", "\u0660\u0660\u0669" }, + { "10", "\u0660\u0661\u0660" }, + { "99", "\u0660\u0669\u0669" }, + { "100", "\u0661\u0660\u0660" }, + { "999", "\u0669\u0669\u0669" }, + { "1000", "\u0661\u0660\u0660\u0660" }, + }; + + private static String[][] formatDecimalArabicGrouped = + { + { "\u0661", "\u066c", "1" }, + { "0", "\u0660" }, + { "1", "\u0661" }, + { "1000", "\u0661\u066c\u0660\u066c\u0660\u066c\u0660" }, + { "1000000", "\u0661\u066c\u0660\u066c\u0660\u066c\u0660\u066c\u0660\u066c\u0660\u066c\u0660" }, + { "1000000000", "\u0661\u066c\u0660\u066c\u0660\u066c\u0660\u066c\u0660\u066c\u0660\u066c\u0660\u066c\u0660\u066c\u0660\u066c\u0660" }, + }; + + private static String[][] formatDecimalArabicGroupedPadded = + { + { "\u0660\u0660\u0661", "\u066c", "2" }, + { "0", "\u0660\u066c\u0660\u0660" }, + { "1", "\u0660\u066c\u0660\u0661" }, + { "9", "\u0660\u066c\u0660\u0669" }, + { "10", "\u0660\u066c\u0661\u0660" }, + { "99", "\u0660\u066c\u0669\u0669" }, + { "100", "\u0661\u066c\u0660\u0660" }, + { "999", "\u0669\u066c\u0669\u0669" }, + { "1000", "\u0661\u0660\u066c\u0660\u0660" }, + }; + + private static String[][] formatDecimalThai = + { + { "\u0E51" }, + { "0", "\u0E50" }, + { "1", "\u0E51" }, + { "2", "\u0E52" }, + { "3", "\u0E53" }, + { "4", "\u0E54" }, + { "5", "\u0E55" }, + { "6", "\u0E56" }, + { "7", "\u0E57" }, + { "8", "\u0E58" }, + { "9", "\u0E59" }, + { "10", "\u0E51\u0E50" }, + { "1000", "\u0E51\u0E50\u0E50\u0E50" }, + { "1000000", "\u0E51\u0E50\u0E50\u0E50\u0E50\u0E50\u0E50" }, + { "1000000000", "\u0E51\u0E50\u0E50\u0E50\u0E50\u0E50\u0E50\u0E50\u0E50\u0E50" }, + }; + + private static String[][] formatDecimalThaiPadded = + { + { "\u0E50\u0E50\u0E51" }, + { "0", "\u0E50\u0E50\u0E50" }, + { "1", "\u0E50\u0E50\u0E51" }, + { "9", "\u0E50\u0E50\u0E59" }, + { "10", "\u0E50\u0E51\u0E50" }, + { "99", "\u0E50\u0E59\u0E59" }, + { "100", "\u0E51\u0E50\u0E50" }, + { "999", "\u0E59\u0E59\u0E59" }, + { "1000", "\u0E51\u0E50\u0E50\u0E50" }, + }; + + private static String[][] formatRomanLower = + { + { "i" }, + { "0", "0" }, + { "1", "i" }, + { "2", "ii" }, + { "3", "iii" }, + { "4", "iv" }, + { "5", "v" }, + { "6", "vi" }, + { "7", "vii" }, + { "8", "viii" }, + { "9", "ix" }, + { "10", "x" }, + { "20", "xx" }, + { "30", "xxx" }, + { "40", "xl" }, + { "50", "l" }, + { "60", "lx" }, + { "70", "lxx" }, + { "80", "lxxx" }, + { "90", "xc" }, + { "100", "c" }, + { "200", "cc" }, + { "300", "ccc" }, + { "400", "cd" }, + { "500", "d" }, + { "600", "dc" }, + { "700", "dcc" }, + { "800", "dccc" }, + { "900", "cm" }, + { "1000", "m" }, + { "2000", "mm" }, + { "2011", "mmxi" }, + { "4999", "mmmmcmxcix" }, + { "5000", "5000" }, + }; + + private static String[][] formatRomanUpper = + { + + { "I" }, + { "0", "0" }, + { "1", "I" }, + { "2", "II" }, + { "3", "III" }, + { "4", "IV" }, + { "5", "V" }, + { "6", "VI" }, + { "7", "VII" }, + { "8", "VIII" }, + { "9", "IX" }, + { "10", "X" }, + { "20", "XX" }, + { "30", "XXX" }, + { "40", "XL" }, + { "50", "L" }, + { "60", "LX" }, + { "70", "LXX" }, + { "80", "LXXX" }, + { "90", "XC" }, + { "100", "C" }, + { "200", "CC" }, + { "300", "CCC" }, + { "400", "CD" }, + { "500", "D" }, + { "600", "DC" }, + { "700", "DCC" }, + { "800", "DCCC" }, + { "900", "CM" }, + { "1000", "M" }, + { "2000", "MM" }, + { "2011", "MMXI" }, + { "4999", "MMMMCMXCIX" }, + { "5000", "5000" }, + }; + + private static String[][] formatRomanLargeLower = + { + { "i", null, null, null, "large" }, + { "0", "0" }, + { "1", "i" }, + { "2", "ii" }, + { "3", "iii" }, + { "4", "iv" }, + { "5", "v" }, + { "6", "vi" }, + { "7", "vii" }, + { "8", "viii" }, + { "9", "ix" }, + { "10", "x" }, + { "20", "xx" }, + { "30", "xxx" }, + { "40", "xl" }, + { "50", "l" }, + { "60", "lx" }, + { "70", "lxx" }, + { "80", "lxxx" }, + { "90", "xc" }, + { "100", "c" }, + { "200", "cc" }, + { "300", "ccc" }, + { "400", "cd" }, + { "500", "d" }, + { "600", "dc" }, + { "700", "dcc" }, + { "800", "dccc" }, + { "900", "cm" }, + { "1000", "m" }, + { "2000", "mm" }, + { "2011", "mmxi" }, + { "4999", "\u2180\u2181cmxcix" }, + { "5000", "\u2181" }, + { "5001", "\u2181i" }, + { "9999", "\u2180\u2182cmxcix" }, + { "10000", "\u2182" }, + { "10001", "\u2182i" }, + { "49999", "\u2182\u2187\u2180\u2182cmxcix" }, + { "99999", "\u2182\u2188\u2180\u2182cmxcix" }, + { "100000", "\u2188" }, + { "100001", "\u2188i" }, + { "199999", "\u2188\u2182\u2188\u2180\u2182cmxcix" }, + { "200000", "200000" }, + }; + + private static String[][] formatRomanLargeUpper = + { + { "I", null, null, null, "large" }, + { "0", "0" }, + { "1", "I" }, + { "2", "II" }, + { "3", "III" }, + { "4", "IV" }, + { "5", "V" }, + { "6", "VI" }, + { "7", "VII" }, + { "8", "VIII" }, + { "9", "IX" }, + { "10", "X" }, + { "20", "XX" }, + { "30", "XXX" }, + { "40", "XL" }, + { "50", "L" }, + { "60", "LX" }, + { "70", "LXX" }, + { "80", "LXXX" }, + { "90", "XC" }, + { "100", "C" }, + { "200", "CC" }, + { "300", "CCC" }, + { "400", "CD" }, + { "500", "D" }, + { "600", "DC" }, + { "700", "DCC" }, + { "800", "DCCC" }, + { "900", "CM" }, + { "1000", "M" }, + { "2000", "MM" }, + { "2011", "MMXI" }, + { "4999", "\u2180\u2181CMXCIX" }, + { "5000", "\u2181" }, + { "5001", "\u2181I" }, + { "9999", "\u2180\u2182CMXCIX" }, + { "10000", "\u2182" }, + { "10001", "\u2182I" }, + { "49999", "\u2182\u2187\u2180\u2182CMXCIX" }, + { "99999", "\u2182\u2188\u2180\u2182CMXCIX" }, + { "100000", "\u2188" }, + { "100001", "\u2188I" }, + { "199999", "\u2188\u2182\u2188\u2180\u2182CMXCIX" }, + { "200000", "200000" }, + }; + + private static String[][] formatRomanNumberFormsLower = + { + { "i", null, null, null, "unicode-number-forms" }, + { "0", "0" }, + { "1", "\u2170" }, + { "2", "\u2171" }, + { "3", "\u2172" }, + { "4", "\u2173" }, + { "5", "\u2174" }, + { "6", "\u2175" }, + { "7", "\u2176" }, + { "8", "\u2177" }, + { "9", "\u2178" }, + { "10", "\u2179" }, + { "11", "\u2179\u2170" }, + { "12", "\u2179\u2171" }, + { "13", "\u2179\u2172" }, + { "14", "\u2179\u2173" }, + { "15", "\u2179\u2174" }, + { "16", "\u2179\u2175" }, + { "17", "\u2179\u2176" }, + { "18", "\u2179\u2177" }, + { "19", "\u2179\u2178" }, + { "20", "\u2179\u2179" }, + { "30", "\u2179\u2179\u2179" }, + { "40", "\u2179\u217C" }, + { "50", "\u217C" }, + { "60", "\u217C\u2179" }, + { "70", "\u217C\u2179\u2179" }, + { "80", "\u217C\u2179\u2179\u2179" }, + { "90", "\u2179\u217D" }, + { "100", "\u217D" }, + { "200", "\u217D\u217D" }, + { "300", "\u217D\u217D\u217D" }, + { "400", "\u217D\u217E" }, + { "500", "\u217E" }, + { "600", "\u217E\u217D" }, + { "700", "\u217E\u217D\u217D" }, + { "800", "\u217E\u217D\u217D\u217D" }, + { "900", "\u217D\u217F" }, + { "999", "\u217D\u217F\u2179\u217D\u2178" }, + { "1000", "\u217F" }, + { "2000", "\u217F\u217F" }, + { "2011", "\u217F\u217F\u2179\u2170" }, + { "4999", "\u2180\u2181\u217D\u217F\u2179\u217D\u2178" }, + { "5000", "\u2181" }, + { "5001", "\u2181\u2170" }, + { "9999", "\u2180\u2182\u217D\u217F\u2179\u217D\u2178" }, + { "10000", "\u2182" }, + { "10001", "\u2182\u2170" }, + { "49999", "\u2182\u2187\u2180\u2182\u217D\u217F\u2179\u217D\u2178" }, + { "99999", "\u2182\u2188\u2180\u2182\u217D\u217F\u2179\u217D\u2178" }, + { "100000", "\u2188" }, + { "100001", "\u2188\u2170" }, + { "199999", "\u2188\u2182\u2188\u2180\u2182\u217D\u217F\u2179\u217D\u2178" }, + { "200000", "200000" }, + }; + + private static String[][] formatRomanNumberFormsUpper = + { + { "I", null, null, null, "unicode-number-forms" }, + { "0", "0" }, + { "1", "\u2160" }, + { "2", "\u2161" }, + { "3", "\u2162" }, + { "4", "\u2163" }, + { "5", "\u2164" }, + { "6", "\u2165" }, + { "7", "\u2166" }, + { "8", "\u2167" }, + { "9", "\u2168" }, + { "10", "\u2169" }, + { "11", "\u2169\u2160" }, + { "12", "\u2169\u2161" }, + { "13", "\u2169\u2162" }, + { "14", "\u2169\u2163" }, + { "15", "\u2169\u2164" }, + { "16", "\u2169\u2165" }, + { "17", "\u2169\u2166" }, + { "18", "\u2169\u2167" }, + { "19", "\u2169\u2168" }, + { "20", "\u2169\u2169" }, + { "30", "\u2169\u2169\u2169" }, + { "40", "\u2169\u216C" }, + { "50", "\u216C" }, + { "60", "\u216C\u2169" }, + { "70", "\u216C\u2169\u2169" }, + { "80", "\u216C\u2169\u2169\u2169" }, + { "90", "\u2169\u216D" }, + { "100", "\u216D" }, + { "200", "\u216D\u216D" }, + { "300", "\u216D\u216D\u216D" }, + { "400", "\u216D\u216E" }, + { "500", "\u216E" }, + { "600", "\u216E\u216D" }, + { "700", "\u216E\u216D\u216D" }, + { "800", "\u216E\u216D\u216D\u216D" }, + { "900", "\u216D\u216F" }, + { "999", "\u216D\u216F\u2169\u216D\u2168" }, + { "1000", "\u216F" }, + { "2000", "\u216F\u216F" }, + { "2011", "\u216F\u216F\u2169\u2160" }, + { "4999", "\u2180\u2181\u216D\u216F\u2169\u216D\u2168" }, + { "5000", "\u2181" }, + { "5001", "\u2181\u2160" }, + { "9999", "\u2180\u2182\u216D\u216F\u2169\u216D\u2168" }, + { "10000", "\u2182" }, + { "10001", "\u2182\u2160" }, + { "49999", "\u2182\u2187\u2180\u2182\u216D\u216F\u2169\u216D\u2168" }, + { "99999", "\u2182\u2188\u2180\u2182\u216D\u216F\u2169\u216D\u2168" }, + { "100000", "\u2188" }, + { "100001", "\u2188\u2160" }, + { "199999", "\u2188\u2182\u2188\u2180\u2182\u216D\u216F\u2169\u216D\u2168" }, + { "200000", "200000" }, + }; + + private static String[][] formatAlphabeticLatinLower = + { + { "a" }, + { "0", "0" }, + { "1", "a" }, + { "2", "b" }, + { "3", "c" }, + { "10", "j" }, + { "20", "t" }, + { "26", "z" }, + { "27", "aa" }, + { "28", "ab" }, + { "29", "ac" }, + { "52", "az" }, + { "53", "ba" }, + { "702", "zz" }, + { "703", "aaa" }, + { "999999", "bdwgm" }, + { "1000000", "bdwgn" }, + }; + + private static String[][] formatAlphabeticLatinUpper = + { + { "A" }, + { "0", "0" }, + { "1", "A" }, + { "2", "B" }, + { "3", "C" }, + { "10", "J" }, + { "20", "T" }, + { "26", "Z" }, + { "27", "AA" }, + { "28", "AB" }, + { "29", "AC" }, + { "52", "AZ" }, + { "53", "BA" }, + { "702", "ZZ" }, + { "703", "AAA" }, + { "999999", "BDWGM" }, + { "1000000", "BDWGN" }, + }; + + private static String[][] formatAlphabeticArabicHijai = + { + { "\u0627", null, null, "alphabetic" }, + { "0", "0" }, + { "1", "\u0623" }, + { "2", "\u0628" }, + { "3", "\u062A" }, + { "4", "\u062B" }, + { "5", "\u062C" }, + { "6", "\u062D" }, + { "7", "\u062E" }, + { "8", "\u062F" }, + { "9", "\u0630" }, + { "10", "\u0631" }, + { "11", "\u0632" }, + { "12", "\u0633" }, + { "13", "\u0634" }, + { "14", "\u0635" }, + { "15", "\u0636" }, + { "16", "\u0637" }, + { "17", "\u0638" }, + { "18", "\u0639" }, + { "19", "\u063A" }, + { "20", "\u0641" }, + { "21", "\u0642" }, + { "22", "\u0643" }, + { "23", "\u0644" }, + { "24", "\u0645" }, + { "25", "\u0646" }, + { "26", "\u0647" }, + { "27", "\u0648" }, + { "28", "\u0649" }, + { "29", "\u0623\u0623" }, + { "56", "\u0623\u0649" }, + { "57", "\u0628\u0623" }, + { "812", "\u0649\u0649" }, + { "813", "\u0623\u0623\u0623" }, + { "999999", "\u0623\u0638\u0636\u0635\u062E" }, + { "1000000", "\u0623\u0638\u0636\u0635\u062F" }, + }; + + private static String[][] formatAlphabeticArabicAbjadi = + { + { "\u0627", null, null, "traditional" }, + { "0", "0" }, + { "1", "\u0623" }, + { "2", "\u0628" }, + { "3", "\u062C" }, + { "4", "\u062F" }, + { "5", "\u0647" }, + { "6", "\u0648" }, + { "7", "\u0632" }, + { "8", "\u062D" }, + { "9", "\u0637" }, + { "10", "\u0649" }, + { "11", "\u0643" }, + { "12", "\u0644" }, + { "13", "\u0645" }, + { "14", "\u0646" }, + { "15", "\u0633" }, + { "16", "\u0639" }, + { "17", "\u0641" }, + { "18", "\u0635" }, + { "19", "\u0642" }, + { "20", "\u0631" }, + { "21", "\u0634" }, + { "22", "\u062A" }, + { "23", "\u062B" }, + { "24", "\u062E" }, + { "25", "\u0630" }, + { "26", "\u0636" }, + { "27", "\u0638" }, + { "28", "\u063A" }, + { "29", "\u0623\u0623" }, + { "56", "\u0623\u063A" }, + { "57", "\u0628\u0623" }, + { "812", "\u063A\u063A" }, + { "813", "\u0623\u0623\u0623" }, + { "999999", "\u0623\u0641\u0633\u0646\u0632" }, + { "1000000", "\u0623\u0641\u0633\u0646\u062D" }, + }; + + private static String[][] formatNumeralArabicAbjadi = + { + { "\u0623", null, null, "traditional" }, + { "0", "0" }, + { "1", "\u0623" }, + { "2", "\u0628" }, + { "3", "\u062C" }, + { "4", "\u062F" }, + { "5", "\u0647" }, + { "6", "\u0648" }, + { "7", "\u0632" }, + { "8", "\u062D" }, + { "9", "\u0637" }, + { "10", "\u0649" }, + { "11", "\u0649\u0623" }, + { "12", "\u0649\u0628" }, + { "13", "\u0649\u062C" }, + { "14", "\u0649\u062F" }, + { "15", "\u0649\u0647" }, + { "16", "\u0649\u0648" }, + { "17", "\u0649\u0632" }, + { "18", "\u0649\u062D" }, + { "19", "\u0649\u0637" }, + { "20", "\u0643" }, + { "30", "\u0644" }, + { "40", "\u0645" }, + { "50", "\u0646" }, + { "60", "\u0633" }, + { "70", "\u0639" }, + { "80", "\u0641" }, + { "90", "\u0635" }, + { "99", "\u0635\u0637" }, + { "100", "\u0642" }, + { "101", "\u0642\u0623" }, + { "200", "\u0631" }, + { "300", "\u0634" }, + { "400", "\u062A" }, + { "500", "\u062B" }, + { "600", "\u062E" }, + { "700", "\u0630" }, + { "800", "\u0636" }, + { "900", "\u0638" }, + { "999", "\u0638\u0635\u0637" }, + { "1000", "\u063A" }, + { "1999", "\u063A\u0638\u0635\u0637" }, + { "2000", "2000" }, + }; + + private static String[][] formatAlphabeticHebrew = + { + { "\u05D0", null, null, "alphabetic" }, + { "0", "0" }, + { "1", "\u05D0" }, + { "2", "\u05D1" }, + { "3", "\u05D2" }, + { "4", "\u05D3" }, + { "5", "\u05D4" }, + { "6", "\u05D5" }, + { "7", "\u05D6" }, + { "8", "\u05D7" }, + { "9", "\u05D8" }, + { "10", "\u05D9" }, + { "11", "\u05DB" }, + { "12", "\u05DC" }, + { "13", "\u05DE" }, + { "14", "\u05E0" }, + { "15", "\u05E1" }, + { "16", "\u05E2" }, + { "17", "\u05E4" }, + { "18", "\u05E6" }, + { "19", "\u05E7" }, + { "20", "\u05E8" }, + { "21", "\u05E9" }, + { "22", "\u05EA" }, + { "23", "\u05DA" }, + { "24", "\u05DD" }, + { "25", "\u05DF" }, + { "26", "\u05E3" }, + { "27", "\u05E5" }, + { "28", "\u05D0\u05D0" }, + { "54", "\u05D0\u05E5" }, + { "55", "\u05D1\u05D0" }, + { "756", "\u05E5\u05E5" }, + { "757", "\u05D0\u05D0\u05D0" }, + { "999999", "\u05D0\u05DA\u05E9\u05E7\u05E5" }, + { "1000000", "\u05D0\u05DA\u05E9\u05E8\u05D0" }, + }; + + private static String[][] formatNumeralHebrewGematria = + { + { "\u05D0", null, null, "traditional" }, + { "0", "0" }, + { "1", "\u05D0" }, + { "2", "\u05D1" }, + { "3", "\u05D2" }, + { "4", "\u05D3" }, + { "5", "\u05D4" }, + { "6", "\u05D5" }, + { "7", "\u05D6" }, + { "8", "\u05D7" }, + { "9", "\u05D8" }, + { "10", "\u05D9" }, + { "11", "\u05D9\u05D0" }, + { "12", "\u05D9\u05D1" }, + { "13", "\u05D9\u05D2" }, + { "14", "\u05D9\u05D3" }, + { "15", "\u05D8\u05F4\u05D5" }, + { "16", "\u05D8\u05F4\u05D6" }, + { "17", "\u05D9\u05D6" }, + { "18", "\u05D9\u05D7" }, + { "19", "\u05D9\u05D8" }, + { "20", "\u05DB" }, + { "30", "\u05DC" }, + { "40", "\u05DE" }, + { "50", "\u05E0" }, + { "60", "\u05E1" }, + { "70", "\u05E2" }, + { "80", "\u05E4" }, + { "90", "\u05E6" }, + { "99", "\u05E6\u05D8" }, + { "100", "\u05E7" }, + { "101", "\u05E7\u05D0" }, + { "200", "\u05E8" }, + { "300", "\u05E9" }, + { "400", "\u05EA" }, + { "500", "\u05EA\u05F4\u05E7" }, + { "600", "\u05EA\u05F4\u05E8" }, + { "700", "\u05EA\u05F4\u05E9" }, + { "800", "\u05EA\u05F4\u05EA" }, + { "900", "\u05EA\u05EA\u05F4\u05E7" }, + { "999", "\u05EA\u05EA\u05F4\u05E7\u05E6\u05D8" }, + { "1000", "\u05D0\u05F3" }, + { "1999", "\u05D0\u05F3\u05EA\u05EA\u05F4\u05E7\u05E6\u05D8" }, + { "2000", "2000" }, + }; + + private static String[][] formatAlphabeticThai = + { + { "\u0E01", null, null, "alphabetic" }, + { "0", "0" }, + { "1", "\u0E01" }, + { "2", "\u0E02" }, + { "3", "\u0E03" }, + { "10", "\u0E0A" }, + { "20", "\u0E14" }, + { "30", "\u0E1E" }, + { "40", "\u0E2A" }, + { "44", "\u0E2E" }, + { "45", "\u0E01\u0E01" }, + { "88", "\u0E01\u0E2E" }, + { "89", "\u0E02\u0E01" }, + { "1980", "\u0E2E\u0E2E" }, + { "1981", "\u0E01\u0E01\u0E01" }, + { "999999", "\u0E0B\u0E20\u0E17\u0E0B" }, + { "1000000", "\u0E0B\u0E20\u0E17\u0E0C" }, + }; + + private static String[][] formatWordEnglishLower = + { + { "w", null, null, null, null, "eng" }, + { "0", "zero" }, + { "1", "one" }, + { "2", "two" }, + { "3", "three" }, + { "4", "four" }, + { "5", "five" }, + { "6", "six" }, + { "7", "seven" }, + { "8", "eight" }, + { "9", "nine" }, + { "10", "ten" }, + { "99", "ninety nine" }, + { "100", "one hundred" }, + { "999", "nine hundred ninety nine" }, + { "1000", "one thousand" }, + { "999999", "nine hundred ninety nine thousand nine hundred ninety nine" }, + { "1000000", "one million" }, + { "999999999", "nine hundred ninety nine million nine hundred ninety nine thousand nine hundred ninety nine" }, + { "1000000000", "one billion" } + }; + + private static String[][] formatWordEnglishUpper = + { + { "W", null, null, null, null, "eng" }, + { "0", "ZERO" }, + { "1", "ONE" }, + { "2", "TWO" }, + { "3", "THREE" }, + { "4", "FOUR" }, + { "5", "FIVE" }, + { "6", "SIX" }, + { "7", "SEVEN" }, + { "8", "EIGHT" }, + { "9", "NINE" }, + { "10", "TEN" }, + { "99", "NINETY NINE" }, + { "100", "ONE HUNDRED" }, + { "999", "NINE HUNDRED NINETY NINE" }, + { "1000", "ONE THOUSAND" }, + { "999999", "NINE HUNDRED NINETY NINE THOUSAND NINE HUNDRED NINETY NINE" }, + { "1000000", "ONE MILLION" }, + { "999999999", "NINE HUNDRED NINETY NINE MILLION NINE HUNDRED NINETY NINE THOUSAND NINE HUNDRED NINETY NINE" }, + { "1000000000", "ONE BILLION" } + }; + + private static String[][] formatWordEnglishTitle = + { + { "Ww", null, null, null, null, "eng" }, + { "0", "Zero" }, + { "1", "One" }, + { "2", "Two" }, + { "3", "Three" }, + { "4", "Four" }, + { "5", "Five" }, + { "6", "Six" }, + { "7", "Seven" }, + { "8", "Eight" }, + { "9", "Nine" }, + { "10", "Ten" }, + { "99", "Ninety Nine" }, + { "100", "One Hundred" }, + { "999", "Nine Hundred Ninety Nine" }, + { "1000", "One Thousand" }, + { "999999", "Nine Hundred Ninety Nine Thousand Nine Hundred Ninety Nine" }, + { "1000000", "One Million" }, + { "999999999", "Nine Hundred Ninety Nine Million Nine Hundred Ninety Nine Thousand Nine Hundred Ninety Nine" }, + { "1000000000", "One Billion" } + }; + + private static String[][] formatWordSpanishLower = + { + { "w", null, null, null, null, "spa" }, + { "0", "cero" }, + { "1", "uno" }, + { "2", "dos" }, + { "3", "tres" }, + { "4", "cuatro" }, + { "5", "cinco" }, + { "6", "seise" }, + { "7", "siete" }, + { "8", "ocho" }, + { "9", "nueve" }, + { "10", "diez" }, + { "11", "once" }, + { "12", "doce" }, + { "13", "trece" }, + { "14", "catorce" }, + { "15", "quince" }, + { "16", "diecis\u00e9is" }, + { "17", "diecisiete" }, + { "18", "dieciocho" }, + { "19", "diecinueve" }, + { "20", "veinte" }, + { "21", "veintiuno" }, + { "22", "veintid\u00f3s" }, + { "23", "veintitr\u00e9s" }, + { "24", "veinticuatro" }, + { "25", "veinticinco" }, + { "26", "veintis\u00e9is" }, + { "27", "veintisiete" }, + { "28", "veintiocho" }, + { "29", "veintinueve" }, + { "30", "treinta" }, + { "31", "treinta y uno" }, + { "32", "treinta y dos" }, + { "40", "cuarenta" }, + { "41", "cuarenta y uno" }, + { "42", "cuarenta y dos" }, + { "50", "cincuenta" }, + { "51", "cincuenta y uno" }, + { "52", "cincuenta y dos" }, + { "60", "sesenta" }, + { "61", "sesenta y uno" }, + { "62", "sesenta y dos" }, + { "70", "setenta" }, + { "71", "setenta y uno" }, + { "72", "setenta y dos" }, + { "80", "ochenta" }, + { "81", "ochenta y uno" }, + { "82", "ochenta y dos" }, + { "90", "noventa" }, + { "91", "noventa y uno" }, + { "92", "noventa y dos" }, + { "99", "noventa y nueve" }, + { "100", "cien" }, + { "101", "ciento uno" }, + { "102", "ciento dos" }, + { "200", "doscientos" }, + { "300", "trescientos" }, + { "400", "cuatrocientos" }, + { "500", "quinientos" }, + { "600", "seiscientos" }, + { "700", "setecientos" }, + { "800", "ochocientos" }, + { "900", "novecientos" }, + { "999", "novecientos noventa y nueve" }, + { "1000", "mil" }, + { "1001", "mil uno" }, + { "1002", "mil dos" }, + { "2000", "dos mil" }, + { "2001", "dos mil uno" }, + { "100000", "cien mil" }, + { "100001", "cien mil uno" }, + { "999999", "novecientos noventa y nueve mil novecientos noventa y nueve" }, + { "1000000", "un mill\u00f3n" }, + { "999999999", "novecientos noventa y nueve millones novecientos noventa y nueve mil novecientos noventa y nueve" }, + { "1000000000", "mil millones" } + }; + + private static String[][] formatWordSpanishUpper = + { + { "W", null, null, null, null, "spa" }, + { "0", "CERO" }, + { "1", "UNO" }, + { "2", "DOS" }, + { "3", "TRES" }, + { "4", "CUATRO" }, + { "5", "CINCO" }, + { "6", "SEISE" }, + { "7", "SIETE" }, + { "8", "OCHO" }, + { "9", "NUEVE" }, + { "10", "DIEZ" }, + { "11", "ONCE" }, + { "12", "DOCE" }, + { "13", "TRECE" }, + { "14", "CATORCE" }, + { "15", "QUINCE" }, + { "16", "DIECIS\u00c9IS" }, + { "17", "DIECISIETE" }, + { "18", "DIECIOCHO" }, + { "19", "DIECINUEVE" }, + { "20", "VEINTE" }, + { "21", "VEINTIUNO" }, + { "22", "VEINTID\u00d3S" }, + { "23", "VEINTITR\u00c9S" }, + { "24", "VEINTICUATRO" }, + { "25", "VEINTICINCO" }, + { "26", "VEINTIS\u00c9IS" }, + { "27", "VEINTISIETE" }, + { "28", "VEINTIOCHO" }, + { "29", "VEINTINUEVE" }, + { "30", "TREINTA" }, + { "31", "TREINTA Y UNO" }, + { "32", "TREINTA Y DOS" }, + { "40", "CUARENTA" }, + { "41", "CUARENTA Y UNO" }, + { "42", "CUARENTA Y DOS" }, + { "50", "CINCUENTA" }, + { "51", "CINCUENTA Y UNO" }, + { "52", "CINCUENTA Y DOS" }, + { "60", "SESENTA" }, + { "61", "SESENTA Y UNO" }, + { "62", "SESENTA Y DOS" }, + { "70", "SETENTA" }, + { "71", "SETENTA Y UNO" }, + { "72", "SETENTA Y DOS" }, + { "80", "OCHENTA" }, + { "81", "OCHENTA Y UNO" }, + { "82", "OCHENTA Y DOS" }, + { "90", "NOVENTA" }, + { "91", "NOVENTA Y UNO" }, + { "92", "NOVENTA Y DOS" }, + { "99", "NOVENTA Y NUEVE" }, + { "100", "CIEN" }, + { "101", "CIENTO UNO" }, + { "102", "CIENTO DOS" }, + { "200", "DOSCIENTOS" }, + { "300", "TRESCIENTOS" }, + { "400", "CUATROCIENTOS" }, + { "500", "QUINIENTOS" }, + { "600", "SEISCIENTOS" }, + { "700", "SETECIENTOS" }, + { "800", "OCHOCIENTOS" }, + { "900", "NOVECIENTOS" }, + { "999", "NOVECIENTOS NOVENTA Y NUEVE" }, + { "1000", "MIL" }, + { "1001", "MIL UNO" }, + { "1002", "MIL DOS" }, + { "2000", "DOS MIL" }, + { "2001", "DOS MIL UNO" }, + { "100000", "CIEN MIL" }, + { "100001", "CIEN MIL UNO" }, + { "999999", "NOVECIENTOS NOVENTA Y NUEVE MIL NOVECIENTOS NOVENTA Y NUEVE" }, + { "1000000", "UN MILL\u00d3N" }, + { "999999999", "NOVECIENTOS NOVENTA Y NUEVE MILLONES NOVECIENTOS NOVENTA Y NUEVE MIL NOVECIENTOS NOVENTA Y NUEVE" }, + { "1000000000", "MIL MILLONES" } + }; + + private static String[][] formatWordSpanishTitle = + { + { "Ww", null, null, null, null, "spa" }, + { "0", "Cero" }, + { "1", "Uno" }, + { "2", "Dos" }, + { "3", "Tres" }, + { "4", "Cuatro" }, + { "5", "Cinco" }, + { "6", "Seise" }, + { "7", "Siete" }, + { "8", "Ocho" }, + { "9", "Nueve" }, + { "10", "Diez" }, + { "11", "Once" }, + { "12", "Doce" }, + { "13", "Trece" }, + { "14", "Catorce" }, + { "15", "Quince" }, + { "16", "Diecis\u00e9is" }, + { "17", "Diecisiete" }, + { "18", "Dieciocho" }, + { "19", "Diecinueve" }, + { "20", "Veinte" }, + { "21", "Veintiuno" }, + { "22", "Veintid\u00f3s" }, + { "23", "Veintitr\u00e9s" }, + { "24", "Veinticuatro" }, + { "25", "Veinticinco" }, + { "26", "Veintis\u00e9is" }, + { "27", "Veintisiete" }, + { "28", "Veintiocho" }, + { "29", "Veintinueve" }, + { "30", "Treinta" }, + { "31", "Treinta Y Uno" }, + { "32", "Treinta Y Dos" }, + { "40", "Cuarenta" }, + { "41", "Cuarenta Y Uno" }, + { "42", "Cuarenta Y Dos" }, + { "50", "Cincuenta" }, + { "51", "Cincuenta Y Uno" }, + { "52", "Cincuenta Y Dos" }, + { "60", "Sesenta" }, + { "61", "Sesenta Y Uno" }, + { "62", "Sesenta Y Dos" }, + { "70", "Setenta" }, + { "71", "Setenta Y Uno" }, + { "72", "Setenta Y Dos" }, + { "80", "Ochenta" }, + { "81", "Ochenta Y Uno" }, + { "82", "Ochenta Y Dos" }, + { "90", "Noventa" }, + { "91", "Noventa Y Uno" }, + { "92", "Noventa Y Dos" }, + { "99", "Noventa Y Nueve" }, + { "100", "Cien" }, + { "101", "Ciento Uno" }, + { "102", "Ciento Dos" }, + { "200", "Doscientos" }, + { "300", "Trescientos" }, + { "400", "Cuatrocientos" }, + { "500", "Quinientos" }, + { "600", "Seiscientos" }, + { "700", "Setecientos" }, + { "800", "Ochocientos" }, + { "900", "Novecientos" }, + { "999", "Novecientos Noventa Y Nueve" }, + { "1000", "Mil" }, + { "1001", "Mil Uno" }, + { "1002", "Mil Dos" }, + { "2000", "Dos Mil" }, + { "2001", "Dos Mil Uno" }, + { "100000", "Cien Mil" }, + { "100001", "Cien Mil Uno" }, + { "999999", "Novecientos Noventa Y Nueve Mil Novecientos Noventa Y Nueve" }, + { "1000000", "Un Mill\u00f3n" }, + { "999999999", "Novecientos Noventa Y Nueve Millones Novecientos Noventa Y Nueve Mil Novecientos Noventa Y Nueve" }, + { "1000000000", "Mil Millones" } + }; + + private static String[][] formatWordFrenchLower = + { + { "w", null, null, null, null, "fra" }, + { "0", "z\u00e9ro" }, + { "1", "un" }, + { "2", "deux" }, + { "3", "trois" }, + { "4", "quatre" }, + { "5", "cinq" }, + { "6", "six" }, + { "7", "sept" }, + { "8", "huit" }, + { "9", "neuf" }, + { "10", "dix" }, + { "11", "onze" }, + { "12", "douze" }, + { "13", "treize" }, + { "14", "quatorze" }, + { "15", "quinze" }, + { "16", "seize" }, + { "17", "dix-sept" }, + { "18", "dix-huit" }, + { "19", "dix-neuf" }, + { "20", "vingt" }, + { "21", "vingt et un" }, + { "22", "vingt-deux" }, + { "23", "vingt-trois" }, + { "24", "vingt-quatre" }, + { "25", "vingt-cinq" }, + { "26", "vingt-six" }, + { "27", "vingt-sept" }, + { "28", "vingt-huit" }, + { "29", "vingt-neuf" }, + { "30", "trente" }, + { "31", "trente et un" }, + { "32", "trente-deux" }, + { "40", "quarante" }, + { "41", "quarante et un" }, + { "42", "quarante-deux" }, + { "50", "cinquante" }, + { "51", "cinquante et un" }, + { "52", "cinquante-deux" }, + { "60", "soixante" }, + { "61", "soixante et un" }, + { "62", "soixante-deux" }, + { "70", "soixante-dix" }, + { "71", "soixante et onze" }, + { "72", "soixante-douze" }, + { "79", "soixante-dix-neuf" }, + { "80", "quatre-vingts" }, + { "81", "quatre-vingt-un" }, + { "82", "quatre-vingt-deux" }, + { "89", "quatre-vingt-neuf" }, + { "90", "quatre-vingt-dix" }, + { "91", "quatre-vingt-onze" }, + { "92", "quatre-vingt-douze" }, + { "99", "quatre-vingt-dix-neuf" }, + { "100", "cent" }, + { "101", "cent un" }, + { "102", "cent deux" }, + { "200", "deux cents" }, + { "201", "deux cent un" }, + { "202", "deux cent deux" }, + { "300", "trois cents" }, + { "301", "trois cent un" }, + { "400", "quatre cents" }, + { "401", "quatre cent un" }, + { "500", "cinq cents" }, + { "501", "cinq cent un" }, + { "600", "six cents" }, + { "601", "six cent un" }, + { "700", "sept cents" }, + { "701", "sept cent un" }, + { "800", "huit cents" }, + { "801", "huit cent un" }, + { "900", "neuf cents" }, + { "901", "neuf cent un" }, + { "999", "neuf cent quatre-vingt-dix-neuf" }, + { "1000", "mille" }, + { "1001", "mille un" }, + { "1002", "mille deux" }, + { "2000", "deux mille" }, + { "2001", "deux mille un" }, + { "100000", "cent mille" }, + { "100001", "cent mille un" }, + { "999999", "neuf cent quatre-vingt-dix-neuf mille neuf cent quatre-vingt-dix-neuf" }, + { "1000000", "un million" }, + { "999999999", "neuf cent quatre-vingt-dix-neuf millions neuf cent quatre-vingt-dix-neuf mille neuf cent quatre-vingt-dix-neuf" }, + { "1000000000", "un milliard" } + }; + + private static String[][] formatWordFrenchUpper = + { + { "W", null, null, null, null, "fra" }, + { "0", "Z\u00c9RO" }, + { "1", "UN" }, + { "2", "DEUX" }, + { "3", "TROIS" }, + { "4", "QUATRE" }, + { "5", "CINQ" }, + { "6", "SIX" }, + { "7", "SEPT" }, + { "8", "HUIT" }, + { "9", "NEUF" }, + { "10", "DIX" }, + { "11", "ONZE" }, + { "12", "DOUZE" }, + { "13", "TREIZE" }, + { "14", "QUATORZE" }, + { "15", "QUINZE" }, + { "16", "SEIZE" }, + { "17", "DIX-SEPT" }, + { "18", "DIX-HUIT" }, + { "19", "DIX-NEUF" }, + { "20", "VINGT" }, + { "21", "VINGT ET UN" }, + { "22", "VINGT-DEUX" }, + { "23", "VINGT-TROIS" }, + { "24", "VINGT-QUATRE" }, + { "25", "VINGT-CINQ" }, + { "26", "VINGT-SIX" }, + { "27", "VINGT-SEPT" }, + { "28", "VINGT-HUIT" }, + { "29", "VINGT-NEUF" }, + { "30", "TRENTE" }, + { "31", "TRENTE ET UN" }, + { "32", "TRENTE-DEUX" }, + { "40", "QUARANTE" }, + { "41", "QUARANTE ET UN" }, + { "42", "QUARANTE-DEUX" }, + { "50", "CINQUANTE" }, + { "51", "CINQUANTE ET UN" }, + { "52", "CINQUANTE-DEUX" }, + { "60", "SOIXANTE" }, + { "61", "SOIXANTE ET UN" }, + { "62", "SOIXANTE-DEUX" }, + { "70", "SOIXANTE-DIX" }, + { "71", "SOIXANTE ET ONZE" }, + { "72", "SOIXANTE-DOUZE" }, + { "79", "SOIXANTE-DIX-NEUF" }, + { "80", "QUATRE-VINGTS" }, + { "81", "QUATRE-VINGT-UN" }, + { "82", "QUATRE-VINGT-DEUX" }, + { "89", "QUATRE-VINGT-NEUF" }, + { "90", "QUATRE-VINGT-DIX" }, + { "91", "QUATRE-VINGT-ONZE" }, + { "92", "QUATRE-VINGT-DOUZE" }, + { "99", "QUATRE-VINGT-DIX-NEUF" }, + { "100", "CENT" }, + { "101", "CENT UN" }, + { "102", "CENT DEUX" }, + { "200", "DEUX CENTS" }, + { "201", "DEUX CENT UN" }, + { "202", "DEUX CENT DEUX" }, + { "300", "TROIS CENTS" }, + { "301", "TROIS CENT UN" }, + { "400", "QUATRE CENTS" }, + { "401", "QUATRE CENT UN" }, + { "500", "CINQ CENTS" }, + { "501", "CINQ CENT UN" }, + { "600", "SIX CENTS" }, + { "601", "SIX CENT UN" }, + { "700", "SEPT CENTS" }, + { "701", "SEPT CENT UN" }, + { "800", "HUIT CENTS" }, + { "801", "HUIT CENT UN" }, + { "900", "NEUF CENTS" }, + { "901", "NEUF CENT UN" }, + { "999", "NEUF CENT QUATRE-VINGT-DIX-NEUF" }, + { "1000", "MILLE" }, + { "1001", "MILLE UN" }, + { "1002", "MILLE DEUX" }, + { "2000", "DEUX MILLE" }, + { "2001", "DEUX MILLE UN" }, + { "100000", "CENT MILLE" }, + { "100001", "CENT MILLE UN" }, + { "999999", "NEUF CENT QUATRE-VINGT-DIX-NEUF MILLE NEUF CENT QUATRE-VINGT-DIX-NEUF" }, + { "1000000", "UN MILLION" }, + { "999999999", "NEUF CENT QUATRE-VINGT-DIX-NEUF MILLIONS NEUF CENT QUATRE-VINGT-DIX-NEUF MILLE NEUF CENT QUATRE-VINGT-DIX-NEUF" }, + { "1000000000", "UN MILLIARD" } + }; + + private static String[][] formatWordFrenchTitle = + { + { "Ww", null, null, null, null, "fra" }, + { "0", "Z\u00e9ro" }, + { "1", "Un" }, + { "2", "Deux" }, + { "3", "Trois" }, + { "4", "Quatre" }, + { "5", "Cinq" }, + { "6", "Six" }, + { "7", "Sept" }, + { "8", "Huit" }, + { "9", "Neuf" }, + { "10", "Dix" }, + { "11", "Onze" }, + { "12", "Douze" }, + { "13", "Treize" }, + { "14", "Quatorze" }, + { "15", "Quinze" }, + { "16", "Seize" }, + { "17", "Dix-sept" }, + { "18", "Dix-huit" }, + { "19", "Dix-neuf" }, + { "20", "Vingt" }, + { "21", "Vingt Et Un" }, + { "22", "Vingt-deux" }, + { "23", "Vingt-trois" }, + { "24", "Vingt-quatre" }, + { "25", "Vingt-cinq" }, + { "26", "Vingt-six" }, + { "27", "Vingt-sept" }, + { "28", "Vingt-huit" }, + { "29", "Vingt-neuf" }, + { "30", "Trente" }, + { "31", "Trente Et Un" }, + { "32", "Trente-deux" }, + { "40", "Quarante" }, + { "41", "Quarante Et Un" }, + { "42", "Quarante-deux" }, + { "50", "Cinquante" }, + { "51", "Cinquante Et Un" }, + { "52", "Cinquante-deux" }, + { "60", "Soixante" }, + { "61", "Soixante Et Un" }, + { "62", "Soixante-deux" }, + { "70", "Soixante-dix" }, + { "71", "Soixante Et Onze" }, + { "72", "Soixante-douze" }, + { "79", "Soixante-dix-neuf" }, + { "80", "Quatre-vingts" }, + { "81", "Quatre-vingt-un" }, + { "82", "Quatre-vingt-deux" }, + { "89", "Quatre-vingt-neuf" }, + { "90", "Quatre-vingt-dix" }, + { "91", "Quatre-vingt-onze" }, + { "92", "Quatre-vingt-douze" }, + { "99", "Quatre-vingt-dix-neuf" }, + { "100", "Cent" }, + { "101", "Cent Un" }, + { "102", "Cent Deux" }, + { "200", "Deux Cents" }, + { "201", "Deux Cent Un" }, + { "202", "Deux Cent Deux" }, + { "300", "Trois Cents" }, + { "301", "Trois Cent Un" }, + { "400", "Quatre Cents" }, + { "401", "Quatre Cent Un" }, + { "500", "Cinq Cents" }, + { "501", "Cinq Cent Un" }, + { "600", "Six Cents" }, + { "601", "Six Cent Un" }, + { "700", "Sept Cents" }, + { "701", "Sept Cent Un" }, + { "800", "Huit Cents" }, + { "801", "Huit Cent Un" }, + { "900", "Neuf Cents" }, + { "901", "Neuf Cent Un" }, + { "999", "Neuf Cent Quatre-vingt-dix-neuf" }, + { "1000", "Mille" }, + { "1001", "Mille Un" }, + { "1002", "Mille Deux" }, + { "2000", "Deux Mille" }, + { "2001", "Deux Mille Un" }, + { "100000", "Cent Mille" }, + { "100001", "Cent Mille Un" }, + { "999999", "Neuf Cent Quatre-vingt-dix-neuf Mille Neuf Cent Quatre-vingt-dix-neuf" }, + { "1000000", "Un Million" }, + { "999999999", "Neuf Cent Quatre-vingt-dix-neuf Millions Neuf Cent Quatre-vingt-dix-neuf Mille Neuf Cent Quatre-vingt-dix-neuf" }, + { "1000000000", "Un Milliard" } + }; + + /** + * Tests decimal from latin script. + * @throws Exception if the test fails + */ + @Test + public void testFormatDecimal() throws Exception { + performConversions(formatDecimal); + performConversions(formatDecimalPadded); + performConversions(formatDecimalGrouped); + performConversions(formatDecimalGroupedPadded); + } + + /** + * Tests decimal from arabic script. + * @throws Exception if the test fails + */ + @Test + public void testFormatDecimalArabic() throws Exception { + performConversions(formatDecimalArabic); + performConversions(formatDecimalArabicPadded); + performConversions(formatDecimalArabicGrouped); + performConversions(formatDecimalArabicGroupedPadded); + } + + /** + * Tests decimal from thai script. + * @throws Exception if the test fails + */ + @Test + public void testFormatDecimalThai() throws Exception { + performConversions(formatDecimalThai); + performConversions(formatDecimalThaiPadded); + } + + /** + * Tests roman numbers. + * @throws Exception if the test fails + */ + @Test + public void testFormatRoman() throws Exception { + performConversions(formatRomanLower); + performConversions(formatRomanUpper); + performConversions(formatRomanLargeLower); + performConversions(formatRomanLargeUpper); + performConversions(formatRomanNumberFormsLower); + performConversions(formatRomanNumberFormsUpper); + } + + /** + * Tests latin alphabetic sequence numerals. + * @throws Exception if the test fails + */ + @Test + public void testAlphabeticLatin() throws Exception { + performConversions(formatAlphabeticLatinLower); + performConversions(formatAlphabeticLatinUpper); + } + + /** + * Tests arabic alphabetic sequence numerals. + * @throws Exception if the test fails + */ + @Test + public void testAlphabeticArabic() throws Exception { + performConversions(formatAlphabeticArabicHijai); + performConversions(formatAlphabeticArabicAbjadi); + } + + /** + * Tests hebrew alphabetic sequence numerals. + * @throws Exception if the test fails + */ + @Test + public void testAlphabeticHebrew() throws Exception { + performConversions(formatAlphabeticHebrew); + } + + /** + * Tests latin alphabetic sequence numerals. + * @throws Exception if the test fails + */ + @Test + public void testAlphabeticThai() throws Exception { + performConversions(formatAlphabeticThai); + } + + /** + * Tests arabic numerals.. + * @throws Exception if the test fails + */ + @Test + public void testNumeralArabic() throws Exception { + performConversions(formatNumeralArabicAbjadi); + } + + /** + * Tests hebrew numerals. + * @throws Exception if the test fails + */ + @Test + public void testNumeralHebrew() throws Exception { + performConversions(formatNumeralHebrewGematria); + } + + /** + * Tests english word numerals. + * @throws Exception if the test fails + */ + @Test + public void testWordEnglish() throws Exception { + performConversions(formatWordEnglishLower); + performConversions(formatWordEnglishUpper); + performConversions(formatWordEnglishTitle); + } + + /** + * Tests spanish word numerals. + * @throws Exception if the test fails + */ + @Test + public void testWordSpanish() throws Exception { + performConversions(formatWordSpanishLower); + performConversions(formatWordSpanishUpper); + performConversions(formatWordSpanishTitle); + } + + /** + * Tests french word numerals. + * @throws Exception if the test fails + */ + @Test + public void testWordFrench() throws Exception { + performConversions(formatWordFrenchLower); + performConversions(formatWordFrenchUpper); + performConversions(formatWordFrenchTitle); + } + + /** + * Perform conversions according to test specification. + * @param ts test specification + */ + private void performConversions(String[][] ts) { + assert ts != null; + assert ts.length >= 2; + String[] args = ts[0]; + assert args != null; + assert args.length > 0; + String format = args[0]; + assert format.length() > 0; + char groupingSeparator; + if (args.length > 1) { + String s = args[1]; + if ((s != null) && (s.length() > 0)) { + groupingSeparator = s.charAt(0); + } else { + groupingSeparator = 0; + } + } else { + groupingSeparator = 0; + } + int groupingSize; + if (args.length > 2) { + String s = args[2]; + if ((s != null) && (s.length() > 0)) { + groupingSize = Integer.parseInt(s); + } else { + groupingSize = 0; + } + } else { + groupingSize = 0; + } + int letterValue; + if (args.length > 3) { + String s = args[3]; + if ((s != null) && (s.length() > 0)) { + s = s.toLowerCase(); + if (s.equals("alphabetic")) { + letterValue = NumberConverter.LETTER_VALUE_ALPHABETIC; + } else if (s.equals("traditional")) { + letterValue = NumberConverter.LETTER_VALUE_TRADITIONAL; + } else { + letterValue = 0; + } + } else { + letterValue = 0; + } + } else { + letterValue = 0; + } + String features; + if (args.length > 4) { + String s = args[4]; + if ((s != null) && (s.length() > 0)) { + features = s; + } else { + features = null; + } + } else { + features = null; + } + String language; + if (args.length > 5) { + String s = args[5]; + if ((s != null) && (s.length() > 0)) { + language = s; + } else { + language = null; + } + } else { + language = null; + } + String country; + if (args.length > 6) { + String s = args[6]; + if ((s != null) && (s.length() > 0)) { + country = s; + } else { + country = null; + } + } else { + country = null; + } + NumberConverter nc = new NumberConverter(format, groupingSeparator, groupingSize, letterValue, features, language, country); + for (int i = 1, nt = ts.length; i < nt; i++) { + String[] sa = ts[i]; + assert sa != null; + assert sa.length >= 2; + List<Long> numbers = new ArrayList<Long>(); + for (int k = 0, nn = sa.length - 1; k < nn; k++) { + String s = sa[k]; + numbers.add(Long.valueOf(s)); + } + String expected = sa [ sa.length - 1 ]; + String actual = nc.convert(numbers); + assertEquals(expected, actual); + } + } + +} diff --git a/src/test/java/org/apache/fop/complexscripts/util/UtilTestSuite.java b/src/test/java/org/apache/fop/complexscripts/util/UtilTestSuite.java new file mode 100644 index 000000000..4407254a8 --- /dev/null +++ b/src/test/java/org/apache/fop/complexscripts/util/UtilTestSuite.java @@ -0,0 +1,32 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.complexscripts.util; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +/** + * Test suite for bidirectional functionality. + */ +@RunWith(Suite.class) +@SuiteClasses(NumberConverterTestCase.class) +public class UtilTestSuite { +} diff --git a/src/test/java/org/apache/fop/config/BaseConstructiveUserConfigTest.java b/src/test/java/org/apache/fop/config/BaseConstructiveUserConfigTest.java new file mode 100644 index 000000000..7a3cab3bb --- /dev/null +++ b/src/test/java/org/apache/fop/config/BaseConstructiveUserConfigTest.java @@ -0,0 +1,53 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.config; + +import java.io.IOException; +import java.io.InputStream; + +import org.junit.Test; +import org.xml.sax.SAXException; + +import static org.junit.Assert.fail; + +/** + * Super class of several user config cases. + */ +public abstract class BaseConstructiveUserConfigTest extends BaseUserConfigTest { + + public BaseConstructiveUserConfigTest(InputStream confStream) throws SAXException, IOException { + super(confStream); + } + + /** + * Test using a standard FOP font + * @throws Exception checkstyle wants a comment here, even a silly one + */ + @Test + public void testUserConfig() throws Exception { + try { + convertFO(); + } catch (Exception e) { + // this should *not* happen! + e.printStackTrace(); + fail(e.getMessage()); + } + } +} diff --git a/src/test/java/org/apache/fop/config/BaseDestructiveUserConfigTest.java b/src/test/java/org/apache/fop/config/BaseDestructiveUserConfigTest.java new file mode 100644 index 000000000..4050e9b2d --- /dev/null +++ b/src/test/java/org/apache/fop/config/BaseDestructiveUserConfigTest.java @@ -0,0 +1,46 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.config; + +import java.io.IOException; +import java.io.InputStream; + +import org.junit.Test; +import org.xml.sax.SAXException; + +import org.apache.fop.apps.FOPException; + +/** + * Super class for several user configuration failure cases. + */ +public abstract class BaseDestructiveUserConfigTest extends BaseUserConfigTest { + + public BaseDestructiveUserConfigTest(InputStream confStream) throws SAXException, IOException { + super(confStream); + } + + /** + * Test the user configuration failure. + */ + @Test(expected = FOPException.class) + public void testUserConfig() throws Exception { + convertFO(); + } +} diff --git a/src/test/java/org/apache/fop/config/BaseUserConfigTest.java b/src/test/java/org/apache/fop/config/BaseUserConfigTest.java new file mode 100644 index 000000000..1af57d985 --- /dev/null +++ b/src/test/java/org/apache/fop/config/BaseUserConfigTest.java @@ -0,0 +1,81 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.config; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; + +import org.xml.sax.SAXException; + +import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.render.pdf.BasePDFTest; + +import static org.apache.fop.FOPTestUtils.getBaseDir; + +/** + * Basic runtime test for FOP's font configuration. It is used to verify that + * nothing obvious is broken after compiling. + */ +public abstract class BaseUserConfigTest extends BasePDFTest { + + protected DefaultConfigurationBuilder cfgBuilder = new DefaultConfigurationBuilder(); + + /** logging instance */ + protected Log log = LogFactory.getLog(BaseUserConfigTest.class); + + + public BaseUserConfigTest(InputStream confStream) throws SAXException, IOException { + super(confStream); + } + + /** + * @see org.apache.fop.render.pdf.BasePDFTest#init() + */ + protected void init() { + // do nothing + } + + protected void convertFO() throws Exception { + final File baseDir = getBaseDir(); + final String fontFOFilePath = getFontFOFilePath(); + File foFile = new File(baseDir, fontFOFilePath); + final boolean dumpOutput = false; + FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); + convertFO(foFile, foUserAgent, dumpOutput); + } + + /** + * get test FOP config File + * @return fo test filepath + */ + protected String getFontFOFilePath() { + return "test/xml/bugtests/font.fo"; + } + + /** get base config directory */ + protected static String getBaseConfigDir() { + return "test/config/"; + } +} diff --git a/src/test/java/org/apache/fop/config/FontAttributesMissingTestCase.java b/src/test/java/org/apache/fop/config/FontAttributesMissingTestCase.java new file mode 100644 index 000000000..fa4babfa2 --- /dev/null +++ b/src/test/java/org/apache/fop/config/FontAttributesMissingTestCase.java @@ -0,0 +1,44 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.config; + +import java.io.IOException; + +import org.xml.sax.SAXException; + +import org.apache.fop.apps.FopConfBuilder; +import org.apache.fop.apps.PDFRendererConfBuilder; + +/** + * this font is without a metrics-url or an embed-url + */ +public class FontAttributesMissingTestCase extends BaseDestructiveUserConfigTest { + + public FontAttributesMissingTestCase() throws SAXException, IOException { + super(new FopConfBuilder().setStrictValidation(true) + .startRendererConfig(PDFRendererConfBuilder.class) + .startFontsConfig() + .startFont(null, null) + .addTriplet("Gladiator", "normal", "normal") + .endFont() + .endFontConfig() + .endRendererConfig().build()); + } +} diff --git a/src/test/java/org/apache/fop/config/FontMetricsUrlBadTestCase.java b/src/test/java/org/apache/fop/config/FontMetricsUrlBadTestCase.java new file mode 100644 index 000000000..591104412 --- /dev/null +++ b/src/test/java/org/apache/fop/config/FontMetricsUrlBadTestCase.java @@ -0,0 +1,44 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.config; + +import java.io.IOException; + +import org.xml.sax.SAXException; + +import org.apache.fop.apps.FopConfBuilder; +import org.apache.fop.apps.PDFRendererConfBuilder; + +/** + * this font has a metrics-url that does not exist on filesystem + */ +public class FontMetricsUrlBadTestCase extends BaseDestructiveUserConfigTest { + + public FontMetricsUrlBadTestCase() throws SAXException, IOException { + super(new FopConfBuilder().setStrictValidation(true) + .startRendererConfig(PDFRendererConfBuilder.class) + .startFontsConfig() + .startFont("test/doesnotexist.ttf.ansi.xml", null) + .addTriplet("Gladiator-Ansi", "normal", "normal") + .endFont() + .endFontConfig() + .endRendererConfig().build()); + } +} diff --git a/src/test/java/org/apache/fop/config/FontMetricsUrlMalformedTestCase.java b/src/test/java/org/apache/fop/config/FontMetricsUrlMalformedTestCase.java new file mode 100644 index 000000000..11538dc33 --- /dev/null +++ b/src/test/java/org/apache/fop/config/FontMetricsUrlMalformedTestCase.java @@ -0,0 +1,44 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.config; + +import java.io.IOException; + +import org.xml.sax.SAXException; + +import org.apache.fop.apps.FopConfBuilder; +import org.apache.fop.apps.PDFRendererConfBuilder; + +/** + * this font has a malformed metrics-url + */ +public class FontMetricsUrlMalformedTestCase extends BaseDestructiveUserConfigTest { + + public FontMetricsUrlMalformedTestCase() throws SAXException, IOException { + super(new FopConfBuilder().setStrictValidation(true) + .startRendererConfig(PDFRendererConfBuilder.class) + .startFontsConfig() + .startFont("badprotocol:test/glb12.ttf.xml", null) + .addTriplet("Gladiator", "normal", "normal") + .endFont() + .endFontConfig() + .endRendererConfig().build()); + } +} diff --git a/src/test/java/org/apache/fop/config/FontTripletAttributeMissingTestCase.java b/src/test/java/org/apache/fop/config/FontTripletAttributeMissingTestCase.java new file mode 100644 index 000000000..4bacc180c --- /dev/null +++ b/src/test/java/org/apache/fop/config/FontTripletAttributeMissingTestCase.java @@ -0,0 +1,44 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.config; + +import java.io.IOException; + +import org.xml.sax.SAXException; + +import org.apache.fop.apps.FopConfBuilder; +import org.apache.fop.apps.PDFRendererConfBuilder; + +/** + * this font has a missing font triplet attribute + */ +public class FontTripletAttributeMissingTestCase extends BaseDestructiveUserConfigTest { + + public FontTripletAttributeMissingTestCase() throws SAXException, IOException { + super(new FopConfBuilder().setStrictValidation(true) + .startRendererConfig(PDFRendererConfBuilder.class) + .startFontsConfig() + .startFont(null, "test/resources/fonts/ttf/glb12.ttf") + .addTriplet("Gladiator", null, "normal") + .endFont() + .endFontConfig() + .endRendererConfig().build()); + } +} diff --git a/src/test/java/org/apache/fop/config/FontsAutoDetectTestCase.java b/src/test/java/org/apache/fop/config/FontsAutoDetectTestCase.java new file mode 100644 index 000000000..e05e44ab1 --- /dev/null +++ b/src/test/java/org/apache/fop/config/FontsAutoDetectTestCase.java @@ -0,0 +1,38 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.config; + +import java.io.IOException; + +import org.xml.sax.SAXException; + +import org.apache.fop.apps.FopConfBuilder; +import org.apache.fop.apps.PDFRendererConfBuilder; + +public class FontsAutoDetectTestCase extends BaseConstructiveUserConfigTest { + + public FontsAutoDetectTestCase() throws SAXException, IOException { + super(new FopConfBuilder().startRendererConfig(PDFRendererConfBuilder.class) + .startFontsConfig() + .addAutoDetect() + .endFontConfig() + .endRendererConfig().build()); + } +} diff --git a/src/test/java/org/apache/fop/config/FontsDirectoryRecursiveTestCase.java b/src/test/java/org/apache/fop/config/FontsDirectoryRecursiveTestCase.java new file mode 100644 index 000000000..aab7a2e7c --- /dev/null +++ b/src/test/java/org/apache/fop/config/FontsDirectoryRecursiveTestCase.java @@ -0,0 +1,41 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.config; + +import java.io.IOException; + +import org.xml.sax.SAXException; + +import org.apache.fop.apps.FopConfBuilder; +import org.apache.fop.apps.PDFRendererConfBuilder; + +/** + * tests font directory on system + */ +public class FontsDirectoryRecursiveTestCase extends BaseConstructiveUserConfigTest { + + public FontsDirectoryRecursiveTestCase() throws SAXException, IOException { + super(new FopConfBuilder().startRendererConfig(PDFRendererConfBuilder.class) + .startFontsConfig() + .addDirectory("test/resources/fonts", true) + .endFontConfig() + .endRendererConfig().build()); + } +} diff --git a/src/test/java/org/apache/fop/config/FontsSubstitutionTestCase.java b/src/test/java/org/apache/fop/config/FontsSubstitutionTestCase.java new file mode 100644 index 000000000..1ac79e353 --- /dev/null +++ b/src/test/java/org/apache/fop/config/FontsSubstitutionTestCase.java @@ -0,0 +1,83 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.config; + +import java.io.File; +import java.io.IOException; + +import org.xml.sax.SAXException; + +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.apps.FopConfBuilder; +import org.apache.fop.apps.MimeConstants; +import org.apache.fop.apps.PDFRendererConfBuilder; +import org.apache.fop.fonts.CustomFontCollection; +import org.apache.fop.fonts.Font; +import org.apache.fop.fonts.FontCollection; +import org.apache.fop.fonts.FontInfo; +import org.apache.fop.fonts.FontManager; +import org.apache.fop.fonts.FontTriplet; +import org.apache.fop.fonts.base14.Base14FontCollection; +import org.apache.fop.render.PrintRenderer; + +/** + * Tests the font substitution mechanism + */ +public class FontsSubstitutionTestCase extends BaseConstructiveUserConfigTest { + + public FontsSubstitutionTestCase() throws SAXException, IOException { + super(new FopConfBuilder() + .startFontsConfig() + .substituteFonts("Times", "italic", null, "Gladiator", "normal", "bold") + .endFontsConfig() + .startRendererConfig(PDFRendererConfBuilder.class) + .startFontsConfig() + .startFont(null, "resources/fonts/ttf/glb12.ttf") + .addTriplet("Gladiator", "normal", "bold") + .endFont() + .endFontConfig() + .endRendererConfig().build()); + } + + @Override + protected byte[] convertFO(File foFile, FOUserAgent ua, boolean dumpPdfFile) + throws Exception { + PrintRenderer renderer = (PrintRenderer) ua.getRendererFactory() + .createRenderer(ua, MimeConstants.MIME_PDF); + FontInfo fontInfo = new FontInfo(); + renderer.setupFontInfo(fontInfo); + FontManager fontManager = ua.getFontManager(); + FontCollection[] fontCollections = new FontCollection[] { + new Base14FontCollection(fontManager.isBase14KerningEnabled()), + new CustomFontCollection(fontManager.getResourceResolver(), renderer.getFontList(), + ua.isComplexScriptFeaturesEnabled()) + }; + fontManager.setup(fontInfo, fontCollections); + FontTriplet triplet = new FontTriplet("Times", "italic", + Font.WEIGHT_NORMAL); + String internalFontKey = fontInfo.getInternalFontKey(triplet); + // Times italic should now be mapped to the 15th font (custom font) + // not the original base 14 (F6) + if (!"F15".equals(internalFontKey)) { + throw new Exception("font substitution failed :" + triplet); + } + return null; + } +} diff --git a/src/test/java/org/apache/fop/config/UserConfigTestSuite.java b/src/test/java/org/apache/fop/config/UserConfigTestSuite.java new file mode 100644 index 000000000..9cb5c4270 --- /dev/null +++ b/src/test/java/org/apache/fop/config/UserConfigTestSuite.java @@ -0,0 +1,40 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.config; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +/** + * Test suite for font configuration. + */ +@RunWith(Suite.class) +@SuiteClasses({ + FontAttributesMissingTestCase.class, + FontTripletAttributeMissingTestCase.class, + FontMetricsUrlBadTestCase.class, + FontMetricsUrlMalformedTestCase.class, + FontsDirectoryRecursiveTestCase.class, + FontsAutoDetectTestCase.class, + FontsSubstitutionTestCase.class +}) +public class UserConfigTestSuite { +} diff --git a/src/test/java/org/apache/fop/datatypes/URISpecificationTestCase.java b/src/test/java/org/apache/fop/datatypes/URISpecificationTestCase.java new file mode 100644 index 000000000..f6e2b02ba --- /dev/null +++ b/src/test/java/org/apache/fop/datatypes/URISpecificationTestCase.java @@ -0,0 +1,65 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.datatypes; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +/** + * Tests for URISpecification. + */ +public class URISpecificationTestCase { + + @Test + public void testGetURL() throws Exception { + String actual; + + actual = URISpecification.getURL("http://localhost/test"); + assertEquals("http://localhost/test", actual); + + actual = URISpecification.getURL("url(http://localhost/test)"); + assertEquals("http://localhost/test", actual); + + actual = URISpecification.getURL("url('http://localhost/test')"); + assertEquals("http://localhost/test", actual); + + actual = URISpecification.getURL("url(\"http://localhost/test\")"); + assertEquals("http://localhost/test", actual); + } + + @Test + public void testEscapeURI() throws Exception { + String actual; + + actual = URISpecification.escapeURI("http://localhost/test"); + assertEquals("http://localhost/test", actual); + + actual = URISpecification.escapeURI("http://localhost/test%20test"); + assertEquals("http://localhost/test%20test", actual); + + actual = URISpecification.escapeURI("http://localhost/test test"); + assertEquals("http://localhost/test%20test", actual); + + actual = URISpecification.escapeURI("http://localhost/test test.pdf#page=6"); + assertEquals("http://localhost/test%20test.pdf#page=6", actual); + } + +} diff --git a/src/test/java/org/apache/fop/events/BasicEventTestCase.java b/src/test/java/org/apache/fop/events/BasicEventTestCase.java new file mode 100644 index 000000000..39e3fec98 --- /dev/null +++ b/src/test/java/org/apache/fop/events/BasicEventTestCase.java @@ -0,0 +1,103 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.events; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import org.apache.fop.events.model.EventSeverity; + +public class BasicEventTestCase { + + @Test + public void testBasics() throws Exception { + + MyEventListener listener = new MyEventListener(); + + EventBroadcaster broadcaster = new DefaultEventBroadcaster(); + broadcaster.addEventListener(listener); + assertTrue(broadcaster.hasEventListeners()); + + Event ev = new Event(this, "123", EventSeverity.INFO, + Event.paramsBuilder() + .param("reason", "I'm tired") + .param("blah", new Integer(23)) + .build()); + broadcaster.broadcastEvent(ev); + + ev = listener.event; + assertNotNull(ev); + assertEquals("123", listener.event.getEventID()); + assertEquals(EventSeverity.INFO, listener.event.getSeverity()); + assertEquals("I'm tired", ev.getParam("reason")); + assertEquals(new Integer(23), ev.getParam("blah")); + + broadcaster.removeEventListener(listener); + assertFalse(broadcaster.hasEventListeners()); + + //Just check that there are no NPEs + broadcaster.broadcastEvent(ev); + } + + @Test + public void testEventProducer() throws Exception { + MyEventListener listener = new MyEventListener(); + + EventBroadcaster broadcaster = new DefaultEventBroadcaster(); + broadcaster.addEventListener(listener); + assertTrue(broadcaster.hasEventListeners()); + + + TestEventProducer producer = TestEventProducer.Provider.get(broadcaster); + producer.complain(this, "I'm tired", 23); + + Event ev = listener.event; + assertNotNull(ev); + assertEquals("org.apache.fop.events.TestEventProducer.complain", + listener.event.getEventID()); + assertEquals(EventSeverity.WARN, listener.event.getSeverity()); + assertEquals("I'm tired", ev.getParam("reason")); + assertEquals(new Integer(23), ev.getParam("blah")); + + broadcaster.removeEventListener(listener); + assertFalse(broadcaster.hasEventListeners()); + + //Just check that there are no NPEs + broadcaster.broadcastEvent(ev); + } + + private class MyEventListener implements EventListener { + + private Event event; + + public void processEvent(Event event) { + if (this.event != null) { + fail("Multiple events received"); + } + this.event = event; + } + } + +} diff --git a/src/test/java/org/apache/fop/events/EventChecker.java b/src/test/java/org/apache/fop/events/EventChecker.java new file mode 100644 index 000000000..c2d5fcfd6 --- /dev/null +++ b/src/test/java/org/apache/fop/events/EventChecker.java @@ -0,0 +1,59 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.events; + +import java.util.Map; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +/** + * Class that checks that an expected event is produced, and only this one. + */ +public class EventChecker implements EventListener { + + private final String expectedEventID; + + private final Map<String, Object> expectedParams; + + private boolean eventReceived; + + public EventChecker(String expectedEventID, Map<String, Object> expectedParams) { + this.expectedEventID = expectedEventID; + this.expectedParams = expectedParams; + } + + public void processEvent(Event event) { + // Always create the message to make sure there is no error in the formatting process + String id = event.getEventID(); + if (id.equals(expectedEventID)) { + eventReceived = true; + for (Map.Entry<String, Object> param : expectedParams.entrySet()) { + assertEquals(param.getValue(), event.getParam(param.getKey())); + } + } + } + + public void end() { + if (!eventReceived) { + fail("Did not receive expected event: " + expectedEventID); + } + } +} diff --git a/src/test/java/org/apache/fop/events/EventProcessingTestCase.java b/src/test/java/org/apache/fop/events/EventProcessingTestCase.java new file mode 100644 index 000000000..fb17c9c0c --- /dev/null +++ b/src/test/java/org/apache/fop/events/EventProcessingTestCase.java @@ -0,0 +1,161 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.events; + +import java.io.File; +import java.io.InputStream; +import java.net.URI; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +import javax.xml.transform.Result; +import javax.xml.transform.Source; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.sax.SAXResult; +import javax.xml.transform.stream.StreamSource; + +import org.junit.Test; + +import org.apache.commons.io.output.NullOutputStream; + +import org.apache.xmlgraphics.util.MimeConstants; + +import org.apache.fop.ResourceEventProducer; +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.apps.Fop; +import org.apache.fop.apps.FopFactory; +import org.apache.fop.area.AreaEventProducer; +import org.apache.fop.fo.FOValidationEventProducer; +import org.apache.fop.fo.flow.table.TableEventProducer; +import org.apache.fop.layoutmgr.BlockLevelEventProducer; +import org.apache.fop.layoutmgr.inline.InlineLevelEventProducer; + +/** + * Tests that the event notification system runs smoothly. + */ +public class EventProcessingTestCase { + + private final TransformerFactory tFactory = TransformerFactory.newInstance(); + private static final URI BASE_DIR; + public static final URI CONFIG_BASE_DIR; + static { + URI base = (new File(".")).toURI(); + BASE_DIR = base.resolve("test/events/"); + + /** The base directory of configuration files */ + CONFIG_BASE_DIR = base.resolve("test/config/"); + + } + + public void doTest(InputStream inStream, URI fopConf, String expectedEventID, String mimeType, + Map<String, Object> expectedParams) throws Exception { + EventChecker eventChecker = new EventChecker(expectedEventID, expectedParams); + FopFactory fopFactory; + if (fopConf != null) { + fopFactory = FopFactory.newInstance(new File(fopConf)); + } else { + fopFactory = FopFactory.newInstance(BASE_DIR); + } + + FOUserAgent userAgent = fopFactory.newFOUserAgent(); + + userAgent.getEventBroadcaster().addEventListener(eventChecker); + Fop fop = fopFactory.newFop(mimeType, userAgent, new NullOutputStream()); + Transformer transformer = tFactory.newTransformer(); + Source src = new StreamSource(inStream); + Result res = new SAXResult(fop.getDefaultHandler()); + transformer.transform(src, res); + eventChecker.end(); + + } + + public void doTest(InputStream inStream, URI fopConf, String expectedEventID, String mimeType) + throws Exception { + Map<String, Object> noParams = Collections.emptyMap(); + doTest(inStream, fopConf, expectedEventID, mimeType, noParams); + } + + public void doTest(String filename, String expectedEventID, Map<String, Object> expectedParams) + throws Exception { + doTest(BASE_DIR.resolve(filename).toURL().openStream(), null, expectedEventID, + MimeConstants.MIME_PDF, expectedParams); + } + + public void doTest(String filename, String expectedEventID) throws Exception { + doTest(BASE_DIR.resolve(filename).toURL().openStream(), null, expectedEventID, + MimeConstants.MIME_PDF); + } + + @Test + public void testArea() throws Exception { + doTest("area.fo", + AreaEventProducer.class.getName() + ".unresolvedIDReferenceOnPage"); + } + + @Test + public void testResource() throws Exception { + doTest("resource.fo", + ResourceEventProducer.class.getName() + ".imageNotFound"); + } + + @Test + public void testValidation() throws Exception { + doTest("validation.fo", + FOValidationEventProducer.class.getName() + ".invalidPropertyValue"); + } + + @Test + public void testTable() throws Exception { + doTest("table.fo", + TableEventProducer.class.getName() + ".noTablePaddingWithCollapsingBorderModel"); + } + + @Test + public void testBlockLevel() throws Exception { + doTest("block-level.fo", + BlockLevelEventProducer.class.getName() + ".overconstrainedAdjustEndIndent"); + } + + @Test + public void testInlineLevel() throws Exception { + doTest("inline-level.fo", + InlineLevelEventProducer.class.getName() + ".lineOverflows"); + } + + @Test + public void testViewportIPDOverflow() throws Exception { + doTest("viewport-overflow.fo", BlockLevelEventProducer.class.getName() + ".viewportIPDOverflow"); + } + + @Test + public void testViewportBPDOverflow() throws Exception { + doTest("viewport-overflow.fo", BlockLevelEventProducer.class.getName() + ".viewportBPDOverflow"); + } + + @Test + public void testPageOverflow() throws Exception { + Map<String, Object> params = new HashMap<String, Object>(); + params.put("page", "1"); + doTest("region-body_overflow.fo", BlockLevelEventProducer.class.getName() + ".regionOverflow", + params); + } +} diff --git a/src/test/java/org/apache/fop/events/FlowNamedNotMappedTestCase.java b/src/test/java/org/apache/fop/events/FlowNamedNotMappedTestCase.java new file mode 100644 index 000000000..802c97450 --- /dev/null +++ b/src/test/java/org/apache/fop/events/FlowNamedNotMappedTestCase.java @@ -0,0 +1,80 @@ +/* + * 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. + */ + +/* $Id$ */ +package org.apache.fop.events; + +import java.io.File; +import java.io.FileInputStream; +import java.util.Map; + +import javax.xml.transform.Source; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.sax.SAXResult; +import javax.xml.transform.stream.StreamSource; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import org.apache.commons.io.output.NullOutputStream; + +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.apps.Fop; +import org.apache.fop.apps.FopFactory; +import org.apache.fop.apps.MimeConstants; +import org.apache.fop.fo.FOValidationEventProducer; + +public class FlowNamedNotMappedTestCase { + + + private static class FlowNameNotMappedEventChecker implements EventListener { + private final String personalID = FOValidationEventProducer.class.getName() + ".flowNameNotMapped"; + + public void processEvent(Event event) { + Map<String, Object> t = event.getParams(); + assertEquals("fo:flow", event.getParam("elementName")); + assertEquals("ContentPage_Body", event.getParam("flowName")); + assertEquals(personalID, event.getEventID()); + } + } + + @Test + public void testFlowNamedNotMapped() throws Exception { + FlowNameNotMappedEventChecker flowChecker; + Fop fop; + FopFactory fopFactory = FopFactory.newInstance(new File(".").toURI()); + FOUserAgent userAgent = fopFactory.newFOUserAgent(); + flowChecker = new FlowNameNotMappedEventChecker(); + userAgent.getEventBroadcaster().addEventListener(flowChecker); + fop = fopFactory.newFop(MimeConstants.MIME_PDF, userAgent, new NullOutputStream()); + Source src = new StreamSource(new FileInputStream("test/events/flowNameNotMapped.fo")); + SAXResult res = new SAXResult(fop.getDefaultHandler()); + Transformer transformer = TransformerFactory.newInstance().newTransformer(); + String expected = "on fo:flow could not be mapped to a region-name in the layout-master-set."; + String test = ""; + try { + transformer.transform(src, res); + } catch (TransformerException te) { + test = te.getLocalizedMessage(); + } + assertTrue(test.contains(expected)); + } +} diff --git a/src/test/java/org/apache/fop/events/TestEventProducer.java b/src/test/java/org/apache/fop/events/TestEventProducer.java new file mode 100644 index 000000000..ff19c7ea6 --- /dev/null +++ b/src/test/java/org/apache/fop/events/TestEventProducer.java @@ -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. + */ + +/* $Id$ */ + +package org.apache.fop.events; + +public interface TestEventProducer extends EventProducer { + + /** + * Complain about something. + * @param source the event source + * @param reason the reason for the complaint + * @param blah the complaint + * @event.severity WARN + */ + void complain(Object source, String reason, int blah); + + /** + * Express joy about something. + * @param source the event source + * @param what the cause for the joy + * @event.severity INFO + */ + void enjoy(Object source, String what); + + public static final class Provider { + + private Provider() { + } + + public static TestEventProducer get(EventBroadcaster broadcaster) { + return (TestEventProducer)broadcaster.getEventProducerFor(TestEventProducer.class); + } + } + +} diff --git a/src/test/java/org/apache/fop/fo/DelegatingFOEventHandlerTestCase.java b/src/test/java/org/apache/fop/fo/DelegatingFOEventHandlerTestCase.java new file mode 100644 index 000000000..226c551fb --- /dev/null +++ b/src/test/java/org/apache/fop/fo/DelegatingFOEventHandlerTestCase.java @@ -0,0 +1,531 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fo; + +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; + +import javax.xml.transform.Result; +import javax.xml.transform.Source; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.sax.SAXResult; +import javax.xml.transform.stream.StreamSource; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; +import org.xml.sax.helpers.DefaultHandler; + +import static org.junit.Assert.assertArrayEquals; + +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.fo.FODocumentParser.FOEventHandlerFactory; +import org.apache.fop.fo.flow.BasicLink; +import org.apache.fop.fo.flow.Block; +import org.apache.fop.fo.flow.BlockContainer; +import org.apache.fop.fo.flow.Character; +import org.apache.fop.fo.flow.ExternalGraphic; +import org.apache.fop.fo.flow.Footnote; +import org.apache.fop.fo.flow.FootnoteBody; +import org.apache.fop.fo.flow.Inline; +import org.apache.fop.fo.flow.InstreamForeignObject; +import org.apache.fop.fo.flow.Leader; +import org.apache.fop.fo.flow.ListBlock; +import org.apache.fop.fo.flow.ListItem; +import org.apache.fop.fo.flow.ListItemBody; +import org.apache.fop.fo.flow.ListItemLabel; +import org.apache.fop.fo.flow.PageNumber; +import org.apache.fop.fo.flow.PageNumberCitation; +import org.apache.fop.fo.flow.PageNumberCitationLast; +import org.apache.fop.fo.flow.Wrapper; +import org.apache.fop.fo.flow.table.Table; +import org.apache.fop.fo.flow.table.TableBody; +import org.apache.fop.fo.flow.table.TableCell; +import org.apache.fop.fo.flow.table.TableColumn; +import org.apache.fop.fo.flow.table.TableFooter; +import org.apache.fop.fo.flow.table.TableHeader; +import org.apache.fop.fo.flow.table.TableRow; +import org.apache.fop.fo.pagination.Flow; +import org.apache.fop.fo.pagination.PageSequence; +import org.apache.fop.fo.pagination.Root; +import org.apache.fop.fo.pagination.StaticContent; + +/** + * Tests that {@link DelegatingFOEventHandler} does forward every event to its delegate + * event handler. + */ +public class DelegatingFOEventHandlerTestCase { + + private InputStream document; + + private List<String> expectedEvents; + + private List<String> actualEvents; + + private FODocumentParser documentParser; + + private class DelegatingFOEventHandlerTester extends FOEventHandler { + + DelegatingFOEventHandlerTester(FOUserAgent foUserAgent) { + super(foUserAgent); + } + + private final StringBuilder eventBuilder = new StringBuilder(); + + @Override + public void startDocument() throws SAXException { + actualEvents.add("start document"); + } + + @Override + public void endDocument() throws SAXException { + actualEvents.add("end document"); + } + + @Override + public void startRoot(Root root) { + startElement(root); + } + + @Override + public void endRoot(Root root) { + endElement(root); + } + + @Override + public void startPageSequence(PageSequence pageSeq) { + startElement(pageSeq); + } + + @Override + public void endPageSequence(PageSequence pageSeq) { + endElement(pageSeq); + } + + @Override + public void startPageNumber(PageNumber pagenum) { + startElement(pagenum); + } + + @Override + public void endPageNumber(PageNumber pagenum) { + endElement(pagenum); + } + + @Override + public void startPageNumberCitation(PageNumberCitation pageCite) { + startElement(pageCite); + } + + @Override + public void endPageNumberCitation(PageNumberCitation pageCite) { + endElement(pageCite); + } + + @Override + public void startPageNumberCitationLast(PageNumberCitationLast pageLast) { + startElement(pageLast); + } + + @Override + public void endPageNumberCitationLast(PageNumberCitationLast pageLast) { + endElement(pageLast); + } + + @Override + public void startFlow(Flow fl) { + startElement(fl); + } + + @Override + public void endFlow(Flow fl) { + endElement(fl); + } + + @Override + public void startBlock(Block bl) { + startElement(bl); + } + + @Override + public void endBlock(Block bl) { + endElement(bl); + } + + @Override + public void startBlockContainer(BlockContainer blc) { + startElement(blc); + } + + @Override + public void endBlockContainer(BlockContainer blc) { + endElement(blc); + } + + @Override + public void startInline(Inline inl) { + startElement(inl); + } + + @Override + public void endInline(Inline inl) { + endElement(inl); + } + + @Override + public void startTable(Table tbl) { + startElement(tbl); + } + + @Override + public void endTable(Table tbl) { + endElement(tbl); + } + + @Override + public void startColumn(TableColumn tc) { + startElement(tc); + } + + @Override + public void endColumn(TableColumn tc) { + endElement(tc); + } + + @Override + public void startHeader(TableHeader header) { + startElement(header); + } + + @Override + public void endHeader(TableHeader header) { + endElement(header); + } + + @Override + public void startFooter(TableFooter footer) { + startElement(footer); + } + + @Override + public void endFooter(TableFooter footer) { + endElement(footer); + } + + @Override + public void startBody(TableBody body) { + startElement(body); + } + + @Override + public void endBody(TableBody body) { + endElement(body); + } + + @Override + public void startRow(TableRow tr) { + startElement(tr); + } + + @Override + public void endRow(TableRow tr) { + endElement(tr); + } + + @Override + public void startCell(TableCell tc) { + startElement(tc); + } + + @Override + public void endCell(TableCell tc) { + endElement(tc); + } + + @Override + public void startList(ListBlock lb) { + startElement(lb); + } + + @Override + public void endList(ListBlock lb) { + endElement(lb); + } + + @Override + public void startListItem(ListItem li) { + startElement(li); + } + + @Override + public void endListItem(ListItem li) { + endElement(li); + } + + @Override + public void startListLabel(ListItemLabel listItemLabel) { + startElement(listItemLabel); + } + + @Override + public void endListLabel(ListItemLabel listItemLabel) { + endElement(listItemLabel); + } + + @Override + public void startListBody(ListItemBody listItemBody) { + startElement(listItemBody); + } + + @Override + public void endListBody(ListItemBody listItemBody) { + endElement(listItemBody); + } + + @Override + public void startStatic(StaticContent staticContent) { + startElement(staticContent); + } + + @Override + public void endStatic(StaticContent statisContent) { + endElement(statisContent); + } + + @Override + public void startLink(BasicLink basicLink) { + startElement(basicLink); + } + + @Override + public void endLink(BasicLink basicLink) { + endElement(basicLink); + } + + @Override + public void image(ExternalGraphic eg) { + startElement(eg); + endElement(eg); + } + + @Override + public void startInstreamForeignObject(InstreamForeignObject ifo) { + startElement(ifo); + } + + @Override + public void endInstreamForeignObject(InstreamForeignObject ifo) { + endElement(ifo); + } + + @Override + public void startFootnote(Footnote footnote) { + startElement(footnote); + } + + @Override + public void endFootnote(Footnote footnote) { + endElement(footnote); + } + + @Override + public void startFootnoteBody(FootnoteBody body) { + startElement(body); + } + + @Override + public void endFootnoteBody(FootnoteBody body) { + endElement(body); + } + + @Override + public void startLeader(Leader l) { + startElement(l); + } + + @Override + public void endLeader(Leader l) { + endElement(l); + } + + @Override + public void startWrapper(Wrapper wrapper) { + startElement(wrapper); + } + + @Override + public void endWrapper(Wrapper wrapper) { + endElement(wrapper); + } + + @Override + public void character(Character c) { + startElement(c); + endElement(c); + } + + private void startElement(FObj node) { + addEvent("start ", node); + } + + private void endElement(FObj node) { + addEvent("end ", node); + } + + private void addEvent(String event, FObj node) { + eventBuilder.append(event); + eventBuilder.append(node.getLocalName()); + addID(node); + actualEvents.add(eventBuilder.toString()); + eventBuilder.setLength(0); + } + + private void addID(FObj node) { + String id = node.getId(); + if (id != null && id.length() > 0) { + eventBuilder.append(" id=\""); + eventBuilder.append(id); + eventBuilder.append("\""); + } + } + } + + @Before + public void setUp() throws IOException { + setUpEvents(); + loadDocument(); + createDocumentParser(); + } + + private void setUpEvents() throws IOException { + loadDocument(); + loadExpectedEvents(); + actualEvents = new ArrayList<String>(expectedEvents.size()); + } + + private void loadDocument() { + document = getClass().getResourceAsStream("complete_document.fo"); + } + + private void loadExpectedEvents() throws IOException { + expectedEvents = new ArrayList<String>(); + InputStream xslt = getClass().getResourceAsStream("extract-events.xsl"); + try { + runXSLT(xslt); + } finally { + closeStream(xslt); + closeStream(document); + } + } + + private void runXSLT(InputStream xslt) { + Transformer transformer = createTransformer(xslt); + Source fo = new StreamSource(document); + Result result = createTransformOutputHandler(); + try { + transformer.transform(fo, result); + } catch (TransformerException e) { + throw new RuntimeException(e); + } + } + + private Transformer createTransformer(InputStream xslt) { + TransformerFactory transformerFactory = TransformerFactory.newInstance(); + try { + return transformerFactory.newTransformer(new StreamSource(xslt)); + } catch (TransformerConfigurationException e) { + throw new RuntimeException(e); + } + } + + private Result createTransformOutputHandler() { + return new SAXResult(new DefaultHandler() { + + private final StringBuilder event = new StringBuilder(); + + @Override + public void startElement(String uri, String localName, String qName, + Attributes attributes) throws SAXException { + event.setLength(0); + } + + @Override + public void characters(char[] ch, int start, int length) throws SAXException { + event.append(ch, start, length); + } + + @Override + public void endElement(String uri, String localName, String qName) throws SAXException { + expectedEvents.add(event.toString()); + } + + }); + } + + private void closeStream(InputStream stream) { + try { + stream.close(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + private void createDocumentParser() { + documentParser = FODocumentParser.newInstance(new FOEventHandlerFactory() { + + public FOEventHandler newFOEventHandler(FOUserAgent foUserAgent) { + return new DelegatingFOEventHandler( + new DelegatingFOEventHandlerTester(foUserAgent)) { + }; + } + }); + } + + @Test + public void testFOEventHandler() throws Exception { + documentParser.parse(document); + assertArrayEquals(expectedEvents.toArray(), actualEvents.toArray()); + } + + @After + public void unloadDocument() throws IOException { + document.close(); + } + + /** + * Prints the given list to {@code System.out}, each element on a new line. For + * debugging purpose. + * + * @param list a list + */ + public void printList(List<?> list) { + for (Object element : list) { + System.out.println(element); + } + } + +} diff --git a/src/test/java/org/apache/fop/fo/FODocumentParser.java b/src/test/java/org/apache/fop/fo/FODocumentParser.java new file mode 100644 index 000000000..2e691519b --- /dev/null +++ b/src/test/java/org/apache/fop/fo/FODocumentParser.java @@ -0,0 +1,162 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fo; + +import java.io.File; +import java.io.InputStream; + +import javax.xml.transform.Result; +import javax.xml.transform.Source; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.sax.SAXResult; +import javax.xml.transform.stream.StreamSource; + +import org.apache.fop.apps.FOPException; +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.apps.Fop; +import org.apache.fop.apps.FopFactory; +import org.apache.fop.events.EventListener; + +/** + * Parse an FO document and run the corresponding FO events through a given + * {@link FOEventHandler} instance. That instance is created using the helper + * {@link FOEventHandlerFactory}. + * + * <p>An instance of this class may not be used in multiple threads concurrently.<p> + * + * <p>An instance of this class may be used multiple times if the given + * {@link FOEventHandler} implementation can be used multiple times. + */ +public final class FODocumentParser { + + private static final TransformerFactory TRANSFORMER_FACTORY = TransformerFactory.newInstance(); + + private static final FopFactory FOP_FACTORY = FopFactory.newInstance(new File(".").toURI()); + + private final FOEventHandlerFactory foEventHandlerFactory; + + private Fop fop; + + private Transformer transformer; + + private EventListener eventListener; + + /** + * A factory to create custom instances of {@link FOEventHandler}. + */ + public interface FOEventHandlerFactory { + + /** + * Creates a new {@code FOEventHandler} instance parameterized with the given FO user agent. + * + * @param foUserAgent an FO user agent + * @return a new {@code FOEventHandler} instance + */ + FOEventHandler newFOEventHandler(FOUserAgent foUserAgent); + } + + private FODocumentParser(FOEventHandlerFactory foeEventHandlerFactory) { + this.foEventHandlerFactory = foeEventHandlerFactory; + } + + /** + * Creates and returns a new FO document parser. The given factory will be used to + * customize the handler that will receive FO events, using the + * {@link FOUserAgent#setFOEventHandlerOverride(FOEventHandler)} method. + * + * @param foEventHandlerFactory the factory to be used to create {@code + * FOEventHandler} instances + * @return a new parser + */ + public static FODocumentParser newInstance(FOEventHandlerFactory foEventHandlerFactory) { + return new FODocumentParser(foEventHandlerFactory); + } + + /** + * Sets the event listener to be used if events occurs when parsing the document. + * + * @param eventListener an event listener + */ + public void setEventListener(EventListener eventListener) { + this.eventListener = eventListener; + } + + /** + * Runs FOP on the given document. + * + * @param document XSL-FO document to parse + * @throws FOPException if an error occurs when initializing FOP + * @throws LoadingException if an error occurs when parsing the document + */ + public void parse(InputStream document) throws FOPException, LoadingException { + parse(document, createFOUserAgent()); + } + + /** + * Runs FOP on the given document with the supplied {@link FOUserAgent}. + * + * @param document XSL-FO document to parse + * @param foUserAgent The user agent + * @throws FOPException if an error occurs when initializing FOP + * @throws LoadingException if an error occurs when parsing the document + */ + public void parse(InputStream document, FOUserAgent foUserAgent) + throws FOPException, LoadingException { + fop = FOP_FACTORY.newFop(foUserAgent); + createTransformer(); + runTransformer(document); + } + + /** + * Creates a new {@link FOUserAgent}. + * @return It + */ + public FOUserAgent createFOUserAgent() { + FOUserAgent userAgent = FOP_FACTORY.newFOUserAgent(); + FOEventHandler foEventHandler = foEventHandlerFactory.newFOEventHandler(userAgent); + userAgent.setFOEventHandlerOverride(foEventHandler); + if (eventListener != null) { + userAgent.getEventBroadcaster().addEventListener(eventListener); + } + return userAgent; + } + + private void createTransformer() { + try { + transformer = TRANSFORMER_FACTORY.newTransformer(); + } catch (TransformerConfigurationException e) { + throw new RuntimeException(e); + } + } + + private void runTransformer(InputStream input) throws LoadingException, FOPException { + Source source = new StreamSource(input); + Result result = new SAXResult(fop.getDefaultHandler()); + try { + transformer.transform(source, result); + } catch (TransformerException e) { + Throwable cause = e.getCause(); + throw new LoadingException(cause == null ? e : cause); + } + } +} diff --git a/src/test/java/org/apache/fop/fo/FONodeMocks.java b/src/test/java/org/apache/fop/fo/FONodeMocks.java new file mode 100644 index 000000000..97889c177 --- /dev/null +++ b/src/test/java/org/apache/fop/fo/FONodeMocks.java @@ -0,0 +1,99 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fo; + +import java.io.IOException; + +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import org.apache.xmlgraphics.image.loader.ImageException; +import org.apache.xmlgraphics.image.loader.ImageManager; +import org.apache.xmlgraphics.image.loader.ImageSessionContext; + +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.events.EventBroadcaster; +import org.apache.fop.fo.flow.table.ColumnNumberManager; +import org.apache.fop.fo.flow.table.ColumnNumberManagerHolder; + +/** + * A helper class for creating mocks of {@link FONode} and its descendants. + */ +public final class FONodeMocks { + + private FONodeMocks() { } + + /** + * Creates and returns a mock {@link FONode} configured with a mock + * {@link FOEventHandler}. The FO event handler returns a mock {@link FOUserAgent}, + * which in turn returns a mock {@link org.apache.fop.apps.FopFactory}, which returns a mock + * {@link ImageManager}. + * + * @return a mock FO node + */ + public static FONode mockFONode() { + FONode mockFONode = mock(FONode.class); + mockGetFOEventHandler(mockFONode); + mockGetImageManager(mockFONode.getFOEventHandler().getUserAgent()); + return mockFONode; + } + + public static FOEventHandler mockGetFOEventHandler(FONode mockFONode) { + FOEventHandler mockFOEventHandler = mock(FOEventHandler.class); + mockGetUserAgent(mockFOEventHandler); + when(mockFONode.getFOEventHandler()).thenReturn(mockFOEventHandler); + return mockFOEventHandler; + } + + public static FOUserAgent mockGetUserAgent(FOEventHandler mockFOEventHandler) { + FOUserAgent mockFOUserAgent = mock(FOUserAgent.class); + when(mockFOEventHandler.getUserAgent()).thenReturn(mockFOUserAgent); + return mockFOUserAgent; + } + + public static EventBroadcaster mockGetEventBroadcaster(FOUserAgent mockFOUserAgent) { + EventBroadcaster mockBroadcaster = mock(EventBroadcaster.class); + when(mockFOUserAgent.getEventBroadcaster()).thenReturn(mockBroadcaster); + return mockBroadcaster; + } + + public static ImageManager mockGetImageManager(FOUserAgent mockFOUserAgent) { + try { + ImageManager mockImageManager = mock(ImageManager.class); + when(mockImageManager.getImageInfo(anyString(), any(ImageSessionContext.class))) + .thenReturn(null); + when(mockFOUserAgent.getImageManager()).thenReturn(mockImageManager); + return mockImageManager; + } catch (ImageException e) { + throw new RuntimeException(e); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public static ColumnNumberManager mockGetColumnNumberManager(ColumnNumberManagerHolder mock) { + ColumnNumberManager mockColumnNumberManager = mock(ColumnNumberManager.class); + when(mock.getColumnNumberManager()).thenReturn(mockColumnNumberManager); + return mockColumnNumberManager; + } + +} diff --git a/src/test/java/org/apache/fop/fo/LoadingException.java b/src/test/java/org/apache/fop/fo/LoadingException.java new file mode 100644 index 000000000..a5d509209 --- /dev/null +++ b/src/test/java/org/apache/fop/fo/LoadingException.java @@ -0,0 +1,34 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fo; + +/** + * This class specifies an exceptional condition that occurred while an XSL-FO document + * was being parsed. + */ +public class LoadingException extends Exception { + + private static final long serialVersionUID = 7529029475875542916L; + + LoadingException(Throwable cause) { + super(cause); + } + +} diff --git a/src/test/java/org/apache/fop/fo/complete_document.fo b/src/test/java/org/apache/fop/fo/complete_document.fo new file mode 100644 index 000000000..b103744ae --- /dev/null +++ b/src/test/java/org/apache/fop/fo/complete_document.fo @@ -0,0 +1,176 @@ +<?xml version="1.0" standalone="no"?> +<!-- + 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. +--> +<!-- $Id$ --> +<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" + xmlns:fox="http://xmlgraphics.apache.org/fop/extensions"> + + <fo:layout-master-set> + <fo:simple-page-master master-name="page" + page-height="400pt" page-width="300pt" margin="20pt" margin-top="10pt"> + <fo:region-body margin-top="20pt"/> + <fo:region-before extent="15pt"/> + </fo:simple-page-master> + </fo:layout-master-set> + + <fo:page-sequence master-reference="page"> + <fo:static-content flow-name="xsl-region-before"> + <fo:block id="1" font-size="7pt" text-align-last="justify" padding-bottom="2pt" + border-bottom="0.25pt solid black">This is the page header<fo:leader/>Page <fo:page-number + id="2"/></fo:block> + </fo:static-content> + <fo:static-content flow-name="xsl-footnote-separator"> + <fo:block id="3"><fo:leader leader-length="100pt" leader-pattern="rule"/></fo:block> + </fo:static-content> + <fo:flow flow-name="xsl-region-body"> + <fo:block id="4">This is a link to the <fo:wrapper id="5" color="blue"><fo:basic-link id="6" + internal-destination="second-start" fox:alt-text="">next page-sequence</fo:basic-link></fo:wrapper> + (which starts on page <fo:page-number-citation id="7" ref-id="second-start"/> and ends on + page <fo:page-number-citation-last id="8" ref-id="second-end"/>).</fo:block> + <fo:block id="9" font-family="sans-serif" font-weight="bold" space-before="1em" + space-after="0.2em" role="H1"><fo:block id="10">A Title Block</fo:block></fo:block> + <fo:block id="11">This block of text contains a footnote<fo:footnote id="12"><fo:inline id="13" + baseline-shift="super" font-size="70%">1</fo:inline><fo:footnote-body id="14"><fo:block + id="15">A footnote with a link to the <fo:wrapper id="16" color="blue"><fo:basic-link + id="17" external-destination="http://xmlgraphics.apache.org/fop/" fox:alt-text="">FOP + website</fo:basic-link></fo:wrapper></fo:block></fo:footnote-body></fo:footnote> + call.</fo:block> + <fo:table id="18" space-before="1em" width="100%" table-layout="fixed"> + <fo:table-column id="19" column-width="proportional-column-width(1)"/> + <fo:table-column id="20" column-width="proportional-column-width(2)"/> + <fo:table-header id="21"> + <fo:table-row id="22"> + <fo:table-cell id="23" border="2pt solid black" padding="2pt 2pt 0"> + <fo:block id="24">Header 1.1</fo:block> + </fo:table-cell> + <fo:table-cell id="25" border="2pt solid black" padding="2pt 2pt 0"> + <fo:block id="26">Header 1.2</fo:block> + </fo:table-cell> + </fo:table-row> + </fo:table-header> + <fo:table-footer id="27"> + <fo:table-row id="28"> + <fo:table-cell id="29" border="2pt solid black" padding="2pt 2pt 0"> + <fo:block id="30">Footer 1.1</fo:block> + </fo:table-cell> + <fo:table-cell id="31" border="2pt solid black" padding="2pt 2pt 0"> + <fo:block id="32">Footer 1.2</fo:block> + </fo:table-cell> + </fo:table-row> + </fo:table-footer> + <fo:table-body id="33"> + <fo:table-row id="34"> + <fo:table-cell id="35" border="1pt solid black" padding="2pt 2pt 0"> + <fo:block id="36">Cell 1.1</fo:block> + </fo:table-cell> + <fo:table-cell id="37" border="1pt solid black" padding="2pt 2pt 0"> + <fo:block id="38">Cell 1.2</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row id="39"> + <fo:table-cell id="40" border="1pt solid black" padding="2pt 2pt 0"> + <fo:block id="41">Cell 2.1</fo:block> + </fo:table-cell> + <fo:table-cell id="42" border="1pt solid black" padding="2pt 2pt 0"> + <fo:block id="43">Cell 2.2</fo:block> + </fo:table-cell> + </fo:table-row> + </fo:table-body> + </fo:table> + <fo:block-container id="44" space-before="1.2em"> + <fo:block-container id="45" absolute-position="absolute" top="6pt" right="2.5pt" + inline-progression-dimension="37%" padding="3pt 1pt 2pt 3pt" border="1.5pt solid + darkblue"> + <fo:block id="46" color="darkblue" font-size="80%">This is an absolutely positioned + block-container. Nullam interdum mattis ipsum sit amet molestie.</fo:block> + </fo:block-container> + <fo:block id="47" end-indent="37% + 15pt">Lorem ipsum dolor sit amet, consectetur adipiscing + elit. Integer vel lacinia diam. Etiam venenatis magna vel libero imperdiet + rhoncus.</fo:block> + </fo:block-container> + </fo:flow> + </fo:page-sequence> + + <fo:page-sequence master-reference="page"> + <fo:static-content id="48" flow-name="xsl-region-before"> + <fo:block id="49" font-size="7pt" text-align-last="justify" padding-bottom="2pt" + border-bottom="0.25pt solid black">This is the page header<fo:leader id="50"/>Page + <fo:page-number id="51"/></fo:block> + </fo:static-content> + <fo:flow flow-name="xsl-region-body" text-align="justify" space-before.minimum="8pt" + space-before.optimum="10pt" space-before.maximum="12pt"> + <fo:block id="second-start">Starting a new page-sequence.</fo:block> + <fo:block id="52" text-align="center">The <fo:external-graphic id="53" + src="test/resources/images/fop-logo-color-24bit.png" + inline-progression-dimension.maximum="50%" content-width="scale-to-fit" + alignment-adjust="-46%" alignment-baseline="middle" fox:alt-text="FOP Logo"/> + logo.</fo:block> + <fo:list-block id="54" provisional-distance-between-starts="15pt" + provisional-label-separation="0" space-before="inherit"> + <fo:list-item id="55"> + <fo:list-item-label id="56" end-indent="label-end()"> + <fo:block id="57">1.</fo:block> + </fo:list-item-label> + <fo:list-item-body id="58" start-indent="body-start()"> + <fo:block id="59">First item of a list</fo:block> + </fo:list-item-body> + </fo:list-item> + <fo:list-item id="60"> + <fo:list-item-label id="61" end-indent="label-end()"> + <fo:block id="62">2.</fo:block> + </fo:list-item-label> + <fo:list-item-body id="63" start-indent="body-start()"> + <fo:block id="64">Second item of a list</fo:block> + </fo:list-item-body> + </fo:list-item> + <fo:list-item id="65"> + <fo:list-item-label id="66" end-indent="label-end()"> + <fo:block id="67">3.</fo:block> + </fo:list-item-label> + <fo:list-item-body id="68" start-indent="body-start()"> + <fo:block id="69">Third item of a list</fo:block> + </fo:list-item-body> + </fo:list-item> + </fo:list-block> + <fo:block id="70" text-align="center"><fo:instream-foreign-object id="71" + inline-progression-dimension.maximum="50%" content-width="scale-to-fit" + fox:alt-text="An inline SVG"> + <svg xmlns="http://www.w3.org/2000/svg" width="319" height="286.6"> + <g style="fill-opacity:0.7; stroke:black; stroke-width:3" + transform="translate(0, 286.6) scale(1, -1) translate(100, 100)"> + <circle cx="50" cy="86.6" r="80" style="fill:red;"/> + <circle cx="0" cy="0" r="80" style="fill:green;"/> + <circle cx="100" cy="0" r="80" style="fill:blue;"/> + </g> + </svg> + </fo:instream-foreign-object></fo:block> + <fo:block id="72" space-before="inherit">A block containing an <fo:inline id="73" + border="0.5pt solid black" padding="2pt" padding-bottom="0">inline</fo:inline> + element.</fo:block> + <fo:block id="74" space-before="inherit">A block containing a fancy <fo:character id="75" + border="1pt solid black" padding="0 2pt 1pt 2pt" font-family="Symbol" character="♦"/> + character.</fo:block> + <fo:block id="76" space-before="inherit" text-align-last="justify">A leader with special + content: <fo:leader id="77" leader-pattern="use-content"><fo:inline id="78"><fo:character + id="79" character=" "/><fo:inline id="80" border="0.5pt solid black" + padding-left="2pt" padding-right="2pt"><fo:character id="81" baseline-shift="-10%" + character="•"/></fo:inline></fo:inline></fo:leader>.</fo:block> + <fo:block id="second-end" space-before="inherit">Ending the page-sequence.</fo:block> + </fo:flow> + </fo:page-sequence> + +</fo:root> diff --git a/src/test/java/org/apache/fop/fo/extract-events.xsl b/src/test/java/org/apache/fop/fo/extract-events.xsl new file mode 100644 index 000000000..eae794754 --- /dev/null +++ b/src/test/java/org/apache/fop/fo/extract-events.xsl @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:fo="http://www.w3.org/1999/XSL/Format" + exclude-result-prefixes="fo"> + + <xsl:output indent="yes" omit-xml-declaration="yes"/> + + <xsl:template match="/"> + <event> + <xsl:text>start document</xsl:text> + </event> + <xsl:apply-templates/> + <event> + <xsl:text>end document</xsl:text> + </event> + </xsl:template> + + <xsl:template match="fo:root"> + <event>start root</event> + <xsl:apply-templates select="fo:page-sequence"/> + <event>end root</event> + </xsl:template> + + <xsl:template match="fo:*"> + <xsl:call-template name="process.node"> + <xsl:with-param name="id"> + <xsl:apply-templates select="@id"/> + </xsl:with-param> + </xsl:call-template> + </xsl:template> + + <xsl:template name="process.node"> + <xsl:param name="id" select="''"/> + <event> + <xsl:text>start </xsl:text> + <xsl:value-of select="local-name()"/> + <xsl:value-of select="$id"/> + </event> + <xsl:apply-templates/> + <event> + <xsl:text>end </xsl:text> + <xsl:value-of select="local-name()"/> + <xsl:value-of select="$id"/> + </event> + </xsl:template> + + <xsl:template match="@id"> + <xsl:text> id="</xsl:text> + <xsl:value-of select="."/> + <xsl:text>"</xsl:text> + </xsl:template> + + <xsl:template match="text()"/> + +</xsl:stylesheet> diff --git a/src/test/java/org/apache/fop/fo/flow/MarkersTestCase.java b/src/test/java/org/apache/fop/fo/flow/MarkersTestCase.java new file mode 100644 index 000000000..09a4e129c --- /dev/null +++ b/src/test/java/org/apache/fop/fo/flow/MarkersTestCase.java @@ -0,0 +1,124 @@ +/* + * 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. + */ + +/* $Id:$ */ + +package org.apache.fop.fo.flow; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import org.apache.fop.fo.Constants; + +public class MarkersTestCase { + + @Test + public void testRegisterAndResolve() { + // consider 3 regions, and a boundary; the first region starts before the boundary and ends inside + // the boundary, the second region is fully inside the boundary, and the third region starts inside + // the boundary and ends after the boundary. in every region there are 2 markers, A and B. + // ======== region 1 + Map<String, Marker> markers_region_1 = new HashMap<String, Marker>(); + Marker marker_1A = mock(Marker.class); + Marker marker_1B = mock(Marker.class); + markers_region_1.put("A", marker_1A); + markers_region_1.put("B", marker_1B); + // ======== region 2 + Map<String, Marker> markers_region_2 = new HashMap<String, Marker>(); + Marker marker_2A = mock(Marker.class); + Marker marker_2B = mock(Marker.class); + markers_region_2.put("A", marker_2A); + markers_region_2.put("B", marker_2B); + // ======== region 3 + Map<String, Marker> markers_region_3 = new HashMap<String, Marker>(); + Marker marker_3A = mock(Marker.class); + Marker marker_3B = mock(Marker.class); + markers_region_3.put("A", marker_3A); + markers_region_3.put("B", marker_3B); + // instantiate markers for the boundary + Markers markers = new Markers(); + // register the markers for the different regions + // region 1 + markers.register(markers_region_1, true, false, true); + markers.register(markers_region_1, false, false, true); + // region 2 + markers.register(markers_region_2, true, true, true); + markers.register(markers_region_2, false, true, true); + // region 3 + markers.register(markers_region_3, true, true, false); + markers.register(markers_region_3, false, true, false); + // now prepare a RetrieveMarker + RetrieveMarker rm = mock(RetrieveMarker.class); + when(rm.getRetrieveClassName()).thenReturn("A"); + when(rm.getLocalName()).thenReturn("retrieve-marker"); + when(rm.getPositionLabel()).thenReturn("position-label"); // not relevant for the test + // and resolve the marker for different positions + // EN_FSWP + when(rm.getPosition()).thenReturn(Constants.EN_FSWP); + // expect marker_2A + assertEquals(marker_2A, markers.resolve(rm)); + // EN_LSWP + when(rm.getPosition()).thenReturn(Constants.EN_LSWP); + // expect marker_3A + assertEquals(marker_3A, markers.resolve(rm)); + // EN_LEWP + when(rm.getPosition()).thenReturn(Constants.EN_LEWP); + // expect marker_2A + assertEquals(marker_2A, markers.resolve(rm)); + // EN_FIC + when(rm.getPosition()).thenReturn(Constants.EN_FIC); + // expect marker_1A + assertEquals(marker_1A, markers.resolve(rm)); + // now prepare a RetrieveTableMarker + RetrieveTableMarker rtm = mock(RetrieveTableMarker.class); + when(rtm.getRetrieveClassName()).thenReturn("B"); + when(rtm.getLocalName()).thenReturn("retrieve-table-marker"); + when(rtm.getPositionLabel()).thenReturn("position-label"); // not relevant for the test + // and resolve the marker for different positions + // EN_FIRST_STARTING + when(rtm.getPosition()).thenReturn(Constants.EN_FIRST_STARTING); + // expect marker_2B + assertEquals(marker_2B, markers.resolve(rtm)); + // EN_LAST_STARTING + when(rtm.getPosition()).thenReturn(Constants.EN_LAST_STARTING); + // expect marker_3B + assertEquals(marker_3B, markers.resolve(rtm)); + // EN_LAST_ENDING + when(rtm.getPosition()).thenReturn(Constants.EN_LAST_ENDING); + // expect marker_2B + assertEquals(marker_2B, markers.resolve(rtm)); + // EN_FIRST_INCLUDING_CARRYOVER + when(rtm.getPosition()).thenReturn(Constants.EN_FIRST_INCLUDING_CARRYOVER); + // expect marker_1B + assertEquals(marker_1B, markers.resolve(rtm)); + // test also an invalid position + when(rm.getPosition()).thenReturn(Constants.EN_ABSOLUTE); + try { + Marker m = markers.resolve(rm); + fail("Expected an exception... instead got:" + m.toString()); + } catch (RuntimeException re) { + // do nothing + } + } +} diff --git a/src/test/java/org/apache/fop/fo/flow/table/AbstractTableTest.java b/src/test/java/org/apache/fop/fo/flow/table/AbstractTableTest.java new file mode 100644 index 000000000..0f0e347d3 --- /dev/null +++ b/src/test/java/org/apache/fop/fo/flow/table/AbstractTableTest.java @@ -0,0 +1,62 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fo.flow.table; + +import java.io.FileInputStream; +import java.util.Iterator; + +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.fo.FODocumentParser; +import org.apache.fop.fo.FODocumentParser.FOEventHandlerFactory; +import org.apache.fop.fo.FOEventHandler; +import org.apache.fop.util.ConsoleEventListenerForTests; + +/** + * Superclass for testcases related to tables, factoring the common stuff. + */ +abstract class AbstractTableTest { + + private FODocumentParser documentParser; + + private TableHandler tableHandler; + + protected void setUp(String filename) throws Exception { + createDocumentParser(); + documentParser.setEventListener(new ConsoleEventListenerForTests(filename)); + documentParser.parse(new FileInputStream("test/fotree/unittests/" + filename)); + } + + private void createDocumentParser() { + documentParser = FODocumentParser.newInstance(new FOEventHandlerFactory() { + public FOEventHandler newFOEventHandler(FOUserAgent foUserAgent) { + tableHandler = new TableHandler(foUserAgent); + return tableHandler; + } + }); + } + + protected TableHandler getTableHandler() { + return tableHandler; + } + + protected Iterator getTableIterator() { + return tableHandler.getTables().iterator(); + } +} diff --git a/src/test/java/org/apache/fop/fo/flow/table/AllTests.java b/src/test/java/org/apache/fop/fo/flow/table/AllTests.java new file mode 100644 index 000000000..d4b5e8f6f --- /dev/null +++ b/src/test/java/org/apache/fop/fo/flow/table/AllTests.java @@ -0,0 +1,37 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fo.flow.table; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +/** + * All test to be added in FOTreeTestSuite + * + */ +@RunWith(Suite.class) +@Suite.SuiteClasses({ + CollapsedConditionalBorderTestCase.class, + IllegalRowSpanTestCase.class, + RowGroupBuilderTestCase.class, + TableColumnColumnNumberTestCase.class, + TooManyColumnsTestCase.class }) +public final class AllTests { +} diff --git a/src/test/java/org/apache/fop/fo/flow/table/CollapsedConditionalBorderTestCase.java b/src/test/java/org/apache/fop/fo/flow/table/CollapsedConditionalBorderTestCase.java new file mode 100644 index 000000000..1362ad559 --- /dev/null +++ b/src/test/java/org/apache/fop/fo/flow/table/CollapsedConditionalBorderTestCase.java @@ -0,0 +1,218 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fo.flow.table; + +import java.awt.Color; +import java.util.Iterator; +import java.util.List; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +import org.apache.fop.fo.Constants; +import org.apache.fop.fo.FONode.FONodeIterator; +import org.apache.fop.fo.properties.CommonBorderPaddingBackground.BorderInfo; + +// CSOFF: LineLength + +/** + * A testcase for the resolution of collapsed borders in the FO tree, taking + * conditionality into account. The resolved borders are generated by the + * collapsed-conditional-borders_test-generator.py Python script. + */ +public class CollapsedConditionalBorderTestCase extends AbstractTableTest { + + private final Integer border0pt = new Integer(0); + + private final Integer border4pt = new Integer(4000); + + private final Integer border6pt = new Integer(6000); + + private final Integer border8pt = new Integer(8000); + + /** + * Resolved borders for tables without headers and footers, generated from the Python + * script. + */ + private Object[][][] resolvedBorders = { + {{border0pt, Color.black}, {border8pt, Color.black}}, + {{border6pt, Color.red}, {border6pt, Color.magenta}}, + {{border6pt, Color.blue}, {border6pt, Color.yellow}}, + {{border8pt, Color.black}, {border8pt, Color.black}}, + {{border8pt, Color.black}, {border8pt, Color.black}}, + {{border6pt, Color.red}, {border6pt, Color.magenta}}, + {{border8pt, Color.black}, {border8pt, Color.black}}, + {{border6pt, Color.red}, {border6pt, Color.blue}}, + {{border6pt, Color.magenta}, {border6pt, Color.blue}}, + {{border8pt, Color.black}, {border8pt, Color.black}}, + {{border6pt, Color.red}, {border6pt, Color.yellow}}, + {{border6pt, Color.magenta}, {border6pt, Color.yellow}}, + {{border6pt, Color.blue}, {border6pt, Color.yellow}}, + {{border8pt, Color.black}, {border8pt, Color.black}}, + {{border8pt, Color.black}, {border8pt, Color.black}}, + {{border8pt, Color.black}, {border8pt, Color.black}}, + {{border8pt, Color.black}, {border8pt, Color.black}}, + {{border8pt, Color.black}, {border6pt, Color.red}}, + {{border6pt, Color.magenta}, {border6pt, Color.blue}}, + {{border8pt, Color.black}, {border8pt, Color.black}}, + {{border8pt, Color.black}, {border8pt, Color.black}}, + {{border8pt, Color.black}, {border8pt, Color.black}}, + {{border6pt, Color.red}, {border6pt, Color.magenta}}, + {{border6pt, Color.yellow}, {border8pt, Color.black}}, + {{border8pt, Color.black}, {border8pt, Color.black}}, + {{border6pt, Color.red}, {border6pt, Color.blue}}, + {{border6pt, Color.yellow}, {border6pt, Color.magenta}}, + {{border6pt, Color.blue}, {border6pt, Color.yellow}}, + {{border8pt, Color.black}, {border8pt, Color.black}}, + {{border8pt, Color.black}, {border8pt, Color.black}}, + {{border8pt, Color.black}, {border8pt, Color.black}}, + {{border8pt, Color.black}, {border8pt, Color.black}}, + {{border8pt, Color.black}, {border8pt, Color.black}}, + {{border8pt, Color.black}, {border8pt, Color.black}}, + {{border8pt, Color.black}, {border8pt, Color.black}}, + {{border8pt, Color.black}, {border8pt, Color.black}}, + {{border6pt, Color.red}, {border6pt, Color.magenta}}, + {{border6pt, Color.blue}, {border6pt, Color.yellow}}, + {{border8pt, Color.black}, {border8pt, Color.black}}, + {{border8pt, Color.black}, {border8pt, Color.black}} + }; + + /** + * Resolved borders for tables with headers and footers, generated from the Python + * script. + */ + private Object[][][] resolvedBordersHF = { +{{border8pt, Color.black}, {border6pt, Color.black}, {border8pt, Color.black}, {border6pt, Color.black}, {border4pt, Color.black}, {border4pt, Color.black}, {border4pt, Color.red}, {border8pt, Color.blue}, {border6pt, Color.black}, {border4pt, Color.magenta}, {border8pt, Color.blue}, {border8pt, Color.blue}, {border4pt, Color.red}, {border4pt, Color.blue}, {border4pt, Color.blue}, {border4pt, Color.magenta}}, +{{border8pt, Color.black}, {border6pt, Color.blue}, {border8pt, Color.black}, {border6pt, Color.blue}, {border4pt, Color.black}, {border4pt, Color.black}, {border4pt, Color.red}, {border8pt, Color.blue}, {border6pt, Color.black}, {border6pt, Color.black}, {border8pt, Color.blue}, {border8pt, Color.blue}, {border4pt, Color.red}, {border4pt, Color.blue}, {border4pt, Color.blue}, {border4pt, Color.magenta}}, +{{border8pt, Color.black}, {border6pt, Color.blue}, {border8pt, Color.black}, {border6pt, Color.blue}, {border8pt, Color.red}, {border8pt, Color.red}, {border8pt, Color.red}, {border6pt, Color.blue}, {border4pt, Color.black}, {border4pt, Color.black}, {border6pt, Color.blue}, {border8pt, Color.red}, {border8pt, Color.red}, {border4pt, Color.blue}, {border4pt, Color.blue}, {border4pt, Color.magenta}}, +{{border8pt, Color.black}, {border6pt, Color.blue}, {border8pt, Color.black}, {border6pt, Color.blue}, {border8pt, Color.red}, {border8pt, Color.red}, {border8pt, Color.red}, {border6pt, Color.blue}, {border4pt, Color.black}, {border4pt, Color.magenta}, {border6pt, Color.blue}, {border8pt, Color.red}, {border8pt, Color.red}, {border4pt, Color.blue}, {border4pt, Color.blue}, {border4pt, Color.magenta}}, +{{border8pt, Color.black}, {border6pt, Color.black}, {border8pt, Color.black}, {border6pt, Color.black}, {border4pt, Color.black}, {border4pt, Color.black}, {border4pt, Color.red}, {border8pt, Color.black}, {border8pt, Color.black}, {border4pt, Color.magenta}, {border8pt, Color.black}, {border6pt, Color.blue}, {border4pt, Color.red}, {border4pt, Color.blue}, {border4pt, Color.blue}, {border4pt, Color.magenta}}, +{{border8pt, Color.black}, {border6pt, Color.blue}, {border8pt, Color.black}, {border6pt, Color.blue}, {border4pt, Color.black}, {border4pt, Color.black}, {border4pt, Color.red}, {border8pt, Color.black}, {border8pt, Color.black}, {border4pt, Color.magenta}, {border8pt, Color.black}, {border6pt, Color.blue}, {border6pt, Color.blue}, {border4pt, Color.blue}, {border4pt, Color.blue}, {border4pt, Color.magenta}}, +{{border8pt, Color.black}, {border6pt, Color.blue}, {border8pt, Color.black}, {border6pt, Color.blue}, {border4pt, Color.black}, {border4pt, Color.black}, {border4pt, Color.red}, {border6pt, Color.black}, {border8pt, Color.magenta}, {border8pt, Color.magenta}, {border6pt, Color.black}, {border4pt, Color.blue}, {border4pt, Color.red}, {border8pt, Color.magenta}, {border8pt, Color.magenta}, {border8pt, Color.magenta}}, +{{border8pt, Color.black}, {border6pt, Color.blue}, {border8pt, Color.black}, {border6pt, Color.blue}, {border4pt, Color.black}, {border4pt, Color.black}, {border4pt, Color.red}, {border8pt, Color.black}, {border8pt, Color.black}, {border8pt, Color.black}, {border8pt, Color.black}, {border4pt, Color.blue}, {border4pt, Color.red}, {border6pt, Color.magenta}, {border6pt, Color.magenta}, {border6pt, Color.magenta}} + }; + + private static GridUnit getGridUnit(TablePart part) { + return (GridUnit) ((List) ((List) part.getRowGroups().get(0)).get(0)).get(0); + } + + private static void checkBorder(String errorMsge, BorderSpecification border, + int expectedLength, Color expectedColor) { + BorderInfo borderInfo = border.getBorderInfo(); + if (expectedLength == 0) { + assertEquals(errorMsge, Constants.EN_NONE, borderInfo.getStyle()); + } else { + assertEquals(errorMsge, expectedLength, borderInfo.getWidth().getLengthValue()); + assertEquals(errorMsge, expectedColor, borderInfo.getColor()); + } + } + + private static void checkBorder(String errorMsge, BorderSpecification border, + Object[] resolvedBorder) { + checkBorder(errorMsge, border, + ((Integer) resolvedBorder[0]).intValue(), + (Color) resolvedBorder[1]); + } + + @Test + public void testCollapsedConditionalBorders() throws Exception { + setUp("table/collapsed-conditional-borders.fo"); + int tableNum = 0; + Iterator tableIterator = getTableIterator(); + do { + String baseErrorMsge = "table " + Integer.toString(tableNum) + " (0-based), "; + Table table = (Table) tableIterator.next(); + TablePart part = (TablePart) table.getChildNodes().next(); + GridUnit gu = getGridUnit(part); + + String errorMsge = baseErrorMsge + "border-before"; + checkBorder(errorMsge, gu.borderBefore.normal, 8000, Color.black); + checkBorder(errorMsge, gu.borderBefore.leadingTrailing, 8000, Color.black); + checkBorder(errorMsge, gu.borderBefore.rest, resolvedBorders[tableNum][0]); + + errorMsge = baseErrorMsge + "border-after"; + checkBorder(errorMsge, gu.borderAfter.normal, 8000, Color.black); + checkBorder(errorMsge, gu.borderAfter.leadingTrailing, 8000, Color.black); + checkBorder(errorMsge, gu.borderAfter.rest, resolvedBorders[tableNum][1]); + + tableNum++; + } while (tableIterator.hasNext()); + } + + @Test + public void testCollapsedConditionalBordersHeaderFooter() throws Exception { + setUp("table/collapsed-conditional-borders_header-footer.fo"); + int tableNum = 0; + Iterator tableIterator = getTableIterator(); + do { + String errorMsge = "table " + Integer.toString(tableNum) + " (0-based)"; + int borderNum = 0; + Table table = (Table) tableIterator.next(); + + TableHeader header = table.getTableHeader(); + GridUnit gu = getGridUnit(header); + checkBorder(errorMsge, gu.borderBefore.normal, + resolvedBordersHF[tableNum][borderNum++]); + checkBorder(errorMsge, gu.borderBefore.rest, + resolvedBordersHF[tableNum][borderNum++]); + + TableFooter footer = table.getTableFooter(); + gu = getGridUnit(footer); + checkBorder(errorMsge, gu.borderAfter.normal, + resolvedBordersHF[tableNum][borderNum++]); + checkBorder(errorMsge, gu.borderAfter.rest, + resolvedBordersHF[tableNum][borderNum++]); + + FONodeIterator bodyIter = table.getChildNodes(); + TableBody body = (TableBody) bodyIter.next(); + gu = getGridUnit(body); + checkBorder(errorMsge, gu.borderBefore.normal, + resolvedBordersHF[tableNum][borderNum++]); + checkBorder(errorMsge, gu.borderBefore.leadingTrailing, + resolvedBordersHF[tableNum][borderNum++]); + checkBorder(errorMsge, gu.borderBefore.rest, + resolvedBordersHF[tableNum][borderNum++]); + checkBorder(errorMsge, gu.borderAfter.normal, + resolvedBordersHF[tableNum][borderNum++]); + checkBorder(errorMsge, gu.borderAfter.leadingTrailing, + resolvedBordersHF[tableNum][borderNum++]); + checkBorder(errorMsge, gu.borderAfter.rest, + resolvedBordersHF[tableNum][borderNum++]); + + body = (TableBody) bodyIter.next(); + gu = getGridUnit(body); + checkBorder(errorMsge, gu.borderBefore.normal, + resolvedBordersHF[tableNum][borderNum++]); + checkBorder(errorMsge, gu.borderBefore.leadingTrailing, + resolvedBordersHF[tableNum][borderNum++]); + checkBorder(errorMsge, gu.borderBefore.rest, + resolvedBordersHF[tableNum][borderNum++]); + checkBorder(errorMsge, gu.borderAfter.normal, + resolvedBordersHF[tableNum][borderNum++]); + checkBorder(errorMsge, gu.borderAfter.leadingTrailing, + resolvedBordersHF[tableNum][borderNum++]); + checkBorder(errorMsge, gu.borderAfter.rest, + resolvedBordersHF[tableNum][borderNum++]); + + tableNum++; + } while (tableIterator.hasNext()); + } +} diff --git a/src/test/java/org/apache/fop/fo/flow/table/ErrorCheckTest.java b/src/test/java/org/apache/fop/fo/flow/table/ErrorCheckTest.java new file mode 100644 index 000000000..b30c64c07 --- /dev/null +++ b/src/test/java/org/apache/fop/fo/flow/table/ErrorCheckTest.java @@ -0,0 +1,43 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fo.flow.table; + +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import org.apache.fop.fo.LoadingException; +import org.apache.fop.fo.ValidationException; + +/** + * Abstract class for testing erroneous files, checking that a ValidationException is thrown. + */ +abstract class ErrorCheckTest extends AbstractTableTest { + + protected void launchTest(String filename) throws Exception { + try { + setUp(filename); + fail("Expected ValidationException to be thrown"); + } catch (LoadingException e) { + // TODO check location + assertTrue(e.getCause() instanceof ValidationException); + } + } + +} diff --git a/src/test/java/org/apache/fop/fo/flow/table/HeaderColumnTestCase.java b/src/test/java/org/apache/fop/fo/flow/table/HeaderColumnTestCase.java new file mode 100644 index 000000000..4cc94b5e0 --- /dev/null +++ b/src/test/java/org/apache/fop/fo/flow/table/HeaderColumnTestCase.java @@ -0,0 +1,112 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fo.flow.table; + +import org.junit.Test; +import org.xml.sax.Attributes; +import org.xml.sax.Locator; +import org.xml.sax.helpers.AttributesImpl; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyString; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.events.EventBroadcaster; +import org.apache.fop.fo.ElementMappingRegistry; +import org.apache.fop.fo.FOEventHandler; +import org.apache.fop.fo.FONodeMocks; +import org.apache.fop.fo.FOValidationEventProducer; +import org.apache.fop.fo.PropertyList; +import org.apache.fop.fo.StaticPropertyList; +import org.apache.fop.fo.ValidationException; +import org.apache.fop.fo.expr.PropertyException; +import org.apache.fop.fo.extensions.ExtensionElementMapping; +import org.apache.fop.util.XMLUtil; + +/** + * Tests that the fox:header property is correctly parsed and set up at the FO tree level. + */ +public class HeaderColumnTestCase { + + @Test + public void testWrongValue() throws ValidationException { + Table parent = createTableParent(); + EventBroadcaster mockEventBroadcaster = FONodeMocks.mockGetEventBroadcaster( + parent.getFOEventHandler().getUserAgent()); + FOValidationEventProducer eventProducer = mockGetEventProducerFor(mockEventBroadcaster); + TableColumn column = new TableColumn(parent); + PropertyList propertyList = new StaticPropertyList(column, null); + Attributes atts = createScopeAttribute("blah"); + propertyList.addAttributesToList(atts); + verify(eventProducer).invalidPropertyValue(any(), eq("fo:table-column"), + eq("fox:header"), eq("blah"), any(PropertyException.class), any(Locator.class)); + } + + @Test + public void testCorrectValue() throws Exception { + testCorrectValue(true); + testCorrectValue(false); + } + + private void testCorrectValue(boolean expectedValue) throws Exception { + Table parent = createTableParent(); + FONodeMocks.mockGetColumnNumberManager(parent); + TableColumn column = new TableColumn(parent, true); + PropertyList propertyList = new StaticPropertyList(column, null); + Attributes atts = createScopeAttribute(String.valueOf(expectedValue)); + propertyList.addAttributesToList(atts); + column.bind(propertyList); + assertEquals(expectedValue, column.isHeader()); + } + + private Table createTableParent() { + Table parent = mock(Table.class); + FOEventHandler mockFOEventHandler = FONodeMocks.mockGetFOEventHandler(parent); + FOUserAgent mockUserAgent = mockFOEventHandler.getUserAgent(); + mockGetElementMappingRegistry(mockUserAgent); + return parent; + } + + private Attributes createScopeAttribute(String value) { + AttributesImpl atts = new AttributesImpl(); + atts.addAttribute(ExtensionElementMapping.URI, "header", "fox:header", XMLUtil.CDATA, value); + return atts; + } + + private ElementMappingRegistry mockGetElementMappingRegistry(FOUserAgent mockUserAgent) { + ElementMappingRegistry mockRegistry = mock(ElementMappingRegistry.class); + when(mockRegistry.getElementMapping(anyString())).thenReturn(new ExtensionElementMapping()); + when(mockUserAgent.getElementMappingRegistry()).thenReturn(mockRegistry); + return mockRegistry; + } + + private FOValidationEventProducer mockGetEventProducerFor(EventBroadcaster mockEventBroadcaster) { + FOValidationEventProducer mockEventProducer = mock(FOValidationEventProducer.class); + when(mockEventBroadcaster.getEventProducerFor(eq(FOValidationEventProducer.class))) + .thenReturn(mockEventProducer); + return mockEventProducer; + } + +} diff --git a/src/test/java/org/apache/fop/fo/flow/table/IllegalRowSpanTestCase.java b/src/test/java/org/apache/fop/fo/flow/table/IllegalRowSpanTestCase.java new file mode 100644 index 000000000..b2e7a2c9d --- /dev/null +++ b/src/test/java/org/apache/fop/fo/flow/table/IllegalRowSpanTestCase.java @@ -0,0 +1,50 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fo.flow.table; + +import org.junit.Test; + +/** + * Testcase checking that cells spanning further than their parent element aren't + * accepted. + */ +public class IllegalRowSpanTestCase extends ErrorCheckTest { + + @Test + public void testBody1() throws Exception { + launchTest("table/illegal-row-span_body_1.fo"); + } + + @Test + public void testBody2() throws Exception { + launchTest("table/illegal-row-span_body_2.fo"); + } + + @Test + public void testHeader() throws Exception { + launchTest("table/illegal-row-span_header.fo"); + } + + @Test + public void testFooter() throws Exception { + launchTest("table/illegal-row-span_footer.fo"); + } + +} diff --git a/src/test/java/org/apache/fop/fo/flow/table/RowGroupBuilderTestCase.java b/src/test/java/org/apache/fop/fo/flow/table/RowGroupBuilderTestCase.java new file mode 100644 index 000000000..884116441 --- /dev/null +++ b/src/test/java/org/apache/fop/fo/flow/table/RowGroupBuilderTestCase.java @@ -0,0 +1,182 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fo.flow.table; + +import java.util.Iterator; +import java.util.List; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +/** + * Tests that RowGroupBuilder returns, for each part of a table, the expected number of + * row-groups with the expected number or rows in each. + */ +public class RowGroupBuilderTestCase extends AbstractTableTest { + + /** + * Checks that the given table-body(header,footer) will return row groups as expected. + * More precisely, checks that the number of row groups corresponds to the size of the + * given array, and that the number of rows inside each row group is equal to the + * corresponding integer in the array. + * + * @param part a table part whose row groups are to be checked + * @param expectedRowLengths expected lengths of all the row groups of this part of + * the table + */ + private void checkTablePartRowGroups(TablePart part, int[] expectedRowLengths) { + Iterator rowGroupIter = part.getRowGroups().iterator(); + for (int i = 0; i < expectedRowLengths.length; i++) { + assertTrue(rowGroupIter.hasNext()); + List rowGroup = (List) rowGroupIter.next(); + assertEquals(expectedRowLengths[i], rowGroup.size()); + } + assertFalse(rowGroupIter.hasNext()); + } + + /** + * Gets the next table and checks its row-groups. + * @param tableIter an iterator over the tables to check + * @param expectedHeaderRowLengths expected row-group sizes for the header. If null + * the table is not expected to have a header + * @param expectedFooterRowLengths expected row-group sizes for the footer. If null + * the table is not expected to have a footer + * @param expectedBodyRowLengths expected row-group sizes for the body(-ies) + */ + private void checkNextTableRowGroups(Iterator tableIter, + int[] expectedHeaderRowLengths, int[] expectedFooterRowLengths, int[][] expectedBodyRowLengths) { + Table table = (Table) tableIter.next(); + if (expectedHeaderRowLengths == null) { + assertNull(table.getTableHeader()); + } else { + checkTablePartRowGroups(table.getTableHeader(), expectedHeaderRowLengths); + } + if (expectedFooterRowLengths == null) { + assertNull(table.getTableFooter()); + } else { + checkTablePartRowGroups(table.getTableFooter(), expectedFooterRowLengths); + } + Iterator bodyIter = table.getChildNodes(); + for (int i = 0; i < expectedBodyRowLengths.length; i++) { + assertTrue(bodyIter.hasNext()); + checkTablePartRowGroups((TableBody) bodyIter.next(), expectedBodyRowLengths[i]); + } + } + + public void checkSimple(String filename) throws Exception { + setUp(filename); + Iterator tableIter = getTableIterator(); + + // Table 1: no header, no footer, one body (1 row) + checkNextTableRowGroups(tableIter, null, null, new int[][] {{1}}); + + // Table 2: no header, no footer, one body (2 rows) + checkNextTableRowGroups(tableIter, null, null, new int[][] {{1, 1}}); + + // Table 3: no header, no footer, two bodies (1 row, 1 row) + checkNextTableRowGroups(tableIter, null, null, new int[][] {{1}, {1}}); + + // Table 4: no header, no footer, two bodies (2 rows, 3 rows) + checkNextTableRowGroups(tableIter, null, null, new int[][] {{1, 1}, {1, 1, 1}}); + + // Table 5: one header (1 row), no footer, one body (1 row) + checkNextTableRowGroups(tableIter, new int[] {1}, null, new int[][] {{1}}); + + // Table 6: no header, one footer (1 row), one body (1 row) + checkNextTableRowGroups(tableIter, null, new int[] {1}, new int[][] {{1}}); + + // Table 7: one header (1 row), one footer (1 row), one body (1 row) + checkNextTableRowGroups(tableIter, new int[] {1}, new int[] {1}, new int[][] {{1}}); + + // Table 8: one header (2 rows), one footer (3 rows), one body (2 rows) + checkNextTableRowGroups(tableIter, new int[] {1, 1}, new int[] {1, 1, 1}, new int[][] {{1, 1}}); + + // Table 9: one header (3 rows), one footer (2 rows), three bodies (2 rows, 1 row, 3 rows) + checkNextTableRowGroups(tableIter, new int[] {1, 1, 1}, new int[] {1, 1}, new int[][] {{1, 1}, {1}, {1, 1, 1}}); + } + + public void checkSpans(String filename) throws Exception { + setUp(filename); + Iterator tableIter = getTableIterator(); + + // Table 1: no header, no footer, one body (1 row with column-span) + checkNextTableRowGroups(tableIter, null, null, new int[][] {{1}}); + + // Table 2: no header, no footer, one body (1 row-group of 2 rows) + checkNextTableRowGroups(tableIter, null, null, new int[][] {{2}}); + + // Table 3: no header, no footer, one body (1 row-group of 2 rows, 1 row) + checkNextTableRowGroups(tableIter, null, null, new int[][] {{2, 1}}); + + // Table 4: no header, no footer, one body (1 row, 1 row-group of 2 rows) + checkNextTableRowGroups(tableIter, null, null, new int[][] {{1, 2}}); + + // Table 5: no header, no footer, one body (1 row, 1 row-group of 3 rows, 1 row) + checkNextTableRowGroups(tableIter, null, null, new int[][] {{1, 3, 1}}); + + // Table 6: one header (1 row-group of 2 rows), one footer (1 row, 1 row-group of 3 rows), + // one body (1 row-group of 2 rows, 1 row, 1 row-group of 3 rows) + checkNextTableRowGroups(tableIter, new int[] {2}, new int[] {1, 3}, new int[][] {{2, 1, 3}}); + } + + @Test + public void testWithRowsSimple() throws Exception { + checkSimple("table/RowGroupBuilder_simple.fo"); + } + + @Test + public void testWithRowsSpans() throws Exception { + checkSpans("table/RowGroupBuilder_spans.fo"); + } + + @Test + public void testNoRowSimple() throws Exception { + checkSimple("table/RowGroupBuilder_no-row_simple.fo"); + } + + @Test + public void testNoRowSpans() throws Exception { + checkSpans("table/RowGroupBuilder_no-row_spans.fo"); + } + + @Test + public void testNoColWithRowsSimple() throws Exception { + checkSimple("table/RowGroupBuilder_no-col_simple.fo"); + } + + @Test + public void testNoColWithRowsSpans() throws Exception { + checkSpans("table/RowGroupBuilder_no-col_spans.fo"); + } + + @Test + public void testNoColNoRowSimple() throws Exception { + checkSimple("table/RowGroupBuilder_no-col_no-row_simple.fo"); + } + + @Test + public void testNoColNoRowSpans() throws Exception { + checkSpans("table/RowGroupBuilder_no-col_no-row_spans.fo"); + } +} diff --git a/src/test/java/org/apache/fop/fo/flow/table/TableColumnColumnNumberTestCase.java b/src/test/java/org/apache/fop/fo/flow/table/TableColumnColumnNumberTestCase.java new file mode 100644 index 000000000..be049eac9 --- /dev/null +++ b/src/test/java/org/apache/fop/fo/flow/table/TableColumnColumnNumberTestCase.java @@ -0,0 +1,114 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fo.flow.table; + +import java.util.Iterator; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +import org.apache.fop.datatypes.PercentBaseContext; +import org.apache.fop.fo.FObj; + +public class TableColumnColumnNumberTestCase extends AbstractTableTest { + + /** + * A percentBaseContext that mimics the behaviour of TableLM for computing the widths + * of columns. All what needs to be known is the width of a table unit (as in + * proportional-column-width()). + */ + private class TablePercentBaseContext implements PercentBaseContext { + + private int unitaryWidth; + + void setUnitaryWidth(int unitaryWidth) { + this.unitaryWidth = unitaryWidth; + } + + public int getBaseLength(int lengthBase, FObj fobj) { + return unitaryWidth; + } + } + + private TablePercentBaseContext percentBaseContext = new TablePercentBaseContext(); + + private void checkColumn(Table t, int number, boolean isImplicit, int spans, int repeated, int width) { + TableColumn c = t.getColumn(number - 1); + // TODO a repeated column has a correct number only for its first occurrence +// assertEquals(number, c.getColumnNumber()); + assertEquals(isImplicit, c.isImplicitColumn()); + assertEquals(spans, c.getNumberColumnsSpanned()); + assertEquals(repeated, c.getNumberColumnsRepeated()); + assertEquals(width, c.getColumnWidth().getValue(percentBaseContext)); + } + + @Test + public void testColumnNumber() throws Exception { + setUp("table/table-column_column-number.fo"); + Iterator tableIter = getTableIterator(); + Table t = (Table) tableIter.next(); + assertEquals(2, t.getNumberOfColumns()); + checkColumn(t, 1, false, 1, 2, 100000); + checkColumn(t, 2, false, 1, 2, 100000); + + t = (Table) tableIter.next(); + assertEquals(2, t.getNumberOfColumns()); + checkColumn(t, 1, false, 1, 1, 200000); + checkColumn(t, 2, false, 1, 1, 100000); + + t = (Table) tableIter.next(); + assertEquals(3, t.getNumberOfColumns()); + checkColumn(t, 1, false, 1, 1, 100000); + checkColumn(t, 2, false, 1, 1, 150000); + checkColumn(t, 3, false, 1, 1, 200000); + + t = (Table) tableIter.next(); + percentBaseContext.setUnitaryWidth(125000); + assertEquals(4, t.getNumberOfColumns()); + checkColumn(t, 1, false, 1, 1, 100000); + checkColumn(t, 2, true, 1, 1, 125000); + checkColumn(t, 3, false, 1, 1, 150000); + checkColumn(t, 4, false, 1, 1, 175000); + } + + private void checkImplicitColumns(Iterator tableIter, int columnNumber) { + Table t = (Table) tableIter.next(); + assertEquals(columnNumber, t.getNumberOfColumns()); + for (int i = 1; i <= columnNumber; i++) { + checkColumn(t, i, true, 1, 1, 100000); + } + } + + @Test + public void testImplicitColumns() throws Exception { + setUp("table/implicit_columns_column-number.fo"); + percentBaseContext.setUnitaryWidth(100000); + Iterator tableIter = getTableIterator(); + + checkImplicitColumns(tableIter, 2); + checkImplicitColumns(tableIter, 2); + checkImplicitColumns(tableIter, 2); + checkImplicitColumns(tableIter, 2); + checkImplicitColumns(tableIter, 3); + checkImplicitColumns(tableIter, 4); + checkImplicitColumns(tableIter, 3); + } +} diff --git a/src/test/java/org/apache/fop/fo/flow/table/TableHandler.java b/src/test/java/org/apache/fop/fo/flow/table/TableHandler.java new file mode 100644 index 000000000..04da32b47 --- /dev/null +++ b/src/test/java/org/apache/fop/fo/flow/table/TableHandler.java @@ -0,0 +1,44 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fo.flow.table; + +import java.util.LinkedList; +import java.util.List; + +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.fo.FOEventHandler; + +public class TableHandler extends FOEventHandler { + + /** All the tables encountered in the FO file. List of Table objects. */ + private List tables = new LinkedList(); + + TableHandler(FOUserAgent foUserAgent) { + super(foUserAgent); + } + + public void endTable(Table tbl) { + tables.add(tbl); + } + + List getTables() { + return tables; + } +} diff --git a/src/test/java/org/apache/fop/fo/flow/table/TooManyColumnsTestCase.java b/src/test/java/org/apache/fop/fo/flow/table/TooManyColumnsTestCase.java new file mode 100644 index 000000000..76a5d196d --- /dev/null +++ b/src/test/java/org/apache/fop/fo/flow/table/TooManyColumnsTestCase.java @@ -0,0 +1,55 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fo.flow.table; + +import org.junit.Test; + +public class TooManyColumnsTestCase extends ErrorCheckTest { + + @Test + public void testBody1() throws Exception { + launchTest("table/too-many-columns_body_1.fo"); + } + + @Test + public void testBody2() throws Exception { + launchTest("table/too-many-columns_body_2.fo"); + } + + @Test + public void testBody3() throws Exception { + launchTest("table/too-many-columns_body_3.fo"); + } + + @Test + public void testBody4() throws Exception { + launchTest("table/too-many-columns_body_4.fo"); + } + + @Test + public void testHeader() throws Exception { + launchTest("table/too-many-columns_header.fo"); + } + + @Test + public void testFooter() throws Exception { + launchTest("table/too-many-columns_footer.fo"); + } +} diff --git a/src/test/java/org/apache/fop/fo/flow/table/UnimplementedWarningNeutralizer.java b/src/test/java/org/apache/fop/fo/flow/table/UnimplementedWarningNeutralizer.java new file mode 100644 index 000000000..1a5e38291 --- /dev/null +++ b/src/test/java/org/apache/fop/fo/flow/table/UnimplementedWarningNeutralizer.java @@ -0,0 +1,38 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fo.flow.table; + +/** + * This class aims at easing testing, by preventing the event notification system from + * getting in the way just to issue an Unimplemented Feature warning. + */ +public final class UnimplementedWarningNeutralizer { + + private UnimplementedWarningNeutralizer() { } + + /** + * Neutralizes Unimplemented Feature events from the {@link TableAndCaption} and + * {@link TableCaption} classes. + */ + public static void neutralizeUnimplementedWarning() { + TableAndCaption.notImplementedWarningGiven = true; + TableCaption.notImplementedWarningGiven = true; + } +} diff --git a/src/test/java/org/apache/fop/fo/pagination/AllTests.java b/src/test/java/org/apache/fop/fo/pagination/AllTests.java new file mode 100644 index 000000000..bd5b21c14 --- /dev/null +++ b/src/test/java/org/apache/fop/fo/pagination/AllTests.java @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fo.pagination; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +/** + * All test to be added in FOTreeTestSuite + * + */ +@RunWith(Suite.class) +@Suite.SuiteClasses({ PageSequenceMasterTestCase.class, + RepeatablePageMasterAlternativesTestCase.class }) +public final class AllTests { +} diff --git a/src/test/java/org/apache/fop/fo/pagination/LayoutMasterSetTestCase.java b/src/test/java/org/apache/fop/fo/pagination/LayoutMasterSetTestCase.java new file mode 100644 index 000000000..cfe71f529 --- /dev/null +++ b/src/test/java/org/apache/fop/fo/pagination/LayoutMasterSetTestCase.java @@ -0,0 +1,95 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fo.pagination; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.fo.FODocumentParser; +import org.apache.fop.fo.FODocumentParser.FOEventHandlerFactory; +import org.apache.fop.fo.FOEventHandler; + +public class LayoutMasterSetTestCase { + + private static class FlowMappingTester extends FOEventHandler { + + private static final String[][] FLOW_MAPPINGS = { + + {"first-page-before", "xsl-region-before"}, + {"first-page-after", "xsl-region-after"}, + {"first-page-start", "xsl-region-start"}, + {"first-page-end", "xsl-region-end"}, + + {"odd-page-before", "xsl-region-before"}, + {"odd-page-after", "xsl-region-after"}, + {"odd-page-start", "xsl-region-start"}, + {"odd-page-end", "xsl-region-end"}, + + {"odd-page-before", "xsl-region-before"}, + {"odd-page-after", "xsl-region-after"}, + {"odd-page-start", "xsl-region-start"}, + {"odd-page-end", "xsl-region-end"}, + + {"blank-page-before", "xsl-region-before"}, + {"blank-page-after", "xsl-region-after"}, + {"blank-page-start", "xsl-region-start"}, + {"blank-page-end", "xsl-region-end"}, + + {"last-page-before", "xsl-region-before"}, + {"last-page-after", "xsl-region-after"}, + {"last-page-start", "xsl-region-start"}, + {"last-page-end", "xsl-region-end"}, + + {"xsl-footnote-separator", "xsl-footnote-separator"} + + }; + + FlowMappingTester(FOUserAgent userAgent) { + super(userAgent); + } + + @Override + public void startPageSequence(PageSequence pageSeq) { + super.startPageSequence(pageSeq); + LayoutMasterSet layoutMasterSet = pageSeq.getRoot().getLayoutMasterSet(); + for (String[] mapping : FLOW_MAPPINGS) { + assertEquals(mapping[1], layoutMasterSet.getDefaultRegionNameFor(mapping[0])); + } + } + + } + + /** + * Tests the {@link LayoutMasterSet#getDefaultRegionNameFor(String)} method. + */ + @Test + public void testFlowMapping() throws Exception { + FODocumentParser foDocumentParser = FODocumentParser.newInstance(new FOEventHandlerFactory() { + + public FOEventHandler newFOEventHandler(FOUserAgent foUserAgent) { + return new FlowMappingTester(foUserAgent); + } + }); + foDocumentParser.parse(getClass().getResourceAsStream("side-regions.fo")); + } + +} diff --git a/src/test/java/org/apache/fop/fo/pagination/PageSequenceMasterTestCase.java b/src/test/java/org/apache/fop/fo/pagination/PageSequenceMasterTestCase.java new file mode 100644 index 000000000..9a4515b31 --- /dev/null +++ b/src/test/java/org/apache/fop/fo/pagination/PageSequenceMasterTestCase.java @@ -0,0 +1,160 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fo.pagination; + +import org.junit.Test; +import org.xml.sax.Locator; + +import static org.junit.Assert.fail; +import static org.mockito.Matchers.anyBoolean; +import static org.mockito.Matchers.anyInt; +import static org.mockito.Matchers.anyObject; +import static org.mockito.Matchers.anyString; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import org.apache.fop.apps.FOPException; +import org.apache.fop.fo.FONode; +import org.apache.fop.layoutmgr.BlockLevelEventProducer; + +/** + * Unit Test for PageSequenceMaster + * + */ +public class PageSequenceMasterTestCase { + + /** + * Test that block level events are produced in line with + * XSL:FO - 6.4.8 fo:page-sequence-master - + * "It is an error if the entire sequence of sub-sequence-specifiers children is exhausted + * while some areas returned by an fo:flow are not placed. Implementations may recover, + * if possible, by re-using the sub-sequence-specifier that was last used to generate a page." + * + * @throws Exception exception + */ + @Test + public void testGetNextSimplePageMasterExhausted() throws Exception { + + //Test when the last sub-sequence specifier is not repeatable + testGetNextSimplePageMasterExhausted(true); + + //Test when the last sub-sequence specifier is repeatable + testGetNextSimplePageMasterExhausted(false); + + } + + private void testGetNextSimplePageMasterExhausted(boolean canResume) throws Exception { + + SimplePageMaster spm = mock(SimplePageMaster.class); + SubSequenceSpecifier mockSinglePageMasterReference + = mock(SubSequenceSpecifier.class); + BlockLevelEventProducer mockBlockLevelEventProducer = mock(BlockLevelEventProducer.class); + + // subject under test + PageSequenceMaster pageSequenceMaster = createPageSequenceMaster( + mockBlockLevelEventProducer); + pageSequenceMaster.addSubsequenceSpecifier(mockSinglePageMasterReference); + + //Setup to mock the exhaustion of the last sub-sequence specifier + when(mockSinglePageMasterReference.getNextPageMaster(anyBoolean(), anyBoolean(), + anyBoolean(), anyBoolean())).thenReturn(null, spm); + + //Need this for the method to return normally + when(mockSinglePageMasterReference.canProcess(anyString())).thenReturn(true); + + when(mockSinglePageMasterReference.isReusable()).thenReturn(canResume); + + pageSequenceMaster.getNextSimplePageMaster(false, false, false, false, null); + + verify(mockBlockLevelEventProducer).pageSequenceMasterExhausted((Locator)anyObject(), + anyString(), eq(canResume), (Locator)anyObject()); + } + + /** + * Test that PageProductionException is thrown if the final simple-page-master + * cannot handle the main-flow of the page sequence + * @throws Exception exception + */ + @Test + public void testGetNextSimplePageMasterException() throws Exception { + + final String mainFlowRegionName = "main"; + final String emptyFlowRegionName = "empty"; + + // This will represent a page master that does not map to the main flow + // of the page sequence + SimplePageMaster mockEmptySPM = mock(SimplePageMaster.class); + Region mockRegion = mock(Region.class); + SinglePageMasterReference mockSinglePageMasterReference + = mock(SinglePageMasterReference.class); + BlockLevelEventProducer mockBlockLevelEventProducer = mock(BlockLevelEventProducer.class); + + LayoutMasterSet mockLayoutMasterSet = mock(LayoutMasterSet.class); + //The layout master set should return the empty page master + when(mockLayoutMasterSet.getSimplePageMaster(anyString())).thenReturn(mockEmptySPM); + when(mockEmptySPM.getRegion(anyInt())).thenReturn(mockRegion); + + when(mockRegion.getRegionName()).thenReturn(emptyFlowRegionName); + + when(mockSinglePageMasterReference.getNextPageMaster(anyBoolean(), anyBoolean(), + anyBoolean(), anyBoolean())) + .thenReturn(null, mockEmptySPM); + + PageSequenceMaster pageSequenceMaster = createPageSequenceMaster(mockLayoutMasterSet, + mockBlockLevelEventProducer); + + pageSequenceMaster.startOfNode(); + pageSequenceMaster.addSubsequenceSpecifier(mockSinglePageMasterReference); + + try { + pageSequenceMaster.getNextSimplePageMaster(false, false, false, false, + mainFlowRegionName); + fail("The next simple page master does not refer to the main flow"); + } catch (PageProductionException ppe) { + //Passed test + } + } + + + private PageSequenceMaster createPageSequenceMaster( + BlockLevelEventProducer blockLevelEventProducer) throws FOPException { + + return createPageSequenceMaster(mock(LayoutMasterSet.class), blockLevelEventProducer); + } + + private PageSequenceMaster createPageSequenceMaster(LayoutMasterSet layoutMasterSet, + BlockLevelEventProducer blockLevelEventProducer) throws FOPException { + FONode mockParent = mock(FONode.class); + Root mockRoot = mock(Root.class); + + //Stub generic components + when(mockParent.getRoot()).thenReturn(mockRoot); + when(mockRoot.getLayoutMasterSet()).thenReturn(layoutMasterSet); + + PageSequenceMaster psm = new PageSequenceMaster(mockParent, blockLevelEventProducer); + psm.startOfNode(); + + return psm; + } + +} + diff --git a/src/test/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternativesTestCase.java b/src/test/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternativesTestCase.java new file mode 100644 index 000000000..ce1a97638 --- /dev/null +++ b/src/test/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternativesTestCase.java @@ -0,0 +1,169 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fo.pagination; + +import org.junit.Test; + +import static org.junit.Assert.assertTrue; +import static org.mockito.Matchers.anyBoolean; +import static org.mockito.Matchers.anyInt; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import org.apache.fop.fo.Constants; +import org.apache.fop.fo.PropertyList; +import org.apache.fop.fo.expr.NumericProperty; +import org.apache.fop.fo.properties.Property; + +/** + * Unit Test for RepeatablePageMasterAlternatives + * + */ +public class RepeatablePageMasterAlternativesTestCase implements Constants { + + /** + * + * @throws Exception exception + */ + @Test + public void testIsInfinite1() throws Exception { + // Create fixture + Property maximumRepeats = mock(Property.class); + ConditionalPageMasterReference cpmr = createCPMR("empty"); + + when(maximumRepeats.getEnum()).thenReturn(EN_NO_LIMIT); + + RepeatablePageMasterAlternatives objectUnderTest + = createRepeatablePageMasterAlternatives(cpmr, maximumRepeats); + + assertTrue("is infinite", objectUnderTest.isInfinite()); + } + + /** + * + * @throws Exception exception + */ + @Test + public void testIsInfinite2() throws Exception { + // Create fixture + Property maximumRepeats = mock(Property.class); + ConditionalPageMasterReference cpmr = createCPMR("empty"); + + NumericProperty numericProperty = mock(NumericProperty.class); + + final int maxRepeatNum = 0; + assertTrue(maxRepeatNum != EN_NO_LIMIT); + + when(maximumRepeats.getEnum()).thenReturn(maxRepeatNum); + when(maximumRepeats.getNumeric()).thenReturn(numericProperty); + + RepeatablePageMasterAlternatives objectUnderTest + = createRepeatablePageMasterAlternatives(createCPMR("empty"), + maximumRepeats); + + assertTrue("is infinite", !objectUnderTest.isInfinite()); + } + + /** + * Test that an infinite sequence of empty page masters has + * willTerminiate() returning false + * @throws Exception exception + */ + @Test + public void testCanProcess1() throws Exception { + // Create fixture + Property maximumRepeats = mock(Property.class); + ConditionalPageMasterReference cpmr = createCPMR("empty"); + + when(maximumRepeats.getEnum()).thenReturn(EN_NO_LIMIT); + when(cpmr.isValid(anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean())) + .thenReturn(true); + + RepeatablePageMasterAlternatives objectUnderTest + = createRepeatablePageMasterAlternatives(cpmr, maximumRepeats); + + //Fixture assertion + assertTrue("Should be infinite", objectUnderTest.isInfinite()); + + //Test assertion + assertTrue("Infinite sequences that do not process the main flow will " + + " not terminate", + !objectUnderTest.canProcess("main-flow")); + } + /** + * Test that a finite sequence of simple page masters has + * willTerminate() returning true + * + * @throws Exception exception + */ + @Test + public void testCanProcess2() throws Exception { + // Create fixture + Property maximumRepeats = mock(Property.class); + NumericProperty numericProperty = mock(NumericProperty.class); + + final int maxRepeatNum = 0; + + when(maximumRepeats.getEnum()).thenReturn(maxRepeatNum); + when(maximumRepeats.getNumeric()).thenReturn(numericProperty); + + RepeatablePageMasterAlternatives objectUnderTest + = createRepeatablePageMasterAlternatives(createCPMR("empty"), + maximumRepeats); + + //Fixture assertion + assertTrue("Should be finite sequence", !objectUnderTest.isInfinite()); + + //Test assertion + assertTrue("Finite sequences will terminate", + objectUnderTest.canProcess("main-flow")); + } + + private ConditionalPageMasterReference createCPMR(String regionName) { + ConditionalPageMasterReference cpmr = mock(ConditionalPageMasterReference.class); + SimplePageMaster master = mock(SimplePageMaster.class); + Region region = mock(Region.class); + when(master.getRegion(anyInt())).thenReturn(region); + when(region.getRegionName()).thenReturn(regionName); + when(cpmr.getMaster()).thenReturn(master); + + return cpmr; + } + + private RepeatablePageMasterAlternatives createRepeatablePageMasterAlternatives( + ConditionalPageMasterReference cpmr, Property maximumRepeats) throws Exception { + + PropertyList pList = mock(PropertyList.class); + + when(pList.get(anyInt())).thenReturn(maximumRepeats); + + PageSequenceMaster parent = mock(PageSequenceMaster.class); + when(parent.getName()).thenReturn("fo:page-sequence-master"); + + RepeatablePageMasterAlternatives sut = new RepeatablePageMasterAlternatives(parent); + + sut.startOfNode(); + sut.bind(pList); + sut.addConditionalPageMasterReference(cpmr); + return sut; + } + +} + diff --git a/src/test/java/org/apache/fop/fo/pagination/side-regions.fo b/src/test/java/org/apache/fop/fo/pagination/side-regions.fo new file mode 100644 index 000000000..8a0fba2ec --- /dev/null +++ b/src/test/java/org/apache/fop/fo/pagination/side-regions.fo @@ -0,0 +1,181 @@ +<?xml version="1.0" standalone="no"?> +<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> + <fo:layout-master-set> + <fo:simple-page-master master-name="first-page" + page-height="100pt" page-width="150pt"> + <fo:region-body margin="12pt" display-align="center" background-color="#FFF0F0"/> + <fo:region-before region-name="first-page-before" extent="10pt" precedence="true" + display-align="after"/> + <fo:region-after region-name="first-page-after" extent="10pt" precedence="true"/> + <fo:region-start region-name="first-page-start" extent="10pt" reference-orientation="90" + display-align="after"/> + <fo:region-end region-name="first-page-end" extent="10pt" reference-orientation="-90" + display-align="after"/> + </fo:simple-page-master> + <fo:simple-page-master master-name="odd-page" + page-height="100pt" page-width="150pt"> + <fo:region-body margin="12pt" display-align="center" background-color="#FFFFF0"/> + <fo:region-before region-name="odd-page-before" extent="10pt" precedence="true" + display-align="after"/> + <fo:region-after region-name="odd-page-after" extent="10pt" precedence="true"/> + <fo:region-start region-name="odd-page-start" extent="10pt" reference-orientation="90" + display-align="after"/> + <fo:region-end region-name="odd-page-end" extent="10pt" reference-orientation="-90" + display-align="after"/> + </fo:simple-page-master> + <fo:simple-page-master master-name="even-page" + page-height="100pt" page-width="150pt"> + <fo:region-body margin="12pt" display-align="center" background-color="#F0FFF0"/> + <fo:region-before region-name="even-page-before" extent="10pt" precedence="true" + display-align="after"/> + <fo:region-after region-name="even-page-after" extent="10pt" precedence="true"/> + <fo:region-start region-name="even-page-start" extent="10pt" reference-orientation="90" + display-align="after"/> + <fo:region-end region-name="even-page-end" extent="10pt" reference-orientation="-90" + display-align="after"/> + </fo:simple-page-master> + <fo:simple-page-master master-name="blank-page" + page-height="100pt" page-width="150pt"> + <fo:region-body margin="12pt" display-align="center" background-color="#F0F0F0"/> + <fo:region-before region-name="blank-page-before" extent="10pt" precedence="true" + display-align="after"/> + <fo:region-after region-name="blank-page-after" extent="10pt" precedence="true"/> + <fo:region-start region-name="blank-page-start" extent="10pt" reference-orientation="90" + display-align="after"/> + <fo:region-end region-name="blank-page-end" extent="10pt" reference-orientation="-90" + display-align="after"/> + </fo:simple-page-master> + <fo:simple-page-master master-name="last-page" + page-height="100pt" page-width="150pt"> + <fo:region-body margin="45pt 12pt" display-align="center" background-color="#F0F0FF"/> + <fo:region-before region-name="last-page-before" extent="10pt" precedence="true" + display-align="after"/> + <fo:region-after region-name="last-page-after" extent="10pt" precedence="true"/> + <fo:region-start region-name="last-page-start" extent="10pt" reference-orientation="90" + display-align="after"/> + <fo:region-end region-name="last-page-end" extent="10pt" reference-orientation="-90" + display-align="after"/> + </fo:simple-page-master> + <fo:page-sequence-master master-name="pages"> + <fo:repeatable-page-master-alternatives> + <fo:conditional-page-master-reference page-position="first" master-reference="first-page"/> + <fo:conditional-page-master-reference page-position="last" master-reference="last-page"/> + <fo:conditional-page-master-reference blank-or-not-blank="blank" + master-reference="blank-page"/> + <fo:conditional-page-master-reference odd-or-even="odd" master-reference="odd-page"/> + <fo:conditional-page-master-reference odd-or-even="even" master-reference="even-page"/> + </fo:repeatable-page-master-alternatives> + </fo:page-sequence-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="pages" force-page-count="even" font-size="4pt" + text-align="center"> + + <fo:static-content flow-name="first-page-before"> + <fo:block start-indent="12pt" end-indent="12pt" border-bottom="0.5pt solid red" + padding-bottom="0.5pt">First Page Before.</fo:block> + </fo:static-content> + <fo:static-content flow-name="first-page-after"> + <fo:block start-indent="12pt" end-indent="12pt" border-top="0.5pt solid red" + padding-top="0.5pt">First Page After.</fo:block> + </fo:static-content> + <fo:static-content flow-name="first-page-start"> + <fo:block start-indent="2pt" end-indent="2pt" border-bottom="0.5pt solid red" + padding-bottom="0.5pt">First Page Start.</fo:block> + </fo:static-content> + <fo:static-content flow-name="first-page-end"> + <fo:block start-indent="2pt" end-indent="2pt" border-bottom="0.5pt solid red" + padding-bottom="0.5pt">First Page End.</fo:block> + </fo:static-content> + + <fo:static-content flow-name="odd-page-after"> + <fo:block start-indent="12pt" end-indent="12pt" border-top="0.5pt solid orange" + padding-top="0.5pt">Odd Page After.</fo:block> + </fo:static-content> + <fo:static-content flow-name="odd-page-end"> + <fo:block start-indent="2pt" end-indent="2pt" border-bottom="0.5pt solid orange" + padding-bottom="0.5pt">Odd Page End.</fo:block> + </fo:static-content> + <fo:static-content flow-name="odd-page-start"> + <fo:block start-indent="2pt" end-indent="2pt" border-bottom="0.5pt solid orange" + padding-bottom="0.5pt">Odd Page Start.</fo:block> + </fo:static-content> + <fo:static-content flow-name="odd-page-before"> + <fo:block start-indent="12pt" end-indent="12pt" border-bottom="0.5pt solid orange" + padding-bottom="0.5pt">Odd Page Before.</fo:block> + </fo:static-content> + + <fo:static-content flow-name="even-page-end"> + <fo:block start-indent="2pt" end-indent="2pt" border-bottom="0.5pt solid green" + padding-bottom="0.5pt">Even Page End.</fo:block> + </fo:static-content> + <fo:static-content flow-name="even-page-start"> + <fo:block start-indent="2pt" end-indent="2pt" border-bottom="0.5pt solid green" + padding-bottom="0.5pt">Even Page Start.</fo:block> + </fo:static-content> + <fo:static-content flow-name="even-page-after"> + <fo:block start-indent="12pt" end-indent="12pt" border-top="0.5pt solid green" + padding-top="0.5pt">Even Page After.</fo:block> + </fo:static-content> + <fo:static-content flow-name="even-page-before"> + <fo:block start-indent="12pt" end-indent="12pt" border-bottom="0.5pt solid green" + padding-bottom="0.5pt">Even Page Before.</fo:block> + </fo:static-content> + + <fo:static-content flow-name="blank-page-start"> + <fo:block start-indent="2pt" end-indent="2pt" border-bottom="0.5pt solid black" + padding-bottom="0.5pt">Blank Page Start.</fo:block> + </fo:static-content> + <fo:static-content flow-name="blank-page-after"> + <fo:block start-indent="12pt" end-indent="12pt" border-top="0.5pt solid black" + padding-top="0.5pt">Blank Page After.</fo:block> + </fo:static-content> + <fo:static-content flow-name="blank-page-before"> + <fo:block start-indent="12pt" end-indent="12pt" border-bottom="0.5pt solid black" + padding-bottom="0.5pt">Blank Page Before.</fo:block> + </fo:static-content> + <fo:static-content flow-name="blank-page-end"> + <fo:block start-indent="2pt" end-indent="2pt" border-bottom="0.5pt solid black" + padding-bottom="0.5pt">Blank Page End.</fo:block> + </fo:static-content> + + <fo:static-content flow-name="last-page-before"> + <fo:block start-indent="12pt" end-indent="12pt" border-bottom="0.5pt solid blue" + padding-bottom="0.5pt">Last Page Before.</fo:block> + </fo:static-content> + <fo:static-content flow-name="last-page-end"> + <fo:block start-indent="2pt" end-indent="2pt" border-bottom="0.5pt solid blue" + padding-bottom="0.5pt">Last Page End.</fo:block> + </fo:static-content> + <fo:static-content flow-name="last-page-after"> + <fo:block start-indent="12pt" end-indent="12pt" border-top="0.5pt solid blue" + padding-top="0.5pt">Last Page After.</fo:block> + </fo:static-content> + <fo:static-content flow-name="last-page-start"> + <fo:block start-indent="2pt" end-indent="2pt" border-bottom="0.5pt solid blue" + padding-bottom="0.5pt">Last Page Start.</fo:block> + </fo:static-content> + + <fo:static-content flow-name="xsl-footnote-separator"> + <fo:block> + <fo:leader leader-pattern="rule" leader-length="40%" rule-thickness="0.5pt"/> + </fo:block> + </fo:static-content> + + <fo:flow flow-name="xsl-region-body" font-size="8pt" line-height="10pt"> + <fo:block>Apache™ FOP (Formatting Objects Processor) is a print formatter driven by XSL + formatting objects (XSL-FO) and an output independent formatter.</fo:block> + <fo:block break-before="page">It is an application<fo:footnote><fo:inline>*</fo:inline> + <fo:footnote-body><fo:block font-size="80%">* written in + Java</fo:block></fo:footnote-body></fo:footnote> that reads a formatting object (FO) + tree and renders the resulting pages to a specified output.</fo:block> + <fo:block break-before="page">The FOP project is part of the Apache Software Foundation, which + is a wider community of users and developers of open source projects.</fo:block> + <fo:block break-before="page">Apache™ FOP (Formatting Objects Processor) is a print formatter + driven by XSL formatting objects (XSL-FO) and an output independent formatter.</fo:block> + <fo:block break-before="page">It is a Java application that reads a formatting object (FO) + tree and renders the resulting pages to a specified output.</fo:block> + <fo:block break-before="page">The FOP project is part of the Apache Software Foundation, which + is a wider community of users and developers of open source projects.</fo:block> + </fo:flow> + </fo:page-sequence> +</fo:root> diff --git a/src/test/java/org/apache/fop/fo/properties/AltTextHolderTestCase.java b/src/test/java/org/apache/fop/fo/properties/AltTextHolderTestCase.java new file mode 100644 index 000000000..eae290be3 --- /dev/null +++ b/src/test/java/org/apache/fop/fo/properties/AltTextHolderTestCase.java @@ -0,0 +1,76 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fo.properties; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import org.apache.fop.apps.FOPException; +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.fo.Constants; +import org.apache.fop.fo.FONode; +import org.apache.fop.fo.FONodeMocks; +import org.apache.fop.fo.PropertyList; +import org.apache.fop.fo.expr.PropertyException; +import org.apache.fop.fo.flow.AbstractGraphics; +import org.apache.fop.fo.flow.ExternalGraphic; +import org.apache.fop.fo.flow.InstreamForeignObject; + +/** + * Tests that the fox:alt-text property is correctly set on objects that support it. + */ +public class AltTextHolderTestCase { + + private final String altText = "alternative text"; + + @Test + public void externalGraphicHasAltText() throws FOPException { + testAltTextGetter(new ExternalGraphic(mockFONode())); + } + + @Test + public void instreamForeignObjectHasAltText() throws FOPException { + testAltTextGetter(new InstreamForeignObject(mockFONode())); + } + + private FONode mockFONode() { + FONode mockFONode = FONodeMocks.mockFONode(); + FOUserAgent mockFOUserAgent = mockFONode.getFOEventHandler().getUserAgent(); + when(mockFOUserAgent.isAccessibilityEnabled()).thenReturn(true); + return mockFONode; + } + + private void testAltTextGetter(AbstractGraphics g) throws FOPException { + g.bind(mockPropertyList()); + assertEquals(altText, g.getAltText()); + } + + private PropertyList mockPropertyList() throws PropertyException { + PropertyList mockPropertyList = PropertyListMocks.mockPropertyList(); + Property mockAltText = mock(Property.class); + when(mockAltText.getString()).thenReturn(altText); + when(mockPropertyList.get(Constants.PR_X_ALT_TEXT)).thenReturn(mockAltText); + return mockPropertyList; + } + +} diff --git a/src/test/java/org/apache/fop/fo/properties/CommonAccessibilityHolderTestCase.java b/src/test/java/org/apache/fop/fo/properties/CommonAccessibilityHolderTestCase.java new file mode 100644 index 000000000..81ebc2f41 --- /dev/null +++ b/src/test/java/org/apache/fop/fo/properties/CommonAccessibilityHolderTestCase.java @@ -0,0 +1,128 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fo.properties; + +import java.lang.reflect.Constructor; +import java.util.ArrayList; +import java.util.List; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import org.apache.fop.fo.Constants; +import org.apache.fop.fo.FONode; +import org.apache.fop.fo.FONodeMocks; +import org.apache.fop.fo.PropertyList; +import org.apache.fop.fo.expr.PropertyException; +import org.apache.fop.fo.flow.table.UnimplementedWarningNeutralizer; + +/** + * This tests that all the FONodes that implement CommonAccessibilityHolder correctly configure + * the CommonAccessibility property. + */ +public class CommonAccessibilityHolderTestCase { + + private static final List<Class<? extends CommonAccessibilityHolder>> IMPLEMENTATIONS + = new ArrayList<Class<? extends CommonAccessibilityHolder>>(); + + private final String role = "role"; + + private final String sourceDocument = "source document"; + + static { + /* This triggers 'unimplemented feature' FO validation events so that the event system is + * not triggered when testing, avoiding extra convoluted dependency stubbing. */ + UnimplementedWarningNeutralizer.neutralizeUnimplementedWarning(); + + IMPLEMENTATIONS.add(org.apache.fop.fo.flow.BasicLink.class); + IMPLEMENTATIONS.add(org.apache.fop.fo.flow.Block.class); + IMPLEMENTATIONS.add(org.apache.fop.fo.pagination.bookmarks.Bookmark.class); + IMPLEMENTATIONS.add(org.apache.fop.fo.pagination.bookmarks.BookmarkTitle.class); + IMPLEMENTATIONS.add(org.apache.fop.fo.flow.ExternalGraphic.class); + IMPLEMENTATIONS.add(org.apache.fop.fo.flow.Footnote.class); + IMPLEMENTATIONS.add(org.apache.fop.fo.flow.FootnoteBody.class); + IMPLEMENTATIONS.add(org.apache.fop.fo.flow.InitialPropertySet.class); + IMPLEMENTATIONS.add(org.apache.fop.fo.flow.Inline.class); + IMPLEMENTATIONS.add(org.apache.fop.fo.flow.InstreamForeignObject.class); + IMPLEMENTATIONS.add(org.apache.fop.fo.flow.Leader.class); + IMPLEMENTATIONS.add(org.apache.fop.fo.flow.ListBlock.class); + IMPLEMENTATIONS.add(org.apache.fop.fo.flow.ListItem.class); + IMPLEMENTATIONS.add(org.apache.fop.fo.flow.ListItemBody.class); + IMPLEMENTATIONS.add(org.apache.fop.fo.flow.ListItemLabel.class); + IMPLEMENTATIONS.add(org.apache.fop.fo.flow.PageNumber.class); + IMPLEMENTATIONS.add(org.apache.fop.fo.flow.PageNumberCitation.class); + IMPLEMENTATIONS.add(org.apache.fop.fo.flow.PageNumberCitationLast.class); + IMPLEMENTATIONS.add(org.apache.fop.fo.pagination.Root.class); + IMPLEMENTATIONS.add(org.apache.fop.fo.flow.table.Table.class); + IMPLEMENTATIONS.add(org.apache.fop.fo.flow.table.TableAndCaption.class); + IMPLEMENTATIONS.add(org.apache.fop.fo.flow.table.TableBody.class); + IMPLEMENTATIONS.add(org.apache.fop.fo.flow.table.TableCaption.class); + IMPLEMENTATIONS.add(org.apache.fop.fo.flow.table.TableCell.class); + IMPLEMENTATIONS.add(org.apache.fop.fo.flow.table.TableFooter.class); + IMPLEMENTATIONS.add(org.apache.fop.fo.flow.table.TableHeader.class); + IMPLEMENTATIONS.add(org.apache.fop.fo.flow.table.TableRow.class); + IMPLEMENTATIONS.add(org.apache.fop.fo.pagination.Title.class); + } + + /** + * Bind should be overridden to correctly configure the CommonAccessibility property + * @throws Exception - + */ + @Test + public void bindMustSetRoleAndSourceDoc() throws Exception { + final PropertyList mockPList = mockPropertyList(); + final FONode parent = FONodeMocks.mockFONode(); + for (Class<? extends CommonAccessibilityHolder> clazz : IMPLEMENTATIONS) { + Constructor<? extends CommonAccessibilityHolder> constructor + = clazz.getConstructor(FONode.class); + CommonAccessibilityHolder sut = constructor.newInstance(parent); + ((FONode)sut).bind(mockPList); + String errorMessage = "Test failed for " + clazz + ": "; + assertEquals(errorMessage, role, sut.getCommonAccessibility().getRole()); + assertEquals(errorMessage, sourceDocument, + sut.getCommonAccessibility().getSourceDocument()); + } + } + + private PropertyList mockPropertyList() throws PropertyException { + final PropertyList mockPList = PropertyListMocks.mockPropertyList(); + PropertyListMocks.mockTableProperties(mockPList); + PropertyListMocks.mockCommonBorderPaddingBackgroundProps(mockPList); + mockRoleProperty(mockPList); + mockSourceDocProperty(mockPList); + return mockPList; + } + + private void mockRoleProperty(PropertyList mockPList) throws PropertyException { + final Property mockRoleProperty = mock(Property.class); + when(mockRoleProperty.getString()).thenReturn(role); + when(mockPList.get(Constants.PR_ROLE)).thenReturn(mockRoleProperty); + } + + private void mockSourceDocProperty(PropertyList mockPList) throws PropertyException { + final Property mockSourceDocProperty = mock(Property.class); + when(mockSourceDocProperty.getString()).thenReturn(sourceDocument); + when(mockPList.get(Constants.PR_SOURCE_DOCUMENT)).thenReturn(mockSourceDocProperty); + } + +} diff --git a/src/test/java/org/apache/fop/fo/properties/CommonHyphenationTestCase.java b/src/test/java/org/apache/fop/fo/properties/CommonHyphenationTestCase.java new file mode 100644 index 000000000..029146413 --- /dev/null +++ b/src/test/java/org/apache/fop/fo/properties/CommonHyphenationTestCase.java @@ -0,0 +1,58 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fo.properties; + +import java.util.Locale; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +public class CommonHyphenationTestCase { + + private final String lang = "en"; + + @Test + public void testToLocaleNull() { + Locale locale = CommonHyphenation.toLocale(null, null); + assertNull(locale); + locale = CommonHyphenation.toLocale("none", null); + assertNull(locale); + locale = CommonHyphenation.toLocale("NoNe", "US"); + assertNull(locale); + } + + @Test + public void testToLocaleWithJustLanguage() { + Locale locale = new Locale(lang); + assertEquals(locale, CommonHyphenation.toLocale(lang, null)); + assertEquals(locale, CommonHyphenation.toLocale(lang, "none")); + assertEquals(locale, CommonHyphenation.toLocale(lang, "NONE")); + } + + @Test + public void testToLocaleWithLanguageAndCountry() { + Locale locale = new Locale(lang, "US"); + assertEquals(locale, CommonHyphenation.toLocale(lang, "US")); + assertEquals(locale, CommonHyphenation.toLocale(lang, "us")); + } + +} diff --git a/src/test/java/org/apache/fop/fo/properties/PropertyListMocks.java b/src/test/java/org/apache/fop/fo/properties/PropertyListMocks.java new file mode 100644 index 000000000..f364c9034 --- /dev/null +++ b/src/test/java/org/apache/fop/fo/properties/PropertyListMocks.java @@ -0,0 +1,98 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fo.properties; + +import static org.mockito.Matchers.anyInt; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import org.apache.fop.fo.Constants; +import org.apache.fop.fo.PropertyList; +import org.apache.fop.fo.expr.PropertyException; + +/** + * A helper class for mocking a property list. + */ +public final class PropertyListMocks { + + private PropertyListMocks() { } + + /** + * Creates and returns a mock property list returning a generic default for the + * {@link PropertyList#get(int)} method. + * + * @return a mock property list + */ + public static PropertyList mockPropertyList() { + try { + final PropertyList mockPList = mock(PropertyList.class); + final Property mockGenericProperty = PropertyMocks.mockGenericProperty(); + when(mockPList.get(anyInt())).thenReturn(mockGenericProperty); + return mockPList; + } catch (PropertyException e) { + throw new RuntimeException(e); + } + } + + /** + * Overrides with working mock properties the values returned by + * {@link PropertyList#get(int)} for {@link Constants#PR_COLUMN_NUMBER}, + * {@link Constants#PR_NUMBER_COLUMNS_SPANNED}, + * {@link Constants#PR_NUMBER_ROWS_SPANNED} and {@link Constants#PR_BORDER_COLLAPSE}. + * + * @param mockPList a mock property list + */ + public static void mockTableProperties(PropertyList mockPList) { + try { + final Property mockNumberProperty = PropertyMocks.mockNumberProperty(); + when(mockPList.get(Constants.PR_COLUMN_NUMBER)).thenReturn(mockNumberProperty); + when(mockPList.get(Constants.PR_NUMBER_COLUMNS_SPANNED)).thenReturn(mockNumberProperty); + when(mockPList.get(Constants.PR_NUMBER_ROWS_SPANNED)).thenReturn(mockNumberProperty); + + final Property borderCollapseProperty = mock(Property.class); + when(borderCollapseProperty.getEnum()).thenReturn(Constants.EN_SEPARATE); + when(mockPList.get(Constants.PR_BORDER_COLLAPSE)).thenReturn(borderCollapseProperty); + + final Property writingModeProperty = mock(Property.class); + when(writingModeProperty.getEnum()).thenReturn(Constants.EN_LR_TB); + when(mockPList.get(Constants.PR_WRITING_MODE)).thenReturn(writingModeProperty); + } catch (PropertyException e) { + throw new RuntimeException(e); + } + } + + /** + * Overrides with a working mock property the value returned by + * {@link PropertyList#getBorderPaddingBackgroundProps()}. + * + * @param mockPList a mock property list + */ + public static void mockCommonBorderPaddingBackgroundProps(PropertyList mockPList) { + try { + final CommonBorderPaddingBackground mockCommonBorderPaddingBackground + = mock(CommonBorderPaddingBackground.class); + when(mockPList.getBorderPaddingBackgroundProps()) + .thenReturn(mockCommonBorderPaddingBackground); + } catch (PropertyException e) { + throw new RuntimeException(e); + } + } + +} diff --git a/src/test/java/org/apache/fop/fo/properties/PropertyMocks.java b/src/test/java/org/apache/fop/fo/properties/PropertyMocks.java new file mode 100644 index 000000000..40c923249 --- /dev/null +++ b/src/test/java/org/apache/fop/fo/properties/PropertyMocks.java @@ -0,0 +1,80 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fo.properties; + +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import org.apache.fop.datatypes.Numeric; +import org.apache.fop.datatypes.PercentBaseContext; +import org.apache.fop.fo.Constants; + +/** + * Helper class to create mocks of various kinds of properties. + */ +public final class PropertyMocks { + + private PropertyMocks() { } + + /** + * Creates and returns a generic mock property returning decent defaults for the + * {@link Property#getString()}, {@link Property#getEnum()} and + * {@link Property#getLengthRange()} methods. + * + * @return a mock all-purpose property + */ + public static Property mockGenericProperty() { + final Property mockGenericProperty = mock(Property.class); + when(mockGenericProperty.getString()).thenReturn("A non-empty string"); + when(mockGenericProperty.getEnum()).thenReturn(Constants.EN_SPACE); + LengthRangeProperty lengthRangeProperty = mockLengthRangeProperty(); + when(mockGenericProperty.getLengthRange()).thenReturn(lengthRangeProperty); + return mockGenericProperty; + } + + private static LengthRangeProperty mockLengthRangeProperty() { + final LengthRangeProperty mockLengthRangeProperty = mock(LengthRangeProperty.class); + final Property optimum = mockOptimumProperty(); + when(mockLengthRangeProperty.getOptimum(any(PercentBaseContext.class))) + .thenReturn(optimum); + return mockLengthRangeProperty; + } + + /** + * Creates and returns a mock property returning a decent default for the + * {@link Property#getNumeric()} method. + * + * @return a mock number property + */ + public static Property mockNumberProperty() { + final Property mockNumberProperty = mock(Property.class); + final Numeric mockNumeric = mock(Numeric.class); + when(mockNumberProperty.getNumeric()).thenReturn(mockNumeric); + return mockNumberProperty; + } + + private static Property mockOptimumProperty() { + final Property optimum = mock(Property.class); + when(optimum.isAuto()).thenReturn(true); + return optimum; + } + +} diff --git a/src/test/java/org/apache/fop/fonts/CIDFullTestCase.java b/src/test/java/org/apache/fop/fonts/CIDFullTestCase.java new file mode 100644 index 000000000..7df6cc25b --- /dev/null +++ b/src/test/java/org/apache/fop/fonts/CIDFullTestCase.java @@ -0,0 +1,120 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fonts; + +import java.util.BitSet; +import java.util.HashMap; +import java.util.Map; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import org.apache.fop.util.CharUtilities; + +public class CIDFullTestCase { + + private CIDFull cidFull; + private MultiByteFont mbFont; + private BitSet bs; + private char[] chars; + private int[] widths; + private Map<Integer, Integer> glyphs; + + @Before + public void setup() { + bs = new BitSet(); + glyphs = new HashMap<Integer, Integer>(); + chars = new char[18]; + widths = new int[18]; + int i = 0; + for (int j = 0; j < 20; j++) { + if (j == 10 || j == 11) { + continue; + } + bs.set(j); + glyphs.put(Integer.valueOf(j), Integer.valueOf(j)); + chars[i] = (char) j; + widths[i] = 100; + i++; + } + mbFont = mock(MultiByteFont.class); + when(mbFont.getGlyphIndices()).thenReturn(bs); + when(mbFont.getChars()).thenReturn(chars); + when(mbFont.getWidths()).thenReturn(widths); + cidFull = new CIDFull(mbFont); + } + + @Test + public void testGetOriginalGlyphIndex() { + // index 5 exists + assertEquals(cidFull.getOriginalGlyphIndex(5), 5); + } + + @Test + public void testGetUnicode() { + // index 9 exists + assertEquals(cidFull.getUnicode(9), (char) 9); + // index 10 does not + assertEquals(cidFull.getUnicode(10), CharUtilities.NOT_A_CHARACTER); + } + + @Test + public void testMapChar() { + // index 9 exists + char c = 'a'; + assertEquals(cidFull.mapChar(9, c), (char) 9); + } + + @Test + public void testGetGlyphs() { + Map<Integer, Integer> fontGlyphs = cidFull.getGlyphs(); + for (Integer key : fontGlyphs.keySet()) { + assertEquals(fontGlyphs.get(key), glyphs.get(key)); + } + assertTrue(fontGlyphs.size() == glyphs.size()); + } + + @Test + public void testGetChars() { + assertArrayEquals(cidFull.getChars(), chars); + } + + @Test + public void testGetNumberOfGlyphs() { + assertTrue(cidFull.getNumberOfGlyphs() == 20); + } + + @Test + public void testGetGlyphIndices() { + assertEquals(bs, cidFull.getGlyphIndices()); + } + + @Test + public void testGetWidths() { + assertArrayEquals(cidFull.getWidths(), widths); + } + +} diff --git a/src/test/java/org/apache/fop/fonts/DejaVuLGCSerifTestCase.java b/src/test/java/org/apache/fop/fonts/DejaVuLGCSerifTestCase.java new file mode 100644 index 000000000..c4b471ee5 --- /dev/null +++ b/src/test/java/org/apache/fop/fonts/DejaVuLGCSerifTestCase.java @@ -0,0 +1,75 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fonts; + +import java.io.File; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +import org.apache.fop.apps.io.InternalResourceResolver; +import org.apache.fop.apps.io.ResourceResolverFactory; + +/** + * + */ +public class DejaVuLGCSerifTestCase { + + private InternalResourceResolver resolver = + ResourceResolverFactory.createDefaultInternalResourceResolver(new File(".").toURI()); + private CustomFont font; + + /** + * sets up the testcase by loading the DejaVu Font. + * + * @throws Exception + * if the test fails. + */ + @Before + public void setUp() throws Exception { + File file = new File("test/resources/fonts/ttf/DejaVuLGCSerif.ttf"); + FontUris fontUris = new FontUris(file.toURI(), null); + font = FontLoader.loadFont(fontUris, "", true, EmbeddingMode.AUTO, EncodingMode.AUTO, + false, false, resolver); + } + + /** + * Simple test to see if font name was detected correctly. + */ + @Test + public void testFontName() { + assertEquals("DejaVuLGCSerif", font.getFontName()); + } + + @Test + public void testUnderline() { + assertEquals(-840, font.getUnderlinePosition(10)); + assertEquals(430, font.getUnderlineThickness(10)); + } + + @Test + public void testStrikeout() { + assertEquals(2340, font.getStrikeoutPosition(10)); + assertEquals(490, font.getStrikeoutThickness(10)); + } + +} diff --git a/src/test/java/org/apache/fop/fonts/EmbedFontInfoTestCase.java b/src/test/java/org/apache/fop/fonts/EmbedFontInfoTestCase.java new file mode 100644 index 000000000..e4179f1f6 --- /dev/null +++ b/src/test/java/org/apache/fop/fonts/EmbedFontInfoTestCase.java @@ -0,0 +1,95 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fonts; + +import java.net.URI; +import java.util.ArrayList; +import java.util.List; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +/** + * Testcase for {@link EmbedFontInfo}. + */ +public class EmbedFontInfoTestCase { + + public EmbedFontInfoTestCase() { } + + private EmbedFontInfo sut; + + private final URI metricsURI = URI.create("test/resources/fonts/ttf/glb12.ttf.xml"); + private final URI embedURI = URI.create("test/resources/fonts/ttf/glb12.ttf"); + private final boolean kerning = false; + private final boolean useAdvanced = false; + private final String subFontName = "Gladiator Bold"; + private final EncodingMode encMode = EncodingMode.CID; + private final EmbeddingMode embedMode = EmbeddingMode.AUTO; + private final FontTriplet triplet = new FontTriplet(subFontName, "bold", Font.WEIGHT_BOLD); + + @Before + public void setUp() { + List<FontTriplet> triplets = new ArrayList<FontTriplet>(); + triplets.add(triplet); + FontUris fontUris = new FontUris(embedURI, metricsURI); + sut = new EmbedFontInfo(fontUris, kerning, useAdvanced, triplets, subFontName, encMode, embedMode); + } + + @Test + public void testImmutableGetters() { + assertEquals(metricsURI, sut.getMetricsURI()); + assertEquals(embedURI, sut.getEmbedURI()); + assertEquals(kerning, sut.getKerning()); + assertEquals(subFontName, sut.getSubFontName()); + assertEquals(encMode, sut.getEncodingMode()); + + assertEquals(1, sut.getFontTriplets().size()); + assertEquals(triplet, sut.getFontTriplets().get(0)); + + assertTrue(sut.isEmbedded()); + } + + @Test + public void testMutableGetterSetters() { + String psName = "Test Name"; + sut.setPostScriptName(psName); + assertEquals(psName, sut.getPostScriptName()); + + sut.setEmbedded(false); + assertFalse(sut.isEmbedded()); + } + + @Test + public void testQuirkyBoundaryCasesIsEmbedded() { + FontUris fontUris = new FontUris(null, metricsURI); + sut = new EmbedFontInfo(fontUris, kerning, useAdvanced, sut.getFontTriplets(), subFontName, encMode, + embedMode); + sut.setEmbedded(true); + assertFalse(sut.isEmbedded()); + + sut.setEmbedded(false); + assertFalse(sut.isEmbedded()); + } + +} diff --git a/src/test/java/org/apache/fop/fonts/EncodingModeTestCase.java b/src/test/java/org/apache/fop/fonts/EncodingModeTestCase.java new file mode 100644 index 000000000..8cab9eb8b --- /dev/null +++ b/src/test/java/org/apache/fop/fonts/EncodingModeTestCase.java @@ -0,0 +1,49 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fonts; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +/** + * Tests {@link EncodingMode}. + */ +public class EncodingModeTestCase { + + @Test + public void testGetName() { + assertEquals("auto", EncodingMode.AUTO.getName()); + assertEquals("single-byte", EncodingMode.SINGLE_BYTE.getName()); + assertEquals("cid", EncodingMode.CID.getName()); + } + + @Test + public void testGetValue() { + assertEquals(EncodingMode.AUTO, EncodingMode.getValue("auto")); + assertEquals(EncodingMode.SINGLE_BYTE, EncodingMode.getValue("single-byte")); + assertEquals(EncodingMode.CID, EncodingMode.getValue("cid")); + } + + @Test(expected = IllegalArgumentException.class) + public void getValueMustCheckForIllegalArguments() { + EncodingMode.getValue("fail"); + } +} diff --git a/src/test/java/org/apache/fop/fonts/FOPFontsTestSuite.java b/src/test/java/org/apache/fop/fonts/FOPFontsTestSuite.java new file mode 100644 index 000000000..8e1a0040d --- /dev/null +++ b/src/test/java/org/apache/fop/fonts/FOPFontsTestSuite.java @@ -0,0 +1,42 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fonts; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +import org.apache.fop.fonts.truetype.FontFileReaderTestCase; +import org.apache.fop.fonts.truetype.TTFFileTestCase; +import org.apache.fop.fonts.truetype.TTFSubSetFileTestCase; +import org.apache.fop.fonts.truetype.TTFTableNameTestCase; + +/** + * A test suite designed for org.apache.fop.fonts.* + */ +@RunWith(Suite.class) +@SuiteClasses({ + EncodingModeTestCase.class, + FontFileReaderTestCase.class, + TTFFileTestCase.class, + TTFSubSetFileTestCase.class, + TTFTableNameTestCase.class }) +public final class FOPFontsTestSuite { +} diff --git a/src/test/java/org/apache/fop/fonts/FontEventProcessingTestCase.java b/src/test/java/org/apache/fop/fonts/FontEventProcessingTestCase.java new file mode 100644 index 000000000..b4271ba60 --- /dev/null +++ b/src/test/java/org/apache/fop/fonts/FontEventProcessingTestCase.java @@ -0,0 +1,55 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fonts; + +import java.io.InputStream; +import java.net.URI; + +import org.junit.Test; + +import org.apache.xmlgraphics.util.MimeConstants; + +import org.apache.fop.events.EventProcessingTestCase; + +/** + * Testing font events. + */ +public class FontEventProcessingTestCase { + + private EventProcessingTestCase eventsTests = new EventProcessingTestCase(); + + private static final URI CONFIG_BASE_DIR = EventProcessingTestCase.CONFIG_BASE_DIR; + + @Test + public void testFont() throws Exception { + InputStream inStream = getClass().getResourceAsStream("substituted-font.fo"); + eventsTests.doTest(inStream, null, FontEventProducer.class.getName() + ".fontSubstituted", + MimeConstants.MIME_PDF); + } + + @Test + public void testFontWithBadDirectory() throws Exception { + InputStream inStream = getClass().getResourceAsStream("substituted-font.fo"); + eventsTests.doTest(inStream, CONFIG_BASE_DIR.resolve("test_fonts_directory_bad.xconf"), + FontEventProducer.class.getName() + ".fontDirectoryNotFound", + MimeConstants.MIME_PDF); + } + +} diff --git a/src/test/java/org/apache/fop/fonts/FontManagerConfiguratorTestCase.java b/src/test/java/org/apache/fop/fonts/FontManagerConfiguratorTestCase.java new file mode 100644 index 000000000..d653171b7 --- /dev/null +++ b/src/test/java/org/apache/fop/fonts/FontManagerConfiguratorTestCase.java @@ -0,0 +1,117 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fonts; + +import java.io.File; +import java.io.IOException; +import java.net.URI; + +import org.junit.Before; +import org.junit.Test; +import org.xml.sax.SAXException; + +import static org.junit.Assert.assertEquals; + +import org.apache.fop.apps.FOPException; +import org.apache.fop.apps.FopConfBuilder; +import org.apache.fop.apps.FopConfParser; +import org.apache.fop.apps.FopFactory; + +import static org.apache.fop.apps.FopConfParserTestCase.getFopFactory; + +/** + * A test case for {@link FontManagerConfigurator}. + */ +public class FontManagerConfiguratorTestCase { + + private FopConfBuilder builder; + public final URI baseURI = new File("test/config/").getAbsoluteFile().toURI(); + + @Before + public void setUp() { + builder = new FopConfBuilder(); + } + + private FontManager setBaseAndGetManager(String fontBase) { + builder.setFontBaseURI(fontBase); + return getManager(); + } + + private FontManager getManager() { + FopFactory factory = getFopFactory(builder.build(), baseURI); + return factory.getFontManager(); + } + + @Test(expected = FOPException.class) + public void invalidURI() throws SAXException, IOException { + builder.setFontBaseURI("$$%%**~{}]["); + FopConfParser confParser = new FopConfParser(builder.build(), baseURI); + confParser.getFopFactoryBuilder().build(); + } + + @Test + public void relativeFontBaseURITest() { + String actualBase = "../../resources/fonts/ttf/"; + FontManager fontManager = setBaseAndGetManager(actualBase); + URI expectedURI = baseURI.resolve(actualBase); + assertEquals(expectedURI, fontManager.getResourceResolver().getBaseURI()); + } + + @Test + public void currentRelativeFontBaseTest() { + String actualBase = "."; + FontManager fontManager = setBaseAndGetManager(actualBase); + assertEquals(baseURI, fontManager.getResourceResolver().getBaseURI()); + } + + /** + * This test is an interesting one; it's basically testing that if a base URI pointing to a + * directory that doesn't exist is used, an error is not thrown. The URI resolver should handle + * any {@link java.io.FileNotFoundException}s, not the configuration. We're NOT testing whether a font + * can be resolved here, just that the URI resolver accepts it as its base URI. + */ + @Test + public void fontBaseDoesntExist() { + // TODO: Sort this out + String actualBase = "non-existing-dir/"; + FontManager fontManager = setBaseAndGetManager(actualBase); + assertEquals(baseURI.resolve("non-existing-dir/"), + fontManager.getResourceResolver().getBaseURI()); + } + + /** + * Tests that when no <font-base> is given, it falls back to the URI used in <base>. + */ + @Test + public void noFontBaseURITest() { + String actualBase = "../../resources/images/"; + builder.setBaseURI(actualBase); + FontManager fontManager = getManager(); + assertEquals(baseURI.resolve(actualBase), + fontManager.getResourceResolver().getBaseURI()); + } + + @Test + public void absoluteBaseURI() { + String absoluteBase = "test:///absolute/"; + FontManager fontManager = setBaseAndGetManager(absoluteBase); + assertEquals(URI.create(absoluteBase), fontManager.getResourceResolver().getBaseURI()); + } +} diff --git a/src/test/java/org/apache/fop/fonts/FontManagerTestCase.java b/src/test/java/org/apache/fop/fonts/FontManagerTestCase.java new file mode 100644 index 000000000..9012f843b --- /dev/null +++ b/src/test/java/org/apache/fop/fonts/FontManagerTestCase.java @@ -0,0 +1,77 @@ +/* + * 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.fop.fonts; + +import java.net.URI; + +import org.junit.Before; +import org.junit.Test; +import org.mockito.InOrder; + +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; + +import org.apache.fop.apps.FOPException; +import org.apache.fop.apps.io.InternalResourceResolver; + +public class FontManagerTestCase { + + private FontManager sut; + private FontCacheManager fontCacheManager; + private FontDetector fontDetector; + private InternalResourceResolver resolver; + + @Before + public void setUp() { + resolver = mock(InternalResourceResolver.class); + fontCacheManager = mock(FontCacheManager.class); + fontDetector = mock(FontDetector.class); + + sut = new FontManager(resolver, fontDetector, fontCacheManager); + } + + @Test + public void testSetCacheFile() { + URI testURI = URI.create("test/uri"); + sut.setCacheFile(testURI); + + InOrder inOrder = inOrder(resolver, fontCacheManager); + inOrder.verify(resolver).resolveFromBase(testURI); + inOrder.verify(fontCacheManager).setCacheFile(any(URI.class)); + } + + @Test + public void testGetFontCache() { + sut.getFontCache(); + verify(fontCacheManager).load(); + } + + @Test + public void testSaveCache() throws FOPException { + sut.saveCache(); + verify(fontCacheManager).save(); + } + + @Test + public void testDeleteCache() throws FOPException { + sut.deleteCache(); + verify(fontCacheManager).delete(); + } +} diff --git a/src/test/java/org/apache/fop/fonts/FontsTestSuite.java b/src/test/java/org/apache/fop/fonts/FontsTestSuite.java new file mode 100644 index 000000000..1baba49df --- /dev/null +++ b/src/test/java/org/apache/fop/fonts/FontsTestSuite.java @@ -0,0 +1,38 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fonts; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +/** + * A test suite for the o.a.f.fonts package. + */ +@RunWith(Suite.class) +@SuiteClasses({ + FontManagerConfiguratorTestCase.class, + EmbedFontInfoTestCase.class, + FontEventProcessingTestCase.class, + FontManagerConfiguratorTestCase.class +}) +public class FontsTestSuite { + +} diff --git a/src/test/java/org/apache/fop/fonts/cff/CFFDataReaderTestCase.java b/src/test/java/org/apache/fop/fonts/cff/CFFDataReaderTestCase.java new file mode 100644 index 000000000..97ea5c52b --- /dev/null +++ b/src/test/java/org/apache/fop/fonts/cff/CFFDataReaderTestCase.java @@ -0,0 +1,154 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fonts.cff; + +import java.io.IOException; +import java.util.Map; +import java.util.Random; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +import org.apache.fontbox.cff.CFFDataInput; + +import org.apache.fop.fonts.cff.CFFDataReader.CFFIndexData; +import org.apache.fop.fonts.cff.CFFDataReader.DICTEntry; +import org.apache.fop.fonts.truetype.OTFSubSetFile; + +public class CFFDataReaderTestCase { + private CFFDataReader cffReader; + + /** + * Initializes the CFFDataReader for testing purposes + */ + @Before + public void setUp() { + cffReader = new CFFDataReader(); + } + + /** + * Parses a test dictionary to verify whether the stored data is read correctly. + * @throws IOException + */ + @Test + public void parseDictData() throws IOException { + byte[] testDictData = prepareDictData(); + Map<String, DICTEntry> testTopDict = cffReader.parseDictData(testDictData); + validateDictData(testTopDict); + } + + private byte[] prepareDictData() { + byte[] testDictData = new byte[0]; + //Version + testDictData = OTFSubSetFile.concatArray(testDictData, OTFSubSetFile.createNewRef( + 392, new int[] { 0 }, -1)); + //Notice + testDictData = OTFSubSetFile.concatArray(testDictData, OTFSubSetFile.createNewRef( + 393, new int[] { 1 }, -1)); + //Copyright + testDictData = OTFSubSetFile.concatArray(testDictData, OTFSubSetFile.createNewRef( + 394, new int[] { 12, 0 }, -1)); + //FullName + testDictData = OTFSubSetFile.concatArray(testDictData, OTFSubSetFile.createNewRef( + 395, new int[] { 2 }, -1)); + //FamilyName + testDictData = OTFSubSetFile.concatArray(testDictData, OTFSubSetFile.createNewRef( + 396, new int[] { 3 }, -1)); + //Weight + testDictData = OTFSubSetFile.concatArray(testDictData, OTFSubSetFile.createNewRef( + 397, new int[] { 4 }, -1)); + //isFixedPitch (boolean = false) + testDictData = OTFSubSetFile.concatArray(testDictData, OTFSubSetFile.createNewRef( + 0, new int[] { 12, 1 }, -1)); + //FontBBox + testDictData = OTFSubSetFile.concatArray(testDictData, OTFSubSetFile.createNewRef( + -50, new int[0], -1)); + testDictData = OTFSubSetFile.concatArray(testDictData, OTFSubSetFile.createNewRef( + -40, new int[0], -1)); + testDictData = OTFSubSetFile.concatArray(testDictData, OTFSubSetFile.createNewRef( + 100, new int[0], -1)); + testDictData = OTFSubSetFile.concatArray(testDictData, OTFSubSetFile.createNewRef( + 120, new int[] { 5 }, -1)); + //charset + testDictData = OTFSubSetFile.concatArray(testDictData, OTFSubSetFile.createNewRef( + 1234, new int[] { 15 }, -1)); + //CharStrings + testDictData = OTFSubSetFile.concatArray(testDictData, OTFSubSetFile.createNewRef( + 3654, new int[] { 17 }, -1)); + //Private + testDictData = OTFSubSetFile.concatArray(testDictData, OTFSubSetFile.createNewRef( + 11454, new int[] { 18 }, -1)); + return testDictData; + } + + private void validateDictData(Map<String, DICTEntry> dictMap) { + //SID Values (numbers) + assertEquals(dictMap.get("version").getOperands().get(0).intValue(), 392); + assertEquals(dictMap.get("Notice").getOperands().get(0).intValue(), 393); + assertEquals(dictMap.get("Copyright").getOperands().get(0).intValue(), 394); + assertEquals(dictMap.get("FullName").getOperands().get(0).intValue(), 395); + assertEquals(dictMap.get("FamilyName").getOperands().get(0).intValue(), 396); + assertEquals(dictMap.get("Weight").getOperands().get(0).intValue(), 397); + //Boolean comparison + assertEquals(dictMap.get("isFixedPitch").getOperands().get(0).intValue(), 0); + //Array comparison + int[] fontBBox = { -50, -40, 100, 120 }; + DICTEntry fontBBoxEntry = dictMap.get("FontBBox"); + for (int i = 0; i < fontBBoxEntry.getOperands().size(); i++) { + assertEquals(fontBBoxEntry.getOperands().get(i).intValue(), fontBBox[i]); + } + //Multi-byte offset (number) + assertEquals(dictMap.get("charset").getOperands().get(0).intValue(), 1234); + assertEquals(dictMap.get("CharStrings").getOperands().get(0).intValue(), 3654); + //Larger offset + assertEquals(dictMap.get("Private").getOperands().get(0).intValue(), 11454); + } + + /** + * Tests the parsing of an example byte data index structure + * @throws IOException + */ + @Test + public void testIndexParsing() throws IOException { + byte[] testIndex = { + 0, 5, //Number of objects + 1, //Offset size + 1, //Offsets... + 5, + 12, + 24, + 27, + 32 + }; + Random randGen = new Random(); + byte[] data = new byte[31]; + for (int i = 0; i < data.length; i++) { + data[i] = (byte)randGen.nextInt(255); + } + testIndex = OTFSubSetFile.concatArray(testIndex, data); + CFFIndexData indexData = cffReader.readIndex(new CFFDataInput(testIndex)); + assertEquals(indexData.getNumObjects(), 5); + assertEquals(indexData.getOffSize(), 1); + assertEquals(indexData.getOffsets().length, 6); + assertEquals(indexData.getOffsets()[5], 32); + } +} diff --git a/src/test/java/org/apache/fop/fonts/substituted-font.fo b/src/test/java/org/apache/fop/fonts/substituted-font.fo new file mode 100644 index 000000000..551527522 --- /dev/null +++ b/src/test/java/org/apache/fop/fonts/substituted-font.fo @@ -0,0 +1,14 @@ +<?xml version="1.0" standalone="no"?> +<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> + <fo:layout-master-set> + <fo:simple-page-master master-name="page" + page-height="420pt" page-width="320pt" margin="10pt"> + <fo:region-body background-color="#F0F0F0"/> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="page"> + <fo:flow flow-name="xsl-region-body"> + <fo:block font-family="blah">This block uses an unknown font.</fo:block> + </fo:flow> + </fo:page-sequence> +</fo:root> diff --git a/src/test/java/org/apache/fop/fonts/truetype/FontFileReaderTestCase.java b/src/test/java/org/apache/fop/fonts/truetype/FontFileReaderTestCase.java new file mode 100644 index 000000000..5c1fec175 --- /dev/null +++ b/src/test/java/org/apache/fop/fonts/truetype/FontFileReaderTestCase.java @@ -0,0 +1,304 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fonts.truetype; + +import java.io.ByteArrayInputStream; +import java.io.EOFException; +import java.io.IOException; +import java.io.InputStream; +import java.util.Arrays; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +/** + * A test class for org.apache.fop.truetype.FontFileReader + */ +public class FontFileReaderTestCase { + private FontFileReader fontReader; + private final InputStream in; + private final byte[] byteArray; + + /** + * Constructor - initialises an array that only needs to be created once. It creates a byte[] + * of form { 0x00, 0x01, 0x02, 0x03..., 0xff}; + */ + public FontFileReaderTestCase() { + byteArray = new byte[256]; + for (int i = 0; i < 256; i++) { + byteArray[i] = (byte) i; + } + in = new ByteArrayInputStream(byteArray); + } + + /** + * sets up the test subject object for testing. + */ + @Before + public void setUp() { + try { + fontReader = new FontFileReader(in); + } catch (Exception e) { + fail("Error: " + e.getMessage()); + } + } + + /** + * the "destructor" method. + * + */ + public void tearDown() { + fontReader = null; + } + + /** + * Test readTTFByte() + * @throws IOException exception + */ + @Test + public void testReadTTFByte() throws IOException { + for (int i = 0; i < 256; i++) { + assertEquals((byte) i, fontReader.readTTFByte()); + } + } + + /** + * Test seekSet() - check that it moves to the correct position and enforce a failure case. + * @throws IOException exception + */ + @Test + public void testSeekSet() throws IOException { + fontReader.seekSet(10); + assertEquals(10, fontReader.readTTFByte()); + try { + fontReader.seekSet(257); + fail("FileFontReaderTest Failed testSeekSet"); + } catch (IOException e) { + // Passed + } + } + + /** + * Test skip() - check that it moves to the correct position and enforce a failure case. + * @throws IOException exception + */ + @Test + public void testSkip() throws IOException { + fontReader.skip(100); + assertEquals(100, fontReader.readTTFByte()); + try { + // 100 (seekAdd) + 1 (read() = 1 byte) + 156 = 257 + fontReader.skip(156); + fail("FileFontReaderTest Failed testSkip"); + } catch (IOException e) { + // Passed + } + } + + /** + * Test getCurrentPos() - 3 checks: + * 1) test with seekSet(int) + * 2) test with skip(int) + * 3) test with a readTTFByte() (this moves the position by the size of the data being read) + * @throws IOException exception + */ + @Test + public void testGetCurrentPos() throws IOException { + fontReader.seekSet(10); + fontReader.skip(100); + assertEquals(110, fontReader.getCurrentPos()); + fontReader.readTTFByte(); + assertEquals(111, fontReader.getCurrentPos()); + } + + /** + * Test getFileSize() + */ + @Test + public void testGetFileSize() { + assertEquals(256, fontReader.getFileSize()); + } + + /** + * Test readTTFUByte() + * @throws IOException exception + */ + @Test + public void testReadTTFUByte() throws IOException { + for (int i = 0; i < 256; i++) { + assertEquals(i, fontReader.readTTFUByte()); + } + } + + /** + * Test readTTFShort() - Test positive and negative numbers (two's compliment). + * @throws IOException exception + */ + @Test + public void testReadTTFShort() throws IOException { + // 0x0001 = 1 + assertEquals("Should have been 1 (0x0001)", 1, fontReader.readTTFShort()); + // 0x0203 = 515 + assertEquals(515, fontReader.readTTFShort()); + // now test negative numbers + fontReader.seekSet(250); + // 0xfafb + assertEquals(-1285, fontReader.readTTFShort()); + } + + /** + * Test readTTFUShort() - Test positive and potentially negative numbers (two's compliment). + * @throws IOException exception + */ + @Test + public void testReadTTFUShort() throws IOException { + // 0x0001 + assertEquals(1, fontReader.readTTFUShort()); + // 0x0203 + assertEquals(515, fontReader.readTTFUShort()); + // test potential negatives + fontReader.seekSet(250); + // 0xfafb + assertEquals((250 << 8) + 251, fontReader.readTTFUShort()); + } + + /** + * Test readTTFShort(int) - test reading ahead of current position and behind current position + * and in both cases ensure that our current position isn't changed. + * @throws IOException exception + */ + @Test + public void testReadTTFShortWithArg() throws IOException { + // 0x6465 + assertEquals(25701, fontReader.readTTFShort(100)); + assertEquals(0, fontReader.getCurrentPos()); + // read behind current position (and negative) + fontReader.seekSet(255); + // 0xfafb + assertEquals(-1285, fontReader.readTTFShort(250)); + assertEquals(255, fontReader.getCurrentPos()); + } + + /** + * Test readTTFUShort(int arg) - test reading ahead of current position and behind current + * position and in both cases ensure that our current position isn't changed. + * @throws IOException exception + */ + @Test + public void testReadTTFUShortWithArg() throws IOException { + // 0x6465 + assertEquals(25701, fontReader.readTTFUShort(100)); + assertEquals(0, fontReader.getCurrentPos()); + // read behind current position (and potential negative) + fontReader.seekSet(255); + // 0xfafb + assertEquals(64251, fontReader.readTTFUShort(250)); + assertEquals(255, fontReader.getCurrentPos()); + } + + /** + * Test readTTFLong() + * @throws IOException exception + */ + @Test + public void testReadTTFLong() throws IOException { + // 0x00010203 + assertEquals(66051, fontReader.readTTFLong()); + // test negative numbers + fontReader.seekSet(250); + // 0xf0f1f2f3 + assertEquals(-84148995, fontReader.readTTFLong()); + } + + /** + * Test readTTFULong() + * @throws IOException exception + */ + @Test + public void testReadTTFULong() throws IOException { + // 0x00010203 + assertEquals(66051, fontReader.readTTFULong()); + // test negative numbers + fontReader.seekSet(250); + // 0xfafbfcfd + assertEquals(4210818301L, fontReader.readTTFULong()); + } + + /** + * Test readTTFString() - there are two paths to test here: + * 1) A null terminated string + * 2) A string not terminated with a null (we expect this to throw an EOFException) + * @throws IOException exception + */ + @Test + public void testReadTTFString() throws IOException { + byte[] strByte = {(byte)'t', (byte)'e', (byte)'s', (byte)'t', 0x00}; + fontReader = new FontFileReader(new ByteArrayInputStream(strByte)); + assertEquals("test", fontReader.readTTFString()); + try { + // not NUL terminated + byte[] strByteNoNull = {(byte)'t', (byte)'e', (byte)'s', (byte)'t'}; + fontReader = new FontFileReader(new ByteArrayInputStream(strByteNoNull)); + assertEquals("test", fontReader.readTTFString()); + fail("FontFileReaderTest testReadTTFString Fails."); + } catch (EOFException e) { + // Pass + } + } + + /** + * Test readTTFString(int arg) + * @throws IOException exception + */ + @Test + public void testReadTTFStringIntArg() throws IOException { + byte[] strByte = {(byte)'t', (byte)'e', (byte)'s', (byte)'t'}; + fontReader = new FontFileReader(new ByteArrayInputStream(strByte)); + assertEquals("test", fontReader.readTTFString(4)); + try { + fontReader = new FontFileReader(new ByteArrayInputStream(strByte)); + assertEquals("test", fontReader.readTTFString(5)); + fail("FontFileReaderTest testReadTTFStringIntArg Fails."); + } catch (EOFException e) { + // Pass + } + } + + /** + * Test readTTFString(int arg1, int arg2) + */ + public void testReadTTFString2IntArgs() { + // currently the same as above + } + + /** + * Test getBytes() + * @throws IOException exception + */ + @Test + public void testGetBytes() throws IOException { + byte[] retrievedBytes = fontReader.getBytes(0, 256); + assertTrue(Arrays.equals(byteArray, retrievedBytes)); + } +} diff --git a/src/test/java/org/apache/fop/fonts/truetype/GlyfTableTestCase.java b/src/test/java/org/apache/fop/fonts/truetype/GlyfTableTestCase.java new file mode 100644 index 000000000..952c3ec1f --- /dev/null +++ b/src/test/java/org/apache/fop/fonts/truetype/GlyfTableTestCase.java @@ -0,0 +1,206 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fonts.truetype; + +import java.io.ByteArrayInputStream; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertTrue; + +/** + * Tests {@link GlyfTable}. + */ +public class GlyfTableTestCase { + + private static final class DirData { + + final long offset; + final long length; + + DirData(long offset, long length) { + this.offset = offset; + this.length = length; + } + } + + private FontFileReader subsetReader; + + private long[] glyphOffsets; + + private FontFileReader originalFontReader; + + @Before + public void setUp() throws IOException { + FileInputStream fontStream = new FileInputStream( + "test/resources/fonts/ttf/DejaVuLGCSerif.ttf"); + try { + originalFontReader = new FontFileReader(fontStream); + } finally { + fontStream.close(); + } + } + + /** + * Tests that composed glyphs are included in the glyph subset if a composite glyph is used. + * + * @throws IOException if an I/O error occurs + */ + @Test + public void testPopulateGlyphsWithComposites() throws IOException { + // Glyph 408 -> U+01D8 "uni01D8" this is a composite glyph. + int[] composedIndices = setupTest(408); + + int[] expected = new int[composedIndices.length]; + expected[1] = 6; + expected[5] = 2; + expected[6] = 4; + + assertArrayEquals(expected, composedIndices); + } + + /** + * Tests that no glyphs are added if there are no composite glyphs the subset. + * + * @throws IOException if an I/O error occurs + */ + @Test + public void testPopulateNoCompositeGlyphs() throws IOException { + int[] composedIndices = setupTest(36, 37, 38); // "A", "B", "C" + int[] expected = new int[composedIndices.length]; + + // There should be NO composite glyphs + assertArrayEquals(expected, composedIndices); + } + + /** + * Tests that glyphs aren't remapped twice if the glyph before a composite glyph has 0-length. + * + * @throws IOException if an I/O error occurs + */ + @Test + public void testGlyphsNotRemappedTwice() throws IOException { + int composedGlyph = 12; + // The order of these glyph indices, must NOT be changed! (see javadoc above) + int[] composedIndices = setupTest(1, 2, 3, 16, 2014, 4, 7, 8, 13, 2015, composedGlyph); + + // There are 2 composed glyphs within the subset + int[] expected = new int[composedIndices.length]; + expected[10] = composedGlyph; + + assertArrayEquals(expected, composedIndices); + } + + /** + * Tests that the correct glyph is included in the subset, when a composite glyph composed of a + * composite glyph is used. + * + * @throws IOException if an I/O error occurs + */ + @Test + public void testSingleRecursionStep() throws IOException { + // Glyph 2077 -> U+283F "uni283F" this is composed of a composite glyph (recursive). + int[] composedIndices = setupTest(2077); + + int[] expected = new int[composedIndices.length]; + expected[1] = 2; + + assertArrayEquals(expected, composedIndices); + } + + private int[] setupTest(int... glyphIndices) throws IOException { + Map<Integer, Integer> glyphs = new HashMap<Integer, Integer>(); + int index = 0; + glyphs.put(0, index++); // Glyph 0 (.notdef) must ALWAYS be in the subset + + for (int glyphIndex : glyphIndices) { + glyphs.put(glyphIndex, index++); + } + setupSubsetReader(glyphs); + readLoca(); + + return retrieveIndicesOfComposedGlyphs(); + } + + private void setupSubsetReader(Map<Integer, Integer> glyphs) throws IOException { + TTFSubSetFile fontFile = new TTFSubSetFile(); + String header = OFFontLoader.readHeader(subsetReader); + fontFile.readFont(originalFontReader, "Deja", header, glyphs); + byte[] subsetFont = fontFile.getFontSubset(); + InputStream intputStream = new ByteArrayInputStream(subsetFont); + subsetReader = new FontFileReader(intputStream); + } + + private void readLoca() throws IOException { + DirData loca = getTableData(OFTableName.LOCA.getName()); + int numberOfGlyphs = (int) (loca.length - 4) / 4; + glyphOffsets = new long[numberOfGlyphs]; + subsetReader.seekSet(loca.offset); + + for (int i = 0; i < numberOfGlyphs; i++) { + glyphOffsets[i] = subsetReader.readTTFULong(); + } + } + + private int[] retrieveIndicesOfComposedGlyphs() throws IOException { + DirData glyf = getTableData(OFTableName.GLYF.getName()); + int[] composedGlyphIndices = new int[glyphOffsets.length]; + + for (int i = 0; i < glyphOffsets.length; i++) { + long glyphOffset = glyphOffsets[i]; + if (i != glyphOffsets.length - 1 && glyphOffset == glyphOffsets[i + 1]) { + continue; + } + subsetReader.seekSet(glyf.offset + glyphOffset); + short numberOfContours = subsetReader.readTTFShort(); + if (numberOfContours < 0) { + subsetReader.skip(8); + subsetReader.readTTFUShort(); // flags + int glyphIndex = subsetReader.readTTFUShort(); + composedGlyphIndices[i] = glyphIndex; + } + } + return composedGlyphIndices; + } + + private DirData getTableData(String tableName) throws IOException { + subsetReader.seekSet(0); + subsetReader.skip(12); + String name; + do { + name = subsetReader.readTTFString(4); + subsetReader.skip(4 * 3); + } while (!name.equals(tableName)); + + subsetReader.skip(-8); // We've found the table, go back to get the data we skipped over + return new DirData(subsetReader.readTTFLong(), subsetReader.readTTFLong()); + } + + private void assertArrayEquals(int[] expected, int[] actual) { + assertTrue(Arrays.equals(expected, actual)); + } +} diff --git a/src/test/java/org/apache/fop/fonts/truetype/OTFFileTestCase.java b/src/test/java/org/apache/fop/fonts/truetype/OTFFileTestCase.java new file mode 100644 index 000000000..39b6fd50f --- /dev/null +++ b/src/test/java/org/apache/fop/fonts/truetype/OTFFileTestCase.java @@ -0,0 +1,85 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fonts.truetype; + +import java.io.FileInputStream; +import java.io.InputStream; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +public class OTFFileTestCase { + protected OTFFile sourceSansProBold; + protected FontFileReader sourceSansReader; + protected OTFFile alexBrush; + protected FontFileReader alexBrushReader; + + /** + * Initializes fonts used for the testing of reading OTF CFF + * @throws java.io.IOException + */ + @Before + public void setUp() throws Exception { + sourceSansProBold = new OTFFile(); + InputStream sourceSansStream = new FileInputStream("test/resources/fonts/otf/SourceSansProBold.otf"); + sourceSansReader = new FontFileReader(sourceSansStream); + String sourceSansHeader = OFFontLoader.readHeader(sourceSansReader); + sourceSansProBold.readFont(sourceSansReader, sourceSansHeader); + sourceSansStream.close(); + + InputStream alexBrushStream = new FileInputStream("test/resources/fonts/otf/AlexBrushRegular.otf"); + alexBrush = new OTFFile(); + alexBrushReader = new FontFileReader(alexBrushStream); + String carolynaHeader = OFFontLoader.readHeader(alexBrushReader); + alexBrush.readFont(alexBrushReader, carolynaHeader); + alexBrushStream.close(); + } + + /** + * Tests the font names being read from the file + */ + @Test + public void testFontNames() { + assertTrue(sourceSansProBold.getFamilyNames().contains("Source Sans Pro")); + assertTrue(alexBrush.getFamilyNames().contains("Alex Brush")); + } + + /** + * Tests the number of glyphs and a select number of widths from each font + */ + @Test + public void testGlyphNumberAndWidths() { + assertEquals(824, sourceSansProBold.numberOfGlyphs); + assertEquals(256, alexBrush.numberOfGlyphs); + + int[] gids = {32, 42, 44, 47}; + int[] sourceSansWidths = {516, 555, 572, 383}; + for (int i = 0; i < gids.length; i++) { + assertEquals(sourceSansWidths[i], sourceSansProBold.getWidths()[gids[i]]); + } + int[] carolynaWidths = {842, 822, 658, 784}; + for (int i = 0; i < gids.length; i++) { + assertEquals(carolynaWidths[i], alexBrush.getWidths()[gids[i]]); + } + } +} diff --git a/src/test/java/org/apache/fop/fonts/truetype/OTFSubSetFileTestCase.java b/src/test/java/org/apache/fop/fonts/truetype/OTFSubSetFileTestCase.java new file mode 100644 index 000000000..fecb1e9f1 --- /dev/null +++ b/src/test/java/org/apache/fop/fonts/truetype/OTFSubSetFileTestCase.java @@ -0,0 +1,381 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fonts.truetype; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import org.apache.fontbox.cff.CFFFont; + +import org.apache.fop.fonts.cff.CFFDataReader; +import org.apache.fop.fonts.cff.CFFDataReader.CFFIndexData; +import org.apache.fop.fonts.cff.CFFDataReader.DICTEntry; +import org.apache.fop.fonts.truetype.OTFSubSetFile.BytesNumber; + +public class OTFSubSetFileTestCase extends OTFFileTestCase { + + CFFDataReader cffReaderSourceSans; + private OTFSubSetFile sourceSansSubset; + private byte[] sourceSansData; + CFFDataReader cffReaderHeitiStd; + + /** + * Initialises the test by creating the font subset. A CFFDataReader is + * also created based on the subset data for use in the tests. + * @throws IOException + */ + @Before + public void setUp() throws Exception { + super.setUp(); + + Map<Integer, Integer> glyphs = new HashMap<Integer, Integer>(); + for (int i = 0; i < 256; i++) { + glyphs.put(i, i); + } + + sourceSansSubset = new OTFSubSetFile(); + String sourceSansHeader = OFFontLoader.readHeader(sourceSansReader); + sourceSansSubset.readFont(sourceSansReader, "SourceSansProBold", sourceSansHeader, glyphs); + sourceSansData = sourceSansSubset.getFontSubset(); + cffReaderSourceSans = new CFFDataReader(sourceSansData); + } + + /** + * Validates the CharString data against the original font + * @throws IOException + */ + @Test + public void testCharStringIndex() throws IOException { + assertEquals(256, cffReaderSourceSans.getCharStringIndex().getNumObjects()); + assertTrue(checkCorrectOffsets(cffReaderSourceSans.getCharStringIndex())); + validateCharStrings(cffReaderSourceSans, sourceSansSubset.getCFFReader()); + } + + /** + * Checks the index data to ensure that the offsets are valid + * @param indexData The index data to check + * @return Returns true if it is found to be valid + */ + private boolean checkCorrectOffsets(CFFIndexData indexData) { + int last = 0; + for (int i = 0; i < indexData.getOffsets().length; i++) { + if (indexData.getOffsets()[i] < last) { + return false; + } + last = indexData.getOffsets()[i]; + } + return true; + } + + /** + * Validates the subset font CharString data by comparing it with the original. + * @param subsetCFF The subset CFFDataReader containing the CharString data + * @param origCFF The original CFFDataReader containing the CharString data + * @throws IOException + */ + private void validateCharStrings(CFFDataReader subsetCFF, CFFDataReader origCFF) + throws IOException { + CFFFont sourceSansOriginal = sourceSansProBold.fileFont; + CFFIndexData charStrings = subsetCFF.getCharStringIndex(); + Map<String, byte[]> origCharStringData = sourceSansOriginal.getCharStringsDict(); + for (int i = 0; i < charStrings.getNumObjects(); i++) { + byte[] origCharData = origCharStringData.get(origCharStringData.keySet().toArray( + new String[0])[i]); + byte[] charData = charStrings.getValue(i); + List<BytesNumber> origOperands = getFullCharString(origCharData, origCFF); + List<BytesNumber> subsetOperands = getFullCharString(charData, subsetCFF); + for (int j = 0; j < origOperands.size(); j++) { + assertTrue(origOperands.get(j).equals(subsetOperands.get(j))); + } + } + } + + /** + * Recursively reads and constructs the full CharString for comparison + * @param data The original byte data of the CharString + * @param cffData The CFFDataReader containing the subroutine indexes + * @return Returns a list of parsed operands and operators + * @throws IOException + */ + private List<BytesNumber> getFullCharString(byte[] data, CFFDataReader cffData) throws IOException { + CFFIndexData localIndexSubr = cffData.getLocalIndexSubr(); + CFFIndexData globalIndexSubr = cffData.getGlobalIndexSubr(); + boolean hasLocalSubroutines = localIndexSubr != null && localIndexSubr.getNumObjects() > 0; + boolean hasGlobalSubroutines = globalIndexSubr != null && globalIndexSubr.getNumObjects() > 0; + ArrayList<BytesNumber> operands = new ArrayList<BytesNumber>(); + for (int dataPos = 0; dataPos < data.length; dataPos++) { + int b0 = data[dataPos] & 0xff; + if (b0 == 10 && hasLocalSubroutines) { + int subrNumber = getSubrNumber(localIndexSubr.getNumObjects(), + operands.get(operands.size() - 1).getNumber()); + byte[] subr = localIndexSubr.getValue(subrNumber); + List<BytesNumber> subrOperands = getFullCharString(subr, cffData); + operands = mergeOperands(operands, subrOperands); + } else if (b0 == 29 && hasGlobalSubroutines) { + int subrNumber = getSubrNumber(globalIndexSubr.getNumObjects(), + operands.get(operands.size() - 1).getNumber()); + byte[] subr = globalIndexSubr.getValue(subrNumber); + ArrayList<BytesNumber> subrOperands = (ArrayList<BytesNumber>)getFullCharString(subr, cffData); + operands = mergeOperands(operands, subrOperands); + } else if ((b0 >= 0 && b0 <= 27) || (b0 >= 29 && b0 <= 31)) { + int size = 1; + int b1 = -1; + if (b0 == 12) { + b1 = data[dataPos++] & 0xff; + size = 2; + } + if (b0 == 19 || b0 == 20) { + dataPos += 1; + size = 2; + } + operands.add(new Operator(b0, size, getOperatorName(b0, b1))); + } else if (b0 == 28 || (b0 >= 32 && b0 <= 255)) { + operands.add(readNumber(b0, data, dataPos)); + dataPos += operands.get(operands.size() - 1).getNumBytes() - 1; + } + } + return operands; + } + + /** + * Merges two lists of operands. This is typically used to merge the CharString + * data with that of a parsed and referenced subroutine. + * @param charString The parsed CharString data so far + * @param subroutine The parsed elements from a subroutine + * @return Returns a merged list of both CharString and subroutine elements. + */ + private ArrayList<BytesNumber> mergeOperands(List<BytesNumber> charString, + List<BytesNumber> subroutine) { + BytesNumber[] charStringOperands = charString.toArray(new BytesNumber[0]); + BytesNumber[] subroutineOperands = subroutine.toArray(new BytesNumber[0]); + BytesNumber[] mergeData = new BytesNumber[charStringOperands.length - 1 + + subroutineOperands.length - 1]; + System.arraycopy(charStringOperands, 0, mergeData, 0, charStringOperands.length - 1); + System.arraycopy(subroutineOperands, 0, mergeData, charStringOperands.length - 1, + subroutineOperands.length - 1); + ArrayList<BytesNumber> hello = new ArrayList<BytesNumber>(); + hello.addAll(Arrays.asList(mergeData)); + return hello; + } + + /** + * Parses a number from one or more bytes + * @param b0 The first byte to identify how to interpret the number + * @param input The original byte data containing the number + * @param curPos The current position of the number + * @return Returns the number + * @throws IOException + */ + private BytesNumber readNumber(int b0, byte[] input, int curPos) throws IOException { + if (b0 == 28) { + int b1 = input[curPos + 1] & 0xff; + int b2 = input[curPos + 2] & 0xff; + return new BytesNumber(Integer.valueOf((short) (b1 << 8 | b2)), 3); + } else if (b0 >= 32 && b0 <= 246) { + return new BytesNumber(Integer.valueOf(b0 - 139), 1); + } else if (b0 >= 247 && b0 <= 250) { + int b1 = input[curPos + 1] & 0xff; + return new BytesNumber(Integer.valueOf((b0 - 247) * 256 + b1 + 108), 2); + } else if (b0 >= 251 && b0 <= 254) { + int b1 = input[curPos + 1] & 0xff; + return new BytesNumber(Integer.valueOf(-(b0 - 251) * 256 - b1 - 108), 2); + } else if (b0 == 255) { + int b1 = input[curPos + 1] & 0xff; + int b2 = input[curPos + 2] & 0xff; + return new BytesNumber(Integer.valueOf((short)(b1 << 8 | b2)), 5); + } else { + throw new IllegalArgumentException(); + } + } + + /** + * Gets the subroutine number according to the number of subroutines + * and the provided operand. + * @param numSubroutines The number of subroutines used to calculate the + * subroutine reference. + * @param operand The operand for the subroutine + * @return Returns the calculated subroutine number + */ + private int getSubrNumber(int numSubroutines, int operand) { + int bias = getBias(numSubroutines); + return bias + operand; + } + + /** + * Gets the bias give the number of subroutines. This is used in the + * calculation to determine a subroutine's number + * @param subrCount The number of subroutines for a given index + * @return Returns the bias value + */ + private int getBias(int subrCount) { + if (subrCount < 1240) { + return 107; + } else if (subrCount < 33900) { + return 1131; + } else { + return 32768; + } + } + + /** + * A class representing an operator from the CharString data + */ + private class Operator extends BytesNumber { + private String opName = ""; + + public Operator(int number, int numBytes, String opName) { + super(number, numBytes); + this.opName = opName; + } + public String toString() { + return String.format("[%s]", opName); + } + } + + /** + * Gets the identifying name for the given operator. This is primarily + * used for debugging purposes. See the Type 2 CharString Format specification + * document (Technical Note #5177) Appendix A (Command Codes). + * @param operator The operator code + * @param codeb The second byte of the operator + * @return Returns the operator name. + */ + private String getOperatorName(int operator, int operatorB) { + switch (operator) { + case 0: return "Reserved"; + case 1: return "hstem"; + case 2: return "Reserved"; + case 3: return "vstem"; + case 4: return "vmoveto"; + case 5: return "rlineto"; + case 6: return "hlineto"; + case 7: return "vlineto"; + case 8: return "rrcurveto"; + case 9: return "Reserved"; + case 10: return "callsubr"; + case 11: return "return"; + case 12: return getDoubleOpName(operatorB); + case 13: return "Reserved"; + case 14: return "enchar"; + case 15: + case 16: + case 17: return "Reserved"; + case 18: return "hstemhm"; + case 19: return "hintmask"; + case 20: return "cntrmask"; + case 21: return "rmoveto"; + case 22: return "hmoveto"; + case 23: return "vstemhm"; + case 24: return "rcurveline"; + case 25: return "rlinecurve"; + case 26: return "vvcurveto"; + case 27: return "hhcurveto"; + case 28: return "shortint"; + case 29: return "callgsubr"; + case 30: return "vhcurveto"; + case 31: return "hvcurveto"; + default: return "Unknown"; + } + } + + /** + * Gets the name of a double byte operator code + * @param operator The second byte of the operator + * @return Returns the name + */ + private String getDoubleOpName(int operator) { + switch (operator) { + case 0: + case 1: + case 2: return "Reserved"; + case 3: return "and"; + case 4: return "or"; + case 5: return "not"; + case 6: + case 7: + case 8: return "Reserved"; + case 9: return "abs"; + case 10: return "add"; + case 11: return "sub"; + case 12: return "div"; + case 13: return "Reserved"; + case 14: return "neg"; + case 15: return "eq"; + case 16: + case 17: return "Reserved"; + case 18: return "drop"; + case 19: return "Reserved"; + case 20: return "put"; + case 21: return "get"; + case 22: return "ifelse"; + case 23: return "random"; + case 24: return "mul"; + case 25: return "Reserved"; + case 26: return "sqrt"; + case 27: return "dup"; + case 28: return "exch"; + case 29: return "index"; + case 30: return "roll"; + case 31: + case 32: + case 33: return "Reserved"; + case 34: return "hflex"; + case 35: return "flex"; + case 36: return "hflex1"; + case 37: return "flex1"; + case 38: return "Reserved"; + default: return "Unknown"; + } + } + + /** + * Validates the String index data and size + * @throws IOException + */ + @Test + public void testStringIndex() throws IOException { + assertEquals(164, cffReaderSourceSans.getStringIndex().getNumObjects()); + assertTrue(checkCorrectOffsets(cffReaderSourceSans.getStringIndex())); + assertEquals("Amacron", new String(cffReaderSourceSans.getStringIndex().getValue(5))); + assertEquals("Edotaccent", new String(cffReaderSourceSans.getStringIndex().getValue(32))); + assertEquals("uni0122", new String(cffReaderSourceSans.getStringIndex().getValue(45))); + } + + /** + * Validates the Top Dict data + * @throws IOException + */ + @Test + public void testTopDictData() throws IOException { + Map<String, DICTEntry> topDictEntries = cffReaderSourceSans.parseDictData( + cffReaderSourceSans.getTopDictIndex().getData()); + assertEquals(10, topDictEntries.size()); + } +} diff --git a/src/test/java/org/apache/fop/fonts/truetype/TTFFileTestCase.java b/src/test/java/org/apache/fop/fonts/truetype/TTFFileTestCase.java new file mode 100644 index 000000000..a78b3e674 --- /dev/null +++ b/src/test/java/org/apache/fop/fonts/truetype/TTFFileTestCase.java @@ -0,0 +1,457 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fonts.truetype; + +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.Map; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import org.apache.fop.fonts.truetype.OpenFont.PostScriptVersion; + +/** + * Class for testing org.apache.fop.fonts.truetype.TTFFile + */ +public class TTFFileTestCase { + // We only want to initialize the FontFileReader once (for performance reasons) + /** The truetype font file (DejaVuLGCSerif) */ + protected final TTFFile dejavuTTFFile; + /** The FontFileReader for ttfFile (DejaVuLGCSerif) */ + protected final FontFileReader dejavuReader; + /** The truetype font file (DroidSansMono) */ + protected final TTFFile droidmonoTTFFile; + /** The FontFileReader for ttfFile (DroidSansMono) */ + protected final FontFileReader droidmonoReader; + + + /** + * Constructor initialises FileFontReader to + * @throws IOException exception + */ + public TTFFileTestCase() throws IOException { + dejavuTTFFile = new TTFFile(); + InputStream dejaStream = new FileInputStream("test/resources/fonts/ttf/DejaVuLGCSerif.ttf"); + dejavuReader = new FontFileReader(dejaStream); + String dejavuHeader = OFFontLoader.readHeader(dejavuReader); + dejavuTTFFile.readFont(dejavuReader, dejavuHeader); + dejaStream.close(); + + InputStream droidStream = new FileInputStream("test/resources/fonts/ttf/DroidSansMono.ttf"); + + droidmonoTTFFile = new TTFFile(); + droidmonoReader = new FontFileReader(droidStream); + String droidmonoHeader = OFFontLoader.readHeader(droidmonoReader); + droidmonoTTFFile.readFont(droidmonoReader, droidmonoHeader); + droidStream.close(); + } + + /** + * Test convertTTFUnit2PDFUnit() - The units per em retrieved reading the HEAD table from + * the font file. (DroidSansMono has the same units per em as DejaVu so no point testing it) + */ + @Test + public void testConvertTTFUnit2PDFUnit() { + // DejaVu has 2048 units per em (PDF works in millipts, thus the 1000) + // test rational number + assertEquals(1000, dejavuTTFFile.convertTTFUnit2PDFUnit(2048)); + // test smallest case, this should = 0.488 (round down to 0) + assertEquals(0, dejavuTTFFile.convertTTFUnit2PDFUnit(1)); + // this should round up, but since it's millipts... + assertEquals(0, dejavuTTFFile.convertTTFUnit2PDFUnit(2)); + // ensure behaviour is the same for negative numbers + assertEquals(0, dejavuTTFFile.convertTTFUnit2PDFUnit(-0)); + assertEquals(-1000, dejavuTTFFile.convertTTFUnit2PDFUnit(-2048)); + assertEquals(0, dejavuTTFFile.convertTTFUnit2PDFUnit(-1)); + assertEquals(0, dejavuTTFFile.convertTTFUnit2PDFUnit(-2)); + } + + /** + * Test checkTTC() + * @throws IOException exception + */ + @Test + public void testCheckTTC() throws IOException { + // DejaVu is not a TTC, thus this returns true + String dejavuHeader = OFFontLoader.readHeader(dejavuReader); + assertTrue(dejavuTTFFile.checkTTC(dejavuHeader, "")); + String droidmonoHeader = OFFontLoader.readHeader(droidmonoReader); + assertTrue(droidmonoTTFFile.checkTTC(droidmonoHeader, "")); + /* + * Cannot reasonably test the rest of this method without an actual truetype collection + * because all methods in FontFileReader are "final" and thus mocking isn't possible. + */ + } + + /** + * Test getAnsiKerning() - Tests values retrieved from the kern table in the font file. + */ + @Test + public void testGetAnsiKerning() { + Map<Integer, Map<Integer, Integer>> ansiKerning = dejavuTTFFile.getKerning(); + if (ansiKerning.isEmpty()) { + fail(); + } + Integer k1 = ansiKerning.get(Integer.valueOf('A')).get( + Integer.valueOf('T')); + assertEquals(dejavuTTFFile.convertTTFUnit2PDFUnit(-112), k1.intValue()); + Integer k2 = ansiKerning.get(Integer.valueOf('Y')).get(Integer.valueOf('u')); + assertEquals(dejavuTTFFile.convertTTFUnit2PDFUnit(-178), k2.intValue()); + + // DroidSansMono doens't have kerning (it's mono-spaced) + ansiKerning = droidmonoTTFFile.getAnsiKerning(); + if (!ansiKerning.isEmpty()) { + fail("DroidSansMono shouldn't have any kerning data."); + } + } + + /** + * Test getCapHeight - there are several paths to test: + * 1) The PCLT table (if present) + * 2) The yMax (3rd) value, for the bounding box, for 'H' in the glyf table. + * if not the above: + * 3) The caps height in the OS/2 table + * Tests values retrieved from analysing the font file. + */ + @Test + public void testGetCapHeight() { + // DejaVu doesn't have the PCLT table and so these have to be guessed + // The height is approximated to be the height of the "H" which for + // Deja = 1493 TTFunits + assertEquals(dejavuTTFFile.convertTTFUnit2PDFUnit(1493), dejavuTTFFile.getCapHeight()); + // DroidSansMono doesn't have a PCLT table either + // height of "H" = 1462 + assertEquals(droidmonoTTFFile.convertTTFUnit2PDFUnit(1462), + droidmonoTTFFile.getCapHeight()); + } + + /** + * Test getCharSetName() - check that it returns "WinAnsiEncoding". + */ + @Test + public void testGetCharSetName() { + assertTrue("WinAnsiEncoding".equals(dejavuTTFFile.getCharSetName())); + assertTrue("WinAnsiEncoding".equals(droidmonoTTFFile.getCharSetName())); + } + + /** + * Test getCharWidth() - Test values retrieved from the metrics in the glyf table in + * the font file. + */ + @Test + public void testGetCharWidth() { + // Arbitrarily test a few values: + // The width of "H" (Unicode index 0x0048) is 1786 + assertEquals(dejavuTTFFile.convertTTFUnit2PDFUnit(1786), dejavuTTFFile.getCharWidth(0x48)); + // The width of "i" (unicode index 0x0069) is 655 TTFunits + assertEquals(dejavuTTFFile.convertTTFUnit2PDFUnit(655), dejavuTTFFile.getCharWidth(0x69)); + // final check, "!" (unicode index 0x0021) is 823 TTFunits + assertEquals(dejavuTTFFile.convertTTFUnit2PDFUnit(823), dejavuTTFFile.getCharWidth(0x21)); + + // All the glyphs should be the same width in DroidSansMono (mono-spaced) + int charWidth = droidmonoTTFFile.convertTTFUnit2PDFUnit(1229); + for (int i = 0; i < 255; i++) { + assertEquals(charWidth, droidmonoTTFFile.getCharWidth(i)); + } + } + + /** + * TODO: add implementation to this test + */ + public void testGetCMaps() { + } + + /** + * Test getFamilyNames() - Test value retrieved from the name table in the font file. + */ + @Test + public void testGetFamilyNames() { + assertEquals(1, dejavuTTFFile.getFamilyNames().size()); + for (String name : dejavuTTFFile.getFamilyNames()) { + assertEquals("DejaVu LGC Serif", name); + } + assertEquals(1, droidmonoTTFFile.getFamilyNames().size()); + for (String name : droidmonoTTFFile.getFamilyNames()) { + assertEquals("Droid Sans Mono", name); + } + } + + /** + * Test getFirstChar() - TODO: implement a more intelligent test here. + */ + @Test + public void testGetFirstChar() { + // Not really sure how to test this intelligently + assertEquals(0, dejavuTTFFile.getFirstChar()); + assertEquals(0, droidmonoTTFFile.getFirstChar()); + } + + /** + * Test getFlags() - Test values retrieved from the POST table in the font file. + */ + @Test + public void testGetFlags() { + /* DejaVu flags are: + * italic angle = 0 + * fixed pitch = 0 + * has serifs = true (default value; this font doesn't have a PCLT table) + */ + int flags = dejavuTTFFile.getFlags(); + assertEquals(0, flags & 64); // Italics angle = 0 + assertEquals(32, flags & 32); // Adobe standard charset + assertEquals(0, flags & 2); // fixed pitch = 0 + assertEquals(1, flags & 1); // has serifs = 1 (true) + /* + * Droid flags are: + * italic angle = 0 + * fixed pitch = 1 + * has serifs = true (default value; this font doesn't have a PCLT table) + */ + flags = droidmonoTTFFile.getFlags(); + assertEquals(0, flags & 64); + assertEquals(32, flags & 32); + assertEquals(2, flags & 2); + assertEquals(1, flags & 1); + } + + /** + * Test getFontBBox() - Test values retrieved from values in the HEAD table in the font file. + */ + @Test + public void testGetFontBBox() { + int[] bBox = dejavuTTFFile.getFontBBox(); + /* + * The head table has the following values(DejaVu): + * xmin = -1576, ymin = -710, xmax = 3439, ymax = 2544 + */ + assertEquals(dejavuTTFFile.convertTTFUnit2PDFUnit(-1576), bBox[0]); + assertEquals(dejavuTTFFile.convertTTFUnit2PDFUnit(-710), bBox[1]); + assertEquals(dejavuTTFFile.convertTTFUnit2PDFUnit(3439), bBox[2]); + assertEquals(dejavuTTFFile.convertTTFUnit2PDFUnit(2544), bBox[3]); + /* + * The head table has the following values (DroidSansMono): + * xmin = -312, ymin= -555, xmax = 1315, ymax = 2163 + */ + bBox = droidmonoTTFFile.getFontBBox(); + assertEquals(droidmonoTTFFile.convertTTFUnit2PDFUnit(-312), bBox[0]); + assertEquals(droidmonoTTFFile.convertTTFUnit2PDFUnit(-555), bBox[1]); + assertEquals(droidmonoTTFFile.convertTTFUnit2PDFUnit(1315), bBox[2]); + assertEquals(droidmonoTTFFile.convertTTFUnit2PDFUnit(2163), bBox[3]); + } + + /** + * Test getFullName() - Test value retrieved from the name table in the font file. + */ + @Test + public void testGetFullName() { + assertEquals("DejaVu LGC Serif", dejavuTTFFile.getFullName()); + assertEquals("Droid Sans Mono", droidmonoTTFFile.getFullName()); + } + + /** + * Test getGlyphName - Test value retrieved from the POST table in the font file. + */ + @Test + public void testGetGlyphName() { + assertEquals("H", dejavuTTFFile.getGlyphName(43)); + assertEquals("H", droidmonoTTFFile.getGlyphName(43)); + } + + /** + * Test getItalicAngle() - Test value retrieved from the POST table in the font file. + */ + @Test + public void testGetItalicAngle() { + assertEquals("0", dejavuTTFFile.getItalicAngle()); + assertEquals("0", droidmonoTTFFile.getItalicAngle()); + } + + /** + * Test getKerning() - Test values retrieved from the kern table in the font file. + */ + @Test + public void testGetKerning() { + Map<Integer, Map<Integer, Integer>> kerning = dejavuTTFFile.getKerning(); + if (kerning.isEmpty()) { + fail(); + } + Integer k1 = kerning.get(Integer.valueOf('A')).get(Integer.valueOf('T')); + assertEquals(dejavuTTFFile.convertTTFUnit2PDFUnit(-112), k1.intValue()); + Integer k2 = kerning.get(Integer.valueOf('K')).get(Integer.valueOf('u')); + assertEquals(dejavuTTFFile.convertTTFUnit2PDFUnit(-45), k2.intValue()); + + // DroidSansMono has no kerning data (mono-spaced) + kerning = droidmonoTTFFile.getKerning(); + if (!kerning.isEmpty()) { + fail("DroidSansMono shouldn't have any kerning data"); + } + } + + /** + * Test lastChar() - TODO: implement a more intelligent test + */ + @Test + public void testLastChar() { + assertEquals(0xff, dejavuTTFFile.getLastChar()); + assertEquals(0xff, droidmonoTTFFile.getLastChar()); + } + + /** + * Test getLowerCaseAscent() - There are several paths to test: + * 1) The values in the HHEA table (see code) + * 2) Fall back to values from the OS/2 table + * Test values retrieved from the font file. + */ + @Test + public void testGetLowerCaseAscent() { + assertEquals(dejavuTTFFile.convertTTFUnit2PDFUnit(1556), + dejavuTTFFile.getLowerCaseAscent()); + // Curiously the same value + assertEquals(droidmonoTTFFile.convertTTFUnit2PDFUnit(1556), + droidmonoTTFFile.getLowerCaseAscent()); + } + + /** + * Test getPostScriptName() - Test values retrieved from the post table in the font file. + */ + @Test + public void testGetPostScriptName() { + assertEquals(PostScriptVersion.V2, dejavuTTFFile.getPostScriptVersion()); + assertEquals(PostScriptVersion.V2, droidmonoTTFFile.getPostScriptVersion()); + } + + /** + * Test getStemV() - Undefined. + */ + @Test + public void testGetStemV() { + // Undefined + assertEquals("0", dejavuTTFFile.getStemV()); + assertEquals("0", droidmonoTTFFile.getStemV()); + } + + /** + * Test getSubFamilyName() - Test values retrieved from the name table in the font file. + */ + @Test + public void testGetSubFamilyName() { + assertEquals("Book", dejavuTTFFile.getSubFamilyName()); + assertEquals("Regular", droidmonoTTFFile.getSubFamilyName()); + } + + /** + * Test getTTCnames() - TODO: add implementation with TTC font. + */ + public void testGetTTCnames() { + // Can't test with with DejaVu since it's not a TrueType Collection + } + + /** + * Test getWeightClass() - Test value retrieved from the OS/2 table in the font file. + */ + @Test + public void testGetWeightClass() { + // Retrieved from OS/2 table + assertEquals(400, dejavuTTFFile.getWeightClass()); + assertEquals(400, droidmonoTTFFile.getWeightClass()); + } + + /** + * Test getWidths() - Test values retrieved from the hmtx table in the font file. + */ + @Test + public void testGetWidths() { + int[] widths = dejavuTTFFile.getWidths(); + // using the width of 'A' index = 36 + assertEquals(dejavuTTFFile.convertTTFUnit2PDFUnit(1479), widths[36]); + // using the width of '|' index = 95 + assertEquals(dejavuTTFFile.convertTTFUnit2PDFUnit(690), widths[95]); + widths = droidmonoTTFFile.getWidths(); + // DroidSansMono should have all widths the same size (mono-spaced) + int width = droidmonoTTFFile.convertTTFUnit2PDFUnit(1229); + for (int i = 0; i < 255; i++) { + assertEquals(width, widths[i]); + } + } + + /** + * Test getXHeight() - There are several paths to test: + * 1) The PCLT table (if available) + * 2) The yMax for the bounding box for 'x' in the glyf table. + * Fall back: + * 3) The xheight in the OS/2 table. + */ + @Test + public void testGetXHeight() { + // Since there's no PCLT table, the height of 'x' is used for both DejaVu and DroidSansMono + assertEquals(dejavuTTFFile.convertTTFUnit2PDFUnit(1064), dejavuTTFFile.getXHeight()); + assertEquals(droidmonoTTFFile.convertTTFUnit2PDFUnit(1098), droidmonoTTFFile.getXHeight()); + } + + /** + * Test isCFF() - TODO: add test for a CFF font. + */ + @Test + public void testIsCFF() { + // Neither DejaVu nor DroidSansMono are a compact format font + assertEquals(false, dejavuTTFFile.isCFF()); + assertEquals(false, droidmonoTTFFile.isCFF()); + } + + /** + * Test isEmbeddable() - Test value retrieved from the OS/2 table in the font file. + */ + @Test + public void testIsEmbeddable() { + // Dejavu and DroidSansMono are both embeddable + assertEquals(true, dejavuTTFFile.isEmbeddable()); + assertEquals(true, droidmonoTTFFile.isEmbeddable()); + } + + /** Underline position and thickness. */ + @Test + public void testUnderline() { + assertEquals(-63, dejavuTTFFile.getUnderlinePosition()); + assertEquals(43, dejavuTTFFile.getUnderlineThickness()); + assertEquals(-75, droidmonoTTFFile.getUnderlinePosition()); + assertEquals(49, droidmonoTTFFile.getUnderlineThickness()); + } + + /** Strikeout position and thickness. */ + @Test + public void testStrikeout() { + assertEquals(258, dejavuTTFFile.getStrikeoutPosition()); + assertEquals(49, dejavuTTFFile.getStrikeoutThickness()); + assertEquals(243, droidmonoTTFFile.getStrikeoutPosition()); + assertEquals(49, droidmonoTTFFile.getStrikeoutThickness()); + } + + /** + * Test readFont() - Add implementation if necessary. + */ + public void testReadFont() { + // I'm pretty sure we've tested this with all the other tests + } +} diff --git a/src/test/java/org/apache/fop/fonts/truetype/TTFFontLoaderTestCase.java b/src/test/java/org/apache/fop/fonts/truetype/TTFFontLoaderTestCase.java new file mode 100644 index 000000000..899fe1d73 --- /dev/null +++ b/src/test/java/org/apache/fop/fonts/truetype/TTFFontLoaderTestCase.java @@ -0,0 +1,61 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fonts.truetype; + +import java.io.File; +import java.io.IOException; +import java.net.URI; + +import org.junit.Test; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.apache.fop.apps.io.InternalResourceResolver; +import org.apache.fop.apps.io.ResourceResolverFactory; +import org.apache.fop.fonts.EmbeddingMode; +import org.apache.fop.fonts.EncodingMode; + +/** + * Test case for {@link OFFontLoader}. + */ +public class TTFFontLoaderTestCase { + + @Test + public void testUseKerning() throws IOException { + boolean useComplexScriptFeatures = false; + File file = new File("test/resources/fonts/ttf/DejaVuLGCSerif.ttf"); + URI absoluteFilePath = file.toURI(); + InternalResourceResolver resourceResolver = ResourceResolverFactory.createDefaultInternalResourceResolver( + new File(".").toURI()); + String fontName = "Deja Vu"; + boolean embedded = false; + boolean useKerning = true; + + OFFontLoader fontLoader = new OFFontLoader(absoluteFilePath, fontName, embedded, + EmbeddingMode.AUTO, EncodingMode.AUTO, useKerning, useComplexScriptFeatures, resourceResolver); + assertTrue(fontLoader.getFont().hasKerningInfo()); + useKerning = false; + + fontLoader = new OFFontLoader(absoluteFilePath, fontName, embedded, EmbeddingMode.AUTO, + EncodingMode.AUTO, useKerning, useComplexScriptFeatures, resourceResolver); + assertFalse(fontLoader.getFont().hasKerningInfo()); + } +} diff --git a/src/test/java/org/apache/fop/fonts/truetype/TTFSubSetFileTestCase.java b/src/test/java/org/apache/fop/fonts/truetype/TTFSubSetFileTestCase.java new file mode 100644 index 000000000..ef0dff5d5 --- /dev/null +++ b/src/test/java/org/apache/fop/fonts/truetype/TTFSubSetFileTestCase.java @@ -0,0 +1,79 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fonts.truetype; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +/** + * This class tests TTFSubSetFile + * TODO: Test with more than just a single font + */ +public class TTFSubSetFileTestCase extends TTFFileTestCase { + private TTFSubSetFile ttfSubset; + private byte[] subset; + /** + * Constructor + * @throws IOException exception + */ + public TTFSubSetFileTestCase() throws IOException { + super(); + } + + /** + * setUp() + * @exception IOException file read error + */ + @Before + public void setUp() throws IOException { + ttfSubset = new TTFSubSetFile(); + Map<Integer, Integer> glyphs = new HashMap<Integer, Integer>(); + for (int i = 0; i < 255; i++) { + glyphs.put(i, i); + } + String header = OFFontLoader.readHeader(dejavuReader); + ttfSubset.readFont(dejavuReader, "DejaVu", header, glyphs); + subset = ttfSubset.getFontSubset(); + } + /** + * Test readFont(FontFileReader, String, Map) - Reads the font and tests the output by injecting + * it into a TTFFile object to check the validity of the file as a font. This currently doesn't + * create a cmap table, and so the font doesn't contain ALL of the mandatory tables. + * @throws IOException exception + */ + @Test + public void testReadFont3Args() throws IOException { + + ByteArrayInputStream byteArray = new ByteArrayInputStream(subset); + FontFileReader reader = new FontFileReader(byteArray); + String header = OFFontLoader.readHeader(reader); + dejavuTTFFile.readFont(reader, header); + // Test a couple arbitrary values + assertEquals(dejavuTTFFile.convertTTFUnit2PDFUnit(-1576), dejavuTTFFile.getFontBBox()[0]); + assertEquals(dejavuTTFFile.getFullName(), "DejaVu LGC Serif"); + } +} diff --git a/src/test/java/org/apache/fop/fonts/truetype/TTFTableNameTestCase.java b/src/test/java/org/apache/fop/fonts/truetype/TTFTableNameTestCase.java new file mode 100644 index 000000000..ac5ab3ddc --- /dev/null +++ b/src/test/java/org/apache/fop/fonts/truetype/TTFTableNameTestCase.java @@ -0,0 +1,153 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fonts.truetype; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +/** + * This class tests the enum org.apache.fop.fonts.truetype.TTFTableName + * + */ +public class TTFTableNameTestCase { + /** + * Test getName() - tests that the getName() method returns the expected String as expected in + * the Directory Table. + * @exception IllegalAccessException error + */ + @Test + public void testGetName() throws IllegalAccessException { + assertEquals("tableDirectory", OFTableName.TABLE_DIRECTORY.getName()); + assertEquals("EBDT", OFTableName.EBDT.getName()); + assertEquals("EBLC", OFTableName.EBLC.getName()); + assertEquals("EBSC", OFTableName.EBSC.getName()); + assertEquals("FFTM", OFTableName.FFTM.getName()); + assertEquals("GDEF", OFTableName.GDEF.getName()); + assertEquals("GPOS", OFTableName.GPOS.getName()); + assertEquals("GSUB", OFTableName.GSUB.getName()); + assertEquals("LTSH", OFTableName.LTSH.getName()); + assertEquals("OS/2", OFTableName.OS2.getName()); + assertEquals("PCLT", OFTableName.PCLT.getName()); + assertEquals("VDMX", OFTableName.VDMX.getName()); + assertEquals("cmap", OFTableName.CMAP.getName()); + assertEquals("cvt ", OFTableName.CVT.getName()); + assertEquals("fpgm", OFTableName.FPGM.getName()); + assertEquals("gasp", OFTableName.GASP.getName()); + assertEquals("glyf", OFTableName.GLYF.getName()); + assertEquals("hdmx", OFTableName.HDMX.getName()); + assertEquals("head", OFTableName.HEAD.getName()); + assertEquals("hhea", OFTableName.HHEA.getName()); + assertEquals("hmtx", OFTableName.HMTX.getName()); + assertEquals("kern", OFTableName.KERN.getName()); + assertEquals("loca", OFTableName.LOCA.getName()); + assertEquals("maxp", OFTableName.MAXP.getName()); + assertEquals("name", OFTableName.NAME.getName()); + assertEquals("post", OFTableName.POST.getName()); + assertEquals("prep", OFTableName.PREP.getName()); + assertEquals("vhea", OFTableName.VHEA.getName()); + assertEquals("vmtx", OFTableName.VMTX.getName()); + // make sure it works with other table names + OFTableName test = OFTableName.getValue("test"); + assertEquals("test", test.getName()); + } + + /** + * Test getValue(String) - tests that the getValue(String) method returns the expected + * TTFTableNames value when it is given a String (name of a table). + * @exception IllegalAccessException error + */ + @Test + public void testGetValue() throws IllegalAccessException { + assertEquals(OFTableName.EBDT, OFTableName.getValue("EBDT")); + assertEquals(OFTableName.EBLC, OFTableName.getValue("EBLC")); + assertEquals(OFTableName.EBSC, OFTableName.getValue("EBSC")); + assertEquals(OFTableName.FFTM, OFTableName.getValue("FFTM")); + assertEquals(OFTableName.LTSH, OFTableName.getValue("LTSH")); + assertEquals(OFTableName.OS2, OFTableName.getValue("OS/2")); + assertEquals(OFTableName.PCLT, OFTableName.getValue("PCLT")); + assertEquals(OFTableName.VDMX, OFTableName.getValue("VDMX")); + assertEquals(OFTableName.CMAP, OFTableName.getValue("cmap")); + assertEquals(OFTableName.CVT, OFTableName.getValue("cvt ")); + assertEquals(OFTableName.FPGM, OFTableName.getValue("fpgm")); + assertEquals(OFTableName.GASP, OFTableName.getValue("gasp")); + assertEquals(OFTableName.GLYF, OFTableName.getValue("glyf")); + assertEquals(OFTableName.HDMX, OFTableName.getValue("hdmx")); + assertEquals(OFTableName.HEAD, OFTableName.getValue("head")); + assertEquals(OFTableName.HHEA, OFTableName.getValue("hhea")); + assertEquals(OFTableName.HMTX, OFTableName.getValue("hmtx")); + assertEquals(OFTableName.KERN, OFTableName.getValue("kern")); + assertEquals(OFTableName.LOCA, OFTableName.getValue("loca")); + assertEquals(OFTableName.MAXP, OFTableName.getValue("maxp")); + assertEquals(OFTableName.NAME, OFTableName.getValue("name")); + assertEquals(OFTableName.POST, OFTableName.getValue("post")); + assertEquals(OFTableName.PREP, OFTableName.getValue("prep")); + assertEquals(OFTableName.VHEA, OFTableName.getValue("vhea")); + assertEquals(OFTableName.VMTX, OFTableName.getValue("vmtx")); + // Test that we can store a random table name and it will not fail or throw an error. + OFTableName test = OFTableName.getValue("random"); + assertTrue(test instanceof OFTableName); + } + + /** + * This class overrides hashCode() - we need to ensure it works properly by instantiating two + * objects and comparing their hash-codes. + * @exception IllegalAccessException error + */ + @Test + public void testHashCode() throws IllegalAccessException { + OFTableName a = OFTableName.getValue("testObject"); + OFTableName b = OFTableName.getValue("testObject"); + assertTrue(a.hashCode() == b.hashCode()); + OFTableName c = OFTableName.getValue("fail"); + assertFalse(a.hashCode() == c.hashCode()); + } + + /** + * This class overrides equals(object) - we need to test: + * 1) Reflexivity + * 2) Symmetry + * 3) Transitivity + * 4) Consistency + * 5) check it fails if you put in a null value + * @throws IllegalAccessException error + */ + @Test + public void testEquals() throws IllegalAccessException { + // Reflexivity + OFTableName a = OFTableName.getValue("test"); + assertTrue(a.equals(a)); + // Symmetry + OFTableName b = OFTableName.getValue("test"); + assertTrue(a.equals(b)); + assertTrue(b.equals(a)); + // Transitivity (tested with symmetry) + // Consistency (test that a == b is true and that a == c fails) + OFTableName c = OFTableName.getValue("fail"); + for (int i = 0; i < 100; i++) { + assertTrue(a.equals(b)); + assertFalse(a.equals(c)); + } + // check with null value + assertFalse(a.equals(null)); + } +} diff --git a/src/test/java/org/apache/fop/fonts/type1/AFMParserTestCase.java b/src/test/java/org/apache/fop/fonts/type1/AFMParserTestCase.java new file mode 100644 index 000000000..31a613567 --- /dev/null +++ b/src/test/java/org/apache/fop/fonts/type1/AFMParserTestCase.java @@ -0,0 +1,140 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fonts.type1; + +import java.awt.Rectangle; +import java.io.IOException; +import java.io.InputStream; +import java.util.List; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +/** + * Test case for {@link AFMParser}. + */ +public class AFMParserTestCase { + + private AFMParser sut = new AFMParser(); + + /** + * We're testing with two identical files except one has: + * EncodingScheme AdobeStandardEncoding + * the other has: + * EncodingScheme ExpectedEncoding + * Both files have the correct character metrics data, and we're checking that both are handled + * consistently with both encoding settings. + * + * @throws IOException if an I/O error occurs + */ + @Test + public void testMappingAgainstAdobeStandardEncoding() throws IOException { + InputStream expectedStream = getClass().getResourceAsStream( + "adobe-charset_unknown-encoding.afm"); + InputStream adobeStandardStream = getClass().getResourceAsStream( + "adobe-charset_adobe-encoding.afm"); + AFMFile expectedParser = sut.parse(expectedStream, null); + AFMFile adobeStandard = sut.parse(adobeStandardStream, null); + List<AFMCharMetrics> adobeMetrics = adobeStandard.getCharMetrics(); + checkCharMtrxList(true, expectedParser.getCharMetrics(), adobeMetrics); + + compareMetrics(adobeMetrics); + + nonAdobeCharsetUnknownEncoding(adobeMetrics); + + nonAdobeCharsetAdobeEncoding(adobeMetrics); + } + + private void compareMetrics(List<AFMCharMetrics> charMetrics) { + // in order to ensure that every character is parsed properly, we're going to check them + // against the AFM file (bboxes were created with a counter) + AdobeStandardEncoding[] standardEncoding = AdobeStandardEncoding.values(); + for (int i = 0; i < charMetrics.size(); i++) { + Rectangle expectedBbox = new Rectangle(i + 1, i + 1, 0, 0); + AFMCharMetrics thisMetric = charMetrics.get(i); + assertTrue(thisMetric.getBBox().equals(expectedBbox)); + assertEquals(thisMetric.getCharName(), standardEncoding[i].getAdobeName()); + } + } + + /** + * A non-adobe encoded file is tested, all the character codes are not AdobeStandardEncoding and + * the encoding is not AdobeStandardEncoding, we are checking a failure case here. Checking that + * the AdobeStandardEncoding isn't forced on other encodings. + * + * @param expected the AdobeStandardEncoding encoded character metrics list + * @throws IOException if an IO error occurs + */ + private void nonAdobeCharsetUnknownEncoding(List<AFMCharMetrics> expected) + throws IOException { + InputStream inStream = getClass().getResourceAsStream( + "notadobe-charset_unknown-encoding.afm"); + AFMFile afmFile = sut.parse(inStream, null); + List<AFMCharMetrics> unknownEncodingMetrics = afmFile.getCharMetrics(); + checkCharMtrxList(false, expected, unknownEncodingMetrics); + } + + /** + * This tests a poorly encoded file, it has AdobeStandardEncoding. We are checking that the + * metrics are correctly analysed against properly encoded char metrics. + * + * @param expected + * @throws IOException + */ + private void nonAdobeCharsetAdobeEncoding(List<AFMCharMetrics> expected) + throws IOException { + InputStream inStream = getClass().getResourceAsStream( + "notadobe-charset_adobe-encoding.afm"); + AFMFile afmFile = sut.parse(inStream, null); + List<AFMCharMetrics> correctedCharMetrics = afmFile.getCharMetrics(); + checkCharMtrxList(true, expected, correctedCharMetrics); + } + + private boolean charMetricsEqual(AFMCharMetrics o1, AFMCharMetrics o2) { + return o1.getCharCode() == o2.getCharCode() + && objectEquals(o1.getCharacter(), o2.getCharacter()) + && o1.getWidthX() == o2.getWidthX() + && o1.getWidthY() == o2.getWidthY() + && objectEquals(o1.getBBox(), o2.getBBox()); + } + + private void checkCharMtrxList(boolean expectedResult, List<AFMCharMetrics> expectedList, + List<AFMCharMetrics> actualList) { + assertEquals(expectedList.size(), actualList.size()); + for (int i = 0; i < expectedList.size(); i++) { + assertEquals(expectedResult, charMetricsEqual(expectedList.get(i), actualList.get(i))); + } + } + + private boolean objectEquals(Object o1, Object o2) { + return o1 == null ? o2 == null : (o1 == o2 || o1.equals(o2)); + } + + @Test + public void testUnderlinePositionAndThickness() throws IOException { + AFMFile afm = sut.parse(getClass().getResourceAsStream("underline.afm"), null); + AFMWritingDirectionMetrics metrics = afm.getWritingDirectionMetrics(0); + assertEquals(-96, metrics.getUnderlinePosition()); + assertEquals(58, metrics.getUnderlineThickness()); + } + +} diff --git a/src/test/java/org/apache/fop/fonts/type1/AdobeStandardEncoding.txt b/src/test/java/org/apache/fop/fonts/type1/AdobeStandardEncoding.txt new file mode 100644 index 000000000..e39486a31 --- /dev/null +++ b/src/test/java/org/apache/fop/fonts/type1/AdobeStandardEncoding.txt @@ -0,0 +1,213 @@ +# +# Name: Adobe Standard Encoding to Unicode +# Unicode version: 2.0 +# Table version: 1.0 +# Date: 2011 July 12 +# +# Copyright (c) 1991-2011 Unicode, Inc. All Rights reserved. +# +# This file is provided as-is by Unicode, Inc. (The Unicode Consortium). No +# claims are made as to fitness for any particular purpose. No warranties of +# any kind are expressed or implied. The recipient agrees to determine +# applicability of information provided. If this file has been provided on +# magnetic media by Unicode, Inc., the sole remedy for any claim will be +# exchange of defective media within 90 days of receipt. +# +# Unicode, Inc. hereby grants the right to freely use the information +# supplied in this file in the creation of products supporting the +# Unicode Standard, and to make copies of this file in any form for +# internal or external distribution as long as this notice remains +# attached. +# +# Format: 4 tab-delimited fields: +# +# (1) The Unicode value (in hexadecimal) +# (2) The Adobe Standard Encoding code point (in hexadecimal) +# (3) # Unicode name +# (4) # PostScript character name +# +# General Notes: +# +# The Unicode values in this table were produced as the result of applying +# the algorithm described in the section "Populating a Unicode space" in the +# document "Unicode and Glyph Names," at +# http://partners.adobe.com/asn/developer/typeforum/unicodegn.html +# to the characters encoded in Adobe Standard Encoding. Note that some +# Standard Encoding characters, such as "space", are mapped to 2 Unicode +# values. Refer to the above document for more details. +# +# 2011 July 12: The above link is no longer valid. For comparable, +# more current information, see the document, "Glyph", at: +# <http://www.adobe.com/devnet/opentype/archives/glyph.html> +# +# Revision History: +# +# [v1.0, 2011 July 12] +# Updated terms of use to current wording. +# Updated contact information and document link. +# No changes to the mapping data. +# +# [v0.2, 30 March 1999] +# Different algorithm to produce Unicode values (see notes above) results in +# some character codes being mapped to 2 Unicode values. Updated Unicode +# names to Unicode 2.0 names. +# +# [v0.1, 5 May 1995] First release. +# +# Use the Unicode reporting form <http://www.unicode.org/reporting.html> +# for any questions or comments or to report errors in the data. +# +0020 20 # SPACE # space +00A0 20 # NO-BREAK SPACE # space +0021 21 # EXCLAMATION MARK # exclam +0022 22 # QUOTATION MARK # quotedbl +0023 23 # NUMBER SIGN # numbersign +0024 24 # DOLLAR SIGN # dollar +0025 25 # PERCENT SIGN # percent +0026 26 # AMPERSAND # ampersand +2019 27 # RIGHT SINGLE QUOTATION MARK # quoteright +0028 28 # LEFT PARENTHESIS # parenleft +0029 29 # RIGHT PARENTHESIS # parenright +002A 2A # ASTERISK # asterisk +002B 2B # PLUS SIGN # plus +002C 2C # COMMA # comma +002D 2D # HYPHEN-MINUS # hyphen +00AD 2D # SOFT HYPHEN # hyphen +002E 2E # FULL STOP # period +002F 2F # SOLIDUS # slash +0030 30 # DIGIT ZERO # zero +0031 31 # DIGIT ONE # one +0032 32 # DIGIT TWO # two +0033 33 # DIGIT THREE # three +0034 34 # DIGIT FOUR # four +0035 35 # DIGIT FIVE # five +0036 36 # DIGIT SIX # six +0037 37 # DIGIT SEVEN # seven +0038 38 # DIGIT EIGHT # eight +0039 39 # DIGIT NINE # nine +003A 3A # COLON # colon +003B 3B # SEMICOLON # semicolon +003C 3C # LESS-THAN SIGN # less +003D 3D # EQUALS SIGN # equal +003E 3E # GREATER-THAN SIGN # greater +003F 3F # QUESTION MARK # question +0040 40 # COMMERCIAL AT # at +0041 41 # LATIN CAPITAL LETTER A # A +0042 42 # LATIN CAPITAL LETTER B # B +0043 43 # LATIN CAPITAL LETTER C # C +0044 44 # LATIN CAPITAL LETTER D # D +0045 45 # LATIN CAPITAL LETTER E # E +0046 46 # LATIN CAPITAL LETTER F # F +0047 47 # LATIN CAPITAL LETTER G # G +0048 48 # LATIN CAPITAL LETTER H # H +0049 49 # LATIN CAPITAL LETTER I # I +004A 4A # LATIN CAPITAL LETTER J # J +004B 4B # LATIN CAPITAL LETTER K # K +004C 4C # LATIN CAPITAL LETTER L # L +004D 4D # LATIN CAPITAL LETTER M # M +004E 4E # LATIN CAPITAL LETTER N # N +004F 4F # LATIN CAPITAL LETTER O # O +0050 50 # LATIN CAPITAL LETTER P # P +0051 51 # LATIN CAPITAL LETTER Q # Q +0052 52 # LATIN CAPITAL LETTER R # R +0053 53 # LATIN CAPITAL LETTER S # S +0054 54 # LATIN CAPITAL LETTER T # T +0055 55 # LATIN CAPITAL LETTER U # U +0056 56 # LATIN CAPITAL LETTER V # V +0057 57 # LATIN CAPITAL LETTER W # W +0058 58 # LATIN CAPITAL LETTER X # X +0059 59 # LATIN CAPITAL LETTER Y # Y +005A 5A # LATIN CAPITAL LETTER Z # Z +005B 5B # LEFT SQUARE BRACKET # bracketleft +005C 5C # REVERSE SOLIDUS # backslash +005D 5D # RIGHT SQUARE BRACKET # bracketright +005E 5E # CIRCUMFLEX ACCENT # asciicircum +005F 5F # LOW LINE # underscore +2018 60 # LEFT SINGLE QUOTATION MARK # quoteleft +0061 61 # LATIN SMALL LETTER A # a +0062 62 # LATIN SMALL LETTER B # b +0063 63 # LATIN SMALL LETTER C # c +0064 64 # LATIN SMALL LETTER D # d +0065 65 # LATIN SMALL LETTER E # e +0066 66 # LATIN SMALL LETTER F # f +0067 67 # LATIN SMALL LETTER G # g +0068 68 # LATIN SMALL LETTER H # h +0069 69 # LATIN SMALL LETTER I # i +006A 6A # LATIN SMALL LETTER J # j +006B 6B # LATIN SMALL LETTER K # k +006C 6C # LATIN SMALL LETTER L # l +006D 6D # LATIN SMALL LETTER M # m +006E 6E # LATIN SMALL LETTER N # n +006F 6F # LATIN SMALL LETTER O # o +0070 70 # LATIN SMALL LETTER P # p +0071 71 # LATIN SMALL LETTER Q # q +0072 72 # LATIN SMALL LETTER R # r +0073 73 # LATIN SMALL LETTER S # s +0074 74 # LATIN SMALL LETTER T # t +0075 75 # LATIN SMALL LETTER U # u +0076 76 # LATIN SMALL LETTER V # v +0077 77 # LATIN SMALL LETTER W # w +0078 78 # LATIN SMALL LETTER X # x +0079 79 # LATIN SMALL LETTER Y # y +007A 7A # LATIN SMALL LETTER Z # z +007B 7B # LEFT CURLY BRACKET # braceleft +007C 7C # VERTICAL LINE # bar +007D 7D # RIGHT CURLY BRACKET # braceright +007E 7E # TILDE # asciitilde +00A1 A1 # INVERTED EXCLAMATION MARK # exclamdown +00A2 A2 # CENT SIGN # cent +00A3 A3 # POUND SIGN # sterling +2044 A4 # FRACTION SLASH # fraction +2215 A4 # DIVISION SLASH # fraction +00A5 A5 # YEN SIGN # yen +0192 A6 # LATIN SMALL LETTER F WITH HOOK # florin +00A7 A7 # SECTION SIGN # section +00A4 A8 # CURRENCY SIGN # currency +0027 A9 # APOSTROPHE # quotesingle +201C AA # LEFT DOUBLE QUOTATION MARK # quotedblleft +00AB AB # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK # guillemotleft +2039 AC # SINGLE LEFT-POINTING ANGLE QUOTATION MARK # guilsinglleft +203A AD # SINGLE RIGHT-POINTING ANGLE QUOTATION MARK # guilsinglright +FB01 AE # LATIN SMALL LIGATURE FI # fi +FB02 AF # LATIN SMALL LIGATURE FL # fl +2013 B1 # EN DASH # endash +2020 B2 # DAGGER # dagger +2021 B3 # DOUBLE DAGGER # daggerdbl +00B7 B4 # MIDDLE DOT # periodcentered +2219 B4 # BULLET OPERATOR # periodcentered +00B6 B6 # PILCROW SIGN # paragraph +2022 B7 # BULLET # bullet +201A B8 # SINGLE LOW-9 QUOTATION MARK # quotesinglbase +201E B9 # DOUBLE LOW-9 QUOTATION MARK # quotedblbase +201D BA # RIGHT DOUBLE QUOTATION MARK # quotedblright +00BB BB # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK # guillemotright +2026 BC # HORIZONTAL ELLIPSIS # ellipsis +2030 BD # PER MILLE SIGN # perthousand +00BF BF # INVERTED QUESTION MARK # questiondown +0060 C1 # GRAVE ACCENT # grave +00B4 C2 # ACUTE ACCENT # acute +02C6 C3 # MODIFIER LETTER CIRCUMFLEX ACCENT # circumflex +02DC C4 # SMALL TILDE # tilde +00AF C5 # MACRON # macron +02C9 C5 # MODIFIER LETTER MACRON # macron +02D8 C6 # BREVE # breve +02D9 C7 # DOT ABOVE # dotaccent +00A8 C8 # DIAERESIS # dieresis +02DA CA # RING ABOVE # ring +00B8 CB # CEDILLA # cedilla +02DD CD # DOUBLE ACUTE ACCENT # hungarumlaut +02DB CE # OGONEK # ogonek +02C7 CF # CARON # caron +2014 D0 # EM DASH # emdash +00C6 E1 # LATIN CAPITAL LETTER AE # AE +00AA E3 # FEMININE ORDINAL INDICATOR # ordfeminine +0141 E8 # LATIN CAPITAL LETTER L WITH STROKE # Lslash +00D8 E9 # LATIN CAPITAL LETTER O WITH STROKE # Oslash +0152 EA # LATIN CAPITAL LIGATURE OE # OE +00BA EB # MASCULINE ORDINAL INDICATOR # ordmasculine +00E6 F1 # LATIN SMALL LETTER AE # ae +0131 F5 # LATIN SMALL LETTER DOTLESS I # dotlessi +0142 F8 # LATIN SMALL LETTER L WITH STROKE # lslash +00F8 F9 # LATIN SMALL LETTER O WITH STROKE # oslash +0153 FA # LATIN SMALL LIGATURE OE # oe +00DF FB # LATIN SMALL LETTER SHARP S # germandbls diff --git a/src/test/java/org/apache/fop/fonts/type1/AdobeStandardEncodingTestCase.java b/src/test/java/org/apache/fop/fonts/type1/AdobeStandardEncodingTestCase.java new file mode 100644 index 000000000..a3a3e1c40 --- /dev/null +++ b/src/test/java/org/apache/fop/fonts/type1/AdobeStandardEncodingTestCase.java @@ -0,0 +1,84 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fonts.type1; + +import java.io.BufferedReader; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; + +import org.junit.BeforeClass; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +/** + * Test case for {@link AdobeStandardEncoding}. + */ +public class AdobeStandardEncodingTestCase { + + private static BufferedReader adobeStandardEncoding; + + /** + * Sets up the file reader, this file was retrieved from the url below. + * http://unicode.org/Public/MAPPINGS/VENDORS/ADOBE/stdenc.txt + * + * @throws FileNotFoundException if the file was not found + */ + @BeforeClass + public static void setupReader() throws FileNotFoundException { + InputStream inStream = AdobeStandardEncodingTestCase.class.getResourceAsStream( + "AdobeStandardEncoding.txt"); + adobeStandardEncoding = new BufferedReader(new InputStreamReader(inStream)); + } + + /** + * Probably the best way to test the encoding is by converting it back to format specified in + * the file, that way we can ensure data has been migrated properly. + * + * @throws IOException if an I/O error occurs + */ + @Test + public void testCorrectEncoding() throws IOException { + for (AdobeStandardEncoding encoding : AdobeStandardEncoding.values()) { + String expectedLine = getLine(); + String hexUnicode = toHexString(encoding.getUnicodeIndex(), 4); + String hexAdobe = toHexString(encoding.getAdobeCodePoint(), 2); + String actualLine = hexUnicode + "\t" + + hexAdobe + "\t# " + + encoding.getUnicodeName() + "\t# " + + encoding.getAdobeName(); + assertEquals(expectedLine, actualLine); + } + } + + private String getLine() throws IOException { + String line = "# The first few lines are comments, these should be ignored"; + while (line.startsWith("#")) { + line = adobeStandardEncoding.readLine(); + } + return line; + } + + private String toHexString(int number, int length) { + return String.format("%0" + length + "X", number); + } +} diff --git a/src/test/java/org/apache/fop/fonts/type1/CharMetricsHandlerTestCase.java b/src/test/java/org/apache/fop/fonts/type1/CharMetricsHandlerTestCase.java new file mode 100644 index 000000000..c3e9334dd --- /dev/null +++ b/src/test/java/org/apache/fop/fonts/type1/CharMetricsHandlerTestCase.java @@ -0,0 +1,85 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fonts.type1; + +import java.awt.Rectangle; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.Stack; + +import org.junit.Test; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import org.apache.fop.fonts.NamedCharacter; +import org.apache.fop.fonts.type1.AFMParser.ValueHandler; + +/** + * Test case for {@link CharMetricsHandler}. + */ +public class CharMetricsHandlerTestCase { + + private static final String GOOD_LINE = "C 32 ; WX 32 ; N space ; B 1 1 1 1"; + + private static final AFMCharMetrics EXPECTED_CHM; + + static { + EXPECTED_CHM = new AFMCharMetrics(); + EXPECTED_CHM.setCharCode(32); + EXPECTED_CHM.setWidthX(32.0); + EXPECTED_CHM.setCharacter(new NamedCharacter("space")); + EXPECTED_CHM.setBBox(new Rectangle(1, 1, 0, 0)); + } + + @Test + public void testHandlers() throws IOException { + testEncodingWithMetricsLine("", GOOD_LINE); + testEncodingWithMetricsLine("WrongEncoding", GOOD_LINE); + testEncodingWithMetricsLine("AdobeStandardEncoding", GOOD_LINE); + } + + private void testEncodingWithMetricsLine(String encoding, String line) throws IOException { + Map<String, ValueHandler> valueParsers = mock(HashMap.class); + ValueHandler cHandler = mock(ValueHandler.class); + ValueHandler wxHandler = mock(ValueHandler.class); + ValueHandler nHandler = mock(ValueHandler.class); + ValueHandler bHandler = mock(ValueHandler.class); + when(valueParsers.get("C")).thenReturn(cHandler); + when(valueParsers.get("WX")).thenReturn(wxHandler); + when(valueParsers.get("N")).thenReturn(nHandler); + when(valueParsers.get("B")).thenReturn(bHandler); + + CharMetricsHandler handler = CharMetricsHandler.getHandler(valueParsers, encoding); + Stack<Object> stack = new Stack<Object>(); + handler.parse(line, stack, null); + + verify(valueParsers).get("C"); + verify(valueParsers).get("WX"); + verify(valueParsers).get("N"); + verify(valueParsers).get("B"); + verify(cHandler).parse("32", 0, new Stack<Object>()); + verify(wxHandler).parse("32", 0, new Stack<Object>()); + verify(nHandler).parse("space", 0, new Stack<Object>()); + verify(bHandler).parse("1 1 1 1", 0, new Stack<Object>()); + } +} diff --git a/src/test/java/org/apache/fop/fonts/type1/PostscriptParserTestCase.java b/src/test/java/org/apache/fop/fonts/type1/PostscriptParserTestCase.java new file mode 100644 index 000000000..8686dc048 --- /dev/null +++ b/src/test/java/org/apache/fop/fonts/type1/PostscriptParserTestCase.java @@ -0,0 +1,93 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fonts.type1; + +import java.io.IOException; +import java.util.List; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import org.apache.fop.fonts.type1.PostscriptParser.PSDictionary; +import org.apache.fop.fonts.type1.PostscriptParser.PSElement; +import org.apache.fop.fonts.type1.PostscriptParser.PSFixedArray; +import org.apache.fop.fonts.type1.PostscriptParser.PSSubroutine; +import org.apache.fop.fonts.type1.PostscriptParser.PSVariable; +import org.apache.fop.fonts.type1.PostscriptParser.PSVariableArray; + +public class PostscriptParserTestCase { + private PostscriptParser parser; + private String eol = new String(new byte[] {13}); + private String postscriptElements = + "/myVariable 100 def" + eol + + "/-| {def} executeonly def" + eol + + "/myFixedArray 6 array" + eol + + "0 1 5 {1 index exch /.notdef put } for" + eol + + "dup 1 /a put" + eol + + "dup 2 /b put" + eol + + "dup 3 /c put" + eol + + "dup 4 /d put" + eol + + "readonly def" + eol + + "/myVariableArray [ { this } { is } { a } { test } ] no access def" + eol + + "/refVarSubr myValue -|"; + + @Before + public void setUp() { + parser = new PostscriptParser(); + } + + /** + * Tests parsing an example Postscript document and verifying what + * has been read. + * @throws IOException + */ + @Test + public void testPostscriptParsing() throws IOException { + List<PSElement> elements = parser.parse(postscriptElements.getBytes()); + assertEquals(elements.size(), 5); + assertTrue(elements.get(0) instanceof PSVariable); + assertTrue(elements.get(2) instanceof PSFixedArray); + assertTrue(elements.get(3) instanceof PSVariableArray); + PSFixedArray fixedArray = (PSFixedArray)elements.get(2); + assertEquals(fixedArray.getEntries().size(), 4); + assertEquals(fixedArray.getEntries().get(2), "dup 2 /b put "); + PSVariableArray variableArray = (PSVariableArray)elements.get(3); + assertEquals(variableArray.getEntries().size(), 4); + /* Currently only variable arrays containing subroutines are supported, though + * this can be modified to support single values and also strip out unnecessary + * characters like the { } below. */ + assertEquals(variableArray.getEntries().get(0).trim(), "{ this }"); + } + + /** + * Tests that the correct element is returned given the operator and element ID provided + */ + @Test + public void testCreateElement() { + assertTrue(parser.createElement("/custDictionary", "dict", -1) instanceof PSDictionary); + assertEquals(parser.createElement("/Private", "dict", -1), null); + assertTrue(parser.createElement("/aFixedArray", "array", -1) instanceof PSFixedArray); + assertTrue(parser.createElement("/aVariableArray", "[", -1) instanceof PSVariableArray); + assertTrue(parser.createElement("/aSubroutine", "{", -1) instanceof PSSubroutine); + } +} diff --git a/src/test/java/org/apache/fop/fonts/type1/Type1SubsetFileTestCase.java b/src/test/java/org/apache/fop/fonts/type1/Type1SubsetFileTestCase.java new file mode 100644 index 000000000..3d7093bd3 --- /dev/null +++ b/src/test/java/org/apache/fop/fonts/type1/Type1SubsetFileTestCase.java @@ -0,0 +1,337 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fonts.type1; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.URI; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.junit.Test; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import org.apache.xmlgraphics.fonts.Glyphs; + +import org.apache.fop.fonts.SingleByteFont; +import org.apache.fop.fonts.type1.PostscriptParser.PSDictionary; +import org.apache.fop.fonts.type1.PostscriptParser.PSElement; +import org.apache.fop.fonts.type1.PostscriptParser.PSFixedArray; +import org.apache.fop.fonts.type1.Type1SubsetFile.BinaryCoder; +import org.apache.fop.fonts.type1.Type1SubsetFile.BytesNumber; + +public class Type1SubsetFileTestCase { + + private List<byte[]> decodedSections; + private static final String TEST_FONT_A = "./test/resources/fonts/type1/c0419bt_.pfb"; + + @Test + public void test() throws IOException { + InputStream in = new FileInputStream(TEST_FONT_A); + compareCharStringData(TEST_FONT_A, createFontASubset(in, TEST_FONT_A)); + } + + @Test + public void testStitchFont() throws IOException { + ByteArrayOutputStream baosHeader = new ByteArrayOutputStream(); + ByteArrayOutputStream baosMain = new ByteArrayOutputStream(); + ByteArrayOutputStream baosTrailer = new ByteArrayOutputStream(); + + //Header + for (int i = 0; i < 10; i++) { + baosHeader.write(123); + baosMain.write(123); + } + for (int i = 0; i < 10; i++) { + baosTrailer.write(0); + } + + Type1SubsetFile subset = new Type1SubsetFile(); + byte[] result = subset.stitchFont(baosHeader, baosMain, baosTrailer); + ByteArrayInputStream bais = new ByteArrayInputStream(result); + assertEquals(result.length, 50); + PFBParser parser = new PFBParser(); + parser.parsePFB(bais); + } + + @Test + public void testUpdateSectionSize() throws IOException { + Type1SubsetFile subset = new Type1SubsetFile(); + ByteArrayOutputStream baos = subset.updateSectionSize(456); + byte[] lowOrderSize = baos.toByteArray(); + assertEquals(lowOrderSize[0], -56); + assertEquals(lowOrderSize[1], 1); + } + + @Test + public void testVariableContents() { + Type1SubsetFile subset = new Type1SubsetFile(); + String result = subset.readVariableContents("/myvariable {some variable contents}"); + assertEquals(result, "some variable contents"); + result = subset.readVariableContents("/myvariable {hello {some more text {test} and some more}test}"); + //Should only reads one level deep + assertEquals(result, "hello test"); + } + + @Test + public void getOpPositionAndLength() { + Type1SubsetFile subset = new Type1SubsetFile(); + ArrayList<BytesNumber> ops = new ArrayList<BytesNumber>(); + ops.add(new BytesNumber(10, 1)); + ops.add(new BytesNumber(255, 2)); + ops.add(new BytesNumber(100, 1)); + ops.add(new BytesNumber(97, 1)); + ops.add(new BytesNumber(856, 2)); + assertEquals(subset.getOpPosition(4, ops), 4); + assertEquals(subset.getOperandsLength(ops), 7); + } + + @Test + public void testConcatArrays() { + byte[] arrayA = {(byte)1, (byte)2, (byte)3, (byte)4, (byte)5}; + byte[] arrayB = {(byte)6, (byte)7, (byte)8, (byte)9, (byte)10}; + Type1SubsetFile subset = new Type1SubsetFile(); + byte[] concatArray = subset.concatArray(arrayA, arrayB); + assertEquals(concatArray.length, 10); + assertEquals(concatArray[5], 6); + assertEquals(concatArray[3], 4); + } + + @Test + public void testGetBinaryEntry() { + byte[] decoded = {(byte)34, (byte)23, (byte)78, (byte)55, (byte)12, + (byte)2, (byte)65, (byte)49, (byte)90, (byte)10}; + int[] section = {3, 7}; + Type1SubsetFile subset = new Type1SubsetFile(); + byte[] segment = subset.getBinaryEntry(section, decoded); + assertEquals(segment.length, 4); + assertEquals(segment[0], 55); + assertEquals(segment[3], 65); + } + + private void compareCharStringData(String font, byte[] subsetFont) + throws IOException { + decodedSections = new ArrayList<byte[]>(); + + //Reinitialise the input stream as reset only supports 1000 bytes. + InputStream in = new FileInputStream(font); + List<PSElement> origElements = parseElements(in); + List<PSElement> subsetElements = parseElements(new ByteArrayInputStream(subsetFont)); + + PSFixedArray origSubs = (PSFixedArray)findElement(origElements, "/Subrs"); + PSFixedArray subsetSubs = (PSFixedArray)findElement(subsetElements, "/Subrs"); + PSDictionary origCharStrings = (PSDictionary)findElement(origElements, "/CharStrings"); + PSDictionary subsetCharStrings = (PSDictionary)findElement(subsetElements, "/CharStrings"); + for (String element : subsetCharStrings.getEntries().keySet()) { + if (element.equals("/.notdef")) { + continue; + } + int[] origBinaryCharLocation = origCharStrings.getBinaryEntries().get(element); + int[] subsetBinaryCharLocation = subsetCharStrings.getBinaryEntries().get(element); + + int origLength = origBinaryCharLocation[1] - origBinaryCharLocation[0]; + int subsetLength = subsetBinaryCharLocation[1] - subsetBinaryCharLocation[0]; + byte[] origCharData = new byte[origLength]; + byte[] subsetCharData = new byte[subsetLength]; + System.arraycopy(decodedSections.get(0), origBinaryCharLocation[0], origCharData, 0, origLength); + System.arraycopy(decodedSections.get(1), subsetBinaryCharLocation[0], subsetCharData, 0, subsetLength); + origCharData = BinaryCoder.decodeBytes(origCharData, 4330, 4); + subsetCharData = BinaryCoder.decodeBytes(subsetCharData, 4330, 4); + byte[] origFullCharData = readFullCharString(decodedSections.get(0), origCharData, origSubs); + byte[] subsetFullCharData = readFullCharString(decodedSections.get(1), subsetCharData, subsetSubs); + assertArrayEquals(origFullCharData, subsetFullCharData); + } + } + + private byte[] createFontASubset(InputStream in, String font) throws IOException { + SingleByteFont sbfont = mock(SingleByteFont.class); + //Glyph index & selector + Map<Integer, Integer> glyphs = new HashMap<Integer, Integer>(); + Map<Integer, String> usedCharNames = new HashMap<Integer, String>(); + int count = 0; + for (int i = 32; i < 127; i++) { + glyphs.put(i, count++); + when(sbfont.getUnicodeFromSelector(count)).thenReturn((char)i); + usedCharNames.put(i, String.format("/%s", Glyphs.charToGlyphName((char)i))); + when(sbfont.getGlyphName(i)).thenReturn(AdobeStandardEncoding.getCharFromCodePoint(i)); + } + for (int i = 161; i < 204; i++) { + glyphs.put(i, count++); + when(sbfont.getUnicodeFromSelector(count)).thenReturn((char)i); + usedCharNames.put(i, String.format("/%s", Glyphs.charToGlyphName((char)i))); + when(sbfont.getGlyphName(i)).thenReturn(AdobeStandardEncoding.getCharFromCodePoint(i)); + } + int[] randomGlyphs = {205, 206, 207, 208, 225, 227, 232, 233, 234, 235, 241, 245, + 248, 249, 250, 251 + }; + for (int i = 0; i < randomGlyphs.length; i++) { + glyphs.put(randomGlyphs[i], count++); + when(sbfont.getUnicodeFromSelector(count)).thenReturn((char)randomGlyphs[i]); + usedCharNames.put(i, String.format("/%s", Glyphs.charToGlyphName((char)i))); + when(sbfont.getGlyphName(i)).thenReturn(AdobeStandardEncoding.getCharFromCodePoint(i)); + } + for (int i = 256; i < 335; i++) { + glyphs.put(i, count++); + when(sbfont.getUnicodeFromSelector(count)).thenReturn((char)i); + usedCharNames.put(i, String.format("/%s", Glyphs.charToGlyphName((char)i))); + when(sbfont.getGlyphName(i)).thenReturn(AdobeStandardEncoding.getCharFromCodePoint(i)); + } + when(sbfont.getUsedGlyphNames()).thenReturn(usedCharNames); + when(sbfont.getUsedGlyphs()).thenReturn(glyphs); + when(sbfont.getEmbedFileURI()).thenReturn(URI.create(font)); + Type1SubsetFile subset = new Type1SubsetFile(); + return subset.createSubset(in, sbfont); + } + + private List<PSElement> parseElements(InputStream in) + throws IOException { + PFBParser pfbParser = new PFBParser(); + PFBData origData = pfbParser.parsePFB(in); + PostscriptParser parser = new PostscriptParser(); + byte[] decoded = BinaryCoder.decodeBytes(origData.getEncryptedSegment(), 55665, 4); + decodedSections.add(decoded); + return parser.parse(decoded); + } + + private PSElement findElement(List<PSElement> elements, String operator) { + for (PSElement element : elements) { + if (element.getOperator().equals(operator)) { + return element; + } + } + return null; + } + + private byte[] readFullCharString(byte[] decoded, byte[] data, PSFixedArray subroutines) { + List<BytesNumber> operands = new ArrayList<BytesNumber>(); + for (int i = 0; i < data.length; i++) { + int cur = data[i] & 0xFF; + if (cur >= 0 && cur <= 31) { + //Found subroutine. Read subroutine, recursively scan and update references + if (cur == 10) { + if (operands.size() == 0) { + continue; + } + int[] subrData = subroutines.getBinaryEntryByIndex(operands.get(0).getNumber()); + byte[] subroutine = getBinaryEntry(subrData, decoded); + subroutine = BinaryCoder.decodeBytes(subroutine, 4330, 4); + subroutine = readFullCharString(decoded, subroutine, subroutines); + data = replaceReference(data, subroutine, i - 1 + operands.get(0).getNumBytes(), i); + } else { + int next = -1; + if (cur == 12) { + next = data[++i] & 0xFF; + } + BytesNumber operand = new BytesNumber(cur, i); + operand.setName(getName(cur, next)); + } + operands.clear(); + } + if (cur >= 32 && cur <= 246) { + operands.add(new BytesNumber(cur - 139, 1)); + } else if (cur >= 247 && cur <= 250) { + operands.add(new BytesNumber((cur - 247) * 256 + (data[i + 1] & 0xFF) + 108, 2)); + i++; + } else if (cur >= 251 && cur <= 254) { + operands.add(new BytesNumber(-(cur - 251) * 256 - (data[i + 1] & 0xFF) - 108, 2)); + i++; + } else if (cur == 255) { + int b1 = data[i + 1] & 0xFF; + int b2 = data[i + 2] & 0xFF; + int b3 = data[i + 3] & 0xFF; + int b4 = data[i + 4] & 0xFF; + int value = b1 << 24 | b2 << 16 | b3 << 8 | b4; + operands.add(new BytesNumber(value, 5)); + i += 4; + } + } + return data; + } + + private String getName(int operator, int next) { + switch (operator) { + case 14: return "endchar"; + case 13: return "hsbw"; + case 12: + switch (next) { + case 0: return "dotsection"; + case 1: return "vstem3"; + case 2: return "hstem3"; + case 6: return "seac"; + case 7: return "sbw"; + case 16: return "callothersubr"; + case 17: return "pop"; + case 33: return "setcurrentpoint"; + default: return "unknown"; + } + case 9: return "closepath"; + case 6: return "hlineto"; + case 22: return "hmoveto"; + case 31: return "hvcurveto"; + case 5: return "rlineto"; + case 21: return "rmoveto"; + case 8: return "rrcurveto"; + case 30: return "vhcurveto"; + case 7: return "vlineto"; + case 4: return "vmoveto"; + case 1: return "hstem"; + case 3: return "vstem"; + case 10: return "callsubr"; + case 11: return "return"; + default: return "unknown"; + } + } + + private byte[] replaceReference(byte[] data, byte[] subroutine, int startRef, int endRef) { + byte[] preBytes = new byte[startRef - 1]; + System.arraycopy(data, 0, preBytes, 0, startRef - 1); + byte[] postBytes = new byte[data.length - endRef - 1]; + System.arraycopy(data, endRef + 1, postBytes, 0, data.length - endRef - 1); + data = concatArray(preBytes, subroutine, 1); + data = concatArray(data, postBytes, 0); + return data; + } + + private byte[] getBinaryEntry(int[] position, byte[] decoded) { + int start = position[0]; + int finish = position[1]; + byte[] line = new byte[finish - start]; + System.arraycopy(decoded, start, line, 0, finish - start); + return line; + } + + private byte[] concatArray(byte[] a, byte[] b, int subtract) { + int aLen = a.length; + int bLen = b.length - subtract; + byte[] c = new byte[aLen + bLen]; + System.arraycopy(a, 0, c, 0, aLen); + System.arraycopy(b, 0, c, aLen, bLen); + return c; + } +} diff --git a/src/test/java/org/apache/fop/fonts/type1/adobe-charset_adobe-encoding.afm b/src/test/java/org/apache/fop/fonts/type1/adobe-charset_adobe-encoding.afm new file mode 100644 index 000000000..50f8c3381 --- /dev/null +++ b/src/test/java/org/apache/fop/fonts/type1/adobe-charset_adobe-encoding.afm @@ -0,0 +1,158 @@ +StartFontMetrics 2.0 +EncodingScheme AdobeStandardEncoding +StartCharMetrics 154 +C 32 ; WX 32 ; N space ; B 1 1 1 1 +C 32 ; WX 32 ; N space ; B 2 2 2 2 +C 33 ; WX 33 ; N exclam ; B 3 3 3 3 +C 34 ; WX 34 ; N quotedbl ; B 4 4 4 4 +C 35 ; WX 35 ; N numbersign ; B 5 5 5 5 +C 36 ; WX 36 ; N dollar ; B 6 6 6 6 +C 37 ; WX 37 ; N percent ; B 7 7 7 7 +C 38 ; WX 38 ; N ampersand ; B 8 8 8 8 +C 39 ; WX 39 ; N quoteright ; B 9 9 9 9 +C 40 ; WX 40 ; N parenleft ; B 10 10 10 10 +C 41 ; WX 41 ; N parenright ; B 11 11 11 11 +C 42 ; WX 42 ; N asterisk ; B 12 12 12 12 +C 43 ; WX 43 ; N plus ; B 13 13 13 13 +C 44 ; WX 44 ; N comma ; B 14 14 14 14 +C 45 ; WX 45 ; N hyphen ; B 15 15 15 15 +C 45 ; WX 45 ; N hyphen ; B 16 16 16 16 +C 46 ; WX 46 ; N period ; B 17 17 17 17 +C 47 ; WX 47 ; N slash ; B 18 18 18 18 +C 48 ; WX 48 ; N zero ; B 19 19 19 19 +C 49 ; WX 49 ; N one ; B 20 20 20 20 +C 50 ; WX 50 ; N two ; B 21 21 21 21 +C 51 ; WX 51 ; N three ; B 22 22 22 22 +C 52 ; WX 52 ; N four ; B 23 23 23 23 +C 53 ; WX 53 ; N five ; B 24 24 24 24 +C 54 ; WX 54 ; N six ; B 25 25 25 25 +C 55 ; WX 55 ; N seven ; B 26 26 26 26 +C 56 ; WX 56 ; N eight ; B 27 27 27 27 +C 57 ; WX 57 ; N nine ; B 28 28 28 28 +C 58 ; WX 58 ; N colon ; B 29 29 29 29 +C 59 ; WX 59 ; N semicolon ; B 30 30 30 30 +C 60 ; WX 60 ; N less ; B 31 31 31 31 +C 61 ; WX 61 ; N equal ; B 32 32 32 32 +C 62 ; WX 62 ; N greater ; B 33 33 33 33 +C 63 ; WX 63 ; N question ; B 34 34 34 34 +C 64 ; WX 64 ; N at ; B 35 35 35 35 +C 65 ; WX 65 ; N A ; B 36 36 36 36 +C 66 ; WX 66 ; N B ; B 37 37 37 37 +C 67 ; WX 67 ; N C ; B 38 38 38 38 +C 68 ; WX 68 ; N D ; B 39 39 39 39 +C 69 ; WX 69 ; N E ; B 40 40 40 40 +C 70 ; WX 70 ; N F ; B 41 41 41 41 +C 71 ; WX 71 ; N G ; B 42 42 42 42 +C 72 ; WX 72 ; N H ; B 43 43 43 43 +C 73 ; WX 73 ; N I ; B 44 44 44 44 +C 74 ; WX 74 ; N J ; B 45 45 45 45 +C 75 ; WX 75 ; N K ; B 46 46 46 46 +C 76 ; WX 76 ; N L ; B 47 47 47 47 +C 77 ; WX 77 ; N M ; B 48 48 48 48 +C 78 ; WX 78 ; N N ; B 49 49 49 49 +C 79 ; WX 79 ; N O ; B 50 50 50 50 +C 80 ; WX 80 ; N P ; B 51 51 51 51 +C 81 ; WX 81 ; N Q ; B 52 52 52 52 +C 82 ; WX 82 ; N R ; B 53 53 53 53 +C 83 ; WX 83 ; N S ; B 54 54 54 54 +C 84 ; WX 84 ; N T ; B 55 55 55 55 +C 85 ; WX 85 ; N U ; B 56 56 56 56 +C 86 ; WX 86 ; N V ; B 57 57 57 57 +C 87 ; WX 87 ; N W ; B 58 58 58 58 +C 88 ; WX 88 ; N X ; B 59 59 59 59 +C 89 ; WX 89 ; N Y ; B 60 60 60 60 +C 90 ; WX 90 ; N Z ; B 61 61 61 61 +C 91 ; WX 91 ; N bracketleft ; B 62 62 62 62 +C 92 ; WX 92 ; N backslash ; B 63 63 63 63 +C 93 ; WX 93 ; N bracketright ; B 64 64 64 64 +C 94 ; WX 94 ; N asciicircum ; B 65 65 65 65 +C 95 ; WX 95 ; N underscore ; B 66 66 66 66 +C 96 ; WX 96 ; N quoteleft ; B 67 67 67 67 +C 97 ; WX 97 ; N a ; B 68 68 68 68 +C 98 ; WX 98 ; N b ; B 69 69 69 69 +C 99 ; WX 99 ; N c ; B 70 70 70 70 +C 100 ; WX 100 ; N d ; B 71 71 71 71 +C 101 ; WX 101 ; N e ; B 72 72 72 72 +C 102 ; WX 102 ; N f ; B 73 73 73 73 +C 103 ; WX 103 ; N g ; B 74 74 74 74 +C 104 ; WX 104 ; N h ; B 75 75 75 75 +C 105 ; WX 105 ; N i ; B 76 76 76 76 +C 106 ; WX 106 ; N j ; B 77 77 77 77 +C 107 ; WX 107 ; N k ; B 78 78 78 78 +C 108 ; WX 108 ; N l ; B 79 79 79 79 +C 109 ; WX 109 ; N m ; B 80 80 80 80 +C 110 ; WX 110 ; N n ; B 81 81 81 81 +C 111 ; WX 111 ; N o ; B 82 82 82 82 +C 112 ; WX 112 ; N p ; B 83 83 83 83 +C 113 ; WX 113 ; N q ; B 84 84 84 84 +C 114 ; WX 114 ; N r ; B 85 85 85 85 +C 115 ; WX 115 ; N s ; B 86 86 86 86 +C 116 ; WX 116 ; N t ; B 87 87 87 87 +C 117 ; WX 117 ; N u ; B 88 88 88 88 +C 118 ; WX 118 ; N v ; B 89 89 89 89 +C 119 ; WX 119 ; N w ; B 90 90 90 90 +C 120 ; WX 120 ; N x ; B 91 91 91 91 +C 121 ; WX 121 ; N y ; B 92 92 92 92 +C 122 ; WX 122 ; N z ; B 93 93 93 93 +C 123 ; WX 123 ; N braceleft ; B 94 94 94 94 +C 124 ; WX 124 ; N bar ; B 95 95 95 95 +C 125 ; WX 125 ; N braceright ; B 96 96 96 96 +C 126 ; WX 126 ; N asciitilde ; B 97 97 97 97 +C 161 ; WX 161 ; N exclamdown ; B 98 98 98 98 +C 162 ; WX 162 ; N cent ; B 99 99 99 99 +C 163 ; WX 163 ; N sterling ; B 100 100 100 100 +C 164 ; WX 164 ; N fraction ; B 101 101 101 101 +C 164 ; WX 164 ; N fraction ; B 102 102 102 102 +C 165 ; WX 165 ; N yen ; B 103 103 103 103 +C 166 ; WX 166 ; N florin ; B 104 104 104 104 +C 167 ; WX 167 ; N section ; B 105 105 105 105 +C 168 ; WX 168 ; N currency ; B 106 106 106 106 +C 169 ; WX 169 ; N quotesingle ; B 107 107 107 107 +C 170 ; WX 170 ; N quotedblleft ; B 108 108 108 108 +C 171 ; WX 171 ; N guillemotleft ; B 109 109 109 109 +C 172 ; WX 172 ; N guilsinglleft ; B 110 110 110 110 +C 173 ; WX 173 ; N guilsinglright ; B 111 111 111 111 +C 174 ; WX 174 ; N fi ; B 112 112 112 112 +C 175 ; WX 175 ; N fl ; B 113 113 113 113 +C 177 ; WX 177 ; N endash ; B 114 114 114 114 +C 178 ; WX 178 ; N dagger ; B 115 115 115 115 +C 179 ; WX 179 ; N daggerdbl ; B 116 116 116 116 +C 180 ; WX 180 ; N periodcentered ; B 117 117 117 117 +C 180 ; WX 180 ; N periodcentered ; B 118 118 118 118 +C 182 ; WX 182 ; N paragraph ; B 119 119 119 119 +C 183 ; WX 183 ; N bullet ; B 120 120 120 120 +C 184 ; WX 184 ; N quotesinglbase ; B 121 121 121 121 +C 185 ; WX 185 ; N quotedblbase ; B 122 122 122 122 +C 186 ; WX 186 ; N quotedblright ; B 123 123 123 123 +C 187 ; WX 187 ; N guillemotright ; B 124 124 124 124 +C 188 ; WX 188 ; N ellipsis ; B 125 125 125 125 +C 189 ; WX 189 ; N perthousand ; B 126 126 126 126 +C 191 ; WX 191 ; N questiondown ; B 127 127 127 127 +C 193 ; WX 193 ; N grave ; B 128 128 128 128 +C 194 ; WX 194 ; N acute ; B 129 129 129 129 +C 195 ; WX 195 ; N circumflex ; B 130 130 130 130 +C 196 ; WX 196 ; N tilde ; B 131 131 131 131 +C 197 ; WX 197 ; N macron ; B 132 132 132 132 +C 197 ; WX 197 ; N macron ; B 133 133 133 133 +C 198 ; WX 198 ; N breve ; B 134 134 134 134 +C 199 ; WX 199 ; N dotaccent ; B 135 135 135 135 +C 200 ; WX 200 ; N dieresis ; B 136 136 136 136 +C 202 ; WX 202 ; N ring ; B 137 137 137 137 +C 203 ; WX 203 ; N cedilla ; B 138 138 138 138 +C 205 ; WX 205 ; N hungarumlaut ; B 139 139 139 139 +C 206 ; WX 206 ; N ogonek ; B 140 140 140 140 +C 207 ; WX 207 ; N caron ; B 141 141 141 141 +C 208 ; WX 208 ; N emdash ; B 142 142 142 142 +C 225 ; WX 225 ; N AE ; B 143 143 143 143 +C 227 ; WX 227 ; N ordfeminine ; B 144 144 144 144 +C 232 ; WX 232 ; N Lslash ; B 145 145 145 145 +C 233 ; WX 233 ; N Oslash ; B 146 146 146 146 +C 234 ; WX 234 ; N OE ; B 147 147 147 147 +C 235 ; WX 235 ; N ordmasculine ; B 148 148 148 148 +C 241 ; WX 241 ; N ae ; B 149 149 149 149 +C 245 ; WX 245 ; N dotlessi ; B 150 150 150 150 +C 248 ; WX 248 ; N lslash ; B 151 151 151 151 +C 249 ; WX 249 ; N oslash ; B 152 152 152 152 +C 250 ; WX 250 ; N oe ; B 153 153 153 153 +C 251 ; WX 251 ; N germandbls ; B 154 154 154 154 +EndCharMetrics diff --git a/src/test/java/org/apache/fop/fonts/type1/adobe-charset_unknown-encoding.afm b/src/test/java/org/apache/fop/fonts/type1/adobe-charset_unknown-encoding.afm new file mode 100644 index 000000000..8edbe0d76 --- /dev/null +++ b/src/test/java/org/apache/fop/fonts/type1/adobe-charset_unknown-encoding.afm @@ -0,0 +1,158 @@ +StartFontMetrics 2.0 +EncodingScheme FontSpecific +StartCharMetrics 154 +C 32 ; WX 32 ; N space ; B 1 1 1 1 +C 32 ; WX 32 ; N space ; B 2 2 2 2 +C 33 ; WX 33 ; N exclam ; B 3 3 3 3 +C 34 ; WX 34 ; N quotedbl ; B 4 4 4 4 +C 35 ; WX 35 ; N numbersign ; B 5 5 5 5 +C 36 ; WX 36 ; N dollar ; B 6 6 6 6 +C 37 ; WX 37 ; N percent ; B 7 7 7 7 +C 38 ; WX 38 ; N ampersand ; B 8 8 8 8 +C 39 ; WX 39 ; N quoteright ; B 9 9 9 9 +C 40 ; WX 40 ; N parenleft ; B 10 10 10 10 +C 41 ; WX 41 ; N parenright ; B 11 11 11 11 +C 42 ; WX 42 ; N asterisk ; B 12 12 12 12 +C 43 ; WX 43 ; N plus ; B 13 13 13 13 +C 44 ; WX 44 ; N comma ; B 14 14 14 14 +C 45 ; WX 45 ; N hyphen ; B 15 15 15 15 +C 45 ; WX 45 ; N hyphen ; B 16 16 16 16 +C 46 ; WX 46 ; N period ; B 17 17 17 17 +C 47 ; WX 47 ; N slash ; B 18 18 18 18 +C 48 ; WX 48 ; N zero ; B 19 19 19 19 +C 49 ; WX 49 ; N one ; B 20 20 20 20 +C 50 ; WX 50 ; N two ; B 21 21 21 21 +C 51 ; WX 51 ; N three ; B 22 22 22 22 +C 52 ; WX 52 ; N four ; B 23 23 23 23 +C 53 ; WX 53 ; N five ; B 24 24 24 24 +C 54 ; WX 54 ; N six ; B 25 25 25 25 +C 55 ; WX 55 ; N seven ; B 26 26 26 26 +C 56 ; WX 56 ; N eight ; B 27 27 27 27 +C 57 ; WX 57 ; N nine ; B 28 28 28 28 +C 58 ; WX 58 ; N colon ; B 29 29 29 29 +C 59 ; WX 59 ; N semicolon ; B 30 30 30 30 +C 60 ; WX 60 ; N less ; B 31 31 31 31 +C 61 ; WX 61 ; N equal ; B 32 32 32 32 +C 62 ; WX 62 ; N greater ; B 33 33 33 33 +C 63 ; WX 63 ; N question ; B 34 34 34 34 +C 64 ; WX 64 ; N at ; B 35 35 35 35 +C 65 ; WX 65 ; N A ; B 36 36 36 36 +C 66 ; WX 66 ; N B ; B 37 37 37 37 +C 67 ; WX 67 ; N C ; B 38 38 38 38 +C 68 ; WX 68 ; N D ; B 39 39 39 39 +C 69 ; WX 69 ; N E ; B 40 40 40 40 +C 70 ; WX 70 ; N F ; B 41 41 41 41 +C 71 ; WX 71 ; N G ; B 42 42 42 42 +C 72 ; WX 72 ; N H ; B 43 43 43 43 +C 73 ; WX 73 ; N I ; B 44 44 44 44 +C 74 ; WX 74 ; N J ; B 45 45 45 45 +C 75 ; WX 75 ; N K ; B 46 46 46 46 +C 76 ; WX 76 ; N L ; B 47 47 47 47 +C 77 ; WX 77 ; N M ; B 48 48 48 48 +C 78 ; WX 78 ; N N ; B 49 49 49 49 +C 79 ; WX 79 ; N O ; B 50 50 50 50 +C 80 ; WX 80 ; N P ; B 51 51 51 51 +C 81 ; WX 81 ; N Q ; B 52 52 52 52 +C 82 ; WX 82 ; N R ; B 53 53 53 53 +C 83 ; WX 83 ; N S ; B 54 54 54 54 +C 84 ; WX 84 ; N T ; B 55 55 55 55 +C 85 ; WX 85 ; N U ; B 56 56 56 56 +C 86 ; WX 86 ; N V ; B 57 57 57 57 +C 87 ; WX 87 ; N W ; B 58 58 58 58 +C 88 ; WX 88 ; N X ; B 59 59 59 59 +C 89 ; WX 89 ; N Y ; B 60 60 60 60 +C 90 ; WX 90 ; N Z ; B 61 61 61 61 +C 91 ; WX 91 ; N bracketleft ; B 62 62 62 62 +C 92 ; WX 92 ; N backslash ; B 63 63 63 63 +C 93 ; WX 93 ; N bracketright ; B 64 64 64 64 +C 94 ; WX 94 ; N asciicircum ; B 65 65 65 65 +C 95 ; WX 95 ; N underscore ; B 66 66 66 66 +C 96 ; WX 96 ; N quoteleft ; B 67 67 67 67 +C 97 ; WX 97 ; N a ; B 68 68 68 68 +C 98 ; WX 98 ; N b ; B 69 69 69 69 +C 99 ; WX 99 ; N c ; B 70 70 70 70 +C 100 ; WX 100 ; N d ; B 71 71 71 71 +C 101 ; WX 101 ; N e ; B 72 72 72 72 +C 102 ; WX 102 ; N f ; B 73 73 73 73 +C 103 ; WX 103 ; N g ; B 74 74 74 74 +C 104 ; WX 104 ; N h ; B 75 75 75 75 +C 105 ; WX 105 ; N i ; B 76 76 76 76 +C 106 ; WX 106 ; N j ; B 77 77 77 77 +C 107 ; WX 107 ; N k ; B 78 78 78 78 +C 108 ; WX 108 ; N l ; B 79 79 79 79 +C 109 ; WX 109 ; N m ; B 80 80 80 80 +C 110 ; WX 110 ; N n ; B 81 81 81 81 +C 111 ; WX 111 ; N o ; B 82 82 82 82 +C 112 ; WX 112 ; N p ; B 83 83 83 83 +C 113 ; WX 113 ; N q ; B 84 84 84 84 +C 114 ; WX 114 ; N r ; B 85 85 85 85 +C 115 ; WX 115 ; N s ; B 86 86 86 86 +C 116 ; WX 116 ; N t ; B 87 87 87 87 +C 117 ; WX 117 ; N u ; B 88 88 88 88 +C 118 ; WX 118 ; N v ; B 89 89 89 89 +C 119 ; WX 119 ; N w ; B 90 90 90 90 +C 120 ; WX 120 ; N x ; B 91 91 91 91 +C 121 ; WX 121 ; N y ; B 92 92 92 92 +C 122 ; WX 122 ; N z ; B 93 93 93 93 +C 123 ; WX 123 ; N braceleft ; B 94 94 94 94 +C 124 ; WX 124 ; N bar ; B 95 95 95 95 +C 125 ; WX 125 ; N braceright ; B 96 96 96 96 +C 126 ; WX 126 ; N asciitilde ; B 97 97 97 97 +C 161 ; WX 161 ; N exclamdown ; B 98 98 98 98 +C 162 ; WX 162 ; N cent ; B 99 99 99 99 +C 163 ; WX 163 ; N sterling ; B 100 100 100 100 +C 164 ; WX 164 ; N fraction ; B 101 101 101 101 +C 164 ; WX 164 ; N fraction ; B 102 102 102 102 +C 165 ; WX 165 ; N yen ; B 103 103 103 103 +C 166 ; WX 166 ; N florin ; B 104 104 104 104 +C 167 ; WX 167 ; N section ; B 105 105 105 105 +C 168 ; WX 168 ; N currency ; B 106 106 106 106 +C 169 ; WX 169 ; N quotesingle ; B 107 107 107 107 +C 170 ; WX 170 ; N quotedblleft ; B 108 108 108 108 +C 171 ; WX 171 ; N guillemotleft ; B 109 109 109 109 +C 172 ; WX 172 ; N guilsinglleft ; B 110 110 110 110 +C 173 ; WX 173 ; N guilsinglright ; B 111 111 111 111 +C 174 ; WX 174 ; N fi ; B 112 112 112 112 +C 175 ; WX 175 ; N fl ; B 113 113 113 113 +C 177 ; WX 177 ; N endash ; B 114 114 114 114 +C 178 ; WX 178 ; N dagger ; B 115 115 115 115 +C 179 ; WX 179 ; N daggerdbl ; B 116 116 116 116 +C 180 ; WX 180 ; N periodcentered ; B 117 117 117 117 +C 180 ; WX 180 ; N periodcentered ; B 118 118 118 118 +C 182 ; WX 182 ; N paragraph ; B 119 119 119 119 +C 183 ; WX 183 ; N bullet ; B 120 120 120 120 +C 184 ; WX 184 ; N quotesinglbase ; B 121 121 121 121 +C 185 ; WX 185 ; N quotedblbase ; B 122 122 122 122 +C 186 ; WX 186 ; N quotedblright ; B 123 123 123 123 +C 187 ; WX 187 ; N guillemotright ; B 124 124 124 124 +C 188 ; WX 188 ; N ellipsis ; B 125 125 125 125 +C 189 ; WX 189 ; N perthousand ; B 126 126 126 126 +C 191 ; WX 191 ; N questiondown ; B 127 127 127 127 +C 193 ; WX 193 ; N grave ; B 128 128 128 128 +C 194 ; WX 194 ; N acute ; B 129 129 129 129 +C 195 ; WX 195 ; N circumflex ; B 130 130 130 130 +C 196 ; WX 196 ; N tilde ; B 131 131 131 131 +C 197 ; WX 197 ; N macron ; B 132 132 132 132 +C 197 ; WX 197 ; N macron ; B 133 133 133 133 +C 198 ; WX 198 ; N breve ; B 134 134 134 134 +C 199 ; WX 199 ; N dotaccent ; B 135 135 135 135 +C 200 ; WX 200 ; N dieresis ; B 136 136 136 136 +C 202 ; WX 202 ; N ring ; B 137 137 137 137 +C 203 ; WX 203 ; N cedilla ; B 138 138 138 138 +C 205 ; WX 205 ; N hungarumlaut ; B 139 139 139 139 +C 206 ; WX 206 ; N ogonek ; B 140 140 140 140 +C 207 ; WX 207 ; N caron ; B 141 141 141 141 +C 208 ; WX 208 ; N emdash ; B 142 142 142 142 +C 225 ; WX 225 ; N AE ; B 143 143 143 143 +C 227 ; WX 227 ; N ordfeminine ; B 144 144 144 144 +C 232 ; WX 232 ; N Lslash ; B 145 145 145 145 +C 233 ; WX 233 ; N Oslash ; B 146 146 146 146 +C 234 ; WX 234 ; N OE ; B 147 147 147 147 +C 235 ; WX 235 ; N ordmasculine ; B 148 148 148 148 +C 241 ; WX 241 ; N ae ; B 149 149 149 149 +C 245 ; WX 245 ; N dotlessi ; B 150 150 150 150 +C 248 ; WX 248 ; N lslash ; B 151 151 151 151 +C 249 ; WX 249 ; N oslash ; B 152 152 152 152 +C 250 ; WX 250 ; N oe ; B 153 153 153 153 +C 251 ; WX 251 ; N germandbls ; B 154 154 154 154 +EndCharMetrics diff --git a/src/test/java/org/apache/fop/fonts/type1/notadobe-charset_adobe-encoding.afm b/src/test/java/org/apache/fop/fonts/type1/notadobe-charset_adobe-encoding.afm new file mode 100644 index 000000000..11cecb17f --- /dev/null +++ b/src/test/java/org/apache/fop/fonts/type1/notadobe-charset_adobe-encoding.afm @@ -0,0 +1,158 @@ +StartFontMetrics 2.0 +EncodingScheme AdobeStandardEncoding +StartCharMetrics 154 +C 33 ; WX 32 ; N space ; B 1 1 1 1 +C 33 ; WX 32 ; N space ; B 2 2 2 2 +C 34 ; WX 33 ; N exclam ; B 3 3 3 3 +C 35 ; WX 34 ; N quotedbl ; B 4 4 4 4 +C 36 ; WX 35 ; N numbersign ; B 5 5 5 5 +C 37 ; WX 36 ; N dollar ; B 6 6 6 6 +C 38 ; WX 37 ; N percent ; B 7 7 7 7 +C 39 ; WX 38 ; N ampersand ; B 8 8 8 8 +C 40 ; WX 39 ; N quoteright ; B 9 9 9 9 +C 41 ; WX 40 ; N parenleft ; B 10 10 10 10 +C 42 ; WX 41 ; N parenright ; B 11 11 11 11 +C 43 ; WX 42 ; N asterisk ; B 12 12 12 12 +C 44 ; WX 43 ; N plus ; B 13 13 13 13 +C 45 ; WX 44 ; N comma ; B 14 14 14 14 +C 46 ; WX 45 ; N hyphen ; B 15 15 15 15 +C 46 ; WX 45 ; N hyphen ; B 16 16 16 16 +C 47 ; WX 46 ; N period ; B 17 17 17 17 +C 48 ; WX 47 ; N slash ; B 18 18 18 18 +C 49 ; WX 48 ; N zero ; B 19 19 19 19 +C 50 ; WX 49 ; N one ; B 20 20 20 20 +C 51 ; WX 50 ; N two ; B 21 21 21 21 +C 52 ; WX 51 ; N three ; B 22 22 22 22 +C 53 ; WX 52 ; N four ; B 23 23 23 23 +C 54 ; WX 53 ; N five ; B 24 24 24 24 +C 55 ; WX 54 ; N six ; B 25 25 25 25 +C 56 ; WX 55 ; N seven ; B 26 26 26 26 +C 57 ; WX 56 ; N eight ; B 27 27 27 27 +C 58 ; WX 57 ; N nine ; B 28 28 28 28 +C 59 ; WX 58 ; N colon ; B 29 29 29 29 +C 60 ; WX 59 ; N semicolon ; B 30 30 30 30 +C 61 ; WX 60 ; N less ; B 31 31 31 31 +C 62 ; WX 61 ; N equal ; B 32 32 32 32 +C 63 ; WX 62 ; N greater ; B 33 33 33 33 +C 64 ; WX 63 ; N question ; B 34 34 34 34 +C 65 ; WX 64 ; N at ; B 35 35 35 35 +C 66 ; WX 65 ; N A ; B 36 36 36 36 +C 67 ; WX 66 ; N B ; B 37 37 37 37 +C 68 ; WX 67 ; N C ; B 38 38 38 38 +C 69 ; WX 68 ; N D ; B 39 39 39 39 +C 70 ; WX 69 ; N E ; B 40 40 40 40 +C 71 ; WX 70 ; N F ; B 41 41 41 41 +C 72 ; WX 71 ; N G ; B 42 42 42 42 +C 73 ; WX 72 ; N H ; B 43 43 43 43 +C 74 ; WX 73 ; N I ; B 44 44 44 44 +C 75 ; WX 74 ; N J ; B 45 45 45 45 +C 76 ; WX 75 ; N K ; B 46 46 46 46 +C 77 ; WX 76 ; N L ; B 47 47 47 47 +C 78 ; WX 77 ; N M ; B 48 48 48 48 +C 79 ; WX 78 ; N N ; B 49 49 49 49 +C 80 ; WX 79 ; N O ; B 50 50 50 50 +C 81 ; WX 80 ; N P ; B 51 51 51 51 +C 82 ; WX 81 ; N Q ; B 52 52 52 52 +C 83 ; WX 82 ; N R ; B 53 53 53 53 +C 84 ; WX 83 ; N S ; B 54 54 54 54 +C 85 ; WX 84 ; N T ; B 55 55 55 55 +C 86 ; WX 85 ; N U ; B 56 56 56 56 +C 87 ; WX 86 ; N V ; B 57 57 57 57 +C 88 ; WX 87 ; N W ; B 58 58 58 58 +C 89 ; WX 88 ; N X ; B 59 59 59 59 +C 90 ; WX 89 ; N Y ; B 60 60 60 60 +C 91 ; WX 90 ; N Z ; B 61 61 61 61 +C 92 ; WX 91 ; N bracketleft ; B 62 62 62 62 +C 93 ; WX 92 ; N backslash ; B 63 63 63 63 +C 94 ; WX 93 ; N bracketright ; B 64 64 64 64 +C 95 ; WX 94 ; N asciicircum ; B 65 65 65 65 +C 96 ; WX 95 ; N underscore ; B 66 66 66 66 +C 97 ; WX 96 ; N quoteleft ; B 67 67 67 67 +C 98 ; WX 97 ; N a ; B 68 68 68 68 +C 99 ; WX 98 ; N b ; B 69 69 69 69 +C 100 ; WX 99 ; N c ; B 70 70 70 70 +C 101 ; WX 100 ; N d ; B 71 71 71 71 +C 102 ; WX 101 ; N e ; B 72 72 72 72 +C 103 ; WX 102 ; N f ; B 73 73 73 73 +C 104 ; WX 103 ; N g ; B 74 74 74 74 +C 105 ; WX 104 ; N h ; B 75 75 75 75 +C 106 ; WX 105 ; N i ; B 76 76 76 76 +C 107 ; WX 106 ; N j ; B 77 77 77 77 +C 108 ; WX 107 ; N k ; B 78 78 78 78 +C 109 ; WX 108 ; N l ; B 79 79 79 79 +C 110 ; WX 109 ; N m ; B 80 80 80 80 +C 111 ; WX 110 ; N n ; B 81 81 81 81 +C 112 ; WX 111 ; N o ; B 82 82 82 82 +C 113 ; WX 112 ; N p ; B 83 83 83 83 +C 114 ; WX 113 ; N q ; B 84 84 84 84 +C 115 ; WX 114 ; N r ; B 85 85 85 85 +C 116 ; WX 115 ; N s ; B 86 86 86 86 +C 117 ; WX 116 ; N t ; B 87 87 87 87 +C 118 ; WX 117 ; N u ; B 88 88 88 88 +C 119 ; WX 118 ; N v ; B 89 89 89 89 +C 120 ; WX 119 ; N w ; B 90 90 90 90 +C 121 ; WX 120 ; N x ; B 91 91 91 91 +C 122 ; WX 121 ; N y ; B 92 92 92 92 +C 123 ; WX 122 ; N z ; B 93 93 93 93 +C 124 ; WX 123 ; N braceleft ; B 94 94 94 94 +C 125 ; WX 124 ; N bar ; B 95 95 95 95 +C 126 ; WX 125 ; N braceright ; B 96 96 96 96 +C 127 ; WX 126 ; N asciitilde ; B 97 97 97 97 +C 162 ; WX 161 ; N exclamdown ; B 98 98 98 98 +C 163 ; WX 162 ; N cent ; B 99 99 99 99 +C 164 ; WX 163 ; N sterling ; B 100 100 100 100 +C 165 ; WX 164 ; N fraction ; B 101 101 101 101 +C 165 ; WX 164 ; N fraction ; B 102 102 102 102 +C 166 ; WX 165 ; N yen ; B 103 103 103 103 +C 167 ; WX 166 ; N florin ; B 104 104 104 104 +C 168 ; WX 167 ; N section ; B 105 105 105 105 +C 169 ; WX 168 ; N currency ; B 106 106 106 106 +C 170 ; WX 169 ; N quotesingle ; B 107 107 107 107 +C 171 ; WX 170 ; N quotedblleft ; B 108 108 108 108 +C 172 ; WX 171 ; N guillemotleft ; B 109 109 109 109 +C 173 ; WX 172 ; N guilsinglleft ; B 110 110 110 110 +C 174 ; WX 173 ; N guilsinglright ; B 111 111 111 111 +C 175 ; WX 174 ; N fi ; B 112 112 112 112 +C 176 ; WX 175 ; N fl ; B 113 113 113 113 +C 178 ; WX 177 ; N endash ; B 114 114 114 114 +C 179 ; WX 178 ; N dagger ; B 115 115 115 115 +C 180 ; WX 179 ; N daggerdbl ; B 116 116 116 116 +C 181 ; WX 180 ; N periodcentered ; B 117 117 117 117 +C 181 ; WX 180 ; N periodcentered ; B 118 118 118 118 +C 183 ; WX 182 ; N paragraph ; B 119 119 119 119 +C 184 ; WX 183 ; N bullet ; B 120 120 120 120 +C 185 ; WX 184 ; N quotesinglbase ; B 121 121 121 121 +C 186 ; WX 185 ; N quotedblbase ; B 122 122 122 122 +C 187 ; WX 186 ; N quotedblright ; B 123 123 123 123 +C 188 ; WX 187 ; N guillemotright ; B 124 124 124 124 +C 189 ; WX 188 ; N ellipsis ; B 125 125 125 125 +C 190 ; WX 189 ; N perthousand ; B 126 126 126 126 +C 192 ; WX 191 ; N questiondown ; B 127 127 127 127 +C 194 ; WX 193 ; N grave ; B 128 128 128 128 +C 195 ; WX 194 ; N acute ; B 129 129 129 129 +C 196 ; WX 195 ; N circumflex ; B 130 130 130 130 +C 197 ; WX 196 ; N tilde ; B 131 131 131 131 +C 198 ; WX 197 ; N macron ; B 132 132 132 132 +C 198 ; WX 197 ; N macron ; B 133 133 133 133 +C 199 ; WX 198 ; N breve ; B 134 134 134 134 +C 200 ; WX 199 ; N dotaccent ; B 135 135 135 135 +C 201 ; WX 200 ; N dieresis ; B 136 136 136 136 +C 203 ; WX 202 ; N ring ; B 137 137 137 137 +C 204 ; WX 203 ; N cedilla ; B 138 138 138 138 +C 206 ; WX 205 ; N hungarumlaut ; B 139 139 139 139 +C 207 ; WX 206 ; N ogonek ; B 140 140 140 140 +C 208 ; WX 207 ; N caron ; B 141 141 141 141 +C 209 ; WX 208 ; N emdash ; B 142 142 142 142 +C 226 ; WX 225 ; N AE ; B 143 143 143 143 +C 228 ; WX 227 ; N ordfeminine ; B 144 144 144 144 +C 233 ; WX 232 ; N Lslash ; B 145 145 145 145 +C 234 ; WX 233 ; N Oslash ; B 146 146 146 146 +C 235 ; WX 234 ; N OE ; B 147 147 147 147 +C 236 ; WX 235 ; N ordmasculine ; B 148 148 148 148 +C 242 ; WX 241 ; N ae ; B 149 149 149 149 +C 246 ; WX 245 ; N dotlessi ; B 150 150 150 150 +C 249 ; WX 248 ; N lslash ; B 151 151 151 151 +C 250 ; WX 249 ; N oslash ; B 152 152 152 152 +C 251 ; WX 250 ; N oe ; B 153 153 153 153 +C 252 ; WX 251 ; N germandbls ; B 154 154 154 154 +EndCharMetrics diff --git a/src/test/java/org/apache/fop/fonts/type1/notadobe-charset_unknown-encoding.afm b/src/test/java/org/apache/fop/fonts/type1/notadobe-charset_unknown-encoding.afm new file mode 100644 index 000000000..1714288ab --- /dev/null +++ b/src/test/java/org/apache/fop/fonts/type1/notadobe-charset_unknown-encoding.afm @@ -0,0 +1,158 @@ +StartFontMetrics 2.0 +EncodingScheme FontSpecific +StartCharMetrics 154 +C 33 ; WX 32 ; N space ; B 1 1 1 1 +C 33 ; WX 32 ; N space ; B 2 2 2 2 +C 34 ; WX 33 ; N exclam ; B 3 3 3 3 +C 35 ; WX 34 ; N quotedbl ; B 4 4 4 4 +C 36 ; WX 35 ; N numbersign ; B 5 5 5 5 +C 37 ; WX 36 ; N dollar ; B 6 6 6 6 +C 38 ; WX 37 ; N percent ; B 7 7 7 7 +C 39 ; WX 38 ; N ampersand ; B 8 8 8 8 +C 40 ; WX 39 ; N quoteright ; B 9 9 9 9 +C 41 ; WX 40 ; N parenleft ; B 10 10 10 10 +C 42 ; WX 41 ; N parenright ; B 11 11 11 11 +C 43 ; WX 42 ; N asterisk ; B 12 12 12 12 +C 44 ; WX 43 ; N plus ; B 13 13 13 13 +C 45 ; WX 44 ; N comma ; B 14 14 14 14 +C 46 ; WX 45 ; N hyphen ; B 15 15 15 15 +C 46 ; WX 45 ; N hyphen ; B 16 16 16 16 +C 47 ; WX 46 ; N period ; B 17 17 17 17 +C 48 ; WX 47 ; N slash ; B 18 18 18 18 +C 49 ; WX 48 ; N zero ; B 19 19 19 19 +C 50 ; WX 49 ; N one ; B 20 20 20 20 +C 51 ; WX 50 ; N two ; B 21 21 21 21 +C 52 ; WX 51 ; N three ; B 22 22 22 22 +C 53 ; WX 52 ; N four ; B 23 23 23 23 +C 54 ; WX 53 ; N five ; B 24 24 24 24 +C 55 ; WX 54 ; N six ; B 25 25 25 25 +C 56 ; WX 55 ; N seven ; B 26 26 26 26 +C 57 ; WX 56 ; N eight ; B 27 27 27 27 +C 58 ; WX 57 ; N nine ; B 28 28 28 28 +C 59 ; WX 58 ; N colon ; B 29 29 29 29 +C 60 ; WX 59 ; N semicolon ; B 30 30 30 30 +C 61 ; WX 60 ; N less ; B 31 31 31 31 +C 62 ; WX 61 ; N equal ; B 32 32 32 32 +C 63 ; WX 62 ; N greater ; B 33 33 33 33 +C 64 ; WX 63 ; N question ; B 34 34 34 34 +C 65 ; WX 64 ; N at ; B 35 35 35 35 +C 66 ; WX 65 ; N A ; B 36 36 36 36 +C 67 ; WX 66 ; N B ; B 37 37 37 37 +C 68 ; WX 67 ; N C ; B 38 38 38 38 +C 69 ; WX 68 ; N D ; B 39 39 39 39 +C 70 ; WX 69 ; N E ; B 40 40 40 40 +C 71 ; WX 70 ; N F ; B 41 41 41 41 +C 72 ; WX 71 ; N G ; B 42 42 42 42 +C 73 ; WX 72 ; N H ; B 43 43 43 43 +C 74 ; WX 73 ; N I ; B 44 44 44 44 +C 75 ; WX 74 ; N J ; B 45 45 45 45 +C 76 ; WX 75 ; N K ; B 46 46 46 46 +C 77 ; WX 76 ; N L ; B 47 47 47 47 +C 78 ; WX 77 ; N M ; B 48 48 48 48 +C 79 ; WX 78 ; N N ; B 49 49 49 49 +C 80 ; WX 79 ; N O ; B 50 50 50 50 +C 81 ; WX 80 ; N P ; B 51 51 51 51 +C 82 ; WX 81 ; N Q ; B 52 52 52 52 +C 83 ; WX 82 ; N R ; B 53 53 53 53 +C 84 ; WX 83 ; N S ; B 54 54 54 54 +C 85 ; WX 84 ; N T ; B 55 55 55 55 +C 86 ; WX 85 ; N U ; B 56 56 56 56 +C 87 ; WX 86 ; N V ; B 57 57 57 57 +C 88 ; WX 87 ; N W ; B 58 58 58 58 +C 89 ; WX 88 ; N X ; B 59 59 59 59 +C 90 ; WX 89 ; N Y ; B 60 60 60 60 +C 91 ; WX 90 ; N Z ; B 61 61 61 61 +C 92 ; WX 91 ; N bracketleft ; B 62 62 62 62 +C 93 ; WX 92 ; N backslash ; B 63 63 63 63 +C 94 ; WX 93 ; N bracketright ; B 64 64 64 64 +C 95 ; WX 94 ; N asciicircum ; B 65 65 65 65 +C 96 ; WX 95 ; N underscore ; B 66 66 66 66 +C 97 ; WX 96 ; N quoteleft ; B 67 67 67 67 +C 98 ; WX 97 ; N a ; B 68 68 68 68 +C 99 ; WX 98 ; N b ; B 69 69 69 69 +C 100 ; WX 99 ; N c ; B 70 70 70 70 +C 101 ; WX 100 ; N d ; B 71 71 71 71 +C 102 ; WX 101 ; N e ; B 72 72 72 72 +C 103 ; WX 102 ; N f ; B 73 73 73 73 +C 104 ; WX 103 ; N g ; B 74 74 74 74 +C 105 ; WX 104 ; N h ; B 75 75 75 75 +C 106 ; WX 105 ; N i ; B 76 76 76 76 +C 107 ; WX 106 ; N j ; B 77 77 77 77 +C 108 ; WX 107 ; N k ; B 78 78 78 78 +C 109 ; WX 108 ; N l ; B 79 79 79 79 +C 110 ; WX 109 ; N m ; B 80 80 80 80 +C 111 ; WX 110 ; N n ; B 81 81 81 81 +C 112 ; WX 111 ; N o ; B 82 82 82 82 +C 113 ; WX 112 ; N p ; B 83 83 83 83 +C 114 ; WX 113 ; N q ; B 84 84 84 84 +C 115 ; WX 114 ; N r ; B 85 85 85 85 +C 116 ; WX 115 ; N s ; B 86 86 86 86 +C 117 ; WX 116 ; N t ; B 87 87 87 87 +C 118 ; WX 117 ; N u ; B 88 88 88 88 +C 119 ; WX 118 ; N v ; B 89 89 89 89 +C 120 ; WX 119 ; N w ; B 90 90 90 90 +C 121 ; WX 120 ; N x ; B 91 91 91 91 +C 122 ; WX 121 ; N y ; B 92 92 92 92 +C 123 ; WX 122 ; N z ; B 93 93 93 93 +C 124 ; WX 123 ; N braceleft ; B 94 94 94 94 +C 125 ; WX 124 ; N bar ; B 95 95 95 95 +C 126 ; WX 125 ; N braceright ; B 96 96 96 96 +C 127 ; WX 126 ; N asciitilde ; B 97 97 97 97 +C 162 ; WX 161 ; N exclamdown ; B 98 98 98 98 +C 163 ; WX 162 ; N cent ; B 99 99 99 99 +C 164 ; WX 163 ; N sterling ; B 100 100 100 100 +C 165 ; WX 164 ; N fraction ; B 101 101 101 101 +C 165 ; WX 164 ; N fraction ; B 102 102 102 102 +C 166 ; WX 165 ; N yen ; B 103 103 103 103 +C 167 ; WX 166 ; N florin ; B 104 104 104 104 +C 168 ; WX 167 ; N section ; B 105 105 105 105 +C 169 ; WX 168 ; N currency ; B 106 106 106 106 +C 170 ; WX 169 ; N quotesingle ; B 107 107 107 107 +C 171 ; WX 170 ; N quotedblleft ; B 108 108 108 108 +C 172 ; WX 171 ; N guillemotleft ; B 109 109 109 109 +C 173 ; WX 172 ; N guilsinglleft ; B 110 110 110 110 +C 174 ; WX 173 ; N guilsinglright ; B 111 111 111 111 +C 175 ; WX 174 ; N fi ; B 112 112 112 112 +C 176 ; WX 175 ; N fl ; B 113 113 113 113 +C 178 ; WX 177 ; N endash ; B 114 114 114 114 +C 179 ; WX 178 ; N dagger ; B 115 115 115 115 +C 180 ; WX 179 ; N daggerdbl ; B 116 116 116 116 +C 181 ; WX 180 ; N periodcentered ; B 117 117 117 117 +C 181 ; WX 180 ; N periodcentered ; B 118 118 118 118 +C 183 ; WX 182 ; N paragraph ; B 119 119 119 119 +C 184 ; WX 183 ; N bullet ; B 120 120 120 120 +C 185 ; WX 184 ; N quotesinglbase ; B 121 121 121 121 +C 186 ; WX 185 ; N quotedblbase ; B 122 122 122 122 +C 187 ; WX 186 ; N quotedblright ; B 123 123 123 123 +C 188 ; WX 187 ; N guillemotright ; B 124 124 124 124 +C 189 ; WX 188 ; N ellipsis ; B 125 125 125 125 +C 190 ; WX 189 ; N perthousand ; B 126 126 126 126 +C 192 ; WX 191 ; N questiondown ; B 127 127 127 127 +C 194 ; WX 193 ; N grave ; B 128 128 128 128 +C 195 ; WX 194 ; N acute ; B 129 129 129 129 +C 196 ; WX 195 ; N circumflex ; B 130 130 130 130 +C 197 ; WX 196 ; N tilde ; B 131 131 131 131 +C 198 ; WX 197 ; N macron ; B 132 132 132 132 +C 198 ; WX 197 ; N macron ; B 133 133 133 133 +C 199 ; WX 198 ; N breve ; B 134 134 134 134 +C 200 ; WX 199 ; N dotaccent ; B 135 135 135 135 +C 201 ; WX 200 ; N dieresis ; B 136 136 136 136 +C 203 ; WX 202 ; N ring ; B 137 137 137 137 +C 204 ; WX 203 ; N cedilla ; B 138 138 138 138 +C 206 ; WX 205 ; N hungarumlaut ; B 139 139 139 139 +C 207 ; WX 206 ; N ogonek ; B 140 140 140 140 +C 208 ; WX 207 ; N caron ; B 141 141 141 141 +C 209 ; WX 208 ; N emdash ; B 142 142 142 142 +C 226 ; WX 225 ; N AE ; B 143 143 143 143 +C 228 ; WX 227 ; N ordfeminine ; B 144 144 144 144 +C 233 ; WX 232 ; N Lslash ; B 145 145 145 145 +C 234 ; WX 233 ; N Oslash ; B 146 146 146 146 +C 235 ; WX 234 ; N OE ; B 147 147 147 147 +C 236 ; WX 235 ; N ordmasculine ; B 148 148 148 148 +C 242 ; WX 241 ; N ae ; B 149 149 149 149 +C 246 ; WX 245 ; N dotlessi ; B 150 150 150 150 +C 249 ; WX 248 ; N lslash ; B 151 151 151 151 +C 250 ; WX 249 ; N oslash ; B 152 152 152 152 +C 251 ; WX 250 ; N oe ; B 153 153 153 153 +C 252 ; WX 251 ; N germandbls ; B 154 154 154 154 +EndCharMetrics diff --git a/src/test/java/org/apache/fop/fonts/type1/underline.afm b/src/test/java/org/apache/fop/fonts/type1/underline.afm new file mode 100644 index 000000000..8137b41eb --- /dev/null +++ b/src/test/java/org/apache/fop/fonts/type1/underline.afm @@ -0,0 +1,4 @@ +StartFontMetrics 2.0 +UnderlinePosition -96 +UnderlineThickness 58 +EndFontMetrics diff --git a/src/test/java/org/apache/fop/fotreetest/DummyFOEventHandler.java b/src/test/java/org/apache/fop/fotreetest/DummyFOEventHandler.java new file mode 100644 index 000000000..fcb9cfe6e --- /dev/null +++ b/src/test/java/org/apache/fop/fotreetest/DummyFOEventHandler.java @@ -0,0 +1,38 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fotreetest; + +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.fo.FOEventHandler; + +/** + * Dummy FOEventHandler implementation that does nothing. + */ +public class DummyFOEventHandler extends FOEventHandler { + + /** + * Main constructor. + * @param foUserAgent the user agent + */ + public DummyFOEventHandler(FOUserAgent foUserAgent) { + super(foUserAgent); + } + +} diff --git a/src/test/java/org/apache/fop/fotreetest/FOTreeTestCase.java b/src/test/java/org/apache/fop/fotreetest/FOTreeTestCase.java new file mode 100644 index 000000000..3d58e7ef0 --- /dev/null +++ b/src/test/java/org/apache/fop/fotreetest/FOTreeTestCase.java @@ -0,0 +1,175 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fotreetest; + +import java.io.File; +import java.util.Collection; +import java.util.List; + +import javax.xml.parsers.SAXParser; +import javax.xml.parsers.SAXParserFactory; + +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; +import org.xml.sax.SAXException; +import org.xml.sax.XMLReader; +import org.xml.sax.helpers.XMLFilterImpl; + +import org.apache.fop.DebugHelper; +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.apps.Fop; +import org.apache.fop.apps.FopFactory; +import org.apache.fop.apps.FopFactoryBuilder; +import org.apache.fop.apps.FopFactoryConfig; +import org.apache.fop.apps.MutableConfig; +import org.apache.fop.fotreetest.ext.TestElementMapping; +import org.apache.fop.layoutengine.LayoutEngineTestUtils; +import org.apache.fop.layoutengine.TestFilesConfiguration; +import org.apache.fop.util.ConsoleEventListenerForTests; + +/** + * Test driver class for FO tree tests. + */ +@RunWith(Parameterized.class) +public class FOTreeTestCase { + + private static final String BASE_DIR = "test/fotree/"; + private static final String TEST_CASES = "testcases"; + + @BeforeClass + public static void registerElementListObservers() { + DebugHelper.registerStandardElementListObservers(); + } + + /** + * Gets the parameters to run the FO tree test cases. + * @return a collection of file arrays containing the test files + */ + @Parameters + public static Collection<File[]> getParameters() { + TestFilesConfiguration.Builder builder = new TestFilesConfiguration.Builder(); + builder.testDir(BASE_DIR) + .singleProperty("fop.fotree.single") + .startsWithProperty("fop.fotree.starts-with") + .suffix(".fo") + .testSet("testcases") + .disabledProperty("fop.layoutengine.disabled", "test/fotree/disabled-testcases.xml") + .privateTestsProperty("fop.fotree.private"); + + TestFilesConfiguration testConfig = builder.build(); + return LayoutEngineTestUtils.getTestFiles(testConfig); + } + + + + private final File testFile; + + /** + * Main constructor + * + * @param testFile the FO file to test + */ + public FOTreeTestCase(File testFile) { + this.testFile = testFile; + } + + /** + * Runs a test. + * @throws Exception if a test or FOP itself fails + */ + @Test + public void runTest() throws Exception { + try { + ResultCollector collector = ResultCollector.getInstance(); + collector.reset(); + + SAXParserFactory spf = SAXParserFactory.newInstance(); + spf.setNamespaceAware(true); + spf.setValidating(false); + SAXParser parser = spf.newSAXParser(); + XMLReader reader = parser.getXMLReader(); + FopFactoryBuilder builder = new FopFactoryBuilder(new File(".").toURI()); + // Resetting values modified by processing instructions + builder.setBreakIndentInheritanceOnReferenceAreaBoundary( + FopFactoryConfig.DEFAULT_BREAK_INDENT_INHERITANCE); + builder.setSourceResolution(FopFactoryConfig.DEFAULT_SOURCE_RESOLUTION); + + MutableConfig mutableConfig = new MutableConfig(builder); + + FopFactory fopFactory = FopFactory.newInstance(mutableConfig); + fopFactory.addElementMapping(new TestElementMapping()); + FOUserAgent ua = fopFactory.newFOUserAgent(); + ua.setFOEventHandlerOverride(new DummyFOEventHandler(ua)); + ua.getEventBroadcaster().addEventListener( + new ConsoleEventListenerForTests(testFile.getName())); + + // Used to set values in the user agent through processing instructions + reader = new PIListener(reader, mutableConfig); + Fop fop = fopFactory.newFop(ua); + + reader.setContentHandler(fop.getDefaultHandler()); + reader.setDTDHandler(fop.getDefaultHandler()); + reader.setErrorHandler(fop.getDefaultHandler()); + reader.setEntityResolver(fop.getDefaultHandler()); + try { + reader.parse(testFile.toURI().toURL().toExternalForm()); + } catch (Exception e) { + collector.notifyError(e.getLocalizedMessage()); + throw e; + } + + List<String> results = collector.getResults(); + if (results.size() > 0) { + for (int i = 0; i < results.size(); i++) { + System.out.println(results.get(i)); + } + throw new IllegalStateException(results.get(0)); + } + } catch (Exception e) { + org.apache.commons.logging.LogFactory.getLog(this.getClass()).info( + "Error on " + testFile.getName()); + throw e; + } + } + + private static class PIListener extends XMLFilterImpl { + + private final MutableConfig fopConfig; + + public PIListener(XMLReader parent, MutableConfig fopConfig) { + super(parent); + this.fopConfig = fopConfig; + } + + /** @see org.xml.sax.helpers.XMLFilterImpl */ + public void processingInstruction(String target, String data) throws SAXException { + if ("fop-useragent-break-indent-inheritance".equals(target)) { + fopConfig.setBreakIndentInheritanceOnReferenceAreaBoundary( + Boolean.valueOf(data).booleanValue()); + } else if ("fop-source-resolution".equals(target)) { + fopConfig.setSourceResolution(Float.parseFloat(data)); + } + super.processingInstruction(target, data); + } + } +} diff --git a/src/test/java/org/apache/fop/fotreetest/FOTreeTestSuite.java b/src/test/java/org/apache/fop/fotreetest/FOTreeTestSuite.java new file mode 100644 index 000000000..604ff6e9e --- /dev/null +++ b/src/test/java/org/apache/fop/fotreetest/FOTreeTestSuite.java @@ -0,0 +1,38 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fotreetest; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +/** + * JUnit test suit for running layout engine test under JUnit control. + */ +@RunWith(Suite.class) +@Suite.SuiteClasses({ + org.apache.fop.fo.flow.table.AllTests.class, + org.apache.fop.fo.pagination.AllTests.class, + org.apache.fop.fotreetest.FOTreeTestCase.class, + org.apache.fop.fo.properties.CommonAccessibilityHolderTestCase.class, + org.apache.fop.fo.DelegatingFOEventHandlerTestCase.class +}) +public final class FOTreeTestSuite { + +} diff --git a/src/test/java/org/apache/fop/fotreetest/ResultCollector.java b/src/test/java/org/apache/fop/fotreetest/ResultCollector.java new file mode 100644 index 000000000..948b856bf --- /dev/null +++ b/src/test/java/org/apache/fop/fotreetest/ResultCollector.java @@ -0,0 +1,77 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fotreetest; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +/** + * This class collects failures for assertions injected into the FO stream. + */ +public class ResultCollector { + + private static ResultCollector instance; + + private List<String> results = new ArrayList<String>(); + + /** @return the ResultCollector singleton */ + public static ResultCollector getInstance() { + if (instance == null) { + instance = new ResultCollector(); + } + return instance; + } + + /** Main constructor. */ + public ResultCollector() { + //nop + } + + /** + * This notifies the ResultCollector about an assertion failure. + * + * @param message the message containing the details + */ + public void notifyAssertionFailure(String message) { + System.out.println(message); + results.add(message); + } + + /** + * This notifies the ResultCollector about a testcase that ended + * with a fatal error + * + * @param message the message containing the details + */ + public void notifyError(String message) { + results.add(message); + } + + /** Resets the result list. */ + public void reset() { + results.clear(); + } + + /** @return the list of results */ + public List<String> getResults() { + return Collections.unmodifiableList(results); + } +} diff --git a/src/test/java/org/apache/fop/fotreetest/ext/AssertElement.java b/src/test/java/org/apache/fop/fotreetest/ext/AssertElement.java new file mode 100644 index 000000000..955644ae4 --- /dev/null +++ b/src/test/java/org/apache/fop/fotreetest/ext/AssertElement.java @@ -0,0 +1,124 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fotreetest.ext; + + +import org.xml.sax.Attributes; +import org.xml.sax.Locator; + +import org.apache.fop.apps.FOPException; +import org.apache.fop.fo.FONode; +import org.apache.fop.fo.FOPropertyMapping; +import org.apache.fop.fo.PropertyList; +import org.apache.fop.fo.properties.KeepProperty; +import org.apache.fop.fo.properties.LengthPairProperty; +import org.apache.fop.fo.properties.LengthRangeProperty; +import org.apache.fop.fo.properties.PercentLength; +import org.apache.fop.fo.properties.Property; +import org.apache.fop.fo.properties.SpaceProperty; +import org.apache.fop.fotreetest.ResultCollector; + +/** + * Defines the assert element for the FOP Test extension. + */ +public class AssertElement extends TestObj { + + /** + * Creates a new AssertElement instance that is a child + * of the given {@link FONode} + * + * @param parent the parent {@link FONode} + */ + public AssertElement(FONode parent) { + super(parent); + } + + /** + * @see org.apache.fop.fo.FONode#processNode + */ + public void processNode(String elementName, + Locator locator, + Attributes attlist, + PropertyList propertyList) throws FOPException { + //super.processNode(elementName, locator, attlist, propertyList); + + ResultCollector collector = ResultCollector.getInstance(); + String propName = attlist.getValue("property"); + String expected = attlist.getValue("expected"); + String component = null; + int dotIndex = propName.indexOf('.'); + if (dotIndex >= 0) { + component = propName.substring(dotIndex + 1); + propName = propName.substring(0, dotIndex); + } + int propID = FOPropertyMapping.getPropertyId(propName); + if (propID < 0) { + collector.notifyAssertionFailure("Property not found: " + propName); + } else { + Property prop; + prop = propertyList.getParentPropertyList().get(propID); + if (component != null) { + //Access subcomponent + Property mainProp = prop; + prop = null; + LengthPairProperty lpp = mainProp.getLengthPair(); + if (lpp != null) { + prop = lpp.getComponent(FOPropertyMapping.getSubPropertyId(component)); + } + LengthRangeProperty lrp = mainProp.getLengthRange(); + if (lrp != null) { + prop = lrp.getComponent(FOPropertyMapping.getSubPropertyId(component)); + } + KeepProperty kp = mainProp.getKeep(); + if (kp != null) { + prop = kp.getComponent(FOPropertyMapping.getSubPropertyId(component)); + } + SpaceProperty sp = mainProp.getSpace(); + if (sp != null) { + prop = sp.getComponent(FOPropertyMapping.getSubPropertyId(component)); + } + } + String s; + if (prop instanceof PercentLength) { + s = prop.getString(); + } else { + s = String.valueOf(prop); + } + if (!expected.equals(s)) { + collector.notifyAssertionFailure( + locator.getSystemId() + + "\nProperty '" + propName + + "' expected to evaluate to '" + expected + + "' but got '" + s + + "'\n(test:assert in " + + propertyList.getParentFObj().getName() + + " at line #" + locator.getLineNumber() + + ", column #" + locator.getColumnNumber() + ")\n"); + } + } + + } + + /** @see org.apache.fop.fo.FONode#getLocalName() */ + public String getLocalName() { + return "assert"; + } + +} diff --git a/src/test/java/org/apache/fop/fotreetest/ext/TestElementMapping.java b/src/test/java/org/apache/fop/fotreetest/ext/TestElementMapping.java new file mode 100644 index 000000000..b61944eae --- /dev/null +++ b/src/test/java/org/apache/fop/fotreetest/ext/TestElementMapping.java @@ -0,0 +1,54 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fotreetest.ext; + +import org.apache.fop.fo.ElementMapping; +import org.apache.fop.fo.FONode; + +/** + * This class provides the element mapping for FOP. + */ +public class TestElementMapping extends ElementMapping { + + /** MathML Namespace */ + public static final String NAMESPACE = "http://xmlgraphics.apache.org/fop/test"; + + /** + * Main constructor + */ + public TestElementMapping() { + this.namespaceURI = NAMESPACE; + } + + /** @see org.apache.fop.fo.ElementMapping#initialize() */ + protected void initialize() { + if (foObjs == null) { + foObjs = new java.util.HashMap<String, Maker>(); + foObjs.put("assert", new AssertMaker()); + } + } + + static class AssertMaker extends ElementMapping.Maker { + public FONode make(FONode parent) { + return new AssertElement(parent); + } + } + +} diff --git a/src/test/java/org/apache/fop/fotreetest/ext/TestObj.java b/src/test/java/org/apache/fop/fotreetest/ext/TestObj.java new file mode 100644 index 000000000..e921c8919 --- /dev/null +++ b/src/test/java/org/apache/fop/fotreetest/ext/TestObj.java @@ -0,0 +1,44 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.fotreetest.ext; + +// FOP +import org.apache.fop.fo.FONode; +import org.apache.fop.fo.FObj; + +/** + * Base class for all FOP Test objects. + */ +public abstract class TestObj extends FObj { + + /** + * @see org.apache.fop.fo.FONode#FONode(FONode) + */ + public TestObj(FONode parent) { + super(parent); + } + + /** @see org.apache.fop.fo.FONode#getNamespaceURI() */ + public String getNamespaceURI() { + return TestElementMapping.NAMESPACE; + } + +} + diff --git a/src/test/java/org/apache/fop/image/loader/batik/ImageLoaderTestCase.java b/src/test/java/org/apache/fop/image/loader/batik/ImageLoaderTestCase.java new file mode 100644 index 000000000..7f3036c24 --- /dev/null +++ b/src/test/java/org/apache/fop/image/loader/batik/ImageLoaderTestCase.java @@ -0,0 +1,229 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.image.loader.batik; + +import java.awt.image.Raster; +import java.awt.image.RenderedImage; +import java.io.File; + +import org.junit.Ignore; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; + +import org.apache.xmlgraphics.image.loader.Image; +import org.apache.xmlgraphics.image.loader.ImageFlavor; +import org.apache.xmlgraphics.image.loader.ImageInfo; +import org.apache.xmlgraphics.image.loader.ImageManager; +import org.apache.xmlgraphics.image.loader.XMLNamespaceEnabledImageFlavor; +import org.apache.xmlgraphics.image.loader.impl.ImageRendered; +import org.apache.xmlgraphics.image.loader.impl.ImageXMLDOM; +import org.apache.xmlgraphics.image.writer.ImageWriterUtil; + +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.apps.FopFactory; +import org.apache.fop.apps.FopFactoryBuilder; + +/** + * Tests for bundled ImageLoader implementations. + */ +@Ignore("Batik fails big time") +public class ImageLoaderTestCase { + + private static final File DEBUG_TARGET_DIR = null; + + private FopFactory fopFactory; + + public ImageLoaderTestCase() { + FopFactoryBuilder builder = new FopFactoryBuilder(new File(".").toURI()); + builder.setSourceResolution(72); + builder.setTargetResolution(300); + fopFactory = builder.build(); + } + + @Test + public void testSVG() throws Exception { + String uri = "test/resources/images/img-w-size.svg"; + + FOUserAgent userAgent = fopFactory.newFOUserAgent(); + + ImageManager manager = fopFactory.getImageManager(); + ImageInfo info = manager.preloadImage(uri, userAgent.getImageSessionContext()); + assertNotNull("ImageInfo must not be null", info); + + Image img = manager.getImage(info, XMLNamespaceEnabledImageFlavor.SVG_DOM, + userAgent.getImageSessionContext()); + assertNotNull("Image must not be null", img); + assertEquals(XMLNamespaceEnabledImageFlavor.SVG_DOM, img.getFlavor()); + ImageXMLDOM imgDom = (ImageXMLDOM)img; + assertNotNull(imgDom.getDocument()); + assertEquals("http://www.w3.org/2000/svg", imgDom.getRootNamespace()); + info = imgDom.getInfo(); //Switch to the ImageInfo returned by the image + assertEquals(16000, info.getSize().getWidthMpt()); + assertEquals(16000, info.getSize().getHeightMpt()); + + img = manager.getImage(info, ImageFlavor.RENDERED_IMAGE, + userAgent.getImageSessionContext()); + assertNotNull("Image must not be null", img); + assertEquals(ImageFlavor.RENDERED_IMAGE, img.getFlavor()); + ImageRendered imgRed = (ImageRendered)img; + assertNotNull(imgRed.getRenderedImage()); + if (DEBUG_TARGET_DIR != null) { + ImageWriterUtil.saveAsPNG(imgRed.getRenderedImage(), + (int)userAgent.getTargetResolution(), + new File(DEBUG_TARGET_DIR, "out.svg.png")); + } + assertEquals(67, imgRed.getRenderedImage().getWidth()); + assertEquals(67, imgRed.getRenderedImage().getHeight()); + info = imgRed.getInfo(); //Switch to the ImageInfo returned by the image + assertEquals(16000, info.getSize().getWidthMpt()); + assertEquals(16000, info.getSize().getHeightMpt()); + } + + @Test + public void testSVGNoViewbox() throws Exception { + String uri = "test/resources/images/circles.svg"; + + FopFactoryBuilder builder = new FopFactoryBuilder(new File(".").toURI()); + builder.setSourceResolution(96); + builder.setTargetResolution(300); + FopFactory ff = builder.build(); + + FOUserAgent userAgent = ff.newFOUserAgent(); + + ImageManager manager = ff.getImageManager(); + ImageInfo info = manager.preloadImage(uri, userAgent.getImageSessionContext()); + assertNotNull("ImageInfo must not be null", info); + + Image img = manager.getImage(info, XMLNamespaceEnabledImageFlavor.SVG_DOM, + userAgent.getImageSessionContext()); + assertNotNull("Image must not be null", img); + assertEquals(XMLNamespaceEnabledImageFlavor.SVG_DOM, img.getFlavor()); + ImageXMLDOM imgDom = (ImageXMLDOM)img; + assertNotNull(imgDom.getDocument()); + assertEquals("http://www.w3.org/2000/svg", imgDom.getRootNamespace()); + info = imgDom.getInfo(); //Switch to the ImageInfo returned by the image + assertEquals(96, info.getSize().getDpiHorizontal(), 0); + assertEquals(340158, info.getSize().getWidthMpt()); + assertEquals(340158, info.getSize().getHeightMpt()); + assertEquals(454, info.getSize().getWidthPx()); + assertEquals(454, info.getSize().getHeightPx()); + + img = manager.getImage(info, ImageFlavor.RENDERED_IMAGE, + userAgent.getImageSessionContext()); + assertNotNull("Image must not be null", img); + assertEquals(ImageFlavor.RENDERED_IMAGE, img.getFlavor()); + ImageRendered imgRed = (ImageRendered)img; + assertNotNull(imgRed.getRenderedImage()); + if (DEBUG_TARGET_DIR != null) { + ImageWriterUtil.saveAsPNG(imgRed.getRenderedImage(), + (int)userAgent.getTargetResolution(), + new File(DEBUG_TARGET_DIR, "circles.svg.png")); + } + assertEquals(1418, imgRed.getRenderedImage().getWidth()); + assertEquals(1418, imgRed.getRenderedImage().getHeight()); + info = imgRed.getInfo(); //Switch to the ImageInfo returned by the image + assertEquals(340158, info.getSize().getWidthMpt()); + assertEquals(340158, info.getSize().getHeightMpt()); + } + + @Test + public void testWMF() throws Exception { + String uri = "test/resources/images/testChart.wmf"; + + FOUserAgent userAgent = fopFactory.newFOUserAgent(); + + ImageManager manager = fopFactory.getImageManager(); + ImageInfo info = manager.preloadImage(uri, userAgent.getImageSessionContext()); + assertNotNull("ImageInfo must not be null", info); + + Image img = manager.getImage(info, ImageFlavor.RENDERED_IMAGE, + userAgent.getImageSessionContext()); + assertNotNull("Image must not be null", img); + assertEquals(ImageFlavor.RENDERED_IMAGE, img.getFlavor()); + ImageRendered imgRed = (ImageRendered)img; + assertNotNull(imgRed.getRenderedImage()); + if (DEBUG_TARGET_DIR != null) { + ImageWriterUtil.saveAsPNG(imgRed.getRenderedImage(), + (int)userAgent.getTargetResolution(), + new File(DEBUG_TARGET_DIR, "out.wmf.png")); + } + assertEquals(3300, imgRed.getRenderedImage().getWidth()); + assertEquals(2550, imgRed.getRenderedImage().getHeight()); + info = imgRed.getInfo(); //Switch to the ImageInfo returned by the image + assertEquals(792000, info.getSize().getWidthMpt()); + assertEquals(612000, info.getSize().getHeightMpt()); + } + + @Test + public void testSVGWithReferences() throws Exception { + String uri = "test/resources/fop/svg/images.svg"; + FopFactory ff = FopFactory.newInstance(new File(".").toURI()); + FOUserAgent userAgent = ff.newFOUserAgent(); + + ImageManager manager = ff.getImageManager(); + ImageInfo info = manager.preloadImage(uri, userAgent.getImageSessionContext()); + assertNotNull("ImageInfo must not be null", info); + + Image img = manager.getImage(info, XMLNamespaceEnabledImageFlavor.SVG_DOM, + userAgent.getImageSessionContext()); + assertNotNull("Image must not be null", img); + assertEquals(XMLNamespaceEnabledImageFlavor.SVG_DOM, img.getFlavor()); + ImageXMLDOM imgDom = (ImageXMLDOM)img; + assertNotNull(imgDom.getDocument()); + assertEquals("http://www.w3.org/2000/svg", imgDom.getRootNamespace()); + info = imgDom.getInfo(); //Switch to the ImageInfo returned by the image + assertEquals(400000, info.getSize().getWidthMpt()); + assertEquals(400000, info.getSize().getHeightMpt()); + assertEquals(400, info.getSize().getWidthPx()); + assertEquals(400, info.getSize().getHeightPx()); + + img = manager.getImage(info, ImageFlavor.RENDERED_IMAGE, + userAgent.getImageSessionContext()); + assertNotNull("Image must not be null", img); + assertEquals(ImageFlavor.RENDERED_IMAGE, img.getFlavor()); + ImageRendered imgRed = (ImageRendered)img; + RenderedImage renImg = imgRed.getRenderedImage(); + assertNotNull(renImg); + if (DEBUG_TARGET_DIR != null) { + ImageWriterUtil.saveAsPNG(renImg, + (int)userAgent.getTargetResolution(), + new File(DEBUG_TARGET_DIR, "images.svg.png")); + } + assertEquals(400, renImg.getWidth()); + assertEquals(400, renImg.getHeight()); + info = imgRed.getInfo(); //Switch to the ImageInfo returned by the image + assertEquals(400000, info.getSize().getWidthMpt()); + assertEquals(400000, info.getSize().getHeightMpt()); + Raster raster = renImg.getData(); + // This pixel is white + int[] pixel1 = raster.getPixel(1, 1, (int[])null); + // This pixel is from the embedded JPG and is not white + int[] pixel80 = raster.getPixel(80, 80, (int[]) null); + assertEquals(pixel1.length, pixel80.length); + boolean same = true; + for (int i = 0; i < pixel1.length; i++) { + same &= (pixel1[i] == pixel80[i]); + } + assertFalse("Embedding JPG into SVG failed", same); + } +} diff --git a/src/test/java/org/apache/fop/image/loader/batik/ImagePreloaderTestCase.java b/src/test/java/org/apache/fop/image/loader/batik/ImagePreloaderTestCase.java new file mode 100644 index 000000000..3d690b67c --- /dev/null +++ b/src/test/java/org/apache/fop/image/loader/batik/ImagePreloaderTestCase.java @@ -0,0 +1,165 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.image.loader.batik; + +import java.io.File; +import java.io.IOException; + +import org.junit.Ignore; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.apache.xmlgraphics.image.loader.ImageException; +import org.apache.xmlgraphics.image.loader.ImageInfo; +import org.apache.xmlgraphics.image.loader.ImageManager; + +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.apps.FopFactory; +import org.apache.fop.apps.FopFactoryBuilder; +import org.apache.fop.apps.MimeConstants; + +/** + * Tests for bundled image preloader implementations. + */ +public class ImagePreloaderTestCase { + + private FopFactory fopFactory; + + public ImagePreloaderTestCase() { + FopFactoryBuilder builder = new FopFactoryBuilder(new File(".").toURI()); + builder.setSourceResolution(72); + builder.setTargetResolution(300); + fopFactory = builder.build(); + } + + @Test + public void testSVG() throws Exception { + String uri = "test/resources/images/img-w-size.svg"; + + checkSVGFile(uri); + } + + @Test + public void testSVGZ() throws Exception { + String uri = "test/resources/images/img-w-size.svgz"; + + checkSVGFile(uri); + } + + private void checkSVGFile(String uri) throws ImageException, IOException { + FOUserAgent userAgent = fopFactory.newFOUserAgent(); + + ImageManager manager = fopFactory.getImageManager(); + ImageInfo info = manager.preloadImage(uri, userAgent.getImageSessionContext()); + assertNotNull("ImageInfo must not be null", info); + assertEquals(MimeConstants.MIME_SVG, info.getMimeType()); + assertEquals(uri, info.getOriginalURI()); + assertEquals(16, info.getSize().getWidthPx()); + assertEquals(16, info.getSize().getHeightPx()); + assertEquals(userAgent.getSourceResolution(), info.getSize().getDpiHorizontal(), 0.1); + assertEquals(16000, info.getSize().getWidthMpt()); + assertEquals(16000, info.getSize().getHeightMpt()); + } + + @Test + public void testSVGNoSize() throws Exception { + String uri = "test/resources/images/img.svg"; + FOUserAgent userAgent = fopFactory.newFOUserAgent(); + + ImageManager manager = fopFactory.getImageManager(); + ImageInfo info = manager.preloadImage(uri, userAgent.getImageSessionContext()); + assertNotNull("ImageInfo must not be null", info); + assertEquals(MimeConstants.MIME_SVG, info.getMimeType()); + assertEquals(uri, info.getOriginalURI()); + assertEquals(100, info.getSize().getWidthPx()); //100 = default viewport size + assertEquals(100, info.getSize().getHeightPx()); + assertEquals(userAgent.getSourceResolution(), info.getSize().getDpiHorizontal(), 0.1); + assertEquals(100000, info.getSize().getWidthMpt()); + assertEquals(100000, info.getSize().getHeightMpt()); + } + + @Test + @Ignore("Batik has not yet been handled") + public void testSVGWithDOM() throws Exception { + String uri = "my:SVGImage"; + FOUserAgent userAgent = fopFactory.newFOUserAgent(); + + // TODO: SORT THIS OUT!! + // userAgent.setURIResolver(new URIResolver() { + // + // public Source resolve(String href, String base) throws TransformerException { + // if (href.startsWith("my:")) { + // DOMImplementation impl = SVGDOMImplementation.getDOMImplementation(); + // String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI; + // Document doc = impl.createDocument(svgNS, "svg", null); + // Element element = doc.getDocumentElement(); + // element.setAttribute("viewBox", "0 0 20 20"); + // element.setAttribute("width", "20pt"); + // element.setAttribute("height", "20pt"); + // + // Element rect = doc.createElementNS(svgNS, "rect"); + // rect.setAttribute("x", "5"); + // rect.setAttribute("y", "5"); + // rect.setAttribute("width", "10"); + // rect.setAttribute("height", "10"); + // element.appendChild(rect); + // + // DOMSource src = new DOMSource(doc); + // return src; + // } else { + // return null; + // } + // } + // + // }); + + ImageManager manager = fopFactory.getImageManager(); + ImageInfo info = manager.preloadImage(uri, userAgent.getImageSessionContext()); + assertNotNull("ImageInfo must not be null", info); + assertEquals(MimeConstants.MIME_SVG, info.getMimeType()); + assertEquals(uri, info.getOriginalURI()); + assertEquals(20, info.getSize().getWidthPx()); //100 = default viewport size + assertEquals(20, info.getSize().getHeightPx()); + assertEquals(userAgent.getSourceResolution(), info.getSize().getDpiHorizontal(), 0.1); + assertEquals(20000, info.getSize().getWidthMpt()); + assertEquals(20000, info.getSize().getHeightMpt()); + } + + @Test + public void testWMF() throws Exception { + String uri = "test/resources/images/testChart.wmf"; + + FOUserAgent userAgent = fopFactory.newFOUserAgent(); + + ImageManager manager = fopFactory.getImageManager(); + ImageInfo info = manager.preloadImage(uri, userAgent.getImageSessionContext()); + assertNotNull("ImageInfo must not be null", info); + assertEquals(ImageWMF.MIME_WMF, info.getMimeType()); + assertEquals(uri, info.getOriginalURI()); + assertEquals(27940, info.getSize().getWidthPx()); + assertEquals(21590, info.getSize().getHeightPx()); + assertEquals(2540, info.getSize().getDpiHorizontal(), 0.1); + assertEquals(792000, info.getSize().getWidthMpt()); + assertEquals(612000, info.getSize().getHeightMpt()); + } + +} diff --git a/src/test/java/org/apache/fop/intermediate/AbstractIFTest.java b/src/test/java/org/apache/fop/intermediate/AbstractIFTest.java new file mode 100644 index 000000000..48c3f335b --- /dev/null +++ b/src/test/java/org/apache/fop/intermediate/AbstractIFTest.java @@ -0,0 +1,151 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.intermediate; + +import java.io.File; +import java.io.IOException; + +import javax.xml.XMLConstants; +import javax.xml.transform.Result; +import javax.xml.transform.Templates; +import javax.xml.transform.Transformer; +import javax.xml.transform.dom.DOMResult; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.sax.SAXResult; +import javax.xml.validation.Schema; +import javax.xml.validation.SchemaFactory; +import javax.xml.validation.Validator; + +import org.w3c.dom.Document; +import org.xml.sax.ErrorHandler; +import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; + +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.apps.Fop; +import org.apache.fop.render.intermediate.IFContext; +import org.apache.fop.render.intermediate.IFDocumentHandler; +import org.apache.fop.render.intermediate.IFSerializer; + +/** + * A common super-class for intermediate format test cases. + */ +abstract class AbstractIFTest extends AbstractIntermediateTest { + + private static final Schema IF_SCHEMA; + + static { + Schema ifSchema = null; + try { + SchemaFactory sFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); + sFactory.setErrorHandler(new ErrorHandler() { + + public void error(SAXParseException exception) throws SAXException { + throw exception; + } + + public void fatalError(SAXParseException exception) throws SAXException { + throw exception; + } + + public void warning(SAXParseException exception) throws SAXException { + throw exception; + } + + }); + File ifSchemaFile = new File( + "src/documentation/intermediate-format-ng/fop-intermediate-format-ng.xsd"); + ifSchema = sFactory.newSchema(ifSchemaFile); + } catch (IllegalArgumentException iae) { + System.err.println("No suitable SchemaFactory for XML Schema validation found!"); + } catch (SAXException e) { + throw new ExceptionInInitializerError(e); + } + IF_SCHEMA = ifSchema; + } + + /** + * Creates a new test case. + * + * @param testFile the file containing the document and the tests + * @throws IOException if an I/O error occurs while loading the test case + */ + public AbstractIFTest(File testFile) throws IOException { + super(testFile); + } + + @Override + protected String getIntermediateFileExtension() { + return ".if.xml"; + } + + @Override + protected Document buildIntermediateDocument(Templates templates) throws Exception { + Transformer transformer = templates.newTransformer(); + setErrorListener(transformer); + + //Set up XMLRenderer to render to a DOM + DOMResult domResult = new DOMResult(); + + FOUserAgent userAgent = createUserAgent(); + + //Create an instance of the target renderer so the XMLRenderer can use its font setup + IFDocumentHandler targetHandler = userAgent.getRendererFactory().createDocumentHandler( + userAgent, getTargetMIME()); + + //Setup painter + IFSerializer serializer = new IFSerializer(new IFContext(userAgent)); + serializer.mimicDocumentHandler(targetHandler); + serializer.setResult(domResult); + + userAgent.setDocumentHandlerOverride(serializer); + + Fop fop = fopFactory.newFop(userAgent); + Result res = new SAXResult(fop.getDefaultHandler()); + transformer.transform(new DOMSource(testDoc), res); + + return (Document) domResult.getNode(); + } + + @Override + protected void validate(Document doc) throws SAXException, IOException { + if (IF_SCHEMA == null) { + return; //skip validation; + } + Validator validator = IF_SCHEMA.newValidator(); + validator.setErrorHandler(new ErrorHandler() { + + public void error(SAXParseException exception) throws SAXException { + throw exception; + } + + public void fatalError(SAXParseException exception) throws SAXException { + throw exception; + } + + public void warning(SAXParseException exception) throws SAXException { + //ignore + } + + }); + validator.validate(new DOMSource(doc)); + } + +} diff --git a/src/test/java/org/apache/fop/intermediate/AbstractIntermediateTest.java b/src/test/java/org/apache/fop/intermediate/AbstractIntermediateTest.java new file mode 100644 index 000000000..23c7c0560 --- /dev/null +++ b/src/test/java/org/apache/fop/intermediate/AbstractIntermediateTest.java @@ -0,0 +1,243 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.intermediate; + +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; + +import javax.xml.transform.ErrorListener; +import javax.xml.transform.Source; +import javax.xml.transform.Templates; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; +import javax.xml.transform.dom.DOMSource; + +import org.custommonkey.xmlunit.XMLAssert; +import org.junit.After; +import org.junit.Before; +import org.w3c.dom.Document; +import org.xml.sax.SAXException; + +import org.apache.commons.io.IOUtils; +import org.apache.commons.io.output.NullOutputStream; + +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.apps.FopFactory; +import org.apache.fop.apps.MimeConstants; +import org.apache.fop.events.model.EventSeverity; +import org.apache.fop.util.ConsoleEventListenerForTests; + +/** + * Abstract base class for intermediate format tests. + */ +public abstract class AbstractIntermediateTest { + + /** the test environment */ + protected static TestAssistant testAssistant = new TestAssistant(); + + /** the FOP factory */ + protected FopFactory fopFactory; + + /** the directory containing the tests */ + protected File testDir = new File("test/layoutengine/standard-testcases"); + /** the output directory for any files generated by the tests */ + protected File outputDir; + + /** the test file */ + protected File testFile; + /** the test document as DOM */ + protected Document testDoc; + /** the intermediate format document as DOM */ + protected Document intermediate; + + /** + * Constructor for the test suite that is used for each test file. + * @param testFile the test file to run + * @throws IOException if an I/O error occurs while loading the test case + */ + public AbstractIntermediateTest(File testFile) + throws IOException { + this.testFile = testFile; + } + + @Before + public void setUp() throws Exception { + setupOutputDirectory(); + this.testDoc = testAssistant.loadTestCase(testFile); + this.fopFactory = testAssistant.getFopFactory(testDoc); + intermediate = buildIntermediateDocument(testAssistant.getTestcase2FOStylesheet()); + if (outputDir != null) { + testAssistant.saveDOM(intermediate, new File(outputDir, + testFile.getName() + ".1" + getIntermediateFileExtension())); + } + } + + @After + public void tearDown() throws Exception { + //Release memory + this.intermediate = null; + this.fopFactory = null; + this.testDoc = null; + } + + /** + * Returns the file extension for the intermediate file format. + * @return the file extension + */ + protected abstract String getIntermediateFileExtension(); + + /** + * Returns the MIME type for which to test or to mimic for the intermediate format. + * @return the MIME type + */ + protected String getTargetMIME() { + return MimeConstants.MIME_PDF; + } + + /** + * Validates the intermediate format file. + * @param doc the intermediate file + * @throws IOException if an IO error occurs while loading the schema + * @throws SAXException if a SAX-related exception (including a validation error) occurs + */ + protected void validate(Document doc) throws SAXException, IOException { + //nop by default + } + + /** + * Builds an intermediate format document from a source file. + * @param templates the (optional) stylesheet + * @return the intermediate format document as a DOM + * @throws Exception if an error occurs while processing the document + */ + protected abstract Document buildIntermediateDocument(Templates templates) throws Exception; + + /** + * Creates a new FOP user agent. + * @return the user agent + */ + protected FOUserAgent createUserAgent() { + FOUserAgent userAgent = fopFactory.newFOUserAgent(); + userAgent.getEventBroadcaster().addEventListener( + new ConsoleEventListenerForTests(testFile.getName(), EventSeverity.FATAL)); + return userAgent; + } + + /** + * Sets up the output directory. + */ + protected void setupOutputDirectory() { + String s = System.getProperty("fop.intermediate.outdir"); + if (s != null && s.length() > 0) { + outputDir = new File(s); + outputDir.mkdirs(); + } + } + + /** + * Tests the area tree parser by running the parsed area tree again through the area tree + * renderer. The source and result documents are compared to each other. + * @throws Exception if the test fails + */ + public void testParserToIntermediateFormat() throws Exception { + validate(intermediate); + Source src = new DOMSource(intermediate); + Document doc = parseAndRenderToIntermediateFormat(src); + if (outputDir != null) { + File tgtFile = new File(outputDir, testFile.getName() + ".2" + + getIntermediateFileExtension()); + testAssistant.saveDOM(doc, tgtFile); + } + + XMLAssert.assertXMLEqual(intermediate, doc); + } + + /** + * Parses the intermediate file and renders it back to the intermediate format. + * @param src the source for the intermediate file + * @return a DOM Document with the re-created intermediate file + * @throws Exception if an error occurs while processing the document + */ + protected abstract Document parseAndRenderToIntermediateFormat(Source src) throws Exception; + + /** + * Tests the area tree parser by sending the parsed area tree to the PDF Renderer. Some + * errors might be caught by the PDFRenderer. + * @throws Exception if the test fails + */ + public void testParserToPDF() throws Exception { + OutputStream out; + if (outputDir != null) { + File tgtFile = new File(outputDir, testFile.getName() + ".pdf"); + out = new FileOutputStream(tgtFile); + out = new BufferedOutputStream(out); + } else { + out = new NullOutputStream(); + } + try { + Source src = new DOMSource(intermediate); + parseAndRender(src, out); + } finally { + IOUtils.closeQuietly(out); + } + } + + /** + * Parses and renders an intermediate format document to a final format. + * @param src the source document + * @param out the target output stream + * @throws Exception if an error occurs while rendering the document + */ + protected abstract void parseAndRender(Source src, OutputStream out) + throws Exception; + + /** + * Run the test. + * + * @throws Exception if an error occurs during the test + */ + public abstract void runTest() throws Exception; + + /** + * Sets an error listener which doesn't swallow errors like Xalan's default one. + * @param transformer the transformer to set the error listener on + */ + protected void setErrorListener(Transformer transformer) { + transformer.setErrorListener(new ErrorListener() { + + public void error(TransformerException exception) throws TransformerException { + throw exception; + } + + public void fatalError(TransformerException exception) throws TransformerException { + throw exception; + } + + public void warning(TransformerException exception) throws TransformerException { + //ignore + } + + }); + } + +} diff --git a/src/test/java/org/apache/fop/intermediate/AreaTreeParserTestCase.java b/src/test/java/org/apache/fop/intermediate/AreaTreeParserTestCase.java new file mode 100644 index 000000000..ab1af4379 --- /dev/null +++ b/src/test/java/org/apache/fop/intermediate/AreaTreeParserTestCase.java @@ -0,0 +1,162 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.intermediate; + +import java.io.File; +import java.io.IOException; +import java.io.OutputStream; +import java.util.Collection; + +import javax.xml.transform.Result; +import javax.xml.transform.Source; +import javax.xml.transform.Templates; +import javax.xml.transform.Transformer; +import javax.xml.transform.dom.DOMResult; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.sax.SAXResult; +import javax.xml.transform.sax.TransformerHandler; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; +import org.w3c.dom.Document; + +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.apps.Fop; +import org.apache.fop.apps.MimeConstants; +import org.apache.fop.area.AreaTreeModel; +import org.apache.fop.area.AreaTreeParser; +import org.apache.fop.area.RenderPagesModel; +import org.apache.fop.fonts.FontInfo; +import org.apache.fop.layoutengine.LayoutEngineTestUtils; +import org.apache.fop.render.Renderer; +import org.apache.fop.render.xml.XMLRenderer; + +/** + * Tests the area tree parser. + */ +@RunWith(Parameterized.class) +public class AreaTreeParserTestCase extends AbstractIntermediateTest { + + /** + * Creates the parameters for this test. + * + * @return the list of file arrays populated with test files + * @throws IOException if an I/O error occurs while reading the test file + */ + @Parameters + public static Collection<File[]> getParameters() throws IOException { + return LayoutEngineTestUtils.getLayoutTestFiles(); + } + + /** + * Constructor for the test suite that is used for each test file. + * @param testFile the test file to run + * @throws IOException + * @throws IOException if an I/O error occurs while loading the test case + */ + public AreaTreeParserTestCase(File testFile) throws IOException { + super(testFile); + } + + /** {@inheritDoc} */ + protected String getIntermediateFileExtension() { + return ".at.xml"; + } + + /** {@inheritDoc} */ + protected Document buildIntermediateDocument(Templates templates) + throws Exception { + Transformer transformer = templates.newTransformer(); + setErrorListener(transformer); + + //Set up XMLRenderer to render to a DOM + TransformerHandler handler = testAssistant.getTransformerFactory().newTransformerHandler(); + DOMResult domResult = new DOMResult(); + handler.setResult(domResult); + + FOUserAgent userAgent = createUserAgent(); + + //Create an instance of the target renderer so the XMLRenderer can use its font setup + Renderer targetRenderer = userAgent.getRendererFactory().createRenderer( + userAgent, getTargetMIME()); + + XMLRenderer renderer = new XMLRenderer(userAgent); + renderer.mimicRenderer(targetRenderer); + renderer.setContentHandler(handler); + + userAgent.setRendererOverride(renderer); + + Fop fop = fopFactory.newFop(MimeConstants.MIME_FOP_AREA_TREE, userAgent); + Result res = new SAXResult(fop.getDefaultHandler()); + transformer.transform(new DOMSource(testDoc), res); + + return (Document)domResult.getNode(); + } + + /** {@inheritDoc} */ + protected void parseAndRender(Source src, OutputStream out) throws Exception { + AreaTreeParser parser = new AreaTreeParser(); + + FOUserAgent userAgent = createUserAgent(); + FontInfo fontInfo = new FontInfo(); + AreaTreeModel treeModel = new RenderPagesModel(userAgent, + getTargetMIME(), fontInfo, out); + parser.parse(src, treeModel, userAgent); + treeModel.endDocument(); + } + + /** {@inheritDoc} */ + protected Document parseAndRenderToIntermediateFormat(Source src) throws Exception { + AreaTreeParser parser = new AreaTreeParser(); + + //Set up XMLRenderer to render to a DOM + TransformerHandler handler = testAssistant.getTransformerFactory().newTransformerHandler(); + DOMResult domResult = new DOMResult(); + handler.setResult(domResult); + FOUserAgent userAgent = createUserAgent(); + XMLRenderer renderer = new XMLRenderer(userAgent); + userAgent.setRendererOverride(renderer); + renderer.setContentHandler(handler); + + FontInfo fontInfo = new FontInfo(); + AreaTreeModel treeModel = new RenderPagesModel(userAgent, + MimeConstants.MIME_FOP_AREA_TREE, fontInfo, null); + parser.parse(src, treeModel, userAgent); + treeModel.endDocument(); + + return (Document)domResult.getNode(); + } + + @Override + @Test + public void runTest() throws Exception { + try { + testParserToIntermediateFormat(); + testParserToPDF(); + } catch (Exception e) { + org.apache.commons.logging.LogFactory.getLog(this.getClass()).error( + "Error on " + testFile.getName()); + throw e; + } + } + +} diff --git a/src/test/java/org/apache/fop/intermediate/AreaTreeXMLFormatTestSuite.java b/src/test/java/org/apache/fop/intermediate/AreaTreeXMLFormatTestSuite.java new file mode 100644 index 000000000..2003958c8 --- /dev/null +++ b/src/test/java/org/apache/fop/intermediate/AreaTreeXMLFormatTestSuite.java @@ -0,0 +1,32 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.intermediate; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +/** + * JUnit test suite for the area tree XML format + */ +@RunWith(Suite.class) +@SuiteClasses(AreaTreeParserTestCase.class) +public class AreaTreeXMLFormatTestSuite { +} diff --git a/src/test/java/org/apache/fop/intermediate/IFCheck.java b/src/test/java/org/apache/fop/intermediate/IFCheck.java new file mode 100644 index 000000000..dfd76f3b3 --- /dev/null +++ b/src/test/java/org/apache/fop/intermediate/IFCheck.java @@ -0,0 +1,37 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.intermediate; + +import org.w3c.dom.Document; + +import org.apache.fop.check.Check; + +/** + * Check interface for intermediate format checks. + */ +public interface IFCheck extends Check { + + /** + * Called to perform the check. + * @param intermediate the intermediate format file as a DOM document + */ + void check(Document intermediate); + +} diff --git a/src/test/java/org/apache/fop/intermediate/IFChecksFactory.java b/src/test/java/org/apache/fop/intermediate/IFChecksFactory.java new file mode 100644 index 000000000..2eab74130 --- /dev/null +++ b/src/test/java/org/apache/fop/intermediate/IFChecksFactory.java @@ -0,0 +1,49 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.intermediate; + +import org.w3c.dom.Element; + +import org.apache.fop.check.ChecksFactory; +import org.apache.fop.layoutengine.EvalCheck; +import org.apache.fop.layoutengine.TrueCheck; + +/** + * A factory class for creating {@link IFCheck} instances. + */ +final class IFChecksFactory extends ChecksFactory<IFCheck> { + + IFChecksFactory() { + registerCheckFactory("true", new CheckFactory<IFCheck>() { + + public IFCheck createCheck(Element element) { + return new TrueCheck(element); + } + + }); + registerCheckFactory("eval", new CheckFactory<IFCheck>() { + + public IFCheck createCheck(Element element) { + return new EvalCheck(element); + } + + }); + } +} diff --git a/src/test/java/org/apache/fop/intermediate/IFMimickingTestCase.java b/src/test/java/org/apache/fop/intermediate/IFMimickingTestCase.java new file mode 100644 index 000000000..83dd88661 --- /dev/null +++ b/src/test/java/org/apache/fop/intermediate/IFMimickingTestCase.java @@ -0,0 +1,153 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.intermediate; + +import java.io.File; + +import javax.xml.transform.ErrorListener; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMResult; +import javax.xml.transform.sax.SAXResult; +import javax.xml.transform.stream.StreamSource; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.fail; + +import org.apache.fop.apps.FOPException; +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.apps.Fop; +import org.apache.fop.apps.FopFactory; +import org.apache.fop.apps.MimeConstants; +import org.apache.fop.events.Event; +import org.apache.fop.events.EventFormatter; +import org.apache.fop.events.EventListener; +import org.apache.fop.fonts.FontEventProducer; +import org.apache.fop.render.intermediate.IFContext; +import org.apache.fop.render.intermediate.IFDocumentHandler; +import org.apache.fop.render.intermediate.IFException; +import org.apache.fop.render.intermediate.IFSerializer; + +/** + * This test checks the correct mimicking of a different output format. + */ +public class IFMimickingTestCase { + + private FopFactory fopFactory; + + @Before + public void setUp() throws Exception { + File configFile = new File("test/test-no-xml-metrics.xconf"); + fopFactory = FopFactory.newInstance(configFile); + } + + /** + * Tests IF document handler mimicking with PDF output. + * @throws Exception if an error occurs + */ + @Test + public void testMimickingPDF() throws Exception { + doTestMimicking(MimeConstants.MIME_PDF); + } + + /** + * Tests IF document handler mimicking with PostScript output. + * @throws Exception if an error occurs + */ + @Test + public void testMimickingPS() throws Exception { + doTestMimicking(MimeConstants.MIME_POSTSCRIPT); + } + + /** + * Tests IF document handler mimicking with TIFF output. + * @throws Exception if an error occurs + */ + @Test + public void testMimickingTIFF() throws Exception { + doTestMimicking(MimeConstants.MIME_TIFF); + } + + private void doTestMimicking(String mime) throws FOPException, IFException, + TransformerException { + //Set up XMLRenderer to render to a DOM + DOMResult domResult = new DOMResult(); + + FOUserAgent userAgent = fopFactory.newFOUserAgent(); + userAgent.getEventBroadcaster().addEventListener(new EventListener() { + + public void processEvent(Event event) { + if (event.getEventGroupID().equals(FontEventProducer.class.getName())) { + fail("There must be no font-related event! Got: " + + EventFormatter.format(event)); + } + } + + }); + + //Create an instance of the target renderer so the XMLRenderer can use its font setup + IFDocumentHandler targetHandler = userAgent.getRendererFactory().createDocumentHandler( + userAgent, mime); + + //Setup painter + IFSerializer serializer = new IFSerializer(new IFContext(userAgent)); + serializer.mimicDocumentHandler(targetHandler); + serializer.setResult(domResult); + + userAgent.setDocumentHandlerOverride(serializer); + + Fop fop = fopFactory.newFop(userAgent); + + //minimal-pdf-a.fo uses the Gladiator font so is an ideal FO file for this test: + StreamSource src = new StreamSource(new File("test/xml/pdf-a/minimal-pdf-a.fo")); + + TransformerFactory tFactory = TransformerFactory.newInstance(); + Transformer transformer = tFactory.newTransformer(); + setErrorListener(transformer); + + transformer.transform(src, new SAXResult(fop.getDefaultHandler())); + } + + /** + * Sets an error listener which doesn't swallow errors like Xalan's default one. + * @param transformer the transformer to set the error listener on + */ + protected void setErrorListener(Transformer transformer) { + transformer.setErrorListener(new ErrorListener() { + + public void error(TransformerException exception) throws TransformerException { + throw exception; + } + + public void fatalError(TransformerException exception) throws TransformerException { + throw exception; + } + + public void warning(TransformerException exception) throws TransformerException { + //ignore + } + + }); + } + +} diff --git a/src/test/java/org/apache/fop/intermediate/IFParserTestCase.java b/src/test/java/org/apache/fop/intermediate/IFParserTestCase.java new file mode 100644 index 000000000..9a08816c6 --- /dev/null +++ b/src/test/java/org/apache/fop/intermediate/IFParserTestCase.java @@ -0,0 +1,113 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.intermediate; + +import java.io.File; +import java.io.IOException; +import java.io.OutputStream; +import java.util.Collection; + +import javax.xml.transform.Source; +import javax.xml.transform.dom.DOMResult; +import javax.xml.transform.stream.StreamResult; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; +import org.w3c.dom.Document; + +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.fonts.FontInfo; +import org.apache.fop.layoutengine.LayoutEngineTestUtils; +import org.apache.fop.render.intermediate.IFContext; +import org.apache.fop.render.intermediate.IFDocumentHandler; +import org.apache.fop.render.intermediate.IFParser; +import org.apache.fop.render.intermediate.IFSerializer; + +/** + * Tests the intermediate format parser. + */ +@RunWith(Parameterized.class) +public class IFParserTestCase extends AbstractIFTest { + + /** + * Gets the parameters for this test + * + * @return a collection of file arrays containing the test files + * @throws IOException if an error occurs when trying to read the test files + */ + @Parameters + public static Collection<File[]> getParameters() throws IOException { + return LayoutEngineTestUtils.getLayoutTestFiles(); + } + + /** + * Constructor for the test suite that is used for each test file. + * @param testFile the test file to run + * @throws IOException if an I/O error occurs while loading the test case + */ + public IFParserTestCase(File testFile) throws IOException { + super(testFile); + } + + /** {@inheritDoc} */ + @Override + protected void parseAndRender(Source src, OutputStream out) throws Exception { + IFParser parser = new IFParser(); + + FOUserAgent userAgent = createUserAgent(); + + IFDocumentHandler documentHandler = userAgent.getRendererFactory().createDocumentHandler( + userAgent, getTargetMIME()); + documentHandler.setResult(new StreamResult(out)); + documentHandler.setDefaultFontInfo(new FontInfo()); + parser.parse(src, documentHandler, userAgent); + } + + /** {@inheritDoc} */ + @Override + protected Document parseAndRenderToIntermediateFormat(Source src) throws Exception { + IFParser parser = new IFParser(); + + FOUserAgent userAgent = createUserAgent(); + + IFSerializer serializer = new IFSerializer(new IFContext(userAgent)); + DOMResult domResult = new DOMResult(); + serializer.setResult(domResult); + + parser.parse(src, serializer, userAgent); + + return (Document)domResult.getNode(); + } + + @Override + @Test + public void runTest() throws Exception { + try { + testParserToIntermediateFormat(); + testParserToPDF(); + } catch (Exception e) { + org.apache.commons.logging.LogFactory.getLog(this.getClass()).error( + "Error on " + testFile.getName()); + throw e; + } + } +} diff --git a/src/test/java/org/apache/fop/intermediate/IFTestCase.java b/src/test/java/org/apache/fop/intermediate/IFTestCase.java new file mode 100644 index 000000000..562302ba4 --- /dev/null +++ b/src/test/java/org/apache/fop/intermediate/IFTestCase.java @@ -0,0 +1,116 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.intermediate; + +import java.io.File; +import java.io.FilenameFilter; +import java.io.IOException; +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.Collection; + +import javax.xml.transform.Source; +import javax.xml.transform.TransformerFactory; + +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; + + +/** + * Test case for the IF output. + */ +@RunWith(Parameterized.class) +public class IFTestCase extends AbstractIFTest { + + /** + * Gets the files for this test. + * + * @return a collection of file arrays containing the files to test + * @throws IOException if an error occurs when reading the test files + */ + @Parameters + public static Collection<File[]> getParameters() throws IOException { + File testDir = new File("test/intermediate"); + String[] tests = testDir.list(new FilenameFilter() { + + public boolean accept(File dir, String name) { + return name.endsWith(".xml"); + } + }); + + Collection<File[]> parameters = new ArrayList<File[]>(); + for (String test : tests) { + parameters.add(new File[] { new File(testDir, test) }); + } + return parameters; + } + + private static IFTester ifTester; + + @BeforeClass + public static void setupTestEnvironment() { + File backupDir = new File("build/test-results/intermediate"); + backupDir.mkdirs(); + ifTester = new IFTester(TransformerFactory.newInstance(), backupDir); + } + + /** + * Creates a new test case. + * + * @param test the file containing the test case + * @param ifTester the helper instance that will perform checks + * @throws IOException if an I/O error occurs while loading the test case + */ + public IFTestCase(File test) throws IOException { + super(test); + this.testDir = test.getParentFile(); + } + + @Override + @Test + public void runTest() throws Exception { + Element testRoot = testAssistant.getTestRoot(testFile); + NodeList nodes = testRoot.getElementsByTagName("if-checks"); + if (nodes.getLength() == 0) { + throw new RuntimeException("No IF check found"); + } + Element ifChecks = (Element) nodes.item(0); + + Document doc = buildIntermediateDocument(testAssistant.getTestcase2FOStylesheet()); + ifTester.doIFChecks(testFile.getName(), ifChecks, doc); + } + + @Override + protected void parseAndRender(Source src, OutputStream out) throws Exception { + throw new IllegalStateException("Not applicable to this test"); + } + + @Override + protected Document parseAndRenderToIntermediateFormat(Source src) throws Exception { + throw new IllegalStateException("Not applicable to this test"); + } + +} diff --git a/src/test/java/org/apache/fop/intermediate/IFTester.java b/src/test/java/org/apache/fop/intermediate/IFTester.java new file mode 100644 index 000000000..46303d874 --- /dev/null +++ b/src/test/java/org/apache/fop/intermediate/IFTester.java @@ -0,0 +1,84 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.intermediate; + +import java.io.File; +import java.util.List; + +import javax.xml.transform.Result; +import javax.xml.transform.Source; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +/** + * Does tests on the intermediate format. + */ +public class IFTester { + + private final IFChecksFactory ifChecksFactory = new IFChecksFactory(); + + private final TransformerFactory tfactory; + + private File backupDir; + + /** + * Main constructor. + * + * @param transformerFactory the factory used to serialize the intermediate format files + * @param backupDir an optional directory in which to write the serialized + * IF files (may be null) + */ + public IFTester(TransformerFactory transformerFactory, File backupDir) { + this.tfactory = transformerFactory; + this.backupDir = backupDir; + } + + /** + * Runs the intermediate format checks. + * @param testName the name of the test case + * @param checksRoot the root element containing the IF checks + * @param ifDocument the IF XML + * @throws TransformerException if an error occurs while transforming the content + */ + public void doIFChecks(String testName, Element checksRoot, Document ifDocument) + throws TransformerException { + if (this.backupDir != null) { + Transformer transformer = tfactory.newTransformer(); + Source src = new DOMSource(ifDocument); + File targetFile = new File(this.backupDir, testName + ".if.xml"); + Result res = new StreamResult(targetFile); + transformer.transform(src, res); + } + List<IFCheck> checks = ifChecksFactory.createCheckList(checksRoot); + if (checks.size() == 0) { + throw new RuntimeException("No available IF check"); + } + for (IFCheck check : checks) { + check.check(ifDocument); + } + } + +} diff --git a/src/test/java/org/apache/fop/intermediate/IntermediateFormatTestSuite.java b/src/test/java/org/apache/fop/intermediate/IntermediateFormatTestSuite.java new file mode 100644 index 000000000..71b26cb9b --- /dev/null +++ b/src/test/java/org/apache/fop/intermediate/IntermediateFormatTestSuite.java @@ -0,0 +1,32 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.intermediate; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +/** + * A test suite for testing the Intermediate Format output. + */ +@RunWith(Suite.class) +@SuiteClasses(IFTestCase.class) +public final class IntermediateFormatTestSuite { +} diff --git a/src/test/java/org/apache/fop/intermediate/LayoutIFTestSuite.java b/src/test/java/org/apache/fop/intermediate/LayoutIFTestSuite.java new file mode 100644 index 000000000..ea60f2ff4 --- /dev/null +++ b/src/test/java/org/apache/fop/intermediate/LayoutIFTestSuite.java @@ -0,0 +1,32 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.intermediate; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +/** + * JUnit test suite for the intermediate format + */ +@RunWith(Suite.class) +@SuiteClasses(IFParserTestCase.class) +public final class LayoutIFTestSuite { +} diff --git a/src/test/java/org/apache/fop/intermediate/TestAssistant.java b/src/test/java/org/apache/fop/intermediate/TestAssistant.java new file mode 100644 index 000000000..d13f88959 --- /dev/null +++ b/src/test/java/org/apache/fop/intermediate/TestAssistant.java @@ -0,0 +1,184 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.intermediate; + +import java.io.File; +import java.io.IOException; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.transform.Result; +import javax.xml.transform.Source; +import javax.xml.transform.Templates; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.TransformerException; +import javax.xml.transform.dom.DOMResult; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.sax.SAXTransformerFactory; +import javax.xml.transform.stream.StreamResult; +import javax.xml.transform.stream.StreamSource; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +import org.apache.xpath.XPathAPI; +import org.apache.xpath.objects.XObject; + +import org.apache.fop.apps.EnvironmentProfile; +import org.apache.fop.apps.EnvironmentalProfileFactory; +import org.apache.fop.apps.FopFactory; +import org.apache.fop.apps.FopFactoryBuilder; +import org.apache.fop.apps.io.ResourceResolverFactory; + +/** + * Helper class for running FOP tests. + */ +public class TestAssistant { + + // configure fopFactory as desired + protected final File testDir = new File("test/layoutengine/standard-testcases"); + + private SAXTransformerFactory tfactory = (SAXTransformerFactory) SAXTransformerFactory.newInstance(); + + private DocumentBuilderFactory domBuilderFactory; + + private Templates testcase2fo; + private Templates testcase2checks; + + /** + * Main constructor. + */ + public TestAssistant() { + domBuilderFactory = DocumentBuilderFactory.newInstance(); + domBuilderFactory.setNamespaceAware(true); + domBuilderFactory.setValidating(false); + } + + /** + * Returns the stylesheet for convert extracting the XSL-FO part from the test case. + * @return the stylesheet + * @throws TransformerConfigurationException if an error occurs loading the stylesheet + */ + public Templates getTestcase2FOStylesheet() throws TransformerConfigurationException { + if (testcase2fo == null) { + //Load and cache stylesheet + Source src = new StreamSource(new File("test/layoutengine/testcase2fo.xsl")); + testcase2fo = tfactory.newTemplates(src); + } + return testcase2fo; + } + + /** + * Returns the stylesheet for convert extracting the checks from the test case. + * @return the stylesheet + * @throws TransformerConfigurationException if an error occurs loading the stylesheet + */ + private Templates getTestcase2ChecksStylesheet() throws TransformerConfigurationException { + if (testcase2checks == null) { + //Load and cache stylesheet + Source src = new StreamSource(new File("test/layoutengine/testcase2checks.xsl")); + testcase2checks = tfactory.newTemplates(src); + } + return testcase2checks; + } + + /** + * Returns the element from the given XML file that encloses the tests. + * + * @param testFile a test case + * @return the parent element of the group(s) of checks + * @throws TransformerException if an error occurs while extracting the test element + */ + public Element getTestRoot(File testFile) throws TransformerException { + Transformer transformer = getTestcase2ChecksStylesheet().newTransformer(); + DOMResult res = new DOMResult(); + transformer.transform(new StreamSource(testFile), res); + Document doc = (Document) res.getNode(); + return doc.getDocumentElement(); + } + + public FopFactory getFopFactory(Document testDoc) { + EnvironmentProfile envProfile = EnvironmentalProfileFactory.createRestrictedIO( + testDir.getParentFile().toURI(), + ResourceResolverFactory.createDefaultResourceResolver()); + FopFactoryBuilder builder = new FopFactoryBuilder(envProfile); + builder.setStrictFOValidation(isStrictValidation(testDoc)); + builder.getFontManager().setBase14KerningEnabled(isBase14KerningEnabled(testDoc)); + return builder.build(); + } + + private boolean isBase14KerningEnabled(Document testDoc) { + try { + XObject xo = XPathAPI.eval(testDoc, "/testcase/cfg/base14kerning"); + String s = xo.str(); + return ("true".equalsIgnoreCase(s)); + } catch (TransformerException e) { + throw new RuntimeException("Error while evaluating XPath expression", e); + } + } + + private boolean isStrictValidation(Document testDoc) { + try { + XObject xo = XPathAPI.eval(testDoc, "/testcase/cfg/strict-validation"); + return !("false".equalsIgnoreCase(xo.str())); + } catch (TransformerException e) { + throw new RuntimeException("Error while evaluating XPath expression", e); + } + } + + /** + * Loads a test case into a DOM document. + * @param testFile the test file + * @return the loaded test case + * @throws IOException if an I/O error occurs loading the test case + */ + public Document loadTestCase(File testFile) + throws IOException { + try { + DocumentBuilder builder = domBuilderFactory.newDocumentBuilder(); + Document testDoc = builder.parse(testFile); + return testDoc; + } catch (Exception e) { + throw new IOException("Error while loading test case: " + e.getMessage()); + } + } + + /** + * Serialize the DOM for later inspection. + * @param doc the DOM document + * @param target target file + * @throws TransformerException if a problem occurs during serialization + */ + public void saveDOM(Document doc, File target) throws TransformerException { + Transformer transformer = getTransformerFactory().newTransformer(); + Source src = new DOMSource(doc); + Result res = new StreamResult(target); + transformer.transform(src, res); + } + + /** + * Returns the SAXTransformerFactory. + * @return the SAXTransformerFactory + */ + public SAXTransformerFactory getTransformerFactory() { + return tfactory; + } +} diff --git a/src/test/java/org/apache/fop/layoutengine/ElementListCheck.java b/src/test/java/org/apache/fop/layoutengine/ElementListCheck.java new file mode 100644 index 000000000..4ac29b4cd --- /dev/null +++ b/src/test/java/org/apache/fop/layoutengine/ElementListCheck.java @@ -0,0 +1,279 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.layoutengine; + +import java.util.Iterator; +import java.util.List; + +import org.w3c.dom.CDATASection; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.w3c.dom.Text; + +import org.apache.fop.layoutmgr.KnuthBox; +import org.apache.fop.layoutmgr.KnuthGlue; +import org.apache.fop.layoutmgr.KnuthPenalty; +import org.apache.fop.layoutmgr.ListElement; + +/** + * Check implementation that checks a Knuth element list. + */ +public class ElementListCheck implements LayoutEngineCheck { + + private String category; + private String id; + private int index = -1; + private Element checkElement; + + /** + * Creates a new instance from a DOM node. + * @param node DOM node that defines this check + */ + public ElementListCheck(Node node) { + this.category = node.getAttributes().getNamedItem("category").getNodeValue(); + if (node.getAttributes().getNamedItem("id") != null) { + this.id = node.getAttributes().getNamedItem("id").getNodeValue(); + } + if (!haveID()) { + if (node.getAttributes().getNamedItem("index") != null) { + String s = node.getAttributes().getNamedItem("index").getNodeValue(); + this.index = Integer.parseInt(s); + } + } + this.checkElement = (Element)node; + } + + /** + * @see org.apache.fop.layoutengine.LayoutEngineCheck + */ + public void check(LayoutResult result) { + ElementListCollector.ElementList elementList = findElementList(result); + NodeList children = checkElement.getChildNodes(); + int pos = -1; + for (int i = 0; i < children.getLength(); i++) { + Node node = children.item(i); + if (node instanceof Element) { + pos++; + Element domEl = (Element)node; + ListElement knuthEl = (ListElement) elementList.getElementList().get(pos); + if ("skip".equals(domEl.getLocalName())) { + pos += Integer.parseInt(getElementText(domEl)) - 1; + } else if ("box".equals(domEl.getLocalName())) { + if (!(knuthEl instanceof KnuthBox)) { + fail("Expected KnuthBox" + + " at position " + pos + + " but got: " + knuthEl.getClass().getName()); + } + KnuthBox box = (KnuthBox) knuthEl; + if (domEl.getAttribute("w").length() > 0) { + int w = Integer.parseInt(domEl.getAttribute("w")); + if (w != box.getWidth()) { + fail("Expected w=" + w + + " at position " + pos + + " but got: " + box.getWidth()); + } + } + if ("true".equals(domEl.getAttribute("aux"))) { + if (!box.isAuxiliary()) { + fail("Expected auxiliary box" + + " at position " + pos); + } + } + if ("false".equals(domEl.getAttribute("aux"))) { + if (box.isAuxiliary()) { + fail("Expected a normal, not an auxiliary box" + + " at position " + pos); + } + } + } else if ("penalty".equals(domEl.getLocalName())) { + if (!(knuthEl instanceof KnuthPenalty)) { + fail("Expected KnuthPenalty " + + " at position " + pos + + " but got: " + knuthEl.getClass().getName()); + } + KnuthPenalty pen = (KnuthPenalty)knuthEl; + if (domEl.getAttribute("w").length() > 0) { + int w = Integer.parseInt(domEl.getAttribute("w")); + if (w != pen.getWidth()) { + fail("Expected w=" + w + + " at position " + pos + + " but got: " + pen.getWidth()); + } + } + if (domEl.getAttribute("p").length() > 0) { + if ("<0".equals(domEl.getAttribute("p"))) { + if (pen.getPenalty() >= 0) { + fail("Expected p<0" + + " at position " + pos + + " but got: " + pen.getPenalty()); + } + } else if (">0".equals(domEl.getAttribute("p"))) { + if (pen.getPenalty() <= 0) { + fail("Expected p>0" + + " at position " + pos + + " but got: " + pen.getPenalty()); + } + } else { + int p; + if ("INF".equalsIgnoreCase(domEl.getAttribute("p"))) { + p = KnuthPenalty.INFINITE; + } else if ("INFINITE".equalsIgnoreCase(domEl.getAttribute("p"))) { + p = KnuthPenalty.INFINITE; + } else if ("-INF".equalsIgnoreCase(domEl.getAttribute("p"))) { + p = -KnuthPenalty.INFINITE; + } else if ("-INFINITE".equalsIgnoreCase(domEl.getAttribute("p"))) { + p = -KnuthPenalty.INFINITE; + } else { + p = Integer.parseInt(domEl.getAttribute("p")); + } + if (p != pen.getPenalty()) { + fail("Expected p=" + p + + " at position " + pos + + " but got: " + pen.getPenalty()); + } + } + } + if ("true".equals(domEl.getAttribute("flagged"))) { + if (!pen.isPenaltyFlagged()) { + fail("Expected flagged penalty" + + " at position " + pos); + } + } else if ("false".equals(domEl.getAttribute("flagged"))) { + if (pen.isPenaltyFlagged()) { + fail("Expected non-flagged penalty" + + " at position " + pos); + } + } + if ("true".equals(domEl.getAttribute("aux"))) { + if (!pen.isAuxiliary()) { + fail("Expected auxiliary penalty" + + " at position " + pos); + } + } else if ("false".equals(domEl.getAttribute("aux"))) { + if (pen.isAuxiliary()) { + fail("Expected non-auxiliary penalty" + + " at position " + pos); + } + } + } else if ("glue".equals(domEl.getLocalName())) { + if (!(knuthEl instanceof KnuthGlue)) { + fail("Expected KnuthGlue" + + " at position " + pos + + " but got: " + knuthEl.getClass().getName()); + } + KnuthGlue glue = (KnuthGlue)knuthEl; + if (domEl.getAttribute("w").length() > 0) { + int w = Integer.parseInt(domEl.getAttribute("w")); + if (w != glue.getWidth()) { + fail("Expected w=" + w + + " at position " + pos + + " but got: " + glue.getWidth()); + } + } + if (domEl.getAttribute("y").length() > 0) { + int stretch = Integer.parseInt(domEl.getAttribute("y")); + if (stretch != glue.getStretch()) { + fail("Expected y=" + stretch + + " (stretch) at position " + pos + + " but got: " + glue.getStretch()); + } + } + if (domEl.getAttribute("z").length() > 0) { + int shrink = Integer.parseInt(domEl.getAttribute("z")); + if (shrink != glue.getShrink()) { + fail("Expected z=" + shrink + + " (shrink) at position " + pos + + " but got: " + glue.getShrink()); + } + } + } else { + throw new IllegalArgumentException("Invalid child node for 'element-list': " + + domEl.getLocalName() + + " at position " + pos + " (" + this + ")"); + } + + } + } + pos++; + if (elementList.getElementList().size() > pos) { + fail("There are " + + (elementList.getElementList().size() - pos) + + " unchecked elements at the end of the list"); + } + } + + private void fail(String msg) { + throw new AssertionError(msg + " (" + this + ")"); + } + + private boolean haveID() { + return (this.id != null && this.id.length() > 0); + } + + private ElementListCollector.ElementList findElementList(LayoutResult result) { + List candidates = new java.util.ArrayList(); + Iterator iter = result.getElementListCollector().getElementLists().iterator(); + while (iter.hasNext()) { + ElementListCollector.ElementList el = (ElementListCollector.ElementList)iter.next(); + if (el.getCategory().equals(category)) { + if (haveID() && this.id.equals(el.getID())) { + candidates.add(el); + break; + } else if (!haveID()) { + candidates.add(el); + } + } + } + if (candidates.size() == 0) { + throw new ArrayIndexOutOfBoundsException("Requested element list not found"); + } else if (index >= 0) { + return (ElementListCollector.ElementList)candidates.get(index); + } else { + return (ElementListCollector.ElementList)candidates.get(0); + } + } + + private static String getElementText(Element el) { + StringBuffer sb = new StringBuffer(); + NodeList children = el.getChildNodes(); + for (int i = 0; i < children.getLength(); i++) { + Node node = children.item(i); + if (node instanceof Text) { + sb.append(((Text)node).getData()); + } else if (node instanceof CDATASection) { + sb.append(((CDATASection)node).getData()); + } + } + return sb.toString(); + } + + /** @see java.lang.Object#toString() */ + public String toString() { + StringBuffer sb = new StringBuffer("element-list"); + sb.append(" category=").append(category); + if (haveID()) { + sb.append(" id=").append(id); + } else if (index >= 0) { + sb.append(" index=").append(index); + } + return sb.toString(); + } +} diff --git a/src/test/java/org/apache/fop/layoutengine/ElementListCollector.java b/src/test/java/org/apache/fop/layoutengine/ElementListCollector.java new file mode 100644 index 000000000..1890ee86f --- /dev/null +++ b/src/test/java/org/apache/fop/layoutengine/ElementListCollector.java @@ -0,0 +1,90 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.layoutengine; + +import java.util.List; + +import org.apache.fop.layoutmgr.ElementListObserver.Observer; + +/** + * This class collects element list generated during a FOP processing run. These lists are later + * used to perform automated checks. + */ +public class ElementListCollector implements Observer { + + private List elementLists = new java.util.ArrayList(); + + /** + * Resets the collector. + */ + public void reset() { + elementLists.clear(); + } + + /** + * @return the list of ElementList instances. + */ + public List getElementLists() { + return this.elementLists; + } + + /** @see org.apache.fop.layoutmgr.ElementListObserver.Observer */ + public void observe(List elementList, String category, String id) { + elementLists.add(new ElementList(elementList, category, id)); + } + + /** + * Data object representing an element list along with additional information. + */ + public static class ElementList { + + private List elementList; + private String category; + private String id; + + /** + * Creates a new ElementList instance + * @param elementList the element list + * @param category the category for the element list + * @param id an optional ID + */ + public ElementList(List elementList, String category, String id) { + this.elementList = elementList; + this.category = category; + this.id = id; + } + + /** @return the element list */ + public List getElementList() { + return elementList; + } + + /** @return the category */ + public String getCategory() { + return category; + } + + /** @return the ID, may be null */ + public String getID() { + return id; + } + } + +} diff --git a/src/test/java/org/apache/fop/layoutengine/EvalCheck.java b/src/test/java/org/apache/fop/layoutengine/EvalCheck.java new file mode 100644 index 000000000..2af8884dd --- /dev/null +++ b/src/test/java/org/apache/fop/layoutengine/EvalCheck.java @@ -0,0 +1,98 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.layoutengine; + +import javax.xml.transform.TransformerException; + +import org.w3c.dom.Document; +import org.w3c.dom.Node; + +import org.apache.xml.utils.PrefixResolver; +import org.apache.xml.utils.PrefixResolverDefault; +import org.apache.xpath.XPathAPI; +import org.apache.xpath.objects.XObject; + +import org.apache.fop.intermediate.IFCheck; + +/** + * Simple check that requires an XPath expression to evaluate to true. + */ +public class EvalCheck implements LayoutEngineCheck, IFCheck { + + private String expected; + private String xpath; + private double tolerance; + private PrefixResolver prefixResolver; + + /** + * Creates a new instance from a DOM node. + * @param node DOM node that defines this check + */ + public EvalCheck(Node node) { + this.expected = node.getAttributes().getNamedItem("expected").getNodeValue(); + this.xpath = node.getAttributes().getNamedItem("xpath").getNodeValue(); + Node nd = node.getAttributes().getNamedItem("tolerance"); + if (nd != null) { + this.tolerance = Double.parseDouble(nd.getNodeValue()); + } + this.prefixResolver = new PrefixResolverDefault(node); + } + + /** {@inheritDoc} */ + public void check(LayoutResult result) { + doCheck(result.getAreaTree()); + } + + /** {@inheritDoc} */ + public void check(Document intermediate) { + doCheck(intermediate); + } + + private void doCheck(Document doc) { + XObject res; + try { + res = XPathAPI.eval(doc, xpath, prefixResolver); + } catch (TransformerException e) { + throw new RuntimeException("XPath evaluation failed: " + e.getMessage()); + } + String actual = res.str(); //Second str() seems to fail. D'oh! + if (tolerance != 0) { + double v1 = Double.parseDouble(expected); + double v2 = Double.parseDouble(actual); + if (Math.abs(v1 - v2) > tolerance) { + throw new AssertionError( + "Expected XPath expression to evaluate to '" + expected + "', but got '" + + actual + "' (" + this + ", outside tolerance)"); + } + } else { + if (!expected.equals(actual)) { + throw new AssertionError( + "Expected XPath expression to evaluate to '" + expected + "', but got '" + + actual + "' (" + this + ")"); + } + } + } + + /** {@inheritDoc} */ + public String toString() { + return "XPath: " + xpath; + } + +} diff --git a/src/test/java/org/apache/fop/layoutengine/HyphenationLayoutTestCase.java b/src/test/java/org/apache/fop/layoutengine/HyphenationLayoutTestCase.java new file mode 100644 index 000000000..6b5ebbf71 --- /dev/null +++ b/src/test/java/org/apache/fop/layoutengine/HyphenationLayoutTestCase.java @@ -0,0 +1,53 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.layoutengine; + +import java.io.File; +import java.io.IOException; +import java.util.Collection; + +import org.junit.runners.Parameterized.Parameters; + +/** + * Class for testing the FOP's hyphenation layout engine using testcases specified in XML + * files. + */ +public class HyphenationLayoutTestCase extends LayoutEngineTestCase { + + /** + * Creates the parameters for this test. + * + * @return the list of file arrays populated with test files + * @throws IOException if an I/O error occurs while reading the test file + */ + @Parameters + public static Collection<File[]> getParameters() throws IOException { + return LayoutEngineTestUtils.getLayoutTestFiles("hyphenation-testcases"); + } + + /** + * Constructor + * @param testFile the file to test + */ + public HyphenationLayoutTestCase(File testFile) { + super(testFile); + } + +} diff --git a/src/test/java/org/apache/fop/layoutengine/LayoutEngineCheck.java b/src/test/java/org/apache/fop/layoutengine/LayoutEngineCheck.java new file mode 100644 index 000000000..ca979efe5 --- /dev/null +++ b/src/test/java/org/apache/fop/layoutengine/LayoutEngineCheck.java @@ -0,0 +1,35 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.layoutengine; + +import org.apache.fop.check.Check; + +/** + * Defines the interface for check operations. + */ +public interface LayoutEngineCheck extends Check { + + /** + * Called to perform the check. + * @param result the results from the processing run + */ + void check(LayoutResult result); + +} diff --git a/src/test/java/org/apache/fop/layoutengine/LayoutEngineChecksFactory.java b/src/test/java/org/apache/fop/layoutengine/LayoutEngineChecksFactory.java new file mode 100644 index 000000000..9883a9a74 --- /dev/null +++ b/src/test/java/org/apache/fop/layoutengine/LayoutEngineChecksFactory.java @@ -0,0 +1,62 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.layoutengine; + +import org.w3c.dom.Element; + +import org.apache.fop.check.ChecksFactory; + +/** + * A factory class for creating {@link LayoutEngineCheck} instances. + */ +public final class LayoutEngineChecksFactory extends ChecksFactory<LayoutEngineCheck> { + + public LayoutEngineChecksFactory() { + registerCheckFactory("true", new CheckFactory<LayoutEngineCheck>() { + + public LayoutEngineCheck createCheck(Element element) { + return new TrueCheck(element); + } + + }); + registerCheckFactory("eval", new CheckFactory<LayoutEngineCheck>() { + + public LayoutEngineCheck createCheck(Element element) { + return new EvalCheck(element); + } + + }); + registerCheckFactory("element-list", new CheckFactory<LayoutEngineCheck>() { + + public LayoutEngineCheck createCheck(Element element) { + return new ElementListCheck(element); + } + + }); + registerCheckFactory("result", new CheckFactory<LayoutEngineCheck>() { + + public LayoutEngineCheck createCheck(Element element) { + return new ResultCheck(element); + } + + }); + } + +} diff --git a/src/test/java/org/apache/fop/layoutengine/LayoutEngineTestCase.java b/src/test/java/org/apache/fop/layoutengine/LayoutEngineTestCase.java new file mode 100644 index 000000000..57607e475 --- /dev/null +++ b/src/test/java/org/apache/fop/layoutengine/LayoutEngineTestCase.java @@ -0,0 +1,360 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.layoutengine; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.Source; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMResult; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.sax.SAXResult; +import javax.xml.transform.sax.TransformerHandler; + +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.ContentHandler; +import org.xml.sax.SAXException; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import org.apache.fop.DebugHelper; +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.apps.Fop; +import org.apache.fop.apps.FopFactory; +import org.apache.fop.apps.FormattingResults; +import org.apache.fop.area.AreaTreeModel; +import org.apache.fop.area.AreaTreeParser; +import org.apache.fop.area.RenderPagesModel; +import org.apache.fop.events.Event; +import org.apache.fop.events.EventListener; +import org.apache.fop.events.model.EventSeverity; +import org.apache.fop.fonts.FontInfo; +import org.apache.fop.intermediate.IFTester; +import org.apache.fop.intermediate.TestAssistant; +import org.apache.fop.layoutmgr.ElementListObserver; +import org.apache.fop.render.intermediate.IFContext; +import org.apache.fop.render.intermediate.IFRenderer; +import org.apache.fop.render.intermediate.IFSerializer; +import org.apache.fop.render.xml.XMLRenderer; +import org.apache.fop.util.ConsoleEventListenerForTests; +import org.apache.fop.util.DelegatingContentHandler; + +/** + * Class for testing the FOP's layout engine using testcases specified in XML + * files. + */ +@RunWith(Parameterized.class) +public class LayoutEngineTestCase { + private static File areaTreeBackupDir; + + @BeforeClass + public static void makeDirAndRegisterDebugHelper() throws IOException { + DebugHelper.registerStandardElementListObservers(); + areaTreeBackupDir = new File("build/test-results/layoutengine"); + if (!areaTreeBackupDir.mkdirs() && !areaTreeBackupDir.exists()) { + throw new IOException("Failed to create the layout engine directory at " + + "build/test-results/layoutengine"); + } + } + + /** + * Creates the parameters for this test. + * + * @return the list of file arrays populated with test files + * @throws IOException if an I/O error occurs while reading the test file + */ + @Parameters + public static Collection<File[]> getParameters() throws IOException { + return LayoutEngineTestUtils.getLayoutTestFiles(); + } + + private TestAssistant testAssistant = new TestAssistant(); + + private LayoutEngineChecksFactory layoutEngineChecksFactory = new LayoutEngineChecksFactory(); + + private IFTester ifTester; + private File testFile; + + private TransformerFactory tfactory = TransformerFactory.newInstance(); + + /** + * Constructs a new instance. + * + * @param testFile the test file + */ + public LayoutEngineTestCase(File testFile) { + this.ifTester = new IFTester(tfactory, areaTreeBackupDir); + this.testFile = testFile; + } + + /** + * Runs a single layout engine test case. + * @throws TransformerException In case of an XSLT/JAXP problem + * @throws IOException In case of an I/O problem + * @throws SAXException In case of a problem during SAX processing + * @throws ParserConfigurationException In case of a problem with the XML parser setup + */ + @Test + public void runTest() throws TransformerException, SAXException, IOException, + ParserConfigurationException { + + DOMResult domres = new DOMResult(); + + ElementListCollector elCollector = new ElementListCollector(); + ElementListObserver.addObserver(elCollector); + + Fop fop; + FopFactory effFactory; + EventsChecker eventsChecker = new EventsChecker( + new ConsoleEventListenerForTests(testFile.getName(), EventSeverity.WARN)); + try { + Document testDoc = testAssistant.loadTestCase(testFile); + effFactory = testAssistant.getFopFactory(testDoc); + + //Setup Transformer to convert the testcase XML to XSL-FO + Transformer transformer = testAssistant.getTestcase2FOStylesheet().newTransformer(); + Source src = new DOMSource(testDoc); + + //Setup Transformer to convert the area tree to a DOM + TransformerHandler athandler; + athandler = testAssistant.getTransformerFactory().newTransformerHandler(); + athandler.setResult(domres); + + //Setup FOP for area tree rendering + FOUserAgent ua = effFactory.newFOUserAgent(); + ua.getEventBroadcaster().addEventListener(eventsChecker); + + XMLRenderer atrenderer = new XMLRenderer(ua); + atrenderer.setContentHandler(athandler); + ua.setRendererOverride(atrenderer); + fop = effFactory.newFop(ua); + + SAXResult fores = new SAXResult(fop.getDefaultHandler()); + transformer.transform(src, fores); + } finally { + ElementListObserver.removeObserver(elCollector); + } + + Document doc = (Document)domres.getNode(); + if (areaTreeBackupDir != null) { + testAssistant.saveDOM(doc, + new File(areaTreeBackupDir, testFile.getName() + ".at.xml")); + } + FormattingResults results = fop.getResults(); + LayoutResult result = new LayoutResult(doc, elCollector, results); + checkAll(effFactory, testFile, result, eventsChecker); + } + + private static class EventsChecker implements EventListener { + + private final List<Event> events = new ArrayList<Event>(); + + private final EventListener defaultListener; + + /** + * @param fallbackListener the listener to which this class will pass through + * events that are not being checked + */ + public EventsChecker(EventListener fallbackListener) { + this.defaultListener = fallbackListener; + } + + public void processEvent(Event event) { + events.add(event); + } + + public void checkEvent(String expectedKey, Map<String, String> expectedParams) { + boolean eventFound = false; + for (Iterator<Event> iter = events.iterator(); !eventFound && iter.hasNext();) { + Event event = iter.next(); + if (event.getEventKey().equals(expectedKey)) { + eventFound = true; + iter.remove(); + checkParameters(event, expectedParams); + } + } + if (!eventFound) { + fail("Event did not occur but was expected to: " + expectedKey + expectedParams); + } + } + + private void checkParameters(Event event, Map<String, String> expectedParams) { + Map<String, Object> actualParams = event.getParams(); + for (Map.Entry<String, String> expectedParam : expectedParams.entrySet()) { + assertTrue("Event \"" + event.getEventKey() + + "\" is missing parameter \"" + expectedParam.getKey() + '"', + actualParams.containsKey(expectedParam.getKey())); + assertEquals("Event \"" + event.getEventKey() + + "\" has wrong value for parameter \"" + expectedParam.getKey() + "\";", + actualParams.get(expectedParam.getKey()).toString(), + expectedParam.getValue()); + } + } + + public void emitUncheckedEvents() { + for (Event event : events) { + defaultListener.processEvent(event); + } + } + } + + /** + * Perform all checks on the area tree and, optionally, on the intermediate format. + * @param fopFactory the FOP factory + * @param testFile Test case XML file + * @param result The layout results + * @throws TransformerException if a problem occurs in XSLT/JAXP + */ + protected void checkAll(FopFactory fopFactory, File testFile, LayoutResult result, + EventsChecker eventsChecker) throws TransformerException { + Element testRoot = testAssistant.getTestRoot(testFile); + + NodeList nodes; + //AT tests only when checks are available + nodes = testRoot.getElementsByTagName("at-checks"); + if (nodes.getLength() > 0) { + Element atChecks = (Element)nodes.item(0); + doATChecks(atChecks, result); + } + + //IF tests only when checks are available + nodes = testRoot.getElementsByTagName("if-checks"); + if (nodes.getLength() > 0) { + Element ifChecks = (Element)nodes.item(0); + Document ifDocument = createIF(fopFactory, testFile, result.getAreaTree()); + ifTester.doIFChecks(testFile.getName(), ifChecks, ifDocument); + } + + nodes = testRoot.getElementsByTagName("event-checks"); + if (nodes.getLength() > 0) { + Element eventChecks = (Element) nodes.item(0); + doEventChecks(eventChecks, eventsChecker); + } + eventsChecker.emitUncheckedEvents(); + } + + private Document createIF(FopFactory fopFactory, File testFile, Document areaTreeXML) + throws TransformerException { + try { + FOUserAgent ua = fopFactory.newFOUserAgent(); + ua.getEventBroadcaster().addEventListener( + new ConsoleEventListenerForTests(testFile.getName(), EventSeverity.WARN)); + + IFRenderer ifRenderer = new IFRenderer(ua); + + IFSerializer serializer = new IFSerializer(new IFContext(ua)); + DOMResult result = new DOMResult(); + serializer.setResult(result); + ifRenderer.setDocumentHandler(serializer); + + ua.setRendererOverride(ifRenderer); + FontInfo fontInfo = new FontInfo(); + //Construct the AreaTreeModel that will received the individual pages + final AreaTreeModel treeModel = new RenderPagesModel(ua, + null, fontInfo, null); + + //Iterate over all intermediate files + AreaTreeParser parser = new AreaTreeParser(); + ContentHandler handler = parser.getContentHandler(treeModel, ua); + + DelegatingContentHandler proxy = new DelegatingContentHandler() { + + public void endDocument() throws SAXException { + super.endDocument(); + //Signal the end of the processing. + //The renderer can finalize the target document. + treeModel.endDocument(); + } + + }; + proxy.setDelegateContentHandler(handler); + + Transformer transformer = tfactory.newTransformer(); + transformer.transform(new DOMSource(areaTreeXML), new SAXResult(proxy)); + + return (Document)result.getNode(); + } catch (Exception e) { + throw new TransformerException( + "Error while generating intermediate format file: " + e.getMessage(), e); + } + } + + private void doATChecks(Element checksRoot, LayoutResult result) { + List<LayoutEngineCheck> checks = layoutEngineChecksFactory.createCheckList(checksRoot); + if (checks.size() == 0) { + throw new RuntimeException("No available area tree check"); + } + for (LayoutEngineCheck check : checks) { + try { + check.check(result); + } catch (AssertionError ae) { + throw new AssertionError("Layout test (" + testFile.getName() + "): " + ae.getMessage()); + } catch (RuntimeException rte) { + throw new RuntimeException("Layout test (" + testFile.getName() + "): " + rte.getMessage()); + } + } + } + + private void doEventChecks(Element eventChecks, EventsChecker eventsChecker) { + NodeList events = eventChecks.getElementsByTagName("event"); + for (int i = 0; i < events.getLength(); i++) { + Element event = (Element) events.item(i); + NamedNodeMap attributes = event.getAttributes(); + Map<String, String> params = new HashMap<String, String>(); + String key = null; + for (int j = 0; j < attributes.getLength(); j++) { + Node attribute = attributes.item(j); + String name = attribute.getNodeName(); + String value = attribute.getNodeValue(); + if ("key".equals(name)) { + key = value; + } else { + params.put(name, value); + } + } + if (key == null) { + throw new RuntimeException("An event element must have a \"key\" attribute"); + } + eventsChecker.checkEvent(key, params); + } + } + +} diff --git a/src/test/java/org/apache/fop/layoutengine/LayoutEngineTestSuite.java b/src/test/java/org/apache/fop/layoutengine/LayoutEngineTestSuite.java new file mode 100644 index 000000000..89bf28a55 --- /dev/null +++ b/src/test/java/org/apache/fop/layoutengine/LayoutEngineTestSuite.java @@ -0,0 +1,32 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.layoutengine; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +/** + * JUnit test suit for running layout engine test under JUnit control. + */ +@RunWith(Suite.class) +@SuiteClasses(LayoutEngineTestCase.class) +public class LayoutEngineTestSuite { +} diff --git a/src/test/java/org/apache/fop/layoutengine/LayoutEngineTestUtils.java b/src/test/java/org/apache/fop/layoutengine/LayoutEngineTestUtils.java new file mode 100644 index 000000000..2649838f4 --- /dev/null +++ b/src/test/java/org/apache/fop/layoutengine/LayoutEngineTestUtils.java @@ -0,0 +1,210 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.layoutengine; + +import java.io.File; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import javax.xml.transform.Result; +import javax.xml.transform.Source; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.sax.SAXResult; +import javax.xml.transform.stream.StreamSource; + +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; +import org.xml.sax.helpers.DefaultHandler; + +import org.apache.commons.io.FileUtils; +import org.apache.commons.io.filefilter.AndFileFilter; +import org.apache.commons.io.filefilter.IOFileFilter; +import org.apache.commons.io.filefilter.NameFileFilter; +import org.apache.commons.io.filefilter.NotFileFilter; +import org.apache.commons.io.filefilter.PrefixFileFilter; +import org.apache.commons.io.filefilter.SuffixFileFilter; +import org.apache.commons.io.filefilter.TrueFileFilter; + +/** + * Utility class for layout engine tests. + */ +public final class LayoutEngineTestUtils { + + /** Set this to true to get the correspondence between test number and test file. */ + private static final boolean DEBUG = false; + + private LayoutEngineTestUtils() { + } + + private static class FilenameHandler extends DefaultHandler { + private StringBuffer buffer = new StringBuffer(128); + private boolean readingFilename; + private List<String> filenames; + + public FilenameHandler(List<String> filenames) { + this.filenames = filenames; + } + + public void startElement(String namespaceURI, String localName, String qName, + Attributes atts) throws SAXException { + if (qName != null && qName.equals("file")) { + buffer.setLength(0); + readingFilename = true; + } else { + throw new RuntimeException( + "Unexpected element while reading disabled testcase file names: " + qName); + } + } + + public void endElement(String namespaceURI, String localName, String qName) + throws SAXException { + if (qName != null && qName.equals("file")) { + readingFilename = false; + filenames.add(buffer.toString()); + } else { + throw new RuntimeException( + "Unexpected element while reading disabled testcase file names: " + qName); + } + } + + public void characters(char[] ch, int start, int length) throws SAXException { + if (readingFilename) { + buffer.append(ch, start, length); + } + } + } + + /** + * Removes from {@code filter} any tests that have been disabled. + * + * @param filter the filter populated with tests + * @param disabled name of the file containing disabled test cases. If null or empty, + * no file is read + * @return {@code filter} minus any disabled tests + */ + public static IOFileFilter decorateWithDisabledList(IOFileFilter filter, String disabled) { + if (disabled != null && disabled.length() > 0) { + filter = new AndFileFilter(new NotFileFilter(new NameFileFilter( + LayoutEngineTestUtils.readDisabledTestcases(new File(disabled)))), filter); + } + return filter; + } + + private static String[] readDisabledTestcases(File f) { + List<String> lines = new ArrayList<String>(); + Source stylesheet = new StreamSource( + new File("test/layoutengine/disabled-testcase2filename.xsl")); + Source source = new StreamSource(f); + Result result = new SAXResult(new FilenameHandler(lines)); + try { + Transformer transformer = TransformerFactory.newInstance().newTransformer(stylesheet); + transformer.transform(source, result); + } catch (TransformerConfigurationException tce) { + throw new RuntimeException(tce); + } catch (TransformerException te) { + throw new RuntimeException(te); + } + return (String[]) lines.toArray(new String[lines.size()]); + } + + /** + * Returns the test files matching the given configuration. + * + * @param testConfig the test configuration + * @return the applicable test cases + */ + public static Collection<File[]> getTestFiles(TestFilesConfiguration testConfig) { + File mainDir = testConfig.getTestDirectory(); + IOFileFilter filter; + String single = testConfig.getSingleTest(); + String startsWith = testConfig.getStartsWith(); + if (single != null) { + filter = new NameFileFilter(single); + } else if (startsWith != null) { + filter = new PrefixFileFilter(startsWith); + filter = new AndFileFilter(filter, new SuffixFileFilter(testConfig.getFileSuffix())); + filter = decorateWithDisabledList(filter, testConfig.getDisabledTests()); + } else { + filter = new SuffixFileFilter(testConfig.getFileSuffix()); + filter = decorateWithDisabledList(filter, testConfig.getDisabledTests()); + } + String testset = testConfig.getTestSet(); + + Collection<File> files = FileUtils.listFiles(new File(mainDir, testset), filter, + TrueFileFilter.INSTANCE); + if (testConfig.hasPrivateTests()) { + Collection<File> privateFiles = FileUtils.listFiles(new File(mainDir, + "private-testcases"), filter, TrueFileFilter.INSTANCE); + files.addAll(privateFiles); + } + + Collection<File[]> parametersForJUnit4 = new ArrayList<File[]>(); + int index = 0; + for (File f : files) { + parametersForJUnit4.add(new File[] {f}); + if (DEBUG) { + System.out.println(String.format("%3d %s", index++, f)); + } + } + + return parametersForJUnit4; + } + + /** + * This is a helper method that uses the standard parameters for FOP's layout engine tests and + * returns a set of test files. These pull in System parameters to configure the layout tests + * to run. + * + * @return A collection of file arrays that contain the test files + */ + public static Collection<File[]> getLayoutTestFiles() { + String testSet = System.getProperty("fop.layoutengine.testset"); + testSet = (testSet != null ? testSet : "standard") + "-testcases"; + return getLayoutTestFiles(testSet); + } + + /** + * This is a helper method that uses the standard parameters for FOP's layout engine tests, + * given a test set name returns a set of test files. + * + * @param testSetName the name of the test set + * @return A collection of file arrays that contain the test files + */ + public static Collection<File[]> getLayoutTestFiles(String testSetName) { + TestFilesConfiguration.Builder builder = new TestFilesConfiguration.Builder(); + + builder.testDir("test/layoutengine") + .singleProperty("fop.layoutengine.single") + .startsWithProperty("fop.layoutengine.starts-with") + .suffix(".xml") + .testSet(testSetName) + .disabledProperty("fop.layoutengine.disabled", + "test/layoutengine/disabled-testcases.xml") + .privateTestsProperty("fop.layoutengine.private"); + + TestFilesConfiguration testConfig = builder.build(); + return getTestFiles(testConfig); + } + +} diff --git a/src/test/java/org/apache/fop/layoutengine/LayoutResult.java b/src/test/java/org/apache/fop/layoutengine/LayoutResult.java new file mode 100644 index 000000000..92c459234 --- /dev/null +++ b/src/test/java/org/apache/fop/layoutengine/LayoutResult.java @@ -0,0 +1,65 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.layoutengine; + +import org.w3c.dom.Document; + +import org.apache.fop.apps.FormattingResults; + +/** + * This class holds references to all the results from the FOP processing run. + */ +public class LayoutResult { + + private Document areaTree; + private ElementListCollector elCollector; + private FormattingResults results; + + /** + * Creates a new LayoutResult instance. + * @param areaTree the area tree DOM + * @param elCollector the element list collector + * @param results the formatting results + */ + public LayoutResult(Document areaTree, ElementListCollector elCollector, + FormattingResults results) { + this.areaTree = areaTree; + this.elCollector = elCollector; + this.results = results; + } + + /** @return the generated area tree as DOM tree */ + public Document getAreaTree() { + return this.areaTree; + } + + /** @return the element list collector */ + public ElementListCollector getElementListCollector() { + return this.elCollector; + } + + /** + * @return Returns the results. + */ + public FormattingResults getResults() { + return results; + } + +} diff --git a/src/test/java/org/apache/fop/layoutengine/ResultCheck.java b/src/test/java/org/apache/fop/layoutengine/ResultCheck.java new file mode 100644 index 000000000..7289757fb --- /dev/null +++ b/src/test/java/org/apache/fop/layoutengine/ResultCheck.java @@ -0,0 +1,65 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.layoutengine; + +import org.w3c.dom.Node; + +import org.apache.fop.apps.FormattingResults; + +/** + * Simple check that requires a result property to evaluate to the expected value + */ +public class ResultCheck implements LayoutEngineCheck { + + private String expected; + private String property; + + /** + * Creates a new instance from a DOM node. + * @param node DOM node that defines this check + */ + public ResultCheck(Node node) { + this.expected = node.getAttributes().getNamedItem("expected").getNodeValue(); + this.property = node.getAttributes().getNamedItem("property").getNodeValue(); + } + + /** {@inheritDoc} */ + public void check(LayoutResult result) { + FormattingResults results = result.getResults(); + String actual; + if (property.equals("pagecount")) { + actual = Integer.toString(results.getPageCount()); + } else { + throw new RuntimeException("No such property test: " + property); + } + if (!expected.equals(actual)) { + throw new AssertionError( + "Expected property to evaluate to '" + expected + "', but got '" + + actual + "' (" + this + ")"); + } + + } + + @Override + public String toString() { + return "Property: " + property; + } + +} diff --git a/src/test/java/org/apache/fop/layoutengine/TestFilesConfiguration.java b/src/test/java/org/apache/fop/layoutengine/TestFilesConfiguration.java new file mode 100644 index 000000000..656fc5f6f --- /dev/null +++ b/src/test/java/org/apache/fop/layoutengine/TestFilesConfiguration.java @@ -0,0 +1,205 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.layoutengine; + +import java.io.File; + +/** + * A class that contains the information needed to run a suite of layout engine and FO tree + * tests. + */ +public final class TestFilesConfiguration { + + private final File testDirectory; + private final String singleTest; + private final String testStartsWith; + private final String testFileSuffix; + private final String testSet; + private final String disabledTests; + private final boolean privateTests; + + private TestFilesConfiguration(Builder builder) { + this.testDirectory = new File(builder.testDirectory); + this.singleTest = builder.singleTest; + this.testStartsWith = builder.testStartsWith; + this.testFileSuffix = builder.testFileSuffix; + this.testSet = builder.testSet; + this.privateTests = builder.privateTests; + this.disabledTests = builder.disabledTests; + } + + /** + * Returns the directory of the tests. + * @return the test directory + */ + public File getTestDirectory() { + return testDirectory; + } + + /** + * Returns the name of the single test file to run. + * @return the single test file name + */ + public String getSingleTest() { + return singleTest; + } + + /** + * Returns the string that must prefix the test file names. + * @return the prefixing string + */ + public String getStartsWith() { + return testStartsWith; + } + + /** + * Returns the file suffix (i.e. ".xml" for XML files and ".fo" for FOs). + * @return the file suffix + */ + public String getFileSuffix() { + return testFileSuffix; + } + + /** + * Returns the directory set of tests to be run. + * @return the directory tests + */ + public String getTestSet() { + return testSet; + } + + /** + * Returns the name of the XML file containing the disabled tests. + * @return a file name, may be null + */ + public String getDisabledTests() { + return disabledTests; + } + + /** + * Whether any private tests should be invoked. + * @return true if private tests should be tested + */ + public boolean hasPrivateTests() { + return privateTests; + } + + /** + * A builder class that configures the data for running a suite of tests designed for the + * layout engine and FOTree. + */ + public static class Builder { + + private String testDirectory; + private String singleTest; + private String testStartsWith; + private String testFileSuffix; + private String testSet; + private String disabledTests; + private boolean privateTests; + + /** + * Configures the test directory. + * @param dir the test directory + * @return {@code this} + */ + public Builder testDir(String dir) { + testDirectory = dir; + return this; + } + + /** + * Configures the name of the single test to run. + * @param singleProperty name of the property that determines the single test case + * @return {@code this} + */ + public Builder singleProperty(String singleProperty) { + singleTest = getSystemProperty(singleProperty); + return this; + } + + /** + * Configures the prefix that all test cases must match. + * @param startsWithProperty name of the property that determines the common prefix + * @return {@code this} + */ + public Builder startsWithProperty(String startsWithProperty) { + testStartsWith = getSystemProperty(startsWithProperty); + return this; + } + + /** + * Configures the test file name suffix. + * @param suffix the suffixing string + * @return {@code this} + */ + public Builder suffix(String suffix) { + testFileSuffix = suffix; + return this; + } + + /** + * Configures the name of the directory containing the set of tests. + * @param testSet the directory of tests. If null, defaults to "standard-testcases" + * @return {@code this} + */ + public Builder testSet(String testSet) { + this.testSet = testSet != null ? testSet : "standard-testcases"; + return this; + } + + /** + * Configures whether any tests are disabled. + * @param disabledProperty name of the property that determines the file of + * disabled test cases + * @param defaultValue if the property was not defined, uses this file name + * instead + * @return {@code this} + */ + public Builder disabledProperty(String disabledProperty, String defaultValue) { + String property = getSystemProperty(disabledProperty); + disabledTests = property != null ? property : defaultValue; + return this; + } + + /** + * Configures whether private tests must be run or not. + * @param privateTestsProperty name of the property containing the boolean switch + * @return {@code this} + */ + public Builder privateTestsProperty(String privateTestsProperty) { + String property = getSystemProperty(privateTestsProperty); + this.privateTests = property != null && property.equalsIgnoreCase("true"); + return this; + } + + private String getSystemProperty(String property) { + return System.getProperty(property); + } + + /** + * Creates the configuration instance. + * @return a configuration instance configured by this builder + */ + public TestFilesConfiguration build() { + return new TestFilesConfiguration(this); + } + } +} diff --git a/src/test/java/org/apache/fop/layoutengine/TrueCheck.java b/src/test/java/org/apache/fop/layoutengine/TrueCheck.java new file mode 100644 index 000000000..5509d754d --- /dev/null +++ b/src/test/java/org/apache/fop/layoutengine/TrueCheck.java @@ -0,0 +1,91 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.layoutengine; + +import javax.xml.transform.TransformerException; + +import org.w3c.dom.Document; +import org.w3c.dom.Node; + +import org.apache.xml.utils.PrefixResolver; +import org.apache.xml.utils.PrefixResolverDefault; +import org.apache.xpath.XPathAPI; +import org.apache.xpath.objects.XBoolean; +import org.apache.xpath.objects.XObject; + +import org.apache.fop.intermediate.IFCheck; + +/** + * Simple check that requires an XPath expression to evaluate to true. + */ +public class TrueCheck implements LayoutEngineCheck, IFCheck { + + private String xpath; + private String failureMessage; + private PrefixResolver prefixResolver; + + /** + * Creates a new instance from a DOM node. + * @param node DOM node that defines this check + */ + public TrueCheck(Node node) { + this.xpath = node.getAttributes().getNamedItem("xpath").getNodeValue(); + Node nd = node.getAttributes().getNamedItem("fail-msg"); + if (nd != null) { + this.failureMessage = nd.getNodeValue(); + } + this.prefixResolver = new PrefixResolverDefault(node); + } + + /** {@inheritDoc} */ + public void check(LayoutResult result) { + doCheck(result.getAreaTree()); + } + + /** {@inheritDoc} */ + public void check(Document intermediate) { + doCheck(intermediate); + } + + private void doCheck(Document doc) { + XObject res; + try { + res = XPathAPI.eval(doc, xpath, prefixResolver); + } catch (TransformerException e) { + throw new RuntimeException("XPath evaluation failed: " + e.getMessage()); + } + if (!XBoolean.S_TRUE.equals(res)) { + if (failureMessage != null) { + throw new AssertionError(failureMessage); + } else { + throw new AssertionError( + "Expected XPath expression to evaluate to 'true', but got '" + + res + "' (" + this + ")"); + } + } + + } + + /** {@inheritDoc} */ + public String toString() { + return "XPath: " + xpath; + } + +} diff --git a/src/test/java/org/apache/fop/layoutmgr/BreakElementTestCase.java b/src/test/java/org/apache/fop/layoutmgr/BreakElementTestCase.java new file mode 100644 index 000000000..c836bce7c --- /dev/null +++ b/src/test/java/org/apache/fop/layoutmgr/BreakElementTestCase.java @@ -0,0 +1,37 @@ +/* + * 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.fop.layoutmgr; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +import org.apache.fop.fo.Constants; + +public class BreakElementTestCase { + + /** + * Tests that the constructor sets the break class to a valid default value. + */ + @Test + public void breakClassMustBeValid() { + LayoutContext context = LayoutContext.newInstance(); + BreakElement breakElement = new BreakElement(new Position(null), 0, context); + assertEquals(Constants.EN_AUTO, breakElement.getBreakClass()); + } +} diff --git a/src/test/java/org/apache/fop/layoutmgr/PageSequenceLayoutManagerTestCase.java b/src/test/java/org/apache/fop/layoutmgr/PageSequenceLayoutManagerTestCase.java new file mode 100644 index 000000000..e810f80c5 --- /dev/null +++ b/src/test/java/org/apache/fop/layoutmgr/PageSequenceLayoutManagerTestCase.java @@ -0,0 +1,119 @@ +/* + * 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. + */ + +/* $Id:$ */ + +package org.apache.fop.layoutmgr; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.anyInt; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import org.apache.fop.area.AreaTreeHandler; +import org.apache.fop.area.PageViewport; +import org.apache.fop.fo.pagination.Flow; +import org.apache.fop.fo.pagination.PageSequence; +import org.apache.fop.fo.pagination.Region; +import org.apache.fop.fo.pagination.Root; +import org.apache.fop.fo.pagination.SimplePageMaster; + +public class PageSequenceLayoutManagerTestCase { + + private static final String MAIN_FLOW_NAME = "main"; + private static final String EMPTY_FLOW_NAME = "empty"; + + /** + * Blank pages can be created from empty pages + * + * @throws Exception + */ + @Test + public void testGetNextPageBlank() throws Exception { + + final Page expectedPage = createPageForRegionName(EMPTY_FLOW_NAME); + final Page[] providedPages = new Page[]{expectedPage}; + + testGetNextPage(providedPages, expectedPage, true); + } + + /** + * Empty pages should not be provided by the PageSequenceLayoutManager + * to layout the main flow + * + * @throws Exception + */ + @Test + public void testGetNextPageFirstEmpty() throws Exception { + + final Page emptyPage = createPageForRegionName(EMPTY_FLOW_NAME); + final Page expectedPage = createPageForRegionName(MAIN_FLOW_NAME); + final Page[] providedPages = new Page[]{emptyPage, expectedPage}; + + testGetNextPage(providedPages, expectedPage, false); + } + + private void testGetNextPage(final Page[] providedPages, Page expectedPage, boolean isBlank) { + + final Flow flow = mock(Flow.class); + final PageSequence pseq = mock(PageSequence.class); + final Root root = mock(Root.class); + final AreaTreeHandler ath = mock(AreaTreeHandler.class); + + when(flow.getFlowName()).thenReturn(MAIN_FLOW_NAME); + when(pseq.getMainFlow()).thenReturn(flow); + when(pseq.getRoot()).thenReturn(root); + + PageSequenceLayoutManager sut = new PageSequenceLayoutManager(ath, pseq) { + + @Override + protected Page createPage(int i, boolean b) { + return providedPages[i - 1]; + } + + @Override + protected void finishPage() { + //nop + } + + // Expose the protected method for testing + public Page makeNewPage(boolean isBlank) { + return super.makeNewPage(isBlank); + } + }; + + assertEquals(expectedPage, sut.makeNewPage(isBlank)); + } + + + private static Page createPageForRegionName(final String regionName) { + final Page page = mock(Page.class); + final SimplePageMaster spm = mock(SimplePageMaster.class); + final PageViewport pageViewport = mock(PageViewport.class); + final Region region = mock(Region.class); + + when(page.getSimplePageMaster()).thenReturn(spm); + when(page.getPageViewport()).thenReturn(pageViewport); + when(spm.getRegion(anyInt())).thenReturn(region); + + when(region.getRegionName()).thenReturn(regionName); + + return page; + } +} diff --git a/src/test/java/org/apache/fop/layoutmgr/RetrieveTableMarkerLayoutManagerMakerTestCase.java b/src/test/java/org/apache/fop/layoutmgr/RetrieveTableMarkerLayoutManagerMakerTestCase.java new file mode 100644 index 000000000..6a37de33c --- /dev/null +++ b/src/test/java/org/apache/fop/layoutmgr/RetrieveTableMarkerLayoutManagerMakerTestCase.java @@ -0,0 +1,56 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.layoutmgr; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Test; + +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import org.apache.fop.apps.FOPException; +import org.apache.fop.fo.FObj.FObjIterator; +import org.apache.fop.fo.flow.RetrieveTableMarker; +import org.apache.fop.layoutmgr.LayoutManagerMapping.RetrieveTableMarkerLayoutManagerMaker; + +public class RetrieveTableMarkerLayoutManagerMakerTestCase { + + @Test + public void testMake() throws FOPException { + // mock + FObjIterator foi = mock(FObjIterator.class); + when(foi.hasNext()).thenReturn(true).thenReturn(false); + // mock + RetrieveTableMarker rtm = mock(RetrieveTableMarker.class); + // real RTMLMM, not mock + List l = new ArrayList(); + LayoutManagerMapping lmm = new LayoutManagerMapping(); + RetrieveTableMarkerLayoutManagerMaker rtmlmm = lmm.new RetrieveTableMarkerLayoutManagerMaker(); + // test the case rtm has no child nodes + when(rtm.getChildNodes()).thenReturn(null); + rtmlmm.make(rtm, l); + assertTrue(l.size() == 1); + assertTrue(l.get(0) instanceof RetrieveTableMarkerLayoutManager); + } + +} diff --git a/src/test/java/org/apache/fop/layoutmgr/RetrieveTableMarkerLayoutManagerTestCase.java b/src/test/java/org/apache/fop/layoutmgr/RetrieveTableMarkerLayoutManagerTestCase.java new file mode 100644 index 000000000..fda9cbccb --- /dev/null +++ b/src/test/java/org/apache/fop/layoutmgr/RetrieveTableMarkerLayoutManagerTestCase.java @@ -0,0 +1,82 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.layoutmgr; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import org.apache.fop.fo.Constants; +import org.apache.fop.fo.flow.RetrieveTableMarker; +import org.apache.fop.fo.flow.table.Table; +import org.apache.fop.layoutmgr.inline.TextLayoutManager; +import org.apache.fop.layoutmgr.table.TableLayoutManager; + +public class RetrieveTableMarkerLayoutManagerTestCase { + + @Test + public void testGetNextKnuthElementsLayoutContextInt() { + LayoutContext lc = LayoutContext.newInstance(); + // mock + Table t = mock(Table.class); + // mock + RetrieveTableMarker rtm = mock(RetrieveTableMarker.class); + when(rtm.getRetrieveClassName()).thenReturn("A"); + when(rtm.getPosition()).thenReturn(Constants.EN_FIRST_STARTING); + when(rtm.getBoundary()).thenReturn(Constants.EN_TABLE_FRAGMENT); + // mock + TextLayoutManager tlm = mock(TextLayoutManager.class); + // mock + LayoutManagerMapping lmm = mock(LayoutManagerMapping.class); + when(lmm.makeLayoutManager(rtm)).thenReturn(tlm); + // mock + PageSequenceLayoutManager pslm = mock(PageSequenceLayoutManager.class); + when(pslm.getPSLM()).thenReturn(pslm); + when(pslm.getLayoutManagerMaker()).thenReturn(lmm); + // mock + TableLayoutManager tablelm = mock(TableLayoutManager.class); + when(tablelm.getTable()).thenReturn(t); + // mock + BlockLayoutManager blm = mock(BlockLayoutManager.class); + when(blm.getPSLM()).thenReturn(pslm); + when(blm.getParent()).thenReturn(tablelm); + // real RTMLM, not mock + RetrieveTableMarkerLayoutManager rtmlm = new RetrieveTableMarkerLayoutManager(rtm); + rtmlm.setParent(blm); + // test the case where resolution returns null + when(tablelm.resolveRetrieveTableMarker(rtm)).thenReturn(null); + assertNull(rtmlm.getNextKnuthElements(lc, 0)); + // test the case where resolution returns non null + List l = new ArrayList(); + when(tablelm.resolveRetrieveTableMarker(rtm)).thenReturn(rtm); + when(tlm.getNextKnuthElements(lc, 0)).thenReturn(l); + assertEquals(l, rtmlm.getNextKnuthElements(lc, 0)); + verify(tlm).setParent(blm); + verify(tlm).initialize(); + } + +} diff --git a/src/test/java/org/apache/fop/layoutmgr/table/TableCellLayoutManagerTestCase.java b/src/test/java/org/apache/fop/layoutmgr/table/TableCellLayoutManagerTestCase.java new file mode 100644 index 000000000..629e5f1c6 --- /dev/null +++ b/src/test/java/org/apache/fop/layoutmgr/table/TableCellLayoutManagerTestCase.java @@ -0,0 +1,116 @@ +/* + * 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. + */ + +/* $Id:$ */ + +package org.apache.fop.layoutmgr.table; + +import java.awt.Color; + +import org.junit.Test; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import org.apache.fop.fo.flow.table.PrimaryGridUnit; +import org.apache.fop.fo.flow.table.Table; +import org.apache.fop.fo.flow.table.TableCell; +import org.apache.fop.fo.flow.table.TableColumn; +import org.apache.fop.fo.flow.table.TableHeader; +import org.apache.fop.fo.flow.table.TableRow; +import org.apache.fop.fo.properties.CommonBorderPaddingBackground; +import org.apache.fop.fo.properties.CommonBorderPaddingBackground.BorderInfo; +import org.apache.fop.fo.properties.CondLengthProperty; +import org.apache.fop.layoutmgr.LayoutContext; +import org.apache.fop.layoutmgr.PageSequenceLayoutManager; +import org.apache.fop.layoutmgr.PositionIterator; +import org.apache.fop.layoutmgr.RetrieveTableMarkerLayoutManager; + +public class TableCellLayoutManagerTestCase { + + // this test aims to check that the first call to addAreas() calls + // TLM.saveTableHeaderTableCellLayoutManagers() but the second call, through repeatAddAreas() + // does not call it again; there are a lot of mocks here, but just the necessary so that the + // addAreas() call can run to completion without NPE; also, the mocking needs to be done so + // the methods isDecendantOfTableHeaderOrFooter() and hasRetrieveTableMarker() return true. + @Test + public void testRepeatAddAreas() { + LayoutContext lc = LayoutContext.newInstance(); + // mock background + CommonBorderPaddingBackground cbpb = mock(CommonBorderPaddingBackground.class); + // mock conditional length property + CondLengthProperty clp = mock(CondLengthProperty.class); + when(clp.getLengthValue()).thenReturn(0); + // real border info + BorderInfo bi = BorderInfo.getInstance(0, clp, Color.BLACK, clp, clp); + // mock column + TableColumn tcol = mock(TableColumn.class); + when(tcol.getCommonBorderPaddingBackground()).thenReturn(cbpb); + // mock table + Table t = mock(Table.class); + when(t.getColumn(0)).thenReturn(tcol); + // mock header + TableHeader th = mock(TableHeader.class); + when(th.getCommonBorderPaddingBackground()).thenReturn(cbpb); + // mock row + TableRow tr = mock(TableRow.class); + when(tr.getParent()).thenReturn(th); + // mock cell + TableCell tc = mock(TableCell.class); + when(tc.hasRetrieveTableMarker()).thenReturn(true); + when(tc.getTable()).thenReturn(t); + when(tc.getId()).thenReturn("cellId"); + when(tc.getCommonBorderPaddingBackground()).thenReturn(cbpb); + when(tc.getParent()).thenReturn(tr); + // mock PGU + PrimaryGridUnit pgu = mock(PrimaryGridUnit.class); + when(pgu.getCell()).thenReturn(tc); + when(pgu.getColIndex()).thenReturn(0); + when(pgu.getBorderBefore(0)).thenReturn(bi); + when(pgu.getBorderAfter(0)).thenReturn(bi); + when(pgu.getBorderEnd()).thenReturn(bi); + when(pgu.getBorderStart()).thenReturn(bi); + when(pgu.getTablePart()).thenReturn(th); + // mock RTMLM + RetrieveTableMarkerLayoutManager rtmlm = mock(RetrieveTableMarkerLayoutManager.class); + when(rtmlm.isFinished()).thenReturn(true); // avoids infinite loop + // mock PSLM + PageSequenceLayoutManager pslm = mock(PageSequenceLayoutManager.class); + // mock TLM + TableLayoutManager tlm = mock(TableLayoutManager.class); + when(tlm.getPSLM()).thenReturn(pslm); + // mock PI + PositionIterator pi = mock(PositionIterator.class); + // mock RP + RowPainter rp = mock(RowPainter.class); + + // real TCLM, not a mock! + TableCellLayoutManager tclm = new TableCellLayoutManager(tc, pgu); + tclm.addChildLM(rtmlm); + tclm.setParent(tlm); + // lets call addAreas + int[] n = {}; + tclm.addAreas(pi, lc, n, 0, 0, 0, 0, true, true, rp, 0); + // check the TCLM is added to the TLM + verify(tlm).saveTableHeaderTableCellLayoutManagers(tclm); + // call the repeat + tclm.repeatAddAreas(); + // check the TCLM was not added again + verify(tlm).saveTableHeaderTableCellLayoutManagers(tclm); + } +} diff --git a/src/test/java/org/apache/fop/layoutmgr/table/TableContentLayoutManagerTestCase.java b/src/test/java/org/apache/fop/layoutmgr/table/TableContentLayoutManagerTestCase.java new file mode 100644 index 000000000..2bc41979c --- /dev/null +++ b/src/test/java/org/apache/fop/layoutmgr/table/TableContentLayoutManagerTestCase.java @@ -0,0 +1,64 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.layoutmgr.table; + +import org.junit.Test; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import org.apache.fop.fo.FONode.FONodeIterator; +import org.apache.fop.fo.flow.table.Table; +import org.apache.fop.layoutmgr.LayoutContext; +import org.apache.fop.layoutmgr.PositionIterator; + +public class TableContentLayoutManagerTestCase { + + @Test + public void testAddAreas() { + LayoutContext lc = LayoutContext.newInstance(); + // mock + ColumnSetup cs = mock(ColumnSetup.class); + when(cs.getColumnCount()).thenReturn(3); + // mock + FONodeIterator foni = mock(FONodeIterator.class); + when(foni.hasNext()).thenReturn(false); + // mock + Table t = mock(Table.class); + when(t.getChildNodes()).thenReturn(foni); + when(t.getMarkers()).thenReturn(null); + // mock + TableLayoutManager tlm = mock(TableLayoutManager.class); + when(tlm.getTable()).thenReturn(t); + when(tlm.getColumns()).thenReturn(cs); + // mock + PositionIterator pi = mock(PositionIterator.class); + when(pi.hasNext()).thenReturn(false); + // real TCLM, not a mock + TableContentLayoutManager tclm = new TableContentLayoutManager(tlm); + // check that addAreas() calls the clearTableFragments() on the table and the + // repeatAddAreasForSavedTableHeaderTableCellLayoutManagers on the TLM + tclm.addAreas(pi, lc); + verify(tlm).clearTableFragmentMarkers(); + verify(tlm).repeatAddAreasForSavedTableHeaderTableCellLayoutManagers(); + } + +} diff --git a/src/test/java/org/apache/fop/layoutmgr/table/TableHandler.java b/src/test/java/org/apache/fop/layoutmgr/table/TableHandler.java new file mode 100644 index 000000000..7d07cb227 --- /dev/null +++ b/src/test/java/org/apache/fop/layoutmgr/table/TableHandler.java @@ -0,0 +1,45 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.layoutmgr.table; + +import java.util.LinkedList; +import java.util.List; + +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.fo.FOEventHandler; +import org.apache.fop.fo.flow.table.Table; + +public class TableHandler extends FOEventHandler { + + /** All the tables encountered in the FO file. List of Table objects. */ + private List tables = new LinkedList(); + + TableHandler(FOUserAgent foUserAgent) { + super(foUserAgent); + } + + public void endTable(Table tbl) { + tables.add(tbl); + } + + List getTables() { + return tables; + } +} diff --git a/src/test/java/org/apache/fop/layoutmgr/table/TableLayoutManagerTestCase.java b/src/test/java/org/apache/fop/layoutmgr/table/TableLayoutManagerTestCase.java new file mode 100644 index 000000000..46a394eb7 --- /dev/null +++ b/src/test/java/org/apache/fop/layoutmgr/table/TableLayoutManagerTestCase.java @@ -0,0 +1,119 @@ +/* + * 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. + */ + +/* $Id:$ */ + +package org.apache.fop.layoutmgr.table; + +import java.util.HashMap; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import org.apache.fop.area.PageViewport; +import org.apache.fop.fo.Constants; +import org.apache.fop.fo.flow.Marker; +import org.apache.fop.fo.flow.RetrieveTableMarker; +import org.apache.fop.fo.flow.table.Table; +import org.apache.fop.layoutmgr.BlockLayoutManager; +import org.apache.fop.layoutmgr.Page; +import org.apache.fop.layoutmgr.PageSequenceLayoutManager; + +public class TableLayoutManagerTestCase { + + @Test + public void testSavedTableCellLayoutManagersFunctionality() { + Table t = mock(Table.class); + TableCellLayoutManager tclm1 = mock(TableCellLayoutManager.class); + TableLayoutManager tlm = new TableLayoutManager(t); + tlm.saveTableHeaderTableCellLayoutManagers(tclm1); + tlm.repeatAddAreasForSavedTableHeaderTableCellLayoutManagers(); + verify(tclm1).repeatAddAreas(); // called once + // test that after the first repeatAddAreas() call the list closes to new additions + TableCellLayoutManager tclm2 = mock(TableCellLayoutManager.class); + tlm.saveTableHeaderTableCellLayoutManagers(tclm2); + tlm.repeatAddAreasForSavedTableHeaderTableCellLayoutManagers(); + verify(tclm1, times(2)).repeatAddAreas(); // called twice + verify(tclm2, never()).repeatAddAreas(); // never called + } + + @Test + public void testResolveRetrieveTableMarker() { + // mock + Table t = mock(Table.class); + // mock + Marker m = mock(Marker.class); + // mock + RetrieveTableMarker rtm = mock(RetrieveTableMarker.class); + when(rtm.getRetrieveClassName()).thenReturn("A"); + when(rtm.getPosition()).thenReturn(Constants.EN_FIRST_STARTING); + // mock + PageViewport pv = mock(PageViewport.class); + when(pv.resolveMarker(rtm)).thenReturn(m); + // mock + Page p = mock(Page.class); + when(p.getPageViewport()).thenReturn(pv); + // mock + PageSequenceLayoutManager pslm = mock(PageSequenceLayoutManager.class); + when(pslm.getPSLM()).thenReturn(pslm); + when(pslm.getCurrentPage()).thenReturn(p); + // mock + BlockLayoutManager blm = mock(BlockLayoutManager.class); + blm.setParent(pslm); + when(blm.getPSLM()).thenReturn(pslm); + // real TLM, not mock + TableLayoutManager tlm = new TableLayoutManager(t); + tlm.setParent(blm); + // register a marker + HashMap<String, Marker> markers1 = new HashMap<String, Marker>(); + Marker m1 = mock(Marker.class); + markers1.put("A", m1); + tlm.registerMarkers(markers1, true, true, true); + tlm.registerMarkers(markers1, false, true, true); + // check that if there is a marker at table fragment level the RTM is returned + assertEquals(rtm, tlm.resolveRetrieveTableMarker(rtm)); + verify(rtm, never()).getBoundary(); + // check that if there is no marker at table fragment level and that is the boundary + // we get a null return value + when(rtm.getBoundary()).thenReturn(Constants.EN_TABLE_FRAGMENT); + when(rtm.getRetrieveClassName()).thenReturn("B"); + assertNull(tlm.resolveRetrieveTableMarker(rtm)); + verify(rtm).getBoundary(); + verify(rtm, never()).changePositionTo(Constants.EN_LAST_ENDING); + // check that if there is no marker at table fragment level and the boundary is page + // then we try to do the resolution at page level; test the case a marker is found + when(rtm.getBoundary()).thenReturn(Constants.EN_PAGE); + assertEquals(rtm, tlm.resolveRetrieveTableMarker(rtm)); + verify(rtm).changePositionTo(Constants.EN_LAST_ENDING); + verify(rtm).changePositionTo(Constants.EN_FIRST_STARTING); + verify(pv).resolveMarker(rtm); + // test the same situation but in this case the marker is not found + when(pv.resolveMarker(rtm)).thenReturn(null); + assertNull(tlm.resolveRetrieveTableMarker(rtm)); + // test the situation where the marker is not found at page level but the boundary is table + when(rtm.getBoundary()).thenReturn(Constants.EN_TABLE); + assertNull(tlm.resolveRetrieveTableMarker(rtm)); + } + +} diff --git a/src/test/java/org/apache/fop/logging/LoggingElementListObserver.java b/src/test/java/org/apache/fop/logging/LoggingElementListObserver.java new file mode 100644 index 000000000..7824a6b8b --- /dev/null +++ b/src/test/java/org/apache/fop/logging/LoggingElementListObserver.java @@ -0,0 +1,76 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.logging; + +import java.util.List; +import java.util.ListIterator; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import org.apache.fop.layoutmgr.ElementListObserver.Observer; +import org.apache.fop.layoutmgr.ElementListUtils; +import org.apache.fop.layoutmgr.ListElement; + +/** + * <p>Logs all observed element lists. + * </p> + * <p>You can enable/disabled individual categories separately, for example for JDK 1.4 logging: + * </p> + * <p>org.apache.fop.logging.LoggingElementListObserver.level = INFO</p> + * <p>org.apache.fop.logging.LoggingElementListObserver.table-cell.level = FINE</p> + */ +public class LoggingElementListObserver implements Observer { + + /** @see org.apache.fop.layoutmgr.ElementListObserver.Observer */ + public void observe(List elementList, String category, String id) { + Log log = LogFactory.getLog(LoggingElementListObserver.class.getName() + "." + category); + if (!log.isDebugEnabled()) { + return; + } + log.debug(" "); + int len = (elementList != null ? ElementListUtils.calcContentLength(elementList) : 0); + log.debug("ElementList: category=" + category + ", id=" + id + ", len=" + len + "mpt"); + if (elementList == null) { + log.debug("<<empty list>>"); + return; + } + ListIterator tempIter = elementList.listIterator(); + ListElement temp; + while (tempIter.hasNext()) { + temp = (ListElement) tempIter.next(); + if (temp.isBox()) { + log.debug(tempIter.previousIndex() + + ") " + temp); + } else if (temp.isGlue()) { + log.debug(tempIter.previousIndex() + + ") " + temp); + } else { + log.debug(tempIter.previousIndex() + + ") " + temp); + } + if (temp.getPosition() != null) { + log.debug(" " + temp.getPosition()); + } + } + log.debug(" "); + } + +} diff --git a/src/test/java/org/apache/fop/memory/MemoryEater.java b/src/test/java/org/apache/fop/memory/MemoryEater.java new file mode 100644 index 000000000..efe0cc489 --- /dev/null +++ b/src/test/java/org/apache/fop/memory/MemoryEater.java @@ -0,0 +1,145 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.memory; + +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.OutputStream; +import java.net.MalformedURLException; + +import javax.xml.transform.Result; +import javax.xml.transform.Source; +import javax.xml.transform.Templates; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.sax.SAXResult; +import javax.xml.transform.sax.SAXTransformerFactory; +import javax.xml.transform.stream.StreamSource; + +import org.apache.commons.io.IOUtils; +import org.apache.commons.io.output.NullOutputStream; + +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.apps.Fop; +import org.apache.fop.apps.FopFactory; +import org.apache.fop.apps.MimeConstants; + +/** + * Debug tool to create and process large FO files by replicating them a specified number of times. + */ +public final class MemoryEater { + + private SAXTransformerFactory tFactory + = (SAXTransformerFactory)SAXTransformerFactory.newInstance(); + private Templates replicatorTemplates; + + private Stats stats; + + private MemoryEater() throws TransformerConfigurationException, MalformedURLException { + File xsltFile = new File("test/xsl/fo-replicator.xsl"); + Source xslt = new StreamSource(xsltFile); + replicatorTemplates = tFactory.newTemplates(xslt); + } + + private void eatMemory(File foFile, int runRepeats, int replicatorRepeats) throws Exception { + stats = new Stats(); + FopFactory fopFactory = FopFactory.newInstance(foFile.getParentFile().toURI()); + for (int i = 0; i < runRepeats; i++) { + eatMemory(i, foFile, replicatorRepeats, fopFactory); + stats.progress(i, runRepeats); + } + stats.dumpFinalStats(); + System.out.println(stats.getGoogleChartURL()); + } + + private void eatMemory(int callIndex, File foFile, int replicatorRepeats, FopFactory fopFactory) + throws Exception { + Source src = new StreamSource(foFile); + + Transformer transformer = replicatorTemplates.newTransformer(); + transformer.setParameter("repeats", new Integer(replicatorRepeats)); + + OutputStream out = new NullOutputStream(); //write to /dev/nul + try { + FOUserAgent userAgent = fopFactory.newFOUserAgent(); + Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, userAgent, out); + Result res = new SAXResult(fop.getDefaultHandler()); + + transformer.transform(src, res); + + stats.notifyPagesProduced(fop.getResults().getPageCount()); + if (callIndex == 0) { + System.out.println(foFile.getName() + " generates " + + fop.getResults().getPageCount() + " pages."); + } + stats.checkStats(); + } finally { + IOUtils.closeQuietly(out); + } + } + + private static void prompt() throws IOException { + BufferedReader in = new BufferedReader(new java.io.InputStreamReader(System.in)); + System.out.print("Press return to continue..."); + in.readLine(); + } + + /** + * Main method. + * @param args the command-line arguments + */ + public static void main(String[] args) { + boolean doPrompt = true; //true if you want a chance to start the monitoring console + try { + int replicatorRepeats = 2; + int runRepeats = 1; + if (args.length > 0) { + replicatorRepeats = Integer.parseInt(args[0]); + } + if (args.length > 1) { + runRepeats = Integer.parseInt(args[1]); + } + File testFile = new File("examples/fo/basic/readme.fo"); + + System.out.println("MemoryEater! About to replicate the test file " + + replicatorRepeats + " times and run it " + runRepeats + " times..."); + if (doPrompt) { + prompt(); + } + + System.out.println("Processing..."); + long start = System.currentTimeMillis(); + + MemoryEater app = new MemoryEater(); + app.eatMemory(testFile, runRepeats, replicatorRepeats); + + long duration = System.currentTimeMillis() - start; + System.out.println("Success! Job took " + duration + " ms"); + + if (doPrompt) { + prompt(); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + +} diff --git a/src/test/java/org/apache/fop/memory/Stats.java b/src/test/java/org/apache/fop/memory/Stats.java new file mode 100644 index 000000000..354952347 --- /dev/null +++ b/src/test/java/org/apache/fop/memory/Stats.java @@ -0,0 +1,121 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.memory; + +import java.util.Iterator; +import java.util.List; + +class Stats { + + private static final int INTERVAL = 2000; + + private long startTime = System.currentTimeMillis(); + private long lastProgressDump = startTime; + private int pagesProduced; + + private int totalPagesProduced; + + private int step; + private int stepCount; + + private List samples = new java.util.LinkedList(); + + public void checkStats() { + long now = System.currentTimeMillis(); + if (now > lastProgressDump + INTERVAL) { + dumpStats(); + reset(); + } + } + + public void notifyPagesProduced(int count) { + pagesProduced += count; + totalPagesProduced += count; + } + + public void reset() { + pagesProduced = 0; + lastProgressDump = System.currentTimeMillis(); + } + + public void dumpStats() { + long duration = System.currentTimeMillis() - lastProgressDump; + + if (stepCount != 0) { + int progress = 100 * step / stepCount; + System.out.println("Progress: " + progress + "%, " + (stepCount - step) + " left"); + } + + long ppm = 60000 * pagesProduced / duration; + System.out.println("Speed: " + ppm + "ppm"); + samples.add(new Sample((int)ppm)); + } + + public void dumpFinalStats() { + long duration = System.currentTimeMillis() - startTime; + System.out.println("Final statistics"); + System.out.println("Pages produced: " + totalPagesProduced); + long ppm = 60000 * totalPagesProduced / duration; + System.out.println("Average speed: " + ppm + "ppm"); + } + + public String getGoogleChartURL() { + StringBuffer sb = new StringBuffer("http://chart.apis.google.com/chart?"); + //http://chart.apis.google.com/chart?cht=ls&chd=t:60,40&chs=250x100&chl=Hello|World + sb.append("cht=ls"); + sb.append("&chd=t:"); + boolean first = true; + int maxY = 0; + Iterator iter = samples.iterator(); + while (iter.hasNext()) { + Sample sample = (Sample)iter.next(); + if (first) { + first = false; + } else { + sb.append(','); + } + sb.append(sample.ppm); + maxY = Math.max(maxY, sample.ppm); + } + int ceilY = ((maxY / 1000) + 1) * 1000; + sb.append("&chs=1000x300"); //image size + sb.append("&chds=0,").append(ceilY); //data scale + sb.append("&chg=0,20"); //scale steps + sb.append("&chxt=y"); + sb.append("&chxl=0:|0|" + ceilY); + return sb.toString(); + } + + private static class Sample { + + private int ppm; + + public Sample(int ppm) { + this.ppm = ppm; + } + } + + public void progress(int step, int stepCount) { + this.step = step; + this.stepCount = stepCount; + + } + +} diff --git a/src/test/java/org/apache/fop/pdf/AbstractPDFStreamTestCase.java b/src/test/java/org/apache/fop/pdf/AbstractPDFStreamTestCase.java new file mode 100644 index 000000000..ae68cbeb7 --- /dev/null +++ b/src/test/java/org/apache/fop/pdf/AbstractPDFStreamTestCase.java @@ -0,0 +1,93 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.pdf; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.OutputStream; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +/** + * Test case for {@link AbstractPDFStream}. + */ +public class AbstractPDFStreamTestCase extends PDFObjectTestCase { + + private AbstractPDFStream abstractStream; + + private String textData = "This is an arbitrary string for testing."; + + private static byte[] encodedBytes; + static { + int[] encoded = { 0x78, 0x9c, 0x0b, 0xc9, 0xc8, 0x2c, 0x56, 0x00, 0xa2, 0xc4, 0x3c, 0x85, + 0xc4, 0xa2, 0xa4, 0xcc, 0x92, 0xa2, 0xc4, 0xa2, 0x4a, 0x85, 0xe2, 0x92, 0xa2, 0xcc, + 0xbc, 0x74, 0x85, 0xb4, 0xfc, 0x22, 0x85, 0x92, 0xd4, 0xe2, 0x12, 0x20, 0x5b, 0x0f, + 0x00, 0x2d, 0x2b, 0x0e, 0xde, 0x0a }; + encodedBytes = new byte[encoded.length]; + int i = 0; + for (int in : encoded) { + encodedBytes[i++] = (byte) (in & 0xff); + } + } + private String startStream = "<< /Length 1 0 R /Filter /FlateDecode >>\n" + + "stream\n"; + + private String endStream = "endstream"; + + @Before + public void setUp() { + abstractStream = new AbstractPDFStream() { + + @Override + protected void outputRawStreamData(OutputStream out) throws IOException { + out.write(textData.getBytes()); + } + + @Override + protected int getSizeHint() throws IOException { + return textData.length(); + } + }; + abstractStream.setDocument(doc); + abstractStream.setParent(parent); + + pdfObjectUnderTest = abstractStream; + } + + /** + * Tests output() - ensure that this object is correctly formatted to the output stream. + * @throws IOException if an I/O error occurs + */ + @Test + public void testOutput() throws IOException { + // This differs from most other objects, if the object number = 0 an exception is thrown + ByteArrayOutputStream outStream = new ByteArrayOutputStream(); + abstractStream.setObjectNumber(1); + ByteArrayOutputStream expectedStream = new ByteArrayOutputStream(); + expectedStream.write(startStream.getBytes()); + expectedStream.write(encodedBytes); + expectedStream.write(endStream.getBytes()); + assertEquals(expectedStream.size(), abstractStream.output(outStream)); + assertEquals(expectedStream.toString(), outStream.toString()); + } +} diff --git a/src/test/java/org/apache/fop/pdf/FileIDGeneratorTestCase.java b/src/test/java/org/apache/fop/pdf/FileIDGeneratorTestCase.java new file mode 100644 index 000000000..3301fff9e --- /dev/null +++ b/src/test/java/org/apache/fop/pdf/FileIDGeneratorTestCase.java @@ -0,0 +1,126 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.pdf; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +/** + * Tests the {@link FileIDGenerator} class. + */ +@RunWith(Parameterized.class) +public class FileIDGeneratorTestCase { + + /** The generator under test. */ + protected FileIDGenerator fileIDGenerator; + + private TestGetter initializer; + + @Parameters + public static Collection<TestGetter[]> getParameters() { + ArrayList<TestGetter[]> params = new ArrayList<TestGetter[]>(); + params.add(new TestGetter[] { new RandomFileIDGeneratorTest() }); + params.add(new TestGetter[] { new DigestFileIDGeneratorTest() }); + return params; + } + + public FileIDGeneratorTestCase(TestGetter initializer) { + this.initializer = initializer; + } + + @Before + public void setUp() throws Exception { + fileIDGenerator = initializer.getSut(); + } + + /** Tests that the getOriginalFileID method generates valid output. */ + @Test + public void testOriginal() { + byte[] fileID = fileIDGenerator.getOriginalFileID(); + fileIDMustBeValid(fileID); + } + + /** Tests that the getUpdatedFileID method generates valid output. */ + @Test + public void testUpdated() { + byte[] fileID = fileIDGenerator.getUpdatedFileID(); + fileIDMustBeValid(fileID); + } + + private void fileIDMustBeValid(byte[] fileID) { + assertNotNull(fileID); + assertEquals(16, fileID.length); + } + + /** Tests that multiple calls to getOriginalFileID method always return the same value. */ + @Test + public void testOriginalMultipleCalls() { + byte[] fileID1 = fileIDGenerator.getUpdatedFileID(); + byte[] fileID2 = fileIDGenerator.getUpdatedFileID(); + assertTrue(Arrays.equals(fileID1, fileID2)); + } + + /** Tests that getUpdatedFileID returns the same value as getOriginalFileID. */ + @Test + public void testUpdateEqualsOriginal() { + byte[] originalFileID = fileIDGenerator.getOriginalFileID(); + byte[] updatedFileID = fileIDGenerator.getUpdatedFileID(); + assertTrue(Arrays.equals(originalFileID, updatedFileID)); + } + + private interface TestGetter { + FileIDGenerator getSut() throws Exception; + } + + /** + * Tests the random file ID generator. + */ + private static class RandomFileIDGeneratorTest implements TestGetter { + + public FileIDGenerator getSut() throws Exception { + return FileIDGenerator.getRandomFileIDGenerator(); + } + + } + + /** + * Tests the file ID generator based on an MD5 digest. + */ + private static class DigestFileIDGeneratorTest implements TestGetter { + + public FileIDGenerator getSut() throws Exception { + return FileIDGenerator.getDigestFileIDGenerator( + new PDFDocument("Apache FOP")); + } + + } + +} diff --git a/src/test/java/org/apache/fop/pdf/ObjectStreamManagerTestCase.java b/src/test/java/org/apache/fop/pdf/ObjectStreamManagerTestCase.java new file mode 100644 index 000000000..fda1a006e --- /dev/null +++ b/src/test/java/org/apache/fop/pdf/ObjectStreamManagerTestCase.java @@ -0,0 +1,113 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.pdf; + +import java.io.IOException; +import java.io.OutputStream; +import java.util.List; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import org.apache.fop.pdf.xref.CompressedObjectReference; + +public class ObjectStreamManagerTestCase { + + private List<CompressedObjectReference> compressedObjectReferences; + + private MockPdfDocument pdfDocument; + + @Test + public void add() { + final int expectedCapacity = 100; + final int numCompressedObjects = expectedCapacity * 2 + 1; + createCompressObjectReferences(numCompressedObjects); + assertEquals(numCompressedObjects, compressedObjectReferences.size()); + int objectStreamNumber1 = assertSameObjectStream(0, expectedCapacity); + int objectStreamNumber2 = assertSameObjectStream(expectedCapacity, expectedCapacity * 2); + int objectStreamNumber3 = assertSameObjectStream(expectedCapacity * 2, numCompressedObjects); + assertDifferent(objectStreamNumber1, objectStreamNumber2, objectStreamNumber3); + assertEquals(objectStreamNumber3, pdfDocument.previous.getObjectNumber().getNumber()); + } + + private void createCompressObjectReferences(int numObjects) { + pdfDocument = new MockPdfDocument(); + ObjectStreamManager sut = new ObjectStreamManager(pdfDocument); + for (int obNum = 1; obNum <= numObjects; obNum++) { + sut.add(createCompressedObject(obNum)); + } + compressedObjectReferences = sut.getCompressedObjectReferences(); + } + + private static class MockPdfDocument extends PDFDocument { + + private ObjectStream previous; + + public MockPdfDocument() { + super(""); + } + + public void assignObjectNumber(PDFObject obj) { + super.assignObjectNumber(obj); + if (obj instanceof ObjectStream) { + ObjectStream objStream = (ObjectStream) obj; + ObjectStream previous = (ObjectStream) objStream.get("Extends"); + if (previous == null) { + assertEquals(this.previous, previous); + } + this.previous = objStream; + } + } + } + + private CompressedObject createCompressedObject(final int objectNumber) { + return new CompressedObject() { + + public PDFObjectNumber getObjectNumber() { + return new PDFObjectNumber(objectNumber); + } + + public int output(OutputStream outputStream) throws IOException { + throw new UnsupportedOperationException(); + } + }; + } + + private int assertSameObjectStream(int from, int to) { + int objectStreamNumber = getObjectStreamNumber(from); + for (int i = from + 1; i < to; i++) { + assertEquals(objectStreamNumber, getObjectStreamNumber(i)); + } + return objectStreamNumber; + } + + private int getObjectStreamNumber(int index) { + return compressedObjectReferences.get(index).getObjectStreamNumber().getNumber(); + } + + private void assertDifferent(int objectStreamNumber1, int objectStreamNumber2, + int objectStreamNumber3) { + assertTrue(objectStreamNumber1 != objectStreamNumber2); + assertTrue(objectStreamNumber1 != objectStreamNumber3); + assertTrue(objectStreamNumber2 != objectStreamNumber3); + } +} diff --git a/src/test/java/org/apache/fop/pdf/ObjectStreamTestCase.java b/src/test/java/org/apache/fop/pdf/ObjectStreamTestCase.java new file mode 100644 index 000000000..a38df70a0 --- /dev/null +++ b/src/test/java/org/apache/fop/pdf/ObjectStreamTestCase.java @@ -0,0 +1,132 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.pdf; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +public class ObjectStreamTestCase { + + private static final String OBJECT_CONTENT = "<<\n /Foo True\n /Bar False\n>>\n"; + + private PDFDocument pdfDocument; + + private ObjectStream objectStream; + + private List<MockCompressedObject> compressedObjects; + + @Before + public void setUp() throws Exception { + pdfDocument = new PDFDocument("PDFObjectStreamTestCase"); + objectStream = new ObjectStream(); + pdfDocument.assignObjectNumber(objectStream); + compressedObjects = Arrays.asList(new MockCompressedObject(), new MockCompressedObject()); + } + + @Test + public void testSingleObjectStream() throws IOException { + populateObjectStream(); + testOutput(); + } + + @Test + public void testObjectStreamCollection() throws IOException { + objectStream = new ObjectStream(objectStream); + pdfDocument.assignObjectNumber(objectStream); + populateObjectStream(); + testOutput(); + } + + @Test(expected = IllegalStateException.class) + public void directObjectsAreNotAllowed() throws Exception { + objectStream.addObject(new MockCompressedObject()); + } + + @Test(expected = NullPointerException.class) + public void nullObjectsAreNotAllowed() throws Exception { + objectStream.addObject(null); + } + + private void testOutput() throws IOException { + String expected = getExpectedOutput(); + String actual = getActualOutput(); + assertEquals(expected, actual); + } + + private void populateObjectStream() { + for (MockCompressedObject obj : compressedObjects) { + pdfDocument.assignObjectNumber(obj); + objectStream.addObject(obj); + } + } + + private String getExpectedOutput() { + int numObs = compressedObjects.size(); + int objectStreamNumber = objectStream.getObjectNumber().getNumber(); + int offsetsLength = 9; + StringBuilder expected = new StringBuilder(); + expected.append("<<\n"); + ObjectStream previous = (ObjectStream) objectStream.get("Extends"); + if (previous != null) { + expected.append(" /Extends ").append(previous.getObjectNumber()).append(" 0 R\n"); + objectStreamNumber++; + } + expected.append(" /Type /ObjStm\n") + .append(" /N ").append(numObs).append("\n") + .append(" /First ").append(offsetsLength).append('\n') + .append(" /Length ").append(OBJECT_CONTENT.length() * 2 + offsetsLength).append('\n') + .append(">>\n") + .append("stream\n"); + int offset = 0; + int num = 1; + for (PDFObject ob : compressedObjects) { + expected.append(objectStreamNumber + num++).append(' ').append(offset).append('\n'); + offset += ob.toPDFString().length(); + } + for (PDFObject ob : compressedObjects) { + expected.append(ob.toPDFString()); + } + expected.append("\nendstream"); + return expected.toString(); + } + + private String getActualOutput() throws IOException { + ByteArrayOutputStream actual = new ByteArrayOutputStream(); + objectStream.getFilterList().setDisableAllFilters(true); + objectStream.output(actual); + return actual.toString("US-ASCII"); + } + + private static class MockCompressedObject extends PDFObject implements CompressedObject { + + @Override + protected String toPDFString() { + return OBJECT_CONTENT; + } + } + +} diff --git a/src/test/java/org/apache/fop/pdf/PDFAModeTestCase.java b/src/test/java/org/apache/fop/pdf/PDFAModeTestCase.java new file mode 100644 index 000000000..68609575a --- /dev/null +++ b/src/test/java/org/apache/fop/pdf/PDFAModeTestCase.java @@ -0,0 +1,145 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.pdf; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +public class PDFAModeTestCase { + + private static class PDFAModeChecker { + + private final PDFAMode mode; + + PDFAModeChecker(PDFAMode mode) { + this.mode = mode; + } + + PDFAModeChecker isEnabled() { + assertTrue(mode.isEnabled()); + return this; + } + + PDFAModeChecker isDisabled() { + assertFalse(mode.isEnabled()); + return this; + } + + PDFAModeChecker isPart1() { + assertEquals(1, mode.getPart()); + assertTrue(mode.isPart1()); + return this; + } + + PDFAModeChecker isNotPart1() { + assertFalse(mode.getPart() == 1); + assertFalse(mode.isPart1()); + return this; + } + + PDFAModeChecker isPart2() { + assertTrue(mode.getPart() == 1 || mode.getPart() == 2); + assertTrue(mode.isPart2()); + return this; + } + + PDFAModeChecker isNotPart2() { + assertFalse(mode.getPart() == 2); + assertFalse(mode.isPart2()); + return this; + } + + PDFAModeChecker hasConformanceLevel(char level) { + assertEquals(level, mode.getConformanceLevel()); + return this; + } + + PDFAModeChecker isLevelA() { + assertEquals('A', mode.getConformanceLevel()); + assertTrue(mode.isLevelA()); + return this; + } + + PDFAModeChecker isNotLevelA() { + assertFalse(mode.getConformanceLevel() == 'A'); + assertFalse(mode.isLevelA()); + return this; + } + } + + @Test + public void checkDisabled() { + new PDFAModeChecker(PDFAMode.DISABLED) + .isDisabled() + .isNotPart1() + .isNotPart2() + .isNotLevelA(); + } + + @Test + public void checkPDFA1a() { + new PDFAModeChecker(PDFAMode.PDFA_1A) + .isEnabled() + .isPart1() + .isPart2() + .isLevelA(); + } + + @Test + public void checkPDFA1b() { + new PDFAModeChecker(PDFAMode.PDFA_1B) + .isEnabled() + .isPart1() + .isPart2() + .isNotLevelA(); + } + + @Test + public void checkPDFA2a() { + new PDFAModeChecker(PDFAMode.PDFA_2A) + .isEnabled() + .isNotPart1() + .isPart2() + .isLevelA(); + } + + @Test + public void checkPDFA2b() { + new PDFAModeChecker(PDFAMode.PDFA_2B) + .isEnabled() + .isNotPart1() + .isPart2() + .isNotLevelA(); + } + + @Test + public void checkPDFA2u() { + new PDFAModeChecker(PDFAMode.PDFA_2U) + .isEnabled() + .isNotPart1() + .isPart2() + .isNotLevelA() + .hasConformanceLevel('U'); + } + +} diff --git a/src/test/java/org/apache/fop/pdf/PDFArrayTestCase.java b/src/test/java/org/apache/fop/pdf/PDFArrayTestCase.java new file mode 100644 index 000000000..53e9bdba0 --- /dev/null +++ b/src/test/java/org/apache/fop/pdf/PDFArrayTestCase.java @@ -0,0 +1,237 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.pdf; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +/** + * Test case for {@link PDFArray}. + */ +public class PDFArrayTestCase extends PDFObjectTestCase { + private PDFArray intArray; + private String intArrayOutput; + private PDFArray doubleArray; + private String doubleArrayOutput; + private PDFArray collectionArray; + private String collectionArrayOutput; + private PDFArray objArray; + private String objArrayOutput; + + /** A PDF object used solely for testing */ + private PDFNumber num; + + @Before + public void setUp() { + intArray = new PDFArray(parent, new int[] {1, 2, 3, 4, 5}); + intArrayOutput = "[1 2 3 4 5]"; + + doubleArray = new PDFArray(parent, new double[] {1.1, 2.2, 3.3, 4.4, 5.5}); + doubleArrayOutput = "[1.1 2.2 3.3 4.4 5.5]"; + + List<Object> strList = new ArrayList<Object>(); + strList.add("one"); + strList.add("two"); + strList.add("three"); + collectionArray = new PDFArray(parent, strList); + collectionArrayOutput = "[(one) (two) (three)]"; + + // Set arbitrary values here + num = new PDFNumber(); + num.setNumber(20); + num.setObjectNumber(4); + objArray = new PDFArray(parent, new Object[] {"one", 2, 3.0f, num}); + objArrayOutput = "[(one) 2 3 4 0 R]"; + + // set the document + intArray.setDocument(doc); + doubleArray.setDocument(doc); + collectionArray.setDocument(doc); + objArray.setDocument(doc); + + // Test the progenitor in the inheritance stack + objArray.setParent(parent); + pdfObjectUnderTest = objArray; + } + + private void intArrayContainsTests() { + for (int i = 1; i <= 5; i++) { + assertTrue(intArray.contains(i)); + } + assertFalse(intArray.contains(6)); + assertFalse(intArray.contains(0)); + } + + private void doubleArrayContainsTests() { + assertTrue(doubleArray.contains(1.1)); + assertTrue(doubleArray.contains(2.2)); + assertTrue(doubleArray.contains(3.3)); + assertTrue(doubleArray.contains(4.4)); + assertTrue(doubleArray.contains(5.5)); + assertFalse(doubleArray.contains(10.0)); + assertFalse(doubleArray.contains(0.0)); + } + + private void collectionArrayContainsTests() { + assertTrue(collectionArray.contains("one")); + assertTrue(collectionArray.contains("two")); + assertTrue(collectionArray.contains("three")); + assertFalse(collectionArray.contains("zero")); + assertFalse(collectionArray.contains("four")); + } + + private void objectArrayContainsTests() { + assertTrue(objArray.contains("one")); + assertTrue(objArray.contains(2)); + assertTrue(objArray.contains(3.0f)); + assertTrue(objArray.contains(num)); + assertFalse(objArray.contains("four")); + assertFalse(objArray.contains(0.0)); + } + + /** + * Test contains() - test whether this PDFArray contains an object. + */ + @Test + public void testContains() { + // Test some arbitrary values + intArrayContainsTests(); + doubleArrayContainsTests(); + collectionArrayContainsTests(); + objectArrayContainsTests(); + } + + /** + * Test length() - tests the length of an array. + */ + @Test + public void testLength() { + assertEquals(5, intArray.length()); + assertEquals(5, doubleArray.length()); + assertEquals(3, collectionArray.length()); + assertEquals(4, objArray.length()); + + // Test the count is incremented when an object is added (this only + // needs to be tested once) + intArray.add(6); + assertEquals(6, intArray.length()); + } + + /** + * Test set() - tests that a particular point has been properly set. + */ + @Test + public void testSet() { + PDFName name = new PDFName("zero test"); + objArray.set(0, name); + assertEquals(name, objArray.get(0)); + + objArray.set(1, "test"); + assertEquals("test", objArray.get(1)); + // This goes through the set(int, double) code path rather than set(int, Object) + objArray.set(2, 5); + assertEquals(5.0, objArray.get(2)); + try { + objArray.set(4, 2); + fail("out of bounds"); + } catch (IndexOutOfBoundsException e) { + // Pass + } + } + + /** + * Test get() - gets the object stored at a given index. + */ + @Test + public void testGet() { + // Test some arbitrary values + for (int i = 1; i <= 5; i++) { + assertEquals(i, intArray.get(i - 1)); + } + + assertEquals(1.1, doubleArray.get(0)); + assertEquals(2.2, doubleArray.get(1)); + assertEquals(3.3, doubleArray.get(2)); + assertEquals(4.4, doubleArray.get(3)); + assertEquals(5.5, doubleArray.get(4)); + + assertEquals("one", collectionArray.get(0)); + assertEquals("two", collectionArray.get(1)); + assertEquals("three", collectionArray.get(2)); + + assertEquals("one", objArray.get(0)); + assertEquals(2, objArray.get(1)); + assertEquals(0, Double.compare(3.0, (Float) objArray.get(2))); + assertEquals(num, objArray.get(3)); + } + + /** + * Tests add() - tests that objects are appended to the end of the array as expected. + */ + @Test + public void testAdd() { + intArray.add(new Integer(6)); + doubleArray.add(6.6); + // Test some arbitrary values + for (int i = 1; i <= 6; i++) { + assertEquals(i, intArray.get(i - 1)); + } + + assertEquals(1.1, doubleArray.get(0)); + assertEquals(2.2, doubleArray.get(1)); + assertEquals(3.3, doubleArray.get(2)); + assertEquals(4.4, doubleArray.get(3)); + assertEquals(5.5, doubleArray.get(4)); + assertEquals(6.6, doubleArray.get(5)); + + collectionArray.add(1); + assertEquals("one", collectionArray.get(0)); + assertEquals("two", collectionArray.get(1)); + assertEquals("three", collectionArray.get(2)); + assertEquals(1.0, collectionArray.get(3)); + + objArray.add("four"); + assertEquals("one", objArray.get(0)); + assertEquals(2, objArray.get(1)); + assertEquals(0, Double.compare(3.0, (Float) objArray.get(2))); + assertEquals("four", objArray.get(4)); + } + + /** + * Tests output() - tests that this object is properly streamed to the PDF document. + * @throws IOException error caused by I/O + */ + @Test + public void testOutput() throws IOException { + testOutputStreams(intArrayOutput, intArray); + testOutputStreams(doubleArrayOutput, doubleArray); + testOutputStreams(collectionArrayOutput, collectionArray); + testOutputStreams(objArrayOutput, objArray); + } +} diff --git a/src/test/java/org/apache/fop/pdf/PDFAttachmentTestCase.java b/src/test/java/org/apache/fop/pdf/PDFAttachmentTestCase.java new file mode 100644 index 000000000..8915ba934 --- /dev/null +++ b/src/test/java/org/apache/fop/pdf/PDFAttachmentTestCase.java @@ -0,0 +1,61 @@ +/* + * 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. + */ + +/* $Id$ */ +package org.apache.fop.pdf; + +import java.awt.Dimension; +import java.awt.Rectangle; +import java.io.ByteArrayOutputStream; +import java.io.File; + +import javax.xml.transform.stream.StreamResult; + +import org.junit.Test; + +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.apps.FopFactory; +import org.apache.fop.fonts.FontInfo; +import org.apache.fop.render.intermediate.IFContext; +import org.apache.fop.render.intermediate.IFException; +import org.apache.fop.render.intermediate.extensions.Link; +import org.apache.fop.render.intermediate.extensions.URIAction; +import org.apache.fop.render.pdf.PDFDocumentHandler; +import org.apache.fop.render.pdf.extensions.PDFEmbeddedFileAttachment; + +import junit.framework.Assert; + +public class PDFAttachmentTestCase { + private FOUserAgent ua = FopFactory.newInstance(new File(".").toURI()).newFOUserAgent(); + + @Test + public void testAddEmbeddedFile() throws IFException { + PDFDocumentHandler docHandler = new PDFDocumentHandler(new IFContext(ua)); + docHandler.setFontInfo(new FontInfo()); + ByteArrayOutputStream out = new ByteArrayOutputStream(); + docHandler.setResult(new StreamResult(out)); + docHandler.startDocument(); + docHandler.startPage(0, "", "", new Dimension()); + docHandler.handleExtensionObject(new PDFEmbeddedFileAttachment("filename", "src", "desc")); + docHandler.getDocumentNavigationHandler().renderLink(new Link( + new URIAction("embedded-file:filename", false), new Rectangle())); + docHandler.endDocument(); + Assert.assertTrue(out.toString().contains("<<\n /Type /Filespec\n /F (filename)")); + Assert.assertTrue(out.toString().contains("<<\n/S /JavaScript\n" + + "/JS (this.exportDataObject({cName:\"filename\", nLaunch:2});)\n>>")); + } +} diff --git a/src/test/java/org/apache/fop/pdf/PDFDestsTestCase.java b/src/test/java/org/apache/fop/pdf/PDFDestsTestCase.java new file mode 100644 index 000000000..4655b258d --- /dev/null +++ b/src/test/java/org/apache/fop/pdf/PDFDestsTestCase.java @@ -0,0 +1,64 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.pdf; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import org.junit.Before; +import org.junit.Test; + +/** + * Test case for {@link PDFDests}. + */ +public class PDFDestsTestCase extends PDFObjectTestCase { + + private PDFDests dests = new PDFDests(); + private String expectedString = "<< /Names [(number) 10 (name) /Test#20name] >>"; + + @Before + public void setUp() { + List<PDFDestination> destinations = new ArrayList<PDFDestination>(); + PDFNumber number = new PDFNumber(); + number.setNumber(10); + PDFDestination testNumber = new PDFDestination("number", number); + testNumber.setDocument(doc); + destinations.add(testNumber); + PDFDestination testName = new PDFDestination("name", new PDFName("Test name")); + testName.setDocument(doc); + destinations.add(testName); + + dests = new PDFDests(destinations); + dests.setDocument(doc); + dests.setParent(parent); + pdfObjectUnderTest = dests; + } + + /** + * Populate the object with some arbitrary values and ensure they are wrapped properly. + * @throws IOException if an I/O error occurs + */ + @Test + public void testConstructor() throws IOException { + // Seems the only way to test this is by testing the output + testOutputStreams(expectedString, dests); + } +} diff --git a/src/test/java/org/apache/fop/pdf/PDFDictionaryTestCase.java b/src/test/java/org/apache/fop/pdf/PDFDictionaryTestCase.java new file mode 100644 index 000000000..cc2352300 --- /dev/null +++ b/src/test/java/org/apache/fop/pdf/PDFDictionaryTestCase.java @@ -0,0 +1,135 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.pdf; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.fail; + +import org.apache.commons.io.output.CountingOutputStream; + +/** + * Test case for {@link PDFDictionary}. + */ +public class PDFDictionaryTestCase extends PDFObjectTestCase { + /** The test subject */ + private PDFDictionary pdfDictUnderTest; + private PDFArray testArray; + private PDFNumber testNumber; + /** The order in which these objects are put into the dictionary MUST be maintained. */ + private String expectedOutput = "<<\n" + + " /String (TestValue)\n" + + " /int 10\n" + + " /double 3.1\n" + + " /array [1 (two) 20]\n" + + " /number 20\n" + + " /null null\n" + + ">>"; + + @Before + public void setUp() { + // A PDFNumber for testing, this DOES have a parent + testNumber = new PDFNumber(); + testNumber.setParent(parent); + testNumber.setNumber(20); + // An array for testing, this DOES NOT have a parent + testArray = new PDFArray(); + testArray.add(1); + testArray.add("two"); + testArray.add(testNumber); + // Populating the dictionary with a parent, document and the various objects + pdfDictUnderTest = new PDFDictionary(parent); + pdfDictUnderTest.setDocument(doc); + pdfDictUnderTest.put("String", "TestValue"); + pdfDictUnderTest.put("int", 10); + pdfDictUnderTest.put("double", Double.valueOf(3.1)); + pdfDictUnderTest.put("array", testArray); + pdfDictUnderTest.put("number", testNumber); + // null is a valid PDF object + pdfDictUnderTest.put("null", null); + // test that the interface is maintained + pdfObjectUnderTest = pdfDictUnderTest; + } + + /** + * Tests put() - tests that the object is put into the dictionary and it is handled if it is a + * {@link PDFObject}. + */ + @Test + public void testPut() { + // The "put()" commands have already been done in setUp(), so just test them. + assertEquals("TestValue", pdfDictUnderTest.get("String")); + assertEquals(10, pdfDictUnderTest.get("int")); + assertEquals(3.1, pdfDictUnderTest.get("double")); + // With PDFObjects, if they DO NOT have a parent, the dict becomes their parent. + assertEquals(testArray, pdfDictUnderTest.get("array")); + assertEquals(pdfDictUnderTest, testArray.getParent()); + // With PDFObjects, if they DO have a parent, the dict DOES NOT change the parent object. + assertEquals(testNumber, pdfDictUnderTest.get("number")); + // Test it doesn't explode when we try to get a non-existent entry + assertNull(pdfDictUnderTest.get("Not in dictionary")); + // Tests that we can over-write objects + pdfDictUnderTest.put("array", 10); + assertEquals(10, pdfDictUnderTest.get("array")); + // Test that nulls are handled appropriately + assertNull(pdfDictUnderTest.get("null")); + } + + /** + * Tests get() - tests that objects can be properly retrieved from the dictionary. + */ + @Test + public void testGet() { + // Tested fairly comprehensively in testPut(). + } + + /** + * Tests writeDictionary() - tests that the dictionary is properly written to the output-stream. + */ + @Test + public void testWriteDictionary() { + // Ensure that the objects stored in the dictionary are streamed in the correct format. + ByteArrayOutputStream outStream = new ByteArrayOutputStream(); + CountingOutputStream cout = new CountingOutputStream(outStream); + StringBuilder textBuffer = new StringBuilder(); + try { + pdfDictUnderTest.writeDictionary(cout, textBuffer); + PDFDocument.flushTextBuffer(textBuffer, cout); + assertEquals(expectedOutput, outStream.toString()); + } catch (IOException e) { + fail("IOException: " + e.getMessage()); + } + } + + /** + * Tests output() - test that this object can write itself to an output stream. + * @throws IOException error caused by I/O + */ + @Test + public void testOutput() throws IOException { + testOutputStreams(expectedOutput, pdfDictUnderTest); + } +} diff --git a/src/test/java/org/apache/fop/pdf/PDFDocumentGraphics2DTestCase.java b/src/test/java/org/apache/fop/pdf/PDFDocumentGraphics2DTestCase.java new file mode 100644 index 000000000..fd6d8b94b --- /dev/null +++ b/src/test/java/org/apache/fop/pdf/PDFDocumentGraphics2DTestCase.java @@ -0,0 +1,93 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.pdf; + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.Graphics2D; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +import org.apache.commons.io.output.ByteArrayOutputStream; + +import org.apache.xmlgraphics.util.UnitConv; + +import org.apache.fop.svg.PDFDocumentGraphics2D; + +/** + * Tests for {@link PDFDocumentGraphics2D}. + */ +public class PDFDocumentGraphics2DTestCase { + + /** + * Does a smoke test on PDFDocumentGraphics2D making sure that nobody accidentally broke + * anything serious. It does not check the correctness of the produced PDF. + * @throws Exception if an error occurs + */ + @Test + public void smokeTest() throws Exception { + ByteArrayOutputStream baout = new ByteArrayOutputStream(); + PDFDocumentGraphics2D g2d = new PDFDocumentGraphics2D(false); + g2d.setGraphicContext(new org.apache.xmlgraphics.java2d.GraphicContext()); + + //Set up the document size + Dimension pageSize = new Dimension( + (int)Math.ceil(UnitConv.mm2pt(210)), + (int)Math.ceil(UnitConv.mm2pt(297))); //page size A4 (in pt) + g2d.setupDocument(baout, pageSize.width, pageSize.height); + + //A few rectangles rotated and with different color + Graphics2D copy = (Graphics2D)g2d.create(); + int c = 12; + for (int i = 0; i < c; i++) { + float f = ((i + 1) / (float)c); + Color col = new Color(0.0f, 1 - f, 0.0f); + copy.setColor(col); + copy.fillRect(70, 90, 50, 50); + copy.rotate(-2 * Math.PI / c, 70, 90); + } + copy.dispose(); + + //Some text + g2d.rotate(-0.25); + g2d.setColor(Color.RED); + g2d.setFont(new Font("sans-serif", Font.PLAIN, 36)); + g2d.drawString("Hello world!", 140, 140); + g2d.setColor(Color.RED.darker()); + g2d.setFont(new Font("serif", Font.PLAIN, 36)); + g2d.drawString("Hello world!", 140, 180); + + g2d.nextPage(); //Move to next page + + g2d.setFont(new Font("sans-serif", Font.PLAIN, 36)); + g2d.drawString("Welcome to page 2!", 140, 140); + + //Cleanup + g2d.finish(); + + String pdfString = baout.toString("ISO-8859-1"); + assertEquals("%%EOF not found", + pdfString.substring(pdfString.length() - 6), "%%EOF\n"); + } + +} diff --git a/src/test/java/org/apache/fop/pdf/PDFDocumentTestCase.java b/src/test/java/org/apache/fop/pdf/PDFDocumentTestCase.java new file mode 100644 index 000000000..e58201f13 --- /dev/null +++ b/src/test/java/org/apache/fop/pdf/PDFDocumentTestCase.java @@ -0,0 +1,62 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.pdf; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +/** + * Test case for {@link PDFDocument} + */ +public class PDFDocumentTestCase { + + /** + * Test flushTextBuffer() - ensure that the text given will stream to the PDF document as + * expected. + * @throws IOException when an I/O error occurs + */ + @Test + public void testFlushTextBuffer() throws IOException { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + StringBuilder textBuffer = new StringBuilder(); + String testString = "This is a test string, just some arbitrary data."; + textBuffer.append(testString); + + PDFDocument.flushTextBuffer(textBuffer, out); + assertEquals(testString, out.toString()); + + // Should reset the textBuffer + assertEquals(0, textBuffer.length()); + assertEquals("", textBuffer.toString()); + out.reset(); + + String[] strArray = { "Try ", "with ", "multiple ", "strings." }; + for (String str : strArray) { + textBuffer.append(str); + } + String fullString = textBuffer.toString(); + PDFDocument.flushTextBuffer(textBuffer, out); + assertEquals(fullString, out.toString()); + } +} diff --git a/src/test/java/org/apache/fop/pdf/PDFEncodingTestCase.java b/src/test/java/org/apache/fop/pdf/PDFEncodingTestCase.java new file mode 100644 index 000000000..2f80b077c --- /dev/null +++ b/src/test/java/org/apache/fop/pdf/PDFEncodingTestCase.java @@ -0,0 +1,76 @@ +/* + * 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.fop.pdf; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; + +import org.apache.fop.fonts.CodePointMapping; + +public class PDFEncodingTestCase { + + /** + * Tests the createPDFEncoding method to ensure a null encoding type + * is handled correctly. + */ + @Test + public void testCreatePDFEncodingForNull() { + Object encoding = PDFEncoding.createPDFEncoding(null, "Test"); + assertEquals(encoding, null); + } + + /** + * Tests that when a PDFEncoding object is created, if the encoding type is + * that of StandardEncoding, the baseEncoding tag is omitted. + */ + @Test + public void testStandardEncodingDiffs() { + Object encoding = PDFEncoding.createPDFEncoding(CodePointMapping.getMapping( + CodePointMapping.SYMBOL_ENCODING), "Test"); + if (encoding instanceof PDFEncoding) { + PDFEncoding pdfEncoding = (PDFEncoding) encoding; + assertFalse(pdfEncoding.entries.containsKey("BaseEncoding")); + } + } + + /** + * Tests that when the StandardEncoding type is provided and there are no + * differences, the returned encoding object is null. + */ + @Test + public void testStandardEncodingNoDiff() { + Object encoding = PDFEncoding.createPDFEncoding(CodePointMapping.getMapping( + CodePointMapping.STANDARD_ENCODING), "Test"); + assertEquals(encoding, null); + } + + /** + * Tests that when the SymbolEncoding type is provided and there are no + * differences, the returned encoding string is that of SymbolEncoding. + */ + @Test + public void testCreatePDFEncodingSymbol() { + Object encoding = PDFEncoding.createPDFEncoding(CodePointMapping.getMapping( + CodePointMapping.SYMBOL_ENCODING), "Symbol"); + assert (encoding instanceof String); + String pdfEncoding = (String) encoding; + assertEquals(pdfEncoding, "SymbolEncoding"); + } +} diff --git a/src/test/java/org/apache/fop/pdf/PDFEncryptionJCETestCase.java b/src/test/java/org/apache/fop/pdf/PDFEncryptionJCETestCase.java new file mode 100644 index 000000000..18d15c384 --- /dev/null +++ b/src/test/java/org/apache/fop/pdf/PDFEncryptionJCETestCase.java @@ -0,0 +1,647 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.pdf; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.security.InvalidAlgorithmParameterException; +import java.security.InvalidKeyException; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.Arrays; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import javax.crypto.BadPaddingException; +import javax.crypto.Cipher; +import javax.crypto.IllegalBlockSizeException; +import javax.crypto.NoSuchPaddingException; +import javax.crypto.spec.IvParameterSpec; +import javax.crypto.spec.SecretKeySpec; + +import org.junit.Test; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +/** + * Tests the {@link PDFEncryptionJCE} class. + */ +public class PDFEncryptionJCETestCase { + + private EncryptionTest test; + + private PDFEncryptionJCE encryptionObject; + + private static final class EncryptionTest { + + private int objectNumber = 1; + + private final PDFEncryptionParams encryptionParameters = new PDFEncryptionParams(); + + private byte[] data; + + private byte[] encryptedData; + + private final EncryptionDictionaryTester encryptionDictionaryTester; + + EncryptionTest() { + this(new EncryptionDictionaryTester()); + } + + EncryptionTest(EncryptionDictionaryTester encryptionDictionaryTester) { + encryptionParameters.setUserPassword("TestUserPassword"); + encryptionParameters.setOwnerPassword("TestOwnerPassword"); + setData(0x00, 0xAA, 0xFF, 0x55, 0xCC, 0x33, 0xF0); + this.encryptionDictionaryTester = encryptionDictionaryTester; + this.encryptionDictionaryTester.setLength( + encryptionParameters.getEncryptionLengthInBits()); + } + + int getObjectNumber() { + return objectNumber; + } + + EncryptionTest setObjectNumber(int objectNumber) { + this.objectNumber = objectNumber; + return this; + } + + byte[] getData() { + return data; + } + + EncryptionTest setData(int... data) { + /* + * Use an array of int to avoid having to cast some elements to byte in the + * method call. + */ + this.data = convertIntArrayToByteArray(data); + return this; + } + + byte[] getEncryptedData() { + return encryptedData; + } + + EncryptionTest setEncryptedData(int... encryptedData) { + this.encryptedData = convertIntArrayToByteArray(encryptedData); + return this; + } + + private byte[] convertIntArrayToByteArray(int[] intArray) { + byte[] byteArray = new byte[intArray.length]; + for (int i = 0; i < intArray.length; i++) { + byteArray[i] = (byte) intArray[i]; + } + return byteArray; + } + + PDFEncryptionParams getEncryptionParameters() { + return encryptionParameters; + } + + EncryptionTest setUserPassword(String userPassword) { + encryptionParameters.setUserPassword(userPassword); + return this; + } + + EncryptionTest setOwnerPassword(String ownerPassword) { + encryptionParameters.setOwnerPassword(ownerPassword); + return this; + } + + EncryptionTest setEncryptionLength(int encryptionLength) { + encryptionParameters.setEncryptionLengthInBits(encryptionLength); + encryptionDictionaryTester.setLength(encryptionLength); + return this; + } + + EncryptionTest disablePrint() { + encryptionParameters.setAllowPrint(false); + return this; + } + + EncryptionTest disableEditContent() { + encryptionParameters.setAllowEditContent(false); + return this; + } + + EncryptionTest disableCopyContent() { + encryptionParameters.setAllowCopyContent(false); + return this; + } + + EncryptionTest disableEditAnnotations() { + encryptionParameters.setAllowEditAnnotations(false); + return this; + } + + EncryptionTest disableFillInForms() { + encryptionParameters.setAllowFillInForms(false); + return this; + } + + EncryptionTest disableAccessContent() { + encryptionParameters.setAllowAccessContent(false); + return this; + } + + EncryptionTest disableAssembleDocument() { + encryptionParameters.setAllowAssembleDocument(false); + return this; + } + + EncryptionTest disablePrintHq() { + encryptionParameters.setAllowPrintHq(false); + return this; + } + + void testEncryptionDictionary(PDFEncryptionJCE encryptionObject) { + encryptionDictionaryTester.test(encryptionObject); + } + } + + private static final class EncryptionDictionaryTester { + + private int version = 2; + + private int revision = 3; + + private int length = 128; + + private int permissions = -4; + + private String ownerEntry = "D9A98017F0500EF9B69738641C9B4CBA1229EDC3F2151BC6C9C4FB07B1CB315E"; + + private String userEntry = "D3EF424BFEA2E434000E1A74941CC87300000000000000000000000000000000"; + + EncryptionDictionaryTester setVersion(int version) { + this.version = version; + return this; + } + + EncryptionDictionaryTester setRevision(int revision) { + this.revision = revision; + return this; + } + + EncryptionDictionaryTester setLength(int length) { + this.length = length; + return this; + } + + EncryptionDictionaryTester setPermissions(int permissions) { + this.permissions = permissions; + return this; + } + + EncryptionDictionaryTester setOwnerEntry(String ownerEntry) { + this.ownerEntry = ownerEntry; + return this; + } + + EncryptionDictionaryTester setUserEntry(String userEntry) { + this.userEntry = userEntry; + return this; + } + + void test(PDFEncryptionJCE encryptionObject) { + byte[] encryptionDictionary = encryptionObject.toPDF(); + RegexTestedCharSequence dictionary = new RegexTestedCharSequence(encryptionDictionary); + + final String whitespace = "\\s+"; + final String digits = "\\d+"; + final String hexDigits = "\\p{XDigit}+"; + + dictionary.mustContain("/Filter" + whitespace + "/Standard\\b"); + + dictionary.mustContain("/V" + whitespace + "(" + digits + ")") + .withGroup1EqualTo(Integer.toString(version)); + + dictionary.mustContain("/R" + whitespace + "(" + digits + ")") + .withGroup1EqualTo(Integer.toString(revision)); + + dictionary.mustContain("/Length" + whitespace + "(" + digits + ")") + .withGroup1EqualTo(Integer.toString(length)); + + dictionary.mustContain("/P" + whitespace + "(-?" + digits + ")") + .withGroup1EqualTo(Integer.toString(permissions)); + + dictionary.mustContain("/O" + whitespace + "<(" + hexDigits + ")>") + .withGroup1EqualTo(ownerEntry); + + dictionary.mustContain("/U" + whitespace + "<(" + hexDigits + ")>") + .withGroup1EqualTo(userEntry); + } + } + + private static final class RegexTestedCharSequence { + + private final String string; + + private Matcher matcher; + + RegexTestedCharSequence(byte[] bytes) { + try { + string = new String(bytes, "US-ASCII"); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(e); + } + } + + RegexTestedCharSequence mustContain(String regex) { + Pattern pattern = Pattern.compile(regex); + matcher = pattern.matcher(string); + assertTrue(matcher.find()); + return this; + } + + RegexTestedCharSequence withGroup1EqualTo(String expected) { + assertEquals(expected, matcher.group(1)); + return this; + } + } + + @Test + public final void testMake() { + PDFEncryption testEncryptionObj = createEncryptionObject(new PDFEncryptionParams()); + assertTrue(testEncryptionObj instanceof PDFEncryptionJCE); + assertEquals(1, ((PDFEncryptionJCE) testEncryptionObj).getObjectNumber().getNumber()); + } + + @Test + public void testBasic() throws IOException { + test = new EncryptionTest(); + test.setData(0x00).setEncryptedData(0x24); + runEncryptionTests(); + + test.setData(0xAA).setEncryptedData(0x8E); + runEncryptionTests(); + + test.setData(0xFF).setEncryptedData(0xDB); + runEncryptionTests(); + + test = new EncryptionTest().setEncryptedData(0x24, 0x07, 0x85, 0xF7, 0x87, 0x31, 0x90); + runEncryptionTests(); + } + + @Test + public void test128bit() throws IOException { + EncryptionDictionaryTester encryptionDictionaryTester = new EncryptionDictionaryTester() + .setVersion(2) + .setRevision(3) + .setPermissions(-4) + .setOwnerEntry("D9A98017F0500EF9B69738641C9B4CBA1229EDC3F2151BC6C9C4FB07B1CB315E") + .setUserEntry("D3EF424BFEA2E434000E1A74941CC87300000000000000000000000000000000"); + test = new EncryptionTest(encryptionDictionaryTester) + .setObjectNumber(2) + .setEncryptionLength(128) + .setEncryptedData(0xE3, 0xCB, 0xB2, 0x55, 0xD9, 0x26, 0x55); + runEncryptionTests(); + } + + @Test + public void testDisableRev2Permissions() throws IOException { + EncryptionDictionaryTester encryptionDictionaryTester = new EncryptionDictionaryTester() + .setVersion(1) + .setRevision(2) + .setLength(40) + .setPermissions(-64) + .setOwnerEntry("3EE8C4000CA44B2645EED029C9EA7D4FC63C6D9B89349E8FA5A40C7691AB96B5") + .setUserEntry("3E65D0090746C4C37C5EF23C1BDB6323E00C24C4B2D744DD3BFB654CD58591A1"); + test = new EncryptionTest(encryptionDictionaryTester).setObjectNumber(3).setEncryptionLength(40) + .disablePrint().disableEditContent().disableCopyContent().disableEditAnnotations() + .setEncryptedData(0x66, 0xEE, 0xA7, 0x93, 0xC4, 0xB1, 0xB4); + runEncryptionTests(); + } + + @Test + public void testDisableRev3Permissions() throws IOException { + EncryptionDictionaryTester encryptionDictionaryTester = new EncryptionDictionaryTester() + .setVersion(2) + .setRevision(3) + .setLength(40) + .setPermissions(-3844) + .setOwnerEntry("8D4BCA4F4AB2BAB4E38F161D61F937EC50BE5EB30C2DC05EA409D252CD695E55") + .setUserEntry("0F01171E22C7FB27B079C132BA4277DE00000000000000000000000000000000"); + test = new EncryptionTest(encryptionDictionaryTester) + .setObjectNumber(4) + .setEncryptionLength(40) + .disableFillInForms() + .disableAccessContent() + .disableAssembleDocument() + .disablePrintHq() + .setEncryptedData(0x8E, 0x3C, 0xD2, 0x05, 0x50, 0x48, 0x82); + runEncryptionTests(); + } + + @Test + public void test128bitDisableSomePermissions() throws IOException { + EncryptionDictionaryTester encryptionDictionaryTester = new EncryptionDictionaryTester() + .setVersion(2) + .setRevision(3) + .setPermissions(-1304) + .setOwnerEntry("D9A98017F0500EF9B69738641C9B4CBA1229EDC3F2151BC6C9C4FB07B1CB315E") + .setUserEntry("62F0E4D8641D482E0F8E71A89270045A00000000000000000000000000000000"); + test = new EncryptionTest(encryptionDictionaryTester) + .setObjectNumber(5) + .setEncryptionLength(128) + .disablePrint() + .disableCopyContent() + .disableFillInForms() + .disableAssembleDocument() + .setEncryptedData(0xF7, 0x85, 0x4F, 0xB0, 0x50, 0x5C, 0xDF); + runEncryptionTests(); + } + + @Test + public void testDifferentPasswords() throws IOException { + EncryptionDictionaryTester encryptionDictionaryTester = new EncryptionDictionaryTester() + .setRevision(2) + .setVersion(1) + .setLength(40) + .setOwnerEntry("D11C233C65E9DC872E858ABBD8B62198771167ADCE7AB8DC7AE0A1A7E21A1E25") + .setUserEntry("6F449167DB8DDF0D2DF4602DDBBA97ABF9A9101F632CC16AB0BE74EB9500B469"); + test = new EncryptionTest(encryptionDictionaryTester) + .setObjectNumber(6) + .setEncryptionLength(40) + .setUserPassword("ADifferentUserPassword") + .setOwnerPassword("ADifferentOwnerPassword") + .setEncryptedData(0x27, 0xAC, 0xB1, 0x6C, 0x42, 0xE0, 0xA8); + runEncryptionTests(); + } + + @Test + public void testNoOwnerPassword() throws IOException { + EncryptionDictionaryTester encryptionDictionaryTester = new EncryptionDictionaryTester() + .setRevision(2) + .setVersion(1) + .setLength(40) + .setOwnerEntry("5163AAF3EE74C76D7C223593A84C8702FEA8AA4493E4933FF5B5A5BBB20AE4BB") + .setUserEntry("42DDF1C1BF3AB04786D5038E7B0A723AE614D944E1DE91A922FC54F5F2345E00"); + test = new EncryptionTest(encryptionDictionaryTester) + .setObjectNumber(7) + .setEncryptionLength(40) + .setUserPassword("ADifferentUserPassword") + .setOwnerPassword("") + .setEncryptedData(0xEC, 0x2E, 0x5D, 0xC2, 0x7F, 0xAD, 0x58); + runEncryptionTests(); + } + + @Test + public void test128bitDisableSomePermissionsDifferentPasswords() throws IOException { + EncryptionDictionaryTester encryptionDictionaryTester = new EncryptionDictionaryTester() + .setVersion(2) + .setRevision(3) + .setPermissions(-2604) + .setOwnerEntry("F83CA049FAA2F774F8541F25E746A92EE2A7F060C46C91C693E673BF18FF7B36") + .setUserEntry("88A4C58F5385B5F08FACA0636D790EDF00000000000000000000000000000000"); + test = new EncryptionTest(encryptionDictionaryTester) + .setObjectNumber(8) + .setUserPassword("ADifferentUserPassword") + .setOwnerPassword("ADifferentOwnerPassword") + .setEncryptionLength(128) + .disableEditContent() + .disableEditAnnotations() + .disableAccessContent() + .disablePrintHq() + .setEncryptedData(0x77, 0x54, 0x67, 0xA5, 0xCC, 0x73, 0xDE); + runEncryptionTests(); + } + + @Test + public void test128bitNoPermissionNoOwnerPassword() throws IOException { + EncryptionDictionaryTester encryptionDictionaryTester = new EncryptionDictionaryTester() + .setVersion(2) + .setRevision(3) + .setPermissions(-3904) + .setOwnerEntry("3EEB3FA5594CBD935BFB2F83FB184DD41FBCD7C36A04F1FFD0899B0DFFCFF96B") + .setUserEntry("D972B72DD2633F613B0DDB7511C719C500000000000000000000000000000000"); + test = new EncryptionTest(encryptionDictionaryTester) + .setObjectNumber(9) + .setUserPassword("ADifferentUserPassword") + .setOwnerPassword("") + .setEncryptionLength(128) + .disablePrint() + .disableEditContent() + .disableCopyContent() + .disableEditAnnotations() + .disableFillInForms() + .disableAccessContent() + .disableAssembleDocument() + .disablePrintHq() + .setEncryptedData(0x0C, 0xAD, 0x49, 0xC7, 0xE5, 0x05, 0xB8); + runEncryptionTests(); + } + + @Test + public void testAES256() throws UnsupportedEncodingException, NoSuchAlgorithmException, + NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException, + IllegalBlockSizeException, BadPaddingException { + MessageDigest sha256 = MessageDigest.getInstance("SHA-256"); + String dataText = "Test data to encrypt."; + byte[] data = dataText.getBytes("UTF-8"); + PDFEncryptionParams params = new PDFEncryptionParams(); + params.setEncryptionLengthInBits(256); + params.setUserPassword("userpassword"); + params.setOwnerPassword("ownerpassword"); + PDFEncryptionJCE encryption = createEncryptionObject(params); + PDFText text = new PDFText(); + text.setObjectNumber(1); // obj number not used with AES 256, can be anything + String dictionary = new String(encryption.toPDF()); + byte[] encrypted = encryption.encrypt(data, text); + byte[] u = parseHexStringEntries(dictionary, "U"); + byte[] o = parseHexStringEntries(dictionary, "O"); + byte[] ue = parseHexStringEntries(dictionary, "UE"); + byte[] oe = parseHexStringEntries(dictionary, "OE"); + byte[] perms = parseHexStringEntries(dictionary, "Perms"); + // check byte arrays lengths + assertEquals(48, u.length); + assertEquals(48, o.length); + assertEquals(32, ue.length); + assertEquals(32, oe.length); + assertEquals(16, perms.length); + // check user password is valid + byte[] userValSalt = new byte[8]; + byte[] userKeySalt = new byte[8]; + System.arraycopy(u, 32, userValSalt, 0, 8); + System.arraycopy(u, 40, userKeySalt, 0, 8); + byte[] uPassBytes = params.getUserPassword().getBytes("UTF-8"); + byte[] testUPass = new byte[uPassBytes.length + 8]; + System.arraycopy(uPassBytes, 0, testUPass, 0, uPassBytes.length); + System.arraycopy(userValSalt, 0, testUPass, uPassBytes.length, 8); + sha256.reset(); + sha256.update(testUPass); + byte[] actualUPass = sha256.digest(); + byte[] expectedUPass = new byte[32]; + System.arraycopy(u, 0, expectedUPass, 0, 32); + assertArrayEquals(expectedUPass, actualUPass); + // check owner password is valid + byte[] ownerValSalt = new byte[8]; + byte[] ownerKeySalt = new byte[8]; + System.arraycopy(o, 32, ownerValSalt, 0, 8); + System.arraycopy(o, 40, ownerKeySalt, 0, 8); + byte[] oPassBytes = params.getOwnerPassword().getBytes("UTF-8"); + byte[] testOPass = new byte[oPassBytes.length + 8 + 48]; + System.arraycopy(oPassBytes, 0, testOPass, 0, oPassBytes.length); + System.arraycopy(ownerValSalt, 0, testOPass, oPassBytes.length, 8); + System.arraycopy(u, 0, testOPass, oPassBytes.length + 8, 48); + sha256.reset(); + sha256.update(testOPass); + byte[] actualOPass = sha256.digest(); + byte[] expectedOPass = new byte[32]; + System.arraycopy(o, 0, expectedOPass, 0, 32); + assertArrayEquals(expectedOPass, actualOPass); + // compute encryption key from ue + byte[] ivZero = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + IvParameterSpec ivspecZero = new IvParameterSpec(ivZero); + Cipher cipherNoPadding = Cipher.getInstance("AES/CBC/NoPadding"); + byte[] tmpUKey = new byte[uPassBytes.length + 8]; + System.arraycopy(uPassBytes, 0, tmpUKey, 0, uPassBytes.length); + System.arraycopy(userKeySalt, 0, tmpUKey, uPassBytes.length, 8); + sha256.reset(); + sha256.update(tmpUKey); + byte[] intUKey = sha256.digest(); + SecretKeySpec uSKeySpec = new SecretKeySpec(intUKey, "AES"); + cipherNoPadding.init(Cipher.DECRYPT_MODE, uSKeySpec, ivspecZero); + byte[] uFileEncryptionKey = cipherNoPadding.doFinal(ue); + // compute encryption key from oe + byte[] tmpOKey = new byte[oPassBytes.length + 8 + 48]; + System.arraycopy(oPassBytes, 0, tmpOKey, 0, oPassBytes.length); + System.arraycopy(ownerKeySalt, 0, tmpOKey, oPassBytes.length, 8); + System.arraycopy(u, 0, tmpOKey, oPassBytes.length + 8, 48); + sha256.reset(); + sha256.update(tmpOKey); + byte[] intOKey = sha256.digest(); + SecretKeySpec oSKeySpec = new SecretKeySpec(intOKey, "AES"); + cipherNoPadding.init(Cipher.DECRYPT_MODE, oSKeySpec, ivspecZero); + byte[] oFileEncryptionKey = cipherNoPadding.doFinal(oe); + // check both keys are the same + assertArrayEquals(uFileEncryptionKey, oFileEncryptionKey); + byte[] fileEncryptionKey = new byte[uFileEncryptionKey.length]; + System.arraycopy(uFileEncryptionKey, 0, fileEncryptionKey, 0, uFileEncryptionKey.length); + // decrypt perms + SecretKeySpec sKeySpec = new SecretKeySpec(fileEncryptionKey, "AES"); + cipherNoPadding.init(Cipher.DECRYPT_MODE, sKeySpec, ivspecZero); + byte[] decryptedPerms = cipherNoPadding.doFinal(perms); + assertEquals('T', decryptedPerms[8]); // metadata encrypted by default + assertEquals('a', decryptedPerms[9]); + assertEquals('d', decryptedPerms[10]); + assertEquals('b', decryptedPerms[11]); + int expectedPermissions = -4; // default if nothing set + int actualPermissions = decryptedPerms[3] << 24 | (decryptedPerms[2] & 0xFF) << 16 + | (decryptedPerms[1] & 0xFF) << 8 | (decryptedPerms[0] & 0xFF); + assertEquals(expectedPermissions, actualPermissions); + // decrypt data + byte[] iv = new byte[16]; + System.arraycopy(encrypted, 0, iv, 0, 16); + byte[] encryptedData = new byte[encrypted.length - 16]; + System.arraycopy(encrypted, 16, encryptedData, 0, encrypted.length - 16); + IvParameterSpec ivspec = new IvParameterSpec(iv); + Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); + cipher.init(Cipher.DECRYPT_MODE, sKeySpec, ivspec); + byte[] decryptedData = cipher.doFinal(encryptedData); + assertArrayEquals(data, decryptedData); + } + + private byte[] parseHexStringEntries(String dictionary, String entry) throws UnsupportedEncodingException { + String token = "/" + entry + " <"; + int start = dictionary.indexOf(token) + token.length(); + int end = dictionary.indexOf(">", start); + String parsedEntry = dictionary.substring(start, end); + int length = parsedEntry.length(); + byte[] data = new byte[length / 2]; + for (int i = 0; i < length; i += 2) { + data[i / 2] = (byte) ((Character.digit(parsedEntry.charAt(i), 16) << 4) + Character.digit( + parsedEntry.charAt(i + 1), 16)); + } + return data; + } + + /** + * Creates an encryption object using a fixed file ID generator for test reproducibility. + * + * @param params the encryption parameters + * @return PDFEncryptionJCE the encryption object + */ + private PDFEncryptionJCE createEncryptionObject(PDFEncryptionParams params) { + PDFDocument doc = new PDFDocument("Apache FOP") { + + @Override + FileIDGenerator getFileIDGenerator() { + return new FileIDGenerator() { + + private final byte[] fixedFileID = new byte[] { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F}; + + @Override + byte[] getOriginalFileID() { + return fixedFileID; + } + + @Override + byte[] getUpdatedFileID() { + return fixedFileID; + } + + }; + } + }; + return (PDFEncryptionJCE) PDFEncryptionJCE.make(new PDFObjectNumber(1), params, doc); + } + + private void runEncryptionTests() throws IOException { + encryptionObject = createEncryptionObject(test.getEncryptionParameters()); + runEncryptTest(); + runFilterTest(); + runEncryptionDictionaryTest(); + } + + private void runEncryptTest() { + PDFText text = new PDFText(); + text.setObjectNumber(test.getObjectNumber()); + byte[] byteResult = encryptionObject.encrypt(test.getData(), text); + + assertTrue(Arrays.equals(test.getEncryptedData(), byteResult)); + } + + private void runFilterTest() throws IOException { + PDFStream stream = new PDFStream(); + stream.setDocument(encryptionObject.getDocumentSafely()); + stream.setObjectNumber(test.getObjectNumber()); + stream.setData(test.getData()); + encryptionObject.applyFilter(stream); + + StreamCache streamCache = stream.encodeStream(); + ByteArrayOutputStream testOutputStream = new ByteArrayOutputStream(); + streamCache.outputContents(testOutputStream); + + assertTrue(Arrays.equals(test.getEncryptedData(), testOutputStream.toByteArray())); + } + + private void runEncryptionDictionaryTest() { + test.testEncryptionDictionary(encryptionObject); + } + +} diff --git a/src/test/java/org/apache/fop/pdf/PDFFactoryTestCase.java b/src/test/java/org/apache/fop/pdf/PDFFactoryTestCase.java new file mode 100644 index 000000000..edbc7e449 --- /dev/null +++ b/src/test/java/org/apache/fop/pdf/PDFFactoryTestCase.java @@ -0,0 +1,78 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.pdf; + +import java.io.File; +import java.net.URI; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +import org.apache.xmlgraphics.io.ResourceResolver; + +import org.apache.fop.apps.io.InternalResourceResolver; +import org.apache.fop.apps.io.ResourceResolverFactory; +import org.apache.fop.fonts.CIDSet; +import org.apache.fop.fonts.CIDSubset; +import org.apache.fop.fonts.EmbeddingMode; +import org.apache.fop.fonts.MultiByteFont; + +/** + * Test case for {@link PDFFactory}. + */ +public class PDFFactoryTestCase { + + /** + * This tests that when a font is subset embedded in a PDF, the font name is prefixed with a + * pseudo-random tag as per the PDF spec. + */ + @Test + public void testSubsetFontNamePrefix() { + class MockedFont extends MultiByteFont { + public MockedFont(InternalResourceResolver resolver) { + super(resolver, EmbeddingMode.AUTO); + } + + @Override + public int[] getWidths() { + return new int[] {0}; + } + + @Override + public CIDSet getCIDSet() { + return new CIDSubset(this); + } + } + PDFDocument doc = new PDFDocument("Test"); + PDFFactory pdfFactory = new PDFFactory(doc); + URI thisURI = new File(".").toURI(); + ResourceResolver resolver = ResourceResolverFactory.createDefaultResourceResolver(); + InternalResourceResolver resourceResolver = ResourceResolverFactory.createInternalResourceResolver( + thisURI, resolver); + MockedFont font = new MockedFont(resourceResolver); + + PDFFont pdfDejaVu = pdfFactory.makeFont("DejaVu", "DejaVu", "TTF", font, font); + assertEquals("/EAAAAA+DejaVu", pdfDejaVu.getBaseFont().toString()); + + PDFFont pdfArial = pdfFactory.makeFont("Arial", "Arial", "TTF", font, font); + assertEquals("/EAAAAB+Arial", pdfArial.getBaseFont().toString()); + } +} diff --git a/src/test/java/org/apache/fop/pdf/PDFFilterListTestCase.java b/src/test/java/org/apache/fop/pdf/PDFFilterListTestCase.java new file mode 100644 index 000000000..d1cc6273d --- /dev/null +++ b/src/test/java/org/apache/fop/pdf/PDFFilterListTestCase.java @@ -0,0 +1,33 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.pdf; + +import org.junit.Test; + +import static org.junit.Assert.assertFalse; + +public class PDFFilterListTestCase { + + @Test + public void testFilterList() { + PDFFilterList filterList = new PDFFilterList(); + assertFalse(filterList.isInitialized()); + } +} diff --git a/src/test/java/org/apache/fop/pdf/PDFLibraryTestSuite.java b/src/test/java/org/apache/fop/pdf/PDFLibraryTestSuite.java new file mode 100644 index 000000000..7f408ae2c --- /dev/null +++ b/src/test/java/org/apache/fop/pdf/PDFLibraryTestSuite.java @@ -0,0 +1,47 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.pdf; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +/** + * Test suite for FOP's utility classes. + */ +@RunWith(Suite.class) +@SuiteClasses({ + PDFArrayTestCase.class, + PDFDictionaryTestCase.class, + PDFNumberTestCase.class, + PDFObjectTestCase.class, + PDFNameTestCase.class, + AbstractPDFStreamTestCase.class, + PDFDestsTestCase.class, + PDFDocumentTestCase.class, + PDFNullTestCase.class, + PDFNumsArrayTestCase.class, + PDFRectangleTestCase.class, + PDFReferenceTestCase.class, + VersionTestCase.class, + VersionControllerTestCase.class +}) +public class PDFLibraryTestSuite { +} diff --git a/src/test/java/org/apache/fop/pdf/PDFLinearizationTestCase.java b/src/test/java/org/apache/fop/pdf/PDFLinearizationTestCase.java new file mode 100644 index 000000000..3df497e0f --- /dev/null +++ b/src/test/java/org/apache/fop/pdf/PDFLinearizationTestCase.java @@ -0,0 +1,311 @@ +/* + * 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. + */ + +/* $Id$ */ +package org.apache.fop.pdf; + +import java.awt.Dimension; +import java.awt.Rectangle; +import java.awt.geom.Rectangle2D; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import javax.xml.transform.stream.StreamResult; + +import org.junit.Assert; +import org.junit.Test; + +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.apps.FopFactory; +import org.apache.fop.fonts.FontInfo; +import org.apache.fop.render.intermediate.IFContext; +import org.apache.fop.render.pdf.PDFContentGenerator; +import org.apache.fop.render.pdf.PDFDocumentHandler; +import org.apache.fop.render.pdf.PDFPainter; + +public class PDFLinearizationTestCase { + private int objectLeast; + private int[] objects; + + @Test + public void testPDF() throws IOException { + PDFDocument doc = new PDFDocument(""); + doc.setLinearizationEnabled(true); + PDFResources resources = new PDFResources(doc); + PDFResourceContext context = new PDFResourceContext(resources); + ByteArrayOutputStream out = new ByteArrayOutputStream(); + PDFContentGenerator gen = null; + for (int i = 0; i < 2; i++) { + gen = new PDFContentGenerator(doc, out, context); + Rectangle2D.Float f = new Rectangle2D.Float(); + PDFPage page = new PDFPage(resources, i, f, f, f, f); + doc.registerObject(page); + doc.registerObject(gen.getStream()); + page.setContents(gen.getStream()); + } + gen.flushPDFDoc(); + byte[] data = out.toByteArray(); + checkPDF(data); + } + + @Test + public void testImage() throws Exception { + String fopxconf = "<fop version=\"1.0\"><renderers>" + + "<renderer mime=\"application/pdf\">" + + "<linearization>true</linearization>" + + "</renderer></renderers></fop>"; + FopFactory fopFactory = FopFactory.newInstance(new File(".").toURI(), + new ByteArrayInputStream(fopxconf.getBytes())); + FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); + IFContext ifContext = new IFContext(foUserAgent); + PDFDocumentHandler documentHandler = new PDFDocumentHandler(ifContext); + documentHandler.getConfigurator().configure(documentHandler); + ByteArrayOutputStream out = new ByteArrayOutputStream(); + documentHandler.setFontInfo(new FontInfo()); + documentHandler.setResult(new StreamResult(out)); + documentHandler.startDocument(); + documentHandler.startPage(0, "", "", new Dimension()); + PDFPainter pdfPainter = new PDFPainter(documentHandler, null); + pdfPainter.drawImage("test/resources/fop/svg/logo.jpg", new Rectangle()); + documentHandler.endPage(); + Assert.assertFalse(out.toString().contains("/Subtype /Image")); + documentHandler.endDocument(); + Assert.assertTrue(out.toString().contains("/Subtype /Image")); + } + + private void checkPDF(byte[] data) throws IOException { + checkHintTable(data); + InputStream is = new ByteArrayInputStream(data); + Map<String, StringBuilder> objs = readObjs(is); + + List<String> keys = new ArrayList<String>(objs.keySet()); + int start = keys.indexOf("1 0 obj"); + Assert.assertTrue(start > 1); + int j = 1; + for (int i = start; i < keys.size(); i++) { + Assert.assertEquals(keys.get(i), j + " 0 obj"); + j++; + } + for (int i = 0; i < start; i++) { + Assert.assertEquals(keys.get(i), j + " 0 obj"); + j++; + } + + checkFirstObj(data); + checkTrailer(data); + + String firstObj = objs.values().iterator().next().toString().replace("\n", ""); + Assert.assertTrue(firstObj.startsWith("<< /Linearized 1 /L " + data.length)); + Assert.assertTrue(firstObj.endsWith("startxref0%%EOF")); + int pageObjNumber = getValue("/O", firstObj); + Assert.assertTrue(objs.get(pageObjNumber + " 0 obj").toString().contains("/Type /Page")); + Assert.assertTrue(objs.get("5 0 obj").toString().contains("/Type /Pages")); + + int total = 0; + for (int i : objects) { + total += i; + } + Assert.assertEquals(total, objs.size() - 6); + } + + private void checkFirstObj(byte[] data) throws IOException { + int firstObjPos = getValue("/E", getFirstObj(data)); + InputStream is = new ByteArrayInputStream(data); + Assert.assertEquals(is.skip(firstObjPos), firstObjPos); + byte[] obj = new byte[10]; + Assert.assertEquals(is.read(obj), obj.length); + Assert.assertTrue(new String(obj).startsWith("1 0 obj")); + } + + private void checkTrailer(byte[] data) throws IOException { + int trailerPos = getValue("/T", getFirstObj(data)); + InputStream is = new ByteArrayInputStream(data); + Assert.assertEquals(is.skip(trailerPos), trailerPos); + byte[] obj = new byte[20]; + Assert.assertEquals(is.read(obj), obj.length); + Assert.assertTrue(new String(obj).startsWith("0000000000 65535 f")); + } + + private int getValue(String name, String firstObj) throws IOException { + String[] split = firstObj.split(" "); + for (int i = 0; i < split.length; i++) { + if (split[i].equals(name)) { + return Integer.valueOf(split[i + 1].replace(">>", "")); + } + } + throw new IOException(name + " not found " + firstObj); + } + + private int[] getArrayValue(String name, String firstObj) throws IOException { + String[] split = firstObj.split(" "); + for (int i = 0; i < split.length; i++) { + if (split[i].equals(name)) { + int[] v = new int[2]; + v[0] = Integer.valueOf(split[i + 1].replace("[", "")); + v[1] = Integer.valueOf(split[i + 2].replace("]", "")); + return v; + } + } + throw new IOException(name + " not found " + firstObj); + } + + private String getFirstObj(byte[] out) throws IOException { + InputStream data = new ByteArrayInputStream(out); + Map<String, StringBuilder> objs = readObjs(data); + return objs.values().iterator().next().toString().replace("\n", ""); + } + + private void checkHintTable(byte[] out) throws IOException { + String firstObj = getFirstObj(out); + int hintPos = getArrayValue("/H", firstObj)[0]; + int hintLength = getArrayValue("/H", firstObj)[1]; + + InputStream data = new ByteArrayInputStream(out); + Assert.assertEquals(data.skip(hintPos), hintPos); + + byte[] hintTable = new byte[hintLength]; + Assert.assertEquals(data.read(hintTable), hintLength); + String hintTableStr = new String(hintTable); + + Assert.assertTrue(hintTableStr.contains("/S ")); + Assert.assertTrue(hintTableStr.contains("/C ")); + Assert.assertTrue(hintTableStr.contains("/E ")); + Assert.assertTrue(hintTableStr.contains("/L ")); + Assert.assertTrue(hintTableStr.contains("/V ")); + Assert.assertTrue(hintTableStr.contains("/O ")); + Assert.assertTrue(hintTableStr.contains("/I ")); + Assert.assertTrue(hintTableStr.contains("/Length ")); + Assert.assertTrue(hintTableStr.contains("stream")); + Assert.assertTrue(hintTableStr.contains("endstream")); + Assert.assertTrue(hintTableStr.endsWith("endobj\n")); + + data = new ByteArrayInputStream(hintTable); + readStart(data); + int pages = getValue("/N", firstObj); + readObjectsTable(data, pages); + readSharedObjectsTable(data); + Assert.assertEquals(objectLeast, 1); + } + + private void readObjectsTable(InputStream data, int pages) + throws IOException { + objectLeast = read32(data); + read32(data); + int bitsDiffObjects = read16(data); + read32(data); + int bitsDiffPageLength = read16(data); + read32(data); + read16(data); + read32(data); + read16(data); + read16(data); + read16(data); + read16(data); + read16(data); + + objects = new int[pages]; + for (int i = 0; i < pages; i++) { + objects[i] = objectLeast + readBits(bitsDiffObjects, data); + } + for (int i = 0; i < pages; i++) { + readBits(bitsDiffPageLength, data); + } + for (int i = 0; i < pages; i++) { + readBits(32, data); + } + } + + private void readSharedObjectsTable(InputStream str) throws IOException { + readBits(32, str); + readBits(32, str); + readBits(32, str); + int sharedGroups = readBits(32, str); + readBits(16, str); + readBits(32, str); + int bitsDiffGroupLength = readBits(16, str); + for (int i = 0; i < sharedGroups; i++) { + readBits(bitsDiffGroupLength, str); + } + } + + private int readBits(int bits, InputStream data) throws IOException { + if (bits == 32) { + return read32(data); + } + if (bits == 16) { + return read16(data); + } + throw new IOException("Wrong bits"); + } + + private int read32(InputStream data) throws IOException { + int ch1 = data.read(); + int ch2 = data.read(); + int ch3 = data.read(); + int ch4 = data.read(); + return ((ch1 << 24) + (ch2 << 16) + (ch3 << 8) + (ch4)); + } + + private int read16(InputStream data) throws IOException { + int ch1 = data.read(); + int ch2 = data.read(); + return (ch1 << 8) + (ch2); + } + + private void readStart(InputStream inputStream) throws IOException { + StringBuilder sb = new StringBuilder(); + while (inputStream.available() > 0) { + int data = inputStream.read(); + if (data == '\n') { + if (sb.toString().equals("stream")) { + return; + } + sb.setLength(0); + } else { + sb.append((char)data); + } + } + } + + public static Map<String, StringBuilder> readObjs(InputStream inputStream) throws IOException { + Map<String, StringBuilder> objs = new LinkedHashMap<String, StringBuilder>(); + StringBuilder sb = new StringBuilder(); + String key = null; + while (inputStream.available() > 0) { + int data = inputStream.read(); + if (data == '\n') { + if (sb.toString().endsWith(" 0 obj")) { + key = sb.toString().trim(); + objs.put(key, new StringBuilder()); + } else if (key != null) { + objs.get(key).append(sb).append("\n"); + } + sb.setLength(0); + } else { + sb.append((char)data); + } + } + return objs; + } +} diff --git a/src/test/java/org/apache/fop/pdf/PDFNameTestCase.java b/src/test/java/org/apache/fop/pdf/PDFNameTestCase.java new file mode 100644 index 000000000..8d7321496 --- /dev/null +++ b/src/test/java/org/apache/fop/pdf/PDFNameTestCase.java @@ -0,0 +1,171 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.pdf; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +import org.apache.commons.io.output.CountingOutputStream; + +/** + * Test class for {@link PDFName}. + */ +public class PDFNameTestCase extends PDFObjectTestCase { + private PDFName pdfName; + + /** + * Sets up the local variables + */ + @Before + public void setUp() { + pdfName = new PDFName("TestName"); + pdfName.setParent(parent); + pdfName.setDocument(doc); + + pdfObjectUnderTest = pdfName; + } + + /** + * Tests escapeName() - tests that this method escapes the necessary characters. + */ + @Test + public void testEscapeName() { + try { + // Test for null, this is a programming error thus the NPE + PDFName.escapeName(null); + fail("NPE not thrown when null object given to escapeName()"); + } catch (NullPointerException e) { + // PASS + } + // All names are prefixed by "/", check the PDF spec for further details. + assertEquals("/Test", PDFName.escapeName("Test")); + // Check that if the name is already prefixed with "/" it doens't do it twice + assertEquals("/Test", PDFName.escapeName("/Test")); + // Test with a space in the middle + assertEquals("/Test#20test", PDFName.escapeName("Test test")); + // Test that all chars apart from ASCII '!' --> '~' are escaped + nonEscapedCharactersTests(); + escapedCharactersTests(); + } + + private void escapedCharactersTests() { + for (char i = 0; i < '!'; i++) { + String str = Integer.toHexString(i >>> 4 & 0x0f).toUpperCase(); + str += Integer.toHexString(i & 0x0f).toUpperCase(); + assertEquals("/#" + str, PDFName.escapeName(String.valueOf(i))); + } + for (char i = '~' + 1; i < 256; i++) { + String str = Integer.toHexString(i >>> 4 & 0x0f).toUpperCase(); + str += Integer.toHexString(i & 0x0f).toUpperCase(); + assertEquals("/#" + str, PDFName.escapeName(String.valueOf(i))); + } + checkCharacterIsEscaped('#'); + checkCharacterIsEscaped('%'); + checkCharacterIsEscaped('('); + checkCharacterIsEscaped(')'); + checkCharacterIsEscaped('<'); + checkCharacterIsEscaped('>'); + checkCharacterIsEscaped('['); + checkCharacterIsEscaped(']'); + checkCharacterIsEscaped('>'); + } + + private void checkCharacterIsEscaped(char c) { + String str = Integer.toHexString(c >>> 4 & 0x0f).toUpperCase(); + str += Integer.toHexString(c & 0x0f).toUpperCase(); + assertEquals("/#" + str, PDFName.escapeName(String.valueOf(c))); + } + + private void nonEscapedCharactersTests() { + charactersNotEscapedBetween('!', '"'); + charactersNotEscapedBetween('*', ';'); + charactersNotEscapedBetween('?', 'Z'); + charactersNotEscapedBetween('^', '~'); + } + + private void charactersNotEscapedBetween(char c1, char c2) { + for (char i = c1; i <= c2; i++) { + String str = String.valueOf(i); + String expected = !str.equals("/") ? "/" + str : str; + assertEquals(expected, PDFName.escapeName(str)); + } + } + + /** + * Tests toString() - this has been overridden to return the String that PDFName wraps. + */ + @Test + public void testToString() { + // The escape characters have already been tested in testEscapeName() so this doesn't need + // to be done twice. + PDFName test1 = new PDFName("test1"); + assertEquals("/test1", test1.toString()); + PDFName test2 = new PDFName("another test"); + assertEquals("/another#20test", test2.toString()); + try { + new PDFName(null); + fail("NPE not thrown when null passed to constructor"); + } catch (NullPointerException e) { + // PASS + } + } + + /** + * Tests output() - check that this object can stream itself in the correct format. + * @throws IOException error caused by I/O + */ + @Test + public void testOutput() throws IOException { + testOutputStreams("/TestName", pdfName); + testOutputStreams("/test#20test", new PDFName("test test")); + } + + /** + * Test outputInline() - this writes the object reference if it is a direct object (has an + * object number), or writes the String representation if there is no object number. + */ + @Test + public void testOutputInline() { + ByteArrayOutputStream outStream = new ByteArrayOutputStream(); + CountingOutputStream cout = new CountingOutputStream(outStream); + StringBuilder textBuffer = new StringBuilder(); + try { + // test with no object number set. + pdfName.outputInline(outStream, textBuffer); + PDFDocument.flushTextBuffer(textBuffer, cout); + assertEquals("/TestName", outStream.toString()); + + outStream.reset(); + // test with object number set + pdfName.setObjectNumber(1); + pdfName.outputInline(outStream, textBuffer); + PDFDocument.flushTextBuffer(textBuffer, cout); + assertEquals("1 0 R", outStream.toString()); + } catch (IOException e) { + fail("IOException: " + e.getMessage()); + } + } +} diff --git a/src/test/java/org/apache/fop/pdf/PDFNullTestCase.java b/src/test/java/org/apache/fop/pdf/PDFNullTestCase.java new file mode 100644 index 000000000..87dacc7f6 --- /dev/null +++ b/src/test/java/org/apache/fop/pdf/PDFNullTestCase.java @@ -0,0 +1,49 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.pdf; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +/** + * Test case for {@link PDFNull}. + */ +public class PDFNullTestCase extends PDFObjectTestCase { + + /** + * Test outputInline() - test that "null" is printed to the output stream. + */ + @Test + public void testOutputInline() throws IOException { + PDFNull obj = PDFNull.INSTANCE; + ByteArrayOutputStream out = new ByteArrayOutputStream(); + StringBuilder text = new StringBuilder(); + obj.outputInline(out, text); + assertEquals("null", text.toString()); + + // Ensure previously written text is not discarded + obj.outputInline(out, text); + assertEquals("nullnull", text.toString()); + } +} diff --git a/src/test/java/org/apache/fop/pdf/PDFNumberTestCase.java b/src/test/java/org/apache/fop/pdf/PDFNumberTestCase.java new file mode 100644 index 000000000..65f484dc7 --- /dev/null +++ b/src/test/java/org/apache/fop/pdf/PDFNumberTestCase.java @@ -0,0 +1,162 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.pdf; + +import java.io.IOException; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +/** + * This test tests PDFNumber's doubleOut() methods. + */ +public class PDFNumberTestCase extends PDFObjectTestCase { + /** + * Sets up the local variables, most of these are inherited from PDFObjectTestCase + */ + @Before + public void setUp() { + pdfObjectUnderTest = new PDFNumber(); + pdfObjectUnderTest.setParent(parent); + pdfObjectUnderTest.setDocument(doc); + } + + /** + * Tests PDFNumber.doubleOut(). + * @throws Exception if the test fails + */ + @Test + public void testDoubleOut1() throws Exception { + //Default is 6 decimal digits + assertEquals("0", PDFNumber.doubleOut(0.0f)); + assertEquals("0", PDFNumber.doubleOut(0.0000000000000000000123f)); + assertEquals("0.1", PDFNumber.doubleOut(0.1f)); + assertEquals("100", PDFNumber.doubleOut(100.0f)); + assertEquals("100", PDFNumber.doubleOut(99.99999999999999999999999f)); + + //You'd expect 100.123456 here but DecimalFormat uses the BigDecimal.ROUND_HALF_EVEN + //strategy. I don't know if that's a problem. The strange thing testDoubleOut2 + //seems to return the normally expected value. Weird. + assertEquals("100.123459", PDFNumber.doubleOut(100.12345611111111f)); + assertEquals("-100.123459", PDFNumber.doubleOut(-100.12345611111111f)); + } + + /** + * Tests PDFNumber.doubleOut(). + * @throws Exception if the test fails + */ + public void testDoubleOut2() throws Exception { + //4 decimal digits in this case + assertEquals("0", PDFNumber.doubleOut(0.0f, 4)); + assertEquals("0", PDFNumber.doubleOut(0.0000000000000000000123f, 4)); + assertEquals("0.1", PDFNumber.doubleOut(0.1f, 4)); + assertEquals("100", PDFNumber.doubleOut(100.0f, 4)); + assertEquals("100", PDFNumber.doubleOut(99.99999999999999999999999f, 4)); + assertEquals("100.1234", PDFNumber.doubleOut(100.12341111111111f, 4)); + assertEquals("-100.1234", PDFNumber.doubleOut(-100.12341111111111f, 4)); + } + + /** + * Tests PDFNumber.doubleOut(). + * @throws Exception if the test fails + */ + public void testDoubleOut3() throws Exception { + //0 decimal digits in this case + assertEquals("0", PDFNumber.doubleOut(0.0f, 0)); + assertEquals("0", PDFNumber.doubleOut(0.1f, 0)); + assertEquals("1", PDFNumber.doubleOut(0.6f, 0)); + assertEquals("100", PDFNumber.doubleOut(100.1234f, 0)); + assertEquals("-100", PDFNumber.doubleOut(-100.1234f, 0)); + } + + /** + * Tests PDFNumber.doubleOut(). Special cases (former bugs). + * @throws Exception if the test fails + */ + public void testDoubleOut4() throws Exception { + double d = Double.parseDouble("5.7220458984375E-6"); + assertEquals("0.000006", PDFNumber.doubleOut(d)); + assertEquals("0", PDFNumber.doubleOut(d, 4)); + assertEquals("0.00000572", PDFNumber.doubleOut(d, 8)); + } + + /** + * Tests PDFNumber.doubleOut(). Tests for wrong parameters. + * @throws Exception if the test fails + */ + public void testDoubleOutWrongParameters() throws Exception { + try { + PDFNumber.doubleOut(0.1f, -1); + fail("IllegalArgument expected!"); + } catch (IllegalArgumentException iae) { + //we want that + } + try { + PDFNumber.doubleOut(0.1f, 17); //We support max 16 decimal digits + fail("IllegalArgument expected!"); + } catch (IllegalArgumentException iae) { + //we want that + } + try { + PDFNumber.doubleOut(0.1f, 98274659); + fail("IllegalArgument expected!"); + } catch (IllegalArgumentException iae) { + //we want that + } + try { + PDFNumber.doubleOut(null); + fail("NullPointer expected!"); + } catch (NullPointerException e) { + // PASS + } + } + + /** + * Tests both getNumber() and setNumber() - basic getter/setter methods... Why there isn't a + * constructor is beyond me... + */ + public void testGetSetNumber() { + PDFNumber pdfNum = new PDFNumber(); + // Check with a floating point number + pdfNum.setNumber(1.111f); + assertEquals(1.111f, pdfNum.getNumber()); + // try with an int + pdfNum.setNumber(2); + assertEquals(2, pdfNum.getNumber()); + // See what happens with a null... make sure it doesn't explode + pdfNum.setNumber(null); + assertEquals(null, pdfNum.getNumber()); + } + + /** + * Tests toPDFString() - this serializes PDFNumber to PDF format. + * @throws IOException error caused by I/O + */ + public void testToPDFString() throws IOException { + PDFNumber testSubject = new PDFNumber(); + testSubject.setNumber(1.0001); + testOutputStreams("1.0001", testSubject); + testSubject.setNumber(999); + testOutputStreams("999", testSubject); + } +} diff --git a/src/test/java/org/apache/fop/pdf/PDFNumsArrayTestCase.java b/src/test/java/org/apache/fop/pdf/PDFNumsArrayTestCase.java new file mode 100644 index 000000000..d36775cda --- /dev/null +++ b/src/test/java/org/apache/fop/pdf/PDFNumsArrayTestCase.java @@ -0,0 +1,54 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.pdf; + +import java.io.IOException; + +import org.junit.Before; +import org.junit.Test; + +/** + * Test case for {@link PDFNumsArray}. + */ +public class PDFNumsArrayTestCase extends PDFObjectTestCase { + private PDFNumsArray numsArray; + private String expectedString = "[0 /Test#20name 1 10]"; + + @Before + public void setUp() { + numsArray = new PDFNumsArray(parent); + numsArray.put(0, new PDFName("Test name")); + PDFNumber num = new PDFNumber(); + num.setNumber(10); + numsArray.put(1, num); + numsArray.setDocument(doc); + + pdfObjectUnderTest = numsArray; + } + + /** + * Test output() - ensure that this object is properly outputted to the PDF document. + * @throws IOException if an I/O error occurs + */ + @Test + public void testOutput() throws IOException { + testOutputStreams(expectedString, numsArray); + } +} diff --git a/src/test/java/org/apache/fop/pdf/PDFObjectTestCase.java b/src/test/java/org/apache/fop/pdf/PDFObjectTestCase.java new file mode 100644 index 000000000..544352438 --- /dev/null +++ b/src/test/java/org/apache/fop/pdf/PDFObjectTestCase.java @@ -0,0 +1,197 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.pdf; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +/** + * Tests the PDFObject class. + */ +public class PDFObjectTestCase { + /** The document behind this object */ + protected final PDFDocument doc = new PDFDocument("test"); + /** The parent of this object */ + protected final PDFObject parent = new DummyPDFObject(); + /** The test subject */ + protected PDFObject pdfObjectUnderTest; + + private static class DummyPDFObject extends PDFObject { + + }; + + @Before + public void setUp() { + pdfObjectUnderTest = new DummyPDFObject(); + pdfObjectUnderTest.setDocument(doc); + pdfObjectUnderTest.setParent(parent); + } + + /** + * Tests setObjectNumber() + */ + @Test + public void testSetObjectNumber() { + pdfObjectUnderTest.setObjectNumber(1); + assertEquals(1, pdfObjectUnderTest.getObjectNumber().getNumber()); + + pdfObjectUnderTest.setObjectNumber(5); + assertEquals(5, pdfObjectUnderTest.getObjectNumber().getNumber()); + } + + /** + * Tests hasObjectNumber() - returns the object number of the underlying PDF object. + */ + @Test + public void testHasObjectNumber() { + assertFalse(pdfObjectUnderTest.hasObjectNumber()); + + pdfObjectUnderTest.setObjectNumber(1); + assertTrue(pdfObjectUnderTest.hasObjectNumber()); + } + + /** + * Tests getGeneration() - returns the generation number of the underlying PDF object. + */ + @Test + public void testGetGeneration() { + // Default should be 0 + assertEquals(0, pdfObjectUnderTest.getGeneration()); + // apparently there is no way to set this to anything other than 0 + } + + /** + * Tests setDocument() - returns the document to which this object is bound. + */ + @Test + public void testSetDocument() { + assertEquals(doc, pdfObjectUnderTest.getDocument()); + // assign a different document to the object and test (this should be immutable but isn't) + PDFDocument anotherDoc = new PDFDocument("another test"); + pdfObjectUnderTest.setDocument(anotherDoc); + assertEquals(anotherDoc, pdfObjectUnderTest.getDocument()); + } + + /** + * Tests setParent() - assigns the object a parent. + */ + @Test + public void testSetParent() { + assertEquals(parent, pdfObjectUnderTest.getParent()); + // assign another parent (this probably shouldn't me mutable) + DummyPDFObject anotherParent = new DummyPDFObject(); + pdfObjectUnderTest.setParent(anotherParent); + assertEquals(anotherParent, pdfObjectUnderTest.getParent()); + } + + /** + * Test getObjectID() - returns the PDF object ID. + */ + @Test + public void testGetObjectID() { + pdfObjectUnderTest.setObjectNumber(10); + // String is of the format "<object#> <generation#> obj\n" + assertEquals("10 0 obj\n", pdfObjectUnderTest.getObjectID()); + } + + /** + * Test referencePDF() - returns a {@link String} in PDF format to reference this object. + */ + @Test + public void testReferencePDF() { + try { + pdfObjectUnderTest.referencePDF(); + fail("The object number is not set, an exception should be thrown"); + } catch (IllegalArgumentException e) { + // PASS + } + pdfObjectUnderTest.setObjectNumber(10); + // Referencing this object is in the format "<obj#> <gen#> R" + assertEquals("10 0 R", pdfObjectUnderTest.referencePDF()); + } + + /** + * Test makeReference() - returns this object represented as a {@link PDFReference}. + */ + @Test + public void testMakeReference() { + // Not very intelligent but, there's not much to test here + pdfObjectUnderTest.setObjectNumber(10); + PDFReference ref = pdfObjectUnderTest.makeReference(); + assertEquals(pdfObjectUnderTest.getObjectNumber(), ref.getObjectNumber()); + assertEquals(pdfObjectUnderTest, ref.getObject()); + assertEquals(pdfObjectUnderTest.referencePDF(), ref.toString()); + } + + /** + * Tests PDF object references. + * @throws Exception if an error occurs + */ + @Test + public void testReference() throws Exception { + PDFDictionary dict = new PDFDictionary(); + dict.setObjectNumber(7); + PDFReference ref = dict.makeReference(); + assertEquals(ref.getObjectNumber().getNumber(), 7); + assertEquals(ref.getGeneration(), 0); + assertEquals(ref.toString(), "7 0 R"); + + ref = new PDFReference("8 0 R"); + assertEquals(ref.getObjectNumber().getNumber(), 8); + assertEquals(ref.getGeneration(), 0); + assertEquals(ref.toString(), "8 0 R"); + } + + /** + * A generic method to test output() for sub-classes of (@link PDFObject}. The expected String + * should be formatted such that the object number and object descriptor aren't printed i.e. + * for a simple integer object in PDF: + * <pre> + * 1 0 obj ** ommited from expectedString + * 10 + * endobj ** ommited from expectedString + * </pre> + * Thus the expected string would be "10". + * @param expectedString the string that is expected. + * @param object the object being tested + * @throws IOException error with I/O + */ + protected void testOutputStreams(String expectedString, PDFObject object) throws IOException { + // Test both with and without object numbers + ByteArrayOutputStream outStream = new ByteArrayOutputStream(); + // Ensure that + object.setObjectNumber(0); + assertEquals(expectedString.length(), object.output(outStream)); + assertEquals(expectedString, outStream.toString()); + outStream.reset(); + object.setObjectNumber(1); + // Test the length of the output string is returned correctly. + assertEquals(expectedString.length(), object.output(outStream)); + assertEquals(expectedString, outStream.toString()); + } +} diff --git a/src/test/java/org/apache/fop/pdf/PDFPageLabelsTestCase.java b/src/test/java/org/apache/fop/pdf/PDFPageLabelsTestCase.java new file mode 100644 index 000000000..a8be7ee74 --- /dev/null +++ b/src/test/java/org/apache/fop/pdf/PDFPageLabelsTestCase.java @@ -0,0 +1,93 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.pdf; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.mock; + +public class PDFPageLabelsTestCase { + + @Test + public void testAddPageLabel() throws IOException { + PDFDocument pdfDoc = mock(PDFDocument.class); + PDFPageLabels pageLabels = new PDFPageLabels(); + pageLabels.setDocument(pdfDoc); + int index = 0; + StringBuilder expected = new StringBuilder(); + expected.append("["); + expected.append(index + " << /S /r >>"); + pageLabels.addPageLabel(index++, "i"); + pageLabels.addPageLabel(index++, "ii"); + pageLabels.addPageLabel(index++, "iii"); + expected.append(" " + index + " << /S /D >>"); + pageLabels.addPageLabel(index++, "1"); + pageLabels.addPageLabel(index++, "2"); + pageLabels.addPageLabel(index++, "3"); + pageLabels.addPageLabel(index++, "4"); + pageLabels.addPageLabel(index++, "5"); + pageLabels.addPageLabel(index++, "6"); + pageLabels.addPageLabel(index++, "7"); + pageLabels.addPageLabel(index++, "8"); + pageLabels.addPageLabel(index++, "9"); + pageLabels.addPageLabel(index++, "10"); + expected.append(" " + index + " << /S /A >>"); + pageLabels.addPageLabel(index++, "A"); + pageLabels.addPageLabel(index++, "B"); + expected.append(" " + index + " << /S /R /St 100 >>"); + pageLabels.addPageLabel(index++, "C"); + expected.append(" " + index + " << /S /R /St 500 >>"); + pageLabels.addPageLabel(index++, "D"); + expected.append(" " + index + " << /S /A /St 5 >>"); + pageLabels.addPageLabel(index++, "E"); + pageLabels.addPageLabel(index++, "F"); + pageLabels.addPageLabel(index++, "G"); + expected.append(" " + index + " << /P (aa) >>"); + pageLabels.addPageLabel(index++, "aa"); + expected.append(" " + index + " << /P (ab) >>"); + pageLabels.addPageLabel(index++, "ab"); + expected.append(" " + index + " << /P (ac) >>"); + pageLabels.addPageLabel(index++, "ac"); + expected.append(" " + index + " << /S /a >>"); + pageLabels.addPageLabel(index++, "a"); + pageLabels.addPageLabel(index++, "b"); + expected.append(" " + index + " << /S /R /St 2 >>"); + pageLabels.addPageLabel(index++, "II"); + expected.append(" " + index + " << /S /R /St 12 >>"); + pageLabels.addPageLabel(index++, "XII"); + expected.append(" " + index + " <<\n /P (00)\n /S /D\n /St 9\n>>"); + pageLabels.addPageLabel(index++, "009"); + expected.append(" " + index + " <<\n /P (0)\n /S /D\n /St 10\n>>"); + pageLabels.addPageLabel(index++, "010"); + pageLabels.addPageLabel(index++, "011"); + expected.append("]"); + + PDFNumsArray nums = pageLabels.getNums(); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + nums.output(baos); + assertEquals(expected.toString(), baos.toString()); + baos.close(); + } + +} diff --git a/src/test/java/org/apache/fop/pdf/PDFPagePieceTestCase.java b/src/test/java/org/apache/fop/pdf/PDFPagePieceTestCase.java new file mode 100644 index 000000000..4ee98b665 --- /dev/null +++ b/src/test/java/org/apache/fop/pdf/PDFPagePieceTestCase.java @@ -0,0 +1,67 @@ +/* + * 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. + */ + +/* $Id$ */ +package org.apache.fop.pdf; + +import java.awt.Dimension; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.util.Arrays; + +import javax.xml.transform.stream.StreamResult; + +import org.junit.Test; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.apps.FopFactory; +import org.apache.fop.render.intermediate.IFContext; +import org.apache.fop.render.intermediate.IFException; +import org.apache.fop.render.pdf.PDFDocumentHandler; +import org.apache.fop.render.pdf.extensions.PDFCollectionEntryExtension; +import org.apache.fop.render.pdf.extensions.PDFDictionaryAttachment; +import org.apache.fop.render.pdf.extensions.PDFDictionaryExtension; +import org.apache.fop.render.pdf.extensions.PDFDictionaryType; + +import junit.framework.Assert; + +public class PDFPagePieceTestCase { + @Test + public void testPDF() throws IFException { + FopFactory fopFactory = FopFactory.newInstance(new File(".").toURI()); + FOUserAgent userAgent = fopFactory.newFOUserAgent(); + PDFDocumentHandler documentHandler = new PDFDocumentHandler(new IFContext(userAgent)); + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + documentHandler.setResult(new StreamResult(bos)); + documentHandler.startDocument(); + documentHandler.startPage(0, "", "", new Dimension()); + + PDFDictionaryExtension dictionaryExtension = mock(PDFDictionaryExtension.class); + when(dictionaryExtension.getDictionaryType()).thenReturn(PDFDictionaryType.PagePiece); + + PDFDictionaryExtension child = mock(PDFDictionaryExtension.class); + when(child.getKey()).thenReturn("a"); + when(dictionaryExtension.getEntries()).thenReturn(Arrays.<PDFCollectionEntryExtension>asList(child)); + documentHandler.handleExtensionObject(new PDFDictionaryAttachment(dictionaryExtension)); + + documentHandler.endPage(); + Assert.assertTrue(bos.toString(), bos.toString().contains("/PieceInfo << /a << >> /LastModified (D:")); + } +} diff --git a/src/test/java/org/apache/fop/pdf/PDFParentTreeTestCase.java b/src/test/java/org/apache/fop/pdf/PDFParentTreeTestCase.java new file mode 100644 index 000000000..6fa5d6a42 --- /dev/null +++ b/src/test/java/org/apache/fop/pdf/PDFParentTreeTestCase.java @@ -0,0 +1,107 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.pdf; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; + +/** + * Tests that the nums array in the ParentTree dictionary is correctly being split into + * separate arrays if the elements number exceeds the set limit. + */ +public class PDFParentTreeTestCase { + + private PDFParentTree parentTree; + + @Before + public void initializeStructureTree() { + parentTree = new PDFParentTree(); + PDFDocument pdfDocument = new PDFDocument("test"); + pdfDocument.makeStructTreeRoot(parentTree); + } + + /** + * Adds less structured items than the imposed limit which should result + * in only one nums array being created. + * @throws Exception + */ + @Test + public void testNoSplit() throws Exception { + assertEquals(getArrayNumber(45), 1); + } + + /** + * Adds more than the imposed array limit to test that it splits the + * nums array into two objects. + * @throws Exception + */ + @Test + public void testSingleSplit() throws Exception { + assertEquals(getArrayNumber(70), 2); + } + + /** + * Adds items to the nums array to cause and test that multiple splits occur + * @throws Exception + */ + @Test + public void testMultipleSplit() throws Exception { + assertEquals(getArrayNumber(165), 4); + } + + /** + * Ensures that items added out of order get added to the correct nums array + * @throws Exception + */ + @Test + public void testOutOfOrderSplit() throws Exception { + PDFStructElem structElem = mock(PDFStructElem.class); + for (int num = 50; num < 53; num++) { + parentTree.addToNums(num, structElem); + } + assertEquals(getArrayNumber(50), 2); + PDFNumberTreeNode treeNode = (PDFNumberTreeNode) parentTree.getKids().get(0); + for (int num = 0; num < 50; num++) { + assertTrue(treeNode.getNums().map.containsKey(num)); + } + treeNode = (PDFNumberTreeNode) parentTree.getKids().get(1); + for (int num = 50; num < 53; num++) { + assertTrue(treeNode.getNums().map.containsKey(num)); + } + } + + /** + * Gets the number of arrays created for a given number of elements + * @param elementNumber The number of elements to be added to the nums array + * @return Returns the number of array objects + * @throws Exception + */ + private int getArrayNumber(int elementNumber) throws Exception { + PDFStructElem structElem = mock(PDFStructElem.class); + for (int structParent = 0; structParent < elementNumber; structParent++) { + parentTree.addToNums(structParent, structElem); + } + return parentTree.getKids().length(); + } +} diff --git a/src/test/java/org/apache/fop/pdf/PDFRectangleTestCase.java b/src/test/java/org/apache/fop/pdf/PDFRectangleTestCase.java new file mode 100644 index 000000000..ed87cd23e --- /dev/null +++ b/src/test/java/org/apache/fop/pdf/PDFRectangleTestCase.java @@ -0,0 +1,52 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.pdf; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.OutputStream; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +/** + * Test case for {@link PDFRectangle}. + */ +public class PDFRectangleTestCase { + + /** + * Test outputInline() - ensure properly formatted co-ords are printed to the output stream. + * @throws IOException if an I/O error occurs + */ + @Test + public void testOutputInline() throws IOException { + OutputStream out = new ByteArrayOutputStream(); + // These are arbitrary values thus have no meaning + PDFRectangle rect = new PDFRectangle(1, 2, 3, 4); + + StringBuilder textBuffer = new StringBuilder(); + // Ensure text before the outputInline() is maintained + textBuffer.append("Test "); + + rect.outputInline(out, textBuffer); + assertEquals("Test [1 2 3 4]", textBuffer.toString()); + } +} diff --git a/src/test/java/org/apache/fop/pdf/PDFReferenceTestCase.java b/src/test/java/org/apache/fop/pdf/PDFReferenceTestCase.java new file mode 100644 index 000000000..4e0e8814d --- /dev/null +++ b/src/test/java/org/apache/fop/pdf/PDFReferenceTestCase.java @@ -0,0 +1,64 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.pdf; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +/** + * Test case for {@link PDFReference}. + */ +public class PDFReferenceTestCase { + + /** + * Tests outputInline() - ensure that this object is properly formatted when printed to the + * output stream. + * @throws IOException if an I/O error occurs + */ + @Test + public void testOutputInline() throws IOException { + PDFName name = new PDFName("Test name"); + name.setObjectNumber(2); + PDFReference pdfRef = new PDFReference(name); + + ByteArrayOutputStream out = new ByteArrayOutputStream(); + StringBuilder textBuffer = new StringBuilder(); + // Ensure that text before outputInline() is kept + textBuffer.append("Text "); + + pdfRef.outputInline(out, textBuffer); + assertEquals("Text 2 0 R", textBuffer.toString()); + } + + /** + * Tests toString() - since this is used quite a lot, we have to ensure the format is correct. + */ + @Test + public void testToString() { + PDFName name = new PDFName("arbitrary"); + name.setObjectNumber(10); + PDFReference ref = new PDFReference(name); + assertEquals("10 0 R", ref.toString()); + } +} diff --git a/src/test/java/org/apache/fop/pdf/PDFStreamTestCase.java b/src/test/java/org/apache/fop/pdf/PDFStreamTestCase.java new file mode 100644 index 000000000..b5fb66e00 --- /dev/null +++ b/src/test/java/org/apache/fop/pdf/PDFStreamTestCase.java @@ -0,0 +1,126 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.pdf; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +public class PDFStreamTestCase { + + private PDFStream stream; + + @Before + public void createStream() { + stream = new PDFStream(); + stream.setObjectNumber(1); + PDFDocument pdfDocument = new PDFDocument("Apache FOP"); + stream.setDocument(pdfDocument); + } + + @Test + public void testFilterSetup() { + testGetFilterList(); + testSetupFilterList(); + } + + private void testGetFilterList() { + PDFFilterList filterList = stream.getFilterList(); + assertFalse(filterList.isInitialized()); + assertEquals(0, filterList.getFilters().size()); + } + + private void testSetupFilterList() { + stream.setupFilterList(); + PDFFilterList filterList = stream.getFilterList(); + assertTrue(filterList.isInitialized()); + assertEquals(1, filterList.getFilters().size()); + PDFFilter filter = filterList.getFilters().get(0); + assertEquals("/FlateDecode", filter.getName()); + } + + @Test + public void customFilter() { + PDFFilterList filters = stream.getFilterList(); + filters.addFilter("null"); + assertTrue(filters.isInitialized()); + assertEquals(1, filters.getFilters().size()); + PDFFilter filter = filters.getFilters().get(0); + assertEquals("", filter.getName()); + } + + @Test + public void testStream() throws IOException { + PDFFilterList filters = stream.getFilterList(); + filters.addFilter("null"); + byte[] bytes = createSampleData(); + stream.setData(bytes); + ByteArrayOutputStream actual = new ByteArrayOutputStream(); + stream.outputRawStreamData(actual); + assertArrayEquals(bytes, actual.toByteArray()); + } + + @Test + public void testEncodeStream() throws IOException { + PDFFilterList filters = stream.getFilterList(); + filters.addFilter("null"); + byte[] bytes = createSampleData(); + stream.setData(bytes); + ByteArrayOutputStream actual = new ByteArrayOutputStream(); + StreamCache streamCache = stream.encodeStream(); + streamCache.outputContents(actual); + assertArrayEquals(bytes, actual.toByteArray()); + } + + @Test + public void testEncodeAndWriteStream() throws IOException { + PDFFilterList filters = stream.getFilterList(); + filters.addFilter("null"); + byte[] bytes = createSampleData(); + stream.setData(bytes); + ByteArrayOutputStream actual = new ByteArrayOutputStream(); + PDFNumber number = new PDFNumber(); + stream.encodeAndWriteStream(actual, number); + assertArrayEquals(createSampleStreamData(), actual.toByteArray()); + } + + private byte[] createSampleData() { + byte[] bytes = new byte[10]; + for (int i = 0; i < 10; i++) { + bytes[i] = (byte) i; + } + return bytes; + } + + private byte[] createSampleStreamData() throws IOException { + ByteArrayOutputStream stream = new ByteArrayOutputStream(); + stream.write("\nstream\n".getBytes("US-ASCII")); + stream.write(createSampleData()); + stream.write("\nendstream".getBytes("US-ASCII")); + return stream.toByteArray(); + } +} diff --git a/src/test/java/org/apache/fop/pdf/PDFUATestCase.java b/src/test/java/org/apache/fop/pdf/PDFUATestCase.java new file mode 100644 index 000000000..e6d7404a2 --- /dev/null +++ b/src/test/java/org/apache/fop/pdf/PDFUATestCase.java @@ -0,0 +1,84 @@ +/* + * 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. + */ + +/* $Id$ */ +package org.apache.fop.pdf; + +import java.awt.geom.Rectangle2D; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.Collection; +import java.util.Iterator; + +import org.junit.Assert; +import org.junit.Test; + +import org.apache.xmlgraphics.util.QName; +import org.apache.xmlgraphics.xmp.Metadata; + +import org.apache.fop.render.pdf.PDFContentGenerator; + +public class PDFUATestCase { + @Test + public void testXMP() throws IOException { + PDFDocument doc = new PDFDocument(""); + doc.getProfile().setPDFUAMode(PDFUAMode.PDFUA_1); + Metadata metadata = PDFMetadata.createXMPFromPDFDocument(doc); + StringBuilder sb = new StringBuilder(); + Iterator i = metadata.iterator(); + while (i.hasNext()) { + QName k = (QName) i.next(); + sb.append(k + ": " + metadata.getProperty(k).getValue() + "\n"); + } + String s = sb.toString(); + Assert.assertTrue(s, s.contains("pdfuaid:part: 1")); + } + + @Test + public void testPDF() throws IOException { + PDFDocument doc = new PDFDocument(""); + doc.getRoot().makeTagged(); + doc.getRoot().setStructTreeRoot(new PDFStructTreeRoot(null)); + doc.getInfo().setTitle("title"); + doc.getProfile().setPDFUAMode(PDFUAMode.PDFUA_1); + PDFResources resources = new PDFResources(doc); + doc.addObject(resources); + PDFResourceContext context = new PDFResourceContext(resources); + ByteArrayOutputStream out = new ByteArrayOutputStream(); + PDFContentGenerator gen = new PDFContentGenerator(doc, out, context); + Rectangle2D.Float f = new Rectangle2D.Float(); + PDFPage page = new PDFPage(resources, 0, f, f, f, f); + doc.addImage(context, new BitmapImage("", 1, 1, new byte[0], null)); + doc.registerObject(page); + gen.flushPDFDoc(); + doc.outputTrailer(out); + + Collection<StringBuilder> objs = PDFLinearizationTestCase.readObjs( + new ByteArrayInputStream(out.toByteArray())).values(); + Assert.assertTrue(getObj(objs, "/Type /Catalog").contains("/ViewerPreferences << /DisplayDocTitle true >>")); + } + + private String getObj(Collection<StringBuilder> objs, String x) { + for (StringBuilder s : objs) { + if (s.toString().contains(x)) { + return s.toString(); + } + } + return null; + } +} diff --git a/src/test/java/org/apache/fop/pdf/PDFVT.fo b/src/test/java/org/apache/fop/pdf/PDFVT.fo new file mode 100644 index 000000000..6919afcf6 --- /dev/null +++ b/src/test/java/org/apache/fop/pdf/PDFVT.fo @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" font-family="Arial" xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf"> + <fo:layout-master-set> + <fo:simple-page-master master-name="simple" page-height="27.9cm" page-width="21.6cm"> + <fo:region-body /> + <pdf:vt> + <pdf:dictionary key="DPM/CIP4_Root/CIP4_Production/CIP4_Part"> + <pdf:string key="CIP4_ProductType">frontpages</pdf:string> + </pdf:dictionary> + </pdf:vt> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:declarations> + <x:xmpmeta xmlns:x="adobe:ns:meta/"> + <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> + <rdf:Description rdf:about="" xmlns:dc="http://purl.org/dc/elements/1.1/"> + <dc:title>Document title</dc:title> + <dc:creator>Document author</dc:creator> + <dc:description>Document subject</dc:description> + </rdf:Description> + </rdf:RDF> + </x:xmpmeta> + </fo:declarations> + <fo:page-sequence format="1" id="th_default_sequence1" master-reference="simple"> + <fo:flow flow-name="xsl-region-body"> + <fo:block>page 1</fo:block> + </fo:flow> + </fo:page-sequence> +</fo:root> diff --git a/src/test/java/org/apache/fop/pdf/PDFVT.xconf b/src/test/java/org/apache/fop/pdf/PDFVT.xconf new file mode 100644 index 000000000..52588f0b0 --- /dev/null +++ b/src/test/java/org/apache/fop/pdf/PDFVT.xconf @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<fop version="1.0"> + <renderers> + <renderer mime="application/pdf"> + <pdf-x-mode>PDF/X-4</pdf-x-mode> + <pdf-vt-mode>PDF/VT-1</pdf-vt-mode> + <output-profile>test/resources/color/ISOcoated_v2_300_bas.icc</output-profile> + <fonts> + <font kerning="yes" embed-url="test/resources/fonts/ttf/DejaVuLGCSerif.ttf"> + <font-triplet name="Arial" style="normal" weight="normal"/> + </font> + </fonts> + </renderer> + </renderers> +</fop> diff --git a/src/test/java/org/apache/fop/pdf/PDFVTTestCase.java b/src/test/java/org/apache/fop/pdf/PDFVTTestCase.java new file mode 100644 index 000000000..a2c1a010c --- /dev/null +++ b/src/test/java/org/apache/fop/pdf/PDFVTTestCase.java @@ -0,0 +1,195 @@ +/* + * 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. + */ + +/* $Id$ */ +package org.apache.fop.pdf; + +import java.awt.geom.Rectangle2D; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.Collection; +import java.util.Iterator; +import java.util.Map; + +import javax.xml.transform.Result; +import javax.xml.transform.Source; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.sax.SAXResult; +import javax.xml.transform.stream.StreamResult; +import javax.xml.transform.stream.StreamSource; + +import org.junit.Assert; +import org.junit.Test; + +import org.xml.sax.SAXException; + +import org.apache.xmlgraphics.util.QName; +import org.apache.xmlgraphics.xmp.Metadata; + +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.apps.Fop; +import org.apache.fop.apps.FopFactory; +import org.apache.fop.apps.MimeConstants; +import org.apache.fop.render.intermediate.IFContext; +import org.apache.fop.render.intermediate.IFDocumentHandler; +import org.apache.fop.render.intermediate.IFException; +import org.apache.fop.render.intermediate.IFParser; +import org.apache.fop.render.intermediate.IFSerializer; +import org.apache.fop.render.intermediate.IFUtil; +import org.apache.fop.render.pdf.PDFContentGenerator; + +public class PDFVTTestCase { + @Test + public void testXMP() throws IOException { + PDFDocument doc = new PDFDocument(""); + doc.getProfile().setPDFXMode(PDFXMode.PDFX_4); + doc.getProfile().setPDFVTMode(PDFVTMode.PDFVT_1); + Metadata metadata = PDFMetadata.createXMPFromPDFDocument(doc); + StringBuilder sb = new StringBuilder(); + Iterator i = metadata.iterator(); + while (i.hasNext()) { + QName k = (QName) i.next(); + sb.append(k + ": " + metadata.getProperty(k).getValue() + "\n"); + } + String s = sb.toString(); + Assert.assertTrue(s.contains("pdfxid:GTS_PDFXVersion: PDF/X-4")); + Assert.assertTrue(s.contains("xmpMM:VersionID: 1")); + Assert.assertTrue(s.contains("pdf:Trapped: False")); + Assert.assertTrue(s.contains("xmpMM:RenditionClass: default")); + Assert.assertTrue(s.contains("pdf:PDFVersion: 1.4")); + Assert.assertTrue(s.contains("pdfvtid:GTS_PDFVTVersion: PDF/VT-1")); + } + + @Test + public void testPDF() throws IOException { + PDFDocument doc = new PDFDocument(""); + doc.getInfo().setTitle("title"); + doc.getProfile().setPDFXMode(PDFXMode.PDFX_4); + doc.getProfile().setPDFVTMode(PDFVTMode.PDFVT_1); + PDFResources resources = new PDFResources(doc); + doc.addObject(resources); + PDFResourceContext context = new PDFResourceContext(resources); + ByteArrayOutputStream out = new ByteArrayOutputStream(); + PDFContentGenerator gen = new PDFContentGenerator(doc, out, context); + Rectangle2D.Float f = new Rectangle2D.Float(); + PDFPage page = new PDFPage(resources, 0, f, f, f, f); + doc.addImage(context, new BitmapImage("", 1, 1, new byte[0], null)); + doc.registerObject(page); + doc.getFactory().makeDPart(page, "master"); + gen.flushPDFDoc(); + doc.outputTrailer(out); + + Collection<StringBuilder> objs = PDFLinearizationTestCase.readObjs( + new ByteArrayInputStream(out.toByteArray())).values(); + Assert.assertTrue(getObj(objs, "/Type /Catalog").contains("/DPartRoot ")); + Assert.assertTrue(getObj(objs, "/Type /DPartRoot").contains("/NodeNameList [/root /record]")); + Assert.assertTrue( + getObj(objs, "/Subtype /Image").contains("/GTS_XID (uuid:d41d8cd9-8f00-3204-a980-0998ecf8427e)")); + } + + @Test + public void textFO() throws IOException, SAXException, TransformerException, IFException { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + foToOutput(out, MimeConstants.MIME_PDF); + checkPDF(out); + } + + @Test + public void textIF() throws IOException, SAXException, TransformerException, IFException { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + foToOutput(out, MimeConstants.MIME_FOP_IF); + iFToPDF(new ByteArrayInputStream(out.toByteArray())); + } + + + private void foToOutput(ByteArrayOutputStream out, String mimeFopIf) + throws IOException, SAXException, TransformerException { + FopFactory fopFactory = getFopFactory(); + FOUserAgent userAgent = fopFactory.newFOUserAgent(); + + if (mimeFopIf.equals(MimeConstants.MIME_FOP_IF)) { + IFSerializer serializer = new IFSerializer(new IFContext(userAgent)); + IFDocumentHandler targetHandler + = userAgent.getRendererFactory().createDocumentHandler(userAgent, MimeConstants.MIME_PDF); + serializer.mimicDocumentHandler(targetHandler); + userAgent.setDocumentHandlerOverride(serializer); + } + + Fop fop = fopFactory.newFop(mimeFopIf, userAgent, out); + Transformer transformer = TransformerFactory.newInstance().newTransformer(); + Source src = new StreamSource(new FileInputStream("test/java/org/apache/fop/pdf/PDFVT.fo")); + Result res = new SAXResult(fop.getDefaultHandler()); + transformer.transform(src, res); + } + + private FopFactory getFopFactory() throws IOException, SAXException { + return FopFactory.newInstance(new File(".").toURI(), + new FileInputStream("test/java/org/apache/fop/pdf/PDFVT.xconf")); + } + + private void iFToPDF(InputStream is) throws IOException, SAXException, TransformerException, IFException { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + + FOUserAgent userAgent = getFopFactory().newFOUserAgent(); + Transformer transformer = TransformerFactory.newInstance().newTransformer(); + Source src = new StreamSource(is); + IFDocumentHandler documentHandler + = userAgent.getRendererFactory().createDocumentHandler(userAgent, MimeConstants.MIME_PDF); + documentHandler.setResult(new StreamResult(out)); + IFUtil.setupFonts(documentHandler); + IFParser parser = new IFParser(); + Result res = new SAXResult(parser.getContentHandler(documentHandler, userAgent)); + transformer.transform(src, res); + + checkPDF(out); + } + + private void checkPDF(ByteArrayOutputStream out) throws IOException { + Map<String, StringBuilder> objs = + PDFLinearizationTestCase.readObjs(new ByteArrayInputStream(out.toByteArray())); + String dpart = getObj(objs.values(), "/DParts"); + int v = getValue("/DParts", dpart); + String dpm = objs.get(v + " 0 obj").toString(); + Assert.assertTrue(dpm.contains( + "/DPM << /CIP4_Root << /CIP4_Production << /CIP4_Part << /CIP4_ProductType (frontpages) >>")); + } + + private int getValue(String name, String firstObj) throws IOException { + String[] split = firstObj.split(" "); + for (int i = 0; i < split.length; i++) { + if (split[i].equals(name)) { + return Integer.valueOf(split[i + 1].replace("[[", "")); + } + } + throw new IOException(name + " not found " + firstObj); + } + + private String getObj(Collection<StringBuilder> objs, String x) { + for (StringBuilder s : objs) { + if (s.toString().contains(x)) { + return s.toString(); + } + } + return null; + } +} diff --git a/src/test/java/org/apache/fop/pdf/TableHeaderScopeTestCase.java b/src/test/java/org/apache/fop/pdf/TableHeaderScopeTestCase.java new file mode 100644 index 000000000..2fa5008ed --- /dev/null +++ b/src/test/java/org/apache/fop/pdf/TableHeaderScopeTestCase.java @@ -0,0 +1,132 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.pdf; + +import org.junit.Test; +import org.mockito.ArgumentMatcher; +import org.mockito.verification.VerificationMode; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.argThat; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import org.apache.fop.pdf.StandardStructureAttributes.Table.Scope; +import org.apache.fop.pdf.StandardStructureTypes.Table; + +public class TableHeaderScopeTestCase { + + private static final String ATTRIBUTE_ENTRY = "A"; + + private VersionController controller; + + @Test + public void pdfDocumentDelegatesToVersionController() { + for (Scope scope : Scope.values()) { + testMakeStructureElementWithScope(scope); + } + } + + private void testMakeStructureElementWithScope(Scope scope) { + VersionController controller = mock(VersionController.class); + PDFDocument document = new PDFDocument("Test", controller); + document.makeStructTreeRoot(null); + PDFStructElem th = new PDFStructElem(null, Table.TH); + document.registerStructureElement(th, scope); + verify(controller).addTableHeaderScopeAttribute(any(PDFStructElem.class), eq(scope)); + } + + @Test + public void versionControllerMayDelegateToScope() { + fixedController14doesNotAddAttribute(); + fixedController15addsAttribute(); + dynamicControllerAddsAttribute(); + } + + private void fixedController14doesNotAddAttribute() { + controller = VersionController.getFixedVersionController(Version.V1_4); + scopeMustNotBeAdded(); + } + + private void fixedController15addsAttribute() { + controller = VersionController.getFixedVersionController(Version.V1_5); + scopeMustBeAdded(); + } + + private void dynamicControllerAddsAttribute() { + PDFDocument document = new PDFDocument("Test"); + controller = VersionController.getDynamicVersionController(Version.V1_4, document); + scopeMustBeAdded(); + assertEquals(Version.V1_5, controller.getPDFVersion()); + } + + private void scopeMustBeAdded() { + scopeMustBeAdded(times(1)); + } + + private void scopeMustNotBeAdded() { + scopeMustBeAdded(never()); + } + + private void scopeMustBeAdded(VerificationMode nTimes) { + PDFStructElem structElem = mock(PDFStructElem.class); + controller.addTableHeaderScopeAttribute(structElem, Scope.COLUMN); + verify(structElem, nTimes).put(eq(ATTRIBUTE_ENTRY), any()); + } + + @Test + public void scopeAddsTheAttribute() { + for (Scope scope : Scope.values()) { + scopeAttributeMustBeAdded(scope); + } + } + + private void scopeAttributeMustBeAdded(Scope scope) { + PDFStructElem structElem = mock(PDFStructElem.class); + Scope.addScopeAttribute(structElem, scope); + verify(structElem).put(eq(ATTRIBUTE_ENTRY), scopeAttribute(scope)); + } + + private PDFDictionary scopeAttribute(Scope scope) { + return argThat(new IsScopeAttribute(scope)); + } + + private static class IsScopeAttribute extends ArgumentMatcher<PDFDictionary> { + + private final Scope expectedScope; + + public IsScopeAttribute(Scope expectedScope) { + this.expectedScope = expectedScope; + } + + @Override + public boolean matches(Object argument) { + PDFDictionary attribute = (PDFDictionary) argument; + return "/Table".equals(attribute.get("O").toString()) + && expectedScope.getName().toString().equals(attribute.get("Scope").toString()); + } + + } + +} diff --git a/src/test/java/org/apache/fop/pdf/VersionControllerTestCase.java b/src/test/java/org/apache/fop/pdf/VersionControllerTestCase.java new file mode 100644 index 000000000..383208405 --- /dev/null +++ b/src/test/java/org/apache/fop/pdf/VersionControllerTestCase.java @@ -0,0 +1,144 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.pdf; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.fail; + +/** + * A test class for {@link VersionController}. + */ +public class VersionControllerTestCase { + + private PDFDocument doc; + + @Before + public void setUp() { + doc = new PDFDocument("test"); + } + + @Test + public void testGetVersion() { + // These do the same thing + for (Version version : Version.values()) { + if (version.compareTo(Version.V1_4) >= 0) { + VersionController fixedVC = VersionController.getFixedVersionController(version); + assertEquals(version, fixedVC.getPDFVersion()); + } + + VersionController dynamicVC = VersionController.getDynamicVersionController(version, + doc); + assertEquals(version, dynamicVC.getPDFVersion()); + } + } + + /** + * Tests that the setter methods work at setting the underlying version. + * Here there is a disparity between the two objects, the fixed version will + * throw an exception if the setter is invoked. The dynamic version will + * allow the version to be changed, if the new version is greater than the + * version already set. + */ + @Test + public void testSetVersion() { + // Create every type of expected PDFVersion + for (Version originalVersion : Version.values()) { + // Compare against every type of Version + for (Version setVersion : Version.values()) { + testDynamicController(originalVersion, setVersion); + testFixedController(originalVersion, setVersion); + } + + } + } + + /** + * The fixed implementation will throw an exception if an attempt is made to change its + * version. + * + * @param originalVersion the version given to the constructor when PDFVersion instantiated + * @param setVersion the version being set + */ + private void testFixedController(Version originalVersion, Version setVersion) { + if (originalVersion.compareTo(Version.V1_4) >= 0) { + VersionController fixedVC = VersionController + .getFixedVersionController(originalVersion); + try { + fixedVC.setPDFVersion(setVersion); + if (setVersion.compareTo(originalVersion) != 0) { + fail("The FixedVersionController should throw an exception if an attempt to change " + + "the version is made"); + } + } catch (IllegalStateException e) { + // PASS + } + // Changes are NOT allowed, the original version is immutable + assertEquals(originalVersion, fixedVC.getPDFVersion()); + // The document version is NEVER changed + assertEquals(Version.V1_4, doc.getPDFVersion()); + // the /Version parameter shouldn't be present in the document catalog + assertNull(doc.getRoot().get("Version")); + } else { + try { + VersionController.getFixedVersionController(originalVersion); + fail("Versions < 1.4 aren't allowed."); + } catch (IllegalArgumentException e) { + // PASS + } + } + } + + /** + * The dynamic implementation allows the version to be changed. However, the version given in + * the constructor will be the version set in the header of the PDF document. Any change to the + * version will then be made in the document catalog. + * + * @param originalVersion the version given to the constructor when PDFVersion instantiated + * @param setVersion the version being set + */ + private void testDynamicController(Version originalVersion, Version setVersion) { + VersionController testSubj = VersionController.getDynamicVersionController(originalVersion, + doc); + testSubj.setPDFVersion(setVersion); + PDFName nameVersion = new PDFName(setVersion.toString()); + + if (originalVersion.compareTo(setVersion) < 0) { + versionShouldChange(setVersion, testSubj, nameVersion); + } else { + versionShouldNotChange(originalVersion, testSubj); + } + doc.getRoot().put("Version", null); + } + + private void versionShouldNotChange(Version originalVersion, VersionController testSubj) { + assertEquals(originalVersion, testSubj.getPDFVersion()); + assertNull(doc.getRoot().get("Version")); + } + + private void versionShouldChange(Version setVersion, VersionController testSubj, + PDFName nameVersion) { + assertEquals(setVersion, testSubj.getPDFVersion()); + assertEquals(nameVersion.toString(), doc.getRoot().get("Version").toString()); + } +} diff --git a/src/test/java/org/apache/fop/pdf/VersionTestCase.java b/src/test/java/org/apache/fop/pdf/VersionTestCase.java new file mode 100644 index 000000000..dd2731d8b --- /dev/null +++ b/src/test/java/org/apache/fop/pdf/VersionTestCase.java @@ -0,0 +1,89 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.pdf; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +/** + * This is a test case for ({@link Version}. + */ +public class VersionTestCase { + + /** + * Test the <code>getValue()</code> method. This should return {@link Version} given a + * {@link String}. + */ + @Test + public void testGetValue() { + int index = 0; + for (Version version : Version.values()) { + assertEquals(version, Version.getValueOf("1." + index++)); + } + } + + @Test(expected = IllegalArgumentException.class) + public void testGetValueIllegalArgument() { + Version.getValueOf("blah"); + } + + /** + * Tests that the <code>toString()</method> method returns the PDF version string of the proper + * format. + */ + @Test + public void testToString() { + // Test all the normal values + int index = 0; + for (Version version : Version.values()) { + assertTrue(version.toString().equals("1." + index++)); + } + } + + /** + * Tests that the <code>compareTo()</code> contract is obeyed. + */ + @Test + public void testCompareTo() { + // Ensure that the implicit comparison contract is satisfied + Version[] expected = { + Version.V1_0, + Version.V1_1, + Version.V1_2, + Version.V1_3, + Version.V1_4, + Version.V1_5, + Version.V1_6, + Version.V1_7 + }; + + Version[] actual = Version.values(); + + for (int i = 0; i < actual.length - 1; i++) { + assertEquals(-1, actual[i].compareTo(expected[i + 1])); + + assertEquals(0, actual[i].compareTo(expected[i])); + + assertEquals(1, actual[i + 1].compareTo(expected[i])); + } + } +} diff --git a/src/test/java/org/apache/fop/pdf/xref/CompressedObjectReferenceTestCase.java b/src/test/java/org/apache/fop/pdf/xref/CompressedObjectReferenceTestCase.java new file mode 100644 index 000000000..b58d2f93e --- /dev/null +++ b/src/test/java/org/apache/fop/pdf/xref/CompressedObjectReferenceTestCase.java @@ -0,0 +1,52 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.pdf.xref; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; + +import org.junit.Test; + +import static org.junit.Assert.assertArrayEquals; + +import org.apache.fop.pdf.PDFObjectNumber; + +public class CompressedObjectReferenceTestCase extends ObjectReferenceTest { + + @Test + public void testOutput() throws IOException { + runTest(Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0), 0); + runTest(Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0x1), 4); + runTest(Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0xf3), 16); + runTest(Arrays.asList(0, 0, 0, 0, 0, 0, 0x5, 0xf7), 128); + runTest(Arrays.asList(0, 0, 0, 0, 0, 0x9, 0xfb, 0xd), 0xae); + runTest(Arrays.asList(0, 0, 0, 0, 0x11, 0xff, 0x15, 0xe9), 0xff); + } + + private void runTest(List<Integer> expectedObjectStreamBytes, int index) throws IOException { + int objectStreamNumber = (int) computeNumberFromBytes(expectedObjectStreamBytes); + sut = new CompressedObjectReference(new PDFObjectNumber(0), new PDFObjectNumber(objectStreamNumber), index); + byte[] expected = createExpectedOutput((byte) 2, expectedObjectStreamBytes, index); + byte[] actual = getActualOutput(); + assertArrayEquals(expected, actual); + } + +} diff --git a/src/test/java/org/apache/fop/pdf/xref/CrossReferenceObjectTest.java b/src/test/java/org/apache/fop/pdf/xref/CrossReferenceObjectTest.java new file mode 100644 index 000000000..513f0d754 --- /dev/null +++ b/src/test/java/org/apache/fop/pdf/xref/CrossReferenceObjectTest.java @@ -0,0 +1,106 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.pdf.xref; + +import java.io.ByteArrayOutputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.io.UnsupportedEncodingException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +import org.junit.Before; + +import static org.junit.Assert.assertArrayEquals; + +import org.apache.fop.pdf.PDFDocument; +import org.apache.fop.pdf.PDFInfo; +import org.apache.fop.pdf.PDFPages; +import org.apache.fop.pdf.PDFRoot; + +public abstract class CrossReferenceObjectTest { + + protected static final int STARTXREF = 12345; + + protected PDFDocument pdfDocument; + + protected TrailerDictionary trailerDictionary; + + private CrossReferenceObject crossReferenceObject; + + @Before + public void setUp() throws UnsupportedEncodingException { + pdfDocument = new PDFDocument("Apache FOP"); + Map<String, List<String>> filterMap = pdfDocument.getFilterMap(); + filterMap.put("default", Arrays.asList("null")); + PDFRoot root = new PDFRoot(pdfDocument, new PDFPages(pdfDocument)); + PDFInfo info = new PDFInfo(); + info.setObjectNumber(2); + byte[] fileID = + new byte[] {0x01, 0x23, 0x45, 0x67, (byte) 0x89, (byte) 0xab, (byte) 0xcd, (byte) 0xef}; + trailerDictionary = new TrailerDictionary(pdfDocument) + .setRoot(root) + .setInfo(info) + .setFileID(fileID, fileID); + } + + protected void runTest() throws IOException { + crossReferenceObject = createCrossReferenceObject(); + byte[] expected = createExpectedCrossReferenceData(); + byte[] actual = createActualCrossReferenceData(); + assertArrayEquals(expected, actual); + } + + protected abstract CrossReferenceObject createCrossReferenceObject(); + + protected abstract byte[] createExpectedCrossReferenceData() throws IOException; + + protected byte[] createActualCrossReferenceData() throws IOException { + ByteArrayOutputStream pdf = new ByteArrayOutputStream(); + crossReferenceObject.output(pdf); + pdf.close(); + return pdf.toByteArray(); + } + + protected byte[] getBytes(StringBuilder stringBuilder) { + return getBytes(stringBuilder.toString()); + } + + protected byte[] getBytes(String string) { + try { + return string.getBytes("US-ASCII"); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(e); + } + } + + /** + * Outputs the given byte array to a file with the given name. Use for debugging + * purpose. + */ + protected void streamToFile(byte[] bytes, String filename) throws IOException { + OutputStream output = new FileOutputStream(filename); + output.write(bytes); + output.close(); + } + +} diff --git a/src/test/java/org/apache/fop/pdf/xref/CrossReferenceStreamTestCase.java b/src/test/java/org/apache/fop/pdf/xref/CrossReferenceStreamTestCase.java new file mode 100644 index 000000000..82af9fe5b --- /dev/null +++ b/src/test/java/org/apache/fop/pdf/xref/CrossReferenceStreamTestCase.java @@ -0,0 +1,144 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.pdf.xref; + +import java.io.ByteArrayOutputStream; +import java.io.DataOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.junit.Test; + +import org.apache.fop.pdf.PDFObjectNumber; + +public class CrossReferenceStreamTestCase extends CrossReferenceObjectTest { + + private List<Long> uncompressedObjectOffsets; + + private List<CompressedObjectReference> compressedObjectReferences; + + @Test + public void testWithNoOffset() throws IOException { + List<Long> emptyList = Collections.emptyList(); + test(emptyList); + } + + @Test + public void testWithOffsets() throws IOException { + test(new ArrayList<Long>(Arrays.asList(0L, 1L, 2L, 3L, 4L))); + } + + @Test + public void testWithBigOffsets() throws IOException { + test(new ArrayList<Long>(Arrays.asList(0xffL, 0xffffL, 0xffffffffL, 0xffffffffffffffffL))); + } + + @Test + public void testWithObjectStreams1() throws IOException { + List<CompressedObjectReference> compressedObjectReferences = + Arrays.asList(new CompressedObjectReference(new PDFObjectNumber(2), new PDFObjectNumber(1), 0)); + test(Arrays.asList(0L, null), compressedObjectReferences); + } + + @Test + public void testWithObjectStreams2() throws IOException { + int numIndirectObjects = 2; + int numCompressedObjects = 1; + List<Long> indirectObjectOffsets + = new ArrayList<Long>(numIndirectObjects + numCompressedObjects); + for (long i = 0; i < numIndirectObjects; i++) { + indirectObjectOffsets.add(i); + } + List<CompressedObjectReference> compressedObjectReferences + = new ArrayList<CompressedObjectReference>(); + for (int index = 0; index < numCompressedObjects; index++) { + indirectObjectOffsets.add(null); + int obNum = numIndirectObjects + index + 1; + compressedObjectReferences.add(new CompressedObjectReference(new PDFObjectNumber(obNum), + new PDFObjectNumber(numIndirectObjects), index)); + } + test(indirectObjectOffsets, compressedObjectReferences); + } + + private void test(List<Long> indirectObjectOffsets) throws IOException { + List<CompressedObjectReference> compressedObjectReferences = Collections.emptyList(); + test(indirectObjectOffsets, compressedObjectReferences); + } + + private void test(List<Long> indirectObjectOffsets, + List<CompressedObjectReference> compressedObjectReferences) throws IOException { + this.uncompressedObjectOffsets = indirectObjectOffsets; + this.compressedObjectReferences = compressedObjectReferences; + runTest(); + } + + @Override + protected CrossReferenceObject createCrossReferenceObject() { + return new CrossReferenceStream(pdfDocument, + uncompressedObjectOffsets.size() + 1, + trailerDictionary, + STARTXREF, + uncompressedObjectOffsets, + compressedObjectReferences); + } + + @Override + protected byte[] createExpectedCrossReferenceData() throws IOException { + List<ObjectReference> objectReferences + = new ArrayList<ObjectReference>(uncompressedObjectOffsets.size()); + for (Long offset : uncompressedObjectOffsets) { + objectReferences.add(offset == null ? null : new UncompressedObjectReference(offset)); + } + for (CompressedObjectReference ref : compressedObjectReferences) { + objectReferences.set(ref.getObjectNumber().getNumber() - 1, ref); + } + int maxObjectNumber = objectReferences.size() + 1; + ByteArrayOutputStream stream = new ByteArrayOutputStream(); + StringBuilder expected = new StringBuilder(256); + expected.append(maxObjectNumber + " 0 obj\n") + .append("<<\n") + .append(" /Root 1 0 R\n") + .append(" /Info 2 0 R\n") + .append(" /ID [<0123456789ABCDEF> <0123456789ABCDEF>]\n") + .append(" /Type /XRef\n") + .append(" /Size ").append(Integer.toString(maxObjectNumber + 1)).append('\n') + .append(" /W [1 8 2]\n") + .append(" /Length ").append(Integer.toString((maxObjectNumber + 1) * 11)).append('\n') + .append(">>\n") + .append("stream\n"); + stream.write(getBytes(expected)); + DataOutputStream data = new DataOutputStream(stream); + data.write(new byte[] {0, 0, 0, 0, 0, 0, 0, 0, 0, (byte) 0xff, (byte) 0xff}); + for (ObjectReference objectReference : objectReferences) { + objectReference.output(data); + } + data.write(1); + data.writeLong(STARTXREF); + data.write(0); + data.write(0); + data.close(); + stream.write(getBytes("\nendstream\nendobj\n")); + return stream.toByteArray(); + } + +} diff --git a/src/test/java/org/apache/fop/pdf/xref/CrossReferenceTableTestCase.java b/src/test/java/org/apache/fop/pdf/xref/CrossReferenceTableTestCase.java new file mode 100644 index 000000000..1c609e30f --- /dev/null +++ b/src/test/java/org/apache/fop/pdf/xref/CrossReferenceTableTestCase.java @@ -0,0 +1,80 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.pdf.xref; + +import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.junit.Test; + +public class CrossReferenceTableTestCase extends CrossReferenceObjectTest { + + private List<Long> offsets; + + @Test + public void testWithNoOffset() throws IOException { + List<Long> emptyList = Collections.emptyList(); + runTest(emptyList); + } + + @Test + public void testWithOffsets() throws IOException { + runTest(Arrays.asList(0L, 1L, 2L, 3L, 4L)); + } + + @Test + public void testWithBigOffsets() throws IOException { + runTest(Arrays.asList(0xffL, 0xffffL, 0x7fffffffL)); + } + + private void runTest(List<Long> offsets) throws IOException { + this.offsets = offsets; + runTest(); + } + + @Override + protected CrossReferenceObject createCrossReferenceObject() { + return new CrossReferenceTable(trailerDictionary, STARTXREF, offsets, 0, offsets.size(), offsets.size()); + } + + @Override + protected byte[] createExpectedCrossReferenceData() throws IOException { + StringBuilder expected = new StringBuilder(256); + expected.append("xref\n0 ") + .append(offsets.size() + 1) + .append("\n0000000000 65535 f \n"); + for (Long objectReference : offsets) { + final String padding = "0000000000"; + String s = String.valueOf(objectReference).toString(); + String loc = padding.substring(s.length()) + s; + expected.append(loc).append(" 00000 n \n"); + } + expected.append("trailer\n<<\n") + .append(" /Root 1 0 R\n") + .append(" /Info 2 0 R\n") + .append(" /ID [<0123456789ABCDEF> <0123456789ABCDEF>]\n") + .append(" /Size ").append(Integer.toString(offsets.size() + 1)).append('\n') + .append(">>"); + return getBytes(expected); + } + +} diff --git a/src/test/java/org/apache/fop/pdf/xref/ObjectReferenceTest.java b/src/test/java/org/apache/fop/pdf/xref/ObjectReferenceTest.java new file mode 100644 index 000000000..fada2794c --- /dev/null +++ b/src/test/java/org/apache/fop/pdf/xref/ObjectReferenceTest.java @@ -0,0 +1,62 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.pdf.xref; + +import java.io.ByteArrayOutputStream; +import java.io.DataOutputStream; +import java.io.IOException; +import java.util.List; + +abstract class ObjectReferenceTest { + + protected ObjectReference sut; + + protected long computeNumberFromBytes(List<Integer> expectedOffsetBytes) { + assert expectedOffsetBytes.size() <= 8; + long offset = 0; + for (int b : expectedOffsetBytes) { + offset = offset << 8 | b; + } + return offset; + } + + protected byte[] createExpectedOutput(byte field1, List<Integer> field2, int field3) { + assert field2.size() == 8; + assert (field3 & 0xffff) == field3; + byte[] expected = new byte[11]; + int index = 0; + expected[index++] = field1; + for (Integer b : field2) { + expected[index++] = b.byteValue(); + } + expected[index++] = (byte) ((field3 & 0xff00) >> 8); + expected[index++] = (byte) (field3 & 0xff); + return expected; + } + + protected byte[] getActualOutput() throws IOException { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + DataOutputStream dataOutputStream = new DataOutputStream(out); + sut.output(dataOutputStream); + dataOutputStream.close(); + return out.toByteArray(); + } + +} diff --git a/src/test/java/org/apache/fop/pdf/xref/UncompressedObjectReferenceTestCase.java b/src/test/java/org/apache/fop/pdf/xref/UncompressedObjectReferenceTestCase.java new file mode 100644 index 000000000..a9f506aaa --- /dev/null +++ b/src/test/java/org/apache/fop/pdf/xref/UncompressedObjectReferenceTestCase.java @@ -0,0 +1,90 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.pdf.xref; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.junit.Test; + +import static org.junit.Assert.assertArrayEquals; + +public class UncompressedObjectReferenceTestCase extends ObjectReferenceTest { + + @Test + public void test1ByteOffsets() throws IOException { + run1ByteOffsetTest(0x0); + run1ByteOffsetTest(0xf); + run1ByteOffsetTest(0x10); + run1ByteOffsetTest(0xff); + } + + private void run1ByteOffsetTest(int offset) throws IOException { + runIntegerOffsetTest(Arrays.asList(0, 0, 0, offset)); + } + + @Test + public void test2ByteOffsets() throws IOException { + runIntegerOffsetTest(Arrays.asList(0, 0, 1, 0xff)); + runIntegerOffsetTest(Arrays.asList(0, 0, 0xa0, 0xff)); + } + + @Test + public void test3ByteOffsets() throws IOException { + runIntegerOffsetTest(Arrays.asList(0, 2, 0x12, 0x34)); + runIntegerOffsetTest(Arrays.asList(0, 0xee, 0x56, 0x78)); + } + + @Test + public void test4ByteOffsets() throws IOException { + runIntegerOffsetTest(Arrays.asList(0x6, 0x12, 0x34, 0x56)); + runIntegerOffsetTest(Arrays.asList(0xf1, 0x9a, 0xbc, 0xde)); + } + + @Test + public void test5ByteOffsets() throws IOException { + runTest(Arrays.asList(0, 0, 0, 0x7, 0x78, 0x9a, 0xbc, 0xde)); + runTest(Arrays.asList(0, 0, 0, 0xbf, 0xf0, 0, 0x1, 0x2)); + } + + @Test + public void test8ByteOffsets() throws IOException { + runTest(Arrays.asList(0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8)); + runTest(Arrays.asList(0xf9, 0xe8, 0xd7, 0xc6, 0xb5, 0xa4, 0x93, 0x82)); + } + + private void runIntegerOffsetTest(List<Integer> expectedOffsetBytes) throws IOException { + List<Integer> expectedLongOffset = new ArrayList<Integer>(8); + expectedLongOffset.addAll(Arrays.asList(0, 0, 0, 0)); + expectedLongOffset.addAll(expectedOffsetBytes); + runTest(expectedLongOffset); + } + + private void runTest(List<Integer> expectedOffsetBytes) throws IOException { + long offset = computeNumberFromBytes(expectedOffsetBytes); + sut = new UncompressedObjectReference(offset); + byte[] expected = createExpectedOutput((byte) 1, expectedOffsetBytes, (byte) 0); + byte[] actual = getActualOutput(); + assertArrayEquals(expected, actual); + } + +} diff --git a/src/test/java/org/apache/fop/render/AbstractPathOrientedRendererTestCase.java b/src/test/java/org/apache/fop/render/AbstractPathOrientedRendererTestCase.java new file mode 100644 index 000000000..b7ab64fcf --- /dev/null +++ b/src/test/java/org/apache/fop/render/AbstractPathOrientedRendererTestCase.java @@ -0,0 +1,162 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render; + +import java.awt.Color; +import java.awt.Rectangle; +import java.awt.geom.AffineTransform; +import java.awt.geom.Rectangle2D; +import java.util.List; +import java.util.Map; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.mock; + +import org.apache.xmlgraphics.image.loader.ImageInfo; +import org.apache.xmlgraphics.image.loader.ImageSize; + +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.area.CTM; +import org.apache.fop.area.Trait; + +public class AbstractPathOrientedRendererTestCase { + + @Before + public void setUp() throws Exception { + } + + @Test + public void testDrawBackgroundWithTargetImageSizes() { + FOUserAgent userAgent = mock(FOUserAgent.class); + MyAPOR myAPOR = new MyAPOR(userAgent); + ImageSize imgSize = new ImageSize(300, 300, 300); + imgSize.setSizeInMillipoints(72000, 72000); + ImageInfo imgInfo = new ImageInfo(null, null); + imgInfo.setSize(imgSize); + Trait.Background background = new Trait.Background(); + background.setImageTargetWidth(300000); + background.setImageTargetHeight(300000); + background.setImageInfo(imgInfo); + myAPOR.drawBackground(0, 0, 600, 900, background, null, null, null, null); + String expected = "[x=0.0,y=0.0,w=3.0,h=3.0][x=0.0,y=3.0,w=3.0,h=3.0][x=0.0,y=6.0,w=3.0,h=3.0]" + + "[x=0.0,y=9.0,w=3.0,h=3.0][x=3.0,y=0.0,w=3.0,h=3.0][x=3.0,y=3.0,w=3.0,h=3.0]" + + "[x=3.0,y=6.0,w=3.0,h=3.0][x=3.0,y=9.0,w=3.0,h=3.0][x=6.0,y=0.0,w=3.0,h=3.0]" + + "[x=6.0,y=3.0,w=3.0,h=3.0][x=6.0,y=6.0,w=3.0,h=3.0][x=6.0,y=9.0,w=3.0,h=3.0]"; + assertEquals(expected, myAPOR.getActual().replaceAll("00000", "")); + myAPOR.resetActual(); + background.setImageTargetWidth(0); + myAPOR.drawBackground(0, 0, 600, 900, background, null, null, null, null); + assertEquals(expected, myAPOR.getActual().replaceAll("00000", "")); + myAPOR.resetActual(); + background.setImageTargetWidth(300000); + background.setImageTargetHeight(0); + myAPOR.drawBackground(0, 0, 600, 900, background, null, null, null, null); + assertEquals(expected, myAPOR.getActual().replaceAll("00000", "")); + } + + private class MyAPOR extends AbstractPathOrientedRenderer { + + private String actual = ""; + + public MyAPOR(FOUserAgent userAgent) { + super(userAgent); + } + + public String getActual() { + return actual; + } + + public void resetActual() { + actual = ""; + } + + public String getMimeType() { + return null; + } + + protected void concatenateTransformationMatrix(AffineTransform at) { + } + + protected void restoreStateStackAfterBreakOut(List breakOutList) { + } + + protected List breakOutOfStateStack() { + return null; + } + + protected void saveGraphicsState() { + } + + protected void restoreGraphicsState() { + } + + protected void beginTextObject() { + } + + protected void endTextObject() { + } + + protected void clip() { + } + + protected void clipRect(float x, float y, float width, float height) { + } + + protected void moveTo(float x, float y) { + } + + protected void lineTo(float x, float y) { + } + + protected void closePath() { + } + + protected void fillRect(float x, float y, float width, float height) { + } + + protected void updateColor(Color col, boolean fill) { + } + + protected void drawImage(String url, Rectangle2D pos, Map foreignAttributes) { + String s = pos.toString(); + actual += s.substring(s.indexOf('[')); + } + + protected void drawBorderLine(float x1, float y1, float x2, float y2, boolean horz, + boolean startOrBefore, int style, Color col) { + } + + protected void startVParea(CTM ctm, Rectangle clippingRect) { + } + + protected void endVParea() { + } + + protected void startLayer(String layer) { + } + + protected void endLayer() { + } + + } +} diff --git a/src/test/java/org/apache/fop/render/AbstractRenderingTest.java b/src/test/java/org/apache/fop/render/AbstractRenderingTest.java new file mode 100644 index 000000000..297a9ba05 --- /dev/null +++ b/src/test/java/org/apache/fop/render/AbstractRenderingTest.java @@ -0,0 +1,104 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render; + +import java.io.File; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.Map; +import java.util.MissingResourceException; + +import javax.xml.transform.Source; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.sax.SAXResult; +import javax.xml.transform.stream.StreamSource; + +import org.apache.commons.io.FileUtils; +import org.apache.commons.io.IOUtils; + +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.apps.Fop; +import org.apache.fop.apps.FopFactory; +import org.apache.fop.apps.MimeConstants; + +/** + * Abstract base class for rendering (output) verification tests. + */ +public abstract class AbstractRenderingTest { + + private static final Map<String, String> MIME_MAP = new java.util.HashMap<String, String>(); + + static { + MIME_MAP.put(MimeConstants.MIME_PDF, ".pdf"); + MIME_MAP.put(MimeConstants.MIME_POSTSCRIPT, ".ps"); + MIME_MAP.put(MimeConstants.MIME_AFP, ".afp"); + } + + /** the JAXP TransformerFactory */ + protected TransformerFactory tFactory = TransformerFactory.newInstance(); + /** the FopFactory */ + protected final FopFactory fopFactory = FopFactory.newInstance(new File(".").toURI()); + + /** + * Renders a test file. + * @param ua the user agent (with override set!) + * @param resourceName the resource name for the FO file + * @param suffix a suffix for the output filename + * @param outputFormat MIME type of the requested output format + * @return the output file + * @throws Exception if an error occurs + */ + protected File renderFile(FOUserAgent ua, String resourceName, String suffix, + String outputFormat) throws Exception { + String extension = MIME_MAP.get(outputFormat); + assert extension != null; + File outputFile = new File("build/test-results/" + resourceName + suffix + extension); + File outputDir = outputFile.getParentFile(); + FileUtils.forceMkdir(outputDir); + + // Prepare input file + InputStream in = getClass().getResourceAsStream(resourceName); + if (in == null) { + throw new MissingResourceException(resourceName + " not found in resources", + getClass().getName(), null); + } + try { + Source src = new StreamSource(in); + + // Create output file + OutputStream out = new java.io.FileOutputStream(outputFile); + out = new java.io.BufferedOutputStream(out); + try { + Fop fop = fopFactory.newFop(outputFormat, ua, out); + SAXResult res = new SAXResult(fop.getDefaultHandler()); + + Transformer transformer = tFactory.newTransformer(); + transformer.transform(src, res); + } finally { + IOUtils.closeQuietly(out); + } + } finally { + IOUtils.closeQuietly(in); + } + return outputFile; + } + +} diff --git a/src/test/java/org/apache/fop/render/RawPNGTestUtil.java b/src/test/java/org/apache/fop/render/RawPNGTestUtil.java new file mode 100644 index 000000000..506556c66 --- /dev/null +++ b/src/test/java/org/apache/fop/render/RawPNGTestUtil.java @@ -0,0 +1,92 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.zip.Deflater; +import java.util.zip.DeflaterOutputStream; + +import org.apache.xmlgraphics.image.loader.ImageSize; + +public final class RawPNGTestUtil { + + private static final int NUM_ROWS = 32; + private static final int NUM_COLUMNS = 32; + private static final int DPI = 72; + + private RawPNGTestUtil() { + + } + + /** + * Builds a PNG IDAT section for a square of a given color and alpha; the filter is fixed. + * @param gray the gray color; set to -1 if using RGB + * @param red the red color; ignored if gray > -1 + * @param green the green color; ignored if gray > -1 + * @param blue the blue color; ignored if gray > -1 + * @param alpha the alpha color; set to -1 if not present + * @return the PNG IDAT byte array + * @throws IOException + */ + public static byte[] buildGRGBAData(int gray, int red, int green, int blue, int alpha) throws IOException { + // build an image, 32x32, Gray or RGB, with or without alpha, and with filter + int filter = 0; + int numRows = NUM_ROWS; + int numColumns = NUM_COLUMNS; + int numComponents = (gray > -1 ? 1 : 3) + (alpha > -1 ? 1 : 0); + int numBytesPerRow = numColumns * numComponents + 1; // 1 for filter + int numBytes = numRows * numBytesPerRow; + byte[] data = new byte[numBytes]; + for (int r = 0; r < numRows; r++) { + data[r * numBytesPerRow] = (byte) filter; + for (int c = 0; c < numColumns; c++) { + if (numComponents == 1) { + data[r * numBytesPerRow + numComponents * c + 1] = (byte) gray; + } else if (numComponents == 2) { + data[r * numBytesPerRow + numComponents * c + 1] = (byte) gray; + data[r * numBytesPerRow + numComponents * c + 2] = (byte) alpha; + } else if (numComponents == 3) { + data[r * numBytesPerRow + numComponents * c + 1] = (byte) red; + data[r * numBytesPerRow + numComponents * c + 2] = (byte) green; + data[r * numBytesPerRow + numComponents * c + 3] = (byte) blue; + } else if (numComponents == 4) { + data[r * numBytesPerRow + numComponents * c + 1] = (byte) red; + data[r * numBytesPerRow + numComponents * c + 2] = (byte) green; + data[r * numBytesPerRow + numComponents * c + 3] = (byte) blue; + data[r * numBytesPerRow + numComponents * c + 4] = (byte) alpha; + } + } + } + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + DeflaterOutputStream dos = new DeflaterOutputStream(baos, new Deflater()); + dos.write(data); + dos.close(); + return baos.toByteArray(); + } + + /** + * + * @return a default ImageSize + */ + public static ImageSize getImageSize() { + return new ImageSize(NUM_ROWS, NUM_COLUMNS, DPI); + } +} diff --git a/src/test/java/org/apache/fop/render/RendererFactoryTestCase.java b/src/test/java/org/apache/fop/render/RendererFactoryTestCase.java new file mode 100644 index 000000000..1fa4ae0fa --- /dev/null +++ b/src/test/java/org/apache/fop/render/RendererFactoryTestCase.java @@ -0,0 +1,149 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render; + +import java.io.File; + +import org.junit.Test; + +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import org.apache.commons.io.output.NullOutputStream; + +import org.apache.fop.apps.FOPException; +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.apps.FopFactory; +import org.apache.fop.apps.MimeConstants; +import org.apache.fop.area.AreaTreeHandler; +import org.apache.fop.fo.FOEventHandler; +import org.apache.fop.render.intermediate.IFContext; +import org.apache.fop.render.intermediate.IFDocumentHandler; +import org.apache.fop.render.intermediate.IFRenderer; +import org.apache.fop.render.pdf.PDFDocumentHandler; +import org.apache.fop.render.rtf.RTFHandler; + +/** + * Tests for {@link RendererFactory}. + */ +public class RendererFactoryTestCase { + + @Test + public void testDocumentHandlerLevel() throws Exception { + FopFactory fopFactory = FopFactory.newInstance(new File(".").toURI()); + RendererFactory factory = fopFactory.getRendererFactory(); + FOUserAgent ua; + IFDocumentHandler handler; + IFDocumentHandler overrideHandler; + + ua = fopFactory.newFOUserAgent(); + handler = factory.createDocumentHandler(ua, MimeConstants.MIME_PDF); + + ua = fopFactory.newFOUserAgent(); + overrideHandler = new PDFDocumentHandler(new IFContext(ua)); + ua.setDocumentHandlerOverride(overrideHandler); + handler = factory.createDocumentHandler(ua, null); + assertTrue(handler == overrideHandler); + + ua = fopFactory.newFOUserAgent(); + try { + handler = factory.createDocumentHandler(ua, "invalid/format"); + fail("Expected UnsupportedOperationException"); + } catch (UnsupportedOperationException uoe) { + //expected + } + } + + @Test + public void testRendererLevel() throws Exception { + FopFactory fopFactory = FopFactory.newInstance(new File(".").toURI()); + RendererFactory factory = fopFactory.getRendererFactory(); + FOUserAgent ua; + Renderer renderer; + + ua = fopFactory.newFOUserAgent(); + renderer = factory.createRenderer(ua, MimeConstants.MIME_PDF); + assertTrue(renderer instanceof IFRenderer); + + ua = fopFactory.newFOUserAgent(); + renderer = factory.createRenderer(ua, MimeConstants.MIME_FOP_IF); + assertTrue(renderer instanceof IFRenderer); + + ua = fopFactory.newFOUserAgent(); + IFDocumentHandler overrideHandler; + overrideHandler = new PDFDocumentHandler(new IFContext(ua)); + ua.setDocumentHandlerOverride(overrideHandler); + renderer = factory.createRenderer(ua, null); + assertTrue(renderer instanceof IFRenderer); + + ua = fopFactory.newFOUserAgent(); + try { + renderer = factory.createRenderer(ua, "invalid/format"); + fail("Expected UnsupportedOperationException"); + } catch (UnsupportedOperationException uoe) { + //expected + } + } + + @Test + public void testFOEventHandlerLevel() throws Exception { + FopFactory fopFactory = FopFactory.newInstance(new File(".").toURI()); + RendererFactory factory = fopFactory.getRendererFactory(); + FOUserAgent ua; + FOEventHandler foEventHandler; + FOEventHandler overrideFOEventHandler; + + ua = fopFactory.newFOUserAgent(); + foEventHandler = factory.createFOEventHandler( + ua, MimeConstants.MIME_PDF, new NullOutputStream()); + assertTrue(foEventHandler instanceof AreaTreeHandler); + + ua = fopFactory.newFOUserAgent(); + foEventHandler = factory.createFOEventHandler( + ua, MimeConstants.MIME_RTF, new NullOutputStream()); + assertTrue(foEventHandler instanceof RTFHandler); + + ua = fopFactory.newFOUserAgent(); + try { + foEventHandler = factory.createFOEventHandler( + ua, "invalid/format", new NullOutputStream()); + fail("Expected UnsupportedOperationException"); + } catch (UnsupportedOperationException uoe) { + //expected + } + + ua = fopFactory.newFOUserAgent(); + try { + foEventHandler = factory.createFOEventHandler( + ua, MimeConstants.MIME_PDF, null); + fail("Expected FOPException because of missing OutputStream"); + } catch (FOPException fe) { + //expected + } + + ua = fopFactory.newFOUserAgent(); + overrideFOEventHandler = new RTFHandler(ua, new NullOutputStream()); + ua.setFOEventHandlerOverride(overrideFOEventHandler); + foEventHandler = factory.createFOEventHandler( + ua, null, null); + assertTrue(foEventHandler == overrideFOEventHandler); + } + +} diff --git a/src/test/java/org/apache/fop/render/afp/AFPBorderPainterTestCase.java b/src/test/java/org/apache/fop/render/afp/AFPBorderPainterTestCase.java new file mode 100644 index 000000000..dfe956d90 --- /dev/null +++ b/src/test/java/org/apache/fop/render/afp/AFPBorderPainterTestCase.java @@ -0,0 +1,77 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.afp; + +import java.awt.Color; +import java.io.ByteArrayOutputStream; +import java.io.OutputStream; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertTrue; + +import org.apache.fop.afp.AFPBorderPainter; +import org.apache.fop.afp.AFPLineDataInfo; +import org.apache.fop.afp.AFPPaintingState; +import org.apache.fop.afp.BorderPaintingInfo; +import org.apache.fop.afp.DataStream; +import org.apache.fop.afp.Factory; +import org.apache.fop.fo.Constants; + +public class AFPBorderPainterTestCase { + private ByteArrayOutputStream outStream; + private AFPBorderPainter borderPainter; + private DataStream ds; + private AFPLineDataInfo line; + + @Before + public void setUp() throws Exception { + outStream = new ByteArrayOutputStream(); + ds = new MyDataStream(new Factory(), null, outStream); + ds.startDocument(); + ds.startPage(1000, 1000, 90, 72, 72); + borderPainter = new AFPBorderPainter(new AFPPaintingState(), ds); + } + + /** + * This test will fail if either of the below statements isn't true: + * org.apache.fop.render.intermediate.BorderPainter.DASHED_BORDER_SPACE_RATIO = 0.5f:q + * org.apache.fop.render.intermediate.BorderPainter.DASHED_BORDER_LENGTH_FACTOR = 4.0f. + */ + @Test + public void testDrawBorderLine() throws Exception { + BorderPaintingInfo paintInfo = new BorderPaintingInfo(0f, 0f, 1000f, 1000f, true, + Constants.EN_DASHED, Color.BLACK); + borderPainter.paint(paintInfo); + ds.endDocument(); + assertTrue(line.getX1() == 4999 && line.getX2() == 8332); + } + + class MyDataStream extends DataStream { + public MyDataStream(Factory factory, AFPPaintingState paintingState, OutputStream outputStream) { + super(factory, paintingState, outputStream); + } + + public void createLine(AFPLineDataInfo lineDataInfo) { + line = lineDataInfo; + } + } +} diff --git a/src/test/java/org/apache/fop/render/afp/AFPPainterTestCase.java b/src/test/java/org/apache/fop/render/afp/AFPPainterTestCase.java new file mode 100644 index 000000000..fd6209bf1 --- /dev/null +++ b/src/test/java/org/apache/fop/render/afp/AFPPainterTestCase.java @@ -0,0 +1,131 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.afp; + +import java.awt.Color; +import java.awt.Rectangle; +import java.util.Map; + +import org.junit.Test; + +import static org.junit.Assert.fail; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import org.apache.xmlgraphics.image.loader.Image; +import org.apache.xmlgraphics.image.loader.ImageFlavor; +import org.apache.xmlgraphics.image.loader.ImageManager; +import org.apache.xmlgraphics.image.loader.impl.DefaultImageContext; +import org.apache.xmlgraphics.image.loader.impl.DefaultImageSessionContext; +import org.apache.xmlgraphics.image.loader.impl.ImageBuffered; + +import org.apache.fop.afp.AFPEventProducer; +import org.apache.fop.afp.AFPPaintingState; +import org.apache.fop.afp.AFPResourceManager; +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.events.EventBroadcaster; +import org.apache.fop.fo.Constants; +import org.apache.fop.render.ImageHandlerRegistry; +import org.apache.fop.render.intermediate.IFContext; +import org.apache.fop.traits.BorderProps; + +public class AFPPainterTestCase { + + @Test + public void testDrawBorderRect() { + // the goal of this test is to check that the drawing of rounded corners in AFP uses a bitmap of the + // rounded corners (in fact the whole rectangle with rounded corners). the check is done by verifying + // that the AFPImageHandlerRenderedImage.handleImage() method is called + // mock + AFPPaintingState afpPaintingState = mock(AFPPaintingState.class); + when(afpPaintingState.getResolution()).thenReturn(72); + // mock + EventBroadcaster eventBroadcaster = mock(EventBroadcaster.class); + // mock + DefaultImageContext defaultImageContext = mock(DefaultImageContext.class); + when(defaultImageContext.getSourceResolution()).thenReturn(72000f); + // mock + DefaultImageSessionContext defaultImageSessionContxt = mock(DefaultImageSessionContext.class); + when(defaultImageSessionContxt.getParentContext()).thenReturn(defaultImageContext); + when(defaultImageSessionContxt.getTargetResolution()).thenReturn(72000f); + // mock + ImageBuffered imageBuffered = mock(ImageBuffered.class); + // mock + ImageManager imageManager = mock(ImageManager.class); + // mock + AFPImageHandlerRenderedImage afpImageHandlerRenderedImage = mock(AFPImageHandlerRenderedImage.class); + // mock + ImageHandlerRegistry imageHandlerRegistry = mock(ImageHandlerRegistry.class); + when(imageHandlerRegistry.getHandler(any(AFPRenderingContext.class), any(Image.class))).thenReturn( + afpImageHandlerRenderedImage); + // mock + FOUserAgent foUserAgent = mock(FOUserAgent.class); + when(foUserAgent.getEventBroadcaster()).thenReturn(eventBroadcaster); + when(foUserAgent.getImageSessionContext()).thenReturn(defaultImageSessionContxt); + when(foUserAgent.getImageManager()).thenReturn(imageManager); + when(foUserAgent.getImageHandlerRegistry()).thenReturn(imageHandlerRegistry); + // mock + AFPEventProducer afpEventProducer = mock(AFPEventProducer.class); + when(AFPEventProducer.Provider.get(eventBroadcaster)).thenReturn(afpEventProducer); + // mock + AFPResourceManager afpResourceManager = mock(AFPResourceManager.class); + when(afpResourceManager.isObjectCached(null)).thenReturn(false); + // mock + IFContext ifContext = mock(IFContext.class); + when(ifContext.getUserAgent()).thenReturn(foUserAgent); + // mock + AFPDocumentHandler afpDocumentHandler = mock(AFPDocumentHandler.class); + when(afpDocumentHandler.getPaintingState()).thenReturn(afpPaintingState); + when(afpDocumentHandler.getContext()).thenReturn(ifContext); + when(afpDocumentHandler.getResourceManager()).thenReturn(afpResourceManager); + when(afpDocumentHandler.cacheRoundedCorner("a2a48964ba2d")).thenReturn("RC000000"); + // real instance, no mock + AFPPainter afpPainter = new AFPPainter(afpDocumentHandler); + // build rectangle 200 x 50 (points, which are converted to millipoints) + Rectangle rectangle = new Rectangle(0, 0, 200000, 50000); + // build border properties + int style = Constants.EN_SOLID; + BorderProps.Mode mode = BorderProps.Mode.SEPARATE; + Color color = Color.BLACK; + int borderWidth = 4000; + int radiusStart = 30000; + int radiusEnd = 30000; + BorderProps border1 = new BorderProps(style, borderWidth, radiusStart, radiusEnd, color, mode); + BorderProps border2 = new BorderProps(style, borderWidth, radiusStart, radiusEnd, color, mode); + BorderProps border3 = new BorderProps(style, borderWidth, radiusStart, radiusEnd, color, mode); + BorderProps border4 = new BorderProps(style, borderWidth, radiusStart, radiusEnd, color, mode); + try { + when(imageManager.convertImage(any(Image.class), any(ImageFlavor[].class), any(Map.class))) + .thenReturn(imageBuffered); + afpPainter.drawBorderRect(rectangle, border1, border2, border3, border4, Color.WHITE); + // note: here we would really like to verify that the second and third arguments passed to + // handleImage() are the instances ib and rect declared above but that causes mockito to throw + // an exception, probably because we cannot declare the AFPRenderingContext and are forced to + // use any(), which forces the use of any() for all arguments + verify(afpImageHandlerRenderedImage).handleImage(any(AFPRenderingContext.class), + any(Image.class), any(Rectangle.class)); + } catch (Exception e) { + fail("something broke..."); + } + } + +} diff --git a/src/test/java/org/apache/fop/render/afp/AFPParser.java b/src/test/java/org/apache/fop/render/afp/AFPParser.java new file mode 100644 index 000000000..9f0f92322 --- /dev/null +++ b/src/test/java/org/apache/fop/render/afp/AFPParser.java @@ -0,0 +1,235 @@ +/* + * 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. + */ + +/* $Id$ */ +package org.apache.fop.render.afp; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.HashMap; +import java.util.Map; + +import org.apache.fop.afp.AFPConstants; +import org.apache.fop.afp.ptoca.PtocaBuilder; + +import junit.framework.Assert; + +public class AFPParser { + private boolean readText; + public AFPParser(boolean readText) { + this.readText = readText; + } + + public void read(InputStream bis, StringBuilder sb) throws IOException { + while (bis.available() > 0) { + readField(bis, sb); + } + } + + private void readField(InputStream bis, StringBuilder sb) throws IOException { + bis.read(); + int len = getLength(bis.read(), bis.read()); + byte[] field = new byte[len - 2]; + bis.read(field); + InputStream fieldStream = new ByteArrayInputStream(field); + fieldStream.read(); + byte type = (byte) fieldStream.read(); + byte category = (byte) fieldStream.read(); + fieldStream.skip(3); + String typeStr = TYPE_MAP.get(type & 0xFF); + String catStr = CATEGORY_MAP.get(category & 0xFF); + if (typeStr != null && catStr != null) { + sb.append(typeStr + " " + catStr); + if (typeStr.equals("BEGIN") || typeStr.equals("END")) { + byte[] name = new byte[8]; + fieldStream.read(name); + sb.append(" " + new String(name, AFPConstants.EBCIDIC_ENCODING)); + fieldStream.skip(2); + readTriplet(fieldStream, sb); + } else if (typeStr.equals("MAP")) { + fieldStream.skip(2); + readTriplet(fieldStream, sb); + } else if (typeStr.equals("DESCRIPTOR") && catStr.equals("OBJECT_AREA")) { + readTriplet(fieldStream, sb); + } else if (typeStr.equals("DATA") && catStr.equals("PRESENTATION_TEXT") && readText) { + readData(fieldStream, sb); + } + sb.append("\n"); + } + } + + private void readData(InputStream bis, StringBuilder sb) throws IOException { + Assert.assertEquals(bis.read(), 0x2B); + Assert.assertEquals(bis.read(), 0xD3); + while (bis.available() > 0) { + int len = bis.read(); + int functionType = bis.read(); + + sb.append(" " + PTOCA_MAP.get(functionType)); + + if ("TRN".equals(PTOCA_MAP.get(functionType))) { + byte[] data = new byte[len - 2]; + bis.read(data); + sb.append(" " + new String(data, "UTF-16BE")); + } else { + bis.skip(len - 2); + } + } + } + + private void readTriplet(InputStream des, StringBuilder sb) throws IOException { + if (des.available() > 0) { + sb.append(" Triplets: "); + } + while (des.available() > 0) { + int len2 = des.read(); + int id = des.read(); + int b = id & 0xFF; + if (TRIPLET_MAP.containsKey(b)) { + sb.append(TRIPLET_MAP.get(b) + ","); + } else { + sb.append(String.format("0x%02X,", b)); + } + des.skip(len2 - 2); + } + } + + private int getLength(int a, int b) { + return (a * 256) + b; + } + + private static final Map<Integer, String> TYPE_MAP = new HashMap<Integer, String>(); + private static final Map<Integer, String> CATEGORY_MAP = new HashMap<Integer, String>(); + private static final Map<Integer, String> TRIPLET_MAP = new HashMap<Integer, String>(); + private static final Map<Integer, String> PTOCA_MAP = new HashMap<Integer, String>(); + static { + PTOCA_MAP.put(0xC2 | PtocaBuilder.CHAIN_BIT, "SIA"); + PTOCA_MAP.put(0xC4 | PtocaBuilder.CHAIN_BIT, "SVI"); + PTOCA_MAP.put(0xC6 | PtocaBuilder.CHAIN_BIT, "AMI"); + PTOCA_MAP.put(0xC8 | PtocaBuilder.CHAIN_BIT, "RMI"); + PTOCA_MAP.put(0xD2 | PtocaBuilder.CHAIN_BIT, "AMB"); + PTOCA_MAP.put(0xDA | PtocaBuilder.CHAIN_BIT, "TRN"); + PTOCA_MAP.put(0xE4 | PtocaBuilder.CHAIN_BIT, "DIR"); + PTOCA_MAP.put(0xE6 | PtocaBuilder.CHAIN_BIT, "DBR"); + PTOCA_MAP.put(0x80 | PtocaBuilder.CHAIN_BIT, "SEC"); + PTOCA_MAP.put(0xF0 | PtocaBuilder.CHAIN_BIT, "SCFL"); + PTOCA_MAP.put(0xF6 | PtocaBuilder.CHAIN_BIT, "STO"); + PTOCA_MAP.put(0xF8 | PtocaBuilder.CHAIN_BIT, "NOP"); + + TYPE_MAP.put(0xA0, "ATTRIBUTE"); + TYPE_MAP.put(0xA2, "COPY_COUNT"); + TYPE_MAP.put(0xA6, "DESCRIPTOR"); + TYPE_MAP.put(0xA7, "CONTROL"); + TYPE_MAP.put(0xA8, "BEGIN"); + TYPE_MAP.put(0xA9, "END"); + TYPE_MAP.put(0xAB, "MAP"); + TYPE_MAP.put(0xAC, "POSITION"); + TYPE_MAP.put(0xAD, "PROCESS"); + TYPE_MAP.put(0xAF, "INCLUDE"); + TYPE_MAP.put(0xB0, "TABLE"); + TYPE_MAP.put(0xB1, "MIGRATION"); + TYPE_MAP.put(0xB2, "VARIABLE"); + TYPE_MAP.put(0xB4, "LINK"); + TYPE_MAP.put(0xEE, "DATA"); + + CATEGORY_MAP.put(0x5F, "PAGE_SEGMENT"); + CATEGORY_MAP.put(0x6B, "OBJECT_AREA"); + CATEGORY_MAP.put(0x77, "COLOR_ATTRIBUTE_TABLE"); + CATEGORY_MAP.put(0x7B, "IM_IMAGE"); + CATEGORY_MAP.put(0x88, "MEDIUM"); + CATEGORY_MAP.put(0x8A, "CODED_FONT"); + CATEGORY_MAP.put(0x90, "PROCESS_ELEMENT"); + CATEGORY_MAP.put(0x92, "OBJECT_CONTAINER"); + CATEGORY_MAP.put(0x9B, "PRESENTATION_TEXT"); + CATEGORY_MAP.put(0xA7, "INDEX"); + CATEGORY_MAP.put(0xA8, "DOCUMENT"); + CATEGORY_MAP.put(0xAD, "PAGE_GROUP"); + CATEGORY_MAP.put(0xAF, "PAGE"); + CATEGORY_MAP.put(0xBB, "GRAPHICS"); + CATEGORY_MAP.put(0xC3, "DATA_RESOURCE"); + CATEGORY_MAP.put(0xC4, "DOCUMENT_ENVIRONMENT_GROUP"); + CATEGORY_MAP.put(0xC6, "RESOURCE_GROUP"); + CATEGORY_MAP.put(0xC7, "OBJECT_ENVIRONMENT_GROUP"); + CATEGORY_MAP.put(0xC9, "ACTIVE_ENVIRONMENT_GROUP"); + CATEGORY_MAP.put(0xCC, "MEDIUM_MAP"); + CATEGORY_MAP.put(0xCD, "FORM_MAP"); + CATEGORY_MAP.put(0xCE, "NAME_RESOURCE"); + CATEGORY_MAP.put(0xD8, "PAGE_OVERLAY"); + CATEGORY_MAP.put(0xD9, "RESOURCE_ENVIROMENT_GROUP"); + CATEGORY_MAP.put(0xDF, "OVERLAY"); + CATEGORY_MAP.put(0xEA, "DATA_SUPRESSION"); + CATEGORY_MAP.put(0xEB, "BARCODE"); + CATEGORY_MAP.put(0xEE, "NO_OPERATION"); + CATEGORY_MAP.put(0xFB, "IMAGE"); + + TRIPLET_MAP.put(0x02, "FULLY_QUALIFIED_NAME"); + TRIPLET_MAP.put(0x04, "MAPPING_OPTION"); + TRIPLET_MAP.put(0x10, "OBJECT_CLASSIFICATION"); + TRIPLET_MAP.put(0x18, "MODCA_INTERCHANGE_SET"); + TRIPLET_MAP.put(0x1F, "FONT_DESCRIPTOR_SPECIFICATION"); + TRIPLET_MAP.put(0x21, "OBJECT_FUNCTION_SET_SPECIFICATION"); + TRIPLET_MAP.put(0x22, "EXTENDED_RESOURCE_LOCAL_IDENTIFIER"); + TRIPLET_MAP.put(0x24, "RESOURCE_LOCAL_IDENTIFIER"); + TRIPLET_MAP.put(0x25, "RESOURCE_SECTION_NUMBER"); + TRIPLET_MAP.put(0x26, "CHARACTER_ROTATION"); + TRIPLET_MAP.put(0x2D, "OBJECT_BYTE_OFFSET"); + TRIPLET_MAP.put(0x36, "ATTRIBUTE_VALUE"); + TRIPLET_MAP.put(0x43, "DESCRIPTOR_POSITION"); + TRIPLET_MAP.put(0x45, "MEDIA_EJECT_CONTROL"); + TRIPLET_MAP.put(0x46, "PAGE_OVERLAY_CONDITIONAL_PROCESSING"); + TRIPLET_MAP.put(0x47, "RESOURCE_USAGE_ATTRIBUTE"); + TRIPLET_MAP.put(0x4B, "MEASUREMENT_UNITS"); + TRIPLET_MAP.put(0x4C, "OBJECT_AREA_SIZE"); + TRIPLET_MAP.put(0x4D, "AREA_DEFINITION"); + TRIPLET_MAP.put(0x4E, "COLOR_SPECIFICATION"); + TRIPLET_MAP.put(0x50, "ENCODING_SCHEME_ID"); + TRIPLET_MAP.put(0x56, "MEDIUM_MAP_PAGE_NUMBER"); + TRIPLET_MAP.put(0x57, "OBJECT_BYTE_EXTENT"); + TRIPLET_MAP.put(0x58, "OBJECT_STRUCTURED_FIELD_OFFSET"); + TRIPLET_MAP.put(0x59, "OBJECT_STRUCTURED_FIELD_EXTENT"); + TRIPLET_MAP.put(0x5A, "OBJECT_OFFSET"); + TRIPLET_MAP.put(0x5D, "FONT_HORIZONTAL_SCALE_FACTOR"); + TRIPLET_MAP.put(0x5E, "OBJECT_COUNT"); + TRIPLET_MAP.put(0x62, "OBJECT_DATE_AND_TIMESTAMP"); + TRIPLET_MAP.put(0x65, "COMMENT"); + TRIPLET_MAP.put(0x68, "MEDIUM_ORIENTATION"); + TRIPLET_MAP.put(0x6C, "RESOURCE_OBJECT_INCLUDE"); + TRIPLET_MAP.put(0x70, "PRESENTATION_SPACE_RESET_MIXING"); + TRIPLET_MAP.put(0x71, "PRESENTATION_SPACE_MIXING_RULE"); + TRIPLET_MAP.put(0x72, "UNIVERSAL_DATE_AND_TIMESTAMP"); + TRIPLET_MAP.put(0x74, "TONER_SAVER"); + TRIPLET_MAP.put(0x75, "COLOR_FIDELITY"); + TRIPLET_MAP.put(0x78, "FONT_FIDELITY"); + TRIPLET_MAP.put(0x80, "ATTRIBUTE_QUALIFIER"); + TRIPLET_MAP.put(0x81, "PAGE_POSITION_INFORMATION"); + TRIPLET_MAP.put(0x82, "PARAMETER_VALUE"); + TRIPLET_MAP.put(0x83, "PRESENTATION_CONTROL"); + TRIPLET_MAP.put(0x84, "FONT_RESOLUTION_AND_METRIC_TECHNOLOGY"); + TRIPLET_MAP.put(0x85, "FINISHING_OPERATION"); + TRIPLET_MAP.put(0x86, "TEXT_FIDELITY"); + TRIPLET_MAP.put(0x87, "MEDIA_FIDELITY"); + TRIPLET_MAP.put(0x88, "FINISHING_FIDELITY"); + TRIPLET_MAP.put(0x8B, "DATA_OBJECT_FONT_DESCRIPTOR"); + TRIPLET_MAP.put(0x8C, "LOCALE_SELECTOR"); + TRIPLET_MAP.put(0x8E, "UP3I_FINISHING_OPERATION"); + TRIPLET_MAP.put(0x91, "COLOR_MANAGEMENT_RESOURCE_DESCRIPTOR"); + TRIPLET_MAP.put(0x95, "RENDERING_INTENT"); + TRIPLET_MAP.put(0x96, "CMR_TAG_FIDELITY"); + TRIPLET_MAP.put(0x97, "DEVICE_APPEARANCE"); + } +} diff --git a/src/test/java/org/apache/fop/render/afp/AFPRendererConfigParserTestCase.java b/src/test/java/org/apache/fop/render/afp/AFPRendererConfigParserTestCase.java new file mode 100644 index 000000000..8ed54049f --- /dev/null +++ b/src/test/java/org/apache/fop/render/afp/AFPRendererConfigParserTestCase.java @@ -0,0 +1,193 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.afp; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + +import org.apache.fop.afp.AFPConstants; +import org.apache.fop.apps.AFPRendererConfBuilder; +import org.apache.fop.apps.AbstractRendererConfigParserTester; +import org.apache.fop.render.afp.AFPRendererConfig.AFPRendererConfigParser; +import org.apache.fop.render.afp.AFPRendererConfig.ImagesModeOptions; + +import static org.apache.fop.render.afp.AFPRendererConfig.ImagesModeOptions.MODE_COLOR; +import static org.apache.fop.render.afp.AFPRendererConfig.ImagesModeOptions.MODE_GRAYSCALE; + +public class AFPRendererConfigParserTestCase + extends AbstractRendererConfigParserTester<AFPRendererConfBuilder, AFPRendererConfig> { + + public AFPRendererConfigParserTestCase() { + super(new AFPRendererConfigParser(), AFPRendererConfBuilder.class); + } + + @Test + public void testShadingMode() throws Exception { + parseConfig(); + assertEquals(AFPShadingMode.COLOR, conf.getShadingMode()); + parseConfig(createRenderer().setShading(AFPShadingMode.DITHERED)); + assertEquals(AFPShadingMode.DITHERED, conf.getShadingMode()); + } + + @Test + public void testResolution() throws Exception { + parseConfig(createRenderer()); + assertEquals(Integer.valueOf(240), conf.getResolution()); + parseConfig(createRenderer().setRenderingResolution(300)); + assertEquals(Integer.valueOf(300), conf.getResolution()); + } + + @Test + public void testLineWidthCorrection() throws Exception { + parseConfig(createRenderer()); + assertEquals(AFPConstants.LINE_WIDTH_CORRECTION, + conf.getLineWidthCorrection().floatValue(), 0.0001f); + parseConfig(createRenderer().setLineWidthCorrection(1f)); + assertEquals(Float.valueOf(1f), conf.getLineWidthCorrection()); + } + + @Test + public void testResourceGroupUri() throws Exception { + parseConfig(createRenderer()); + assertEquals(null, conf.getDefaultResourceGroupUri()); + // TODO yuck! + File file = File.createTempFile("AFPRendererConfigParserTestCase", ""); + try { + file.delete(); + parseConfig(createRenderer().setResourceGroupUri(file.toURI().toASCIIString())); + assertEquals(file.toURI(), conf.getDefaultResourceGroupUri()); + } finally { + file.delete(); + } + } + + @Test + public void testResourceLevelDefaults() throws Exception { + parseConfig(createRenderer()); + assertNull(conf.getResourceLevelDefaults()); + Map<String, String> levels = new HashMap<String, String>(); + levels.put("goca", "page"); + parseConfig(createRenderer().setDefaultResourceLevels(levels)); + assertNotNull(conf.getResourceLevelDefaults()); + } + + @Test + public void testImages() throws Exception { + parseConfig(createRenderer()); + assertEquals(false, conf.isColorImages()); + assertEquals(Integer.valueOf(8), conf.getBitsPerPixel()); + ImagesModeOptions mode = MODE_GRAYSCALE; + parseConfig(createRenderer().startImages(mode) + .setModeAttribute(mode.getModeAttribute(), String.valueOf(1)) + .endImages()); + assertEquals(false, conf.isColorImages()); + assertEquals(Integer.valueOf(1), conf.getBitsPerPixel()); + mode = MODE_COLOR; + parseConfig(createRenderer() + .startImages(mode) + .setModeAttribute(mode.getModeAttribute(), + String.valueOf(false)) + .endImages()); + assertEquals(true, conf.isColorImages()); + assertEquals(false, conf.isCmykImagesSupported()); + parseConfig(createRenderer().startImages(mode) + .setModeAttribute(mode.getModeAttribute(), String.valueOf(true)) + .endImages()); + assertEquals(true, conf.isColorImages()); + assertEquals(true, conf.isCmykImagesSupported()); + } + + @Test(expected = IllegalStateException.class) + public void testImagesException1() throws Exception { + parseConfig(createRenderer().startImages().endImages()); + conf.isCmykImagesSupported(); + } + + @Test(expected = IllegalStateException.class) + public void testImagesException2() throws Exception { + parseConfig(createRenderer().startImages(MODE_COLOR).endImages()); + conf.getBitsPerPixel(); + } + + @Test + public void testImagesNative() throws Exception { + parseConfig(createRenderer()); + assertEquals(false, conf.isNativeImagesSupported()); + parseConfig(createRenderer().startImages().setNativeImageSupport(true).endImages()); + assertEquals(true, conf.isNativeImagesSupported()); + } + + @Test + public void testDitheringQuality() throws Exception { + parseConfig(createRenderer()); + assertEquals(0.5f, conf.getDitheringQuality(), 0.001f); + parseConfig(createRenderer().startImages().setDitheringQuality("min").endImages()); + assertEquals(0.0f, conf.getDitheringQuality(), 0.001f); + parseConfig(createRenderer().startImages().setDitheringQuality("max").endImages()); + assertEquals(1.0f, conf.getDitheringQuality(), 0.001f); + parseConfig(createRenderer().startImages().setDitheringQuality(0.25f).endImages()); + assertEquals(0.25f, conf.getDitheringQuality(), 0.001f); + } + + @Test + public void testAllowJpegEmbedding() throws Exception { + parseConfig(); + assertEquals(false, conf.allowJpegEmbedding()); + + parseConfig(createRenderer().startImages().setAllowJpegEmbedding(true).endImages()); + assertEquals(true, conf.allowJpegEmbedding()); + } + + @Test + public void testBitmapEncodingQuality() throws Exception { + parseConfig(); + assertEquals(1.0f, conf.getBitmapEncodingQuality(), 0.001f); + parseConfig(createRenderer().startImages().setBitmapEncodingQuality(0.5f).endImages()); + assertEquals(0.5f, conf.getBitmapEncodingQuality(), 0.001f); + } + + @Test + public void testFS45() throws Exception { + parseConfig(); + assertEquals(false, conf.isFs45()); + parseConfig(createRenderer().startImages().setFs45(true).endImages()); + assertEquals(true, conf.isFs45()); + } + + @Test + public void tesPseg() throws Exception { + parseConfig(); + assertEquals(false, conf.isWrapPseg()); + parseConfig(createRenderer().startImages().setWrapPseg(true).endImages()); + assertEquals(true, conf.isWrapPseg()); + } + + @Test(expected = IllegalArgumentException.class) + public void testForNameException() throws Exception { + ImagesModeOptions.forName("_"); + } +} diff --git a/src/test/java/org/apache/fop/render/afp/AFPRendererConfiguratorTestCase.java b/src/test/java/org/apache/fop/render/afp/AFPRendererConfiguratorTestCase.java new file mode 100644 index 000000000..48cf89240 --- /dev/null +++ b/src/test/java/org/apache/fop/render/afp/AFPRendererConfiguratorTestCase.java @@ -0,0 +1,213 @@ +/* + * 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.fop.render.afp; + +import java.net.URI; +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; +import org.mockito.ArgumentCaptor; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.verify; + +import org.apache.fop.afp.AFPResourceLevel; +import org.apache.fop.afp.AFPResourceLevel.ResourceType; +import org.apache.fop.afp.AFPResourceLevelDefaults; +import org.apache.fop.apps.AFPRendererConfBuilder; +import org.apache.fop.apps.AbstractRendererConfiguratorTest; +import org.apache.fop.apps.MimeConstants; +import org.apache.fop.render.afp.AFPRendererConfig.AFPRendererConfigParser; +import org.apache.fop.render.afp.AFPRendererConfig.ImagesModeOptions; + +public class AFPRendererConfiguratorTestCase extends + AbstractRendererConfiguratorTest<AFPRendererConfigurator, AFPRendererConfBuilder> { + + public AFPRendererConfiguratorTestCase() { + super(MimeConstants.MIME_AFP, AFPRendererConfBuilder.class, AFPDocumentHandler.class); + } + + @Override + public void setUpDocumentHandler() { + } + + @Override + protected AFPRendererConfigurator createConfigurator() { + return new AFPRendererConfigurator(userAgent, new AFPRendererConfigParser()); + } + + private AFPDocumentHandler getDocHandler() { + return (AFPDocumentHandler) docHandler; + } + + @Test + public void testColorImages() throws Exception { + parseConfig(createBuilder().startImages(ImagesModeOptions.MODE_COLOR) + .endImages()); + verify(getDocHandler()).setColorImages(true); + + parseConfig(createBuilder().startImages(ImagesModeOptions.MODE_GRAYSCALE) + .endImages()); + verify(getDocHandler()).setColorImages(false); + } + + @Test + public void testCMYKImagesSupport() throws Exception { + parseConfig(createBuilder().startImages(ImagesModeOptions.MODE_COLOR) + .setModeAttribute("cmyk", "true") + .endImages()); + verify(getDocHandler()).setCMYKImagesSupported(true); + + parseConfig(createBuilder().startImages(ImagesModeOptions.MODE_COLOR) + .setModeAttribute("cmyk", "false") + .endImages()); + verify(getDocHandler()).setCMYKImagesSupported(false); + } + + @Test + public void testBitsPerPixel() throws Exception { + for (int bpp = 0; bpp < 40; bpp += 8) { + parseConfig(createBuilder().startImages() + .setModeAttribute("bits-per-pixel", String.valueOf(bpp)) + .endImages()); + verify(getDocHandler()).setBitsPerPixel(bpp); + } + } + + @Test + public void testDitheringQuality() throws Exception { + float ditheringQuality = 100f; + parseConfig(createBuilder().startImages() + .setDitheringQuality(ditheringQuality) + .endImages()); + verify(getDocHandler()).setDitheringQuality(ditheringQuality); + + ditheringQuality = 1000f; + parseConfig(createBuilder().startImages() + .setDitheringQuality(ditheringQuality) + .endImages()); + verify(getDocHandler()).setDitheringQuality(ditheringQuality); + } + + @Test + public void testNativeImagesSupported() throws Exception { + parseConfig(createBuilder().startImages() + .setNativeImageSupport(true) + .endImages()); + verify(getDocHandler()).setNativeImagesSupported(true); + + parseConfig(createBuilder().startImages() + .setNativeImageSupport(false) + .endImages()); + verify(getDocHandler()).setNativeImagesSupported(false); + } + + @Test + public void testShadingMode() throws Exception { + for (AFPShadingMode mode : AFPShadingMode.values()) { + parseConfig(createBuilder().setShading(mode)); + verify(getDocHandler()).setShadingMode(mode); + } + } + + @Test + public void testRendererResolution() throws Exception { + for (int resolution = 0; resolution < 1000; resolution += 100) { + parseConfig(createBuilder().setRenderingResolution(resolution)); + verify(getDocHandler()).setResolution(resolution); + } + } + + @Test + public void testLineWidthCorrection() throws Exception { + for (float resolution = 0; resolution < 50; resolution += 5) { + parseConfig(createBuilder().setLineWidthCorrection(resolution)); + verify(getDocHandler()).setLineWidthCorrection(resolution); + } + } + + @Test + public void testResourceGroupURI() throws Exception { + URI uri = URI.create("test://URI/just/used/for/testing"); + parseConfig(createBuilder().setResourceGroupUri(uri.toASCIIString())); + verify(getDocHandler()).setDefaultResourceGroupUri(uri); + } + + @Test + public void testResourceLevelDefaults() throws Exception { + testResourceLevelDefault(ResourceType.DOCUMENT); + } + + private void testResourceLevelDefault(ResourceType resType) throws Exception { + Map<String, String> resourceLevels = new HashMap<String, String>(); + resourceLevels.put("goca", resType.getName()); + parseConfig(createBuilder().setDefaultResourceLevels(resourceLevels)); + ArgumentCaptor<AFPResourceLevelDefaults> argument = ArgumentCaptor.forClass(AFPResourceLevelDefaults.class); + verify(getDocHandler()).setResourceLevelDefaults(argument.capture()); + AFPResourceLevel expectedLevel = new AFPResourceLevel(resType); + assertEquals(expectedLevel, argument.getValue().getDefaultResourceLevel((byte) 3)); + } + + @Test + public void testExternalResourceDefault() throws Exception { + testResourceLevelDefault(ResourceType.EXTERNAL); + } + + @Test + public void testInlineResourceDefault() throws Exception { + testResourceLevelDefault(ResourceType.INLINE); + } + + @Test + public void testPageResourceDefault() throws Exception { + testResourceLevelDefault(ResourceType.PAGE); + } + + @Test + public void testPageGroupResourceDefault() throws Exception { + testResourceLevelDefault(ResourceType.PAGE_GROUP); + } + + @Test + public void testPrintFileResourceDefault() throws Exception { + testResourceLevelDefault(ResourceType.PRINT_FILE); + } + + @Test + public void testBitmapEncodeQuality() throws Exception { + parseConfig(createBuilder().startImages() + .setBitmapEncodingQuality(0.5f) + .endImages()); + verify(getDocHandler()).setBitmapEncodingQuality(0.5f); + } + + @Test + public void testCanEmbedJpeg() throws Exception { + parseConfig(createBuilder().startImages() + .setAllowJpegEmbedding(true) + .endImages()); + verify(getDocHandler()).canEmbedJpeg(true); + + parseConfig(createBuilder().startImages() + .setAllowJpegEmbedding(false) + .endImages()); + verify(getDocHandler()).canEmbedJpeg(false); + } + +} diff --git a/src/test/java/org/apache/fop/render/afp/AFPTestSuite.java b/src/test/java/org/apache/fop/render/afp/AFPTestSuite.java new file mode 100644 index 000000000..117e7efcf --- /dev/null +++ b/src/test/java/org/apache/fop/render/afp/AFPTestSuite.java @@ -0,0 +1,34 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.afp; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +/** + * Test suite for FOP's AFP output. + */ +@RunWith(Suite.class) +@SuiteClasses({ + NoOperationTestCase.class, + AFPRendererConfiguratorTestCase.class }) +public class AFPTestSuite { +} diff --git a/src/test/java/org/apache/fop/render/afp/AFPTrueTypeTestCase.java b/src/test/java/org/apache/fop/render/afp/AFPTrueTypeTestCase.java new file mode 100644 index 000000000..333a23983 --- /dev/null +++ b/src/test/java/org/apache/fop/render/afp/AFPTrueTypeTestCase.java @@ -0,0 +1,209 @@ +/* + * 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. + */ + +/* $Id$ */ +package org.apache.fop.render.afp; + +import java.awt.Color; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.URI; +import java.net.URISyntaxException; + +import javax.xml.transform.Result; +import javax.xml.transform.Source; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.sax.SAXResult; +import javax.xml.transform.stream.StreamSource; + +import org.junit.Test; + +import org.xml.sax.SAXException; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import org.apache.xmlgraphics.io.Resource; +import org.apache.xmlgraphics.io.ResourceResolver; + +import org.apache.fop.afp.AFPPaintingState; +import org.apache.fop.afp.AFPResourceManager; +import org.apache.fop.afp.DataStream; +import org.apache.fop.afp.Factory; +import org.apache.fop.afp.fonts.FopCharacterSet; +import org.apache.fop.afp.modca.PageObject; +import org.apache.fop.apps.EnvironmentalProfileFactory; +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.apps.Fop; +import org.apache.fop.apps.FopConfParser; +import org.apache.fop.apps.FopFactory; +import org.apache.fop.apps.FopFactoryBuilder; +import org.apache.fop.apps.io.ResourceResolverFactory; +import org.apache.fop.fonts.EmbeddingMode; +import org.apache.fop.fonts.FontInfo; +import org.apache.fop.fonts.FontTriplet; +import org.apache.fop.fonts.MultiByteFont; +import org.apache.fop.render.intermediate.IFException; + +import junit.framework.Assert; + +public class AFPTrueTypeTestCase { + private String font; + + @Test + public void testAFPTrueType() throws IOException, SAXException, TransformerException, URISyntaxException { + String fopxconf = "<fop version=\"1.0\">\n" + + " <renderers>\n" + + " <renderer mime=\"application/x-afp\">\n" + + " <fonts>\n" + + " <font name=\"Univers\" embed-url=\"test/resources/fonts/ttf/DejaVuLGCSerif.ttf\">\n" + + " <font-triplet name=\"Univers\" style=\"normal\" weight=\"normal\"/>\n" + + " <font-triplet name=\"any\" style=\"normal\" weight=\"normal\"/>\n" + + " </font>\n" + + " </fonts>\n" + + " </renderer>\n" + + " </renderers>\n" + + "</fop>"; + String fo = "<fo:root xmlns:fo=\"http://www.w3.org/1999/XSL/Format\">\n" + + " <fo:layout-master-set>\n" + + " <fo:simple-page-master master-name=\"simple\">\n" + + " <fo:region-body />\n" + + " </fo:simple-page-master>\n" + + " </fo:layout-master-set>\n" + + " <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:flow>\n" + + " </fo:page-sequence>\n" + + "</fo:root>"; + + FopFactoryBuilder confBuilder = new FopConfParser( + new ByteArrayInputStream(fopxconf.getBytes()), + EnvironmentalProfileFactory.createRestrictedIO(new URI("."), + new MyResourceResolver())).getFopFactoryBuilder(); + FopFactory fopFactory = confBuilder.build(); + FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + Fop fop = fopFactory.newFop("application/x-afp", foUserAgent, bos); + TransformerFactory factory = TransformerFactory.newInstance(); + Transformer transformer = factory.newTransformer(); + Source src = new StreamSource(new ByteArrayInputStream(fo.getBytes())); + Result res = new SAXResult(fop.getDefaultHandler()); + transformer.transform(src, res); + bos.close(); + + StringBuilder sb = new StringBuilder(); + InputStream bis = new ByteArrayInputStream(bos.toByteArray()); + new AFPParser(false).read(bis, sb); + + String format = "BEGIN RESOURCE_GROUP RG000001\n" + + "BEGIN NAME_RESOURCE RES00001 Triplets: OBJECT_FUNCTION_SET_SPECIFICATION" + + ",OBJECT_CLASSIFICATION,0x01,FULLY_QUALIFIED_NAME,\n" + + "BEGIN OBJECT_CONTAINER OC000001 Triplets: 0x41,0x00,0x00,\n"; + for (int i = 0; i < 29; i++) { + format += "DATA OBJECT_CONTAINER\n"; + } + format += "END OBJECT_CONTAINER OC000001\n" + + "END NAME_RESOURCE RES00001\n" + + "END RESOURCE_GROUP RG000001\n" + + "BEGIN DOCUMENT DOC00001\n" + + "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" + + "DESCRIPTOR PAGE\n" + + "MIGRATION PRESENTATION_TEXT\n" + + "END ACTIVE_ENVIRONMENT_GROUP AEG00001\n" + + "BEGIN PRESENTATION_TEXT PT000001\n" + + "DATA PRESENTATION_TEXT\n" + + "END PRESENTATION_TEXT PT000001\n" + + "END PAGE PGN00001\n" + + "END PAGE_GROUP PGP00001\n" + + "END DOCUMENT DOC00001\n"; + + Assert.assertEquals(sb.toString(), format); + Assert.assertEquals("test/resources/fonts/ttf/DejaVuLGCSerif.ttf", font); + } + + class MyResourceResolver implements ResourceResolver { + private ResourceResolver defaultResourceResolver = ResourceResolverFactory.createDefaultResourceResolver(); + public Resource getResource(URI uri) throws IOException { + if (!"tmp".equals(uri.getScheme())) { + font = uri.getPath(); + uri = new File(".", uri.getPath()).toURI(); + } + return defaultResourceResolver.getResource(uri); + } + + public OutputStream getOutputStream(URI uri) throws IOException { + return defaultResourceResolver.getOutputStream(uri); + } + } + + @Test + public void testAFPPainter() throws IFException, IOException { + AFPDocumentHandler afpDocumentHandler = mock(AFPDocumentHandler.class); + when(afpDocumentHandler.getPaintingState()).thenReturn(new AFPPaintingState()); + when(afpDocumentHandler.getResourceManager()).thenReturn(new AFPResourceManager(null)); + + DataStream ds = mock(DataStream.class); + when(afpDocumentHandler.getDataStream()).thenReturn(ds); + PageObject po = new PageObject(new Factory(), "PAGE0001", 0, 0, 0, 0, 0); + when(ds.getCurrentPage()).thenReturn(po); + + AFPPainter afpPainter = new MyAFPPainter(afpDocumentHandler); + afpPainter.setFont("any", "normal", 400, null, null, Color.BLACK); + afpPainter.drawText(0, 0, 0, 0, null, "test"); + + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + po.writeToStream(bos); + + InputStream bis = new ByteArrayInputStream(bos.toByteArray()); + StringBuilder sb = new StringBuilder(); + new AFPParser(true).read(bis, sb); + Assert.assertTrue(sb.toString(), + sb.toString().contains("DATA PRESENTATION_TEXT AMB AMI SCFL TRN t TRN e TRN s TRN t")); + } + + class MyAFPPainter extends AFPPainter { + public MyAFPPainter(AFPDocumentHandler documentHandler) { + super(documentHandler); + } + + protected FOUserAgent getUserAgent() { + FopFactory fopFactory = FopFactory.newInstance(new File(".").toURI()); + return fopFactory.newFOUserAgent(); + } + + protected FontInfo getFontInfo() { + FontInfo f = new FontInfo(); + f.addFontProperties("any", FontTriplet.DEFAULT_FONT_TRIPLET); + MultiByteFont font = new MultiByteFont(null, EmbeddingMode.AUTO); + font.setWidthArray(new int[100]); + f.addMetrics("any", new AFPFontConfig.AFPTrueTypeFont("", true, + new FopCharacterSet("", "UTF-16BE", "", font, null, null), null, null, null)); + return f; + } + } +} diff --git a/src/test/java/org/apache/fop/render/afp/AbstractAFPTest.java b/src/test/java/org/apache/fop/render/afp/AbstractAFPTest.java new file mode 100644 index 000000000..916c68395 --- /dev/null +++ b/src/test/java/org/apache/fop/render/afp/AbstractAFPTest.java @@ -0,0 +1,47 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.afp; + +import java.io.File; + +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.apps.MimeConstants; +import org.apache.fop.render.AbstractRenderingTest; + +/** + * Abstract base class for AFP verification tests. + */ +abstract class AbstractAFPTest extends AbstractRenderingTest { + + /** + * Renders a test file. + * @param ua the user agent (with override set!) + * @param resourceName the resource name for the FO file + * @param suffix a suffix for the output filename + * @return the output file + * @throws Exception if an error occurs + */ + protected File renderFile(FOUserAgent ua, String resourceName, String suffix) + throws Exception { + return renderFile(ua, resourceName, suffix, MimeConstants.MIME_AFP); + } + + +} diff --git a/src/test/java/org/apache/fop/render/afp/NoOperationTestCase.java b/src/test/java/org/apache/fop/render/afp/NoOperationTestCase.java new file mode 100644 index 000000000..9e83829f8 --- /dev/null +++ b/src/test/java/org/apache/fop/render/afp/NoOperationTestCase.java @@ -0,0 +1,127 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.afp; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +import org.apache.commons.io.IOUtils; + +import org.apache.fop.afp.AFPConstants; +import org.apache.fop.afp.parser.MODCAParser; +import org.apache.fop.afp.parser.UnparsedStructuredField; +import org.apache.fop.apps.FOUserAgent; + +/** + * Tests generation of afp:no-operation (NOPs). + */ +public class NoOperationTestCase extends AbstractAFPTest { + + /** + * Tests afp:no-operation. + * @throws Exception if an error occurs + */ + @Test + public void testNoOperation() throws Exception { + FOUserAgent ua = fopFactory.newFOUserAgent(); + File outputFile = renderFile(ua, "nops.fo", ""); + + InputStream in = new java.io.FileInputStream(outputFile); + try { + MODCAParser parser = new MODCAParser(in); + UnparsedStructuredField field = skipTo(parser, 0xD3A8A8); //Begin Document + + //NOP in fo:declarations + field = parser.readNextStructuredField(); + assertEquals(0xD3EEEE, field.getSfTypeID()); + assertEquals("fo:declarations", getNopText(field)); + + field = parser.readNextStructuredField(); + assertEquals(0xD3A8AD, field.getSfTypeID()); //Begin Named Page Group + + //NOPs in fo:page-sequence + field = parser.readNextStructuredField(); + assertEquals(0xD3EEEE, field.getSfTypeID()); + assertEquals("fo:page-sequence: start", getNopText(field)); + field = parser.readNextStructuredField(); + assertEquals(0xD3EEEE, field.getSfTypeID()); + assertEquals("fo:page-sequence: end", getNopText(field)); + + field = parser.readNextStructuredField(); + assertEquals(0xD3A8AF, field.getSfTypeID()); //Begin Page + + field = skipTo(parser, 0xD3A9C9); //End Active Environment Group + field = parser.readNextStructuredField(); + assertEquals(0xD3EEEE, field.getSfTypeID()); + assertEquals("fo:simple-page-master: first", getNopText(field)); + + field = skipTo(parser, 0xD3A9C9); //End Active Environment Group + field = parser.readNextStructuredField(); + assertEquals(0xD3EEEE, field.getSfTypeID()); + assertEquals("fo:simple-page-master: rest", getNopText(field)); + } finally { + IOUtils.closeQuietly(in); + } + + int counter = 0; + in = new java.io.FileInputStream(outputFile); + try { + MODCAParser parser = new MODCAParser(in); + while (true) { + UnparsedStructuredField field = parser.readNextStructuredField(); + if (field == null) { + break; + } + if (field.getSfTypeID() == 0xD3EEEE) { + counter++; + } + } + } finally { + IOUtils.closeQuietly(in); + } + assertEquals(6, counter); //decl, 2 * ps, 3 * page/spm + } + + private String getNopText(UnparsedStructuredField field) throws UnsupportedEncodingException { + byte[] data = field.getData(); + String text = new String(data, AFPConstants.EBCIDIC_ENCODING); + return text; + } + + private UnparsedStructuredField skipTo(MODCAParser parser, int typeID) throws IOException { + UnparsedStructuredField field = null; + do { + field = parser.readNextStructuredField(); + if (field.getSfTypeID() == typeID) { + return field; + } + } while (field != null); + fail("Structured field not found: " + Integer.toHexString(typeID)); + return null; + } + +} diff --git a/src/test/java/org/apache/fop/render/afp/nops.fo b/src/test/java/org/apache/fop/render/afp/nops.fo new file mode 100644 index 000000000..96c6e0d24 --- /dev/null +++ b/src/test/java/org/apache/fop/render/afp/nops.fo @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" + xmlns:afp="http://xmlgraphics.apache.org/fop/extensions/afp"> + <fo:layout-master-set> + <fo:simple-page-master master-name="first" page-height="10.5cm" page-width="14.85cm" margin="2cm"> + <afp:no-operation name="spm">fo:simple-page-master: first</afp:no-operation> + <fo:region-body margin-top="2em "/> + <fo:region-before extent="2em"/> + </fo:simple-page-master> + <fo:simple-page-master master-name="rest" page-height="10.5cm" page-width="14.85cm" margin="2cm"> + <afp:no-operation name="spm">fo:simple-page-master: rest</afp:no-operation> + <fo:region-body margin-top="2em "/> + <fo:region-before extent="2em"/> + </fo:simple-page-master> + <fo:page-sequence-master master-name="main"> + <fo:repeatable-page-master-alternatives> + <fo:conditional-page-master-reference master-reference="first" page-position="first"/> + <fo:conditional-page-master-reference master-reference="rest"/> + </fo:repeatable-page-master-alternatives> + </fo:page-sequence-master> + </fo:layout-master-set> + + <fo:declarations> + <afp:no-operation name="declarations">fo:declarations</afp:no-operation> + </fo:declarations> + + <fo:page-sequence master-reference="main" id="doc1"> + <afp:no-operation name="ps">fo:page-sequence: start</afp:no-operation> + <fo:flow flow-name="xsl-region-body"> + <fo:block>Page 1</fo:block> + <fo:block>Page 1</fo:block> + <fo:block break-after="page"></fo:block> + <fo:block>Page 2</fo:block> + <fo:block>Page 2</fo:block> + <fo:block break-after="page"></fo:block> + <fo:block>Page 3</fo:block> + <fo:block>Page 3</fo:block> + </fo:flow> + <afp:no-operation name="ps">fo:page-sequence: end</afp:no-operation> + </fo:page-sequence> +</fo:root> diff --git a/src/test/java/org/apache/fop/render/bitmap/AbstractBitmapRendererConfigParserTester.java b/src/test/java/org/apache/fop/render/bitmap/AbstractBitmapRendererConfigParserTester.java new file mode 100644 index 000000000..cae184d51 --- /dev/null +++ b/src/test/java/org/apache/fop/render/bitmap/AbstractBitmapRendererConfigParserTester.java @@ -0,0 +1,125 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.bitmap; + +import java.awt.Color; +import java.awt.image.BufferedImage; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import org.apache.fop.apps.AbstractRendererConfigParserTester; +import org.apache.fop.apps.BitmapRendererConfBuilder; +import org.apache.fop.render.bitmap.BitmapRendererConfig.BitmapRendererConfigParser; + +import static org.apache.fop.render.bitmap.BitmapRendererOption.COLOR_MODE_BILEVEL; +import static org.apache.fop.render.bitmap.BitmapRendererOption.COLOR_MODE_BINARY; +import static org.apache.fop.render.bitmap.BitmapRendererOption.COLOR_MODE_GRAY; +import static org.apache.fop.render.bitmap.BitmapRendererOption.COLOR_MODE_RGB; +import static org.apache.fop.render.bitmap.BitmapRendererOption.COLOR_MODE_RGBA; +import static org.apache.fop.render.bitmap.BitmapRendererOption.JAVA2D_TRANSPARENT_PAGE_BACKGROUND; +import static org.apache.fop.render.bitmap.BitmapRendererOption.RENDERING_QUALITY; +import static org.apache.fop.render.bitmap.BitmapRendererOption.RENDERING_SPEED; + +public class AbstractBitmapRendererConfigParserTester + extends AbstractRendererConfigParserTester<BitmapRendererConfBuilder, BitmapRendererConfig> { + + public AbstractBitmapRendererConfigParserTester(BitmapRendererConfigParser parser) { + super(parser, BitmapRendererConfBuilder.class); + } + + @Test + public void testTransparentPageBackground() throws Exception { + parseConfig(createRenderer().setPageBackgroundTransparency(true)); + assertTrue(conf.hasTransparentBackround()); + assertNull(conf.getBackgroundColor()); + + parseConfig(createRenderer().setPageBackgroundTransparency(false)); + assertFalse(conf.hasTransparentBackround()); + assertEquals(Color.WHITE, conf.getBackgroundColor()); + + parseConfig(createRenderer()); + assertEquals(JAVA2D_TRANSPARENT_PAGE_BACKGROUND.getDefaultValue(), + conf.hasTransparentBackround()); + } + + @Test + public void testBackgroundColor() throws Exception { + parseConfig(createRenderer().setBackgroundColor("black")); + assertEquals(Color.BLACK, conf.getBackgroundColor()); + + parseConfig(createRenderer().setBackgroundColor("white")); + assertEquals(Color.WHITE, conf.getBackgroundColor()); + + parseConfig(createRenderer().setBackgroundColor("blue")); + assertEquals(Color.BLUE, conf.getBackgroundColor()); + + parseConfig(createRenderer().setBackgroundColor("blue") + .setPageBackgroundTransparency(true)); + assertTrue(conf.hasTransparentBackround()); + assertNull(conf.getBackgroundColor()); + } + + @Test + public void testAntiAliasing() throws Exception { + parseConfig(createRenderer().setAntiAliasing(true)); + assertTrue(conf.hasAntiAliasing()); + + parseConfig(createRenderer().setAntiAliasing(false)); + assertFalse(conf.hasAntiAliasing()); + } + + @Test + public void testRendererQuality() throws Exception { + parseConfig(createRenderer().setRenderingQuality(RENDERING_QUALITY.getName())); + assertTrue(conf.isRenderHighQuality()); + + parseConfig(createRenderer().setRenderingQuality(RENDERING_SPEED.getName())); + assertFalse(conf.isRenderHighQuality()); + + parseConfig(createRenderer()); + assertTrue(conf.isRenderHighQuality()); + } + + @Test + public void testColorModes() throws Exception { + parseConfig(createRenderer().setColorMode(COLOR_MODE_RGBA.getName())); + assertEquals(BufferedImage.TYPE_INT_ARGB, (int) conf.getColorMode()); + + parseConfig(createRenderer().setColorMode(COLOR_MODE_RGB.getName())); + assertEquals(BufferedImage.TYPE_INT_RGB, (int) conf.getColorMode()); + + parseConfig(createRenderer().setColorMode(COLOR_MODE_GRAY.getName())); + assertEquals(BufferedImage.TYPE_BYTE_GRAY, (int) conf.getColorMode()); + + parseConfig(createRenderer().setColorMode(COLOR_MODE_BINARY.getName())); + assertEquals(BufferedImage.TYPE_BYTE_BINARY, (int) conf.getColorMode()); + + parseConfig(createRenderer().setColorMode(COLOR_MODE_BILEVEL.getName())); + assertEquals(BufferedImage.TYPE_BYTE_BINARY, (int) conf.getColorMode()); + + parseConfig(createRenderer()); + assertEquals(BufferedImage.TYPE_INT_ARGB, (int) conf.getColorMode()); + } +} diff --git a/src/test/java/org/apache/fop/render/bitmap/AbstractBitmapRendererConfiguratorTest.java b/src/test/java/org/apache/fop/render/bitmap/AbstractBitmapRendererConfiguratorTest.java new file mode 100644 index 000000000..dcbb27754 --- /dev/null +++ b/src/test/java/org/apache/fop/render/bitmap/AbstractBitmapRendererConfiguratorTest.java @@ -0,0 +1,120 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.bitmap; + +import java.awt.image.BufferedImage; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.when; + +import org.apache.fop.apps.AbstractRendererConfiguratorTest; +import org.apache.fop.apps.BitmapRendererConfBuilder; +import org.apache.fop.render.intermediate.IFDocumentHandler; +import org.apache.fop.util.ColorUtil; + +import static org.apache.fop.render.bitmap.BitmapRendererOption.COLOR_MODE_BILEVEL; +import static org.apache.fop.render.bitmap.BitmapRendererOption.COLOR_MODE_BINARY; +import static org.apache.fop.render.bitmap.BitmapRendererOption.COLOR_MODE_GRAY; +import static org.apache.fop.render.bitmap.BitmapRendererOption.COLOR_MODE_RGB; +import static org.apache.fop.render.bitmap.BitmapRendererOption.COLOR_MODE_RGBA; +import static org.apache.fop.render.bitmap.BitmapRendererOption.RENDERING_QUALITY; +import static org.apache.fop.render.bitmap.BitmapRendererOption.RENDERING_SPEED; + +public abstract class AbstractBitmapRendererConfiguratorTest extends + AbstractRendererConfiguratorTest<BitmapRendererConfigurator, BitmapRendererConfBuilder> { + + public AbstractBitmapRendererConfiguratorTest(String mimeType, + Class<? extends IFDocumentHandler> docHandlerClass) { + super(mimeType, BitmapRendererConfBuilder.class, docHandlerClass); + } + + BitmapRenderingSettings settings; + + @Override + public void setUpDocumentHandler() { + settings = new BitmapRenderingSettings(); + when(((AbstractBitmapDocumentHandler) docHandler).getSettings()).thenReturn(settings); + } + + @Test + public void testSetPageBackgroundColor() throws Exception { + // Try a few different colours + parseConfig(createBuilder().setBackgroundColor("Blue")); + assertEquals(ColorUtil.parseColorString(null, "Blue"), settings.getPageBackgroundColor()); + + parseConfig(createBuilder().setBackgroundColor("Black")); + assertEquals(ColorUtil.parseColorString(null, "Black"), settings.getPageBackgroundColor()); + } + + @Test + public void testAntiAliasing() throws Exception { + parseConfig(createBuilder().setAntiAliasing(true)); + assertTrue(settings.isAntiAliasingEnabled()); + + parseConfig(createBuilder().setAntiAliasing(false)); + assertFalse(settings.isAntiAliasingEnabled()); + } + + @Test + public void testTransparentBackground() throws Exception { + parseConfig(createBuilder().setPageBackgroundTransparency(true)); + assertTrue(settings.hasTransparentPageBackground()); + + parseConfig(createBuilder().setPageBackgroundTransparency(false)); + assertFalse(settings.hasTransparentPageBackground()); + } + + @Test + public void testRendererQuality() throws Exception { + parseConfig(createBuilder().setRenderingQuality(RENDERING_QUALITY.getName())); + assertTrue(settings.isQualityRenderingEnabled()); + + parseConfig(createBuilder().setRenderingQuality(RENDERING_SPEED.getName())); + assertFalse(settings.isQualityRenderingEnabled()); + + parseConfig(createBuilder()); + assertTrue(settings.isQualityRenderingEnabled()); + } + + @Test + public void testColorModes() throws Exception { + parseConfig(createBuilder().setColorMode(COLOR_MODE_RGBA.getName())); + assertEquals(BufferedImage.TYPE_INT_ARGB, settings.getBufferedImageType()); + + parseConfig(createBuilder().setColorMode(COLOR_MODE_RGB.getName())); + assertEquals(BufferedImage.TYPE_INT_RGB, settings.getBufferedImageType()); + + parseConfig(createBuilder().setColorMode(COLOR_MODE_GRAY.getName())); + assertEquals(BufferedImage.TYPE_BYTE_GRAY, settings.getBufferedImageType()); + + parseConfig(createBuilder().setColorMode(COLOR_MODE_BINARY.getName())); + assertEquals(BufferedImage.TYPE_BYTE_BINARY, settings.getBufferedImageType()); + + parseConfig(createBuilder().setColorMode(COLOR_MODE_BILEVEL.getName())); + assertEquals(BufferedImage.TYPE_BYTE_BINARY, settings.getBufferedImageType()); + + parseConfig(createBuilder()); + assertEquals(BufferedImage.TYPE_INT_ARGB, settings.getBufferedImageType()); + } +} diff --git a/src/test/java/org/apache/fop/render/bitmap/BitmapRendererConfigParserTestCase.java b/src/test/java/org/apache/fop/render/bitmap/BitmapRendererConfigParserTestCase.java new file mode 100644 index 000000000..3c44bfdf7 --- /dev/null +++ b/src/test/java/org/apache/fop/render/bitmap/BitmapRendererConfigParserTestCase.java @@ -0,0 +1,30 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.bitmap; + +import org.apache.fop.apps.MimeConstants; +import org.apache.fop.render.bitmap.BitmapRendererConfig.BitmapRendererConfigParser; + +public class BitmapRendererConfigParserTestCase extends AbstractBitmapRendererConfigParserTester { + + public BitmapRendererConfigParserTestCase() { + super(new BitmapRendererConfigParser(MimeConstants.MIME_BITMAP)); + } +} diff --git a/src/test/java/org/apache/fop/render/bitmap/BitmapRendererConfiguratorTestCase.java b/src/test/java/org/apache/fop/render/bitmap/BitmapRendererConfiguratorTestCase.java new file mode 100644 index 000000000..0d0527160 --- /dev/null +++ b/src/test/java/org/apache/fop/render/bitmap/BitmapRendererConfiguratorTestCase.java @@ -0,0 +1,35 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.bitmap; + +import org.apache.fop.apps.BitmapRendererConfBuilder; +import org.apache.fop.render.bitmap.BitmapRendererConfig.BitmapRendererConfigParser; + +public class BitmapRendererConfiguratorTestCase extends AbstractBitmapRendererConfiguratorTest { + + public BitmapRendererConfiguratorTestCase() { + super(BitmapRendererConfBuilder.getMimeType(), AbstractBitmapDocumentHandler.class); + } + + @Override + public BitmapRendererConfigurator createConfigurator() { + return new BitmapRendererConfigurator(userAgent, new BitmapRendererConfigParser(mimeType)); + } +} diff --git a/src/test/java/org/apache/fop/render/bitmap/TIFFCompressionValueTestCase.java b/src/test/java/org/apache/fop/render/bitmap/TIFFCompressionValueTestCase.java new file mode 100644 index 000000000..c4285f034 --- /dev/null +++ b/src/test/java/org/apache/fop/render/bitmap/TIFFCompressionValueTestCase.java @@ -0,0 +1,77 @@ +/* + * 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.fop.render.bitmap; + +import java.awt.image.BufferedImage; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import static org.apache.fop.render.bitmap.TIFFCompressionValue.CCITT_T4; +import static org.apache.fop.render.bitmap.TIFFCompressionValue.CCITT_T6; +import static org.apache.fop.render.bitmap.TIFFCompressionValue.DEFLATE; +import static org.apache.fop.render.bitmap.TIFFCompressionValue.JPEG; +import static org.apache.fop.render.bitmap.TIFFCompressionValue.LZW; +import static org.apache.fop.render.bitmap.TIFFCompressionValue.NONE; +import static org.apache.fop.render.bitmap.TIFFCompressionValue.PACKBITS; +import static org.apache.fop.render.bitmap.TIFFCompressionValue.ZLIB; + +public class TIFFCompressionValueTestCase { + + @Test + public void testGetName() { + testCompressionName("NONE", NONE); + testCompressionName("JPEG", JPEG); + testCompressionName("PackBits", PACKBITS); + testCompressionName("Deflate", DEFLATE); + testCompressionName("LZW", LZW); + testCompressionName("ZLib", ZLIB); + testCompressionName("CCITT T.4", CCITT_T4); + testCompressionName("CCITT T.6", CCITT_T6); + } + + private void testCompressionName(String name, TIFFCompressionValue expected) { + assertEquals(name, expected.getName()); + assertEquals(expected, TIFFCompressionValue.getType(name)); + } + + @Test + public void testGetImageType() { + for (TIFFCompressionValue value : TIFFCompressionValue.values()) { + if (value == CCITT_T4 || value == CCITT_T6) { + assertEquals(BufferedImage.TYPE_BYTE_BINARY, value.getImageType()); + } else { + assertEquals(BufferedImage.TYPE_INT_ARGB, value.getImageType()); + } + } + } + + @Test + public void testHasCCITTCompression() { + for (TIFFCompressionValue value : TIFFCompressionValue.values()) { + if (value == CCITT_T4 || value == CCITT_T6) { + assertTrue(value.hasCCITTCompression()); + } else { + assertFalse(value.hasCCITTCompression()); + } + } + } +} diff --git a/src/test/java/org/apache/fop/render/bitmap/TIFFRendererConfigParserTestCase.java b/src/test/java/org/apache/fop/render/bitmap/TIFFRendererConfigParserTestCase.java new file mode 100644 index 000000000..8a5c2a72d --- /dev/null +++ b/src/test/java/org/apache/fop/render/bitmap/TIFFRendererConfigParserTestCase.java @@ -0,0 +1,75 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.bitmap; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.apache.xmlgraphics.image.writer.Endianness; + +import org.apache.fop.apps.FopConfBuilder; +import org.apache.fop.apps.TIFFRendererConfBuilder; +import org.apache.fop.render.bitmap.TIFFRendererConfig.TIFFRendererConfigParser; + +public class TIFFRendererConfigParserTestCase +extends AbstractBitmapRendererConfigParserTester { + + public TIFFRendererConfigParserTestCase() { + super(new TIFFRendererConfigParser()); + } + + @Override + protected TIFFRendererConfBuilder createRenderer() { + builder = new FopConfBuilder().setStrictValidation(true).startRendererConfig( + TIFFRendererConfBuilder.class); + return (TIFFRendererConfBuilder) builder; + } + + private TIFFRendererConfig getConfig() { + return (TIFFRendererConfig) conf; + } + + @Test + public void testCompression() throws Exception { + for (TIFFCompressionValue value : TIFFCompressionValue.values()) { + parseConfig(createRenderer().setCompressionMode(value.getName())); + assertEquals(value, getConfig().getCompressionType()); + } + } + + @Test + public void testSingleStrip() throws Exception { + parseConfig(createRenderer().setSingleStrip(true)); + assertTrue(getConfig().isSingleStrip()); + parseConfig(createRenderer().setSingleStrip(false)); + assertFalse(getConfig().isSingleStrip()); + } + + @Test + public void testEndianness() throws Exception { + for (Endianness value : Endianness.values()) { + parseConfig(createRenderer().setEndianness(value.toString())); + assertEquals(value, getConfig().getEndianness()); + } + } +} diff --git a/src/test/java/org/apache/fop/render/bitmap/TIFFRendererConfiguratorTestCase.java b/src/test/java/org/apache/fop/render/bitmap/TIFFRendererConfiguratorTestCase.java new file mode 100644 index 000000000..e340830f4 --- /dev/null +++ b/src/test/java/org/apache/fop/render/bitmap/TIFFRendererConfiguratorTestCase.java @@ -0,0 +1,85 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.bitmap; + +import java.awt.image.BufferedImage; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.apache.xmlgraphics.image.writer.Endianness; + +import org.apache.fop.apps.FopConfBuilder; +import org.apache.fop.apps.MimeConstants; +import org.apache.fop.apps.TIFFRendererConfBuilder; +import org.apache.fop.render.bitmap.TIFFRendererConfig.TIFFRendererConfigParser; + +import static org.apache.fop.render.bitmap.TIFFCompressionValue.CCITT_T4; +import static org.apache.fop.render.bitmap.TIFFCompressionValue.CCITT_T6; + +public class TIFFRendererConfiguratorTestCase extends AbstractBitmapRendererConfiguratorTest { + + public TIFFRendererConfiguratorTestCase() { + super(MimeConstants.MIME_TIFF, TIFFDocumentHandler.class); + } + + @Override + public TIFFRendererConfigurator createConfigurator() { + return new TIFFRendererConfigurator(userAgent, new TIFFRendererConfigParser()); + } + + @Override + protected TIFFRendererConfBuilder createBuilder() { + return new FopConfBuilder().startRendererConfig(TIFFRendererConfBuilder.class); + } + + @Test + @Override + public void testColorModes() throws Exception { + for (TIFFCompressionValue value : TIFFCompressionValue.values()) { + parseConfig(createBuilder().setCompressionMode(value.getName())); + if (value == CCITT_T6 || value == CCITT_T4) { + assertEquals(BufferedImage.TYPE_BYTE_BINARY, settings.getBufferedImageType()); + } else { + assertEquals(BufferedImage.TYPE_INT_ARGB, settings.getBufferedImageType()); + } + } + } + + @Test + public void testSingleStrip() throws Exception { + parseConfig(createBuilder().setSingleStrip(true)); + assertTrue(settings.getWriterParams().isSingleStrip()); + parseConfig(createBuilder().setSingleStrip(false)); + assertFalse(settings.getWriterParams().isSingleStrip()); + } + + @Test + public void testEndianness() throws Exception { + for (Endianness value : Endianness.values()) { + parseConfig(createBuilder().setEndianness(value.toString())); + assertEquals(value, settings.getWriterParams().getEndianness()); + } + } + +} diff --git a/src/test/java/org/apache/fop/render/extensions/prepress/PageBoundariesTestCase.java b/src/test/java/org/apache/fop/render/extensions/prepress/PageBoundariesTestCase.java new file mode 100644 index 000000000..e3f892e7c --- /dev/null +++ b/src/test/java/org/apache/fop/render/extensions/prepress/PageBoundariesTestCase.java @@ -0,0 +1,173 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.extensions.prepress; + +import java.awt.Dimension; +import java.awt.Rectangle; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.fail; + +/** + * Tests for the fox:bleed, fox:crop-offset, fox:crop-box extension properties. + */ +public class PageBoundariesTestCase { + + private static final Dimension TEST_AREA_SIZE = new Dimension(20000, 15000); + + private static final Rectangle TEST_AREA = new Rectangle(TEST_AREA_SIZE); + + private static final String BLEED = "5pt"; + + private static final String CROP_OFFSET = "8pt"; + + /** Test for page boundaries. */ + @Test + public void testBoundaries1() { + PageBoundaries boundaries = new PageBoundaries(TEST_AREA_SIZE, BLEED, CROP_OFFSET, null); + assertEquals(TEST_AREA, boundaries.getTrimBox()); + + Rectangle bleedBox = boundaries.getBleedBox(); + assertNotNull("Expected not null object", bleedBox); + assertEquals(-5000, bleedBox.x); + assertEquals(-5000, bleedBox.y); + assertEquals(30000, bleedBox.width); + assertEquals(25000, bleedBox.height); + + Rectangle mediaBox = boundaries.getMediaBox(); + assertNotNull("Expected not null object", mediaBox); + assertEquals(-8000, mediaBox.x); + assertEquals(-8000, mediaBox.y); + assertEquals(36000, mediaBox.width); + assertEquals(31000, mediaBox.height); + } + + /** Test for page boundaries. */ + @Test + public void testBoundaries2() { + PageBoundaries boundaries = new PageBoundaries( + TEST_AREA_SIZE, BLEED, null, null); + Rectangle bleedBox = boundaries.getBleedBox(); + assertNotNull("Expected not null object", bleedBox); + assertEquals(-5000, bleedBox.x); + assertEquals(-5000, bleedBox.y); + assertEquals(30000, bleedBox.width); + assertEquals(25000, bleedBox.height); + assertEquals(bleedBox, boundaries.getMediaBox()); + } + + /** Two values for the properties. */ + @Test + public void testBoundaries2Values() { + PageBoundaries boundaries = new PageBoundaries( + TEST_AREA_SIZE, "5pt 10pt", "6pt \t 12pt", null); + Rectangle bleedBox = boundaries.getBleedBox(); + assertEquals(-10000, bleedBox.x); + assertEquals(-5000, bleedBox.y); + assertEquals(40000, bleedBox.width); + assertEquals(25000, bleedBox.height); + + Rectangle mediaBox = boundaries.getMediaBox(); + assertEquals(-12000, mediaBox.x); + assertEquals(-6000, mediaBox.y); + assertEquals(44000, mediaBox.width); + assertEquals(27000, mediaBox.height); + } + + /** Three values for the properties. */ + @Test + public void testBoundaries3Values() { + PageBoundaries boundaries = new PageBoundaries( + TEST_AREA_SIZE, "5pt 10pt 7pt", "6pt \t 12pt 14pt", null); + Rectangle bleedBox = boundaries.getBleedBox(); + assertEquals(-10000, bleedBox.x); + assertEquals(-5000, bleedBox.y); + assertEquals(40000, bleedBox.width); + assertEquals(27000, bleedBox.height); + + Rectangle mediaBox = boundaries.getMediaBox(); + assertEquals(-12000, mediaBox.x); + assertEquals(-6000, mediaBox.y); + assertEquals(44000, mediaBox.width); + assertEquals(35000, mediaBox.height); + } + + /** Four values for the properties. */ + @Test + public void testBoundaries4Values() { + PageBoundaries boundaries = new PageBoundaries( + TEST_AREA_SIZE, "5pt 6pt 7pt 8pt", "9pt 10pt 11pt 12pt", null); + Rectangle bleedBox = boundaries.getBleedBox(); + assertEquals(-8000, bleedBox.x); + assertEquals(-5000, bleedBox.y); + assertEquals(34000, bleedBox.width); + assertEquals(27000, bleedBox.height); + + Rectangle mediaBox = boundaries.getMediaBox(); + assertEquals(-12000, mediaBox.x); + assertEquals(-9000, mediaBox.y); + assertEquals(42000, mediaBox.width); + assertEquals(35000, mediaBox.height); + } + + /** Test for the different values of crop-box. */ + @Test + public void testCropBox() { + PageBoundaries boundaries = new PageBoundaries(TEST_AREA_SIZE, BLEED, CROP_OFFSET, null); + assertEquals(boundaries.getMediaBox(), boundaries.getCropBox()); + + boundaries = new PageBoundaries(TEST_AREA_SIZE, BLEED, CROP_OFFSET, ""); + assertEquals(boundaries.getMediaBox(), boundaries.getCropBox()); + + boundaries = new PageBoundaries(TEST_AREA_SIZE, BLEED, CROP_OFFSET, "trim-box"); + assertEquals(TEST_AREA, boundaries.getCropBox()); + + boundaries = new PageBoundaries(TEST_AREA_SIZE, BLEED, CROP_OFFSET, "bleed-box"); + assertEquals(boundaries.getBleedBox(), boundaries.getCropBox()); + + boundaries = new PageBoundaries(TEST_AREA_SIZE, BLEED, CROP_OFFSET, "media-box"); + assertEquals(boundaries.getMediaBox(), boundaries.getCropBox()); + } + + /** Test for default values returned when properties are null. */ + @Test + public void testBoundariesNull() { + PageBoundaries b = new PageBoundaries(TEST_AREA_SIZE, null, null, null); + + assertEquals("Result should be the same as TEST_AREA object", b.getTrimBox(), TEST_AREA); + assertEquals("Result should be the same as TEST_AREA object", b.getBleedBox(), TEST_AREA); + assertEquals("Result should be the same as TEST_AREA object", b.getMediaBox(), TEST_AREA); + assertEquals("Result should be the same as TEST_AREA object", b.getCropBox(), TEST_AREA); + } + + /** Units must be specified. */ + @Test + public void testBoundariesFail() { + try { + new PageBoundaries(TEST_AREA_SIZE, "0", null, null); + fail("Expected IllegalArgumentException. Box should have units"); + } catch (IllegalArgumentException iae) { + // Good! + } + } +} diff --git a/src/test/java/org/apache/fop/render/extensions/prepress/PageScaleTestCase.java b/src/test/java/org/apache/fop/render/extensions/prepress/PageScaleTestCase.java new file mode 100644 index 000000000..9de045cf7 --- /dev/null +++ b/src/test/java/org/apache/fop/render/extensions/prepress/PageScaleTestCase.java @@ -0,0 +1,71 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.extensions.prepress; + +import java.awt.geom.Point2D; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.fail; + +/** + * Tests for the fox:scale extension property. + */ +public class PageScaleTestCase { + + /** 1 value is used for both x and y. */ + @Test + public void testScale1() { + Point2D res = PageScale.getScale(".5"); + assertEquals(0.5, res.getX(), 0.0); + assertEquals(0.5, res.getY(), 0.0); + } + + /** Two values, used resp. for x and y. */ + @Test + public void testScale2() { + Point2D res = PageScale.getScale("1. \t \n 1.2"); + assertEquals(1.0, res.getX(), 0.0); + assertEquals(1.2, res.getY(), 0.0); + } + + /** Scale must not contain units. */ + @Test + public void testScaleFail() { + try { + PageScale.getScale("0.5mm 0.5cm"); + fail("Expected IllegalArgumentException. Scale shouldn't contain units"); + } catch (IllegalArgumentException iae) { + // Good! + } + } + + /** @{code null} is returned when scale is unspecified. */ + @Test + public void testScaleNull() { + Point2D res = PageScale.getScale(null); + assertNull("Result should be null", res); + res = PageScale.getScale(""); + assertNull("Result should be null", res); + } + +} diff --git a/src/test/java/org/apache/fop/render/gradient/GradientTestCase.java b/src/test/java/org/apache/fop/render/gradient/GradientTestCase.java new file mode 100644 index 000000000..51a9c6c37 --- /dev/null +++ b/src/test/java/org/apache/fop/render/gradient/GradientTestCase.java @@ -0,0 +1,291 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.gradient; + +import java.awt.Color; +import java.awt.geom.AffineTransform; + +import org.junit.Test; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; + +import org.apache.batik.ext.awt.LinearGradientPaint; +import org.apache.batik.ext.awt.RadialGradientPaint; + +public class GradientTestCase { + + private static class PatternChecker { + + private final Pattern pattern; + + PatternChecker(Pattern pattern) { + this.pattern = pattern; + } + + public PatternChecker type(int expectedType) { + assertEquals(expectedType, pattern.getPatternType()); + return this; + } + + public PatternChecker matrix(Double... expectedMatrix) { + assertArrayEquals(expectedMatrix, pattern.getMatrix().toArray()); + return this; + } + + public ShadingChecker shading() { + return new ShadingChecker(pattern.getShading()); + } + } + + private static class ShadingChecker { + + private final Shading shading; + + ShadingChecker(Shading shading) { + this.shading = shading; + } + + ShadingChecker shadingType(int expectedShadingType) { + assertEquals(expectedShadingType, shading.getShadingType()); + return this; + } + + ShadingChecker coords(double... expectedCoords) { + double[] coords = new double[shading.getCoords().size()]; + int index = 0; + for (Double d : shading.getCoords()) { + coords[index++] = d; + } + assertArrayEquals(expectedCoords, coords, 0.0001); + return this; + } + + ShadingChecker extend(Boolean... expectedExtend) { + assertArrayEquals(expectedExtend, shading.getExtend().toArray()); + return this; + } + + FunctionChecker function() { + return new FunctionChecker(shading.getFunction()); + } + } + + private static class FunctionChecker { + + private final Function function; + + FunctionChecker(Function function) { + this.function = function; + } + + FunctionChecker functionType(int expectedFunctionType) { + assertEquals(expectedFunctionType, function.getFunctionType()); + return this; + } + + FunctionChecker domain(Double... expectedDomain) { + assertArrayEquals(expectedDomain, function.getDomain().toArray()); + return this; + } + + FunctionChecker bounds(Float... expectedBounds) { + assertArrayEquals(expectedBounds, function.getBounds().toArray()); + return this; + } + + FunctionChecker encode(Double... expectedEncode) { + assertArrayEquals(expectedEncode, function.getEncode().toArray()); + return this; + } + + FunctionChecker cZero(float... expectedCZero) { + assertArrayEquals(expectedCZero, function.getCZero(), 0f); + return this; + } + + FunctionChecker cOne(float... expectedCOne) { + assertArrayEquals(expectedCOne, function.getCOne(), 0f); + return this; + } + + FunctionChecker functions(int expectedFunctionCount) { + assertEquals(expectedFunctionCount, function.getFunctions().size()); + return this; + } + + FunctionChecker function(int index) { + return new FunctionChecker(function.getFunctions().get(index)); + } + } + + @Test + public void simpleLinearGradient() { + LinearGradientPaint gradient = new LinearGradientPaint(0f, 0f, 100f, 100f, + fractions(0f, 1f), colors(Color.BLUE, Color.RED)); + Pattern pattern = GradientMaker.makeLinearGradient(gradient, + AffineTransform.getTranslateInstance(10.0, 20.0), + AffineTransform.getScaleInstance(100.0, 1000.0)); + PatternChecker patternChecker = new PatternChecker(pattern) + .type(2) + .matrix(100.0, 0.0, 0.0, 1000.0, 10.0, 20.0); + ShadingChecker shadingChecker = patternChecker.shading() + .shadingType(2) + .coords(0.0, 0.0, 100.0, 100.0) + .extend(true, true); + FunctionChecker functionChecker = shadingChecker.function() + .functionType(3) + .domain(0.0, 1.0) + .bounds() + .encode(0.0, 1.0) + .functions(1); + functionChecker.function(0) + .functionType(2) + .domain(0.0, 1.0) + .cZero(0f, 0f, 1f) + .cOne(1f, 0f, 0f) + .functions(0); + } + + @Test + public void simpleRadialGradient() { + RadialGradientPaint gradient = new RadialGradientPaint(100, 200, 50, + fractions(0f, 1f), colors(Color.BLUE, Color.RED)); + Pattern pattern = GradientMaker.makeRadialGradient(gradient, new AffineTransform(), new AffineTransform()); + PatternChecker patternChecker = new PatternChecker(pattern).type(2); + ShadingChecker shadingChecker = patternChecker.shading() + .shadingType(3) + .coords(100.0, 200.0, 0.0, 100.0, 200.0, 50.0) + .extend(true, true); + FunctionChecker functionChecker = shadingChecker.function() + .functionType(3) + .domain(0.0, 1.0) + .bounds() + .encode(0.0, 1.0) + .functions(1); + functionChecker.function(0) + .functionType(2) + .domain(0.0, 1.0) + .cZero(0f, 0f, 1f) + .cOne(1f, 0f, 0f) + .functions(0); + } + + @Test + public void threeColorLinearGradient() { + LinearGradientPaint gradient = new LinearGradientPaint(0f, 10f, 20f, 30f, + fractions(0f, 0.5f, 1f), colors(Color.BLUE, Color.RED, Color.GREEN)); + Pattern pattern = GradientMaker.makeLinearGradient(gradient, new AffineTransform(), new AffineTransform()); + PatternChecker patternChecker = new PatternChecker(pattern) + .type(2) + .matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0); + ShadingChecker shadingChecker = patternChecker.shading() + .shadingType(2) + .coords(0.0, 10.0, 20.0, 30.0) + .extend(true, true); + FunctionChecker functionChecker = shadingChecker.function() + .functionType(3) + .domain(0.0, 1.0) + .bounds(0.5f) + .encode(0.0, 1.0, 0.0, 1.0) + .functions(2); + functionChecker.function(0) + .functionType(2) + .domain(0.0, 1.0) + .cZero(0f, 0f, 1f) + .cOne(1f, 0f, 0f) + .functions(0); + functionChecker.function(1) + .functionType(2) + .domain(0.0, 1.0) + .cZero(1f, 0f, 0f) + .cOne(0f, 1f, 0f) + .functions(0); + } + + @Test + public void fourColorRadialGradientNonZeroFirstStop() { + RadialGradientPaint gradient = new RadialGradientPaint(100, 200, 50, 110, 220, + fractions(0.2f, 0.5f, 0.7f, 1f), colors(Color.BLUE, Color.RED, Color.GREEN, Color.WHITE)); + Pattern pattern = GradientMaker.makeRadialGradient(gradient, new AffineTransform(), new AffineTransform()); + ShadingChecker shadingChecker = new PatternChecker(pattern).shading() + .coords(110.0, 220.0, 0.0, 100.0, 200.0, 50.0); + FunctionChecker functionChecker = shadingChecker.function() + .functionType(3) + .bounds(0.2f, 0.5f, 0.7f) + .encode(0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0) + .functions(4); + functionChecker.function(0) + .functionType(2) + .cZero(0f, 0f, 1f) + .cOne(0f, 0f, 1f); + functionChecker.function(1) + .functionType(2) + .cZero(0f, 0f, 1f) + .cOne(1f, 0f, 0f); + functionChecker.function(2) + .functionType(2) + .cZero(1f, 0f, 0f) + .cOne(0f, 1f, 0f); + functionChecker.function(3) + .functionType(2) + .cZero(0f, 1f, 0f) + .cOne(1f, 1f, 1f); + } + + @Test + public void fourColorRadialGradientNonZeroLastStopFocalOut() { + RadialGradientPaint gradient = new RadialGradientPaint(0, 0, 100, 100, 100, + fractions(0f, 0.3f, 0.6f, 0.9f), colors(Color.WHITE, Color.RED, Color.GREEN, Color.BLUE)); + Pattern pattern = GradientMaker.makeRadialGradient(gradient, new AffineTransform(), new AffineTransform()); + ShadingChecker shadingChecker = new PatternChecker(pattern).shading() + .coords(70.7036, 70.7036, 0.0, 0.0, 0.0, 100.0); + FunctionChecker functionChecker = shadingChecker.function() + .functionType(3) + .bounds(0.3f, 0.6f, 0.9f) + .encode(0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0) + .functions(4); + functionChecker.function(0) + .functionType(2) + .cZero(1f, 1f, 1f) + .cOne(1f, 0f, 0f); + functionChecker.function(1) + .functionType(2) + .cZero(1f, 0f, 0f) + .cOne(0f, 1f, 0f); + functionChecker.function(2) + .functionType(2) + .cZero(0f, 1f, 0f) + .cOne(0f, 0f, 1f); + functionChecker.function(3) + .functionType(2) + .cZero(0f, 0f, 1f) + .cOne(0f, 0f, 1f); + } + + private float[] fractions(float... fractions) { + return fractions; + } + + private Color[] colors(Color... colors) { + return colors; + } + +} diff --git a/src/test/java/org/apache/fop/render/intermediate/AbstractIFPainterTestCase.java b/src/test/java/org/apache/fop/render/intermediate/AbstractIFPainterTestCase.java new file mode 100644 index 000000000..ec0f35737 --- /dev/null +++ b/src/test/java/org/apache/fop/render/intermediate/AbstractIFPainterTestCase.java @@ -0,0 +1,105 @@ +/* + * 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.fop.render.intermediate; + +import java.awt.Dimension; +import java.awt.Paint; +import java.awt.Rectangle; +import java.awt.geom.AffineTransform; + +import org.junit.Before; +import org.junit.Test; +import org.w3c.dom.Document; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import org.apache.fop.fonts.FontInfo; +import org.apache.fop.fonts.FontTriplet; +import org.apache.fop.render.RenderingContext; +import org.apache.fop.traits.BorderProps; + +public class AbstractIFPainterTestCase { + + private AbstractIFPainter<?> sut; + private IFDocumentHandler handler; + + @Before + public void setUp() { + handler = mock(IFDocumentHandler.class); + sut = new AbstractIFPainter<IFDocumentHandler>(handler) { + public void startViewport(AffineTransform transform, Dimension size, Rectangle clipRect) + throws IFException { + } + + public void endViewport() throws IFException { + } + + public void startGroup(AffineTransform transform, String layer) throws IFException { + } + + public void endGroup() throws IFException { + } + + public void clipRect(Rectangle rect) throws IFException { + } + + public void clipBackground(Rectangle rect, BorderProps bpsBefore, BorderProps bpsAfter, + BorderProps bpsStart, BorderProps bpsEnd) throws IFException { + } + + public void fillRect(Rectangle rect, Paint fill) throws IFException { + } + + public void drawImage(String uri, Rectangle rect) throws IFException { + } + + public void drawImage(Document doc, Rectangle rect) throws IFException { + } + + @Override + protected RenderingContext createRenderingContext() { + return null; + } + + public void drawText(int x, int y, int letterSpacing, int wordSpacing, int[][] dp, + String text) throws IFException { + } + + }; + FontInfo fontInfo = mock(FontInfo.class); + when(handler.getFontInfo()).thenReturn(fontInfo); + } + + @Test + public void testGetFontKey() throws IFException { + String expected = "the expected string"; + FontTriplet triplet = mock(FontTriplet.class); + FontInfo fontInfo = handler.getFontInfo(); + when(fontInfo.getInternalFontKey(triplet)).thenReturn(expected); + assertEquals(expected, sut.getFontKey(triplet)); + } + + @Test(expected = IFException.class) + public void testGetFontKeyMissingFont() throws IFException { + FontTriplet triplet = mock(FontTriplet.class); + when(handler.getFontInfo().getInternalFontKey(triplet)).thenReturn(null); + sut.getFontKey(triplet); + } +} diff --git a/src/test/java/org/apache/fop/render/intermediate/ArcToBezierCurveTransformerTestCase.java b/src/test/java/org/apache/fop/render/intermediate/ArcToBezierCurveTransformerTestCase.java new file mode 100644 index 000000000..039ddcf90 --- /dev/null +++ b/src/test/java/org/apache/fop/render/intermediate/ArcToBezierCurveTransformerTestCase.java @@ -0,0 +1,79 @@ +/* + * 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.fop.render.intermediate; + +import java.io.IOException; + +import org.junit.Test; +import org.mockito.ArgumentCaptor; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; + +public class ArcToBezierCurveTransformerTestCase { + + @Test + public void arcTo() throws Exception { + testArcTo(Math.PI / 3, Math.PI / 2, 100, 200, 1000, 1000); + } + + private void testArcTo(double startAngle, double endAngle, int xCenter, int yCenter, int width, + int height) throws IOException { + assertAngleWithinFirstQuadrant(startAngle); + assertAngleWithinFirstQuadrant(endAngle); + BezierCurvePainter bezierCurvePainter = mock(BezierCurvePainter.class); + ArcToBezierCurveTransformer sut = new ArcToBezierCurveTransformer(bezierCurvePainter); + sut.arcTo(startAngle, endAngle, xCenter, yCenter, width, height); + double tan1 = Math.tan(startAngle); + double tan2 = Math.tan(endAngle); + double lambda1 = Math.atan(height * tan1 / width); + double lambda2 = Math.atan(height * tan2 / width); + double xStart = width * Math.cos(lambda1) + xCenter; + double yStart = height * Math.sin(lambda1) + yCenter; + double xEnd = width * Math.cos(lambda2) + xCenter; + double yEnd = height * Math.sin(lambda2) + yCenter; + ArgumentCaptor<Integer> xP1Captor = ArgumentCaptor.forClass(Integer.class); + ArgumentCaptor<Integer> yP1Captor = ArgumentCaptor.forClass(Integer.class); + ArgumentCaptor<Integer> xP2Captor = ArgumentCaptor.forClass(Integer.class); + ArgumentCaptor<Integer> yP2Captor = ArgumentCaptor.forClass(Integer.class); + ArgumentCaptor<Integer> xP3Captor = ArgumentCaptor.forClass(Integer.class); + ArgumentCaptor<Integer> yP3Captor = ArgumentCaptor.forClass(Integer.class); + verify(bezierCurvePainter).cubicBezierTo(xP1Captor.capture(), yP1Captor.capture(), + xP2Captor.capture(), yP2Captor.capture(), xP3Captor.capture(), yP3Captor.capture()); + int xP1 = xP1Captor.getValue(); + int yP1 = yP1Captor.getValue(); + int xP2 = xP2Captor.getValue(); + int yP2 = yP2Captor.getValue(); + int xP3 = xP3Captor.getValue(); + int yP3 = yP3Captor.getValue(); + // TODO do more than check the direction of the tangents at the end + // points + assertEquals((yP1 - yStart) / (xP1 - xStart), -width * width / height / height / tan1, 0.01); + assertEquals((yP2 - yEnd) / (xP2 - xEnd), -width * width / height / height / tan2, 0.01); + assertEquals((int) xEnd, xP3); + assertEquals((int) yEnd, yP3); + } + + private void assertAngleWithinFirstQuadrant(double angle) { + if (angle <= 0 || angle > Math.PI / 2) { + fail("Angle " + angle + " is in (0, " + Math.PI / 2 + ")"); + } + } +} diff --git a/src/test/java/org/apache/fop/render/intermediate/BorderPainterTestCase.java b/src/test/java/org/apache/fop/render/intermediate/BorderPainterTestCase.java new file mode 100644 index 000000000..4a89b3ac6 --- /dev/null +++ b/src/test/java/org/apache/fop/render/intermediate/BorderPainterTestCase.java @@ -0,0 +1,578 @@ +/* + * 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.fop.render.intermediate; + +import java.awt.Color; +import java.awt.Rectangle; +import java.io.IOException; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.atLeastOnce; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyZeroInteractions; + +import org.apache.fop.fo.Constants; +import org.apache.fop.traits.BorderProps; +import org.apache.fop.traits.BorderProps.Mode; + +public class BorderPainterTestCase { + + private static final BorderProps BORDER_PROPS = new BorderProps(Constants.EN_SOLID, 10, 50, 50, + Color.BLACK, BorderProps.Mode.SEPARATE); + + @Test + public void clipBackground() throws Exception { + // Rectangular borders + test(new ClipBackgroundTester(0, 0, 10, 10)); + test(new ClipBackgroundTester(5, 10, 10, 10)); + test(new ClipBackgroundTester(0, 0, 10, 10).setBorderWidth(1)); + test(new ClipBackgroundTester(0, 0, 10, 10).beforeBorder().setWidth(10).tester()); + // Rounded corners + test(new ClipBackgroundTester(0, 0, 10, 10).setEndBefore(1, 1)); + test(new ClipBackgroundTester(0, 0, 10, 10).setEndAfter(1, 1)); + test(new ClipBackgroundTester(0, 0, 10, 10).setStartAfter(1, 1)); + test(new ClipBackgroundTester(0, 0, 10, 10).setStartBefore(1, 1)); + test(new ClipBackgroundTester(0, 0, 100, 100) + .setCornerRadii(10) + .beforeBorder().setWidth(5).tester() + .startBorder().setWidth(5).tester()); + test(new ClipBackgroundTester(0, 0, 100, 100) + .setCornerRadii(10) + .beforeBorder().setWidth(10).tester() + .startBorder().setWidth(10).tester()); + test(new ClipBackgroundTester(0, 0, 100, 100) + .setCornerRadii(10) + .beforeBorder().setWidth(5).tester()); + test(new ClipBackgroundTester(0, 0, 100, 100) + .setCornerRadii(10) + .setStartBefore(10, 10) + .beforeBorder().setWidth(10).tester()); + } + + private void test(BorderPainterTester<?> tester) throws IOException { + tester.test(); + } + + @Test (expected = IFException.class) + public void drawBordersThrowsIFException() throws Exception { + GraphicsPainter graphicsPainter = mock(GraphicsPainter.class); + doThrow(new IOException()).when(graphicsPainter).saveGraphicsState(); + new BorderPainter(graphicsPainter).drawBorders(new Rectangle(0, 0, 1000, 1000), BORDER_PROPS, + BORDER_PROPS, BORDER_PROPS, BORDER_PROPS, Color.WHITE); + } + + @Test + public void testDrawRectangularBorders() throws IOException { + test(new DrawRectangularBordersTester(0, 0, 1000, 1000).setBorderWidth(10)); + test(new DrawRectangularBordersTester(0, 0, 1000, 1000)); + test(new DrawRectangularBordersTester(0, 0, 1000, 1000).setBorderWidth(10) + .beforeBorder().setWidth(0).tester()); + } + + @Test + public void testDrawRectangularBordersWithNullBorders() throws IOException, IFException { + GraphicsPainter graphicsPainter = mock(GraphicsPainter.class); + BorderProps nullBorderProps = null; + new BorderPainter(graphicsPainter).drawRectangularBorders(new Rectangle(0, 0, 1000, 1000), + nullBorderProps, nullBorderProps, nullBorderProps, nullBorderProps); + verifyZeroInteractions(graphicsPainter); + } + + @Test + public void drawRoundedBorders() throws Exception { + test(new DrawRoundedBordersTester(0, 0, 10, 10).setBorderWidth(10)); + test(new DrawRoundedBordersTester(0, 0, 10, 10).beforeBorder().setWidth(10).tester()); + test(new DrawRoundedBordersTester(0, 0, 10, 10).setBorderWidth(10).setCornerRadii(5) + .beforeBorder().setWidth(0).tester()); + test(new DrawRoundedBordersTester(0, 0, 10, 10) + .beforeBorder().setWidth(10).tester().endBorder().setWidth(10).tester()); + test(new DrawRoundedBordersTester(0, 0, 100, 100).setBorderWidth(15).setCornerRadii(10)); + test(new DrawRoundedBordersTester(0, 0, 100, 100).setBorderWidth(15).setCornerRadii(10) + .beforeBorder().setWidth(5).tester()); + test(new DrawRoundedBordersTester(0, 0, 60, 60).setBorderWidth(4).setCornerRadii(30)); + } + + @Test + public void testDrawRoundedBordersWithNullBorders() throws IOException, IFException { + GraphicsPainter graphicsPainter = mock(GraphicsPainter.class); + BorderProps nullBorderProps = null; + new BorderPainter(graphicsPainter).drawRoundedBorders(new Rectangle(0, 0, 1000, 1000), + nullBorderProps, nullBorderProps, nullBorderProps, nullBorderProps); + verifyZeroInteractions(graphicsPainter); + } + + @Test + public void testCalculateCornerCorrectionFactor() { + calculateCornerCorrectionFactorHelper(30000, 500000); + calculateCornerCorrectionFactorHelper(30000, 10000); + } + + private void calculateCornerCorrectionFactorHelper(int radius, int rectWidth) { + BorderProps borderProps = new BorderProps(Constants.EN_SOLID, 4000, radius, radius, Color.BLACK, + BorderProps.Mode.SEPARATE); + int rectHeight = rectWidth + 100; + double expected = (2 * radius > rectWidth) ? (double) rectWidth / (2 * radius) : 1.0; + double actual = BorderPainter.calculateCornerCorrectionFactor(rectWidth, rectHeight, borderProps, + borderProps, borderProps, borderProps); + assertEquals(expected, actual, 0); + } + + private abstract static class BorderPainterTester<T extends BorderPainterTester<?>> { + + protected final Rectangle borderExtent; + + protected BorderProps before; + + protected BorderProps after; + + protected BorderProps start; + + protected BorderProps end; + + protected final GraphicsPainter graphicsPainter; + + protected final BorderPainter sut; + + private final BorderPropsBuilder<T> beforeBuilder; + + private final BorderPropsBuilder<T> afterBuilder; + + private final BorderPropsBuilder<T> startBuilder; + + private final BorderPropsBuilder<T> endBuilder; + + public BorderPainterTester(int xOrigin, int yOrigin, int width, int height) { + if (width <= 0 || height <= 0) { + throw new IllegalArgumentException("Cannot test degenerate borders"); + } + beforeBuilder = new BorderPropsBuilder<T>(getThis()); + afterBuilder = new BorderPropsBuilder<T>(getThis()); + startBuilder = new BorderPropsBuilder<T>(getThis()); + endBuilder = new BorderPropsBuilder<T>(getThis()); + this.borderExtent = new Rectangle(xOrigin, yOrigin, width, height); + this.graphicsPainter = mock(GraphicsPainter.class); + this.sut = new BorderPainter(graphicsPainter); + } + + protected abstract T getThis(); + + public BorderPropsBuilder<T> beforeBorder() { + return beforeBuilder; + } + + public BorderPropsBuilder<T> afterBorder() { + return afterBuilder; + } + + public BorderPropsBuilder<T> startBorder() { + return startBuilder; + } + + public BorderPropsBuilder<T> endBorder() { + return endBuilder; + } + + public T setBorderWidth(int width) { + beforeBuilder.setWidth(width); + endBuilder.setWidth(width); + afterBuilder.setWidth(width); + startBuilder.setWidth(width); + return getThis(); + } + + public T setCornerRadii(int radius) { + return setCornerRadii(radius, radius); + } + + public T setCornerRadii(int xRadius, int yRadius) { + setStartBefore(xRadius, yRadius); + setEndBefore(xRadius, yRadius); + setEndAfter(xRadius, yRadius); + setStartAfter(xRadius, yRadius); + return getThis(); + } + + public T setStartBefore(int xRadius, int yRadius) { + startBuilder.setRadiusStart(xRadius); + beforeBuilder.setRadiusStart(yRadius); + return getThis(); + } + + public T setEndBefore(int xRadius, int yRadius) { + endBuilder.setRadiusStart(xRadius); + beforeBuilder.setRadiusEnd(yRadius); + return getThis(); + } + + public T setEndAfter(int xRadius, int yRadius) { + endBuilder.setRadiusEnd(xRadius); + afterBuilder.setRadiusEnd(yRadius); + return getThis(); + } + + public T setStartAfter(int xRadius, int yRadius) { + startBuilder.setRadiusEnd(xRadius); + afterBuilder.setRadiusStart(yRadius); + return getThis(); + } + + public final void test() throws IOException { + before = beforeBuilder.build(); + after = afterBuilder.build(); + end = endBuilder.build(); + start = startBuilder.build(); + testMethod(); + } + + protected abstract void testMethod() throws IOException; + + protected static int numberOfNonZeroBorders(BorderProps first, BorderProps... borders) { + int i = first.width == 0 ? 0 : 1; + for (BorderProps borderProp : borders) { + if (borderProp.width > 0) { + i++; + } + } + return i; + } + + protected int numberOfNonZeroBorders() { + return numberOfNonZeroBorders(before, end, after, start); + } + + } + + private static class BorderPropsBuilder<T extends BorderPainterTester<?>> { + + private final int style = 0; + + private final Color color = null; + + private final Mode mode = BorderProps.Mode.SEPARATE; + + private int width; + + private int radiusStart; + + private int radiusEnd; + + private final T tester; + + public BorderPropsBuilder(T tester) { + this.tester = tester; + } + + public T tester() { + return tester; + } + + public BorderPropsBuilder<T> setWidth(int width) { + this.width = width; + return this; + } + + public BorderPropsBuilder<T> setRadiusStart(int radiusStart) { + this.radiusStart = radiusStart; + return this; + } + + public BorderPropsBuilder<T> setRadiusEnd(int radiusEnd) { + this.radiusEnd = radiusEnd; + return this; + } + + public BorderProps build() { + return new BorderProps(style, width, radiusStart, radiusEnd, color, mode); + } + } + + private static final class DrawRectangularBordersTester + extends BorderPainterTester<DrawRectangularBordersTester> { + + public DrawRectangularBordersTester(int xOrigin, int yOrigin, int width, int height) + throws IOException { + super(xOrigin, yOrigin, width, height); + } + + public DrawRectangularBordersTester setStartBefore(int xRadius, int yRadius) { + return notSupported(); + } + + public DrawRectangularBordersTester setEndBefore(int xRadius, int yRadius) { + return notSupported(); + } + + public DrawRectangularBordersTester setEndAfter(int xRadius, int yRadius) { + return notSupported(); + } + + public DrawRectangularBordersTester setStartAfter(int xRadius, int yRadius) { + return notSupported(); + } + + private DrawRectangularBordersTester notSupported() { + throw new UnsupportedOperationException(); + } + + public void testMethod() throws IOException { + sut.drawRectangularBorders(borderExtent, before, after, start, end); + verifyDrawing(); + } + + private void verifyDrawing() throws IOException { + final int rectX = borderExtent.x; + final int rectY = borderExtent.y; + final int rectWidth = borderExtent.width; + final int rectHeight = borderExtent.height; + if (before.width > 0) { + verify(graphicsPainter).moveTo(rectX, rectY); + verify(graphicsPainter).lineTo(rectWidth, rectY); + verify(graphicsPainter, times(numberOfNonZeroBorders(before, end))) + .lineTo(rectWidth - end.width, rectY + before.width); + verify(graphicsPainter, times(numberOfNonZeroBorders(before, start))) + .lineTo(rectX + start.width, rectY + before.width); + } + if (end.width > 0) { + verify(graphicsPainter).moveTo(rectWidth, rectY); + verify(graphicsPainter).lineTo(rectWidth, rectHeight); + verify(graphicsPainter, times(numberOfNonZeroBorders(end, after))) + .lineTo(rectWidth - end.width, rectHeight - after.width); + verify(graphicsPainter, times(numberOfNonZeroBorders(end, before))) + .lineTo(rectWidth - end.width, rectY + before.width); + } + if (after.width > 0) { + verify(graphicsPainter).moveTo(rectWidth, rectHeight); + verify(graphicsPainter).lineTo(rectX, rectHeight); + verify(graphicsPainter, times(numberOfNonZeroBorders(after, end))) + .lineTo(rectX + start.width, rectHeight - after.width); + verify(graphicsPainter, times(numberOfNonZeroBorders(after, start))) + .lineTo(rectWidth - end.width, rectHeight - after.width); + } + if (start.width > 0) { + verify(graphicsPainter).moveTo(rectX, rectHeight); + verify(graphicsPainter).lineTo(rectX, rectY); + verify(graphicsPainter, times(numberOfNonZeroBorders(start, before))) + .lineTo(rectX + start.width, rectY + before.width); + verify(graphicsPainter, times(numberOfNonZeroBorders(start, after))) + .lineTo(rectX + start.width, rectHeight - after.width); + } + int numBorders = numberOfNonZeroBorders(); + verify(graphicsPainter, times(numBorders)).saveGraphicsState(); + verify(graphicsPainter, times(numBorders)).closePath(); + verify(graphicsPainter, times(numBorders)).restoreGraphicsState(); + verify(graphicsPainter, times(numBorders)).clip(); + } + + @Override + protected DrawRectangularBordersTester getThis() { + return this; + } + } + + private static final class DrawRoundedBordersTester extends BorderPainterTester<DrawRoundedBordersTester> { + + public DrawRoundedBordersTester(int xOrigin, int yOrigin, int width, int height) throws IOException { + super(xOrigin, yOrigin, width, height); + } + + public void testMethod() throws IOException { + sut.drawRoundedBorders(borderExtent, before, after, start, end); + verifyDrawing(); + } + + private void verifyDrawing() throws IOException { + int numBorders = numberOfNonZeroBorders(); + final int rectWidth = borderExtent.width; + final int rectHeight = borderExtent.height; + if (before.width > 0) { + verify(graphicsPainter, atLeastOnce()).lineTo(rectWidth - end.getRadiusStart(), 0); + verify(graphicsPainter, atLeastOnce()).lineTo(calcLineEnd(start.width, before.width, + start.getRadiusStart(), before.getRadiusStart()), before.width); + } + if (end.width > 0) { + verify(graphicsPainter, atLeastOnce()).lineTo(rectHeight - after.getRadiusEnd(), 0); + verify(graphicsPainter, atLeastOnce()).lineTo(calcLineEnd(before.width, end.width, + before.getRadiusEnd(), end.getRadiusStart()), end.width); + } + if (after.width > 0) { + verify(graphicsPainter, atLeastOnce()).lineTo(rectWidth - start.getRadiusEnd(), 0); + verify(graphicsPainter, atLeastOnce()).lineTo(calcLineEnd(start.width, after.width, + start.getRadiusEnd(), after.getRadiusStart()), after.width); + } + if (start.width > 0) { + verify(graphicsPainter, atLeastOnce()).lineTo(rectHeight - after.getRadiusStart(), 0); + verify(graphicsPainter, atLeastOnce()).lineTo(calcLineEnd(before.width, start.width, + before.getRadiusStart(), before.getRadiusStart()), start.width); + } + // verify the drawing of the symmetric rounded corners (the ones that are a quarter of a circle) + // verification is restricted to those since it is too complex in the general case + if (before.width == end.width && before.getRadiusStart() == before.getRadiusEnd() + && end.getRadiusStart() == end.getRadiusEnd() + && before.getRadiusEnd() == end.getRadiusStart() && end.getRadiusStart() > 0) { + verify(graphicsPainter, atLeastOnce()).arcTo(Math.PI * 5 / 4, Math.PI * 3 / 2, + before.getRadiusStart(), end.getRadiusEnd(), before.getRadiusStart(), + end.getRadiusEnd()); + } + if (end.width == after.width && end.getRadiusStart() == end.getRadiusEnd() + && after.getRadiusStart() == after.getRadiusEnd() + && end.getRadiusEnd() == after.getRadiusStart() && after.getRadiusStart() > 0) { + verify(graphicsPainter, atLeastOnce()).arcTo(Math.PI * 5 / 4, Math.PI * 3 / 2, + end.getRadiusStart(), after.getRadiusEnd(), end.getRadiusStart(), + after.getRadiusEnd()); + } + if (after.width == start.width && after.getRadiusStart() == after.getRadiusEnd() + && start.getRadiusStart() == start.getRadiusEnd() + && after.getRadiusEnd() == start.getRadiusStart() && start.getRadiusStart() > 0) { + verify(graphicsPainter, atLeastOnce()).arcTo(Math.PI * 5 / 4, Math.PI * 3 / 2, + after.getRadiusStart(), start.getRadiusEnd(), after.getRadiusStart(), + start.getRadiusEnd()); + } + if (start.width == before.width && start.getRadiusStart() == start.getRadiusEnd() + && before.getRadiusStart() == before.getRadiusEnd() + && start.getRadiusEnd() == before.getRadiusStart() && before.getRadiusStart() > 0) { + verify(graphicsPainter, atLeastOnce()).arcTo(Math.PI * 5 / 4, Math.PI * 3 / 2, + start.getRadiusStart(), before.getRadiusEnd(), start.getRadiusStart(), + before.getRadiusEnd()); + } + verify(graphicsPainter, times(numBorders)).saveGraphicsState(); + verify(graphicsPainter, times(numBorders)).closePath(); + verify(graphicsPainter, times(numBorders)).restoreGraphicsState(); + verify(graphicsPainter, times(numBorders)).clip(); + } + + private int calcLineEnd(int xWidth, int yWidth, int xRadius, int yRadius) { + return yWidth > yRadius ? yWidth : xWidth > 0 ? Math.max(xRadius, xWidth) : 0; + } + + @Override + protected DrawRoundedBordersTester getThis() { + return this; + } + + } + + private static final class ClipBackgroundTester extends BorderPainterTester<ClipBackgroundTester> { + + public ClipBackgroundTester(int xOrigin, int yOrigin, int width, int height) throws IOException { + super(xOrigin, yOrigin, width, height); + } + + public void testMethod() throws IOException { + sut.clipBackground(borderExtent, before, after, start, end); + verifyClipping(); + } + + private void verifyClipping() throws IOException { + int xOrigin = borderExtent.x; + int yOrigin = borderExtent.y; + int xEnd = xOrigin + borderExtent.width; + int yEnd = yOrigin + borderExtent.height; + + Corner startBeforeCorner = Corner.createStartBeforeCorner(getInnerRadiusStart(start), + getInnerRadiusStart(before)); + Corner endBeforeCorner = Corner.createEndBeforeCorner(getInnerRadiusStart(end), getRadiusEnd(before)); + Corner endAfterCorner = Corner.createEndAfterCorner(getRadiusEnd(end), getRadiusEnd(after)); + Corner startAfterCorner = Corner.createStartAfterCorner(getRadiusEnd(start), + getInnerRadiusStart(after)); + verify(graphicsPainter, times(1)).moveTo(xOrigin + startBeforeCorner.xRadius, yOrigin); + verify(graphicsPainter, times(1)).lineTo(xEnd - endBeforeCorner.xRadius, yOrigin); + endBeforeCorner.verifyCornerDrawn(graphicsPainter, xEnd - endBeforeCorner.xRadius, + yOrigin + endBeforeCorner.yRadius); + verify(graphicsPainter, times(1)).lineTo(xEnd, yEnd - endAfterCorner.yRadius); + endAfterCorner.verifyCornerDrawn(graphicsPainter, xEnd - endAfterCorner.xRadius, + yEnd - endAfterCorner.yRadius); + verify(graphicsPainter, times(1)).lineTo(xOrigin + startAfterCorner.xRadius, yEnd); + startAfterCorner.verifyCornerDrawn(graphicsPainter, xOrigin + startAfterCorner.xRadius, + yEnd - startAfterCorner.yRadius); + verify(graphicsPainter, times(1)).lineTo(xOrigin, yOrigin + startBeforeCorner.yRadius); + startBeforeCorner.verifyCornerDrawn(graphicsPainter, xOrigin + startBeforeCorner.xRadius, + yOrigin + startBeforeCorner.yRadius); + verify(graphicsPainter, times(1)).clip(); + } + + private int getInnerRadiusStart(BorderProps borderProps) { + return getInnerRadius(borderProps.getRadiusStart(), borderProps.width); + } + + private int getRadiusEnd(BorderProps borderProps) { + return getInnerRadius(borderProps.getRadiusEnd(), borderProps.width); + } + + private int getInnerRadius(int radius, int borderWidth) { + return Math.max(radius - borderWidth, 0); + } + + private static class Corner { + + public final int xRadius; + + public final int yRadius; + + private final double startAngle; + + private final double endAngle; + + public Corner(int xRadius, int yRadius, double startAngle, double endAngle) { + this.xRadius = xRadius; + this.yRadius = yRadius; + this.startAngle = startAngle; + this.endAngle = endAngle; + } + + public static Corner createStartBeforeCorner(int xRadius, int yRadius) { + return new Corner(xRadius, yRadius, Math.PI, Math.PI * 3 / 2); + } + + public static Corner createEndBeforeCorner(int xRadius, int yRadius) { + return new Corner(xRadius, yRadius, Math.PI * 3 / 2, 0); + } + + public static Corner createEndAfterCorner(int xRadius, int yRadius) { + return new Corner(xRadius, yRadius, 0, Math.PI / 2); + } + + public static Corner createStartAfterCorner(int xRadius, int yRadius) { + return new Corner(xRadius, yRadius, Math.PI / 2, Math.PI); + } + + public void verifyCornerDrawn(GraphicsPainter graphicsPainter, int xCenter, int yCenter) + throws IOException { + if (xRadius != 0 && yRadius != 0) { + verify(graphicsPainter, times(1)).arcTo(startAngle, endAngle, + xCenter, yCenter, xRadius, yRadius); + } else { + verify(graphicsPainter, never()).arcTo(startAngle, endAngle, + xCenter, yCenter, xRadius, yRadius); + } + } + } + + @Override + protected ClipBackgroundTester getThis() { + return this; + } + } + + +} diff --git a/src/test/java/org/apache/fop/render/intermediate/IFSerializerTestCase.java b/src/test/java/org/apache/fop/render/intermediate/IFSerializerTestCase.java new file mode 100644 index 000000000..0340c190e --- /dev/null +++ b/src/test/java/org/apache/fop/render/intermediate/IFSerializerTestCase.java @@ -0,0 +1,93 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.intermediate; + +import java.awt.Rectangle; + +import javax.xml.transform.sax.SAXResult; + +import org.junit.Before; +import org.junit.Test; +import org.xml.sax.helpers.DefaultHandler; + +import static org.junit.Assert.assertTrue; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import org.apache.xmlgraphics.image.loader.ImageManager; +import org.apache.xmlgraphics.image.loader.ImageSessionContext; + +import org.apache.fop.apps.FOUserAgent; + +public class IFSerializerTestCase { + + private static final String IMAGE = "image.png"; + + private IFSerializer sut; + + private ImageManager imageManager; + + @Before + public void setUp() throws IFException { + imageManager = mock(ImageManager.class); + IFContext context = mockContext(); + sut = new IFSerializer(context); + } + + private IFContext mockContext() { + FOUserAgent userAgent = mock(FOUserAgent.class); + when(userAgent.getImageManager()).thenReturn(imageManager); + return new IFContext(userAgent); + } + + @Test + public void drawImageShouldCloseResources() throws IFException { + sut.setResult(new SAXResult(new DefaultHandler())); + whenDrawImageIsCalled(true); + thenImageResourcesMustBeClosed(); + } + + @Test + public void failingDrawImageShouldCloseResources() throws IFException { + // Make drawImage artificially fail by not calling setResult + whenDrawImageIsCalled(false); + thenImageResourcesMustBeClosed(); + } + + private void whenDrawImageIsCalled(boolean terminatesNormally) throws IFException { + boolean exceptionThrown = false; + try { + sut.drawImage(IMAGE, new Rectangle(10, 10)); + } catch (Exception e) { + exceptionThrown = true; + } + if (!terminatesNormally) { + assertTrue(exceptionThrown); + } + } + + private void thenImageResourcesMustBeClosed() { + verify(imageManager).closeImage(eq(IMAGE), any(ImageSessionContext.class)); + } + +} diff --git a/src/test/java/org/apache/fop/render/intermediate/IFStructureTreeBuilderTestCase.java b/src/test/java/org/apache/fop/render/intermediate/IFStructureTreeBuilderTestCase.java new file mode 100644 index 000000000..5546e5905 --- /dev/null +++ b/src/test/java/org/apache/fop/render/intermediate/IFStructureTreeBuilderTestCase.java @@ -0,0 +1,169 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.intermediate; + +import org.junit.Before; +import org.junit.Test; +import org.mockito.ArgumentMatcher; +import org.mockito.InOrder; +import org.xml.sax.Attributes; +import org.xml.sax.ContentHandler; +import org.xml.sax.SAXException; +import org.xml.sax.helpers.AttributesImpl; + +import static org.junit.Assert.fail; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.argThat; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; + +import org.apache.fop.fo.FOElementMapping; +import org.apache.fop.fo.extensions.ExtensionElementMapping; +import org.apache.fop.fo.extensions.InternalElementMapping; +import org.apache.fop.util.XMLUtil; + +public class IFStructureTreeBuilderTestCase { + + private IFStructureTreeBuilder sut; + + @Before + public void setUp() { + sut = new IFStructureTreeBuilder(); + } + + @Test + public void startAndEndPageSequence() throws SAXException { + final ContentHandler handler = mock(ContentHandler.class); + + try { + sut.replayEventsForPageSequence(handler, 0); + fail("No page sequences created"); + } catch (IndexOutOfBoundsException e) { + // Expected + } + + sut.startPageSequence(null, null); + sut.endPageSequence(); + + sut.replayEventsForPageSequence(handler, 0); + + InOrder inOrder = inOrder(handler); + + inOrder.verify(handler).startPrefixMapping( + InternalElementMapping.STANDARD_PREFIX, InternalElementMapping.URI); + inOrder.verify(handler).startPrefixMapping( + ExtensionElementMapping.STANDARD_PREFIX, ExtensionElementMapping.URI); + inOrder.verify(handler).startElement(eq(IFConstants.NAMESPACE), + eq(IFConstants.EL_STRUCTURE_TREE), + eq(IFConstants.EL_STRUCTURE_TREE), + any(Attributes.class)); + inOrder.verify(handler).endElement(eq(IFConstants.NAMESPACE), + eq(IFConstants.EL_STRUCTURE_TREE), + eq(IFConstants.EL_STRUCTURE_TREE)); + inOrder.verify(handler).endPrefixMapping(ExtensionElementMapping.STANDARD_PREFIX); + inOrder.verify(handler).endPrefixMapping(InternalElementMapping.STANDARD_PREFIX); + } + + @Test + public void startNode() throws Exception { + final String[] attributes = {"struct-id", "1"}; + final String nodeName = "block"; + final ContentHandler handler = mock(ContentHandler.class); + + sut.startPageSequence(null, null); + sut.startNode(nodeName, createSimpleAttributes(attributes), null); + sut.endPageSequence(); + + sut.replayEventsForPageSequence(handler, 0); + + verify(handler).startElement(eq(FOElementMapping.URI), eq(nodeName), + eq(FOElementMapping.STANDARD_PREFIX + ":" + nodeName), + AttributesMatcher.match(createSimpleAttributes(attributes))); + } + + @Test + public void endNode() throws Exception { + final String nodeName = "block"; + final ContentHandler handler = mock(ContentHandler.class); + + sut.startPageSequence(null, null); + sut.endNode(nodeName); + sut.endPageSequence(); + + sut.replayEventsForPageSequence(handler, 0); + + verify(handler).endElement(eq(FOElementMapping.URI), eq(nodeName), + eq(FOElementMapping.STANDARD_PREFIX + ":" + nodeName)); + } + + private static Attributes createSimpleAttributes(String... attributes) { + assert (attributes.length % 2 == 0); + final AttributesImpl atts = new AttributesImpl(); + for (int i = 0; i < attributes.length; i += 2) { + String key = attributes[i]; + String value = attributes[i + 1]; + atts.addAttribute("", key, key, XMLUtil.CDATA, value); + } + return atts; + } + + private static final class AttributesMatcher extends ArgumentMatcher<Attributes> { + + private final Attributes expected; + + private AttributesMatcher(Attributes expected) { + this.expected = expected; + } + + public static Attributes match(Attributes expected) { + return argThat(new AttributesMatcher(expected)); + } + + public boolean matches(Object attributes) { + return attributesEqual(expected, (Attributes) attributes); + } + + private static boolean attributesEqual(Attributes attributes1, Attributes attributes2) { + if (attributes1.getLength() != attributes2.getLength()) { + return false; + } + for (int i = 0; i < attributes1.getLength(); i++) { + if (attributes1.getLocalName(i) != attributes2.getLocalName(i)) { + return false; + } + if (attributes1.getQName(i) != attributes2.getQName(i)) { + return false; + } + if (attributes1.getType(i) != attributes2.getType(i)) { + return false; + } + if (attributes1.getURI(i) != attributes2.getURI(i)) { + return false; + } + if (attributes1.getValue(i) != attributes2.getValue(i)) { + return false; + } + } + return true; + } + } +} diff --git a/src/test/java/org/apache/fop/render/intermediate/SAXEventRecorderTestCase.java b/src/test/java/org/apache/fop/render/intermediate/SAXEventRecorderTestCase.java new file mode 100644 index 000000000..757d6620b --- /dev/null +++ b/src/test/java/org/apache/fop/render/intermediate/SAXEventRecorderTestCase.java @@ -0,0 +1,131 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.intermediate; + + +import org.junit.Before; +import org.junit.Test; +import org.mockito.InOrder; +import org.xml.sax.Attributes; +import org.xml.sax.ContentHandler; +import org.xml.sax.SAXException; +import org.xml.sax.helpers.AttributesImpl; + +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; + +import org.apache.fop.render.intermediate.IFStructureTreeBuilder.SAXEventRecorder; +import org.apache.fop.util.XMLUtil; + +/** + * Tests {@link SAXEventRecorder}. + */ +public class SAXEventRecorderTestCase { + + private static final String URI = "http://www.example.com/"; + + private SAXEventRecorder sut; + + @Before + public void setUp() { + sut = new SAXEventRecorder(); + } + + @Test + public void testStartEvent() throws SAXException { + final String localName = "element"; + final String qName = "prefix:" + localName; + final Attributes attributes = new AttributesImpl(); + + sut.startElement(URI, localName, qName, attributes); + ContentHandler handler = mock(ContentHandler.class); + sut.replay(handler); + verify(handler).startElement(URI, localName, qName, attributes); + } + + @Test + public void testEndEvent() throws SAXException { + final String localName = "element"; + final String qName = "prefix:" + localName; + sut.endElement(URI, localName, qName); + ContentHandler handler = mock(ContentHandler.class); + sut.replay(handler); + verify(handler).endElement(URI, localName, qName); + } + + @Test + public void testStartPrefixMapping() throws SAXException { + final String prefix = "prefix"; + + sut.startPrefixMapping(URI, prefix); + ContentHandler handler = mock(ContentHandler.class); + sut.replay(handler); + verify(handler).startPrefixMapping(URI, prefix); + } + + @Test + public void testEndPrefixMapping() throws SAXException { + final String prefix = "prefix"; + + sut.endPrefixMapping(prefix); + ContentHandler handler = mock(ContentHandler.class); + sut.replay(handler); + verify(handler).endPrefixMapping(prefix); + } + + @Test + public void completeTest() throws SAXException { + final String localName1 = "element"; + final String qName1 = "prefix:" + localName1; + final Attributes attributes1 = createAttributes(URI, localName1, qName1, "value-1"); + final String localName2 = "element2"; + final String qName2 = "prefix:" + localName2; + final Attributes attributes2 = createAttributes(URI, localName2, qName2, "value-2"); + final ContentHandler handler = mock(ContentHandler.class); + final String extensionUrl = "http://www.example.com/extension"; + final String extensionPrefix = "ext"; + + sut.startPrefixMapping(extensionPrefix, extensionUrl); + sut.startElement(URI, localName1, qName1, attributes1); + sut.startElement(URI, localName2, qName2, attributes2); + sut.endElement(URI, localName2, qName2); + sut.endElement(URI, localName1, qName1); + sut.endPrefixMapping(extensionPrefix); + + sut.replay(handler); + + InOrder inOrder = inOrder(handler); + inOrder.verify(handler).startPrefixMapping(extensionPrefix, extensionUrl); + inOrder.verify(handler).startElement(URI, localName1, qName1, attributes1); + inOrder.verify(handler).startElement(URI, localName2, qName2, attributes2); + inOrder.verify(handler).endElement(URI, localName2, qName2); + inOrder.verify(handler).endElement(URI, localName1, qName1); + inOrder.verify(handler).endPrefixMapping(extensionPrefix); + } + + private static Attributes createAttributes(String uri, String localName, + String qName, String value) { + final AttributesImpl atts = new AttributesImpl(); + atts.addAttribute(uri, localName, qName, XMLUtil.CDATA, value); + return atts; + } + +} diff --git a/src/test/java/org/apache/fop/render/java2d/Java2DRendererConfigParserTestcase.java b/src/test/java/org/apache/fop/render/java2d/Java2DRendererConfigParserTestcase.java new file mode 100644 index 000000000..e87c8713d --- /dev/null +++ b/src/test/java/org/apache/fop/render/java2d/Java2DRendererConfigParserTestcase.java @@ -0,0 +1,53 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.java2d; + +import org.junit.Test; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import org.apache.fop.apps.AbstractRendererConfigParserTester; +import org.apache.fop.apps.Java2DRendererConfBuilder; +import org.apache.fop.render.java2d.Java2DRendererConfig.Java2DRendererConfigParser; + +public class Java2DRendererConfigParserTestcase + extends AbstractRendererConfigParserTester<Java2DRendererConfBuilder, Java2DRendererConfig> { + + public Java2DRendererConfigParserTestcase() { + super(new Java2DRendererConfigParser("Java2D"), Java2DRendererConfBuilder.class); + } + + @Test + public void testPageBackgroundTransparency() throws Exception { + parseConfig(createRenderer().setPageBackgroundTransparency(true)); + assertTrue(conf.isPageBackgroundTransparent()); + + parseConfig(createRenderer().setPageBackgroundTransparency(false)); + assertFalse(conf.isPageBackgroundTransparent()); + } + + @Test + public void testNullPageBackgroundTransparency() throws Exception { + parseConfig(createRenderer()); + assertNull(conf.isPageBackgroundTransparent()); + } +} diff --git a/src/test/java/org/apache/fop/render/pcl/PCLPainterTestCase.java b/src/test/java/org/apache/fop/render/pcl/PCLPainterTestCase.java new file mode 100644 index 000000000..65ac6ef0b --- /dev/null +++ b/src/test/java/org/apache/fop/render/pcl/PCLPainterTestCase.java @@ -0,0 +1,60 @@ +/* + * 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. + */ + +/* $Id$ */ +package org.apache.fop.render.pcl; + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Rectangle; +import java.io.ByteArrayOutputStream; +import java.io.File; + +import javax.xml.transform.stream.StreamResult; + +import org.junit.Test; + +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.apps.FopFactory; +import org.apache.fop.render.intermediate.IFContext; +import org.apache.fop.render.intermediate.IFException; + +import junit.framework.Assert; + +public class PCLPainterTestCase { + private FOUserAgent ua = FopFactory.newInstance(new File(".").toURI()).newFOUserAgent(); + + @Test + public void testFillRect() throws IFException { + Rectangle size = new Rectangle(1, 1); + PCLPageDefinition pclPageDef = new PCLPageDefinition("", 0, new Dimension(), size, true); + PCLDocumentHandler documentHandler = new PCLDocumentHandler(new IFContext(ua)); + ByteArrayOutputStream output = new ByteArrayOutputStream(); + documentHandler.setResult(new StreamResult(output)); + documentHandler.startDocument(); + PCLPainter pclPainter = new PCLPainter(documentHandler, pclPageDef); + pclPainter.fillRect(size, Color.RED); + Assert.assertTrue(output.toString().contains("*c4Q\u001B*c0.01h0.01V\u001B*c32G\u001B*c4P")); + output.reset(); + + pclPainter.getPCLUtil().setColorEnabled(true); + pclPainter.fillRect(size, Color.RED); + Assert.assertFalse(output.toString().contains("*c4P")); + Assert.assertTrue(output.toString().contains("*v255a0b0c0I\u001B*v0S\u001B*c0.01h0.01V\u001B*c0P")); + } + +} diff --git a/src/test/java/org/apache/fop/render/pcl/PCLRendererConfBuilder.java b/src/test/java/org/apache/fop/render/pcl/PCLRendererConfBuilder.java new file mode 100644 index 000000000..1265526a4 --- /dev/null +++ b/src/test/java/org/apache/fop/render/pcl/PCLRendererConfBuilder.java @@ -0,0 +1,59 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.pcl; + + +import org.apache.fop.apps.FopConfBuilder.RendererConfBuilder; +import org.apache.fop.apps.MimeConstants; + +import static org.apache.fop.render.pcl.Java2DRendererOption.DISABLE_PJL; +import static org.apache.fop.render.pcl.Java2DRendererOption.RENDERING_MODE; +import static org.apache.fop.render.pcl.Java2DRendererOption.TEXT_RENDERING; +/** + * A config builder specific to a particular renderer for specific MIME type. + */ +public final class PCLRendererConfBuilder extends RendererConfBuilder { + + public PCLRendererConfBuilder() { + super(MimeConstants.MIME_PCL); + } + + public PCLRendererConfBuilder setRenderingMode(PCLRenderingMode mode) { + return setRenderingMode(mode.getName()); + } + + public PCLRendererConfBuilder setRenderingMode(String value) { + return createTextElement(RENDERING_MODE, value); + } + + public PCLRendererConfBuilder setTextRendering(String value) { + return createTextElement(TEXT_RENDERING, value); + } + + public PCLRendererConfBuilder setDisablePjl(boolean value) { + return createTextElement(DISABLE_PJL, String.valueOf(value)); + } + + private PCLRendererConfBuilder createTextElement(Java2DRendererOption option, String value) { + createTextElement(option.getName(), value); + return this; + } + +} diff --git a/src/test/java/org/apache/fop/render/pcl/PCLRendererConfigParserTestCase.java b/src/test/java/org/apache/fop/render/pcl/PCLRendererConfigParserTestCase.java new file mode 100644 index 000000000..caf534854 --- /dev/null +++ b/src/test/java/org/apache/fop/render/pcl/PCLRendererConfigParserTestCase.java @@ -0,0 +1,78 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.pcl; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +import org.apache.fop.apps.AbstractRendererConfigParserTester; +import org.apache.fop.apps.FOPException; +import org.apache.fop.apps.MimeConstants; +import org.apache.fop.render.pcl.PCLRendererConfig.PCLRendererConfigParser; + +public class PCLRendererConfigParserTestCase + extends AbstractRendererConfigParserTester<PCLRendererConfBuilder, PCLRendererConfig> { + + public PCLRendererConfigParserTestCase() { + super(new PCLRendererConfigParser(), PCLRendererConfBuilder.class); + } + + @Test + public void testGetMimeType() throws Exception { + assertEquals(MimeConstants.MIME_PCL, new PCLRendererConfigParser().getMimeType()); + } + + @Test + public void testRenderingMode() throws Exception { + parseConfig(); + assertEquals(null, conf.getRenderingMode()); + parseConfig(createRenderer().setRenderingMode(PCLRenderingMode.QUALITY)); + assertEquals(PCLRenderingMode.QUALITY, conf.getRenderingMode()); + } + + @Test(expected = FOPException.class) + public void testRenderingModeException() throws Exception { + parseConfig(createRenderer().setRenderingMode("whatever")); + } + + @Test + public void testTextRendering() throws Exception { + parseConfig(); + assertEquals(false, conf.isTextRendering()); + parseConfig(createRenderer().setTextRendering("auto")); + assertEquals(false, conf.isTextRendering()); + parseConfig(createRenderer().setTextRendering("bitmap")); + assertEquals(true, conf.isTextRendering()); + } + + @Test(expected = FOPException.class) + public void testTextRenderingException() throws Exception { + parseConfig(createRenderer().setTextRendering("whatever")); + } + + @Test + public void testDisablePJL() throws Exception { + parseConfig(); + assertEquals(false, conf.isDisablePjl()); + parseConfig(createRenderer().setDisablePjl(true)); + assertEquals(true, conf.isDisablePjl()); + } +} diff --git a/src/test/java/org/apache/fop/render/pcl/PCLRendererConfiguratorTestCase.java b/src/test/java/org/apache/fop/render/pcl/PCLRendererConfiguratorTestCase.java new file mode 100644 index 000000000..fc7175ad6 --- /dev/null +++ b/src/test/java/org/apache/fop/render/pcl/PCLRendererConfiguratorTestCase.java @@ -0,0 +1,102 @@ +/* + * 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.fop.render.pcl; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.when; + +import org.apache.fop.apps.AbstractRendererConfiguratorTest; +import org.apache.fop.apps.FOPException; +import org.apache.fop.apps.MimeConstants; +import org.apache.fop.render.pcl.PCLRendererConfig.PCLRendererConfigParser; + +public class PCLRendererConfiguratorTestCase extends + AbstractRendererConfiguratorTest<PCLRendererConfigurator, PCLRendererConfBuilder> { + + private PCLRenderingUtil pclUtil; + + public PCLRendererConfiguratorTestCase() { + super(MimeConstants.MIME_PCL, PCLRendererConfBuilder.class, PCLDocumentHandler.class); + } + + @Override + public PCLRendererConfigurator createConfigurator() { + return new PCLRendererConfigurator(userAgent, new PCLRendererConfigParser()); + } + + @Override + public void setUpDocumentHandler() { + pclUtil = new PCLRenderingUtil(userAgent); + when(((PCLDocumentHandler) docHandler).getPCLUtil()).thenReturn(pclUtil); + } + + @Test + public void testSetRenderingMode() throws Exception { + parseConfig(createBuilder().setRenderingMode("bitmap")); + assertEquals(PCLRenderingMode.BITMAP, pclUtil.getRenderingMode()); + + parseConfig(createBuilder().setRenderingMode("quality")); + assertEquals(PCLRenderingMode.QUALITY, pclUtil.getRenderingMode()); + + parseConfig(createBuilder().setRenderingMode("speed")); + assertEquals(PCLRenderingMode.SPEED, pclUtil.getRenderingMode()); + + parseConfig(createBuilder()); + assertEquals(PCLRenderingMode.SPEED, pclUtil.getRenderingMode()); + } + + @Test(expected = FOPException.class) + public void testRenderingModeFailureCase() throws Exception { + parseConfig(createBuilder().setRenderingMode("fail")); + assertEquals(PCLRenderingMode.SPEED, pclUtil.getRenderingMode()); + } + + @Test + public void testPJLDisabled() throws Exception { + parseConfig(createBuilder().setDisablePjl(true)); + assertTrue(pclUtil.isPJLDisabled()); + + parseConfig(createBuilder().setDisablePjl(false)); + assertFalse(pclUtil.isPJLDisabled()); + + parseConfig(createBuilder()); + assertFalse(pclUtil.isPJLDisabled()); + } + + @Test + public void testSetAllTextAsBitmaps() throws Exception { + parseConfig(createBuilder().setTextRendering("bitmap")); + assertTrue(pclUtil.isAllTextAsBitmaps()); + + parseConfig(createBuilder().setTextRendering("auto")); + assertFalse(pclUtil.isAllTextAsBitmaps()); + + parseConfig(createBuilder()); + assertFalse(pclUtil.isAllTextAsBitmaps()); + } + + @Test(expected = FOPException.class) + public void testSetAllTextAsBitmapsFailureCase() throws Exception { + parseConfig(createBuilder().setTextRendering("fail")); + assertFalse(pclUtil.isAllTextAsBitmaps()); + } +} diff --git a/src/test/java/org/apache/fop/render/pcl/fonts/MockPCLTTFFontReader.java b/src/test/java/org/apache/fop/render/pcl/fonts/MockPCLTTFFontReader.java new file mode 100644 index 000000000..a155dd43d --- /dev/null +++ b/src/test/java/org/apache/fop/render/pcl/fonts/MockPCLTTFFontReader.java @@ -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. + */ + +/* $Id$ */ +package org.apache.fop.render.pcl.fonts; + +import java.io.IOException; + +import org.apache.fop.fonts.CustomFont; +import org.apache.fop.fonts.Typeface; +import org.apache.fop.fonts.truetype.FontFileReader; +import org.apache.fop.fonts.truetype.TTFFile; +import org.apache.fop.render.java2d.CustomFontMetricsMapper; +import org.apache.fop.render.pcl.fonts.truetype.PCLTTFFontReader; + +public class MockPCLTTFFontReader extends PCLTTFFontReader { + + public MockPCLTTFFontReader(Typeface font, PCLByteWriterUtil pclByteWriter) throws IOException { + super(font, pclByteWriter); + } + + @Override + protected void loadFont() throws IOException { + if (typeface instanceof CustomFontMetricsMapper) { + CustomFontMetricsMapper fontMetrics = (CustomFontMetricsMapper) typeface; + CustomFont customFont = (CustomFont) fontMetrics.getRealFont(); + fontStream = customFont.getInputStream(); + reader = new FontFileReader(fontStream); + + ttfFont = new TTFFile(); + ttfFont.readFont(reader, customFont.getFullName()); + readFontTables(); + } else { + // TODO - Handle when typeface is not in the expected format for a PCL TrueType object + } + } +} diff --git a/src/test/java/org/apache/fop/render/pcl/fonts/PCLByteWriterUtilTestCase.java b/src/test/java/org/apache/fop/render/pcl/fonts/PCLByteWriterUtilTestCase.java new file mode 100644 index 000000000..a21f204bf --- /dev/null +++ b/src/test/java/org/apache/fop/render/pcl/fonts/PCLByteWriterUtilTestCase.java @@ -0,0 +1,74 @@ +/* + * 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. + */ + +/* $Id$ */ +package org.apache.fop.render.pcl.fonts; + +import java.io.IOException; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertArrayEquals; + +public class PCLByteWriterUtilTestCase { + private PCLByteWriterUtil byteWriter; + + @Before + public void setUp() { + byteWriter = new PCLByteWriterUtil(); + } + + @Test + public void testWriteMethods() throws IOException { + byte[] output = byteWriter.writeCommand("(s4X"); + // 27 = PCL escape character with rest in ASCII format + byte[] command = {27, 40, 115, 52, 88}; + assertArrayEquals(command, output); + + byte[] resultB = byteWriter.unsignedLongInt(102494); + byte[] compareB = {0, 1, -112, 94}; + assertArrayEquals(compareB, resultB); + + byte[] resultC = byteWriter.unsignedInt(1024); + byte[] compareC = {4, 0}; + assertArrayEquals(compareC, resultC); + } + + @Test + public void testUtilMethods() throws IOException { + byte[] anArray = {1, 2, 3, 4, 5, 9, 10}; + byte[] insertArray = {6, 7, 8}; + byte[] result = byteWriter.insertIntoArray(5, anArray, insertArray); + byte[] compareA = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; + assertArrayEquals(compareA, result); + + byte[] reverse = {10, 9, 8, 7, 6}; + byteWriter.updateDataAtLocation(compareA, reverse, 5); + byte[] compareB = {1, 2, 3, 4, 5, 10, 9, 8, 7, 6}; + assertArrayEquals(compareB, compareA); + + byte[] anArrayC = {1, 2, 3, 4, 5}; + byte[] resultC = byteWriter.padBytes(anArrayC, 10); + byte[] compareC = {1, 2, 3, 4, 5, 0, 0, 0, 0, 0}; + assertArrayEquals(compareC, resultC); + + byte[] resultD = byteWriter.padBytes(anArrayC, 10, 1); + byte[] compareD = {1, 2, 3, 4, 5, 1, 1, 1, 1, 1}; + assertArrayEquals(compareD, resultD); + } +} diff --git a/src/test/java/org/apache/fop/render/pcl/fonts/PCLFontReaderFactoryTestCase.java b/src/test/java/org/apache/fop/render/pcl/fonts/PCLFontReaderFactoryTestCase.java new file mode 100644 index 000000000..2860afbdf --- /dev/null +++ b/src/test/java/org/apache/fop/render/pcl/fonts/PCLFontReaderFactoryTestCase.java @@ -0,0 +1,52 @@ +/* + * 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. + */ + +/* $Id$ */ +package org.apache.fop.render.pcl.fonts; + +import java.io.File; +import java.io.FileInputStream; +import java.net.URI; + +import org.junit.Test; + +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import org.apache.fop.fonts.CustomFont; +import org.apache.fop.fonts.FontType; +import org.apache.fop.render.java2d.CustomFontMetricsMapper; +import org.apache.fop.render.pcl.fonts.truetype.PCLTTFFontReader; + +public class PCLFontReaderFactoryTestCase { + private static final String TEST_FONT_TTF = "./test/resources/fonts/ttf/DejaVuLGCSerif.ttf"; + + @Test + public void verifyTypeIdentification() throws Exception { + CustomFont sbFont = mock(CustomFont.class); + when(sbFont.getInputStream()).thenReturn(new FileInputStream(new File(TEST_FONT_TTF))); + when(sbFont.getEmbedFileURI()).thenReturn(new URI(TEST_FONT_TTF)); + CustomFontMetricsMapper customFont = new CustomFontMetricsMapper(sbFont); + when(customFont.getFontType()).thenReturn(FontType.TRUETYPE); + // Have to mock the input stream twice otherwise get a Stream is closed exception + when(((CustomFont) customFont.getRealFont()).getInputStream()).thenReturn( + new FileInputStream(new File(TEST_FONT_TTF))); + PCLFontReaderFactory fontReaderFactory = PCLFontReaderFactory.getInstance(null); + assertTrue(fontReaderFactory.createInstance(customFont) instanceof PCLTTFFontReader); + } +} diff --git a/src/test/java/org/apache/fop/render/pcl/fonts/PCLTTFFontReaderTestCase.java b/src/test/java/org/apache/fop/render/pcl/fonts/PCLTTFFontReaderTestCase.java new file mode 100644 index 000000000..5673efbb4 --- /dev/null +++ b/src/test/java/org/apache/fop/render/pcl/fonts/PCLTTFFontReaderTestCase.java @@ -0,0 +1,198 @@ +/* + * 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. + */ + +/* $Id$ */ +package org.apache.fop.render.pcl.fonts; + +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import org.apache.fop.fonts.CustomFont; +import org.apache.fop.fonts.SingleByteFont; +import org.apache.fop.render.java2d.CustomFontMetricsMapper; +import org.apache.fop.render.pcl.fonts.PCLFontSegment.SegmentID; +import org.apache.fop.render.pcl.fonts.truetype.PCLTTFFontReader; + +public class PCLTTFFontReaderTestCase { + + private CustomFontMetricsMapper customFont = mock(CustomFontMetricsMapper.class); + private PCLByteWriterUtil byteWriter; + private static final String TEST_FONT_A = "./test/resources/fonts/ttf/DejaVuLGCSerif.ttf"; + + @Before + public void setUp() { + byteWriter = new PCLByteWriterUtil(); + } + + @Test + public void verifyFontAData() throws Exception { + CustomFont sbFont = mock(CustomFont.class); + when(sbFont.getInputStream()).thenReturn(new FileInputStream(new File(TEST_FONT_A))); + when(customFont.getRealFont()).thenReturn(sbFont); + SingleByteFont font = mock(SingleByteFont.class); + when(font.getGIDFromChar('h')).thenReturn(104); + when(font.getGIDFromChar('e')).thenReturn(101); + when(font.getGIDFromChar('l')).thenReturn(108); + when(font.getGIDFromChar('o')).thenReturn(111); + PCLTTFFontReader reader = new MockPCLTTFFontReader(customFont, byteWriter); + reader.setFont(font); + verifyFontData(reader); + validateOffsets(reader); + validateFontSegments(reader); + } + + /** + * Compares the input font data against a sample of the data read and calculated by the reader. The assertions are + * made against data taken from the TrueType Font Analyzer tool. + * @param reader The reader + */ + private void verifyFontData(PCLTTFFontReader reader) { + assertEquals(reader.getCellWidth(), 5015); // Bounding box X2 - X1 + assertEquals(reader.getCellHeight(), 3254); // Bounding box Y2 - Y1 + assertEquals(reader.getCapHeight(), 0); // OS2Table.capHeight + assertEquals(reader.getFontName(), "DejaVu LGC Serif"); // Full name read by TTFFont object + assertEquals(reader.getFirstCode(), 32); // Always 32 for bound font + assertEquals(reader.getLastCode(), 255); // Always 255 for bound font + + // Values that require conversion tables (See PCLTTFFontReader.java) + assertEquals(reader.getStrokeWeight(), 0); // Weight Class 400 (regular) should be equivalent 0 + assertEquals(reader.getSerifStyle(), 128); // Serif Style 0 should equal 0 + assertEquals(reader.getWidthType(), 0); // Width Class 5 (regular) should be equivalent 0 + } + + private void validateOffsets(PCLTTFFontReader reader) throws IOException { + // Offsets are stored with their character ID with the array [offset, length] + Map<Integer, int[]> offsets = reader.getCharacterOffsets(); + + // Test data + int[] charC = {27644, 144}; // Char index = 99 + int[] charDollar = {16044, 264}; // Char index = 36 + int[] charOne = {17808, 176}; // Char index = 49 + int[] charUpperD = {21236, 148}; // Char index = 68 + int[] charUpperJ = {22140, 176}; // Char index = 74 + + assertArrayEquals(offsets.get(99), charC); + assertArrayEquals(offsets.get(36), charDollar); + assertArrayEquals(offsets.get(49), charOne); + assertArrayEquals(offsets.get(68), charUpperD); + assertArrayEquals(offsets.get(74), charUpperJ); + } + + /** + * Verifies the font segment data copied originally from the TrueType font. Data was verified using TrueType Font + * Analyzer and PCLParaphernalia tool. + * @param reader The reader + * @throws IOException + */ + private void validateFontSegments(PCLTTFFontReader reader) throws IOException { + HashMap<Character, Integer> mappedChars = new HashMap<Character, Integer>(); + mappedChars.put('H', 1); + mappedChars.put('e', 1); + mappedChars.put('l', 1); + mappedChars.put('o', 1); + + List<PCLFontSegment> segments = reader.getFontSegments(mappedChars); + assertEquals(segments.size(), 5); + for (PCLFontSegment segment : segments) { + if (segment.getIdentifier() == SegmentID.PA) { + // Panose + assertEquals(segment.getData().length, 10); + byte[] panose = {2, 6, 6, 3, 5, 6, 5, 2, 2, 4}; + assertArrayEquals(segment.getData(), panose); + } else if (segment.getIdentifier() == SegmentID.GT) { + verifyGlobalTrueTypeData(segment, mappedChars.size()); + } else if (segment.getIdentifier() == SegmentID.NULL) { + // Terminating segment + assertEquals(segment.getData().length, 0); + } + } + } + + private void verifyGlobalTrueTypeData(PCLFontSegment segment, int mappedCharsSize) + throws IOException { + byte[] ttfData = segment.getData(); + int currentPos = 0; + //Version + assertEquals(readInt(new byte[]{ttfData[currentPos++], ttfData[currentPos++]}), 1); + assertEquals(readInt(new byte[]{ttfData[currentPos++], ttfData[currentPos++]}), 0); + //Number of tables + int numTables = readInt(new byte[]{ttfData[currentPos++], ttfData[currentPos++]}); + assertEquals(numTables, 8); + //Search range + assertEquals(readInt(new byte[]{ttfData[currentPos++], ttfData[currentPos++]}), 128); + //Entry Selector + assertEquals(readInt(new byte[]{ttfData[currentPos++], ttfData[currentPos++]}), 3); + //Range shift + assertEquals(readInt(new byte[]{ttfData[currentPos++], ttfData[currentPos++]}), 0); + String[] validTags = {"head", "hhea", "hmtx", "maxp", "gdir"}; + int matches = 0; + for (int i = 0; i < numTables; i++) { + String tag = readTag(new byte[]{ttfData[currentPos++], ttfData[currentPos++], + ttfData[currentPos++], ttfData[currentPos++]}); + if (Arrays.asList(validTags).contains(tag)) { + matches++; + } + if (tag.equals("hmtx")) { + currentPos += 4; + int offset = readLong(new byte[]{ttfData[currentPos++], ttfData[currentPos++], + ttfData[currentPos++], ttfData[currentPos++]}); + int length = readLong(new byte[]{ttfData[currentPos++], ttfData[currentPos++], + ttfData[currentPos++], ttfData[currentPos++]}); + verifyHmtx(ttfData, offset, length, mappedCharsSize); + } else { + currentPos += 12; + } + } + assertEquals(matches, 5); + } + + private void verifyHmtx(byte[] ttfData, int offset, int length, int mappedCharsSize) + throws IOException { + ByteArrayInputStream bais = new ByteArrayInputStream(ttfData); + byte[] subsetHmtx = new byte[length]; + bais.skip(offset); + bais.read(subsetHmtx); + assertEquals(subsetHmtx.length, (mappedCharsSize + 32) * 4); + } + + private int readInt(byte[] bytes) { + return ((0xFF & bytes[0]) << 8) | (0xFF & bytes[1]); + } + + private int readLong(byte[] bytes) { + return ((0xFF & bytes[0]) << 24) | ((0xFF & bytes[1]) << 16) | ((0xFF & bytes[2]) << 8) + | (0xFF & bytes[3]); + } + + private String readTag(byte[] tag) { + return new String(tag); + } +} diff --git a/src/test/java/org/apache/fop/render/pcl/fonts/truetype/PCLTTFCharacterWriterTestCase.java b/src/test/java/org/apache/fop/render/pcl/fonts/truetype/PCLTTFCharacterWriterTestCase.java new file mode 100644 index 000000000..04849db87 --- /dev/null +++ b/src/test/java/org/apache/fop/render/pcl/fonts/truetype/PCLTTFCharacterWriterTestCase.java @@ -0,0 +1,76 @@ +/* + * 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. + */ + +/* $Id$ */ +package org.apache.fop.render.pcl.fonts.truetype; + +import java.io.File; +import java.io.FileInputStream; + +import org.junit.Test; + +import static org.junit.Assert.assertArrayEquals; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import org.apache.fop.fonts.CustomFont; +import org.apache.fop.fonts.truetype.FontFileReader; +import org.apache.fop.fonts.truetype.OFFontLoader; +import org.apache.fop.fonts.truetype.TTFFile; +import org.apache.fop.render.java2d.CustomFontMetricsMapper; +import org.apache.fop.render.pcl.fonts.PCLByteWriterUtil; +import org.apache.fop.render.pcl.fonts.PCLSoftFont; + +public class PCLTTFCharacterWriterTestCase { + + private PCLTTFCharacterWriter characterWriter; + private PCLSoftFont softFont; + private CustomFontMetricsMapper customFont = mock(CustomFontMetricsMapper.class); + private static final String TEST_FONT_A = "./test/resources/fonts/ttf/DejaVuLGCSerif.ttf"; + + @Test + public void verifyCharacterDefinition() throws Exception { + CustomFont sbFont = mock(CustomFont.class); + when(customFont.getRealFont()).thenReturn(sbFont); + softFont = new PCLSoftFont(1, customFont, false); + TTFFile openFont = new TTFFile(); + FontFileReader reader = new FontFileReader(new FileInputStream(new File(TEST_FONT_A))); + String header = OFFontLoader.readHeader(reader); + openFont.readFont(reader, header); + softFont.setOpenFont(openFont); + softFont.setReader(reader); + + characterWriter = new PCLTTFCharacterWriter(softFont); + byte[] charDefinition = characterWriter.writeCharacterDefinitions("f"); + PCLByteWriterUtil pclByteWriter = new PCLByteWriterUtil(); + // Character command + byte[] command = pclByteWriter.writeCommand(String.format("*c%dE", 32)); + assertArrayEquals(getBytes(charDefinition, 0, 6), command); + // Character definition command + byte[] charDefCommand = pclByteWriter.writeCommand(String.format("(s%dW", 210)); + assertArrayEquals(getBytes(charDefinition, 6, 7), charDefCommand); + } + + private byte[] getBytes(byte[] byteArray, int offset, int length) { + byte[] result = new byte[length]; + int count = 0; + for (int i = offset; i < offset + length; i++) { + result[count++] = byteArray[i]; + } + return result; + } +} diff --git a/src/test/java/org/apache/fop/render/pdf/BasePDFTest.java b/src/test/java/org/apache/fop/render/pdf/BasePDFTest.java new file mode 100644 index 000000000..ec536aa32 --- /dev/null +++ b/src/test/java/org/apache/fop/render/pdf/BasePDFTest.java @@ -0,0 +1,111 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.pdf; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; + +import javax.xml.transform.Source; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.sax.SAXResult; +import javax.xml.transform.stream.StreamSource; + +import org.xml.sax.SAXException; + +import org.apache.commons.io.FileUtils; +import org.apache.commons.io.output.ByteArrayOutputStream; + +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.apps.Fop; +import org.apache.fop.apps.FopConfParser; +import org.apache.fop.apps.FopFactory; +import org.apache.fop.apps.MimeConstants; + +/** + * Base class for automated tests that create PDF files + */ +public class BasePDFTest { + + /** the FopFactory */ + protected final FopFactory fopFactory; + + /** the JAXP TransformerFactory */ + protected final TransformerFactory tFactory = TransformerFactory.newInstance(); + + public BasePDFTest(String fopConf) throws SAXException, IOException { + fopFactory = FopFactory.newInstance(new File(fopConf)); + } + + public BasePDFTest(InputStream confStream) throws SAXException, IOException { + fopFactory = new FopConfParser(confStream, new File(".").toURI()).getFopFactoryBuilder() + .build(); + } + + /** + * Convert a test FO file to PDF + * @param foFile the FO file + * @param ua the preconfigured user agent + * @param dumpPdfFile if true, dumps the generated PDF file to a file name (foFile).pdf + * @return the generated PDF data + * @throws Exception if the conversion fails + */ + protected byte[] convertFO(File foFile, FOUserAgent ua, boolean dumpPdfFile) + throws Exception { + ByteArrayOutputStream baout = new ByteArrayOutputStream(); + Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, ua, baout); + Transformer transformer = tFactory.newTransformer(); + Source src = new StreamSource(foFile); + SAXResult res = new SAXResult(fop.getDefaultHandler()); + try { + transformer.transform(src, res); + final byte[] result = baout.toByteArray(); + if (dumpPdfFile) { + final File outFile = new File(foFile.getParentFile(), foFile.getName() + ".pdf"); + FileUtils.writeByteArrayToFile(outFile, result); + } + return result; + } catch (TransformerException e) { + throw extractOriginalException(e); + } + } + + private static Exception extractOriginalException(Exception e) { + if (e.getCause() != null) { + return extractOriginalException((Exception)e.getCause()); + } else if (e instanceof SAXException) { + SAXException se = (SAXException)e; + if (se.getException() != null) { + return extractOriginalException(se.getException()); + } + } + return e; + } + + /** + * get FOP config File + * @return user config file to be used for testing + */ + protected static String getDefaultConfFile() { + return "test/test.xconf"; + } +} diff --git a/src/test/java/org/apache/fop/render/pdf/ImageRawPNGAdapterTestCase.java b/src/test/java/org/apache/fop/render/pdf/ImageRawPNGAdapterTestCase.java new file mode 100644 index 000000000..9577e2e01 --- /dev/null +++ b/src/test/java/org/apache/fop/render/pdf/ImageRawPNGAdapterTestCase.java @@ -0,0 +1,203 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.pdf; + +import java.awt.color.ColorSpace; +import java.awt.color.ICC_Profile; +import java.awt.image.ComponentColorModel; +import java.awt.image.IndexColorModel; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; + +import org.junit.Test; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import org.apache.xmlgraphics.image.loader.ImageSize; +import org.apache.xmlgraphics.image.loader.impl.ImageRawPNG; +import org.apache.xmlgraphics.java2d.color.profile.ColorProfileUtil; + +import org.apache.fop.pdf.FlateFilter; +import org.apache.fop.pdf.PDFAMode; +import org.apache.fop.pdf.PDFDictionary; +import org.apache.fop.pdf.PDFDocument; +import org.apache.fop.pdf.PDFICCBasedColorSpace; +import org.apache.fop.pdf.PDFICCStream; +import org.apache.fop.pdf.PDFName; +import org.apache.fop.pdf.PDFProfile; +import org.apache.fop.pdf.PDFResources; +import org.apache.fop.render.RawPNGTestUtil; + +public class ImageRawPNGAdapterTestCase { + + @Test + public void testSetupWithIndexColorModel() { + IndexColorModel cm = mock(IndexColorModel.class); + ImageRawPNG irpng = mock(ImageRawPNG.class); + PDFDocument doc = mock(PDFDocument.class); + PDFProfile profile = mock(PDFProfile.class); + ImageRawPNGAdapter irpnga = new ImageRawPNGAdapter(irpng, "mock"); + ImageSize is = RawPNGTestUtil.getImageSize(); + + when(irpng.getColorModel()).thenReturn(cm); + when(irpng.getRenderingIntent()).thenReturn(-1); + // when(cm.hasAlpha()).thenReturn(false); + when(doc.getProfile()).thenReturn(profile); + when(profile.getPDFAMode()).thenReturn(PDFAMode.PDFA_1A); + when(irpng.getSize()).thenReturn(is); + irpnga.setup(doc); + FlateFilter filter = (FlateFilter) irpnga.getPDFFilter(); + assertEquals(1, filter.getColors()); + } + + @Test + public void testSetupWithComponentColorModel() throws IOException { + ComponentColorModel cm = mock(ComponentColorModel.class); + ImageRawPNG irpng = mock(ImageRawPNG.class); + PDFDocument doc = mock(PDFDocument.class); + PDFProfile profile = mock(PDFProfile.class); + ImageRawPNGAdapter irpnga = new ImageRawPNGAdapter(irpng, "mock"); + ImageSize is = RawPNGTestUtil.getImageSize(); + + when(irpng.getColorModel()).thenReturn(cm); + when(irpng.getRenderingIntent()).thenReturn(-1); + when(cm.getNumComponents()).thenReturn(3); + // when(cm.hasAlpha()).thenReturn(false); + when(doc.getProfile()).thenReturn(profile); + when(profile.getPDFAMode()).thenReturn(PDFAMode.PDFA_1A); + when(irpng.getSize()).thenReturn(is); + irpnga.setup(doc); + FlateFilter filter = (FlateFilter) irpnga.getPDFFilter(); + assertEquals(3, filter.getColors()); + } + + @Test + public void testOutputContentsWithRGBPNG() throws IOException { + testOutputContentsWithGRGBAPNG(-1, 128, 128, 128, -1); + } + + @Test + public void testOutputContentsWithRGBAPNG() throws IOException { + testOutputContentsWithGRGBAPNG(-1, 128, 128, 128, 128); + } + + @Test + public void testOutputContentsWithGPNG() throws IOException { + testOutputContentsWithGRGBAPNG(128, -1, -1, -1, -1); + } + + @Test + public void testOutputContentsWithGAPNG() throws IOException { + testOutputContentsWithGRGBAPNG(128, -1, -1, -1, 128); + } + + private void testOutputContentsWithGRGBAPNG(int gray, int red, int green, int blue, int alpha) + throws IOException { + int numColorComponents = gray > -1 ? 1 : 3; + int numComponents = numColorComponents + (alpha > -1 ? 1 : 0); + ComponentColorModel cm = mock(ComponentColorModel.class); + ImageRawPNG irpng = mock(ImageRawPNG.class); + PDFDocument doc = mock(PDFDocument.class); + PDFProfile profile = mock(PDFProfile.class); + ImageRawPNGAdapter irpnga = new ImageRawPNGAdapter(irpng, "mock"); + ImageSize is = RawPNGTestUtil.getImageSize(); + + when(irpng.getColorModel()).thenReturn(cm); + when(irpng.getRenderingIntent()).thenReturn(-1); + when(cm.getNumComponents()).thenReturn(numComponents); + // when(cm.hasAlpha()).thenReturn(false); + when(doc.getProfile()).thenReturn(profile); + when(profile.getPDFAMode()).thenReturn(PDFAMode.PDFA_1A); + when(irpng.getSize()).thenReturn(is); + irpnga.setup(doc); + FlateFilter filter = (FlateFilter) irpnga.getPDFFilter(); + assertEquals(numColorComponents, filter.getColors()); + + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + byte[] data = RawPNGTestUtil.buildGRGBAData(gray, red, green, blue, alpha); + ByteArrayInputStream bais = new ByteArrayInputStream(data); + when(irpng.createInputStream()).thenReturn(bais); + irpnga.outputContents(baos); + if (alpha > -1) { + byte[] expected = RawPNGTestUtil.buildGRGBAData(gray, red, green, blue, -1); + assertArrayEquals(expected, baos.toByteArray()); + } else { + assertArrayEquals(data, baos.toByteArray()); + } + } + + @Test + public void testPopulateXObjectDictionaryWithComponentColorModelAndsRGB() { + ComponentColorModel cm = mock(ComponentColorModel.class); + ImageRawPNG irpng = mock(ImageRawPNG.class); + PDFDictionary pdfDic = mock(PDFDictionary.class); + ImageRawPNGAdapter irpnga = new ImageRawPNGAdapter(irpng, "mock"); + + when(irpng.getColorModel()).thenReturn(cm); + when(irpng.getRenderingIntent()).thenReturn(0); + irpnga.populateXObjectDictionary(pdfDic); + verify(pdfDic).put("Intent", new PDFName("Perceptual")); + when(irpng.getRenderingIntent()).thenReturn(1); + irpnga.populateXObjectDictionary(pdfDic); + verify(pdfDic).put("Intent", new PDFName("RelativeColorimetric")); + when(irpng.getRenderingIntent()).thenReturn(2); + irpnga.populateXObjectDictionary(pdfDic); + verify(pdfDic).put("Intent", new PDFName("Saturation")); + when(irpng.getRenderingIntent()).thenReturn(3); + irpnga.populateXObjectDictionary(pdfDic); + verify(pdfDic).put("Intent", new PDFName("AbsoluteColorimetric")); + } + + @Test + public void testRenderingIntentImpliessRGBColorProfile() { + ComponentColorModel cm = mock(ComponentColorModel.class); + ImageRawPNG irpng = mock(ImageRawPNG.class); + PDFDocument doc = mock(PDFDocument.class); + PDFProfile profile = mock(PDFProfile.class); + PDFResources resources = mock(PDFResources.class); + PDFICCBasedColorSpace cs = mock(PDFICCBasedColorSpace.class); + PDFICCStream stream = mock(PDFICCStream.class); + ICC_Profile iccprof = ICC_Profile.getInstance(ColorSpace.CS_sRGB); + ImageRawPNGAdapter irpnga = new ImageRawPNGAdapter(irpng, "mock"); + ImageSize is = RawPNGTestUtil.getImageSize(); + + when(irpng.getColorModel()).thenReturn(cm); + when(irpng.getRenderingIntent()).thenReturn(0); + when(cm.getNumComponents()).thenReturn(3); + // when(cm.hasAlpha()).thenReturn(false); + when(doc.getProfile()).thenReturn(profile); + when(doc.getResources()).thenReturn(resources); + when(resources.getICCColorSpaceByProfileName("sRGB")).thenReturn(cs); + when(profile.getPDFAMode()).thenReturn(PDFAMode.PDFA_1A); + when(irpng.getSize()).thenReturn(is); + when(cs.getICCStream()).thenReturn(stream); + when(stream.getICCProfile()).thenReturn(iccprof); + + irpnga.setup(doc); + PDFICCStream iccStream = irpnga.getICCStream(); + assertTrue(ColorProfileUtil.isDefaultsRGB(iccStream.getICCProfile())); + } +} diff --git a/src/test/java/org/apache/fop/render/pdf/PDFAConformanceTestCase.java b/src/test/java/org/apache/fop/render/pdf/PDFAConformanceTestCase.java new file mode 100644 index 000000000..752d666c5 --- /dev/null +++ b/src/test/java/org/apache/fop/render/pdf/PDFAConformanceTestCase.java @@ -0,0 +1,143 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.pdf; + +import java.io.File; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; +import org.xml.sax.SAXException; + +import static org.junit.Assert.fail; + +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.events.EventChecker; +import org.apache.fop.pdf.PDFAMode; +import org.apache.fop.pdf.PDFConformanceException; +import org.apache.fop.svg.SVGEventProducer; + +/** + * Tests PDF/A-1 functionality. + */ +public class PDFAConformanceTestCase extends BasePDFTest { + + public PDFAConformanceTestCase() throws SAXException, IOException { + super(getDefaultConfFile()); + } + + private File foBaseDir = new File("test/xml/pdf-a"); + private boolean dumpPDF = Boolean.getBoolean("PDFAConformanceTestCase.dumpPDF"); + + + /** create an FOUserAgent for our tests + * @return an initialized FOUserAgent + * */ + protected FOUserAgent getUserAgent() { + final FOUserAgent userAgent = fopFactory.newFOUserAgent(); + userAgent.getRendererOptions().put("pdf-a-mode", "PDF/A-1b"); + return userAgent; + } + + /** + * Test exception when PDF/A-1 is enabled and everything is as it should. + * @throws Exception if the test fails + */ + @Test + public void testAllOk() throws Exception { + File foFile = new File(foBaseDir, "minimal-pdf-a.fo"); + convertFO(foFile, getUserAgent(), dumpPDF); + } + + /** + * Test exception when PDF/A-1 is enabled together with encryption. + * @throws Exception if the test fails + */ + @Test(expected = PDFConformanceException.class) + public void testNoEncryption() throws Exception { + final FOUserAgent ua = getUserAgent(); + ua.getRendererOptions().put("owner-password", "mypassword"); //To enabled encryption + File foFile = new File(foBaseDir, "minimal-pdf-a.fo"); + convertFO(foFile, ua, dumpPDF); + } + + /** + * Test exception when PDF/A-1 is enabled and a font is used which is not embedded. + * @throws Exception if the test fails + */ + @Test + public void testFontNotEmbedded() throws Exception { + File foFile = new File(foBaseDir, "base14-font.fo"); + try { + convertFO(foFile, getUserAgent(), dumpPDF); + fail("Expected PDFConformanceException. PDF/A-1 wants all fonts embedded."); + } catch (PDFConformanceException e) { + //Good! + } + } + + /** + * Test exception when PDF/A-1 is enabled and images. + * @throws Exception if the test fails + */ + @Test + public void testImages() throws Exception { + File foFile = new File(foBaseDir, "with-rgb-images.fo"); + convertFO(foFile, getUserAgent(), dumpPDF); + + foFile = new File(foBaseDir, "with-cmyk-images.fo"); + try { + convertFO(foFile, getUserAgent(), dumpPDF); + fail("Expected PDFConformanceException." + + " PDF/A-1 does not allow mixing DeviceRGB and DeviceCMYK."); + } catch (PDFConformanceException e) { + //Good! + } + } + + @Test + public void svgTransparency() throws Exception { + FOUserAgent ua = getUserAgent(); + EventChecker eventChecker = setupEventChecker(ua, "transparencyIgnored"); + File foFile = new File(foBaseDir, "svg-transparency.fo"); + convertFO(foFile, ua, dumpPDF); + eventChecker.end(); + } + + @Test + public void svgContainingBitmapWithTransparency() throws Exception { + FOUserAgent ua = getUserAgent(); + EventChecker eventChecker = setupEventChecker(ua, "bitmapWithTransparency"); + File foFile = new File(foBaseDir, "svg-with-transparent-image.fo"); + convertFO(foFile, ua, dumpPDF); + eventChecker.end(); + } + + private EventChecker setupEventChecker(FOUserAgent ua, String expectedEvent) { + Map<String, Object> params = new HashMap<String, Object>(); + params.put("pdfProfile", PDFAMode.PDFA_1B); + EventChecker eventChecker = new EventChecker(SVGEventProducer.class.getName() + + "." + expectedEvent, params); + ua.getEventBroadcaster().addEventListener(eventChecker); + return eventChecker; + } + +} diff --git a/src/test/java/org/apache/fop/render/pdf/PDFAMetadataTestCase.java b/src/test/java/org/apache/fop/render/pdf/PDFAMetadataTestCase.java new file mode 100644 index 000000000..6ff40b3c3 --- /dev/null +++ b/src/test/java/org/apache/fop/render/pdf/PDFAMetadataTestCase.java @@ -0,0 +1,118 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.pdf; + +import java.util.Calendar; +import java.util.TimeZone; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +import org.apache.xmlgraphics.xmp.Metadata; +import org.apache.xmlgraphics.xmp.schemas.DublinCoreAdapter; +import org.apache.xmlgraphics.xmp.schemas.DublinCoreSchema; +import org.apache.xmlgraphics.xmp.schemas.XMPBasicAdapter; +import org.apache.xmlgraphics.xmp.schemas.XMPBasicSchema; +import org.apache.xmlgraphics.xmp.schemas.pdf.AdobePDFAdapter; +import org.apache.xmlgraphics.xmp.schemas.pdf.AdobePDFSchema; + +import org.apache.fop.pdf.PDFDocument; +import org.apache.fop.pdf.PDFInfo; +import org.apache.fop.pdf.PDFMetadata; + +/** + * Test case for PDF/A metadata handling. + */ +public class PDFAMetadataTestCase { + + @Test + public void testInfoUpdate() throws Exception { + Metadata meta = new Metadata(); + DublinCoreAdapter dc = DublinCoreSchema.getAdapter(meta); + dc.setTitle("MyTitle"); + dc.setDescription(null, "MySubject"); + dc.addCreator("That's me"); + + AdobePDFAdapter pdf = AdobePDFSchema.getAdapter(meta); + pdf.setKeywords("XSL-FO XML"); + pdf.setProducer("SuperFOP"); + + XMPBasicAdapter xmp = XMPBasicSchema.getAdapter(meta); + xmp.setCreatorTool("WonderFOP"); + Calendar cal1 = Calendar.getInstance(TimeZone.getTimeZone("Europe/Zurich")); + cal1.set(2007, Calendar.JUNE, 5, 21, 49, 13); + cal1.set(Calendar.MILLISECOND, 0); + xmp.setCreateDate(cal1.getTime()); + Calendar cal2 = Calendar.getInstance(TimeZone.getTimeZone("Europe/Zurich")); + cal2.set(2007, Calendar.JUNE, 6, 8, 15, 59); + cal2.set(Calendar.MILLISECOND, 0); + xmp.setModifyDate(cal2.getTime()); + + PDFInfo info = new PDFInfo(); + assertNull(info.getTitle()); + PDFMetadata.updateInfoFromMetadata(meta, info); + + assertEquals("MyTitle", info.getTitle()); + assertEquals("MySubject", info.getSubject()); + assertEquals("That's me", info.getAuthor()); + assertEquals("XSL-FO XML", info.getKeywords()); + assertEquals("SuperFOP", info.getProducer()); + assertEquals("WonderFOP", info.getCreator()); + assertEquals(cal1.getTime(), info.getCreationDate()); + assertEquals(cal2.getTime(), info.getModDate()); + } + + @Test + public void testXMPUpdate() throws Exception { + PDFDocument doc = new PDFDocument("SuperFOP"); + PDFInfo info = doc.getInfo(); + info.setTitle("MyTitle"); + info.setSubject("MySubject"); + info.setAuthor("That's me"); + info.setKeywords("XSL-FO XML"); + //info.setProducer("SuperFOP"); + info.setCreator("WonderFOP"); + Calendar cal1 = Calendar.getInstance(TimeZone.getTimeZone("Europe/Zurich")); + cal1.set(2007, Calendar.JUNE, 5, 21, 49, 13); + cal1.set(Calendar.MILLISECOND, 0); + info.setCreationDate(cal1.getTime()); + Calendar cal2 = Calendar.getInstance(TimeZone.getTimeZone("Europe/Zurich")); + cal2.set(2007, Calendar.JUNE, 6, 8, 15, 59); + cal2.set(Calendar.MILLISECOND, 0); + info.setModDate(cal2.getTime()); + + Metadata meta = PDFMetadata.createXMPFromPDFDocument(doc); + + DublinCoreAdapter dc = DublinCoreSchema.getAdapter(meta); + assertEquals("MyTitle", dc.getTitle()); + assertEquals("MySubject", dc.getDescription()); + assertEquals(1, dc.getCreators().length); + assertEquals("That's me", dc.getCreators()[0]); + AdobePDFAdapter pdf = AdobePDFSchema.getAdapter(meta); + assertEquals("XSL-FO XML", pdf.getKeywords()); + assertEquals("SuperFOP", pdf.getProducer()); + XMPBasicAdapter xmp = XMPBasicSchema.getAdapter(meta); + assertEquals("WonderFOP", xmp.getCreatorTool()); + assertEquals(cal1.getTime(), xmp.getCreateDate()); + assertEquals(cal2.getTime(), xmp.getModifyDate()); + } +} diff --git a/src/test/java/org/apache/fop/render/pdf/PDFBorderPainterTestCase.java b/src/test/java/org/apache/fop/render/pdf/PDFBorderPainterTestCase.java new file mode 100644 index 000000000..ed8156001 --- /dev/null +++ b/src/test/java/org/apache/fop/render/pdf/PDFBorderPainterTestCase.java @@ -0,0 +1,66 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.pdf; + +import java.awt.Color; +import java.io.ByteArrayOutputStream; +import java.io.OutputStream; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertTrue; + +import org.apache.fop.fo.Constants; +import org.apache.fop.pdf.PDFDocument; + +public class PDFBorderPainterTestCase { + + private PDFContentGenerator generator; + private ByteArrayOutputStream outStream; + private PDFGraphicsPainter borderPainter; + + @Before + public void setUp() { + outStream = new ByteArrayOutputStream(); + generator = new PDFContentGenerator(new PDFDocument("test"), outStream, null); + borderPainter = new PDFGraphicsPainter(generator); + } + + /** + * This test will fail if either of the below statements isn't true: + * org.apache.fop.render.intermediate.BorderPainter.DASHED_BORDER_SPACE_RATIO = 0.5f + * org.apache.fop.render.intermediate.BorderPainter.DASHED_BORDER_LENGTH_FACTOR = 2.0f. + */ + @Test + public void testDrawBorderLine() throws Exception { + borderPainter.drawBorderLine(0, 0, 40000, 1000, true, true, + Constants.EN_DASHED, Color.BLACK); + generator.flushPDFDoc(); + OutputStream outStream = new ByteArrayOutputStream(); + outStream = generator.getStream().getBufferOutputStream(); + assertTrue(((ByteArrayOutputStream) outStream).toString().contains("[7.272727 3.636364] 0 d 1 w")); + } + + public void tearDown() { + generator = null; + outStream = null; + } +} diff --git a/src/test/java/org/apache/fop/render/pdf/PDFCMapTestCase.java b/src/test/java/org/apache/fop/render/pdf/PDFCMapTestCase.java new file mode 100644 index 000000000..bb0f2f92e --- /dev/null +++ b/src/test/java/org/apache/fop/render/pdf/PDFCMapTestCase.java @@ -0,0 +1,73 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.pdf; + +import java.io.StringWriter; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +import org.apache.fop.pdf.CMapBuilder; + +/** Simple sanity test of the PDFCmap class */ +public class PDFCMapTestCase { + private static final String EOL = "\n"; + + @Test + public void testPDFCMapFillInPDF() throws Exception { + final String expected + = "%!PS-Adobe-3.0 Resource-CMap" + EOL + + "%%DocumentNeededResources: ProcSet (CIDInit)" + EOL + + "%%IncludeResource: ProcSet (CIDInit)" + EOL + + "%%BeginResource: CMap (test)" + EOL + + "%%EndComments" + EOL + + "/CIDInit /ProcSet findresource begin" + EOL + + "12 dict begin" + EOL + + "begincmap" + EOL + + "/CIDSystemInfo 3 dict dup begin" + EOL + + " /Registry (Adobe) def" + EOL + + " /Ordering (Identity) def" + EOL + + " /Supplement 0 def" + EOL + + "end def" + EOL + + "/CMapVersion 1 def" + EOL + + "/CMapType 1 def" + EOL + + "/CMapName /test def" + EOL + + "1 begincodespacerange" + EOL + + "<0000> <FFFF>" + EOL + + "endcodespacerange" + EOL + + "1 begincidrange" + EOL + + "<0000> <FFFF> 0" + EOL + + "endcidrange" + EOL + + "endcmap" + EOL + + "CMapName currentdict /CMap defineresource pop" + EOL + + "end" + EOL + + "end" + EOL + + "%%EndResource" + EOL + + "%%EOF" + EOL; + + final StringWriter w = new StringWriter(); + final CMapBuilder builder = new CMapBuilder(w, "test"); + builder.writeCMap(); + final String actual = w.getBuffer().toString(); + assertEquals("PDFCMap output matches expected PostScript code", expected, actual); + } + +} diff --git a/src/test/java/org/apache/fop/render/pdf/PDFEncodingTestCase.java b/src/test/java/org/apache/fop/render/pdf/PDFEncodingTestCase.java new file mode 100644 index 000000000..fc6212dcd --- /dev/null +++ b/src/test/java/org/apache/fop/render/pdf/PDFEncodingTestCase.java @@ -0,0 +1,149 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.pdf; + +import java.io.File; +import java.io.IOException; +import java.util.StringTokenizer; + +import org.junit.Ignore; +import org.junit.Test; +import org.xml.sax.SAXException; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import org.apache.fop.apps.FOUserAgent; + +/** Test that characters are correctly encoded in a generated PDF file */ +public class PDFEncodingTestCase extends BasePDFTest { + private File foBaseDir = new File("test/xml/pdf-encoding"); + private final boolean dumpPDF = Boolean.getBoolean("PDFEncodingTestCase.dumpPDF"); + static final String INPUT_FILE = "test/xml/pdf-encoding/pdf-encoding-test.xconf"; + static final String TEST_MARKER = "PDFE_TEST_MARK_"; + + public PDFEncodingTestCase() throws SAXException, IOException { + super(INPUT_FILE); + } + + + /** + * create an FOUserAgent for our tests + * @return an initialized FOUserAgent + */ + protected FOUserAgent getUserAgent() { + final FOUserAgent a = fopFactory.newFOUserAgent(); + return a; + } + + /** + * Test using a standard FOP font + * @throws Exception checkstyle wants a comment here, even a silly one + */ + @Test + public void testPDFEncodingWithStandardFont() throws Exception { + + /* If the PDF encoding is correct, a text dump of the generated PDF file contains this (excerpts) + * ...Tm [(PDFE_TEST_MARK_2:) ( ) (This) ( ) (is) ...(acute:) ( ) (XX_\351_XX) ] TJ + * ...Tm [(PDFE_TEST_MARK_3:) ( ) (This) ( ) (is) ...(letter:) ( ) (XX_\342\352\356\364\373_XX) ] TJ + * The following array is used to look for these patterns + */ + final String[] testPatterns = { + TEST_MARKER + "1", "Standard", + TEST_MARKER + "2", "XX_\\351_XX", + TEST_MARKER + "3", "XX_\\342\\352\\356\\364\\373_XX" + }; + + runTest("test-standard-font.fo", testPatterns); + } + + /** + * TODO test disabled for now, fails due (probably) do different PDF + * encoding when custom font is used. + * TODO This should be tested using PDFBox. If PDFBox can extract the text correctly, + * everything is fine. The tests here are too unstable. + * + * @throws Exception + * checkstyle wants a comment here, even a silly one + */ + @Ignore("This should be tested using PDFBox. If PDFBox can extract the text correctly," + + "everything is fine. The tests here are too unstable.") + @Test + public void testPDFEncodingWithCustomFont() throws Exception { + + /* If the PDF encoding is correct, a text dump of the generated PDF file contains this (excerpts) + * ...Tm [(PDFE_TEST_MARK_2:) ( ) (This) ( ) (is) ...(acute:) ( ) (XX_\351_XX) ] TJ + * ...Tm [(PDFE_TEST_MARK_3:) ( ) (This) ( ) (is) ...(letter:) ( ) (XX_\342\352\356\364\373_XX) ] TJ + * The following array is used to look for these patterns + */ + final String[] testPatterns = { + TEST_MARKER + "1", "(Gladiator)", + TEST_MARKER + "2", "XX_\\351_XX", + TEST_MARKER + "3", "XX_\\342\\352\\356\\364\\373_XX" + }; + + runTest("test-custom-font.fo", testPatterns); + } + + /** Test encoding using specified input file and test patterns array */ + private void runTest(String inputFile, String[] testPatterns) + throws Exception { + File foFile = new File(foBaseDir, inputFile); + byte[] pdfData = convertFO(foFile, getUserAgent(), dumpPDF); + checkEncoding(pdfData, testPatterns); + } + + /** + * Check character encodings in the generated PDF data, by reading text + * lines identified by markers and checking their content + * + * @throws IOException + */ + private void checkEncoding(byte[] pdf, String[] testPattern) + throws IOException { + + int markersFound = 0; + final String input = new String(pdf); + int pos = 0; + if ((pos = input.indexOf(TEST_MARKER)) >= 0) { + final StringTokenizer tk = new StringTokenizer( + input.substring(pos), "\n"); + + while (tk.hasMoreTokens()) { + final String line = tk.nextToken(); + if (line.indexOf(TEST_MARKER) >= 0) { + markersFound++; + for (int i = 0; i < testPattern.length; i += 2) { + if (line.indexOf(testPattern[i]) >= 0) { + final String ref = testPattern[i + 1]; + final boolean patternFound = line.indexOf(ref) >= 0; + assertTrue("line containing '" + testPattern[i] + + "' must contain '" + ref, patternFound); + } + } + } + } + } + + final int nMarkers = testPattern.length / 2; + assertEquals(nMarkers + " " + TEST_MARKER + " markers must be found", + nMarkers, markersFound); + } +} diff --git a/src/test/java/org/apache/fop/render/pdf/PDFGraphicsPainterTestCase.java b/src/test/java/org/apache/fop/render/pdf/PDFGraphicsPainterTestCase.java new file mode 100644 index 000000000..3130a73e7 --- /dev/null +++ b/src/test/java/org/apache/fop/render/pdf/PDFGraphicsPainterTestCase.java @@ -0,0 +1,170 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.pdf; + +import java.io.IOException; + +import org.junit.Before; +import org.junit.Test; + +import static org.mockito.Matchers.endsWith; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; + +import org.apache.fop.pdf.PDFNumber; + +public class PDFGraphicsPainterTestCase { + + private PDFGraphicsPainter sut; + + private PDFContentGenerator generator; + + @Before + public void setup() { + generator = mock(PDFContentGenerator.class); + sut = new PDFGraphicsPainter(generator); + } + + @Test + public void moveTo() { + int x = 10; + int y = 20; + sut.moveTo(x, y); + verify(generator).add(op("m", x, y)); + } + + @Test + public void lineTo() { + int x = 10; + int y = 20; + sut.lineTo(x, y); + verify(generator).add(op("l", x, y)); + } + + @Test + public void arcTo() throws IOException { + int width = 10; + int height = 10; + int x = 0; + int y = 0; + double startAngle = 0; + double endAngle = Math.PI / 2; + sut.arcTo(startAngle, endAngle, x, y, width, height); + //TODO stricter verification + verify(generator).add(endsWith(" c ")); + } + + @Test + public void closePath() { + sut.closePath(); + verify(generator).add(op("h")); + } + + @Test + public void clip() { + sut.clip(); + verify(generator).add(opln("W\nn")); + } + + @Test + public void saveGraphicsState() { + sut.saveGraphicsState(); + verify(generator).add(opln("q")); + } + + @Test + public void restoreGraphicsState() { + sut.restoreGraphicsState(); + verify(generator).add(opln("Q")); + } + + @Test + public void rotateCoordinates() throws IOException { + double angle = 0; + float s = (float) Math.sin(angle); + float c = (float) Math.cos(angle); + sut.rotateCoordinates(angle); + testTransformCoordinatesF(c, s, -s, c, 0, 0); + } + + @Test + public void translateCoordinates() throws IOException { + int x = 10; + int y = 20; + sut.translateCoordinates(x, y); + testTransformCoordinates(1000, 0, 0, 1000, x, y); + } + + @Test + public void scaleCoordinates() throws IOException { + float xScaleFactor = 10f; + float yScaleFactor = 2f; + sut.scaleCoordinates(xScaleFactor, yScaleFactor); + testTransformCoordinatesF(xScaleFactor, 0f, 0f, yScaleFactor, 0f, 0f); + } + + @Test + public void cubicBezierTo() { + int[] args = new int[]{1, 2, 3, 4, 5, 6}; + sut.cubicBezierTo(args[0], args[1], args[2], args[3], args[4], args[5]); + verify(generator).add(op("c", args)); + } + + private void testTransformCoordinatesF(float... args) { + verify(generator).add(opf("cm", args)); + } + + private void testTransformCoordinates(int... args) { + verify(generator).add(op("cm", args)); + } + + private String opf(String op, float... args) { + return opf(op, " ", args); + } + + private String op(String op, int... args) { + return op(op, " ", args); + } + + private String opln(String op, int... args) { + return op(op, "\n", args); + } + + private String opf(String op, String ending, float... args) { + StringBuilder sb = new StringBuilder(); + for (float arg : args) { + sb.append("" + PDFNumber.doubleOut(arg) + " "); + } + return sb.append(op.trim()).append(ending).toString(); + } + + private String op(String op, String ending, int... args) { + float[] formattedArgs = new float[args.length]; + for (int i = 0; i < args.length; i++) { + formattedArgs[i] = format(args[i]); + } + return opf(op, ending, formattedArgs); + } + + private float format(int i) { + return (float) i / 1000; + } + +} diff --git a/src/test/java/org/apache/fop/render/pdf/PDFPainterTestCase.java b/src/test/java/org/apache/fop/render/pdf/PDFPainterTestCase.java new file mode 100644 index 000000000..d70c00f9e --- /dev/null +++ b/src/test/java/org/apache/fop/render/pdf/PDFPainterTestCase.java @@ -0,0 +1,135 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.pdf; + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Rectangle; +import java.io.ByteArrayOutputStream; +import java.io.File; + +import javax.xml.transform.stream.StreamResult; + +import org.junit.Test; + +import static org.mockito.Matchers.endsWith; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.apps.FopFactory; +import org.apache.fop.fo.Constants; +import org.apache.fop.pdf.PDFDocument; +import org.apache.fop.pdf.PDFProfile; +import org.apache.fop.pdf.PDFStructElem; +import org.apache.fop.render.RenderingContext; +import org.apache.fop.render.intermediate.IFContext; +import org.apache.fop.render.intermediate.IFException; +import org.apache.fop.traits.BorderProps; + +import junit.framework.Assert; + +public class PDFPainterTestCase { + + private FOUserAgent foUserAgent; + private PDFContentGenerator pdfContentGenerator; + private PDFDocumentHandler pdfDocumentHandler; + private PDFPainter pdfPainter; + private PDFStructElem elem = new PDFStructElem(); + + @Test + public void testDrawBorderRect() throws Exception { + // the goal of this test is to check that the drawing of rounded corners in PDF calls + // PDFGraphicsPaiter.cubicBezierTo(); the check is done by verifying that a " c " command is written + // to the PDFContentGenerator + createPDFPainter(false); + // build rectangle 200 x 50 (points, which are converted to milipoints) + Rectangle rectangle = new Rectangle(0, 0, 200000, 50000); + // build border properties: width 4pt, radius 30pt + BorderProps border = new BorderProps(Constants.EN_SOLID, 4000, 30000, 30000, Color.BLACK, + BorderProps.Mode.SEPARATE); + pdfPainter.drawBorderRect(rectangle, border, border, border, border, Color.WHITE); + // since we cannot mock the PDFContentGenerator.format() static method we have to restrict the + // verification to commands that end with " c ". + verify(pdfContentGenerator, times(16)).add(endsWith(" c ")); + } + + private void createPDFPainter(boolean value) { + mockFOUserAgent(value); + mockPDFContentGenerator(); + mockPDFDocumentHandler(); + PDFLogicalStructureHandler handler = mock(PDFLogicalStructureHandler.class); + pdfPainter = new PDFPainter(pdfDocumentHandler, handler); + } + + private void mockFOUserAgent(boolean value) { + foUserAgent = mock(FOUserAgent.class); + when(foUserAgent.isAccessibilityEnabled()).thenReturn(value); + } + + private void mockPDFContentGenerator() { + pdfContentGenerator = mock(PDFContentGenerator.class); + } + + private void mockPDFDocumentHandler() { + pdfDocumentHandler = mock(PDFDocumentHandler.class); + when(pdfDocumentHandler.getGenerator()).thenReturn(pdfContentGenerator); + IFContext ifContext = mock(IFContext.class); + when(ifContext.getUserAgent()).thenReturn(foUserAgent); + when(pdfDocumentHandler.getContext()).thenReturn(ifContext); + when(ifContext.getStructureTreeElement()).thenReturn(elem); + } + + private PDFDocument createMockPDFDocument() { + PDFDocument pdfDoc = mock(PDFDocument.class); + when(pdfContentGenerator.getDocument()).thenReturn(pdfDoc); + when(pdfDocumentHandler.getPDFDocument()).thenReturn(pdfDoc); + when(pdfDoc.getProfile()).thenReturn(new PDFProfile(pdfDoc)); + return pdfDoc; + } + + @Test + public void testPageNumber() throws IFException { + FopFactory fopFactory = FopFactory.newInstance(new File(".").toURI()); + foUserAgent = fopFactory.newFOUserAgent(); + pdfDocumentHandler = new PDFDocumentHandler(new IFContext(foUserAgent)); + pdfDocumentHandler.setResult(new StreamResult(new ByteArrayOutputStream())); + pdfDocumentHandler.startDocument(); + pdfDocumentHandler.startPage(0, "", "", new Dimension()); + pdfDocumentHandler.getContext().setPageNumber(3); + MyPDFPainter pdfPainter = new MyPDFPainter(pdfDocumentHandler, null); + pdfPainter.drawImage("test/resources/images/cmyk.jpg", new Rectangle()); + Assert.assertEquals(pdfPainter.renderingContext.getHints().get("page-number"), 3); + } + + class MyPDFPainter extends PDFPainter { + protected RenderingContext renderingContext; + public MyPDFPainter(PDFDocumentHandler documentHandler, PDFLogicalStructureHandler logicalStructureHandler) { + super(documentHandler, logicalStructureHandler); + } + + protected RenderingContext createRenderingContext() { + renderingContext = super.createRenderingContext(); + return renderingContext; + } + } +} diff --git a/src/test/java/org/apache/fop/render/pdf/PDFRendererConfigParserTestCase.java b/src/test/java/org/apache/fop/render/pdf/PDFRendererConfigParserTestCase.java new file mode 100644 index 000000000..4dd3a6610 --- /dev/null +++ b/src/test/java/org/apache/fop/render/pdf/PDFRendererConfigParserTestCase.java @@ -0,0 +1,211 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.pdf; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.apache.fop.apps.AbstractRendererConfigParserTester; +import org.apache.fop.apps.PDFRendererConfBuilder; +import org.apache.fop.pdf.PDFAMode; +import org.apache.fop.pdf.PDFXMode; +import org.apache.fop.pdf.Version; +import org.apache.fop.render.pdf.PDFRendererConfig.PDFRendererConfigParser; + +public class PDFRendererConfigParserTestCase + extends AbstractRendererConfigParserTester<PDFRendererConfBuilder, PDFRendererConfig> { + + public PDFRendererConfigParserTestCase() { + super(new PDFRendererConfigParser(), PDFRendererConfBuilder.class); + } + + @Test + public void testUserPassword() throws Exception { + String testPassword = "this is a password purely for test purposes"; + parseConfig(createRenderer() + .startEncryptionParams() + .setUserPassword(testPassword) + .endEncryptionParams()); + assertEquals(testPassword, conf.getConfigOptions().getEncryptionParameters().getUserPassword()); + } + + private void testRestrictEncryptionParameter(PDFEncryptionOption option) throws Exception { + parseConfig(createRenderer().startEncryptionParams() + .setAllowParam(option) + .endEncryptionParams()); + assertFalse(testEncryptionParameter(option)); + parseConfig(createRenderer().startEncryptionParams() + .endEncryptionParams()); + assertTrue(testEncryptionParameter(option)); + } + + public boolean testEncryptionParameter(PDFEncryptionOption option) throws Exception { + switch (option) { + case NO_PRINT: + return conf.getConfigOptions().getEncryptionParameters().isAllowPrint(); + case NO_ACCESSCONTENT: + return conf.getConfigOptions().getEncryptionParameters().isAllowAccessContent(); + case NO_ANNOTATIONS: + return conf.getConfigOptions().getEncryptionParameters().isAllowEditAnnotations(); + case NO_ASSEMBLEDOC: + return conf.getConfigOptions().getEncryptionParameters().isAllowAssembleDocument(); + case NO_COPY_CONTENT: + return conf.getConfigOptions().getEncryptionParameters().isAllowCopyContent(); + case NO_EDIT_CONTENT: + return conf.getConfigOptions().getEncryptionParameters().isAllowEditContent(); + case NO_FILLINFORMS: + return conf.getConfigOptions().getEncryptionParameters().isAllowFillInForms(); + case NO_PRINTHQ: + return conf.getConfigOptions().getEncryptionParameters().isAllowPrintHq(); + default: + throw new IllegalStateException("Wrong parameter given"); + } + + } + + @Test + public void testAllEncryptionRestrictions() throws Exception { + testRestrictEncryptionParameter(PDFEncryptionOption.NO_PRINT); + testRestrictEncryptionParameter(PDFEncryptionOption.NO_ACCESSCONTENT); + testRestrictEncryptionParameter(PDFEncryptionOption.NO_ANNOTATIONS); + testRestrictEncryptionParameter(PDFEncryptionOption.NO_ASSEMBLEDOC); + testRestrictEncryptionParameter(PDFEncryptionOption.NO_COPY_CONTENT); + testRestrictEncryptionParameter(PDFEncryptionOption.NO_EDIT_CONTENT); + testRestrictEncryptionParameter(PDFEncryptionOption.NO_FILLINFORMS); + testRestrictEncryptionParameter(PDFEncryptionOption.NO_PRINTHQ); + } + + @Test + public void testOwnerPassword() throws Exception { + String testPassword = "this is a password purely for test purposes"; + parseConfig(createRenderer() + .startEncryptionParams() + .setOwnerPassword(testPassword) + .endEncryptionParams()); + assertEquals(testPassword, conf.getConfigOptions().getEncryptionParameters().getOwnerPassword()); + } + + @Test + public void testFilterListDefaultFlate() throws Exception { + parseConfig(createRenderer().createFilterList(null, "flate")); + assertEquals("flate", conf.getConfigOptions().getFilterMap().get("default").get(0)); + } + + @Test + public void testFilterListDefaultNull() throws Exception { + parseConfig(createRenderer().createFilterList(null, "null")); + assertEquals("null", conf.getConfigOptions().getFilterMap().get("default").get(0)); + } + + @Test + public void testFilterListImage() throws Exception { + parseConfig(createRenderer().createFilterList("image", "flate", "ascii-85")); + assertEquals("flate", conf.getConfigOptions().getFilterMap().get("image").get(0)); + assertEquals("ascii-85", conf.getConfigOptions().getFilterMap().get("image").get(1)); + } + + @Test + public void testPDFAMode() throws Exception { + parseConfig(createRenderer().setPDFAMode(PDFAMode.PDFA_1A.getName())); + assertEquals(PDFAMode.PDFA_1A, conf.getConfigOptions().getPDFAMode()); + + parseConfig(createRenderer().setPDFAMode(PDFAMode.PDFA_1B.getName())); + assertEquals(PDFAMode.PDFA_1B, conf.getConfigOptions().getPDFAMode()); + + parseConfig(createRenderer().setPDFAMode(PDFAMode.DISABLED.getName())); + assertEquals(null, conf.getConfigOptions().getPDFAMode()); + } + + @Test + public void testPDFXMode() throws Exception { + parseConfig(createRenderer().setPDFXMode(PDFXMode.PDFX_3_2003.getName())); + assertEquals(PDFXMode.PDFX_3_2003, conf.getConfigOptions().getPDFXMode()); + + parseConfig(createRenderer().setPDFXMode(PDFXMode.DISABLED.getName())); + assertEquals(null, conf.getConfigOptions().getPDFXMode()); + } + + @Test + public void testEncryptionLength() throws Exception { + for (int i = 0; i <= 40; i++) { + parseConfig(createRenderer() + .startEncryptionParams() + .setEncryptionLength(i) + .endEncryptionParams()); + assertEquals(40, conf.getConfigOptions().getEncryptionParameters().getEncryptionLengthInBits()); + } + + for (int i = 40; i <= 128; i++) { + parseConfig(createRenderer() + .startEncryptionParams() + .setEncryptionLength(i) + .endEncryptionParams()); + int expectedLen = Math.round(i / 8.0f) * 8; + assertEquals(expectedLen, conf.getConfigOptions().getEncryptionParameters() + .getEncryptionLengthInBits()); + } + + for (int i = 128; i < 256; i += 10) { + parseConfig(createRenderer() + .startEncryptionParams() + .setEncryptionLength(i) + .endEncryptionParams()); + assertEquals(128, conf.getConfigOptions().getEncryptionParameters().getEncryptionLengthInBits()); + } + + for (int i = 256; i < 1000; i += 50) { + parseConfig(createRenderer() + .startEncryptionParams() + .setEncryptionLength(i) + .endEncryptionParams()); + assertEquals(256, conf.getConfigOptions().getEncryptionParameters().getEncryptionLengthInBits()); + } + } + + @Test + public void testPDFVersions() throws Exception { + for (int i = 0; i <= 7; i++) { + pdfVersionTester("1." + i); + } + } + + private void pdfVersionTester(String version) throws Exception { + parseConfig(createRenderer().setPDFVersion(version)); + assertEquals(Version.getValueOf(version), conf.getConfigOptions().getPDFVersion()); + } + + @Test(expected = IllegalArgumentException.class) + public void testErroneousPDFVersions18() throws Exception { + pdfVersionTester("1.8"); + } + + @Test(expected = IllegalArgumentException.class) + public void testErroneousPDFVersionsLessThan1() throws Exception { + pdfVersionTester("0.9"); + } + + @Test(expected = IllegalArgumentException.class) + public void testErroneousPDFVersionsNotSet() throws Exception { + pdfVersionTester(""); + } +} diff --git a/src/test/java/org/apache/fop/render/pdf/PDFRendererOptionsConfigTestCase.java b/src/test/java/org/apache/fop/render/pdf/PDFRendererOptionsConfigTestCase.java new file mode 100644 index 000000000..699a8a186 --- /dev/null +++ b/src/test/java/org/apache/fop/render/pdf/PDFRendererOptionsConfigTestCase.java @@ -0,0 +1,124 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.pdf; + +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Collections; +import java.util.EnumMap; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +import org.apache.fop.pdf.PDFAMode; +import org.apache.fop.pdf.PDFEncryptionParams; +import org.apache.fop.pdf.PDFXMode; +import org.apache.fop.pdf.Version; + +import static org.apache.fop.render.pdf.PDFRendererOption.DISABLE_SRGB_COLORSPACE; +import static org.apache.fop.render.pdf.PDFRendererOption.FILTER_LIST; +import static org.apache.fop.render.pdf.PDFRendererOption.OUTPUT_PROFILE; +import static org.apache.fop.render.pdf.PDFRendererOption.PDF_A_MODE; +import static org.apache.fop.render.pdf.PDFRendererOption.PDF_X_MODE; +import static org.apache.fop.render.pdf.PDFRendererOption.VERSION; + +public class PDFRendererOptionsConfigTestCase { + + private static final Map<PDFRendererOption, Object> DEFAULT_OPTIONS; + + private static final PDFEncryptionParams DEFAULT_ENCRYPTION_PARAMS = null; + + static { + final EnumMap<PDFRendererOption, Object> props + = new EnumMap<PDFRendererOption, Object>(PDFRendererOption.class); + for (PDFRendererOption option : PDFRendererOption.values()) { + props.put(option, option.getDefaultValue()); + } + DEFAULT_OPTIONS = Collections.unmodifiableMap(props); + } + + @Test + public void testDefaults() { + assertConfigEquals(DEFAULT_OPTIONS, DEFAULT_ENCRYPTION_PARAMS, PDFRendererOptionsConfig.DEFAULT); + } + + @Test + public void testConstructor() throws URISyntaxException { + final Map<PDFRendererOption, Object> options = createNonDefaultOptions(); + final PDFEncryptionParams encryptionParams = new PDFEncryptionParams(); + assertConfigEquals(options, encryptionParams, new PDFRendererOptionsConfig(options, encryptionParams)); + } + + @Test + public void testMerge() throws URISyntaxException { + final PDFRendererOptionsConfig defaults = PDFRendererOptionsConfig.DEFAULT; + final PDFEncryptionParams encryptionParams = new PDFEncryptionParams(); + final Map<PDFRendererOption, Object> options = createNonDefaultOptions(); + final PDFRendererOptionsConfig otherConfig = new PDFRendererOptionsConfig(options, encryptionParams); + assertConfigEquals(options, encryptionParams, defaults.merge(otherConfig)); + assertEquals(defaults, defaults.merge(null)); + } + + private Map<PDFRendererOption, Object> createNonDefaultOptions() throws URISyntaxException { + final EnumMap<PDFRendererOption, Object> options + = new EnumMap<PDFRendererOption, Object>(PDFRendererOption.class); + options.put(DISABLE_SRGB_COLORSPACE, Boolean.TRUE); + options.put(FILTER_LIST, new HashMap<String, List<String>>()); + options.put(OUTPUT_PROFILE, new URI("xxx")); + options.put(PDF_A_MODE, PDFAMode.PDFA_1A); + options.put(PDF_X_MODE, PDFXMode.PDFX_3_2003); + options.put(VERSION, Version.V1_0); + return Collections.unmodifiableMap(options); + } + + private static void assertConfigEquals(Map<PDFRendererOption, Object> expectedOptions, + PDFEncryptionParams expectedEncryptionParams, PDFRendererOptionsConfig actual) { + assertEquals((Boolean) expectedOptions.get(DISABLE_SRGB_COLORSPACE), actual.getDisableSRGBColorSpace()); + assertEquals((Map) expectedOptions.get(FILTER_LIST), actual.getFilterMap()); + assertEquals((URI) expectedOptions.get(OUTPUT_PROFILE), actual.getOutputProfileURI()); + assertEquals((PDFAMode) expectedOptions.get(PDF_A_MODE), actual.getPDFAMode()); + assertEquals((PDFXMode) expectedOptions.get(PDF_X_MODE), actual.getPDFXMode()); + assertEquals((Version) expectedOptions.get(VERSION), actual.getPDFVersion()); + assertEncryptionParamsEquals(expectedEncryptionParams, actual.getEncryptionParameters()); + } + + private static void assertEncryptionParamsEquals(PDFEncryptionParams expected, + PDFEncryptionParams actual) { + assertEquals(expected == null, actual == null); + if (actual != null) { + assertEquals(expected.getEncryptionLengthInBits(), actual.getEncryptionLengthInBits()); + assertEquals(expected.getOwnerPassword(), actual.getOwnerPassword()); + assertEquals(expected.getUserPassword(), actual.getUserPassword()); + assertEquals(expected.isAllowAccessContent(), actual.isAllowAccessContent()); + assertEquals(expected.isAllowAssembleDocument(), actual.isAllowAssembleDocument()); + assertEquals(expected.isAllowCopyContent(), actual.isAllowCopyContent()); + assertEquals(expected.isAllowEditAnnotations(), actual.isAllowEditAnnotations()); + assertEquals(expected.isAllowEditContent(), actual.isAllowEditContent()); + assertEquals(expected.isAllowFillInForms(), actual.isAllowFillInForms()); + assertEquals(expected.isAllowPrint(), actual.isAllowPrint()); + assertEquals(expected.isAllowPrintHq(), actual.isAllowPrintHq()); + } + } + +} diff --git a/src/test/java/org/apache/fop/render/pdf/PDFsRGBSettingsTestCase.java b/src/test/java/org/apache/fop/render/pdf/PDFsRGBSettingsTestCase.java new file mode 100644 index 000000000..965a8e30e --- /dev/null +++ b/src/test/java/org/apache/fop/render/pdf/PDFsRGBSettingsTestCase.java @@ -0,0 +1,67 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.pdf; + +import java.io.File; +import java.io.IOException; + +import org.junit.Test; +import org.xml.sax.SAXException; + +import static org.junit.Assert.fail; + +import org.apache.fop.apps.FOUserAgent; + +/** + * Tests the disables-srgb-colorspace setting. + */ +public class PDFsRGBSettingsTestCase extends BasePDFTest { + + private File foBaseDir = new File("test/xml/pdf-a"); + + public PDFsRGBSettingsTestCase() throws SAXException, IOException { + super(getDefaultConfFile()); + } + + private FOUserAgent getUserAgent(boolean enablePDFA) { + final FOUserAgent a = fopFactory.newFOUserAgent(); + if (enablePDFA) { + a.getRendererOptions().put("pdf-a-mode", "PDF/A-1b"); + } + a.getRendererOptions().put("disable-srgb-colorspace", Boolean.TRUE); + return a; + } + + /** + * Verify that the PDFRenderer complains if PDF/A or PDF/X is used when sRGB is disabled. + * @throws Exception if the test fails + */ + @Test + public void testPDFAWithDisabledSRGB() throws Exception { + File foFile = new File(foBaseDir, "minimal-pdf-a.fo"); + try { + convertFO(foFile, getUserAgent(true), false); + fail("PDFRenderer must fail if PDF/A is active!"); + } catch (IllegalStateException e) { + //exception expected! + } + } + +} diff --git a/src/test/java/org/apache/fop/render/pdf/RenderPDFTestSuite.java b/src/test/java/org/apache/fop/render/pdf/RenderPDFTestSuite.java new file mode 100644 index 000000000..ab58e9892 --- /dev/null +++ b/src/test/java/org/apache/fop/render/pdf/RenderPDFTestSuite.java @@ -0,0 +1,32 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.pdf; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +/** + * A test suite for org.apache.fop.render.pdf.* + */ +@RunWith(Suite.class) +@SuiteClasses(PDFRendererConfigParserTestCase.class) +public final class RenderPDFTestSuite { +} diff --git a/src/test/java/org/apache/fop/render/pdf/extensions/PDFDocumentInformationElementTestCase.java b/src/test/java/org/apache/fop/render/pdf/extensions/PDFDocumentInformationElementTestCase.java new file mode 100644 index 000000000..939b5fb11 --- /dev/null +++ b/src/test/java/org/apache/fop/render/pdf/extensions/PDFDocumentInformationElementTestCase.java @@ -0,0 +1,72 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.pdf.extensions; + +import java.io.FileInputStream; +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; + +import org.apache.xmlgraphics.util.QName; + +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.events.EventChecker; +import org.apache.fop.fo.FODocumentParser; +import org.apache.fop.fo.FODocumentParser.FOEventHandlerFactory; +import org.apache.fop.fo.FOEventHandler; +import org.apache.fop.fo.FOValidationEventProducer; +import org.apache.fop.fo.LoadingException; +import org.apache.fop.fotreetest.DummyFOEventHandler; + +public class PDFDocumentInformationElementTestCase { + + private FODocumentParser parser = FODocumentParser.newInstance(new FOEventHandlerFactory() { + + public FOEventHandler newFOEventHandler(FOUserAgent foUserAgent) { + return new DummyFOEventHandler(foUserAgent); + } + }); + + @Test(expected = LoadingException.class) + public void illegalChild() throws Exception { + Map<String, Object> expectedParams = new HashMap<String, Object>(); + expectedParams.put("offendingNode", new QName(PDFElementMapping.NAMESPACE, "dictionary")); + runTest("invalid-child.fo", FOValidationEventProducer.class.getName() + ".invalidChild", expectedParams); + } + + @Test + public void standardKeyword() throws Exception { + Map<String, Object> expectedParams = new HashMap<String, Object>(); + expectedParams.put("keyword", "Creator"); + runTest("reserved-keyword.fo", PDFExtensionEventProducer.class.getName() + ".reservedKeyword", expectedParams); + } + + private void runTest(String testCase, String expectedEventKey, Map<String, Object> expectedEventParams) + throws Exception { + EventChecker eventChecker = new EventChecker(expectedEventKey, expectedEventParams); + parser.setEventListener(eventChecker); + try { + parser.parse(new FileInputStream("test/pdf/extensions/document-information/" + testCase)); + } finally { + eventChecker.end(); + } + } +} diff --git a/src/test/java/org/apache/fop/render/ps/AbstractPostScriptTest.java b/src/test/java/org/apache/fop/render/ps/AbstractPostScriptTest.java new file mode 100644 index 000000000..eb25c3f94 --- /dev/null +++ b/src/test/java/org/apache/fop/render/ps/AbstractPostScriptTest.java @@ -0,0 +1,93 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.ps; + +import java.io.File; +import java.io.IOException; + +import static org.junit.Assert.assertEquals; + +import org.apache.xmlgraphics.ps.PSResource; +import org.apache.xmlgraphics.ps.dsc.DSCException; +import org.apache.xmlgraphics.ps.dsc.DSCParser; +import org.apache.xmlgraphics.ps.dsc.events.AbstractResourceDSCComment; +import org.apache.xmlgraphics.ps.dsc.events.DSCComment; +import org.apache.xmlgraphics.ps.dsc.events.DSCEvent; + +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.apps.MimeConstants; +import org.apache.fop.render.AbstractRenderingTest; + +/** + * Abstract base class for PostScript verification tests. + */ +public abstract class AbstractPostScriptTest extends AbstractRenderingTest { + + /** + * Renders a test file. + * @param ua the user agent (with override set!) + * @param resourceName the resource name for the FO file + * @param suffix a suffix for the output filename + * @return the output file + * @throws Exception if an error occurs + */ + protected File renderFile(FOUserAgent ua, String resourceName, String suffix) + throws Exception { + return renderFile(ua, resourceName, suffix, MimeConstants.MIME_POSTSCRIPT); + } + + /** + * Scans for a certain resource DSC comment and checks against a given resource. + * @param parser the DSC parser + * @param comment the comment to scan for + * @param resource the resource to check against + * @throws IOException if an I/O error occurs + * @throws DSCException if a DSC error occurs + */ + protected void checkResourceComment(DSCParser parser, String comment, PSResource resource) + throws IOException, DSCException { + AbstractResourceDSCComment resComment; + resComment = (AbstractResourceDSCComment)gotoDSCComment(parser, comment); + assertEquals(resource, resComment.getResource()); + } + + /** + * Advances the DSC parser to a DSC comment with the given name. + * @param parser the DSC parser + * @param name the name of the DSC comment + * @return the DSC comment + * @throws IOException if an I/O error occurs + * @throws DSCException if a DSC error occurs + */ + protected static DSCComment gotoDSCComment(DSCParser parser, String name) + throws IOException, DSCException { + while (parser.hasNext()) { + DSCEvent event = parser.nextEvent(); + if (event.isDSCComment()) { + DSCComment comment = event.asDSCComment(); + if (comment.getName().equals(name)) { + return comment; + } + } + } + return null; + } + +} diff --git a/src/test/java/org/apache/fop/render/ps/ImageEncoderPNGTestCase.java b/src/test/java/org/apache/fop/render/ps/ImageEncoderPNGTestCase.java new file mode 100644 index 000000000..53654d76a --- /dev/null +++ b/src/test/java/org/apache/fop/render/ps/ImageEncoderPNGTestCase.java @@ -0,0 +1,132 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.ps; + +import java.awt.image.ComponentColorModel; +import java.awt.image.IndexColorModel; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; + +import org.junit.Test; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import org.apache.xmlgraphics.image.loader.ImageSize; +import org.apache.xmlgraphics.image.loader.impl.ImageRawPNG; + +import org.apache.fop.render.RawPNGTestUtil; + +public class ImageEncoderPNGTestCase { + + @Test + public void testWriteToWithRGBPNG() throws IOException { + testWriteToWithGRGBAPNG(-1, 128, 128, 128, -1); + } + + @Test + public void testWriteToWithGPNG() throws IOException { + testWriteToWithGRGBAPNG(128, -1, -1, -1, -1); + } + + @Test + public void testWriteToWithRGBAPNG() throws IOException { + testWriteToWithGRGBAPNG(-1, 128, 128, 128, 128); + } + + @Test + public void testWriteToWithGAPNG() throws IOException { + testWriteToWithGRGBAPNG(128, -1, -1, -1, 128); + } + + private void testWriteToWithGRGBAPNG(int gray, int red, int green, int blue, int alpha) + throws IOException { + int numComponents = (gray > -1 ? 1 : 3) + (alpha > -1 ? 1 : 0); + ImageSize is = RawPNGTestUtil.getImageSize(); + ComponentColorModel cm = mock(ComponentColorModel.class); + when(cm.getNumComponents()).thenReturn(numComponents); + ImageRawPNG irpng = mock(ImageRawPNG.class); + when(irpng.getColorModel()).thenReturn(cm); + when(irpng.getSize()).thenReturn(is); + ImageEncoderPNG iepng = new ImageEncoderPNG(irpng); + + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + byte[] data = RawPNGTestUtil.buildGRGBAData(gray, red, green, blue, alpha); + ByteArrayInputStream bais = new ByteArrayInputStream(data); + when(irpng.createInputStream()).thenReturn(bais); + iepng.writeTo(baos); + if (alpha > -1) { + byte[] expected = RawPNGTestUtil.buildGRGBAData(gray, red, green, blue, -1); + assertArrayEquals(expected, baos.toByteArray()); + } else { + assertArrayEquals(data, baos.toByteArray()); + } + } + + @Test + public void testWriteToWithPalettePNG() throws IOException { + ImageSize is = RawPNGTestUtil.getImageSize(); + IndexColorModel cm = mock(IndexColorModel.class); + ImageRawPNG irpng = mock(ImageRawPNG.class); + when(irpng.getColorModel()).thenReturn(cm); + when(irpng.getSize()).thenReturn(is); + ImageEncoderPNG iepng = new ImageEncoderPNG(irpng); + + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + byte[] data = RawPNGTestUtil.buildGRGBAData(128, -1, -1, -1, -1); + ByteArrayInputStream bais = new ByteArrayInputStream(data); + when(irpng.createInputStream()).thenReturn(bais); + iepng.writeTo(baos); + assertArrayEquals(data, baos.toByteArray()); + } + + @Test + public void testGetImplicitFilterWithIndexColorModel() { + ImageSize is = RawPNGTestUtil.getImageSize(); + IndexColorModel cm = mock(IndexColorModel.class); + ImageRawPNG irpng = mock(ImageRawPNG.class); + when(irpng.getColorModel()).thenReturn(cm); + when(irpng.getBitDepth()).thenReturn(8); + when(irpng.getSize()).thenReturn(is); + ImageEncoderPNG iepng = new ImageEncoderPNG(irpng); + + String expectedFilter = "<< /Predictor 15 /Columns 32 /Colors 1 /BitsPerComponent 8 >> /FlateDecode"; + assertEquals(expectedFilter, iepng.getImplicitFilter()); + } + + @Test + public void testGetImplicitFilterWithComponentColorModel() { + ImageSize is = RawPNGTestUtil.getImageSize(); + ComponentColorModel cm = mock(ComponentColorModel.class); + when(cm.getNumComponents()).thenReturn(3); + ImageRawPNG irpng = mock(ImageRawPNG.class); + when(irpng.getColorModel()).thenReturn(cm); + when(irpng.getBitDepth()).thenReturn(8); + when(irpng.getSize()).thenReturn(is); + ImageEncoderPNG iepng = new ImageEncoderPNG(irpng); + + String expectedFilter = "<< /Predictor 15 /Columns 32 /Colors 3 /BitsPerComponent 8 >> /FlateDecode"; + assertEquals(expectedFilter, iepng.getImplicitFilter()); + } + +} diff --git a/src/test/java/org/apache/fop/render/ps/ImageHandlingTestCase.java b/src/test/java/org/apache/fop/render/ps/ImageHandlingTestCase.java new file mode 100644 index 000000000..3c05e9ad7 --- /dev/null +++ b/src/test/java/org/apache/fop/render/ps/ImageHandlingTestCase.java @@ -0,0 +1,195 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.ps; + +import java.awt.Rectangle; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; + +import org.junit.Test; + +import org.w3c.dom.Document; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import org.apache.commons.io.IOUtils; + +import org.apache.batik.anim.dom.SAXSVGDocumentFactory; + +import org.apache.xmlgraphics.image.loader.impl.ImageXMLDOM; +import org.apache.xmlgraphics.ps.DSCConstants; +import org.apache.xmlgraphics.ps.PSGenerator; +import org.apache.xmlgraphics.ps.PSResource; +import org.apache.xmlgraphics.ps.dsc.DSCException; +import org.apache.xmlgraphics.ps.dsc.DSCParser; +import org.apache.xmlgraphics.ps.dsc.events.DSCCommentPage; +import org.apache.xmlgraphics.ps.dsc.events.DSCCommentPages; +import org.apache.xmlgraphics.ps.dsc.events.DSCCommentTitle; +import org.apache.xmlgraphics.ps.dsc.events.DSCEvent; + +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.apps.FopFactory; +import org.apache.fop.fonts.FontInfo; +import org.apache.fop.render.intermediate.IFContext; + +/** + * Tests the image handling in PostScript output. + */ +public class ImageHandlingTestCase extends AbstractPostScriptTest { + + /** + * Tests JPEG handling. + * @throws Exception if an error occurs + */ + @Test + public void testJPEGImageLevel3() throws Exception { + innerTestJPEGImage(3); + } + + /** + * Tests JPEG handling. + * @throws Exception if an error occurs + */ + @Test + public void testJPEGImageLevel2() throws Exception { + innerTestJPEGImage(2); + } + + private void innerTestJPEGImage(int level) throws Exception { + FOUserAgent ua = fopFactory.newFOUserAgent(); + PSDocumentHandler handler = new PSDocumentHandler(new IFContext(ua)); + PSRenderingUtil psUtil = handler.getPSUtil(); + psUtil.setLanguageLevel(level); + psUtil.setOptimizeResources(true); + ua.setDocumentHandlerOverride(handler); + + // Prepare output file + File outputFile = renderFile(ua, "ps-jpeg-image.fo", + "-if-l" + psUtil.getLanguageLevel()); + verifyPostScriptFile(outputFile, psUtil.getLanguageLevel()); + } + + private void verifyPostScriptFile(File psFile, int level) + throws IOException, DSCException { + InputStream in = new java.io.FileInputStream(psFile); + in = new java.io.BufferedInputStream(in); + try { + DSCParser parser = new DSCParser(in); + + DSCCommentPages pages = (DSCCommentPages)gotoDSCComment(parser, DSCConstants.PAGES); + assertEquals(1, pages.getPageCount()); + + //Skip procsets and encoding + gotoDSCComment(parser, DSCConstants.BEGIN_RESOURCE); + gotoDSCComment(parser, DSCConstants.BEGIN_RESOURCE); + gotoDSCComment(parser, DSCConstants.BEGIN_RESOURCE); + gotoDSCComment(parser, DSCConstants.BEGIN_RESOURCE); + + PSResource form2 = new PSResource(PSResource.TYPE_FORM, "FOPForm:2"); + checkResourceComment(parser, DSCConstants.BEGIN_RESOURCE, form2); + DSCCommentTitle title = (DSCCommentTitle)parser.nextEvent().asDSCComment(); + assertEquals("image/jpeg test/resources/images/bgimg300dpi.jpg", title.getTitle()); + + String resourceContent = getResourceContent(parser); + + if (level == 3) { + assertContains(resourceContent, "/FOPForm:2"); + assertContains(resourceContent, "/DCTDecode filter"); + assertContains(resourceContent, "/ReusableStreamDecode filter"); + } else { + assertContains(resourceContent, "/FOPForm:2"); + assertContains(resourceContent, "/DCTDecode filter"); + assertAbsent(resourceContent, "/ReusableStreamDecode filter"); + } + + //---=== Page 1 ===--- + DSCCommentPage page = (DSCCommentPage)gotoDSCComment(parser, DSCConstants.PAGE); + assertEquals(1, page.getPagePosition()); + + PSResource form1 = new PSResource(PSResource.TYPE_FORM, "FOPForm:1"); + checkResourceComment(parser, DSCConstants.BEGIN_RESOURCE, form1); + title = (DSCCommentTitle)parser.nextEvent().asDSCComment(); + assertEquals("image/jpeg test/resources/images/bgimg72dpi.jpg", title.getTitle()); + resourceContent = getResourceContent(parser); + + if (level == 3) { + assertContains(resourceContent, "/FOPForm:1"); + assertContains(resourceContent, "/DCTDecode filter"); + assertContains(resourceContent, "/ReusableStreamDecode filter"); + } else { + assertContains(resourceContent, "/FOPForm:1"); + assertContains(resourceContent, "/DCTDecode filter"); + assertAbsent(resourceContent, "/ReusableStreamDecode filter"); + } + + } finally { + IOUtils.closeQuietly(in); + } + } + + private void assertContains(String text, String searchString) { + assertTrue("Text doesn't contain '" + searchString + "'", text.indexOf(searchString) >= 0); + } + + private void assertAbsent(String text, String searchString) { + assertTrue("Text contains '" + searchString + "'", text.indexOf(searchString) < 0); + } + + private String getResourceContent(DSCParser parser) throws IOException, DSCException { + StringBuffer sb = new StringBuffer(); + while (parser.hasNext()) { + DSCEvent event = parser.nextEvent(); + if (event.isLine()) { + sb.append(event.asLine().getLine()).append('\n'); + } else if (event.isDSCComment()) { + if (DSCConstants.END_RESOURCE.equals(event.asDSCComment().getName())) { + break; + } + } + } + return sb.toString(); + } + + @Test + public void testPSImageHandlerSVG() throws IOException { + FOUserAgent ua = FopFactory.newInstance(new File(".").toURI()).newFOUserAgent(); + String svg = "<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns=\"http://www.w3.org/2000/svg\" " + + "width=\"210mm\" height=\"297mm\" font-size=\"20\" stroke-width=\"0.1mm\" font-family=\"Arial\">\n" + + " <filter id=\"drop-shadow-font\" width=\"150%\" height=\"150%\">\n" + + " <feGaussianBlur in=\"SourceAlpha\" result=\"blur\" stdDeviation=\"1\"/>\n" + + " <feOffset in=\"blur\" result=\"offsetBlur\" dy=\"1\" dx=\"1\"/>\n" + + " <feBlend in=\"SourceGraphic\" in2=\"offsetBlur\" mode=\"normal\"/>\n" + + " </filter>\n" + + " <text x=\"4.9mm\" filter=\"url(#drop-shadow-font)\" y=\"10.5mm\" fill=\"black\" " + + "rotate=\"30 30 0 15\">Hello SVG with FOP</text>\n" + + "</svg>"; + SAXSVGDocumentFactory factory = new SAXSVGDocumentFactory(null); + Document doc = factory.createDocument(null, IOUtils.toInputStream(svg)); + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + new PSImageHandlerSVG().handleImage( + new PSRenderingContext(ua, new PSGenerator(bos), new FontInfo()), + new ImageXMLDOM(null, doc, ""), + new Rectangle()); + assertTrue(bos.toString().contains("/DataSource Data")); + } +} diff --git a/src/test/java/org/apache/fop/render/ps/PSBorderPainterTestCase.java b/src/test/java/org/apache/fop/render/ps/PSBorderPainterTestCase.java new file mode 100644 index 000000000..602431231 --- /dev/null +++ b/src/test/java/org/apache/fop/render/ps/PSBorderPainterTestCase.java @@ -0,0 +1,63 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.ps; + +import java.awt.Color; +import java.io.ByteArrayOutputStream; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertTrue; + +import org.apache.xmlgraphics.ps.PSGenerator; + +import org.apache.fop.fo.Constants; + +public class PSBorderPainterTestCase { + + private PSGenerator generator; + private ByteArrayOutputStream outStream; + private PSGraphicsPainter borderPainter; + + @Before + public void setUp() { + outStream = new ByteArrayOutputStream(); + generator = new PSGenerator(outStream); + borderPainter = new PSGraphicsPainter(generator); + } + + /** + * This test will fail if either of the below statements isn't true: + * org.apache.fop.render.intermediate.BorderPainter.DASHED_BORDER_SPACE_RATIO = 0.5f:q + * org.apache.fop.render.intermediate.BorderPainter.DASHED_BORDER_LENGTH_FACTOR = 4.0f. + */ + @Test + public void testDrawBorderLine() throws Exception { + borderPainter.drawBorderLine(0, 0, 40000, 1000, true, true, + Constants.EN_DASHED, Color.BLACK); + assertTrue(outStream.toString().contains("[7.2727275 3.6363637] 0 setdash")); + } + + public void tearDown() { + generator = null; + outStream = null; + } +} diff --git a/src/test/java/org/apache/fop/render/ps/PSPainterTestCase.java b/src/test/java/org/apache/fop/render/ps/PSPainterTestCase.java new file mode 100644 index 000000000..3efbb47d4 --- /dev/null +++ b/src/test/java/org/apache/fop/render/ps/PSPainterTestCase.java @@ -0,0 +1,238 @@ +/* + * 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.fop.render.ps; + +import java.awt.Color; +import java.awt.Rectangle; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +import javax.xml.transform.stream.StreamResult; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.mockito.verification.VerificationMode; + +import static org.junit.Assert.fail; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyFloat; +import static org.mockito.Matchers.anyInt; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import org.apache.xmlgraphics.ps.PSGenerator; +import org.apache.xmlgraphics.ps.dsc.ResourceTracker; + +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.apps.FopFactory; +import org.apache.fop.fo.Constants; +import org.apache.fop.fonts.EmbeddingMode; +import org.apache.fop.fonts.Font; +import org.apache.fop.fonts.FontInfo; +import org.apache.fop.fonts.FontTriplet; +import org.apache.fop.fonts.MultiByteFont; +import org.apache.fop.fonts.Typeface; +import org.apache.fop.render.intermediate.IFContext; +import org.apache.fop.render.intermediate.IFException; +import org.apache.fop.render.intermediate.IFState; +import org.apache.fop.traits.BorderProps; + +public class PSPainterTestCase { + + private PSDocumentHandler docHandler; + private PSPainter psPainter; + private PSGenerator gen; + private IFState state; + + @Before + public void setup() { + state = IFState.create(); + FOUserAgent userAgent = mock(FOUserAgent.class); + when(userAgent.getRendererOptions()).thenReturn(Collections.EMPTY_MAP); + IFContext context = mock(IFContext.class); + when(context.getUserAgent()).thenReturn(userAgent); + docHandler = new PSDocumentHandler(context); + gen = mock(PSGenerator.class); + docHandler.gen = gen; + state = IFState.create(); + psPainter = new PSPainter(docHandler, state); + } + + @Test + public void testNonZeroFontSize() throws IOException { + testFontSize(6, times(1)); + } + + @Test + public void testZeroFontSize() throws IOException { + testFontSize(0, never()); + } + + private void testFontSize(int fontSize, VerificationMode test) throws IOException { + state.setFontSize(fontSize); + try { + psPainter.drawText(10, 10, 2, 2, null, "Test"); + } catch (Exception ex) { + //Expected + } + verify(gen, test).useColor(state.getTextColor()); + } + + @Test + public void testDrawBorderRect() { + // the goal of this test is to check that the drawing of rounded corners in PS calls + // PSGraphicsPaiter.cubicBezierTo(); the check is done by verifying that a curveto command is written + // to the PSGenerator + PSGenerator psGenerator = mock(PSGenerator.class); + when(psGenerator.formatDouble(anyFloat())).thenReturn("20.0"); // simplify! + PSRenderingUtil psRenderingUtil = mock(PSRenderingUtil.class); + PSDocumentHandler psDocumentHandler = mock(PSDocumentHandler.class); + when(psDocumentHandler.getGenerator()).thenReturn(psGenerator); + when(psDocumentHandler.getPSUtil()).thenReturn(psRenderingUtil); + PSPainter psPainter = new PSPainter(psDocumentHandler); + // build rectangle 200 x 50 (points, which are converted to milipoints) + Rectangle rectangle = new Rectangle(0, 0, 200000, 50000); + // build border properties: width 4pt, radius 30pt + BorderProps border = new BorderProps(Constants.EN_SOLID, 4000, 30000, 30000, Color.BLACK, + BorderProps.Mode.SEPARATE); + try { + psPainter.drawBorderRect(rectangle, border, border, border, border, Color.WHITE); + verify(psGenerator, times(16)).writeln("20.0 20.0 20.0 20.0 20.0 20.0 curveto "); + } catch (Exception e) { + fail("something broke..."); + } + } + + @Test + public void testDrawText() { + int fontSize = 12000; + String fontName = "MockFont"; + PSGenerator psGenerator = mock(PSGenerator.class); + PSRenderingUtil psRenderingUtil = mock(PSRenderingUtil.class); + PSDocumentHandler psDocumentHandler = mock(PSDocumentHandler.class); + FontInfo fontInfo = mock(FontInfo.class); + PSFontResource psFontResource = mock(PSFontResource.class); + MultiByteFont multiByteFont = mock(MultiByteFont.class); + Font font = mock(Font.class); + when(psDocumentHandler.getGenerator()).thenReturn(psGenerator); + when(psDocumentHandler.getPSUtil()).thenReturn(psRenderingUtil); + when(psDocumentHandler.getFontInfo()).thenReturn(fontInfo); + when(psDocumentHandler.getPSResourceForFontKey(fontName)).thenReturn(psFontResource); + when(fontInfo.getInternalFontKey(any(FontTriplet.class))).thenReturn(fontName); + when(fontInfo.getFontInstance(any(FontTriplet.class), anyInt())).thenReturn(font); + Map<String, Typeface> fonts = new HashMap<String, Typeface>(); + fonts.put(fontName, multiByteFont); + when(fontInfo.getFonts()).thenReturn(fonts); + + IFState ifState = IFState.create(); + ifState.setFontSize(fontSize); + + PSPainter psPainter = new PSPainter(psDocumentHandler, ifState); + + int x = 100000; + int y = 100000; + int letterSpacing = 0; + int wordSpacing = 0; + int[][] dp = {{100, 100, 0, 0}, null, null, {200, 200, -100, -100}}; + double xAsDouble = (x + dp[0][0]) / 1000.0; + double yAsDouble = (y - dp[0][1]) / 1000.0; + when(psGenerator.formatDouble(xAsDouble)).thenReturn("100.100"); + when(psGenerator.formatDouble(yAsDouble)).thenReturn("99.900"); + String text = "Hello Mock!"; + try { + psPainter.drawText(x, y, letterSpacing, wordSpacing, dp, text); + verify(psGenerator).writeln("1 0 0 -1 100.100 99.900 Tm"); + verify(psGenerator).writeln("[<0000> [-100 100] <00000000> [200 -200] <0000> [-300 300] " + + "<0000000000000000000000000000>] TJ"); + } catch (Exception e) { + fail("something broke..."); + } + } + + @Test + public void testOTF() throws IFException, IOException { + FOUserAgent ua = FopFactory.newInstance(new File(".").toURI()).newFOUserAgent(); + final IFState state = IFState.create(); + PSDocumentHandler dh = new PSDocumentHandler(new IFContext(ua)) { + protected PSFontResource getPSResourceForFontKey(String key) { + return new PSFontResource() { + String getName() { + return state.getFontFamily(); + } + void notifyResourceUsageOnPage(ResourceTracker resourceTracker) { + } + }; + } + }; + FontInfo fi = new FontInfo(); + addFont(fi, "OTFFont", true); + addFont(fi, "TTFFont", false); + + dh.setFontInfo(fi); + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + dh.setResult(new StreamResult(bos)); + dh.startDocument(); + state.setFontSize(10); + state.setTextColor(Color.BLACK); + state.setFontStyle(""); + PSPainter p = new PSPainter(dh, state) { + protected String getFontKey(FontTriplet triplet) throws IFException { + return state.getFontFamily(); + } + }; + + state.setFontFamily("TTFFont"); + p.drawText(0, 0, 0, 0, null, "test1"); + + state.setFontFamily("OTFFont"); + p.drawText(0, 0, 0, 0, null, "test2"); + p.drawText(0, 0, 0, 0, null, "test3"); + + state.setFontFamily("TTFFont"); + p.drawText(0, 0, 0, 0, null, "test4"); + + Assert.assertTrue(bos.toString(), bos.toString().endsWith("BT\n" + + "/TTFFont 0.01 F\n" + + "1 0 0 -1 0 0 Tm\n" + + "<00000000000000000000> t\n" + + "/OTFFont.0 0.01 F\n" + + "1 0 0 -1 0 0 Tm\n" + + "<FFFFFFFFFF> t\n" + + "/OTFFont.0 0.01 F\n" + + "1 0 0 -1 0 0 Tm\n" + + "<FFFFFFFFFF> t\n" + + "/TTFFont 0.01 F\n" + + "1 0 0 -1 0 0 Tm\n" + + "<00000000000000000000> t\n")); + } + + private void addFont(FontInfo fi, String name, boolean otf) { + fi.addFontProperties(name, name, "", 0); + MultiByteFont mbf = new MultiByteFont(null, EmbeddingMode.AUTO); + mbf.setWidthArray(new int[100]); + mbf.setIsOTFFile(otf); + fi.addMetrics(name, mbf); + } +} diff --git a/src/test/java/org/apache/fop/render/ps/PSRendererConfigParserTestCase.java b/src/test/java/org/apache/fop/render/ps/PSRendererConfigParserTestCase.java new file mode 100644 index 000000000..45642764c --- /dev/null +++ b/src/test/java/org/apache/fop/render/ps/PSRendererConfigParserTestCase.java @@ -0,0 +1,88 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.ps; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +import org.apache.xmlgraphics.ps.PSGenerator; + +import org.apache.fop.apps.AbstractRendererConfigParserTester; +import org.apache.fop.apps.PSRendererConfBuilder; +import org.apache.fop.render.ps.PSRendererConfig.PSRendererConfigParser; + +public class PSRendererConfigParserTestCase + extends AbstractRendererConfigParserTester<PSRendererConfBuilder, PSRendererConfig> { + + public PSRendererConfigParserTestCase() { + super(new PSRendererConfigParser(), PSRendererConfBuilder.class); + } + + @Test + public void testAutoRotateLandscape() throws Exception { + boolean defaultVal = false; + boolean configuredVal = !defaultVal; + parseConfig(createRenderer()); + assertEquals(defaultVal, conf.isAutoRotateLandscape()); + parseConfig(createRenderer().setAutoRotateLandscape(configuredVal)); + assertEquals(configuredVal, conf.isAutoRotateLandscape()); + } + + @Test + public void testSafeSetPageDevice() throws Exception { + boolean defaultVal = false; + boolean configuredVal = !defaultVal; + parseConfig(createRenderer()); + assertEquals(defaultVal, conf.isSafeSetPageDevice()); + parseConfig(createRenderer().setSafeSetPageDevice(configuredVal)); + assertEquals(configuredVal, conf.isSafeSetPageDevice()); + } + + @Test + public void testDscCompliant() throws Exception { + boolean defaultVal = true; + boolean configuredVal = !defaultVal; + parseConfig(createRenderer()); + assertEquals(defaultVal, conf.isDscComplianceEnabled()); + parseConfig(createRenderer().setDscCompliant(configuredVal)); + assertEquals(configuredVal, conf.isDscComplianceEnabled()); + } + + @Test + public void testLanguageLevel() throws Exception { + Integer defaultVal = PSGenerator.DEFAULT_LANGUAGE_LEVEL; + Integer configuredVal = defaultVal + 1; + parseConfig(createRenderer()); + assertEquals(defaultVal, conf.getLanguageLevel()); + parseConfig(createRenderer().setLanguageLevel(configuredVal)); + assertEquals(configuredVal, conf.getLanguageLevel()); + } + + @Test + public void testOptimizeResources() throws Exception { + boolean defaultVal = false; + boolean configuredVal = !defaultVal; + parseConfig(createRenderer()); + assertEquals(defaultVal, conf.isOptimizeResources()); + parseConfig(createRenderer().setOptimizeResources(configuredVal)); + assertEquals(configuredVal, conf.isOptimizeResources()); + } +} diff --git a/src/test/java/org/apache/fop/render/ps/PSRendererConfiguratorTestCase.java b/src/test/java/org/apache/fop/render/ps/PSRendererConfiguratorTestCase.java new file mode 100644 index 000000000..67ba24763 --- /dev/null +++ b/src/test/java/org/apache/fop/render/ps/PSRendererConfiguratorTestCase.java @@ -0,0 +1,113 @@ +/* + * 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.fop.render.ps; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.when; + +import org.apache.fop.apps.AbstractRendererConfiguratorTest; +import org.apache.fop.apps.MimeConstants; +import org.apache.fop.apps.PSRendererConfBuilder; +import org.apache.fop.render.ps.PSRendererConfig.PSRendererConfigParser; + +public class PSRendererConfiguratorTestCase extends + AbstractRendererConfiguratorTest<PSRendererConfigurator, PSRendererConfBuilder> { + private PSRenderingUtil psUtil; + + public PSRendererConfiguratorTestCase() { + super(MimeConstants.MIME_POSTSCRIPT, PSRendererConfBuilder.class, PSDocumentHandler.class); + } + + @Override + public PSRendererConfigurator createConfigurator() { + return new PSRendererConfigurator(userAgent, new PSRendererConfigParser()); + } + + @Override + public void setUpDocumentHandler() { + psUtil = new PSRenderingUtil(userAgent); + when(((PSDocumentHandler) docHandler).getPSUtil()).thenReturn(psUtil); + } + + @Test + public void testAutoRotateLandscape() throws Exception { + parseConfig(createBuilder().setAutoRotateLandscape(true)); + assertTrue(psUtil.isAutoRotateLandscape()); + + parseConfig(createBuilder().setAutoRotateLandscape(false)); + assertFalse(psUtil.isAutoRotateLandscape()); + + parseConfig(createBuilder()); + assertFalse(psUtil.isAutoRotateLandscape()); + } + + @Test + public void testLanguageLevel() throws Exception { + parseConfig(createBuilder().setLanguageLevel(2)); + assertEquals(2, psUtil.getLanguageLevel()); + + parseConfig(createBuilder().setLanguageLevel(3)); + assertEquals(3, psUtil.getLanguageLevel()); + } + + @Test(expected = IllegalArgumentException.class) + public void testLanguageLevelTestCase() throws Exception { + parseConfig(createBuilder().setLanguageLevel(1)); + assertEquals(1, psUtil.getLanguageLevel()); + } + + @Test + public void testOptimizeResources() throws Exception { + parseConfig(createBuilder().setOptimizeResources(true)); + assertTrue(psUtil.isOptimizeResources()); + + parseConfig(createBuilder().setOptimizeResources(false)); + assertFalse(psUtil.isOptimizeResources()); + + parseConfig(createBuilder()); + assertFalse(psUtil.isOptimizeResources()); + } + + @Test + public void testSafeSetPageDevice() throws Exception { + parseConfig(createBuilder().setSafeSetPageDevice(true)); + assertTrue(psUtil.isSafeSetPageDevice()); + + parseConfig(createBuilder().setSafeSetPageDevice(false)); + assertFalse(psUtil.isSafeSetPageDevice()); + + parseConfig(createBuilder()); + assertFalse(psUtil.isSafeSetPageDevice()); + } + + @Test + public void testDscComplianceEnabled() throws Exception { + parseConfig(createBuilder().setDscCompliant(true)); + assertTrue(psUtil.isDSCComplianceEnabled()); + + parseConfig(createBuilder().setDscCompliant(false)); + assertFalse(psUtil.isDSCComplianceEnabled()); + + parseConfig(createBuilder()); + assertTrue(psUtil.isDSCComplianceEnabled()); + } +} diff --git a/src/test/java/org/apache/fop/render/ps/PSRenderingUtilTestCase.java b/src/test/java/org/apache/fop/render/ps/PSRenderingUtilTestCase.java new file mode 100644 index 000000000..0a2c895be --- /dev/null +++ b/src/test/java/org/apache/fop/render/ps/PSRenderingUtilTestCase.java @@ -0,0 +1,45 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.ps; + +import java.io.IOException; + +import org.junit.Test; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; + +import org.apache.xmlgraphics.ps.PSGenerator; + +import org.apache.fop.render.ps.extensions.PSPageTrailerCodeBefore; + +public class PSRenderingUtilTestCase { + + private final String content = "<< /MyEntry 0 >> command"; + private final PSPageTrailerCodeBefore ptcb = new PSPageTrailerCodeBefore(content); + private final PSGenerator gen = mock(PSGenerator.class); + + @Test + public void testWriteEnclosedExtensionAttachment() throws IOException { + PSRenderingUtil.writeEnclosedExtensionAttachment(gen, ptcb); + verify(gen).writeln(content); + } + +} diff --git a/src/test/java/org/apache/fop/render/ps/PSTestSuite.java b/src/test/java/org/apache/fop/render/ps/PSTestSuite.java new file mode 100644 index 000000000..cf66d4776 --- /dev/null +++ b/src/test/java/org/apache/fop/render/ps/PSTestSuite.java @@ -0,0 +1,35 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.ps; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +/** + * Test suite for FOP's PostScript output. + */ +@RunWith(Suite.class) +@SuiteClasses({ + ImageHandlingTestCase.class, + ResourceOptimizationTestCase.class +}) +public class PSTestSuite { +} diff --git a/src/test/java/org/apache/fop/render/ps/RenderPSTestSuite.java b/src/test/java/org/apache/fop/render/ps/RenderPSTestSuite.java new file mode 100644 index 000000000..2e15bf91f --- /dev/null +++ b/src/test/java/org/apache/fop/render/ps/RenderPSTestSuite.java @@ -0,0 +1,43 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.ps; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +import org.apache.fop.render.ps.fonts.PSTTFGeneratorTestCase; +import org.apache.fop.render.ps.fonts.PSTTFGlyphOutputStreamTestCase; +import org.apache.fop.render.ps.fonts.PSTTFOutputStreamTestCase; +import org.apache.fop.render.ps.fonts.PSTTFTableOutputStreamTestCase; + + +/** + * A test Suite for org.apache.fop.render.ps.* + */ +@RunWith(Suite.class) +@SuiteClasses({ + PSTTFGeneratorTestCase.class, + PSTTFOutputStreamTestCase.class, + PSTTFGlyphOutputStreamTestCase.class, + PSTTFTableOutputStreamTestCase.class +}) +public final class RenderPSTestSuite { +} diff --git a/src/test/java/org/apache/fop/render/ps/ResourceOptimizationTestCase.java b/src/test/java/org/apache/fop/render/ps/ResourceOptimizationTestCase.java new file mode 100644 index 000000000..8a548b1b5 --- /dev/null +++ b/src/test/java/org/apache/fop/render/ps/ResourceOptimizationTestCase.java @@ -0,0 +1,213 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.ps; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.util.Arrays; +import java.util.Collection; +import java.util.Set; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import org.apache.commons.io.IOUtils; + +import org.apache.xmlgraphics.ps.DSCConstants; +import org.apache.xmlgraphics.ps.PSResource; +import org.apache.xmlgraphics.ps.dsc.DSCException; +import org.apache.xmlgraphics.ps.dsc.DSCListener; +import org.apache.xmlgraphics.ps.dsc.DSCParser; +import org.apache.xmlgraphics.ps.dsc.DefaultNestedDocumentHandler; +import org.apache.xmlgraphics.ps.dsc.events.AbstractResourcesDSCComment; +import org.apache.xmlgraphics.ps.dsc.events.DSCAtend; +import org.apache.xmlgraphics.ps.dsc.events.DSCCommentBeginDocument; +import org.apache.xmlgraphics.ps.dsc.events.DSCCommentDocumentNeededResources; +import org.apache.xmlgraphics.ps.dsc.events.DSCCommentDocumentSuppliedResources; +import org.apache.xmlgraphics.ps.dsc.events.DSCCommentEndOfFile; +import org.apache.xmlgraphics.ps.dsc.events.DSCCommentIncludeResource; +import org.apache.xmlgraphics.ps.dsc.events.DSCCommentPage; +import org.apache.xmlgraphics.ps.dsc.events.DSCCommentPages; + +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.render.intermediate.IFContext; + +/** + * Tests the PostScript resource optimization (selective de-duplication of + * images that are used multiple times). + */ +public class ResourceOptimizationTestCase extends AbstractPostScriptTest { + + /** + * Tests resource optimization. + * @throws Exception if an error occurs + */ + @Test + public void testResourceOptimization() throws Exception { + FOUserAgent ua = fopFactory.newFOUserAgent(); + PSDocumentHandler handler = new PSDocumentHandler(new IFContext(ua)); + // This is the important part: we're enabling resource optimization + handler.getPSUtil().setOptimizeResources(true); + ua.setDocumentHandlerOverride(handler); + + // Prepare output file + File outputFile = renderFile(ua, "ps-resources.fo", + "-if-l" + handler.getPSUtil().getLanguageLevel()); + verifyPostScriptFile(outputFile); + } + + private void verifyPostScriptFile(File psFile) throws IOException, DSCException { + InputStream in = new java.io.FileInputStream(psFile); + in = new java.io.BufferedInputStream(in); + try { + DSCParser parser = new DSCParser(in); + parser.setCheckEOF(false); + + //The first form is for arrow_down_small.png (to be reused) + PSResource form1 = new PSResource(PSResource.TYPE_FORM, "FOPForm:1"); + PSResource helvetica = new PSResource(PSResource.TYPE_FONT, "Helvetica"); + PSResource helveticaBold = new PSResource(PSResource.TYPE_FONT, "Helvetica-Bold"); + + PSResource res; + DSCCommentPages pages = (DSCCommentPages)gotoDSCComment(parser, DSCConstants.PAGES); + assertEquals(2, pages.getPageCount()); + + DSCCommentDocumentSuppliedResources supplied + = (DSCCommentDocumentSuppliedResources)gotoDSCComment(parser, + DSCConstants.DOCUMENT_SUPPLIED_RESOURCES); + Set resources = supplied.getResources(); + assertEquals(5, resources.size()); + assertTrue(resources.contains(form1)); + assertTrue("Expected barcode.eps as supplied resource", + resources.contains(new PSResource(PSResource.TYPE_FILE, + "test/resources/images/barcode.eps"))); + + DSCCommentDocumentNeededResources needed + = (DSCCommentDocumentNeededResources)gotoDSCComment(parser, + DSCConstants.DOCUMENT_NEEDED_RESOURCES); + resources = needed.getResources(); + assertEquals(2, resources.size()); + assertTrue("Expected Helvetica as needed resource", + resources.contains(new PSResource(PSResource.TYPE_FONT, "Helvetica"))); + assertTrue("Expected Helvetica-Bold as needed resource", + resources.contains(new PSResource(PSResource.TYPE_FONT, "Helvetica-Bold"))); + + //Some document structure checking + assertNotNull(gotoDSCComment(parser, DSCConstants.BEGIN_DEFAULTS)); + assertNotNull(gotoDSCComment(parser, DSCConstants.END_DEFAULTS)); + assertNotNull(gotoDSCComment(parser, DSCConstants.BEGIN_PROLOG)); + assertNotNull(gotoDSCComment(parser, DSCConstants.END_PROLOG)); + assertNotNull(gotoDSCComment(parser, DSCConstants.BEGIN_SETUP)); + + //Check includes for the two referenced base 14 fonts + DSCCommentIncludeResource include; + Collection strings = new java.util.HashSet( + Arrays.asList(new String[] {"Helvetica", "Helvetica-Bold"})); + for (int i = 0; i < 2; i++) { + include = (DSCCommentIncludeResource)gotoDSCComment( + parser, DSCConstants.INCLUDE_RESOURCE); + res = include.getResource(); + assertEquals(PSResource.TYPE_FONT, res.getType()); + strings.remove(res.getName()); + } + assertEquals(0, strings.size()); + + checkResourceComment(parser, DSCConstants.BEGIN_RESOURCE, + new PSResource(PSResource.TYPE_ENCODING, "WinAnsiEncoding")); + + //Here, we encounter form 1 again + checkResourceComment(parser, DSCConstants.BEGIN_RESOURCE, form1); + + assertNotNull(gotoDSCComment(parser, DSCConstants.END_SETUP)); + //Now the actual pages begin + + //---=== Page 1 ===--- + DSCCommentPage page = (DSCCommentPage)gotoDSCComment(parser, DSCConstants.PAGE); + assertEquals(1, page.getPagePosition()); + + assertEquals(DSCAtend.class, + gotoDSCComment(parser, DSCConstants.PAGE_RESOURCES).getClass()); + assertNotNull(gotoDSCComment(parser, DSCConstants.BEGIN_PAGE_SETUP)); + assertNotNull(gotoDSCComment(parser, DSCConstants.END_PAGE_SETUP)); + + PSResource form2 = new PSResource(PSResource.TYPE_FORM, "FOPForm:2"); + checkResourceComment(parser, DSCConstants.BEGIN_RESOURCE, form2); + assertNotNull(gotoDSCComment(parser, DSCConstants.PAGE_TRAILER)); + + AbstractResourcesDSCComment pageResources; + pageResources = (AbstractResourcesDSCComment)gotoDSCComment( + parser, DSCConstants.PAGE_RESOURCES); + resources = pageResources.getResources(); + assertEquals(5, resources.size()); + assertTrue(resources.contains(form1)); + assertTrue(resources.contains(form2)); + assertTrue(resources.contains(helvetica)); + assertTrue(resources.contains(helveticaBold)); + + //---=== Page 2 ===--- + page = (DSCCommentPage)gotoDSCComment(parser, DSCConstants.PAGE); + assertEquals(2, page.getPagePosition()); + + assertEquals(DSCAtend.class, + gotoDSCComment(parser, DSCConstants.PAGE_RESOURCES).getClass()); + assertNotNull(gotoDSCComment(parser, DSCConstants.BEGIN_PAGE_SETUP)); + assertNotNull(gotoDSCComment(parser, DSCConstants.END_PAGE_SETUP)); + + DSCCommentBeginDocument beginDocument; + beginDocument = (DSCCommentBeginDocument)gotoDSCComment( + parser, DSCConstants.BEGIN_DOCUMENT); + assertEquals("test/resources/images/barcode.eps", + beginDocument.getResource().getName()); + DSCListener listener = new DefaultNestedDocumentHandler(null); + listener.processEvent(beginDocument, parser); + + //And again (the barcode is generated twice) + beginDocument = (DSCCommentBeginDocument)gotoDSCComment( + parser, DSCConstants.BEGIN_DOCUMENT); + assertEquals("test/resources/images/barcode.eps", + beginDocument.getResource().getName()); + listener.processEvent(beginDocument, parser); + + assertNotNull(gotoDSCComment(parser, DSCConstants.PAGE_TRAILER)); + pageResources = (AbstractResourcesDSCComment)gotoDSCComment( + parser, DSCConstants.PAGE_RESOURCES); + resources = pageResources.getResources(); + assertEquals(6, resources.size()); + assertTrue(resources.contains(form1)); + assertFalse(resources.contains(form2)); + assertTrue(resources.contains(helvetica)); + assertTrue(resources.contains(helveticaBold)); + assertTrue(resources.contains(beginDocument.getResource())); + + assertNotNull(gotoDSCComment(parser, DSCConstants.TRAILER)); + //No headers in between, as they should have been put at the beginning of the file + assertEquals(DSCCommentEndOfFile.class, parser.nextEvent().asDSCComment().getClass()); + + } finally { + IOUtils.closeQuietly(in); + } + } + +} diff --git a/src/test/java/org/apache/fop/render/ps/fonts/PSTTFGeneratorTestCase.java b/src/test/java/org/apache/fop/render/ps/fonts/PSTTFGeneratorTestCase.java new file mode 100644 index 000000000..f7f311ff8 --- /dev/null +++ b/src/test/java/org/apache/fop/render/ps/fonts/PSTTFGeneratorTestCase.java @@ -0,0 +1,120 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.ps.fonts; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import org.apache.xmlgraphics.ps.PSGenerator; + +/** + * The test class for org.apache.fop.render.ps.fonts.PSGenerator + */ +public class PSTTFGeneratorTestCase { + private PSTTFGenerator ttfGen; + private ByteArrayOutputStream out = new ByteArrayOutputStream(); + private PSGenerator gen = new PSGenerator(out); + private byte[] byteArray; + + /** + * Constructor + */ + public PSTTFGeneratorTestCase() { + byteArray = new byte[65536]; + for (int i = 0; i < 65536; i++) { + byteArray[i] = (byte) i; + } + } + + @Before + public void setUp() { + ttfGen = new PSTTFGenerator(gen); + } + + /** + * Tests startString() - starts the string in an appropriate way for a PostScript file. + * @exception IOException write error + */ + @Test + public void testStartString() throws IOException { + ttfGen.startString(); + assertEquals("<\n", out.toString()); + } + + /** + * Test streamBytes() - tests that strings are written to file in the proper format. + * @throws IOException write error. + */ + @Test + public void testStreamBytes() throws IOException { + ttfGen.streamBytes(byteArray, 0, 16); + assertEquals("000102030405060708090A0B0C0D0E0F", out.toString()); + /* + * 65520 is the closes multiple of 80 to 65535 (max string size in PS document) and since + * one byte takes up two characters, 65520 / 2 - 16 (16 bytes already written)= 32744. + */ + ttfGen.streamBytes(byteArray, 0, 32744); + // Using a regex to ensure that the format is correct + assertTrue(out.toString().matches("([0-9A-F]{80}\n){819}")); + try { + ttfGen.streamBytes(byteArray, 0, PSTTFGenerator.MAX_BUFFER_SIZE + 1); + fail("Shouldn't be able to write more than MAX_BUFFER_SIZE to a PS document"); + } catch (UnsupportedOperationException e) { + // PASS + } + } + + /** + * Test reset() - reset should reset the line counter such that when reset() is invoked the + * following string streamed to the PS document should be 80 chars long. + * @throws IOException file write error. + */ + @Test + public void testReset() throws IOException { + ttfGen.streamBytes(byteArray, 0, 40); + assertTrue(out.toString().matches("([0-9A-F]{80}\n)")); + ttfGen.streamBytes(byteArray, 0, 40); + assertTrue(out.toString().matches("([0-9A-F]{80}\n){2}")); + + } + + /** + * Test endString() - ensures strings are ended in the PostScript document in the correct + * format, a "00" needs to be appended to the end of a string. + * @throws IOException file write error + */ + @Test + public void testEndString() throws IOException { + ttfGen.endString(); + assertEquals("00\n> ", out.toString()); + out.reset(); + // we need to check that this doesn't write more than 80 chars per line + ttfGen.streamBytes(byteArray, 0, 40); + ttfGen.endString(); + assertTrue(out.toString().matches("([0-9A-F]{80}\n)00\n> ")); + } +} diff --git a/src/test/java/org/apache/fop/render/ps/fonts/PSTTFGlyphOutputStreamTestCase.java b/src/test/java/org/apache/fop/render/ps/fonts/PSTTFGlyphOutputStreamTestCase.java new file mode 100644 index 000000000..82b4364c3 --- /dev/null +++ b/src/test/java/org/apache/fop/render/ps/fonts/PSTTFGlyphOutputStreamTestCase.java @@ -0,0 +1,109 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.ps.fonts; + +import java.io.IOException; + +import org.junit.Before; +import org.junit.Test; +import org.mockito.InOrder; + +import static org.junit.Assert.fail; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +/** + * Test class for PSTTFGlyphOutputStream + */ +public class PSTTFGlyphOutputStreamTestCase { + private PSTTFGenerator mockGen; + private PSTTFGlyphOutputStream glyphOut; + + @Before + public void setUp() { + mockGen = mock(PSTTFGenerator.class); + glyphOut = new PSTTFGlyphOutputStream(mockGen); + } + + /** + * Test startGlyphStream() - test that startGlyphStream() invokes reset() and startString() in + * PSTTFGenerator. + * @exception IOException file write error + */ + @Test + public void testStartGlyphStream() throws IOException { + glyphOut.startGlyphStream(); + verify(mockGen).startString(); + } + + /** + * Test streamGlyph(byte[],int,int) - tests several paths: + * 1) strings are properly appended + * 2) when total strings size > PSTTFGenerator.MAX_BUFFER_SIZE, the strings is closed and a new + * strings is started. + * 3) if a glyph of size > PSTTFGenerator.MAX_BUFFER_SIZE is attempted, an exception is thrown. + * @throws IOException file write error. + */ + @Test + public void testStreamGlyph() throws IOException { + int byteArraySize = 10; + byte[] byteArray = new byte[byteArraySize]; + int runs = 100; + for (int i = 0; i < runs; i++) { + glyphOut.streamGlyph(byteArray, 0, byteArraySize); + } + verify(mockGen, times(runs)).streamBytes(byteArray, 0, byteArraySize); + + /* + * We want to run this for MAX_BUFFER_SIZE / byteArraySize so that go over the string + * boundary and enforce the ending and starting of a new string. Using mockito to ensure + * that this behaviour is performed in order (since this is an integral behavioural aspect) + */ + int stringLimit = PSTTFGenerator.MAX_BUFFER_SIZE / byteArraySize; + for (int i = 0; i < stringLimit; i++) { + glyphOut.streamGlyph(byteArray, 0, byteArraySize); + } + InOrder inOrder = inOrder(mockGen); + inOrder.verify(mockGen, times(stringLimit)).streamBytes(byteArray, 0, byteArraySize); + inOrder.verify(mockGen).endString(); + inOrder.verify(mockGen).startString(); + inOrder.verify(mockGen, times(runs)).streamBytes(byteArray, 0, byteArraySize); + + try { + glyphOut.streamGlyph(byteArray, 0, PSTTFGenerator.MAX_BUFFER_SIZE + 1); + fail("Shouldn't allow a length > PSTTFGenerator.MAX_BUFFER_SIZE"); + } catch (UnsupportedOperationException e) { + // PASS + } + } + + /** + * Test endGlyphStream() - tests that PSTTFGenerator.endString() is invoked when this method + * is called. + * @throws IOException file write exception + */ + @Test + public void testEndGlyphStream() throws IOException { + glyphOut.endGlyphStream(); + verify(mockGen).endString(); + } +} diff --git a/src/test/java/org/apache/fop/render/ps/fonts/PSTTFOutputStreamTestCase.java b/src/test/java/org/apache/fop/render/ps/fonts/PSTTFOutputStreamTestCase.java new file mode 100644 index 000000000..744f17f64 --- /dev/null +++ b/src/test/java/org/apache/fop/render/ps/fonts/PSTTFOutputStreamTestCase.java @@ -0,0 +1,90 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.ps.fonts; + +import java.io.IOException; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; + +import org.apache.xmlgraphics.ps.PSGenerator; + +import org.apache.fop.fonts.truetype.TTFGlyphOutputStream; +import org.apache.fop.fonts.truetype.TTFTableOutputStream; + +/** + * Tests PSTTFOuputStream + */ +public class PSTTFOutputStreamTestCase { + private PSGenerator gen; + private PSTTFOutputStream out; + + /** + * Assigns an OutputStream to the PSGenerator. + */ + @Before + public void setUp() { + gen = mock(PSGenerator.class); + out = new PSTTFOutputStream(gen); + } + + /** + * Test startFontStream() - Just tests that the font is properly initiated in the PostScript + * document (in this case with "/sfnts[") + * @throws IOException write exception. + */ + @Test + public void testStartFontStream() throws IOException { + out.startFontStream(); + verify(gen).write("/sfnts["); + } + + /** + * Test getTableOutputStream() - we need to test that the inheritance model is properly obeyed. + */ + @Test + public void testGetTableOutputStream() { + TTFTableOutputStream tableOut = out.getTableOutputStream(); + assertTrue(tableOut instanceof PSTTFTableOutputStream); + } + + /** + * Test getGlyphOutputStream() - we need to test that the inheritance model is properly obeyed. + */ + @Test + public void testGetGlyphOutputStream() { + TTFGlyphOutputStream glyphOut = out.getGlyphOutputStream(); + assertTrue(glyphOut instanceof PSTTFGlyphOutputStream); + } + + /** + * Test endFontStream() + * @exception IOException write error. + */ + @Test + public void testEndFontStream() throws IOException { + out.endFontStream(); + verify(gen).writeln("] def"); + } +} diff --git a/src/test/java/org/apache/fop/render/ps/fonts/PSTTFTableOutputStreamTestCase.java b/src/test/java/org/apache/fop/render/ps/fonts/PSTTFTableOutputStreamTestCase.java new file mode 100644 index 000000000..c20c3d8b1 --- /dev/null +++ b/src/test/java/org/apache/fop/render/ps/fonts/PSTTFTableOutputStreamTestCase.java @@ -0,0 +1,87 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.ps.fonts; + +import java.io.IOException; + +import org.junit.Before; +import org.junit.Test; +import org.mockito.InOrder; + +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.mock; + +/** + * Test class for unit testing PSTTFTableOutputStream + */ +public class PSTTFTableOutputStreamTestCase { + private PSTTFGenerator mockGen; + private PSTTFTableOutputStream tableOut; + + @Before + public void setUp() { + mockGen = mock(PSTTFGenerator.class); + tableOut = new PSTTFTableOutputStream(mockGen); + } + + /** + * Test streamTable() - several paths to test (2. and 3. test corner cases): + * 1) that a table of length < PSTTFGenerator.MAX_BUFFER_SIZE invokes the correct methods in + * PSTTFGenerator. + * 2) that a table of length > PSTTFGenerator.MAX_BUFFER_SIZE and + * length == n * PSTTFGenerator.MAX_BUFFER_SIZE is split up and the methods in PSTTFGenerator + * are invoked. + * 3) that a table of length > PSTTFGenerator.MAX_BUFFER_SIZE but + * length != n * PSTTFGenerator.MAX_BUFFER_SIZE is split up and the methods in PSTTFGenerator + * are invoked. + * @throws IOException file write error. + */ + @Test + public void testStreamTable() throws IOException { + byte[] byteArray = new byte[PSTTFGenerator.MAX_BUFFER_SIZE * 3]; + tableOut.streamTable(byteArray, 0, 10); + InOrder inOrder = inOrder(mockGen); + inOrder.verify(mockGen).startString(); + inOrder.verify(mockGen).streamBytes(byteArray, 0, 10); + inOrder.verify(mockGen).endString(); + + setUp(); // reset all all the method calls + /* We're going to run this 3 times to ensure the proper method calls are invoked and all + * the bytes are streamed */ + tableOut.streamTable(byteArray, 0, byteArray.length); + inOrder = inOrder(mockGen); + for (int i = 0; i < 3; i++) { + int offset = PSTTFGenerator.MAX_BUFFER_SIZE * i; + inOrder.verify(mockGen).startString(); + inOrder.verify(mockGen).streamBytes(byteArray, offset, PSTTFGenerator.MAX_BUFFER_SIZE); + inOrder.verify(mockGen).endString(); + } + + setUp(); // reset all the method calls + tableOut.streamTable(byteArray, 0, PSTTFGenerator.MAX_BUFFER_SIZE + 1); + inOrder = inOrder(mockGen); + inOrder.verify(mockGen).startString(); + inOrder.verify(mockGen).streamBytes(byteArray, 0, PSTTFGenerator.MAX_BUFFER_SIZE); + inOrder.verify(mockGen).endString(); + inOrder.verify(mockGen).startString(); + inOrder.verify(mockGen).streamBytes(byteArray, PSTTFGenerator.MAX_BUFFER_SIZE, 1); + inOrder.verify(mockGen).endString(); + } +} diff --git a/src/test/java/org/apache/fop/render/ps/ps-jpeg-image.fo b/src/test/java/org/apache/fop/render/ps/ps-jpeg-image.fo new file mode 100644 index 000000000..50ed2d6e4 --- /dev/null +++ b/src/test/java/org/apache/fop/render/ps/ps-jpeg-image.fo @@ -0,0 +1,35 @@ +<?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. +--> +<!-- $Id$ --> +<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> + <fo:layout-master-set> + <fo:simple-page-master master-name="A4" page-height="29.7cm" page-width="21cm" margin="2cm"> + <fo:region-body/> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="A4"> + <fo:flow flow-name="xsl-region-body"> + <fo:block>JPEG image:</fo:block> + <fo:block><fo:external-graphic src="test/resources/images/bgimg72dpi.jpg"/></fo:block> + <fo:block> + <fo:external-graphic src="test/resources/images/bgimg300dpi.jpg"/> + <fo:external-graphic src="test/resources/images/bgimg300dpi.jpg"/> + </fo:block> + </fo:flow> + </fo:page-sequence> +</fo:root> diff --git a/src/test/java/org/apache/fop/render/ps/ps-resources.fo b/src/test/java/org/apache/fop/render/ps/ps-resources.fo new file mode 100644 index 000000000..7982d35bd --- /dev/null +++ b/src/test/java/org/apache/fop/render/ps/ps-resources.fo @@ -0,0 +1,50 @@ +<?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. +--> +<!-- $Id$ --> +<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> + <fo:layout-master-set> + <fo:simple-page-master master-name="A4" page-height="29.7cm" page-width="21cm" margin="2cm"> + <fo:region-body/> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="A4"> + <fo:flow flow-name="xsl-region-body"> + <fo:block font-weight="bold">PostScript Resource Optimization Test</fo:block> + <fo:block>Used again later:</fo:block> + <fo:block><fo:external-graphic src="test/resources/images/arrow_down_small.png"/></fo:block> + <fo:block>Used only once in the whole document:</fo:block> + <fo:block><fo:external-graphic src="test/resources/images/arrow_up_small.png"/></fo:block> + </fo:flow> + </fo:page-sequence> + <fo:page-sequence master-reference="A4"> + <fo:flow flow-name="xsl-region-body"> + <fo:block font-weight="bold">PostScript Resource Optimization Test</fo:block> + <fo:block>Image already used in previous page-sequence:</fo:block> + <fo:block> + <fo:external-graphic src="test/resources/images/arrow_down_small.png" content-width="80%"/> + <fo:external-graphic src="test/resources/images/arrow_down_small.png"/> + <fo:external-graphic src="test/resources/images/arrow_down_small.png" content-width="120%"/> + </fo:block> + <fo:block>Can't currently reuse EPS images:</fo:block> + <fo:block> + <fo:external-graphic src="test/resources/images/barcode.eps"/> + <fo:external-graphic src="test/resources/images/barcode.eps"/> + </fo:block> + </fo:flow> + </fo:page-sequence> +</fo:root> diff --git a/src/test/java/org/apache/fop/render/ps/svg/GradientTestCase.java b/src/test/java/org/apache/fop/render/ps/svg/GradientTestCase.java new file mode 100644 index 000000000..908c60350 --- /dev/null +++ b/src/test/java/org/apache/fop/render/ps/svg/GradientTestCase.java @@ -0,0 +1,76 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.ps.svg; + +import java.awt.Color; +import java.io.ByteArrayOutputStream; +import java.io.IOException; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +import org.apache.commons.io.IOUtils; + +import org.apache.batik.ext.awt.LinearGradientPaint; +import org.apache.batik.ext.awt.MultipleGradientPaint; +import org.apache.batik.ext.awt.RadialGradientPaint; + +import org.apache.xmlgraphics.java2d.GraphicContext; +import org.apache.xmlgraphics.ps.PSGenerator; + +public class GradientTestCase { + + @Test + public void testLinearGradient() throws IOException { + float[] fractions = {0f, 1f}; + Color[] colors = {new Color(255, 255, 0), new Color(255, 0, 0)}; + LinearGradientPaint gradient = new LinearGradientPaint(115f, 285f, 15f, 15f, fractions, colors); + testGradientRendering(gradient, "expected-linear-gradient.ps"); + } + + @Test + public void testRadialGradient() throws IOException { + float cx = 840f; + float cy = 180f; + float r = 16f; + float[] fractions = {0.2f, 0.6f, 0.8f, 1.0f}; + Color[] colors = { + new Color(255, 255, 255), + new Color(200, 200, 200), + new Color(170, 170, 170), + new Color(140, 140, 140)}; + RadialGradientPaint gradient = new RadialGradientPaint(cx, cy, r, fractions, colors); + testGradientRendering(gradient, "expected-radial-gradient.ps"); + } + + private void testGradientRendering(MultipleGradientPaint gradient, String expectedResourceName) + throws IOException { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + PSSVGGraphics2D svgGraphics2D = new PSSVGGraphics2D(false, new PSGenerator(out)); + svgGraphics2D.setGraphicContext(new GraphicContext()); + svgGraphics2D.translate(100, 100); + svgGraphics2D.applyPaint(gradient, true); + byte[] actual = out.toByteArray(); + byte[] expected = IOUtils.toByteArray(getClass().getResourceAsStream(expectedResourceName)); + assertEquals(new String(expected, "US-ASCII"), new String(actual, "US-ASCII")); + } + +} diff --git a/src/test/java/org/apache/fop/render/ps/svg/expected-linear-gradient.ps b/src/test/java/org/apache/fop/render/ps/svg/expected-linear-gradient.ps new file mode 100644 index 000000000..8ddc64486 --- /dev/null +++ b/src/test/java/org/apache/fop/render/ps/svg/expected-linear-gradient.ps @@ -0,0 +1,25 @@ +/Pattern setcolorspace +<< +/Type /Pattern +/PatternType 2 +/Shading << +/ShadingType 2 +/ColorSpace /DeviceRGB +/Coords [ 115 285 15 15 ] +/Extend [ true true ] +/Function << +/FunctionType 3 +/Domain [ 0 1 ] +/Functions [ << +/FunctionType 2 +/Domain [ 0 1 ] +/C0 [ 1 1 0 ] +/C1 [ 1 0 0 ] +/N 1 +>> ] +/Encode [ 0 1 ] +/Bounds [ ] +>> +>> +>> +[ 1 0 0 1 0 0 ] makepattern setcolor diff --git a/src/test/java/org/apache/fop/render/ps/svg/expected-radial-gradient.ps b/src/test/java/org/apache/fop/render/ps/svg/expected-radial-gradient.ps new file mode 100644 index 000000000..527f27965 --- /dev/null +++ b/src/test/java/org/apache/fop/render/ps/svg/expected-radial-gradient.ps @@ -0,0 +1,43 @@ +/Pattern setcolorspace +<< +/Type /Pattern +/PatternType 2 +/Shading << +/ShadingType 3 +/ColorSpace /DeviceRGB +/Coords [ 840 180 0 840 180 16 ] +/Extend [ true true ] +/Function << +/FunctionType 3 +/Domain [ 0 1 ] +/Functions [ << +/FunctionType 2 +/Domain [ 0 1 ] +/C0 [ 1 1 1 ] +/C1 [ 1 1 1 ] +/N 1 +>> << +/FunctionType 2 +/Domain [ 0 1 ] +/C0 [ 1 1 1 ] +/C1 [ 0.784 0.784 0.784 ] +/N 1 +>> << +/FunctionType 2 +/Domain [ 0 1 ] +/C0 [ 0.784 0.784 0.784 ] +/C1 [ 0.667 0.667 0.667 ] +/N 1 +>> << +/FunctionType 2 +/Domain [ 0 1 ] +/C0 [ 0.667 0.667 0.667 ] +/C1 [ 0.549 0.549 0.549 ] +/N 1 +>> ] +/Encode [ 0 1 0 1 0 1 0 1 ] +/Bounds [ 0.2 0.6 0.8 ] +>> +>> +>> +[ 1 0 0 1 0 0 ] makepattern setcolor diff --git a/src/test/java/org/apache/fop/render/rtf/Bug39607TestCase.java b/src/test/java/org/apache/fop/render/rtf/Bug39607TestCase.java new file mode 100644 index 000000000..4c3c8446e --- /dev/null +++ b/src/test/java/org/apache/fop/render/rtf/Bug39607TestCase.java @@ -0,0 +1,66 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.rtf; + +import java.io.StringWriter; + +import org.junit.Test; + +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfDocumentArea; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfFile; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfParagraph; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTable; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTableRow; + +/** + * Test for http://issues.apache.org/bugzilla/show_bug.cgi?id=39607 + */ +public class Bug39607TestCase { + + /** + * Test for the NPE describes in bug 39607 + * @throws Exception If an error occurs + */ + @Test + public void testForNPE() throws Exception { + StringWriter writer = new StringWriter(); + RtfFile f = new RtfFile(writer); + + RtfDocumentArea doc = f.startDocumentArea(); + + RtfSection section = doc.newSection(); + + RtfParagraph paragraph = section.newParagraph(); + paragraph.newText("Testing fop - rtf module - class RtfTableRow"); + paragraph.close(); + + RtfTable table = section.newTable(null); + RtfTableRow row = table.newTableRow(); + row.newTableCell(2000).newParagraph().newText("blah"); + row.newTableCell(5000).newParagraph().newText("doubleBlah"); + row.close(); + table.close(); + section.close(); + doc.close(); + f.flush(); + } + +} diff --git a/src/test/java/org/apache/fop/render/rtf/RichTextFormatTestSuite.java b/src/test/java/org/apache/fop/render/rtf/RichTextFormatTestSuite.java new file mode 100644 index 000000000..5b294bd9b --- /dev/null +++ b/src/test/java/org/apache/fop/render/rtf/RichTextFormatTestSuite.java @@ -0,0 +1,32 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.rtf; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +/** + * Test suite for FOP's RTF library. + */ +@RunWith(Suite.class) +@SuiteClasses(Bug39607TestCase.class) +public class RichTextFormatTestSuite { +} diff --git a/src/test/java/org/apache/fop/render/rtf/rtflib/testdocs/BasicLink.java b/src/test/java/org/apache/fop/render/rtf/rtflib/testdocs/BasicLink.java new file mode 100644 index 000000000..9df1c26ef --- /dev/null +++ b/src/test/java/org/apache/fop/render/rtf/rtflib/testdocs/BasicLink.java @@ -0,0 +1,84 @@ +/* + * 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. + */ + +/* $Id$ */ + + +/* + * This file is part of the RTF library of the FOP project, which was originally + * created by Bertrand Delacretaz <bdelacretaz@codeconsult.ch> and by other + * contributors to the jfor project (www.jfor.org), who agreed to donate jfor to + * the FOP project. + */ + +package org.apache.fop.render.rtf.rtflib.testdocs; + +import java.io.IOException; + +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfDocumentArea; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfHyperLink; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfParagraph; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection; + +/** + * Class <code>BasicLink</code> here. + */ + +public class BasicLink extends TestDocument { + ////////////////////////////////////////////////// + // @@ Construction + ////////////////////////////////////////////////// + + /** + * Default constructor. + */ + public BasicLink() { + } + + /** generate the body of the test document + * @param rda RtfDocumentArea + * @param sect RtfSection + * @throws IOException for I/O Errors + */ + protected void generateDocument(RtfDocumentArea rda, RtfSection sect) throws IOException { + RtfParagraph p = sect.newParagraph(); + p.newLineBreak(); + p.newLineBreak(); + p.newLineBreak(); + p.newText("external link: "); + RtfHyperLink link = p.newHyperLink("click here to go to the hompage", null); + link.setExternalURL("http://www.skynamics.com"); + p.close(); + + p = sect.newParagraph(); + p.newLineBreak(); + p.newText("here we will demonstrate internal link to a bookmark"); + p.newLineBreak(); + p.newText("internal link: "); + link = p.newHyperLink("click here to go to the bookmark", null); + link.setInternalURL("testBookmark"); + p.close(); + + p = sect.newParagraph(); + p.newLineBreak(); + p.newLineBreak(); + p.newLineBreak(); + p.newPageBreak(); + p.newBookmark("testBookmark"); + p.newText("testBookmark"); + } +} diff --git a/src/test/java/org/apache/fop/render/rtf/rtflib/testdocs/CreateTestDocuments.java b/src/test/java/org/apache/fop/render/rtf/rtflib/testdocs/CreateTestDocuments.java new file mode 100644 index 000000000..7f17514ef --- /dev/null +++ b/src/test/java/org/apache/fop/render/rtf/rtflib/testdocs/CreateTestDocuments.java @@ -0,0 +1,107 @@ +/* + * 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. + */ + +/* $Id$ */ + + +/* + * This file is part of the RTF library of the FOP project, which was originally + * created by Bertrand Delacretaz <bdelacretaz@codeconsult.ch> and by other + * contributors to the jfor project (www.jfor.org), who agreed to donate jfor to + * the FOP project. + */ + +package org.apache.fop.render.rtf.rtflib.testdocs; + +import java.io.File; +import java.io.IOException; + +/** Create test RTF documents from classes found in this package. + */ + +public class CreateTestDocuments { + + /** + * package name for the testdocs + */ + public static final String TESTDOCS_PACKAGE = "org.apache.fop.render.rtf.rtflib.testdocs"; + + /** List of all TestDocument subclasses from this package */ + private static final String [] CLASS_NAMES = { + "SimpleDocument", + "TextAttributes", + "SimpleTable", + "SimpleLists", + "ListInTable", + "Whitespace", + "MergedTableCells", + "NestedTable", + "ExternalGraphic", + "BasicLink", + "ParagraphAlignment" + }; + + CreateTestDocuments(File outDir) + throws Exception { + if (!outDir.isDirectory() || !outDir.canWrite()) { + throw new IOException("output directory (" + outDir + ") must exist and be writable"); + } + + for (int i = 0; i < CLASS_NAMES.length; i++) { + createOneTestDocument(CLASS_NAMES[i], outDir); + } + } + + /** instantiate one TestDocument and let it generate its document */ + void createOneTestDocument(String className, File outDir) + throws Exception { + className = TESTDOCS_PACKAGE + "." + className; + TestDocument td = null; + try { + td = (TestDocument)Class.forName(className).newInstance(); + } catch (Exception e) { + throw new Exception("unable to instantiate '" + className + + " as a TestDocument object: " + e); + } + td.setOutputDir(outDir); + try { + td.generateOutput(); + } catch (Exception e) { + System.err.println("Error while generating test RTF document:"); + e.printStackTrace(); + } + } + + /** execute this to create test documents from all classes listed in classNames array + * @param args String array of arguments + * @throws Exception for errors + */ + public static void main(String[] args) + throws Exception { + if (args.length < 1) { + System.err.println("usage: CreateTestDocuments <output directory>"); + System.exit(1); + } + +// System.err.println("CreateTestDocuments - using " + JForVersionInfo.getLongVersionInfo()); + System.err.println("Generates documents to test the RTF library."); + final File outDir = new File(args[0]); + new CreateTestDocuments(outDir); + System.err.println("CreateTestDocuments - all done."); + System.exit(0); + } +} diff --git a/src/test/java/org/apache/fop/render/rtf/rtflib/testdocs/DummyTableColumnsInfo.java b/src/test/java/org/apache/fop/render/rtf/rtflib/testdocs/DummyTableColumnsInfo.java new file mode 100644 index 000000000..1af4c7bed --- /dev/null +++ b/src/test/java/org/apache/fop/render/rtf/rtflib/testdocs/DummyTableColumnsInfo.java @@ -0,0 +1,66 @@ +/* + * 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. + */ + +/* $Id$ */ + + +/* + * This file is part of the RTF library of the FOP project, which was originally + * created by Bertrand Delacretaz <bdelacretaz@codeconsult.ch> and by other + * contributors to the jfor project (www.jfor.org), who agreed to donate jfor to + * the FOP project. + */ + +package org.apache.fop.render.rtf.rtflib.testdocs; + +import org.apache.fop.render.rtf.rtflib.rtfdoc.ITableColumnsInfo; + +/** ITableColumnsInfo that does nothing, used in testodcs package + * to create documents without worrying about nested tables handling. + * Might need to be replaced by more complete version in some sample + * documents created by this package. + */ + +class DummyTableColumnsInfo implements ITableColumnsInfo { + + public float getColumnWidth() { + return INVALID_COLUMN_WIDTH; + } + + public void selectFirstColumn() { + } + + public int getNumberOfColumns() { + return 0; + } + + public int getColumnIndex() { + return 0; + } + + public void selectNextColumn() { + } + + /* (non-Javadoc) + * @see org.apache.fop.render.rtf.rtflib.rtfdoc.ITableColumnsInfo#getFirstSpanningCol() + */ + public boolean getFirstSpanningCol() { + // TODO Auto-generated method stub + return false; + } + +} diff --git a/src/test/java/org/apache/fop/render/rtf/rtflib/testdocs/ExternalGraphic.java b/src/test/java/org/apache/fop/render/rtf/rtflib/testdocs/ExternalGraphic.java new file mode 100644 index 000000000..1127f3e72 --- /dev/null +++ b/src/test/java/org/apache/fop/render/rtf/rtflib/testdocs/ExternalGraphic.java @@ -0,0 +1,115 @@ +/* + * 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. + */ + +/* $Id$ */ + + +/* + * This file is part of the RTF library of the FOP project, which was originally + * created by Bertrand Delacretaz <bdelacretaz@codeconsult.ch> and by other + * contributors to the jfor project (www.jfor.org), who agreed to donate jfor to + * the FOP project. + */ + +package org.apache.fop.render.rtf.rtflib.testdocs; + +import java.io.IOException; + +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfDocumentArea; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfExternalGraphic; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfParagraph; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection; +/** + * Generate a test document containing external graphics. + */ +class ExternalGraphic extends TestDocument { + private String file = "file:///tmp/jfor-images/logo."; + + ////////////////////////////////////////////////// + // @@ Construction + ////////////////////////////////////////////////// + + /** + * Default constructor. + */ + public ExternalGraphic() { + + } + /** generate the body of the test document */ + protected void generateDocument(RtfDocumentArea rda, RtfSection sect) throws IOException { + RtfParagraph p = sect.newParagraph(); + p.newLineBreak(); + p.newLineBreak(); + p.newLineBreak(); + p.newText("EMF image with 150 % height"); + p.newLineBreak(); + RtfExternalGraphic imageA = p.newImage(); + imageA.setURL(file + "emf"); + imageA.setHeight("150%"); + p.newLineBreak(); + p.close(); + + p = sect.newParagraph(); + p.newLineBreak(); + p.newText("PNG image with 150 % width"); + p.newLineBreak(); + RtfExternalGraphic imageB = sect.newImage(); + imageB.setURL(file + "png"); + imageB.setWidth("150%"); + p.newLineBreak(); + p.close(); + + p = sect.newParagraph(); + p.newLineBreak(); + p.newLineBreak(); + p.newText("JPG image with width = 200px and height = 20 px"); + p.newLineBreak(); + RtfExternalGraphic imageC = sect.newImage(); + imageC.setURL(file + "jpg"); + imageC.setWidth("200"); + imageC.setHeight("20"); + p.newLineBreak(); + p.close(); + + p = sect.newParagraph(); + p.newLineBreak(); + p.newLineBreak(); + p.newText("GIF image with width = 200px and scaling = 'uniform', that means the image " + + "size will adjusted automatically"); + p.newLineBreak(); + RtfExternalGraphic imageD = sect.newImage(); + imageD.setURL(file + "gif"); + imageD.setWidth("200"); + imageD.setScaling("uniform"); + p.newLineBreak(); + p.close(); + + p = sect.newParagraph(); + p.newLineBreak(); + p.newLineBreak(); + p.newText("GIF image"); + p.newLineBreak(); + RtfExternalGraphic imageE = sect.newImage(); + imageE.setURL(file + "gif"); + p.newLineBreak(); + p.close(); + + } + + + +} diff --git a/src/test/java/org/apache/fop/render/rtf/rtflib/testdocs/ListInTable.java b/src/test/java/org/apache/fop/render/rtf/rtflib/testdocs/ListInTable.java new file mode 100644 index 000000000..6f4e27a59 --- /dev/null +++ b/src/test/java/org/apache/fop/render/rtf/rtflib/testdocs/ListInTable.java @@ -0,0 +1,79 @@ +/* + * 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. + */ + +/* $Id$ */ + + +/* + * This file is part of the RTF library of the FOP project, which was originally + * created by Bertrand Delacretaz <bdelacretaz@codeconsult.ch> and by other + * contributors to the jfor project (www.jfor.org), who agreed to donate jfor to + * the FOP project. + */ + +package org.apache.fop.render.rtf.rtflib.testdocs; + +import java.io.IOException; + +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfDocumentArea; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfList; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListItem; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfParagraph; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTable; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTableCell; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTableRow; + +/** Generates a simple RTF test document for the jfor rtflib package. + */ + +class ListInTable extends TestDocument { + /** generate the body of the test document */ + protected void generateDocument(RtfDocumentArea rda, RtfSection sect) + throws IOException { + sect.newParagraph().newText("There must be a table below where the " + + "second cell contains a bulleted list mixed with normal paragraphs"); + + final RtfTable tbl = sect.newTable(new DummyTableColumnsInfo()); + final RtfTableRow row = tbl.newTableRow(); + row.newTableCell(RtfTableCell.DEFAULT_CELL_WIDTH).newParagraph().newText("cell A, simple"); + + final RtfTableCell c = row.newTableCell(RtfTableCell.DEFAULT_CELL_WIDTH); + c.newParagraph().newText("cell B, contains this paragraph followed by " + + "a list and another paragraph"); + fillList(c.newList(null), 1, 3); + c.newParagraph().newText("Normal paragraph, follows the list."); + + row.newTableCell(RtfTableCell.DEFAULT_CELL_WIDTH).newParagraph().newText("cell C, simple"); + } + + private void fillList(RtfList list, int listIndex, int nItems) + throws IOException { + for (int i = 0; i < nItems; i++) { + final RtfListItem item = list.newListItem(); + for (int j = 0; j <= i; j++) { + final RtfParagraph para = item.newParagraph(); + para.newText("List " + listIndex + ", item " + i + ", paragraph " + j); + if (i == 0 && j == 0) { + final String txt = "This item takes more than one line to check word-wrapping."; + para.newText(". " + "This list must have " + nItems + + " items. " + txt + " " + txt + " " + txt); + } + } + } + } +} diff --git a/src/test/java/org/apache/fop/render/rtf/rtflib/testdocs/MergedTableCells.java b/src/test/java/org/apache/fop/render/rtf/rtflib/testdocs/MergedTableCells.java new file mode 100644 index 000000000..9be5e899a --- /dev/null +++ b/src/test/java/org/apache/fop/render/rtf/rtflib/testdocs/MergedTableCells.java @@ -0,0 +1,117 @@ +/* + * 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. + */ + +/* $Id$ */ + + +/* + * This file is part of the RTF library of the FOP project, which was originally + * created by Bertrand Delacretaz <bdelacretaz@codeconsult.ch> and by other + * contributors to the jfor project (www.jfor.org), who agreed to donate jfor to + * the FOP project. + */ + +package org.apache.fop.render.rtf.rtflib.testdocs; + +import java.io.IOException; + +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfDocumentArea; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTable; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTableCell; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTableRow; + +/** Generates an RTF test document containing merged table cells + */ + +class MergedTableCells extends TestDocument { + static final int MM_TO_TWIPS = (int)(1440f / 25.4f); + + /** generate the body of the test document */ + protected void generateDocument(RtfDocumentArea rda, RtfSection sect) + throws IOException { + sect.newParagraph().newText("This document contains a table with some merged cells."); + + final RtfTable tbl = sect.newTable(new DummyTableColumnsInfo()); + + // first row, test horizontal merging + { + RtfTableRow r = tbl.newTableRow(); + RtfTableCell c = r.newTableCell(80 * MM_TO_TWIPS); + c.setHMerge(RtfTableCell.MERGE_START); + c.newParagraph().newText("cell 0,0, width 80mm, merge start, " + + "followed by two merged cells totalling 80mm width."); + + c = r.newTableCell(40 * MM_TO_TWIPS); + c.setHMerge(RtfTableCell.MERGE_WITH_PREVIOUS); + c.newParagraph().newText("THIS IS IN AN HMERGED CELL, MUST NOT APPEAR IN RTF DOCUMENT"); + + c = r.newTableCell(40 * MM_TO_TWIPS); + c.setHMerge(RtfTableCell.MERGE_WITH_PREVIOUS); + c.newParagraph().newText("THIS IS IN AN HMERGED CELL, MUST NOT APPEAR IN RTF DOCUMENT"); + } + + // second row, start vertical merging in column 1 + { + RtfTableRow r = tbl.newTableRow(); + RtfTableCell c = r.newTableCell(40 * MM_TO_TWIPS); + c.setVMerge(RtfTableCell.MERGE_START); + c.newParagraph().newText("cell 1,0, vertical merge start, 40mm, spans three rows."); + + r.newTableCell(80 * MM_TO_TWIPS).newParagraph().newText("cell 1,1, no merge, 80mm"); + + c = r.newTableCell(40 * MM_TO_TWIPS); + c.setVMerge(RtfTableCell.MERGE_START); + c.newParagraph().newText("cell 1,2, vertical merge start, 40mm, spans two rows."); + } + + // third row, column 1 merged with previous row + { + RtfTableRow r = tbl.newTableRow(); + RtfTableCell c = r.newTableCell(40 * MM_TO_TWIPS); + c.setVMerge(RtfTableCell.MERGE_WITH_PREVIOUS); + c.newParagraph().newText("cell 2,0, VMERGED CELL, MUST NOT APPEAR IN RTF DOCUMENT"); + + r.newTableCell(40 * MM_TO_TWIPS).newParagraph().newText("cell 2,1, no merge, 40mm"); + r.newTableCell(40 * MM_TO_TWIPS).newParagraph().newText("cell 2,2, no merge, 40mm"); + + c = r.newTableCell(40 * MM_TO_TWIPS); + c.setVMerge(RtfTableCell.MERGE_WITH_PREVIOUS); + c.newParagraph().newText("cell 2,3, VMERGED CELL, MUST NOT APPEAR IN RTF DOCUMENT"); + } + + // fourth row, column 1 merged with previous row + { + RtfTableRow r = tbl.newTableRow(); + RtfTableCell c = r.newTableCell(40 * MM_TO_TWIPS); + c.setVMerge(RtfTableCell.MERGE_WITH_PREVIOUS); + c.newParagraph().newText("cell 3,0, VMERGED CELL, MUST NOT APPEAR IN RTF DOCUMENT"); + + r.newTableCell(10 * MM_TO_TWIPS).newParagraph().newText("cell 3,1, no merge, 10mm"); + r.newTableCell(30 * MM_TO_TWIPS).newParagraph().newText("cell 3,2, no merge, 30mm"); + r.newTableCell(40 * MM_TO_TWIPS).newParagraph().newText("cell 3,3, no merge, 40mm"); + r.newTableCell(40 * MM_TO_TWIPS).newParagraph().newText("cell 3,4, no merge, 40mm"); + } + + // fifth row, just one cell + { + RtfTableRow r = tbl.newTableRow(); + r.newTableCell(160 * MM_TO_TWIPS).newParagraph().newText( + "cell 4,0, width 160mm, only cell in this row"); + } + } +} diff --git a/src/test/java/org/apache/fop/render/rtf/rtflib/testdocs/NestedTable.java b/src/test/java/org/apache/fop/render/rtf/rtflib/testdocs/NestedTable.java new file mode 100644 index 000000000..c11fbc334 --- /dev/null +++ b/src/test/java/org/apache/fop/render/rtf/rtflib/testdocs/NestedTable.java @@ -0,0 +1,214 @@ +/* + * 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. + */ + +/* $Id$ */ + + +/* + * This file is part of the RTF library of the FOP project, which was originally + * created by Bertrand Delacretaz <bdelacretaz@codeconsult.ch> and by other + * contributors to the jfor project (www.jfor.org), who agreed to donate jfor to + * the FOP project. + */ + +package org.apache.fop.render.rtf.rtflib.testdocs; + +import java.io.IOException; + +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfDocumentArea; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfParagraph; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTable; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTableCell; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTableRow; + +/** Generates an RTF document to test nested tables with the jfor rtflib package. + */ + +class NestedTable extends TestDocument { + private static final int MM_TO_TWIPS = (int)(1440f / 25.4f); + + /** generate the body of the test document */ + protected void generateDocument(RtfDocumentArea rda, RtfSection sect) + throws IOException { + sect.newParagraph().newText("This document demonstrates pseudo-nested " + + "tables created using merged table cells"); + + firstTestTable(sect); + RtfParagraph p = sect.newParagraph(); + p.newText("Test continues on next page."); + p.newPageBreak(); + secondTestTable(sect); + + p = sect.newParagraph(); + p.newText("Test continues on next page."); + p.newPageBreak(); + thirdTestTable(sect); + + sect.newParagraph().newText("End of nested tables test document"); + } + + private void firstTestTable(RtfSection sect) + throws IOException { + + sect.newParagraph().newText("First test: table with one nested table in cell 1,1"); + final RtfTable tbl = sect.newTable(new DummyTableColumnsInfo()); + // first row, normal + { + RtfTableRow r = tbl.newTableRow(); + RtfTableCell c = r.newTableCell(160 * MM_TO_TWIPS); + c.newParagraph().newText("cell 0,0, width 160mm, only cell in this row."); + } + + // second row contains nested table + { + RtfTableRow r = tbl.newTableRow(); + r.newTableCell(40 * MM_TO_TWIPS).newParagraph().newText( + "cell 1,0, width 40mm, to the left of nested table."); + + final RtfTableCell c = r.newTableCell(80 * MM_TO_TWIPS); + c.newParagraph().newText("cell 1,1, width 80mm, this text is " + + "followed by a nested table in the same cell, followed " + + "by text that says 'AFTER NESTED TABLE'."); + fillNestedTable(c.newTable(new DummyTableColumnsInfo()), 1); + c.newParagraph().newText("AFTER NESTED TABLE"); + + r.newTableCell(40 * MM_TO_TWIPS).newParagraph().newText( + "cell 1,2, width 40mm, to the right of nested table."); + } + + // third row, normal + { + RtfTableRow r = tbl.newTableRow(); + r.newTableCell(80 * MM_TO_TWIPS).newParagraph().newText( + "cell 2,0, width 80mm, this row has two cells."); + r.newTableCell(80 * MM_TO_TWIPS).newParagraph().newText( + "cell 2,1, width 80mm, last cell."); + } + + } + + private void secondTestTable(RtfSection sect) + throws IOException { + sect.newParagraph().newText("Second test: table with two nested tables in cell 1,1"); + final RtfTable tbl = sect.newTable(new DummyTableColumnsInfo()); + // first row, normal + { + RtfTableRow r = tbl.newTableRow(); + RtfTableCell c = r.newTableCell(160 * MM_TO_TWIPS); + c.newParagraph().newText("second test table: cell 0,0, width 160mm, " + + "only cell in this row."); + } + + // second row contains nested table + { + RtfTableRow r = tbl.newTableRow(); + r.newTableCell(40 * MM_TO_TWIPS).newParagraph().newText( + "cell 1,0, width 40mm, to the left of nested tables."); + + final RtfTableCell c = r.newTableCell(80 * MM_TO_TWIPS); + c.newParagraph().newText("cell 1,1, width 80mm, this text is " + + "followed by a nested table in the same cell, followed " + + "by text that says 'BETWEEN', then another table, then 'AFTER'."); + fillNestedTable(c.newTable(new DummyTableColumnsInfo()), 2); + c.newParagraph().newText("BETWEEN"); + fillNestedTable(c.newTable(new DummyTableColumnsInfo()), 3); + c.newParagraph().newText("AFTER"); + + r.newTableCell(40 * MM_TO_TWIPS).newParagraph().newText( + "cell 1,2, width 40mm, to the right of nested table."); + } + + // third row, normal + { + RtfTableRow r = tbl.newTableRow(); + r.newTableCell(80 * MM_TO_TWIPS).newParagraph().newText( + "cell 2,0, width 80mm, this row has two cells."); + r.newTableCell(80 * MM_TO_TWIPS).newParagraph().newText( + "cell 2,1, width 80mm, last cell."); + } + } + + private void thirdTestTable(RtfSection sect) + throws IOException { + sect.newParagraph().newText("Third test: table with two nested tables " + + "in cell 1,1 and one nested table in cell 0,1"); + final RtfTable tbl = sect.newTable(new DummyTableColumnsInfo()); + // first row, normal + { + RtfTableRow r = tbl.newTableRow(); + RtfTableCell c = r.newTableCell(80 * MM_TO_TWIPS); + c.newParagraph().newText("third test table: cell 0,0, width 40mm, " + + "the cell to its right contains a nested table with no other text."); + c = r.newTableCell(80 * MM_TO_TWIPS); + fillNestedTable(c.newTable(new DummyTableColumnsInfo()), 4); + } + + // second row contains nested table + { + RtfTableRow r = tbl.newTableRow(); + r.newTableCell(40 * MM_TO_TWIPS).newParagraph().newText( + "cell 1,0, width 40mm, to the left of nested tables."); + + final RtfTableCell c = r.newTableCell(80 * MM_TO_TWIPS); + c.newParagraph().newText("cell 1,1, width 80mm, this text is " + + "followed by a nested table in the same cell, followed " + + "by text that says 'BETWEEN', then another table, then 'AFTER'."); + fillNestedTable(c.newTable(new DummyTableColumnsInfo()), 5); + c.newParagraph().newText("BETWEEN"); + fillNestedTable(c.newTable(new DummyTableColumnsInfo()), 6); + c.newParagraph().newText("AFTER"); + + r.newTableCell(40 * MM_TO_TWIPS).newParagraph().newText( + "cell 1,2, width 40mm, to the right of nested table."); + } + + // third row, normal + { + RtfTableRow r = tbl.newTableRow(); + r.newTableCell(80 * MM_TO_TWIPS).newParagraph().newText( + "cell 2,0, width 80mm, this row has two cells."); + r.newTableCell(80 * MM_TO_TWIPS).newParagraph().newText( + "cell 2,1, width 80mm, last cell."); + } + } + + /** fill the nested table */ + private void fillNestedTable(RtfTable tbl, int index) + throws IOException { + final String id = "TABLE " + index; + { + RtfTableRow r = tbl.newTableRow(); + r.newTableCell(80 * MM_TO_TWIPS).newParagraph().newText( + id + ":nested cell 0,0. Nested table contains 3 rows with 1,2 and 3 cells respectively" + ); + } + + { + RtfTableRow r = tbl.newTableRow(); + r.newTableCell(40 * MM_TO_TWIPS).newParagraph().newText(id + ":nested cell 1,0, 40mm."); + r.newTableCell(40 * MM_TO_TWIPS).newParagraph().newText(id + ":nested cell 1,1, 40mm."); + } + + { + RtfTableRow r = tbl.newTableRow(); + r.newTableCell(30 * MM_TO_TWIPS).newParagraph().newText(id + ":nested cell 2,0, 30mm."); + r.newTableCell(30 * MM_TO_TWIPS).newParagraph().newText(id + ":nested cell 2,1, 30mm."); + r.newTableCell(20 * MM_TO_TWIPS).newParagraph().newText(id + ":nested cell 2,2, 20mm."); + } + } +} diff --git a/src/test/java/org/apache/fop/render/rtf/rtflib/testdocs/ParagraphAlignment.java b/src/test/java/org/apache/fop/render/rtf/rtflib/testdocs/ParagraphAlignment.java new file mode 100644 index 000000000..edce3264a --- /dev/null +++ b/src/test/java/org/apache/fop/render/rtf/rtflib/testdocs/ParagraphAlignment.java @@ -0,0 +1,79 @@ +/* + * 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. + */ + +/* $Id$ */ + + +/* + * This file is part of the RTF library of the FOP project, which was originally + * created by Bertrand Delacretaz <bdelacretaz@codeconsult.ch> and by other + * contributors to the jfor project (www.jfor.org), who agreed to donate jfor to + * the FOP project. + */ + +package org.apache.fop.render.rtf.rtflib.testdocs; + +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfAttributes; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfDocumentArea; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfParagraph; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfText; + +/** Generates a simple RTF test document for the jfor rtflib package. + */ +public class ParagraphAlignment extends TestDocument { + + /** + * Constructor + */ + public ParagraphAlignment() { + } + + /** + * Generate the document. + * @param rda RtfDocumentArea + * @param sect RtfSection + * @throws java.io.IOException for I/O errors + */ + protected void generateDocument(RtfDocumentArea rda, RtfSection sect) throws java.io.IOException + { + RtfAttributes attr = new RtfAttributes(); + attr.set(RtfText.ALIGN_CENTER); + RtfParagraph p = sect.newParagraph(attr); + p.newLineBreak(); + p.newLineBreak(); + p.newText("Centered title"); + p.newLineBreak(); + p.close(); + + attr = new RtfAttributes(); + attr.set(RtfText.ALIGN_LEFT); + p = sect.newParagraph(attr); + p.newLineBreak(); + p.newText("This is the left aligned text."); + p.newLineBreak(); + p.close(); + + attr = new RtfAttributes(); + attr.set(RtfText.ALIGN_RIGHT); + p = sect.newParagraph(attr); + p.newLineBreak(); + p.newText("This is the right aligned text."); + p.newLineBreak(); + p.close(); + } +} diff --git a/src/test/java/org/apache/fop/render/rtf/rtflib/testdocs/SimpleDocument.java b/src/test/java/org/apache/fop/render/rtf/rtflib/testdocs/SimpleDocument.java new file mode 100644 index 000000000..ca6ce79bc --- /dev/null +++ b/src/test/java/org/apache/fop/render/rtf/rtflib/testdocs/SimpleDocument.java @@ -0,0 +1,53 @@ +/* + * 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. + */ + +/* $Id$ */ + + +/* + * This file is part of the RTF library of the FOP project, which was originally + * created by Bertrand Delacretaz <bdelacretaz@codeconsult.ch> and by other + * contributors to the jfor project (www.jfor.org), who agreed to donate jfor to + * the FOP project. + */ + +package org.apache.fop.render.rtf.rtflib.testdocs; + +import java.io.IOException; + +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfDocumentArea; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfParagraph; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection; + +/** Generates a simple RTF test document for the jfor rtflib package. + */ + +class SimpleDocument +extends TestDocument { + /** generate the body of the test document */ + protected void generateDocument(RtfDocumentArea rda, RtfSection sect) + throws IOException { + sect.newParagraph().newText("First paragraph of the simple RTF test document."); + + final RtfParagraph para = sect.newParagraph(); + para.newText("Second paragraph of simple RTF test document.\n"); + for (int i = 0; i < 242; i++) { + para.newText("This is string " + i); + para.newLineBreak(); + } + } +} diff --git a/src/test/java/org/apache/fop/render/rtf/rtflib/testdocs/SimpleLists.java b/src/test/java/org/apache/fop/render/rtf/rtflib/testdocs/SimpleLists.java new file mode 100644 index 000000000..e817f6a13 --- /dev/null +++ b/src/test/java/org/apache/fop/render/rtf/rtflib/testdocs/SimpleLists.java @@ -0,0 +1,77 @@ +/* + * 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. + */ + +/* $Id$ */ + + +/* + * This file is part of the RTF library of the FOP project, which was originally + * created by Bertrand Delacretaz <bdelacretaz@codeconsult.ch> and by other + * contributors to the jfor project (www.jfor.org), who agreed to donate jfor to + * the FOP project. + */ + +package org.apache.fop.render.rtf.rtflib.testdocs; + +import java.io.IOException; + +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfDocumentArea; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfList; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListItem; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListStyle; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListStyleNumber; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfParagraph; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection; + +/** Generates a simple RTF test document for the jfor rtflib package. + */ + +class SimpleLists extends TestDocument { + /** generate the body of the test document */ + protected void generateDocument(RtfDocumentArea rda, RtfSection sect) + throws IOException { + sect.newParagraph().newText("First paragraph of the 'SimpleLists' RTF test document."); + sect.newParagraph().newText("First bulleted list with 5 items."); + makeList(sect, 1, 5, null); + sect.newParagraph().newText("Normal paragraph between lists 1 and 2."); + makeList(sect, 2, 3, null); + sect.newParagraph().newText("Normal paragraph after list 2."); + + sect.newParagraph().newText("Now a numbered list (4 items):"); + makeList(sect, 3, 4, new RtfListStyleNumber()); + } + + private void makeList(RtfSection sect, int listIndex, int nItems, RtfListStyle ls) + throws IOException { + final RtfList list = sect.newList(null); + if (ls != null) { + list.setRtfListStyle(ls); + } + for (int i = 0; i < nItems; i++) { + final RtfListItem item = list.newListItem(); + for (int j = 0; j <= i; j++) { + final RtfParagraph para = item.newParagraph(); + para.newText("List " + listIndex + ", item " + i + ", paragraph " + j); + if (i == 0 && j == 0) { + final String txt = "This item takes more than one line to check word-wrapping."; + para.newText(". " + "This list should have " + nItems + + " items. " + txt + " " + txt + " " + txt); + } + } + } + } +} diff --git a/src/test/java/org/apache/fop/render/rtf/rtflib/testdocs/SimpleTable.java b/src/test/java/org/apache/fop/render/rtf/rtflib/testdocs/SimpleTable.java new file mode 100644 index 000000000..10ddc11e7 --- /dev/null +++ b/src/test/java/org/apache/fop/render/rtf/rtflib/testdocs/SimpleTable.java @@ -0,0 +1,72 @@ +/* + * 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. + */ + +/* $Id$ */ + + +/* + * This file is part of the RTF library of the FOP project, which was originally + * created by Bertrand Delacretaz <bdelacretaz@codeconsult.ch> and by other + * contributors to the jfor project (www.jfor.org), who agreed to donate jfor to + * the FOP project. + */ + +package org.apache.fop.render.rtf.rtflib.testdocs; + +import java.io.IOException; + +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfDocumentArea; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTable; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTableCell; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTableRow; + +/** Generates a simple RTF test document for the jfor rtflib package. + */ +class SimpleTable extends TestDocument { + /** generate the body of the test document */ + static final int MAX_ROW = 2; + static final int MAX_COL = 3; + static final int INCH_TO_TWIPS = 1440; + static final int C1W = 4; + + protected void generateDocument(RtfDocumentArea rda, RtfSection sect) + throws IOException { + final RtfTable tbl = sect.newTable(new DummyTableColumnsInfo()); + tbl.newTableRow().newTableCell(C1W * INCH_TO_TWIPS).newParagraph().newText( + "Here's a table row with just one cell, width " + C1W + "''"); + + for (int row = 0; row < MAX_ROW; row++) { + final RtfTableRow r = tbl.newTableRow(); + + for (int col = 0; col < MAX_COL; col++) { + final float widthInInches = col / 2f + 1f; + final int widthInTwips = (int)(widthInInches * INCH_TO_TWIPS); + final RtfTableCell c = r.newTableCell(widthInTwips); + c.newParagraph().newText("(" + row + "," + col + "), width " + + widthInInches + "''"); + if (row == 0 && col == 1) { + for (int i = 0; i < 4; i++) { + c.newParagraph().newText("additional paragraph " + i + " of cell 0,1"); + } + } + } + } + + sect.newParagraph().newText("This paragraph follows the table."); + } +} diff --git a/src/test/java/org/apache/fop/render/rtf/rtflib/testdocs/TestDocument.java b/src/test/java/org/apache/fop/render/rtf/rtflib/testdocs/TestDocument.java new file mode 100644 index 000000000..266903766 --- /dev/null +++ b/src/test/java/org/apache/fop/render/rtf/rtflib/testdocs/TestDocument.java @@ -0,0 +1,88 @@ +/* + * 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. + */ + +/* $Id$ */ + + +/* + * This file is part of the RTF library of the FOP project, which was originally + * created by Bertrand Delacretaz <bdelacretaz@codeconsult.ch> and by other + * contributors to the jfor project (www.jfor.org), who agreed to donate jfor to + * the FOP project. + */ + +package org.apache.fop.render.rtf.rtflib.testdocs; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.util.Date; + +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfDocumentArea; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfFile; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfParagraph; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection; + +/** Base class for generating RTF documents used to test the jfor rtflib package. + */ + +abstract class TestDocument { + private File output; + + final void setOutputDir(File outDir) + throws IOException { + output = new File(outDir, getRtfFilename()); + } + + final String getRtfFilename() { + // use class name for output filename + final String name = getClass().getName(); + final int pos = name.lastIndexOf('.'); + return name.substring(pos + 1) + ".rtf"; + } + + final void generateOutput() + throws IOException { + debugMsg("Generating document " + output + "..."); + final RtfFile f = new RtfFile(new FileWriter(output)); + final RtfDocumentArea rda = f.startDocumentArea(); + final RtfSection sect = rda.newSection(); + addIntroComments(sect); + generateDocument(rda, sect); + f.flush(); + } + + protected abstract void generateDocument(RtfDocumentArea rda, RtfSection sect) + throws IOException; + + void debugMsg(String msg) { + System.err.println(msg); + } + + protected void addIntroComments(RtfSection sect) throws IOException { + final RtfParagraph para = sect.newParagraph(); + + para.newText("jfor RTF library test document."); + para.newLineBreak(); +// para.newText(JForVersionInfo.getLongVersionInfo()); + para.newLineBreak(); + para.newText("generated by class " + getClass().getName()); + para.newLineBreak(); + para.newText("generated on " + new Date()); + para.close(); + } +} diff --git a/src/test/java/org/apache/fop/render/rtf/rtflib/testdocs/TextAttributes.java b/src/test/java/org/apache/fop/render/rtf/rtflib/testdocs/TextAttributes.java new file mode 100644 index 000000000..bb0614cee --- /dev/null +++ b/src/test/java/org/apache/fop/render/rtf/rtflib/testdocs/TextAttributes.java @@ -0,0 +1,67 @@ +/* + * 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. + */ + +/* $Id$ */ + + +/* + * This file is part of the RTF library of the FOP project, which was originally + * created by Bertrand Delacretaz <bdelacretaz@codeconsult.ch> and by other + * contributors to the jfor project (www.jfor.org), who agreed to donate jfor to + * the FOP project. + */ + +package org.apache.fop.render.rtf.rtflib.testdocs; + +import java.io.IOException; + +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfAttributes; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfDocumentArea; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfParagraph; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfText; + +/** Generates a simple RTF test document for the jfor rtflib package. + */ + +class TextAttributes extends TestDocument { + /** generate the body of the test document */ + protected void generateDocument(RtfDocumentArea rda, RtfSection sect) + throws IOException { + final RtfParagraph para = sect.newParagraph(); + para.newText("This is normal\n"); + para.newText("This is bold\n", new RtfAttributes().set(RtfText.ATTR_BOLD)); + para.newText("This is italic\n", new RtfAttributes().set(RtfText.ATTR_ITALIC)); + para.newText("This is underline\n", new RtfAttributes().set(RtfText.ATTR_UNDERLINE)); + + // RTF font sizes are in half-points + para.newText("This is size 48\n", new RtfAttributes().set(RtfText.ATTR_FONT_SIZE, 96)); + + para.newText( + "This is bold and italic\n", + new RtfAttributes().set(RtfText.ATTR_BOLD).set(RtfText.ATTR_ITALIC) + ); + + final RtfAttributes attr = new RtfAttributes(); + attr.set(RtfText.ATTR_BOLD).set(RtfText.ATTR_ITALIC); + attr.set(RtfText.ATTR_UNDERLINE); + attr.set(RtfText.ATTR_FONT_SIZE, 72); + para.newText("This is bold, italic, underline and size 36\n", attr); + + para.newText("This is back to normal\n"); + } +} diff --git a/src/test/java/org/apache/fop/render/rtf/rtflib/testdocs/Whitespace.java b/src/test/java/org/apache/fop/render/rtf/rtflib/testdocs/Whitespace.java new file mode 100644 index 000000000..a206e014f --- /dev/null +++ b/src/test/java/org/apache/fop/render/rtf/rtflib/testdocs/Whitespace.java @@ -0,0 +1,67 @@ +/* + * 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. + */ + +/* $Id$ */ + + +/* + * This file is part of the RTF library of the FOP project, which was originally + * created by Bertrand Delacretaz <bdelacretaz@codeconsult.ch> and by other + * contributors to the jfor project (www.jfor.org), who agreed to donate jfor to + * the FOP project. + */ + +package org.apache.fop.render.rtf.rtflib.testdocs; + +import java.io.IOException; + +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfDocumentArea; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfParagraph; +import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection; + +/** Generates an RTF document to test the WhitespaceCollapser + */ + +class Whitespace extends TestDocument { + /** generate the body of the test document */ + protected void generateDocument(RtfDocumentArea rda, RtfSection sect) + throws IOException { + final RtfParagraph p1 = sect.newParagraph(); + p1.newText("\t Each word of this paragraph must be " + + "separated\tfrom\t\n\tthe next word with exactly\t \tone"); + p1.newText(" space."); + + final RtfParagraph p2 = sect.newParagraph(); + p2.newText(""); + p2.newText("In this"); + p2.newText(" paragraph "); + p2.newText("as well,"); + p2.newText(" there must\tbe \t"); + p2.newText("exactly"); + p2.newText(" one space "); + p2.newText("between each\tword and the next, and no spaces at the " + + "beginning or end of the paragraph."); + + final RtfParagraph p3 = sect.newParagraph(); + p3.newText("The word 'boomerang' must be written after this with no funny spacing: "); + p3.newText("boo"); + p3.newText("me"); + p3.newText("r"); + p3.newText("a"); + p3.newText("ng."); + } +} diff --git a/src/test/java/org/apache/fop/render/rtf/rtflib/testdocs/package.html b/src/test/java/org/apache/fop/render/rtf/rtflib/testdocs/package.html new file mode 100644 index 000000000..6d6d62fdf --- /dev/null +++ b/src/test/java/org/apache/fop/render/rtf/rtflib/testdocs/package.html @@ -0,0 +1,7 @@ +<HTML> +<TITLE>org.apache.fop.render.rtf.rtflib.testdocs</TITLE> +<BODY> +<P>Classes used to test/demonstrate RTFLib capabilities by generating sample +RTF documents.</P> +</BODY> +</HTML>
\ No newline at end of file diff --git a/src/test/java/org/apache/fop/render/txt/TxtRendererConfigParserTestCase.java b/src/test/java/org/apache/fop/render/txt/TxtRendererConfigParserTestCase.java new file mode 100644 index 000000000..30fed05ea --- /dev/null +++ b/src/test/java/org/apache/fop/render/txt/TxtRendererConfigParserTestCase.java @@ -0,0 +1,52 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.render.txt; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +import org.apache.fop.apps.AbstractRendererConfigParserTester; +import org.apache.fop.apps.TxtRendererConfBuilder; +import org.apache.fop.render.txt.TxtRendererConfig.TxtRendererConfigParser; +import org.apache.fop.render.txt.TxtRendererConfig.TxtRendererOption; + +public class TxtRendererConfigParserTestCase + extends AbstractRendererConfigParserTester<TxtRendererConfBuilder, TxtRendererConfig> { + + public TxtRendererConfigParserTestCase() { + super(new TxtRendererConfigParser(), TxtRendererConfBuilder.class); + } + + @Test + public void testEncoding() throws Exception { + parseConfig(createRenderer().setEncoding("UTF-16")); + assertEquals("UTF-16", conf.getEncoding()); + + // Check validation isn't done at this point + parseConfig(createRenderer().setEncoding("RandomString")); + assertEquals("RandomString", conf.getEncoding()); + + // Check the default behaviour is expected + parseConfig(createRenderer()); + assertEquals(TxtRendererOption.ENCODING.getDefaultValue(), conf.getEncoding()); + } + +} diff --git a/src/test/java/org/apache/fop/svg/NativeTextPainterTest.java b/src/test/java/org/apache/fop/svg/NativeTextPainterTest.java new file mode 100644 index 000000000..5344e6a54 --- /dev/null +++ b/src/test/java/org/apache/fop/svg/NativeTextPainterTest.java @@ -0,0 +1,78 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.svg; + +import java.awt.Graphics2D; +import java.awt.geom.AffineTransform; +import java.io.File; +import java.io.IOException; + +import org.w3c.dom.Document; + +import org.apache.batik.anim.dom.SAXSVGDocumentFactory; +import org.apache.batik.bridge.BridgeContext; +import org.apache.batik.bridge.GVTBuilder; +import org.apache.batik.bridge.TextPainter; +import org.apache.batik.gvt.GraphicsNode; + +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.apps.FopFactory; +import org.apache.fop.fonts.FontInfo; +import org.apache.fop.fonts.base14.Base14FontCollection; +import org.apache.fop.svg.font.FOPFontFamilyResolverImpl; + +abstract class NativeTextPainterTest { + + protected final void runTest(String testcase, OperatorValidator validator) throws Exception { + FontInfo fontInfo = createFontInfo(); + BridgeContext bridgeContext = createBridgeContext(fontInfo); + GraphicsNode svg = loadSVG(bridgeContext, testcase); + Graphics2D g2d = createGraphics2D(fontInfo, validator); + svg.paint(g2d); + validator.end(); + } + + private FontInfo createFontInfo() { + FontInfo fontInfo = new FontInfo(); + new Base14FontCollection(true).setup(0, fontInfo); + return fontInfo; + } + + private BridgeContext createBridgeContext(FontInfo fontInfo) { + FOUserAgent userAgent = FopFactory.newInstance(new File(".").toURI()).newFOUserAgent(); + SVGUserAgent svgUserAgent = new SVGUserAgent(userAgent, new FOPFontFamilyResolverImpl(fontInfo), + new AffineTransform()); + BridgeContext bridgeContext = new BridgeContext(svgUserAgent); + bridgeContext.setTextPainter(createTextPainter(fontInfo)); + return bridgeContext; + } + + protected abstract TextPainter createTextPainter(FontInfo fontInfo); + + private GraphicsNode loadSVG(BridgeContext bridgeContext, String resourceName) throws IOException { + SAXSVGDocumentFactory factory = new SAXSVGDocumentFactory(null); + Document svg = factory.createDocument(null, getClass().getResourceAsStream(resourceName)); + GVTBuilder builder = new GVTBuilder(); + return builder.build(bridgeContext, svg); + } + + protected abstract Graphics2D createGraphics2D(FontInfo fontInfo, OperatorValidator validator); + +} diff --git a/src/test/java/org/apache/fop/svg/OperatorValidator.java b/src/test/java/org/apache/fop/svg/OperatorValidator.java new file mode 100644 index 000000000..e94c8e404 --- /dev/null +++ b/src/test/java/org/apache/fop/svg/OperatorValidator.java @@ -0,0 +1,108 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.svg; + +import java.util.LinkedList; +import java.util.Queue; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +class OperatorValidator { + + private interface Match { + + boolean match(String line); + } + + private static class MatchSequence implements OperatorValidator.Match { + + private final Queue<OperatorValidator.Match> expectedMatches = new LinkedList<OperatorValidator.Match>(); + + private OperatorValidator.Match currentMatch; + + private static final OperatorValidator.Match FINAL_MATCH = new Match() { + + public boolean match(String line) { + return false; + } + }; + + public boolean isExhausted() { + return currentMatch == FINAL_MATCH; + } + + public void addMatch(OperatorValidator.Match match) { + if (currentMatch == null) { + currentMatch = match; + } else { + expectedMatches.add(match); + } + } + + public boolean match(String line) { + boolean match = currentMatch.match(line); + if (match) { + if (expectedMatches.isEmpty()) { + currentMatch = FINAL_MATCH; + } else { + currentMatch = expectedMatches.remove(); + } + } + return match; + } + } + + private static class OperatorMatch implements OperatorValidator.Match { + + final String operator; + + final String line; + + OperatorMatch(String operator, String line) { + this.operator = operator; + this.line = line; + } + + public boolean match(String line) { + if (line.contains(operator)) { + assertEquals(this.line, line); + return true; + } + return false; + } + } + + private final OperatorValidator.MatchSequence matchSequence = new MatchSequence(); + + public OperatorValidator addOperatorMatch(String operator, String expectedLine) { + matchSequence.addMatch(new OperatorMatch(operator, expectedLine)); + return this; + } + + public void check(String line) { + matchSequence.match(line); + } + + public void end() { + assertTrue("Expected operators remain", matchSequence.isExhausted()); + } + +} diff --git a/src/test/java/org/apache/fop/svg/PDFGraphics2DTestCase.java b/src/test/java/org/apache/fop/svg/PDFGraphics2DTestCase.java new file mode 100644 index 000000000..3f610c56f --- /dev/null +++ b/src/test/java/org/apache/fop/svg/PDFGraphics2DTestCase.java @@ -0,0 +1,48 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.svg; + +import java.awt.BasicStroke; + +import org.junit.Test; + +import static org.junit.Assert.assertTrue; + +public class PDFGraphics2DTestCase { + + @Test + public void testApplyStrokeNullDash() { + PDFGraphics2D g2d = new PDFGraphics2D(false); + BasicStroke stroke = new BasicStroke(); + g2d.applyStroke(stroke); + assertTrue(g2d.getString().contains("[] 0 d\n")); + } + + @Test + public void testApplyStrokeNonNullDash() { + PDFGraphics2D g2d = new PDFGraphics2D(false); + float[] dashArray = {3.0f, 5.0f}; + BasicStroke stroke = new BasicStroke(1.0f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER, 10.0f, + dashArray, 0.0f); + g2d.applyStroke(stroke); + assertTrue(g2d.getString().contains("[3 5] 0 d\n")); + } + +} diff --git a/src/test/java/org/apache/fop/svg/PDFTextPainterTestCase.java b/src/test/java/org/apache/fop/svg/PDFTextPainterTestCase.java new file mode 100644 index 000000000..3e64cb58f --- /dev/null +++ b/src/test/java/org/apache/fop/svg/PDFTextPainterTestCase.java @@ -0,0 +1,148 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.svg; + +import java.awt.Graphics2D; +import java.io.StringWriter; + +import org.junit.Test; + +import org.apache.batik.bridge.TextPainter; + +import org.apache.xmlgraphics.java2d.GraphicContext; + +import org.apache.fop.fonts.FontInfo; +import org.apache.fop.pdf.PDFDocument; + +public class PDFTextPainterTestCase extends NativeTextPainterTest { + + private static class OperatorCheckingPDFGraphics2D extends PDFGraphics2D { + + OperatorCheckingPDFGraphics2D(FontInfo fontInfo, final OperatorValidator validator) { + super(false, fontInfo, new PDFDocument("test"), null, null, null, 0, null); + this.currentStream = new StringWriter() { + + @Override + public void write(String str) { + validator.check(str); + } + + }; + } + } + + @Override + protected TextPainter createTextPainter(FontInfo fontInfo) { + return new PDFTextPainter(fontInfo); + } + + @Override + protected Graphics2D createGraphics2D(FontInfo fontInfo, OperatorValidator validator) { + PDFGraphics2D g2d = new OperatorCheckingPDFGraphics2D(fontInfo, validator); + g2d.setGraphicContext(new GraphicContext()); + return g2d; + } + + @Test + public void testRotatedGlyph() throws Exception { + runTest("rotated-glyph.svg", new OperatorValidator() + .addOperatorMatch("Tm", "1 0 0 -1 40 110 Tm ") + .addOperatorMatch("TJ", "[(A)] TJ\n") + .addOperatorMatch("Tm", "0.70710677 0.7071068 0.7071068 -0.70710677 106.69999695 110 Tm ") + .addOperatorMatch("TJ", "[(B)] TJ\n") + .addOperatorMatch("Tm", "1 0 0 -1 173.3999939 110 Tm ") + .addOperatorMatch("TJ", "[(C)] TJ\n")); + } + + @Test + public void testDxDy() throws Exception { + runTest("dx-dy.svg", new OperatorValidator() + .addOperatorMatch("Tm", "1 0 0 -1 55 35 Tm ") + .addOperatorMatch("TJ", "[(ABCDE)] TJ\n") + .addOperatorMatch("Tm", "1 0 0 -1 55 75 Tm ") + .addOperatorMatch("TJ", "[(A)] TJ\n") + .addOperatorMatch("Tm", "1 0 0 -1 69 85 Tm ") + .addOperatorMatch("TJ", "[(B)] TJ\n") + .addOperatorMatch("Tm", "1 0 0 -1 109 80 Tm ") + .addOperatorMatch("TJ", "[(C)] TJ\n") + .addOperatorMatch("Tm", "1 0 0 -1 91 65 Tm ") + .addOperatorMatch("TJ", "[(D)] TJ\n") + .addOperatorMatch("Tm", "1 0 0 -1 127 75 Tm ") + .addOperatorMatch("TJ", "[(E)] TJ\n")); + } + + @Test + public void testSpacing() throws Exception { + runTest("spacing.svg", new OperatorValidator() + .addOperatorMatch("Tm", "1 0 0 -1 0 0 Tm ") + .addOperatorMatch("TJ", "[(V) 80 (A) 70 (V)] TJ\n") + .addOperatorMatch("Tm", "1 0 0 -1 0 0 Tm ") + .addOperatorMatch("TJ", "[(V) 80 (A) 70 (V)] TJ\n") + .addOperatorMatch("Tm", "1 0 0 -1 0 0 Tm ") + .addOperatorMatch("TJ", "[(V) -20 (A) -30 (V)] TJ\n") + .addOperatorMatch("Tm", "1 0 0 -1 0 0 Tm ") + .addOperatorMatch("TJ", "[(ab) -111 ( ) -389 (cd)] TJ\n")); + } + + @Test + public void testGlyphOrientation() throws Exception { + runTest("glyph-orientation.svg", new OperatorValidator() + .addOperatorMatch("Tm", "0 1 1 0 738.5 0 Tm ") + .addOperatorMatch("TJ", "[(A)] TJ\n") + .addOperatorMatch("Tm", "0 1 1 0 738.5 667 Tm ") + .addOperatorMatch("TJ", "[(B)] TJ\n") + .addOperatorMatch("Tm", "0 1 1 0 738.5 1334 Tm ") + .addOperatorMatch("TJ", "[(C)] TJ\n") + .addOperatorMatch("Tm", "0 1 1 0 738.5 2056 Tm ") + .addOperatorMatch("TJ", "[(D)] TJ\n") + .addOperatorMatch("Tm", "1 0 0 -1 2149 718 Tm ") + .addOperatorMatch("TJ", "[(E)] TJ\n") + .addOperatorMatch("Tm", "1 0 0 -1 2165.5 1643 Tm ") + .addOperatorMatch("TJ", "[(F)] TJ\n") + .addOperatorMatch("Tm", "1 0 0 -1 2124 2568 Tm ") + .addOperatorMatch("TJ", "[(G)] TJ\n") + .addOperatorMatch("Tm", "1 0 0 -1 2138.5 3493 Tm ") + .addOperatorMatch("TJ", "[(H)] TJ\n") + .addOperatorMatch("Tm", "0 -1 -1 0 718 5000 Tm ") + .addOperatorMatch("TJ", "[(I)] TJ\n") + .addOperatorMatch("Tm", "0 -1 -1 0 1643 5000 Tm ") + .addOperatorMatch("TJ", "[(J)] TJ\n") + .addOperatorMatch("Tm", "0 -1 -1 0 2568 5000 Tm ") + .addOperatorMatch("TJ", "[(K)] TJ\n") + .addOperatorMatch("Tm", "0 -1 -1 0 3493 5000 Tm ") + .addOperatorMatch("TJ", "[(L)] TJ\n")); + } + + @Test + public void testBaselineShift() throws Exception { + runTest("baseline-shift.svg", new OperatorValidator() + .addOperatorMatch("Tm", "1 0 0 -1 0 0 Tm ") + .addOperatorMatch("TJ", "[(AB)] TJ\n") + .addOperatorMatch("Tm", "1 0 0 -1 1334 -462.5 Tm ") + .addOperatorMatch("TJ", "[(CD)] TJ\n") + .addOperatorMatch("Tm", "1 0 0 -1 2778 0 Tm ") + .addOperatorMatch("TJ", "[(EF)] TJ\n") + .addOperatorMatch("Tm", "1 0 0 -1 4056 462.5 Tm ") + .addOperatorMatch("TJ", "[(GH)] TJ\n") + .addOperatorMatch("Tm", "1 0 0 -1 5556 0 Tm ") + .addOperatorMatch("TJ", "[(IJ)] TJ\n")); + } + +} diff --git a/src/test/java/org/apache/fop/svg/PSTextPainterTestCase.java b/src/test/java/org/apache/fop/svg/PSTextPainterTestCase.java new file mode 100644 index 000000000..2b716e348 --- /dev/null +++ b/src/test/java/org/apache/fop/svg/PSTextPainterTestCase.java @@ -0,0 +1,77 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.svg; + +import java.awt.Graphics2D; +import java.io.IOException; + +import org.junit.Test; + +import org.apache.commons.io.output.NullOutputStream; + +import org.apache.batik.bridge.TextPainter; + +import org.apache.xmlgraphics.java2d.GraphicContext; +import org.apache.xmlgraphics.java2d.ps.PSGraphics2D; +import org.apache.xmlgraphics.ps.PSGenerator; + +import org.apache.fop.fonts.FontInfo; +import org.apache.fop.render.ps.PSTextPainter; + +public class PSTextPainterTestCase extends NativeTextPainterTest { + + private static class OperatorCheckingPSGraphics2D extends PSGraphics2D { + + OperatorCheckingPSGraphics2D(FontInfo fontInfo, final OperatorValidator validator) { + super(false, new PSGenerator(new NullOutputStream()) { + + @Override + public void writeln(String cmd) throws IOException { + validator.check(cmd); + } + + }); + } + } + + @Override + protected TextPainter createTextPainter(FontInfo fontInfo) { + return new PSTextPainter(fontInfo); + } + + @Override + protected Graphics2D createGraphics2D(FontInfo fontInfo, OperatorValidator validator) { + PSGraphics2D g2d = new OperatorCheckingPSGraphics2D(fontInfo, validator); + g2d.setGraphicContext(new GraphicContext()); + return g2d; + } + + @Test + public void testRotatedGlyph() throws Exception { + runTest("rotated-glyph.svg", new OperatorValidator() + .addOperatorMatch("Tm", "1 0 0 -1 40 110 Tm") + .addOperatorMatch("xshow", "(A)\n[0] xshow") + .addOperatorMatch("Tm", "0.70711 0.70711 0.70711 -0.70711 106.7 110 Tm") + .addOperatorMatch("xshow", "(B)\n[0] xshow") + .addOperatorMatch("Tm", "1 0 0 -1 173.39999 110 Tm") + .addOperatorMatch("xshow", "(C)\n[0] xshow")); + } + +} diff --git a/src/test/java/org/apache/fop/svg/baseline-shift.svg b/src/test/java/org/apache/fop/svg/baseline-shift.svg new file mode 100644 index 000000000..0f375b9af --- /dev/null +++ b/src/test/java/org/apache/fop/svg/baseline-shift.svg @@ -0,0 +1,9 @@ +<?xml version="1.0"?> +<svg width="150" height="60" xmlns="http://www.w3.org/2000/svg"> +<rect x="0" y="0" width="100%" height="100%" fill="none" stroke="black" stroke-width="2"/> +<g transform="translate(10, 40) scale(20) scale(0.001)"> +<text font-family="sans-serif" font-size="1000"> +AB<tspan baseline-shift="super">CD</tspan>EF<tspan baseline-shift="sub">GH</tspan>IJ +</text> +</g> +</svg> diff --git a/src/test/java/org/apache/fop/svg/dx-dy.svg b/src/test/java/org/apache/fop/svg/dx-dy.svg new file mode 100644 index 000000000..cfdc2de01 --- /dev/null +++ b/src/test/java/org/apache/fop/svg/dx-dy.svg @@ -0,0 +1,8 @@ +<?xml version="1.0"?> +<svg width="200" height="100" xmlns="http://www.w3.org/2000/svg"> +<rect x="0" y="0" width="100%" height="100%" stroke="black" stroke-width="2" fill="none"/> +<g font-family="monospace" font-size="30"> + <text x="55" y="35">ABCDE</text> + <text x="55" y="75" dx="0 -4 22 -36 18" dy="0 10 -5 -15 10">ABCDE</text> +</g> +</svg> diff --git a/src/test/java/org/apache/fop/svg/font/BasicGlyphVectorTestCase.java b/src/test/java/org/apache/fop/svg/font/BasicGlyphVectorTestCase.java new file mode 100644 index 000000000..c6f062a84 --- /dev/null +++ b/src/test/java/org/apache/fop/svg/font/BasicGlyphVectorTestCase.java @@ -0,0 +1,193 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.svg.font; + +import java.awt.Rectangle; +import java.awt.font.GlyphMetrics; +import java.awt.geom.AffineTransform; +import java.awt.geom.Point2D; +import java.awt.geom.Rectangle2D; +import java.text.CharacterIterator; +import java.text.StringCharacterIterator; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.anyInt; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import org.apache.batik.gvt.font.GVTGlyphMetrics; +import org.apache.batik.gvt.font.GVTLineMetrics; + +import org.apache.fop.fonts.Font; +import org.apache.fop.fonts.FontMetrics; + +/** + * Tests all the methods of {@link FOPGVTGlyphVector} with a mocked font. + */ +public class BasicGlyphVectorTestCase extends FOPGVTGlyphVectorTest { + + private final int fontSize = 10000; + + @Before + public void createGlyphVector() { + FontMetrics metrics = mockFontMetrics(); + Font font = mockFont(metrics); + FOPGVTFont gvtFont = mockGVTFont(font); + CharacterIterator it = new StringCharacterIterator("ABC"); + glyphVector = new FOPGVTGlyphVector(gvtFont, it, null); + glyphVector.performDefaultLayout(); + } + + private FontMetrics mockFontMetrics() { + FontMetrics metrics = mock(FontMetrics.class); + when(metrics.getAscender(eq(fontSize))).thenReturn(8000000); + when(metrics.getDescender(eq(fontSize))).thenReturn(-4000000); + when(metrics.getWidth(eq(1), eq(fontSize))).thenReturn(10000000); + when(metrics.getBoundingBox(eq(1), eq(fontSize))).thenReturn( + new Rectangle(-1000000, -2000000, 3000000, 4000000)); + when(metrics.getWidth(eq(2), eq(fontSize))).thenReturn(11000000); + when(metrics.getBoundingBox(eq(2), eq(fontSize))).thenReturn( + new Rectangle(-5000000, -6000000, 7000000, 9000000)); + when(metrics.getWidth(eq(3), eq(fontSize))).thenReturn(12000000); + when(metrics.getBoundingBox(eq(3), eq(fontSize))).thenReturn( + new Rectangle(-9000000, -10000000, 11000000, 14000000)); + return metrics; + } + + private Font mockFont(FontMetrics metrics) { + Font font = mock(Font.class); + when(font.getFontMetrics()).thenReturn(metrics); + when(font.getFontSize()).thenReturn(fontSize); + when(font.mapChar(eq('A'))).thenReturn((char) 1); + when(font.mapChar(eq('B'))).thenReturn((char) 2); + when(font.mapChar(eq('C'))).thenReturn((char) 3); + return font; + } + + private FOPGVTFont mockGVTFont(Font font) { + FOPGVTFont gvtFont = mock(FOPGVTFont.class); + when(gvtFont.getFont()).thenReturn(font); + when(gvtFont.getLineMetrics(anyInt())).thenReturn( + new GVTLineMetrics(8, 0, null, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0)); + return gvtFont; + } + + @Test + public void getGlyphCodeReturnsGlyphIndex() { + assertEquals(1, glyphVector.getGlyphCode(0)); + assertEquals(2, glyphVector.getGlyphCode(1)); + assertEquals(3, glyphVector.getGlyphCode(2)); + } + + @Test + public void testGetGlyphCodes() { + assertArrayEquals(new int[] {1, 2, 3}, glyphVector.getGlyphCodes(0, 3, null)); + assertArrayEquals(new int[] {2, 3}, glyphVector.getGlyphCodes(1, 2, null)); + } + + @Test + public void testGetGlyphMetrics() { + assertGlyphMetricsEqual(new GVTGlyphMetrics(10, 12, new Rectangle(-1, -2, 3, 4), GlyphMetrics.STANDARD), + glyphVector.getGlyphMetrics(0)); + assertGlyphMetricsEqual(new GVTGlyphMetrics(11, 12, new Rectangle(-5, -3, 7, 9), GlyphMetrics.STANDARD), + glyphVector.getGlyphMetrics(1)); + assertGlyphMetricsEqual(new GVTGlyphMetrics(12, 12, new Rectangle(-9, -4, 11, 14), GlyphMetrics.STANDARD), + glyphVector.getGlyphMetrics(2)); + } + + private void assertGlyphMetricsEqual(GVTGlyphMetrics expected, GVTGlyphMetrics actual) { + assertEquals(expected.getHorizontalAdvance(), actual.getHorizontalAdvance(), 0); + assertEquals(expected.getVerticalAdvance(), actual.getVerticalAdvance(), 0); + assertEquals(expected.getBounds2D(), actual.getBounds2D()); + assertEquals(expected.getLSB(), actual.getLSB(), 0); + assertEquals(expected.getRSB(), actual.getRSB(), 0); + assertEquals(expected.getType(), actual.getType()); + assertEquals(expected.isCombining(), actual.isCombining()); + assertEquals(expected.isComponent(), actual.isComponent()); + assertEquals(expected.isLigature(), actual.isLigature()); + assertEquals(expected.isStandard(), actual.isStandard()); + assertEquals(expected.isWhitespace(), actual.isWhitespace()); + } + + @Test + public void testGetGlyphPosition() { + assertEquals(new Point2D.Float(0, 0), glyphVector.getGlyphPosition(0)); + assertEquals(new Point2D.Float(10, 0), glyphVector.getGlyphPosition(1)); + assertEquals(new Point2D.Float(21, 0), glyphVector.getGlyphPosition(2)); + assertEquals(new Point2D.Float(33, 0), glyphVector.getGlyphPosition(3)); + } + + @Test + public void testGetGlyphPositions() { + float[] expectedPositions = new float[] {0, 0, 10, 0, 21, 0, 33, 0}; + assertArrayEquals(expectedPositions, glyphVector.getGlyphPositions(0, 4, null), 0); + assertArrayEquals(expectedPositions, glyphVector.getGlyphPositions(0, 4, new float[8]), 0); + } + + @Test + public void testGetGlyphOutline() { + assertEquals(new Rectangle(-1, -2, 3, 4), glyphVector.getGlyphOutline(0).getBounds()); + assertEquals(new Rectangle(5, -3, 7, 9), glyphVector.getGlyphOutline(1).getBounds()); + assertEquals(new Rectangle(12, -4, 11, 14), glyphVector.getGlyphOutline(2).getBounds()); + } + + @Test + public void testGetOutline() { + assertEquals(new Rectangle(-1, -4, 24, 14), glyphVector.getOutline().getBounds()); + } + + @Test + public void testGetLogicalBounds() { + assertEquals(new Rectangle(0, -8, 33, 12), glyphVector.getLogicalBounds()); + } + + @Test + public void testGetLogicalBoundsRotated() { + for (int i = 0; i < 3; i++) { + glyphVector.setGlyphTransform(i, new AffineTransform(0.7, 0.7, -0.7, 0.7, 0, 0)); + } + assertEquals(new Rectangle2D.Float(-2.8f, -5.6f, 37.8f, 16.8f), glyphVector.getLogicalBounds()); + } + + @Test + public void testGetBounds() { + assertEquals(new Rectangle(-1, -4, 24, 14), glyphVector.getBounds2D(null)); + } + + @Test + public void testGetGlyphVisualBounds() { + assertEquals(new Rectangle(-1, -2, 3, 4), glyphVector.getGlyphVisualBounds(0).getBounds()); + assertEquals(new Rectangle(5, -3, 7, 9), glyphVector.getGlyphVisualBounds(1).getBounds()); + assertEquals(new Rectangle(12, -4, 11, 14), glyphVector.getGlyphVisualBounds(2).getBounds()); + } + + @Test + public void testGetGlyphLogicalBounds() { + assertEquals(new Rectangle(0, -8, 10, 12), glyphVector.getGlyphLogicalBounds(0).getBounds()); + assertEquals(new Rectangle(10, -8, 11, 12), glyphVector.getGlyphLogicalBounds(1).getBounds()); + assertEquals(new Rectangle(21, -8, 12, 12), glyphVector.getGlyphLogicalBounds(2).getBounds()); + } + +} diff --git a/src/test/java/org/apache/fop/svg/font/FOPFontFamilyResolverTestCase.java b/src/test/java/org/apache/fop/svg/font/FOPFontFamilyResolverTestCase.java new file mode 100644 index 000000000..d14752b90 --- /dev/null +++ b/src/test/java/org/apache/fop/svg/font/FOPFontFamilyResolverTestCase.java @@ -0,0 +1,127 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.svg.font; + +import java.awt.FontFormatException; +import java.awt.GraphicsEnvironment; +import java.awt.font.FontRenderContext; +import java.awt.font.LineMetrics; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; +import java.util.Collections; + +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import org.apache.batik.gvt.font.GVTFontFamily; +import org.apache.batik.gvt.font.GVTLineMetrics; + +import org.apache.fop.fonts.FontInfo; + +public class FOPFontFamilyResolverTestCase { + + private static FontInfo fontInfo; + + private FOPFontFamilyResolver resolver; + + @BeforeClass + public static void setUpFontInfo() { + fontInfo = new FontInfoBuilder() + .useDejaVuLGCSerif() + .useDroidSansMono() + .build(); + } + + @Before + public void createFontFamilyResolver() { + resolver = new FOPFontFamilyResolverImpl(fontInfo); + } + + @Test + public void testResolve() { + assertNull(resolver.resolve("Unavailable")); + assertNotNull(resolver.resolve(FontInfoBuilder.DEJAVU_LGC_SERIF)); + } + + @Test + public void testGetFamilyThatCanDisplay() { + GVTFontFamily family = resolver.getFamilyThatCanDisplay('\u0180'); + assertEquals(FontInfoBuilder.DEJAVU_LGC_SERIF, family.getFamilyName()); + family = resolver.getFamilyThatCanDisplay('\u02F3'); + assertEquals(FontInfoBuilder.DROID_SANS_MONO, family.getFamilyName()); + family = resolver.getFamilyThatCanDisplay('\u02DF'); + assertNull(family); + } + + @Test + public void testDeriveFont() { + FOPGVTFontFamily family = resolver.resolve(FontInfoBuilder.DEJAVU_LGC_SERIF); + FOPGVTFont font = family.deriveFont(10, Collections.emptyMap()); + assertEquals(10, font.getSize(), 0); + assertTrue(font.canDisplay('\u01F6')); + assertFalse(font.canDisplay('\u01F7')); + } + + @Test + @Ignore("FOP metrics don't match AWT, but not sure who is right and who is wrong") + public void testLineMetrics() throws FontFormatException, IOException { + FOPGVTFontFamily family = resolver.resolve(FontInfoBuilder.DEJAVU_LGC_SERIF); + FOPGVTFont font = family.deriveFont(10, Collections.emptyMap()); + GVTLineMetrics fopMetrics = font.getLineMetrics("", null); + LineMetrics awtMetrics = getAWTLineMetrics(); + printDifference("Ascent", awtMetrics.getAscent(), fopMetrics.getAscent()); + printDifference("Descent", awtMetrics.getDescent(), fopMetrics.getDescent()); + printDifference("Height", awtMetrics.getHeight(), fopMetrics.getHeight()); + printDifference("Leading", awtMetrics.getLeading(), fopMetrics.getLeading()); + printDifference("StrikethroughOffset", awtMetrics.getStrikethroughOffset(), + fopMetrics.getStrikethroughOffset()); + printDifference("StrikethroughThickness", awtMetrics.getStrikethroughThickness(), + fopMetrics.getStrikethroughThickness()); + printDifference("UnderlineOffset", awtMetrics.getUnderlineOffset(), + fopMetrics.getUnderlineOffset()); + printDifference("UnderlineThickness", awtMetrics.getUnderlineThickness(), + fopMetrics.getUnderlineThickness()); + } + + private LineMetrics getAWTLineMetrics() throws FontFormatException, IOException { + File fontFile = new File("test/resources/fonts/ttf/DejaVuLGCSerif.ttf"); + java.awt.Font awtFont = java.awt.Font.createFont(java.awt.Font.TRUETYPE_FONT, fontFile).deriveFont(10f); + GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); + BufferedImage dummyImage = new BufferedImage(1000, 1000, BufferedImage.TYPE_INT_RGB); + FontRenderContext frc = ge.createGraphics(dummyImage).getFontRenderContext(); + LineMetrics awtMetrics = awtFont.getLineMetrics("ABC", frc); + return awtMetrics; + } + + private void printDifference(String value, float awt, float fop) { + System.out.println(String.format("%22s AWT: %10f FOP: %10f Difference: %.2f%%", value, awt, fop, + (fop - awt) / awt * 100)); + } + +} diff --git a/src/test/java/org/apache/fop/svg/font/FOPGVTFontTestCase.java b/src/test/java/org/apache/fop/svg/font/FOPGVTFontTestCase.java new file mode 100644 index 000000000..b27dac5b2 --- /dev/null +++ b/src/test/java/org/apache/fop/svg/font/FOPGVTFontTestCase.java @@ -0,0 +1,71 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.svg.font; + +import java.text.StringCharacterIterator; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import org.apache.fop.fonts.Font; + +public class FOPGVTFontTestCase { + + private FOPGVTFont font; + + @Before + public void createFont() { + Font f = mock(Font.class); + when(f.hasChar(eq((char) 0))).thenReturn(false); + when(f.hasChar(eq((char) 1))).thenReturn(true); + font = new FOPGVTFont(f, null); + } + + @Test + public void testCanDisplayUpTo() { + char[] text = new char[] {1, 1, 1}; + testCanDisplayUpToVariants(text, -1, 0, 3); + testCanDisplayUpToVariants(text, -1, 1, 3); + text = new char[] {1, 1, 0, 1}; + testCanDisplayUpToVariants(text, 2, 0, 4); + testCanDisplayUpToVariants(text, 2, 1, 4); + testCanDisplayUpToVariants(text, 2, 2, 4); + testCanDisplayUpToVariants(text, -1, 3, 4); + testCanDisplayUpToVariants(text, -1, 1, 2); + } + + @Test + public void testCanDisplayUpToString() { + assertEquals(-1, font.canDisplayUpTo(new String(new char[] {1, 1, 1}))); + assertEquals(0, font.canDisplayUpTo(new String(new char[] {0, 1, 1}))); + assertEquals(1, font.canDisplayUpTo(new String(new char[] {1, 0, 1}))); + assertEquals(2, font.canDisplayUpTo(new String(new char[] {1, 1, 0}))); + } + + private void testCanDisplayUpToVariants(char[] text, int expected, int start, int limit) { + assertEquals(expected, font.canDisplayUpTo(text, start, limit)); + assertEquals(expected, font.canDisplayUpTo(new StringCharacterIterator(new String(text)), start, limit)); + } +} diff --git a/src/test/java/org/apache/fop/svg/font/FOPGVTGlyphVectorTest.java b/src/test/java/org/apache/fop/svg/font/FOPGVTGlyphVectorTest.java new file mode 100644 index 000000000..0995ab4df --- /dev/null +++ b/src/test/java/org/apache/fop/svg/font/FOPGVTGlyphVectorTest.java @@ -0,0 +1,27 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.svg.font; + + +public abstract class FOPGVTGlyphVectorTest { + + protected FOPGVTGlyphVector glyphVector; + +} diff --git a/src/test/java/org/apache/fop/svg/font/FontInfoBuilder.java b/src/test/java/org/apache/fop/svg/font/FontInfoBuilder.java new file mode 100644 index 000000000..c9346588c --- /dev/null +++ b/src/test/java/org/apache/fop/svg/font/FontInfoBuilder.java @@ -0,0 +1,102 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.svg.font; + +import java.io.File; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; + +import org.apache.fop.apps.io.InternalResourceResolver; +import org.apache.fop.apps.io.ResourceResolverFactory; +import org.apache.fop.fonts.EmbeddingMode; +import org.apache.fop.fonts.EncodingMode; +import org.apache.fop.fonts.Font; +import org.apache.fop.fonts.FontInfo; +import org.apache.fop.fonts.FontMetrics; +import org.apache.fop.fonts.truetype.OFFontLoader; + +class FontInfoBuilder { + + public static final String DEJAVU_LGC_SERIF = "DejaVu LGC Serif"; + + public static final String DROID_SANS_MONO = "Droid Sans Mono"; + + private static final boolean USE_ADVANCED_BY_DEFAULT = true; + + private FontInfo fontInfo; + + private int fontKey; + + public FontInfoBuilder() { + reset(); + } + + private void reset() { + fontInfo = new FontInfo(); + fontKey = 1; + } + + public FontInfoBuilder useDejaVuLGCSerif() { + return useDejaVuLGCSerif(USE_ADVANCED_BY_DEFAULT); + } + + public FontInfoBuilder useDejaVuLGCSerif(boolean useAdvanced) { + try { + return useFont(DEJAVU_LGC_SERIF, "DejaVuLGCSerif.ttf", useAdvanced); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public FontInfoBuilder useDroidSansMono() { + return useDroidSansMono(USE_ADVANCED_BY_DEFAULT); + } + + public FontInfoBuilder useDroidSansMono(boolean useAdvanced) { + try { + return useFont(DROID_SANS_MONO, "DroidSansMono.ttf", useAdvanced); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + private FontInfoBuilder useFont(String fontName, String filename, boolean useAdvanced) + throws IOException, URISyntaxException { + URI baseURI = new File("test/resources/fonts/ttf").toURI(); + InternalResourceResolver resolver = ResourceResolverFactory.createDefaultInternalResourceResolver(baseURI); + OFFontLoader fontLoader = new OFFontLoader(new URI(filename), null, true, + EmbeddingMode.AUTO, EncodingMode.AUTO, true, useAdvanced, resolver); + FontMetrics font = fontLoader.getFont(); + registerFont(font, "F" + fontKey++, fontName); + return this; + } + + private void registerFont(FontMetrics font, String key, String familyName) { + fontInfo.addMetrics(key, font); + fontInfo.addFontProperties(key, familyName, Font.STYLE_NORMAL, Font.WEIGHT_NORMAL); + } + + public FontInfo build() { + FontInfo fontInfo = this.fontInfo; + reset(); + return fontInfo; + } +} diff --git a/src/test/java/org/apache/fop/svg/font/GlyphLayoutTestCase.java b/src/test/java/org/apache/fop/svg/font/GlyphLayoutTestCase.java new file mode 100644 index 000000000..04af70544 --- /dev/null +++ b/src/test/java/org/apache/fop/svg/font/GlyphLayoutTestCase.java @@ -0,0 +1,91 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.svg.font; + +import java.util.Collections; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +import org.apache.fop.fonts.FontInfo; + +/** + * Specifically tests glyph positioning from a real font. + */ +public class GlyphLayoutTestCase extends FOPGVTGlyphVectorTest { + + /** + * Glyph positioning using the legacy kern table. + */ + @Test + public void testBasicGlyphPositioning() throws Exception { + testGlyphLayout(false); + } + + /** + * Glyph positioning using GPOS sub-tables. + */ + @Test + public void testAdvancedGlyphPositioning() throws Exception { + testGlyphLayout(true); + } + + private void testGlyphLayout(boolean useAdvanced) { + FOPGVTFont font = loadFont(useAdvanced); + glyphVector = (FOPGVTGlyphVector) font.createGlyphVector(null, "L\u201DP,V.F,A\u2019LT.", "DFLT", "dflt"); + glyphVector.performDefaultLayout(); + // Values in font units (unitsPerEm = 2048), glyph width - kern + int[] widths = { + /* L */ 1360 - 491, + /* " */ 1047, + /* P */ 1378 - 415, + /* , */ 651, + /* V */ 1479 - 358, + /* . */ 651, + /* F */ 1421 - 319, + /* , */ 651, + /* A */ 1479 - 301, + /* ' */ 651, + /* L */ 1360 - 167, + /* T */ 1366 - 301, + /* . */ 651}; + checkGlyphPositions(13, widths); + } + + private FOPGVTFont loadFont(boolean useAdvanced) { + FontInfo fontInfo = new FontInfoBuilder().useDejaVuLGCSerif(useAdvanced).build(); + FOPFontFamilyResolver resolver = new FOPFontFamilyResolverImpl(fontInfo); + FOPGVTFontFamily family = resolver.resolve(FontInfoBuilder.DEJAVU_LGC_SERIF); + return family.deriveFont(1000, Collections.emptyMap()); + } + + private void checkGlyphPositions(int expectedGlyphCount, int[] widths) { + assertEquals(expectedGlyphCount, glyphVector.getNumGlyphs()); + float[] positions = new float[2 * (widths.length + 1)]; + for (int i = 0, n = 2; i < widths.length; i++, n += 2) { + positions[n] = positions[n - 2] + widths[i] / 2.048f; + } + for (int i = 0; i <= widths.length; i++) { + assertEquals(positions[2 * i], glyphVector.getGlyphPosition(i).getX(), 3); + } + } + +} diff --git a/src/test/java/org/apache/fop/svg/glyph-orientation.svg b/src/test/java/org/apache/fop/svg/glyph-orientation.svg new file mode 100644 index 000000000..4900a3b02 --- /dev/null +++ b/src/test/java/org/apache/fop/svg/glyph-orientation.svg @@ -0,0 +1,10 @@ +<?xml version="1.0"?> +<svg width="100" height="140" xmlns="http://www.w3.org/2000/svg"> +<rect x="0" y="0" width="100%" height="100%" fill="none" stroke="black" stroke-width="2"/> +<g transform="translate(10) scale(20) scale(0.001) translate(0, 1000)" + font-family="sans-serif" font-size="1000"> + <text x="1000" writing-mode="tb">ABCD</text> + <text x="2500" writing-mode="tb" glyph-orientation-vertical="0">EFGH</text> + <text x="0" y="5000" glyph-orientation-horizontal="270">IJKL</text> +</g> +</svg> diff --git a/src/test/java/org/apache/fop/svg/rotated-glyph.svg b/src/test/java/org/apache/fop/svg/rotated-glyph.svg new file mode 100644 index 000000000..8b942905e --- /dev/null +++ b/src/test/java/org/apache/fop/svg/rotated-glyph.svg @@ -0,0 +1,5 @@ +<?xml version="1.0"?> +<svg width="300" height="150" xmlns="http://www.w3.org/2000/svg"> +<rect x="0" y="0" width="100%" height="100%" fill="none" stroke="black" stroke-width="2"/> +<text font-family="Helvetica" font-size="100" x="40" y="110" rotate="0 45 0">ABC</text> +</svg> diff --git a/src/test/java/org/apache/fop/svg/spacing.svg b/src/test/java/org/apache/fop/svg/spacing.svg new file mode 100644 index 000000000..943ab1d04 --- /dev/null +++ b/src/test/java/org/apache/fop/svg/spacing.svg @@ -0,0 +1,21 @@ +<?xml version="1.0"?> +<svg width="150" height="200" xmlns="http://www.w3.org/2000/svg"> +<rect x="0" y="0" width="100%" height="100%" stroke="black" stroke-width="2" fill="none"/> +<g transform="translate(10) scale(40) scale(0.001) translate(0, 1000)" + font-family="sans-serif" font-size="1000"> + <g transform=""> + <text>VAV</text> + <line x1="667" y1="-818" x2="667" y2="100" stroke-width="10" stroke="blue"/> + </g> + <g transform="translate(0, 1000)"> + <text kerning="0">VAV</text> + <line x1="667" y1="-818" x2="667" y2="100" stroke-width="10" stroke="blue"/> + </g> + <g transform="translate(0, 2000)"> + <text letter-spacing="100">VAV</text> + </g> + <g transform="translate(0, 3000)"> + <text word-spacing="500">ab cd</text> + </g> +</g> +</svg> diff --git a/src/test/java/org/apache/fop/text/linebreak/LineBreakStatusTestCase.java b/src/test/java/org/apache/fop/text/linebreak/LineBreakStatusTestCase.java new file mode 100644 index 000000000..e4854d9a7 --- /dev/null +++ b/src/test/java/org/apache/fop/text/linebreak/LineBreakStatusTestCase.java @@ -0,0 +1,340 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.text.linebreak; + +import org.junit.Test; + +import static org.junit.Assert.assertTrue; + +/** + * JUnit test case for the LineBreakStatus class + */ +public class LineBreakStatusTestCase { + + /* + * These symbols are used to indicate the break action returned + * by the paragraph breaking. Their meaning is as per Unicode + * <a href="http://unicode.org/reports/tr14/#PairBasedImplementation">technical + * report #14</a>. + */ + private static final String BREAK_ACTION = "_%#@^!"; + + /** + * Test of reset method, of class org.apache.commons.text.linebreak.LineBreakStatus. + */ + @Test + public void testReset() { + System.out.println("testReset"); + // TODO + } + + /** + * Test of nextChar method, of class org.apache.commons.text.linebreak.LineBreakStatus. + * Runs tests for most of the Line Breaking Properties defined in the Unicode standard. + */ + @Test + public void testNextChar() { + System.out.println("testNextChar"); + + // AL -- Ordinary Alphabetic and Symbol Characters (XP) + assertTrue(testBreak( + "Nobreak", + "^^^^^^^" + )); + + // BA -- Break Opportunity After (A) + assertTrue(testBreak( + "Thin Space" + "\u2009" + "break", + "^^^^^%^^^^" + "^" + "_^^^^" + )); + + assertTrue(testBreak( + "Shy" + "\u00AD" + "break", + "^^^" + "^" + "_^^^^" + )); + + + // BB -- Break opportunites before characters (B) + assertTrue(testBreak( + "Acute Accent" + "\u00B4" + "break", + "^^^^^^%^^^^^" + "_" + "^^^^^" + )); + + // B2 -- Break Opportunity Before and After (B/A/XP) + assertTrue(testBreak( + "Em Dash" + "\u2014" + "break", + "^^^%^^^" + "_" + "_^^^^" + )); + + assertTrue(testBreak( + "Em Dash Dash" + "\u2014" + "\u2014" + "break", + "^^^%^^^^%^^^" + "_" + "^" + "_^^^^" + )); + + // BK Mandatory Break (A) -- normative + assertTrue(testBreak( + "Form Feed" + "\u000C" + "break", + "^^^^^%^^^" + "^" + "!^^^^" + )); + + assertTrue(testBreak( + "Line Separator" + "\u2028" + "break", + "^^^^^%^^^^^^^^" + "^" + "!^^^^" + )); + + assertTrue(testBreak( + "Paragraph Separator" + "\u2029" + "break", + "^^^^^^^^^^%^^^^^^^^" + "^" + "!^^^^" + )); + + // CB Contingent Break Opportunity (B/A) -- normative + // TODO Don't know quite what to do here + + // CL -- Closing Punctuation (XB) + assertTrue(testBreak( + "Right Parenthesis ) break", + "^^^^^^%^^^^^^^^^^^^^%^^^^" + )); + + // CM -- Attached Characters and Combining Marks (XB) -- normative + assertTrue(testBreak( + "Grave Accent" + "\u0300" + " break", + "^^^^^^%^^^^^" + "^" + "^%^^^^" + )); + + // CR -- Carriage Return (A) -- normative + assertTrue(testBreak( + "CR" + "\r" + "break", + "^^" + "^" + "!^^^^" + )); + + assertTrue(testBreak( + "CRLF" + "\r\n" + "break", + "^^^^" + "^^" + "!^^^^" + )); + + // EX -- Exclamation / interrogation (XB) + assertTrue(testBreak( + "EX CL ! ) break", + "^^^%^^^^^^%^^^^" + )); + + assertTrue(testBreak( + "EX Wave Dash ! " + "\u301C" + " break", + "^^^%^^^^%^^^^^^" + "%" + "^_^^^^" + )); + + // GL -- Non-breaking ("Glue") (XB/XA) -- normative + assertTrue(testBreak( + "No" + "\u00a0" + "break", + "^^" + "^" + "^^^^^" + )); + + assertTrue(testBreak( + "Non" + "\u2011" + " Hyphen", + "^^^" + "^" + "^%^^^^^" + )); + + // H2 -- Hangul LVT Syllable (B/A) + // TODO + + // H3 -- Hangul LVT Syllable (B/A) + // TODO + + // HY -- Hyphen Minus + assertTrue(testBreak( + "Normal-Hyphen", + "^^^^^^^_^^^^^" + )); + + assertTrue(testBreak( + "Normal - Hyphen", + "^^^^^^^%^_^^^^^" + )); + + assertTrue(testBreak( + "123-456", + "^^^^^^^" + )); + + assertTrue(testBreak( + "123 - 456", + "^^^^%^%^^" + )); + + // ID -- Ideographic (B/A) + assertTrue(testBreak( + "\u4E00" + "\u3000" + "\u4E02", + "^" + "_" + "_" + )); + + // IN -- Inseperable characters (XP) + assertTrue(testBreak( + "IN " + "\u2024" + "\u2025" + "\u2026", + "^^^" + "%" + "^" + "^" + )); + + // IS -- Numeric Separator (Infix) (XB) + assertTrue(testBreak( + "123,456.00 12:59", + "^^^^^^^^^^^%^^^^" + )); + + // JL -- Hangul L Jamo (B) + // TODO + + // JT -- Hangul T Jamo (A) + // TODO + + // JV -- Hangul V Jamo (XA/XB) + // TODO + + // LF -- Line Feed (A) -- normative + assertTrue(testBreak( + "Simple" + "\n" + "\n" + "break", + "^^^^^^" + "^" + "!" + "!^^^^" + )); + + // NL -- Next Line (A) -- normative + assertTrue(testBreak( + "NL" + "\u0085" + "break", + "^^" + "^" + "!^^^^" + )); + + // NS -- Non-starters (XB) + // TODO + + // NU -- Numeric (XP) + // Tested as part of IS + + // OP -- Opening Punctuation (XA) + assertTrue(testBreak( + "[ Bracket ( Parenthesis", + "^^^^^^^^^^%^^^^^^^^^^^^" + )); + + // PO -- Postfix (Numeric) (XB) + assertTrue(testBreak( + "(12.00)%", + "^^^^^^^^" + )); + + // PR -- Prefix (Numeric) (XA) + assertTrue(testBreak( + "$1000.00", + "^^^^^^^^" + )); + + // QU -- Ambiguous Quotation (XB/XA) + assertTrue(testBreak( + "'In Quotes'", + "^^^^%^^^^^^" + )); + + assertTrue(testBreak( + "' (In Quotes) '", + "^^^^^^%^^^^^^^%" + )); + + // SA -- Complex-context Dependent Characters (South East Asian) (P) + // TODO + + // SP -- Space (A) -- normative + assertTrue(testBreak( + "Simple break", + "^^^^^^^%^^^^" + )); + + assertTrue(testBreak( + "Simple break2", + "^^^^^^^^^^%^^^^^" + )); + + // SY -- Symbols Allowing Break After (A) + assertTrue(testBreak( + "http://xmlgraphics.apache.org/fop", + "^^^^^^^_^^^^^^^^^^^^^^^^^^^^^^_^^" + )); + + assertTrue(testBreak( + "1/2 31/10/2005", + "^^^^%^^^^^^^^^" + )); + + // WJ -- Word Joiner (XA/XB) -- (normative) + assertTrue(testBreak( + "http://" + "\u2060" + "xmlgraphics.apache.org/" + "\uFEFF" + "fop", + "^^^^^^^" + "^" + "^^^^^^^^^^^^^^^^^^^^^^^" + "^" + "^^^" + )); + + assertTrue(testBreak( + "Simple " + "\u2060" + "break", + "^^^^^^^" + "^" + "^^^^^" + )); + + assertTrue(testBreak( + "Simple" + "\u200B" + "\u2060" + "break", + "^^^^^^" + "^" + "_" + "^^^^^" + )); + + // XX -- Unknown (XP) + // TODO + + // ZW -- Zero Width Space (A) -- (normative) + assertTrue(testBreak( + "Simple" + "\u200B" + "break", + "^^^^^^" + "^" + "_^^^^" + )); + + // Unassigned codepoint: should yield same result as AL + assertTrue(testBreak( + "No" + "\u1F7E" + "break", + "^^" + "^" + "^^^^^" + )); + + } + + /** + * Tests the paragraph break status (break actions) returned from calling + * LineBreakStatus.nextChar() on each character of paragraph against + * the expected break actions. There must be a positional match between + * the characters in paragraph and characters in breakAction. + * @param paragraph The text to be analysed for line breaks + * @param breakActions The symbolic representation of the break actions + * expected to be returned. + */ + private boolean testBreak(String paragraph, String breakActions) { + boolean result = true; + int length = paragraph.length(); + LineBreakStatus lbs = new LineBreakStatus(); + for (int i = 0; i < length; i++) { + byte breakAction = lbs.nextChar(paragraph.charAt(i)); + if (BREAK_ACTION.charAt(breakAction) != breakActions.charAt(i)) { + System.err.println(paragraph); + System.err.println(breakActions); + System.err.println("pos = " + i + + " expected '" + breakActions.charAt(i) + + "' got '" + BREAK_ACTION.charAt(breakAction) + "'"); + result = false; + } + } + return result; + } +} diff --git a/src/test/java/org/apache/fop/text/linebreak/LineBreakUtilsTestCase.java b/src/test/java/org/apache/fop/text/linebreak/LineBreakUtilsTestCase.java new file mode 100644 index 000000000..5fc5c7d50 --- /dev/null +++ b/src/test/java/org/apache/fop/text/linebreak/LineBreakUtilsTestCase.java @@ -0,0 +1,72 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.text.linebreak; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +/** + * TODO add javadoc + * + * + */ +public class LineBreakUtilsTestCase { + + @Test + public void testLineBreakProperty() { + assertEquals(LineBreakUtils.getLineBreakProperty('A'), LineBreakUtils.LINE_BREAK_PROPERTY_AL); + assertEquals(LineBreakUtils.getLineBreakProperty('1'), LineBreakUtils.LINE_BREAK_PROPERTY_NU); + assertEquals(LineBreakUtils.getLineBreakProperty('\n'), LineBreakUtils.LINE_BREAK_PROPERTY_LF); + assertEquals(LineBreakUtils.getLineBreakProperty('\r'), LineBreakUtils.LINE_BREAK_PROPERTY_CR); + assertEquals(LineBreakUtils.getLineBreakProperty('('), LineBreakUtils.LINE_BREAK_PROPERTY_OP); + assertEquals(LineBreakUtils.getLineBreakProperty('\u1F7E'), 0); + } + + @Test + public void testLineBreakPair() { + assertEquals( + LineBreakUtils.getLineBreakPairProperty( + LineBreakUtils.LINE_BREAK_PROPERTY_CM, + LineBreakUtils.LINE_BREAK_PROPERTY_CL), + LineBreakUtils.PROHIBITED_BREAK); + assertEquals( + LineBreakUtils.getLineBreakPairProperty( + LineBreakUtils.LINE_BREAK_PROPERTY_CL, + LineBreakUtils.LINE_BREAK_PROPERTY_CM), + LineBreakUtils.COMBINING_INDIRECT_BREAK); + assertEquals( + LineBreakUtils.getLineBreakPairProperty( + LineBreakUtils.LINE_BREAK_PROPERTY_IS, + LineBreakUtils.LINE_BREAK_PROPERTY_PR), + LineBreakUtils.DIRECT_BREAK); + assertEquals( + LineBreakUtils.getLineBreakPairProperty( + LineBreakUtils.LINE_BREAK_PROPERTY_AL, + LineBreakUtils.LINE_BREAK_PROPERTY_OP), + LineBreakUtils.INDIRECT_BREAK); + assertEquals( + LineBreakUtils.getLineBreakPairProperty( + LineBreakUtils.LINE_BREAK_PROPERTY_LF, + LineBreakUtils.LINE_BREAK_PROPERTY_CM), + 0); + } + +} diff --git a/src/test/java/org/apache/fop/threading/AvalonAdapter.java b/src/test/java/org/apache/fop/threading/AvalonAdapter.java new file mode 100644 index 000000000..5074d6b70 --- /dev/null +++ b/src/test/java/org/apache/fop/threading/AvalonAdapter.java @@ -0,0 +1,58 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.threading; + +import org.apache.avalon.framework.logger.Logger; + +import org.apache.fop.events.Event; +import org.apache.fop.events.EventFormatter; +import org.apache.fop.events.EventListener; +import org.apache.fop.events.model.EventSeverity; + +/** + * Redirects events to an Avalon logger. + */ +class AvalonAdapter implements EventListener { + + private final Logger logger; + private String filename; + + public AvalonAdapter(Logger logger, String filename) { + this.logger = logger; + this.filename = filename; + } + + public void processEvent(Event event) { + String msg = EventFormatter.format(event); + EventSeverity severity = event.getSeverity(); + if (severity == EventSeverity.INFO) { + //logger.info(filename + ": " + msg); + } else if (severity == EventSeverity.WARN) { + //logger.warn(filename + ": " + msg); + } else if (severity == EventSeverity.ERROR) { + logger.error(filename + ": " + msg); + } else if (severity == EventSeverity.FATAL) { + logger.fatalError(filename + ": " + msg); + } else { + assert false; + } + } + +} diff --git a/src/test/java/org/apache/fop/threading/FOPTestbed.java b/src/test/java/org/apache/fop/threading/FOPTestbed.java new file mode 100644 index 000000000..7b08b7cd1 --- /dev/null +++ b/src/test/java/org/apache/fop/threading/FOPTestbed.java @@ -0,0 +1,322 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.threading; + +import java.io.File; +import java.io.OutputStream; +import java.text.DecimalFormat; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; + +import javax.xml.transform.Source; +import javax.xml.transform.Templates; +import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.stream.StreamSource; + +import org.apache.avalon.framework.CascadingRuntimeException; +import org.apache.avalon.framework.activity.Executable; +import org.apache.avalon.framework.activity.Initializable; +import org.apache.avalon.framework.configuration.Configurable; +import org.apache.avalon.framework.configuration.Configuration; +import org.apache.avalon.framework.configuration.ConfigurationException; +import org.apache.avalon.framework.container.ContainerUtil; +import org.apache.avalon.framework.logger.AbstractLogEnabled; +import org.apache.commons.io.IOUtils; +import org.apache.commons.io.output.CountingOutputStream; +import org.apache.commons.io.output.NullOutputStream; + +/** + * Testbed for multi-threading tests. The class can run a configurable set of task a number of + * times in a configurable number of threads to easily reproduce multi-threading issues. + */ +public class FOPTestbed extends AbstractLogEnabled + implements Configurable, Initializable { + + private int repeat; + private List taskList = new java.util.ArrayList(); + private int threads; + private File outputDir; + private Configuration fopCfg; + private Processor foprocessor; + private boolean writeToDevNull; + + private int counter; + + private List results = Collections.synchronizedList(new java.util.LinkedList()); + + /** {@inheritDoc} */ + public void configure(Configuration configuration) throws ConfigurationException { + this.threads = configuration.getChild("threads").getValueAsInteger(10); + this.outputDir = new File(configuration.getChild("output-dir").getValue()); + this.writeToDevNull = configuration.getChild("devnull").getValueAsBoolean(false); + Configuration tasks = configuration.getChild("tasks"); + this.repeat = tasks.getAttributeAsInteger("repeat", 1); + Configuration[] entries = tasks.getChildren("task"); + for (int i = 0; i < entries.length; i++) { + this.taskList.add(new TaskDef(entries[i])); + } + this.fopCfg = configuration.getChild("processor"); + } + + /** {@inheritDoc} */ + public void initialize() throws Exception { + this.foprocessor = createFOProcessor(); + } + + /** + * Starts the stress test. + */ + public void doStressTest() { + getLogger().info("Starting stress test..."); + long start = System.currentTimeMillis(); + this.counter = 0; + + //Initialize threads + ThreadGroup workerGroup = new ThreadGroup("FOP workers"); + List threadList = new java.util.LinkedList(); + for (int ti = 0; ti < this.threads; ti++) { + TaskRunner runner = new TaskRunner(); + ContainerUtil.enableLogging(runner, getLogger()); + Thread thread = new Thread(workerGroup, runner, "Worker- " + ti); + threadList.add(thread); + } + + //Start threads + Iterator i = threadList.iterator(); + while (i.hasNext()) { + ((Thread)i.next()).start(); + } + + //Wait for threads to end + while (threadList.size() > 0) { + Thread t = (Thread)threadList.get(0); + if (!t.isAlive()) { + threadList.remove(0); + continue; + } + try { + Thread.sleep(100); + } catch (InterruptedException ie) { + //ignore + } + } + long duration = System.currentTimeMillis() - start; + + report(duration); + } + + private void report(long duration) { + int count = this.results.size(); + int failures = 0; + long bytesWritten = 0; + System.out.println("Report on " + count + " tasks:"); + Iterator iter = this.results.iterator(); + while (iter.hasNext()) { + Result res = (Result)iter.next(); + if (res.failure != null) { + System.out.println("FAIL: " + (res.end - res.start) + " " + res.task); + System.out.println(" -> " + res.failure.getMessage()); + failures++; + } else { + System.out.println("good: " + (res.end - res.start) + " " + res.filesize + + " " + res.task); + bytesWritten += res.filesize; + } + } + System.out.println("Stress test duration: " + duration + "ms"); + if (failures > 0) { + System.out.println(failures + " failures of " + count + " documents!!!"); + } else { + float mb = 1024f * 1024f; + System.out.println("Bytes written: " + (bytesWritten / mb) + " MB, " + + (bytesWritten * 1000 / duration) + " bytes / sec"); + System.out.println("NO failures with " + count + " documents."); + } + } + + private class TaskRunner extends AbstractLogEnabled implements Runnable { + + public void run() { + try { + for (int r = 0; r < repeat; r++) { + Iterator i = taskList.iterator(); + while (i.hasNext()) { + TaskDef def = (TaskDef)i.next(); + final Task task = new Task(def, counter++, foprocessor); + ContainerUtil.enableLogging(task, getLogger()); + task.execute(); + } + } + } catch (Exception e) { + getLogger().error("Thread ended with an exception", e); + } + } + + } + + /** + * Creates a new FOProcessor. + * @return the newly created instance + */ + public Processor createFOProcessor() { + try { + Class clazz = Class.forName(this.fopCfg.getAttribute("class", + "org.apache.fop.threading.FOProcessorImpl")); + Processor fop = (Processor)clazz.newInstance(); + ContainerUtil.enableLogging(fop, getLogger()); + ContainerUtil.configure(fop, this.fopCfg); + ContainerUtil.initialize(fop); + return fop; + } catch (Exception e) { + throw new CascadingRuntimeException("Error creating FO Processor", e); + } + } + + + private class TaskDef { + private String fo; + private String xml; + private String xslt; + private Templates templates; + + public TaskDef(String fo) { + this.fo = fo; + } + + public TaskDef(Configuration cfg) throws ConfigurationException { + this.fo = cfg.getAttribute("fo", null); + if (this.fo == null) { + this.xml = cfg.getAttribute("xml"); + this.xslt = cfg.getAttribute("xslt", null); + if (this.xslt != null) { + TransformerFactory factory = TransformerFactory.newInstance(); + Source xsltSource = new StreamSource(new File(xslt)); + try { + this.templates = factory.newTemplates(xsltSource); + } catch (TransformerConfigurationException tce) { + throw new ConfigurationException("Invalid XSLT", tce); + } + } + } + } + + public String getFO() { + return this.fo; + } + + public String getXML() { + return this.xml; + } + + public Templates getTemplates() { + return this.templates; + } + + public String toString() { + StringBuffer sb = new StringBuffer(); + if (this.fo != null) { + sb.append("fo="); + sb.append(this.fo); + } else { + sb.append("xml="); + sb.append(this.xml); + sb.append(" xslt="); + sb.append(this.xslt); + } + return sb.toString(); + } + } + + + private class Task extends AbstractLogEnabled implements Executable { + + private TaskDef def; + private int num; + private Processor fop; + + public Task(TaskDef def, int num, Processor fop) { + this.def = def; + this.num = num; + this.fop = fop; + } + + + public void execute() throws Exception { + getLogger().info("Processing: " + def); + long start = System.currentTimeMillis(); + try { + DecimalFormat df = new DecimalFormat("00000"); + File outfile = new File(outputDir, df.format(num) + fop.getTargetFileExtension()); + OutputStream out; + if (writeToDevNull) { + out = new NullOutputStream(); + } else { + out = new java.io.FileOutputStream(outfile); + out = new java.io.BufferedOutputStream(out); + } + CountingOutputStream cout = new CountingOutputStream(out); + try { + Source src; + Templates templates; + + if (def.getFO() != null) { + src = new StreamSource(new File(def.getFO())); + templates = null; + } else { + src = new StreamSource(new File(def.getXML())); + templates = def.getTemplates(); + } + fop.process(src, templates, cout); + } finally { + IOUtils.closeQuietly(cout); + } + results.add(new Result(def, start, System.currentTimeMillis(), + cout.getByteCount())); + } catch (Exception e) { + results.add(new Result(def, start, System.currentTimeMillis(), e)); + throw e; + } + } + } + + private static class Result { + + private TaskDef task; + private long start; + private long end; + private long filesize; + private Throwable failure; + + public Result(TaskDef task, long start, long end, long filesize) { + this(task, start, end, null); + this.filesize = filesize; + } + + public Result(TaskDef task, long start, long end, Throwable failure) { + this.task = task; + this.start = start; + this.end = end; + this.failure = failure; + } + } + +} diff --git a/src/test/java/org/apache/fop/threading/FOProcessorImpl.java b/src/test/java/org/apache/fop/threading/FOProcessorImpl.java new file mode 100644 index 000000000..721830aee --- /dev/null +++ b/src/test/java/org/apache/fop/threading/FOProcessorImpl.java @@ -0,0 +1,119 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.threading; + +import java.io.File; +import java.io.OutputStream; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URL; + +import javax.xml.transform.Result; +import javax.xml.transform.Source; +import javax.xml.transform.Templates; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.sax.SAXResult; + +import org.xml.sax.SAXException; + +import org.apache.avalon.framework.activity.Initializable; +import org.apache.avalon.framework.configuration.Configurable; +import org.apache.avalon.framework.configuration.Configuration; +import org.apache.avalon.framework.configuration.ConfigurationException; +import org.apache.avalon.framework.logger.AbstractLogEnabled; +import org.apache.commons.io.FilenameUtils; + +import org.apache.fop.apps.FOPException; +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.apps.Fop; +import org.apache.fop.apps.FopFactory; +import org.apache.fop.apps.MimeConstants; + +/** + * Default implementation of the {@link Processor} interface using FOP. + */ +public class FOProcessorImpl extends AbstractLogEnabled + implements Processor, Configurable, Initializable { + + private FopFactory fopFactory; + private TransformerFactory factory = TransformerFactory.newInstance(); + private URI userconfig; + private String mime; + private String fileExtension; + + /** {@inheritDoc} */ + public void configure(Configuration configuration) throws ConfigurationException { + try { + this.userconfig = new URI(configuration.getChild("userconfig").getValue(null)); + this.mime = configuration.getChild("mime").getValue(MimeConstants.MIME_PDF); + this.fileExtension = configuration.getChild("extension").getValue(".pdf"); + } catch (URISyntaxException use) { + throw new RuntimeException(use); + } + } + + public void initialize() throws Exception { + if (this.userconfig != null) { + getLogger().debug("Setting user config: " + userconfig); + fopFactory = FopFactory.newInstance(new File(userconfig)); + } else { + fopFactory = FopFactory.newInstance(new File(".").toURI()); + } + } + + /** {@inheritDoc} + * @throws URISyntaxException + * @throws SAXException */ + public void process(Source src, Templates templates, OutputStream out) + throws java.io.IOException, URISyntaxException, SAXException { + FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); + + try { + URL url = new URL(src.getSystemId()); + String filename = FilenameUtils.getName(url.getPath()); + foUserAgent.getEventBroadcaster().addEventListener( + new AvalonAdapter(getLogger(), filename)); + } catch (MalformedURLException mfue) { + throw new RuntimeException(mfue); + } + Fop fop = fopFactory.newFop(this.mime, foUserAgent, out); + + try { + Transformer transformer; + if (templates == null) { + transformer = factory.newTransformer(); + } else { + transformer = templates.newTransformer(); + } + Result res = new SAXResult(fop.getDefaultHandler()); + transformer.transform(src, res); + } catch (TransformerException e) { + throw new FOPException(e); + } + } + + /** {@inheritDoc} */ + public String getTargetFileExtension() { + return this.fileExtension; + } +} diff --git a/src/test/java/org/apache/fop/threading/IFProcessorImpl.java b/src/test/java/org/apache/fop/threading/IFProcessorImpl.java new file mode 100644 index 000000000..0dc87fa50 --- /dev/null +++ b/src/test/java/org/apache/fop/threading/IFProcessorImpl.java @@ -0,0 +1,126 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.threading; + +import java.io.File; +import java.io.OutputStream; +import java.net.MalformedURLException; +import java.net.URL; + +import javax.xml.transform.Result; +import javax.xml.transform.Source; +import javax.xml.transform.Templates; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.sax.SAXResult; +import javax.xml.transform.stream.StreamResult; + +import org.xml.sax.ContentHandler; + +import org.apache.avalon.framework.activity.Initializable; +import org.apache.avalon.framework.configuration.Configurable; +import org.apache.avalon.framework.configuration.Configuration; +import org.apache.avalon.framework.configuration.ConfigurationException; +import org.apache.avalon.framework.logger.AbstractLogEnabled; +import org.apache.commons.io.FilenameUtils; + +import org.apache.fop.apps.FOPException; +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.apps.FopFactory; +import org.apache.fop.apps.MimeConstants; +import org.apache.fop.render.intermediate.IFDocumentHandler; +import org.apache.fop.render.intermediate.IFException; +import org.apache.fop.render.intermediate.IFParser; +import org.apache.fop.render.intermediate.IFUtil; + +/** + * Implementation of the {@link Processor} interface that renders IF XML to a final output format. + */ +public class IFProcessorImpl extends AbstractLogEnabled + implements Processor, Configurable, Initializable { + + private FopFactory fopFactory; + private TransformerFactory factory = TransformerFactory.newInstance(); + private String userconfig; + private String mime; + private String fileExtension; + + /** {@inheritDoc} */ + public void configure(Configuration configuration) throws ConfigurationException { + this.userconfig = configuration.getChild("userconfig").getValue(null); + this.mime = configuration.getChild("mime").getValue(MimeConstants.MIME_PDF); + this.fileExtension = configuration.getChild("extension").getValue(".pdf"); + } + + /** {@inheritDoc} */ + public void initialize() throws Exception { + if (this.userconfig != null) { + getLogger().debug("Setting user config: " + userconfig); + fopFactory = FopFactory.newInstance(new File(this.userconfig)); + } else { + fopFactory = FopFactory.newInstance(new File(".").toURI()); + } + } + + /** {@inheritDoc} + * @throws IFException */ + public void process(Source src, Templates templates, OutputStream out) + throws org.apache.fop.apps.FOPException, java.io.IOException, IFException { + FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); + try { + URL url = new URL(src.getSystemId()); + String filename = FilenameUtils.getName(url.getPath()); + foUserAgent.getEventBroadcaster().addEventListener( + new AvalonAdapter(getLogger(), filename)); + } catch (MalformedURLException mfue) { + throw new RuntimeException(mfue); + } + + //Setup target handler + IFDocumentHandler targetHandler = fopFactory.getRendererFactory().createDocumentHandler( + foUserAgent, mime); + + //Setup fonts + IFUtil.setupFonts(targetHandler); + targetHandler.setResult(new StreamResult(out)); + + try { + Transformer transformer; + if (templates == null) { + transformer = factory.newTransformer(); + } else { + transformer = templates.newTransformer(); + } + IFParser parser = new IFParser(); + ContentHandler contentHandler = parser.getContentHandler(targetHandler, foUserAgent); + Result res = new SAXResult(contentHandler); + transformer.transform(src, res); + } catch (TransformerException e) { + throw new FOPException(e); + } + } + + /** {@inheritDoc} */ + public String getTargetFileExtension() { + return this.fileExtension; + } + +} diff --git a/src/test/java/org/apache/fop/threading/Main.java b/src/test/java/org/apache/fop/threading/Main.java new file mode 100644 index 000000000..d18ae405a --- /dev/null +++ b/src/test/java/org/apache/fop/threading/Main.java @@ -0,0 +1,77 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.threading; + +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; + +import org.apache.avalon.framework.ExceptionUtil; +import org.apache.avalon.framework.configuration.Configuration; +import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder; +import org.apache.avalon.framework.container.ContainerUtil; +import org.apache.avalon.framework.logger.ConsoleLogger; + +/** + * Starter class for the multi-threading testbed. + */ +public final class Main { + + private Main() { + } + + private static void prompt() throws IOException { + BufferedReader in = new BufferedReader(new java.io.InputStreamReader(System.in)); + System.out.print("Press return to continue..."); + in.readLine(); + } + + /** + * Main method. + * @param args the command-line arguments + */ + public static void main(String[] args) { + try { + //Read configuration + File cfgFile = new File(args[0]); + DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder(); + Configuration cfg = builder.buildFromFile(cfgFile); + + boolean doPrompt = cfg.getAttributeAsBoolean("prompt", false); + if (doPrompt) { + prompt(); + } + + //Setup testbed + FOPTestbed testbed = new FOPTestbed(); + ContainerUtil.enableLogging(testbed, new ConsoleLogger(ConsoleLogger.LEVEL_INFO)); + ContainerUtil.configure(testbed, cfg); + ContainerUtil.initialize(testbed); + + //Start tests + testbed.doStressTest(); + + System.exit(0); + } catch (Exception e) { + System.err.println(ExceptionUtil.printStackTrace(e)); + System.exit(-1); + } + } +} diff --git a/src/test/java/org/apache/fop/threading/Processor.java b/src/test/java/org/apache/fop/threading/Processor.java new file mode 100644 index 000000000..2f37c02a1 --- /dev/null +++ b/src/test/java/org/apache/fop/threading/Processor.java @@ -0,0 +1,47 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.threading; + +import java.io.OutputStream; + +import javax.xml.transform.Source; +import javax.xml.transform.Templates; + +/** + * Represents a processor. + */ +public interface Processor { + + /** + * Process a file. + * @param src the Source for the FO or XML file + * @param templates a JAXP Templates object for an XSLT transformation or null + * @param out the OutputStream for the target file + * @throws Exception if an error occurs + */ + void process(Source src, Templates templates, OutputStream out) + throws Exception; + + /** + * Returns the target file extension for the configured output format. + * @return the target file extension (for example ".pdf") + */ + String getTargetFileExtension(); +} diff --git a/src/test/java/org/apache/fop/threading/sample.cfg.xml b/src/test/java/org/apache/fop/threading/sample.cfg.xml new file mode 100644 index 000000000..a4de0d754 --- /dev/null +++ b/src/test/java/org/apache/fop/threading/sample.cfg.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<config prompt="false"> + <threads>2</threads> + <output-dir>C:/Dev/FOP/temp/out</output-dir> + <processor class="org.apache.fop.threading.FOProcessorImpl"> + <!-- + <userconfig>C:/Dev/FOP/temp/userconfig.xml</userconfig> + --> + <mime>application/pdf</mime> + <extension>.pdf</extension> + </processor> + <tasks repeat="2"> + <task fo="C:/Dev/FOP/temp/helloworld.fo"/> + <task xml="C:/Dev/FOP/temp/page-x-of-y.xml" xslt="C:/Dev/FOP/temp/page-x-of-y.xsl"/> + </tasks> +</config> diff --git a/src/test/java/org/apache/fop/traits/BorderPropsTestCase.java b/src/test/java/org/apache/fop/traits/BorderPropsTestCase.java new file mode 100644 index 000000000..692e3059f --- /dev/null +++ b/src/test/java/org/apache/fop/traits/BorderPropsTestCase.java @@ -0,0 +1,82 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.traits; + +import java.awt.Color; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +import org.apache.xmlgraphics.java2d.color.ColorWithAlternatives; +import org.apache.xmlgraphics.java2d.color.DeviceCMYKColorSpace; + +import org.apache.fop.fo.Constants; +import org.apache.fop.util.ColorUtil; + +/** + * Tests the BorderProps class. + */ +public class BorderPropsTestCase { + + /** + * Test serialization and deserialization to/from String. + * @throws Exception if an error occurs + */ + @Test + public void testSerialization() throws Exception { + Color col = new Color(1.0f, 1.0f, 0.5f, 1.0f); + //Normalize: Avoid false alarms due to color conversion (rounding) + col = ColorUtil.parseColorString(null, ColorUtil.colorToString(col)); + BorderProps sut = BorderProps.makeRectangular(Constants.EN_DOUBLE, 1250, col, + BorderProps.Mode.COLLAPSE_OUTER); + testSerialization(sut); + + float[] cmyk = new float[] {1.0f, 1.0f, 0.5f, 1.0f}; + col = DeviceCMYKColorSpace.createCMYKColor(cmyk); + //Convert to sRGB with CMYK alternative as constructed by the cmyk() function + float[] rgb = col.getRGBColorComponents(null); + col = new ColorWithAlternatives(rgb[0], rgb[1], rgb[2], new Color[] {col}); + sut = BorderProps.makeRectangular(Constants.EN_INSET, 9999, col, BorderProps.Mode.SEPARATE); + testSerialization(sut); + } + + /** + * Test serialization and deserialization to/from String. + * @throws Exception if an error occurs + */ + @Test + public void testSerializationWithCornerRadii() throws Exception { + Color col = new Color(1.0f, 1.0f, 0.5f, 1.0f); + //Normalize: Avoid false alarms due to color conversion (rounding) + col = ColorUtil.parseColorString(null, ColorUtil.colorToString(col)); + for (BorderProps.Mode mode : BorderProps.Mode.values()) { + BorderProps sut = BorderProps.makeRectangular(Constants.EN_SOLID, 10, col, mode); + testSerialization(sut); + sut = new BorderProps(Constants.EN_SOLID, 10, 4, 3, col, mode); + testSerialization(sut); + } + } + + private void testSerialization(BorderProps borderProp) { + assertEquals(borderProp, BorderProps.valueOf(null, borderProp.toString())); + } + +} diff --git a/src/test/java/org/apache/fop/traits/MinOptMaxTestCase.java b/src/test/java/org/apache/fop/traits/MinOptMaxTestCase.java new file mode 100644 index 000000000..ba6862785 --- /dev/null +++ b/src/test/java/org/apache/fop/traits/MinOptMaxTestCase.java @@ -0,0 +1,224 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.traits; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +/** + * Tests the {@link MinOptMax} class. + */ +public class MinOptMaxTestCase { + + /** + * Tests that the constant <code>MinOptMax.ZERO</code> is really zero. + */ + @Test + public void testZero() { + assertEquals(MinOptMax.getInstance(0), MinOptMax.ZERO); + } + + @Test + public void testNewStiffMinOptMax() { + MinOptMax value = MinOptMax.getInstance(1); + assertTrue(value.isStiff()); + assertEquals(1, value.getMin()); + assertEquals(1, value.getOpt()); + assertEquals(1, value.getMax()); + } + + @Test + public void testNewMinOptMax() { + MinOptMax value = MinOptMax.getInstance(1, 2, 3); + assertTrue(value.isElastic()); + assertEquals(1, value.getMin()); + assertEquals(2, value.getOpt()); + assertEquals(3, value.getMax()); + } + + /** + * Test that it is possible to create stiff instances with the normal factory method. + */ + @Test + public void testNewMinOptMaxStiff() { + MinOptMax value = MinOptMax.getInstance(1, 1, 1); + assertTrue(value.isStiff()); + assertEquals(1, value.getMin()); + assertEquals(1, value.getOpt()); + assertEquals(1, value.getMax()); + } + + @Test + public void testNewMinOptMaxMinGreaterOpt() { + try { + MinOptMax.getInstance(1, 0, 2); + fail(); + } catch (IllegalArgumentException e) { + assertEquals("min (1) > opt (0)", e.getMessage()); + } + } + + @Test + public void testNewMinOptMaxMaxSmallerOpt() { + try { + MinOptMax.getInstance(0, 1, 0); + fail(); + } catch (IllegalArgumentException e) { + assertEquals("max (0) < opt (1)", e.getMessage()); + } + } + + @Test + public void testShrinkablility() { + assertEquals(0, MinOptMax.getInstance(1).getShrink()); + assertEquals(1, MinOptMax.getInstance(1, 2, 2).getShrink()); + assertEquals(2, MinOptMax.getInstance(1, 3, 3).getShrink()); + } + + @Test + public void testStrechablilty() { + assertEquals(0, MinOptMax.getInstance(1).getStretch()); + assertEquals(1, MinOptMax.getInstance(1, 1, 2).getStretch()); + assertEquals(2, MinOptMax.getInstance(1, 1, 3).getStretch()); + } + + @Test + public void testPlus() { + assertEquals(MinOptMax.ZERO, + MinOptMax.ZERO.plus(MinOptMax.ZERO)); + assertEquals(MinOptMax.getInstance(1, 2, 3), + MinOptMax.ZERO.plus(MinOptMax.getInstance(1, 2, 3))); + assertEquals(MinOptMax.getInstance(2, 4, 6), + MinOptMax.getInstance(1, 2, 3).plus(MinOptMax.getInstance(1, 2, 3))); + assertEquals(MinOptMax.getInstance(4, 5, 6), MinOptMax.getInstance(1, 2, 3).plus(3)); + } + + @Test + public void testMinus() { + assertEquals(MinOptMax.ZERO, + MinOptMax.ZERO.minus(MinOptMax.ZERO)); + assertEquals(MinOptMax.getInstance(1, 2, 3), + MinOptMax.getInstance(1, 2, 3).plus(MinOptMax.ZERO)); + assertEquals(MinOptMax.getInstance(1, 2, 3), + MinOptMax.getInstance(2, 4, 6).minus(MinOptMax.getInstance(1, 2, 3))); + assertEquals(MinOptMax.getInstance(1, 2, 3), MinOptMax.getInstance(5, 6, 7).minus(4)); + } + + @Test + public void testMinusFail1() { + try { + MinOptMax.ZERO.minus(MinOptMax.getInstance(1, 2, 3)); + fail(); + } catch (ArithmeticException e) { + // Ok + } + } + + @Test + public void testMinusFail2() { + try { + MinOptMax.getInstance(1, 2, 3).minus(MinOptMax.getInstance(1, 3, 3)); + fail(); + } catch (ArithmeticException e) { + // Ok + } + } + + @Test + public void testMinusFail3() { + try { + MinOptMax.ZERO.minus(MinOptMax.getInstance(1, 1, 2)); + fail(); + } catch (ArithmeticException e) { + // Ok + } + } + + @Test + public void testMinusFail4() { + try { + MinOptMax.getInstance(1, 2, 3).minus(MinOptMax.getInstance(1, 1, 3)); + fail(); + } catch (ArithmeticException e) { + // Ok + } + } + + @Test + public void testMult() { + assertEquals(MinOptMax.ZERO, MinOptMax.ZERO.mult(0)); + assertEquals(MinOptMax.getInstance(1, 2, 3), MinOptMax.getInstance(1, 2, 3).mult(1)); + assertEquals(MinOptMax.getInstance(2, 4, 6), MinOptMax.getInstance(1, 2, 3).mult(2)); + } + + @Test + public void testMultFail() { + try { + MinOptMax.getInstance(1, 2, 3).mult(-1); + fail(); + } catch (IllegalArgumentException e) { + assertEquals("factor < 0; was: -1", e.getMessage()); + } + } + + @Test + public void testNonZero() { + assertFalse(MinOptMax.ZERO.isNonZero()); + assertTrue(MinOptMax.getInstance(1).isNonZero()); + assertTrue(MinOptMax.getInstance(1, 2, 3).isNonZero()); + } + + @Test + public void testExtendMinimum() { + assertEquals(MinOptMax.getInstance(1, 1, 1), + MinOptMax.ZERO.extendMinimum(1)); + assertEquals(MinOptMax.getInstance(1, 2, 3), + MinOptMax.getInstance(1, 2, 3).extendMinimum(1)); + assertEquals(MinOptMax.getInstance(2, 2, 3), + MinOptMax.getInstance(1, 2, 3).extendMinimum(2)); + assertEquals(MinOptMax.getInstance(3, 3, 3), + MinOptMax.getInstance(1, 2, 3).extendMinimum(3)); + assertEquals(MinOptMax.getInstance(4, 4, 4), + MinOptMax.getInstance(1, 2, 3).extendMinimum(4)); + } + + @Test + public void testEquals() { + MinOptMax number = MinOptMax.getInstance(1, 3, 5); + assertEquals(number, number); + assertEquals(number, MinOptMax.getInstance(1, 3, 5)); + assertFalse(number.equals(MinOptMax.getInstance(2, 3, 5))); + assertFalse(number.equals(MinOptMax.getInstance(1, 4, 5))); + assertFalse(number.equals(MinOptMax.getInstance(1, 3, 4))); + assertFalse(number.equals(null)); + assertFalse(number.equals(new Integer(1))); + } + + @Test + public void testHashCode() { + MinOptMax number = MinOptMax.getInstance(1, 2, 3); + assertEquals(number.hashCode(), number.hashCode()); + assertEquals(number.hashCode(), MinOptMax.getInstance(1, 2, 3).hashCode()); + } +} diff --git a/src/test/java/org/apache/fop/util/AdvancedMessageFormatTestCase.java b/src/test/java/org/apache/fop/util/AdvancedMessageFormatTestCase.java new file mode 100644 index 000000000..5e75f2563 --- /dev/null +++ b/src/test/java/org/apache/fop/util/AdvancedMessageFormatTestCase.java @@ -0,0 +1,189 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.util; + +import java.util.Map; + +import org.junit.Test; +import org.xml.sax.helpers.LocatorImpl; + +import static org.junit.Assert.assertEquals; + +import org.apache.fop.events.model.EventSeverity; +import org.apache.fop.util.text.AdvancedMessageFormat; + +/** + * Tests for EventFormatter. + */ +public class AdvancedMessageFormatTestCase { + + @Test + public void testFormatting() throws Exception { + String msg; + AdvancedMessageFormat format; + + String pattern + = "Element \"{elementName}\" is missing[ required property \"{propertyName}\"]!"; + format = new AdvancedMessageFormat(pattern); + + Map params = new java.util.HashMap(); + params.put("node", new Object()); + params.put("elementName", "fo:external-graphic"); + params.put("propertyName", "src"); + + msg = format.format(params); + assertEquals("Element \"fo:external-graphic\" is missing required property \"src\"!", msg); + + params.remove("propertyName"); + msg = format.format(params); + assertEquals("Element \"fo:external-graphic\" is missing!", msg); + + pattern + = "Testing \\{escaped \\[characters\\], now a normal field {elementName}!"; + format = new AdvancedMessageFormat(pattern); + msg = format.format(params); + assertEquals("Testing {escaped [characters], now a normal field fo:external-graphic!", msg); + + pattern = "Multi-conditional: [case1: {var1}|case2: {var2}|case3: {var3}]"; + format = new AdvancedMessageFormat(pattern); + + params = new java.util.HashMap(); + msg = format.format(params); + assertEquals("Multi-conditional: ", msg); + + params.put("var3", "value3"); + msg = format.format(params); + assertEquals("Multi-conditional: case3: value3", msg); + params.put("var1", "value1"); + msg = format.format(params); + assertEquals("Multi-conditional: case1: value1", msg); + } + + @Test + public void testObjectFormatting() throws Exception { + String msg; + AdvancedMessageFormat format; + + String pattern + = "Here's a Locator: {locator}"; + format = new AdvancedMessageFormat(pattern); + + Map params = new java.util.HashMap(); + LocatorImpl loc = new LocatorImpl(); + loc.setColumnNumber(7); + loc.setLineNumber(12); + params.put("locator", loc); + + msg = format.format(params); + assertEquals("Here\'s a Locator: 12:7", msg); + } + + @Test + public void testIfFormatting() throws Exception { + String msg; + AdvancedMessageFormat format; + + format = new AdvancedMessageFormat("You are{isBad,if, not} nice!"); + + Map params = new java.util.HashMap(); + + params.put("isBad", Boolean.FALSE); + msg = format.format(params); + assertEquals("You are nice!", msg); + + params.put("isBad", Boolean.TRUE); + msg = format.format(params); + assertEquals("You are not nice!", msg); + + format = new AdvancedMessageFormat("You are{isGood,if, very, not so} nice!"); + + params = new java.util.HashMap(); + + msg = format.format(params); //isGood is missing + assertEquals("You are not so nice!", msg); + + params.put("isGood", Boolean.FALSE); + msg = format.format(params); + assertEquals("You are not so nice!", msg); + + params.put("isGood", Boolean.TRUE); + msg = format.format(params); + assertEquals("You are very nice!", msg); + + format = new AdvancedMessageFormat("You are{isGood,if, very\\, very} nice!"); + + params = new java.util.HashMap(); + + msg = format.format(params); //isGood is missing + assertEquals("You are nice!", msg); + + params.put("isGood", Boolean.FALSE); + msg = format.format(params); + assertEquals("You are nice!", msg); + + params.put("isGood", Boolean.TRUE); + msg = format.format(params); + assertEquals("You are very, very nice!", msg); + } + + @Test + public void testEqualsFormatting() throws Exception { + String msg; + AdvancedMessageFormat format; + + format = new AdvancedMessageFormat( + "Error{severity,equals,EventSeverity:FATAL,,\nSome explanation!}"); + + Map params = new java.util.HashMap(); + + params.put("severity", EventSeverity.FATAL); + msg = format.format(params); + assertEquals("Error", msg); + + params.put("severity", EventSeverity.WARN); + msg = format.format(params); + assertEquals("Error\nSome explanation!", msg); + } + + @Test + public void testChoiceFormatting() throws Exception { + String msg; + AdvancedMessageFormat format; + + format = new AdvancedMessageFormat( + "You have {amount,choice,0#nothing|0<{amount} bucks|100<more than enough}."); + + Map params = new java.util.HashMap(); + + params.put("amount", new Integer(0)); + msg = format.format(params); + assertEquals("You have nothing.", msg); + + params.put("amount", new Integer(7)); + msg = format.format(params); + assertEquals("You have 7 bucks.", msg); + + params.put("amount", new Integer(140)); + msg = format.format(params); + assertEquals("You have more than enough.", msg); + + } + +} diff --git a/src/test/java/org/apache/fop/util/BitmapImageUtilTestCase.java b/src/test/java/org/apache/fop/util/BitmapImageUtilTestCase.java new file mode 100644 index 000000000..8bda99785 --- /dev/null +++ b/src/test/java/org/apache/fop/util/BitmapImageUtilTestCase.java @@ -0,0 +1,169 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.util; + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics2D; +import java.awt.image.BufferedImage; +import java.awt.image.RenderedImage; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.StringWriter; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +import org.apache.commons.io.IOUtils; + +import org.apache.xmlgraphics.image.writer.ImageWriterUtil; +import org.apache.xmlgraphics.util.WriterOutputStream; +import org.apache.xmlgraphics.util.io.ASCIIHexOutputStream; + +import org.apache.fop.util.bitmap.BitmapImageUtil; +import org.apache.fop.util.bitmap.MonochromeBitmapConverter; + +/** + * Tests {@link BitmapImageUtil}. + */ +public class BitmapImageUtilTestCase { + + private static final boolean DEBUG = true; + private static final boolean TEST_PIXELS = false; + + /** + * Tests the convertTo* methods. + * @throws Exception if an error occurs + */ + @Test + public void testConvertToMono() throws Exception { + BufferedImage testImage = createTestImage(); + saveAsPNG(testImage, "test-image"); + + RenderedImage img; + Dimension scaled = new Dimension(320, 240); + + img = BitmapImageUtil.convertToGrayscale(testImage, null); + saveAsPNG(img, "out-gray"); + assertEquals(1, img.getColorModel().getNumComponents()); + assertEquals(8, img.getColorModel().getPixelSize()); + assertEquals(640, img.getWidth()); + assertEquals(480, img.getHeight()); + assertPixels("5757575757575757575757FFFFFFFFFF", img, 220, 34, 16); + + img = BitmapImageUtil.convertToGrayscale(testImage, scaled); + saveAsPNG(img, "out-gray-scaled"); + assertEquals(1, img.getColorModel().getNumComponents()); + assertEquals(8, img.getColorModel().getPixelSize()); + assertEquals(320, img.getWidth()); + assertEquals(240, img.getHeight()); + + img = BitmapImageUtil.convertToMonochrome(testImage, null); + saveAsPNG(img, "out-mono"); + assertEquals(1, img.getColorModel().getPixelSize()); + assertEquals(640, img.getWidth()); + assertEquals(480, img.getHeight()); + assertPixels("00000000000000000000000101010101", img, 220, 34, 16); + + if (isJAIAvailable()) { + img = BitmapImageUtil.convertToMonochrome(testImage, null, 0.5f); + saveAsPNG(img, "out-mono-jai-0.5"); + assertEquals(1, img.getColorModel().getPixelSize()); + assertEquals(640, img.getWidth()); + assertEquals(480, img.getHeight()); + assertPixels("00010000000100000001000101010101", img, 220, 34, 16); + + img = BitmapImageUtil.convertToMonochrome(testImage, null, 1.0f); + saveAsPNG(img, "out-mono-jai-1.0"); + assertEquals(1, img.getColorModel().getPixelSize()); + assertEquals(640, img.getWidth()); + assertEquals(480, img.getHeight()); + assertPixels("01000001000001000001000101010101", img, 220, 34, 16); + } + } + + private void assertPixels(String expected, RenderedImage img, int x, int y, int w) + throws IOException { + if (TEST_PIXELS) { + byte[] byteArray = (byte[])img.getData().getDataElements(x, y, w, 1, new byte[w]); + assertEquals(expected, toHex(byteArray)); + } + } + + private boolean isJAIAvailable() { + MonochromeBitmapConverter converter + = BitmapImageUtil.createDefaultMonochromeBitmapConverter(); + return converter.getClass().getName().contains("JAI"); + } + + private void saveAsPNG(RenderedImage img, String name) throws IOException { + if (DEBUG) { + File baseDir = new File("./build/test-results/bitmap-conversion"); + baseDir.mkdirs(); + ImageWriterUtil.saveAsPNG(img, new File(baseDir, name + ".png")); + } + } + + private String toHex(byte[] byteArray) throws IOException { + InputStream in = new java.io.ByteArrayInputStream(byteArray); + StringWriter writer = new StringWriter(); + WriterOutputStream wo = new WriterOutputStream(writer, "US-ASCII"); + ASCIIHexOutputStream hex = new ASCIIHexOutputStream(wo); + IOUtils.copyLarge(in, hex); + return writer.toString(); + } + + private BufferedImage createTestImage() { + BufferedImage buf = new BufferedImage(640, 480, BufferedImage.TYPE_INT_RGB); + Graphics2D g2d = buf.createGraphics(); + g2d.setBackground(Color.WHITE); + g2d.clearRect(0, 0, buf.getWidth(), buf.getHeight()); + + //A few rectangles rotated and with different color + Graphics2D copy = (Graphics2D)g2d.create(); + copy.translate(170, 170); + int c = 12; + for (int i = 0; i < c; i++) { + float f = ((i + 1) / (float)c); + Color col = new Color(0.0f, 1 - f, 0.0f); + copy.setColor(col); + copy.fillRect(0, 0, 120, 120); + copy.rotate(-2 * Math.PI / c); + } + copy.dispose(); + + //the same in gray scales + copy = (Graphics2D)g2d.create(); + copy.translate(470, 310); + c = 12; + for (int i = 0; i < c; i++) { + float f = ((i + 1) / (float)c); + Color col = new Color(f, f, f); + copy.setColor(col); + copy.fillRect(0, 0, 120, 120); + copy.rotate(-2 * Math.PI / c); + } + copy.dispose(); + return buf; + } + +} diff --git a/src/test/java/org/apache/fop/util/ColorUtilTestCase.java b/src/test/java/org/apache/fop/util/ColorUtilTestCase.java new file mode 100644 index 000000000..c86ebbeac --- /dev/null +++ b/src/test/java/org/apache/fop/util/ColorUtilTestCase.java @@ -0,0 +1,338 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.util; + +import java.awt.Color; +import java.awt.color.ColorSpace; +import java.io.File; +import java.net.URI; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import org.apache.xmlgraphics.java2d.color.ColorSpaces; +import org.apache.xmlgraphics.java2d.color.ColorWithAlternatives; +import org.apache.xmlgraphics.java2d.color.NamedColorSpace; +import org.apache.xmlgraphics.java2d.color.RenderingIntent; + +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.apps.FopFactory; + +/** + * Tests the ColorUtil class. + */ +public class ColorUtilTestCase { + private FopFactory fopFactory = FopFactory.newInstance(new File(".").toURI()); + + /** + * Test serialization to String. + * @throws Exception if an error occurs + */ + @Test + public void testSerialization() throws Exception { + Color col = new Color(1.0f, 1.0f, 0.5f, 1.0f); + String s = ColorUtil.colorToString(col); + + //This is what the old color spit out. Now it is 80 due to rounding + //assertEquals("#ffff7f", s); + assertEquals("#ffff80", s); + + col = new Color(1.0f, 0.0f, 0.0f, 0.8f); + s = ColorUtil.colorToString(col); + assertEquals("#ff0000cc", s); + } + + /** + * Test deserialization from String. + * @throws Exception if an error occurs + */ + @Test + public void testDeserialization() throws Exception { + Color col = ColorUtil.parseColorString(null, "#ffff7f"); + assertEquals(255, col.getRed()); + assertEquals(255, col.getGreen()); + assertEquals(127, col.getBlue()); + assertEquals(255, col.getAlpha()); + + col = ColorUtil.parseColorString(null, "#ff0000cc"); + assertEquals(255, col.getRed()); + assertEquals(0, col.getGreen()); + assertEquals(0, col.getBlue()); + assertEquals(204, col.getAlpha()); + } + + /** + * Test equals(). + * @throws Exception if an error occurs + */ + @Test + public void testEquals() throws Exception { + Color col1 = ColorUtil.parseColorString(null, "#ff0000cc"); + Color col2 = ColorUtil.parseColorString(null, "#ff0000cc"); + assertEquals(col1, col2); + + col1 = ColorUtil.parseColorString(null, "fop-rgb-icc(0.5,0.5,0.5,#CMYK,,0.0,0.0,0.0,0.5)"); + /* The following doesn't work since java.awt.Color from Sun doesn't round consistently + col2 = ColorUtil.parseColorString(null, "cmyk(0.0,0.0,0.0,0.5)"); + assertEquals(col1, col2); + */ + + col2 = ColorUtil.parseColorString(null, "fop-rgb-icc(0.5,0.5,0.5,#CMYK,,0.5,0.5,0.5,0.0)"); + assertTrue(col1.equals(col2)); + assertFalse(org.apache.xmlgraphics.java2d.color.ColorUtil.isSameColor(col1, col2)); + } + + /** + * Tests the rgb() function. + * @throws Exception if an error occurs + */ + @Test + public void testRGB() throws Exception { + + FOUserAgent ua = fopFactory.newFOUserAgent(); + Color colActual; + + colActual = ColorUtil.parseColorString(ua, "rgb(255, 40, 0)"); + assertEquals(255, colActual.getRed()); + assertEquals(40, colActual.getGreen()); + assertEquals(0, colActual.getBlue()); + assertEquals(255, colActual.getAlpha()); + assertEquals(ColorSpace.getInstance(ColorSpace.CS_sRGB), colActual.getColorSpace()); + } + + /** + * Tests the fop-rgb-icc() function. + * @throws Exception if an error occurs + */ + @Test + public void testRGBICC() throws Exception { + FopFactory fopFactory = FopFactory.newInstance(new File(".").toURI()); + URI sRGBLoc = new URI("src/java/org/apache/fop/pdf/sRGB%20Color%20Space%20Profile.icm"); + ColorSpace cs = fopFactory.getColorSpaceCache().get( + "sRGBAlt", sRGBLoc.toASCIIString(), RenderingIntent.AUTO); + assertNotNull("Color profile not found", cs); + + FOUserAgent ua = fopFactory.newFOUserAgent(); + ColorWithFallback colActual; + + //fop-rgb-icc() is used instead of rgb-icc() inside FOP! + String colSpec = "fop-rgb-icc(1.0,0.0,0.0,sRGBAlt," + + "\"" + sRGBLoc.toASCIIString() + "\",1.0,0.0,0.0)"; + colActual = (ColorWithFallback)ColorUtil.parseColorString(ua, colSpec); + assertEquals(cs, colActual.getColorSpace()); + assertEquals(255, colActual.getRed(), 2f); //Java 5: 253, Java 6: 255 + assertEquals(0, colActual.getGreen(), 25f); //Java 5: 25, Java 6: 0 + assertEquals(0, colActual.getBlue()); + //I don't understand the difference. Maybe Java's sRGB and HP's sRGB are somehow not + //equivalent. This is only going to be a problem if anyone actually makes use of the + //RGB fallback in any renderer. + //TODO Anyone know what's going on here? + float[] comps = colActual.getColorComponents(null); + assertEquals(3, comps.length); + assertEquals(1f, comps[0], 0); + assertEquals(0f, comps[1], 0); + assertEquals(0f, comps[2], 0); + assertEquals(0, colActual.getAlternativeColors().length); + + Color fallback = colActual.getFallbackColor(); + assertTrue(fallback.getColorSpace().isCS_sRGB()); + assertEquals(255, fallback.getRed()); + assertEquals(0, fallback.getGreen()); + assertEquals(0, fallback.getBlue()); + + assertEquals(colSpec, ColorUtil.colorToString(colActual)); + + colSpec = "fop-rgb-icc(1.0,0.5,0.0,blah," + + "\"invalid.icm\",1.0,0.5,0.0,0.15)"; + Color colFallback = ColorUtil.parseColorString(ua, colSpec); + assertEquals(new Color(1.0f, 0.5f, 0.0f), colFallback); + } + + /** + * Tests the cmyk() function. + * @throws Exception if an error occurs + */ + @Test + public void testCMYK() throws Exception { + ColorWithAlternatives colActual; + String colSpec; + + colSpec = "cmyk(0.0, 0.0, 1.0, 0.0)"; + colActual = (ColorWithAlternatives)ColorUtil.parseColorString(null, colSpec); + assertEquals(255, colActual.getRed()); + assertEquals(255, colActual.getGreen()); + assertEquals(0, colActual.getBlue()); + Color alt = colActual.getAlternativeColors()[0]; + assertEquals(ColorSpaces.getDeviceCMYKColorSpace(), alt.getColorSpace()); + float[] comps = alt.getColorComponents(null); + assertEquals(4, comps.length); + assertEquals(0f, comps[0], 0); + assertEquals(0f, comps[1], 0); + assertEquals(1f, comps[2], 0); + assertEquals(0f, comps[3], 0); + assertEquals("fop-rgb-icc(1.0,1.0,0.0,#CMYK,,0.0,0.0,1.0,0.0)", + ColorUtil.colorToString(colActual)); + + colSpec = "cmyk(0.0274, 0.2196, 0.3216, 0.0)"; + colActual = (ColorWithAlternatives)ColorUtil.parseColorString(null, colSpec); + assertEquals(248, colActual.getRed(), 1); + assertEquals(199, colActual.getGreen(), 1); + assertEquals(172, colActual.getBlue(), 1); + alt = colActual.getAlternativeColors()[0]; + assertEquals(ColorSpaces.getDeviceCMYKColorSpace(), alt.getColorSpace()); + comps = alt.getColorComponents(null); + assertEquals(0.0274f, comps[0], 0.001); + assertEquals(0.2196f, comps[1], 0.001); + assertEquals(0.3216f, comps[2], 0.001); + assertEquals(0f, comps[3], 0); + assertEquals("fop-rgb-icc(0.9726,0.7804,0.67840004,#CMYK,,0.0274,0.2196,0.3216,0.0)", + ColorUtil.colorToString(colActual)); + + colSpec = "fop-rgb-icc(1.0,1.0,0.0,#CMYK,,0.0,0.0,1.0,0.0)"; + colActual = (ColorWithAlternatives)ColorUtil.parseColorString(null, colSpec); + assertEquals(255, colActual.getRed()); + assertEquals(255, colActual.getGreen()); + assertEquals(0, colActual.getBlue()); + alt = colActual.getAlternativeColors()[0]; + assertEquals(ColorSpaces.getDeviceCMYKColorSpace(), alt.getColorSpace()); + comps = alt.getColorComponents(null); + assertEquals(4, comps.length); + assertEquals(0f, comps[0], 0); + assertEquals(0f, comps[1], 0); + assertEquals(1f, comps[2], 0); + assertEquals(0f, comps[3], 0); + assertEquals("fop-rgb-icc(1.0,1.0,0.0,#CMYK,,0.0,0.0,1.0,0.0)", + ColorUtil.colorToString(colActual)); + + colSpec = "fop-rgb-icc(0.5,0.5,0.5,#CMYK,,0.0,0.0,0.0,0.5)"; + colActual = (ColorWithAlternatives)ColorUtil.parseColorString(null, colSpec); + assertEquals(127, colActual.getRed(), 1); + assertEquals(127, colActual.getGreen(), 1); + assertEquals(127, colActual.getBlue(), 1); + alt = colActual.getAlternativeColors()[0]; + assertEquals(ColorSpaces.getDeviceCMYKColorSpace(), alt.getColorSpace()); + comps = alt.getColorComponents(null); + assertEquals(4, comps.length); + assertEquals(0f, comps[0], 0); + assertEquals(0f, comps[1], 0); + assertEquals(0f, comps[2], 0); + assertEquals(0.5f, comps[3], 0); + assertEquals("fop-rgb-icc(0.5,0.5,0.5,#CMYK,,0.0,0.0,0.0,0.5)", + ColorUtil.colorToString(colActual)); + + //Verify that the cmyk() and fop-rgb-icc(#CMYK) functions have the same results + ColorWithAlternatives colCMYK = (ColorWithAlternatives)ColorUtil.parseColorString( + null, "cmyk(0,0,0,0.5)"); + assertEquals(colCMYK.getAlternativeColors()[0], colActual.getAlternativeColors()[0]); + //The following doesn't work: + //assertEquals(colCMYK, colActual); + //java.awt.Color does not consistenly calculate the int RGB values: + //Color(ColorSpace cspace, float components[], float alpha): 0.5 --> 127 + //Color(float r, float g, float b): 0.5 --> 128 + if (!colCMYK.equals(colActual)) { + System.out.println("Info: java.awt.Color does not consistently calculate" + + " int RGB values from float RGB values."); + } + } + + /** + * Tests color for the #Separation pseudo-colorspace. + * @throws Exception if an error occurs + */ + @Test + public void testSeparationColor() throws Exception { + ColorWithFallback colActual; + String colSpec; + + colSpec = "fop-rgb-icc(1.0,0.8,0.0,#Separation,,Postgelb)"; + colActual = (ColorWithFallback)ColorUtil.parseColorString(null, colSpec); + assertEquals(255, colActual.getRed(), 5); + assertEquals(204, colActual.getGreen(), 3); + assertEquals(0, colActual.getBlue(), 12); + //sRGB results differ between JDKs + + Color fallback = colActual.getFallbackColor(); + assertEquals(255, fallback.getRed()); + assertEquals(204, fallback.getGreen()); + assertEquals(0, fallback.getBlue()); + + assertFalse(colActual.hasAlternativeColors()); + + assertTrue(colActual.getColorSpace() instanceof NamedColorSpace); + NamedColorSpace ncs; + ncs = (NamedColorSpace)colActual.getColorSpace(); + assertEquals("Postgelb", ncs.getColorName()); + float[] comps = colActual.getColorComponents(null); + assertEquals(1, comps.length); + assertEquals(1f, comps[0], 0); + assertEquals(colSpec, ColorUtil.colorToString(colActual)); + + } + + /** + * Tests the fop-rgb-named-color() function. + * @throws Exception if an error occurs + */ + @Test + public void testNamedColorProfile() throws Exception { + FopFactory fopFactory = FopFactory.newInstance(new File("./").toURI()); + URI ncpLoc = new URI("test/resources/color/ncp-example.icc"); + ColorSpace cs = fopFactory.getColorSpaceCache().get( + "NCP", ncpLoc.toASCIIString(), RenderingIntent.AUTO); + assertNotNull("Color profile not found", cs); + + FOUserAgent ua = fopFactory.newFOUserAgent(); + ColorWithFallback colActual; + + //fop-rgb-named-color() is used instead of rgb-named-color() inside FOP! + String colSpec = "fop-rgb-named-color(1.0,0.8,0.0,NCP," + + "\"" + ncpLoc.toASCIIString() + "\",Postgelb)"; + colActual = (ColorWithFallback)ColorUtil.parseColorString(ua, colSpec); + assertEquals(255, colActual.getRed(), 2); + assertEquals(193, colActual.getGreen(), 2); + assertEquals(0, colActual.getBlue()); + + Color fallback = colActual.getFallbackColor(); + assertEquals(255, fallback.getRed()); + assertEquals(204, fallback.getGreen()); + assertEquals(0, fallback.getBlue()); + assertEquals(ColorSpace.getInstance(ColorSpace.CS_sRGB), fallback.getColorSpace()); + + float[] comps = fallback.getColorComponents(null); + assertEquals(3, comps.length); + assertEquals(1f, comps[0], 0); + assertEquals(0.8f, comps[1], 0); + assertEquals(0f, comps[2], 0); + + assertTrue(colActual.getColorSpace() instanceof NamedColorSpace); + NamedColorSpace ncs; + ncs = (NamedColorSpace)colActual.getColorSpace(); + assertEquals("Postgelb", ncs.getColorName()); + comps = colActual.getColorComponents(null); + assertEquals(1, comps.length); + assertEquals(1f, comps[0], 0); + + assertEquals(colSpec, ColorUtil.colorToString(colActual)); + } +} diff --git a/src/test/java/org/apache/fop/util/CompareUtilTestCase.java b/src/test/java/org/apache/fop/util/CompareUtilTestCase.java new file mode 100644 index 000000000..e0f769afc --- /dev/null +++ b/src/test/java/org/apache/fop/util/CompareUtilTestCase.java @@ -0,0 +1,98 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.util; + +import java.util.ArrayList; +import java.util.List; +import java.util.Vector; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.concurrent.atomic.AtomicBoolean; + +import org.junit.Test; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; + +public class CompareUtilTestCase { + + @Test + public void testEqual() { + int numberOfParallelThreads = Runtime.getRuntime().availableProcessors(); + long numberOfEqualOperations = 100; + double probabilityOf12 = 0.5; + + ExecutorService executor = Executors.newFixedThreadPool(numberOfParallelThreads); + + final Vector object1 = new Vector(); + object1.add(new Object()); + object1.add(new Object()); + object1.add(new Object()); + object1.add(new Object()); + object1.add(new Object()); + final Vector object2 = new Vector(); + object2.add(new Object()); + object2.add(new Object()); + object2.add(new Object()); + object2.add(new Object()); + object2.add(new Object()); + object2.add(new Object()); + object2.add(new Object()); + object2.add(new Object()); + object2.add(new Object()); + object2.add(new Object()); + final boolean areEqual = object1.equals(object2); + final AtomicBoolean wrongResult = new AtomicBoolean(false); + + Runnable equal12 = new Runnable() { + public void run() { + if (areEqual != CompareUtil.equal(object1, object2)) { + wrongResult.set(true); + } + } + }; + Runnable equal21 = new Runnable() { + public void run() { + if (areEqual != CompareUtil.equal(object2, object1)) { + wrongResult.set(true); + } + } + }; + + List<Future<?>> futures = new ArrayList<Future<?>>(); + for (int i = 1; i <= numberOfEqualOperations; i++) { + Runnable randomTask = Math.random() < probabilityOf12 ? equal12 : equal21; + futures.add(executor.submit(randomTask)); + } + + Exception exception = null; + try { + for (Future<?> future : futures) { + future.get(); + } + } catch (Exception e) { + exception = e; + } + + assertNull(exception); + assertFalse(wrongResult.get()); + } +} diff --git a/src/test/java/org/apache/fop/util/ConsoleEventListenerForTests.java b/src/test/java/org/apache/fop/util/ConsoleEventListenerForTests.java new file mode 100644 index 000000000..24a797648 --- /dev/null +++ b/src/test/java/org/apache/fop/util/ConsoleEventListenerForTests.java @@ -0,0 +1,89 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.util; + +import org.apache.fop.events.Event; +import org.apache.fop.events.EventFormatter; +import org.apache.fop.events.EventListener; +import org.apache.fop.events.model.EventSeverity; + +/** A simple event listener that writes the events to stdout and sterr. */ +public class ConsoleEventListenerForTests implements EventListener { + + private String name; + private EventSeverity logLevel; + + /** + * Creates a new event listener with console output on severity INFO. This object will + * write out the name of the test before the first log message. + * @param name the name of the test + */ + public ConsoleEventListenerForTests(String name) { + this(name, EventSeverity.INFO); + } + + /** + * Creates a new event listener with console output. This object will + * write out the name of the test before the first log message. + * @param name the name of the test + * @param logLevel the logging level + */ + public ConsoleEventListenerForTests(String name, EventSeverity logLevel) { + this.name = name; + this.logLevel = logLevel; + } + + /** {@inheritDoc} */ + public void processEvent(Event event) { + EventSeverity severity = event.getSeverity(); + if (severity == EventSeverity.FATAL) { + log("FATAL", event); + return; + } + if (logLevel == EventSeverity.FATAL) { + return; + } + if (severity == EventSeverity.ERROR) { + log("ERROR", event); + return; + } + if (logLevel == EventSeverity.ERROR) { + return; + } + if (severity == EventSeverity.WARN) { + log("WARN ", event); + } + if (logLevel == EventSeverity.WARN) { + return; + } + if (severity == EventSeverity.INFO) { + log("INFO ", event); + } + } + + private void log(String levelString, Event event) { + if (this.name != null) { + System.out.println("Test: " + this.name); + this.name = null; + } + String msg = EventFormatter.format(event); + System.out.println(" [" + levelString + "] " + msg); + } +} diff --git a/src/test/java/org/apache/fop/util/DigestFilter.java b/src/test/java/org/apache/fop/util/DigestFilter.java new file mode 100644 index 000000000..9e62fdc1c --- /dev/null +++ b/src/test/java/org/apache/fop/util/DigestFilter.java @@ -0,0 +1,139 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.util; + +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.Iterator; +import java.util.Map; +import java.util.TreeMap; + +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; +import org.xml.sax.SAXNotRecognizedException; +import org.xml.sax.SAXNotSupportedException; +import org.xml.sax.helpers.XMLFilterImpl; + +/** + * SAX filter which produces a digest over the XML elements. + * Insignificant whitespace as determined by the, comments and + * processing instructions are not part of the digest. + * If the filter is namespace aware, the URI and local name for + * each element is digested, otherwise the QName. Attributes are + * sorted before the name-value pairs are digested. + * + */ +public class DigestFilter extends XMLFilterImpl { + + private MessageDigest digest; + private byte[] value; + private boolean isNamespaceAware; + + public DigestFilter(String algorithm) throws NoSuchAlgorithmException { + digest = MessageDigest.getInstance(algorithm); + } + + public byte[] getDigestValue() { + return value; + } + + public String getDigestString() { + if (value != null) { + StringBuffer buffer = new StringBuffer(2 * value.length); + for (int i = 0; i < value.length; i++) { + int val = value[i]; + int hi = (val >> 4) & 0xF; + int lo = val & 0xF; + if (hi < 10) { + buffer.append((char) (hi + 0x30)); + } else { + buffer.append((char) (hi + 0x61 - 10)); + } + if (lo < 10) { + buffer.append((char) (lo + 0x30)); + } else { + buffer.append((char) (lo + 0x61 - 10)); + } + } + return buffer.toString(); + } else { + return null; + } + } + + /* (non-Javadoc) + * @see org.xml.sax.ContentHandler#characters(char[], int, int) + */ + public void characters(char[] chars, int start, int length) + throws SAXException { + digest.update(new String(chars, start, length).getBytes()); + super.characters(chars, start, length); + } + + /* (non-Javadoc) + * @see org.xml.sax.ContentHandler#endDocument() + */ + public void endDocument() throws SAXException { + value = digest.digest(); + super.endDocument(); + } + + public void startElement( + String url, + String localName, + String qName, + Attributes attr) + throws SAXException { + Map map = new TreeMap(); + if (isNamespaceAware) { + digest.update(url.getBytes()); + digest.update(localName.getBytes()); + for (int i = 0; i < attr.getLength(); i++) { + map.put( + attr.getLocalName(i) + attr.getURI(i), + attr.getValue(i)); + } + } else { + digest.update(qName.getBytes()); + for (int i = 0; i < attr.getLength(); i++) { + map.put(attr.getQName(i), attr.getValue(i)); + } + } + for (Iterator i = map.entrySet().iterator(); i.hasNext();) { + Map.Entry entry = (Map.Entry)i.next(); + digest.update(((String)entry.getKey()).getBytes()); + digest.update(((String)entry.getValue()).getBytes()); + } + super.startElement(url, localName, qName, attr); + } + + + /* (non-Javadoc) + * @see org.xml.sax.XMLReader#setFeature(java.lang.String, boolean) + */ + public void setFeature(String feature, boolean value) + throws SAXNotRecognizedException, SAXNotSupportedException { + if (feature.equals("http://xml.org/sax/features/namespaces")) { + isNamespaceAware = value; + } + super.setFeature(feature, value); + } + +} diff --git a/src/test/java/org/apache/fop/util/ElementListUtilsTestCase.java b/src/test/java/org/apache/fop/util/ElementListUtilsTestCase.java new file mode 100644 index 000000000..5e4f38b0b --- /dev/null +++ b/src/test/java/org/apache/fop/util/ElementListUtilsTestCase.java @@ -0,0 +1,152 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.util; + +import java.util.LinkedList; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; + +import org.apache.fop.layoutmgr.ElementListUtils; +import org.apache.fop.layoutmgr.KnuthBox; +import org.apache.fop.layoutmgr.KnuthElement; +import org.apache.fop.layoutmgr.KnuthGlue; +import org.apache.fop.layoutmgr.KnuthPenalty; + +/** + * Test class for ElementListUtils. + */ +public class ElementListUtilsTestCase { + + /** + * Tests ElementListUtils.removeLegalBreaks(). + * @throws Exception if the test fails + */ + @Test + public void testRemoveElementPenalty1() throws Exception { + LinkedList lst = new LinkedList(); + lst.add(new KnuthBox(4000, null, false)); + lst.add(new KnuthPenalty(0, 0, false, null, false)); + lst.add(new KnuthBox(4000, null, false)); + lst.add(new KnuthPenalty(0, 200, false, null, false)); + lst.add(new KnuthBox(4000, null, false)); + lst.add(new KnuthPenalty(0, 0, false, null, false)); + lst.add(new KnuthBox(4000, null, false)); + lst.add(new KnuthPenalty(0, KnuthElement.INFINITE, false, null, false)); + lst.add(new KnuthGlue(0, Integer.MAX_VALUE, 0, null, false)); + lst.add(new KnuthPenalty(0, -KnuthElement.INFINITE, false, null, false)); + + boolean res = ElementListUtils.removeLegalBreaks(lst, 9000); + + assertFalse(res); + + assertEquals(KnuthElement.INFINITE, ((KnuthPenalty)lst.get(1)).getPenalty()); + assertEquals(KnuthElement.INFINITE, ((KnuthPenalty)lst.get(3)).getPenalty()); + assertEquals(0, ((KnuthPenalty)lst.get(5)).getPenalty()); + } + + /** + * Tests ElementListUtils.removeLegalBreaks(). + * @throws Exception if the test fails + */ + @Test + public void testRemoveElementPenalty2() throws Exception { + LinkedList lst = new LinkedList(); + lst.add(new KnuthBox(4000, null, false)); + lst.add(new KnuthGlue(0, 0, 0, null, false)); + lst.add(new KnuthBox(4000, null, false)); + lst.add(new KnuthGlue(0, 0, 0, null, false)); + lst.add(new KnuthBox(4000, null, false)); + lst.add(new KnuthGlue(0, 0, 0, null, false)); + lst.add(new KnuthBox(4000, null, false)); + lst.add(new KnuthPenalty(0, KnuthElement.INFINITE, false, null, false)); + lst.add(new KnuthGlue(0, Integer.MAX_VALUE, 0, null, false)); + lst.add(new KnuthPenalty(0, -KnuthElement.INFINITE, false, null, false)); + + boolean res = ElementListUtils.removeLegalBreaks(lst, 9000); + + assertFalse(res); + + //Must insert an INFINITE penalty + assertEquals(KnuthElement.INFINITE, ((KnuthPenalty)lst.get(1)).getPenalty()); + assertEquals(0, ((KnuthGlue)lst.get(2)).getWidth()); + assertEquals(KnuthElement.INFINITE, ((KnuthPenalty)lst.get(4)).getPenalty()); + assertEquals(0, ((KnuthGlue)lst.get(5)).getWidth()); + assertEquals(0, ((KnuthGlue)lst.get(7)).getWidth()); + } + + /** + * Tests ElementListUtils.removeLegalBreaksFromEnd(). + * @throws Exception if the test fails + */ + @Test + public void testRemoveElementFromEndPenalty1() throws Exception { + LinkedList lst = new LinkedList(); + lst.add(new KnuthBox(4000, null, false)); + lst.add(new KnuthPenalty(0, 0, false, null, false)); + lst.add(new KnuthBox(4000, null, false)); + lst.add(new KnuthPenalty(0, 200, false, null, false)); + lst.add(new KnuthBox(4000, null, false)); + lst.add(new KnuthPenalty(0, 0, false, null, false)); + lst.add(new KnuthBox(4000, null, false)); + lst.add(new KnuthPenalty(0, KnuthElement.INFINITE, false, null, false)); + lst.add(new KnuthGlue(0, Integer.MAX_VALUE, 0, null, false)); + lst.add(new KnuthPenalty(0, -KnuthElement.INFINITE, false, null, false)); + + boolean res = ElementListUtils.removeLegalBreaksFromEnd(lst, 9000); + + assertFalse(res); + + assertEquals(0, ((KnuthPenalty)lst.get(1)).getPenalty()); + assertEquals(KnuthElement.INFINITE, ((KnuthPenalty)lst.get(3)).getPenalty()); + assertEquals(KnuthElement.INFINITE, ((KnuthPenalty)lst.get(5)).getPenalty()); + } + + /** + * Tests ElementListUtils.removeLegalBreaksFromEnd(). + * @throws Exception if the test fails + */ + @Test + public void testRemoveElementFromEndPenalty2() throws Exception { + LinkedList lst = new LinkedList(); + lst.add(new KnuthBox(4000, null, false)); + lst.add(new KnuthPenalty(0, 0, false, null, false)); + lst.add(new KnuthBox(4000, null, false)); + lst.add(new KnuthPenalty(0, 200, false, null, false)); + lst.add(new KnuthBox(4000, null, false)); + lst.add(new KnuthGlue(0, 0, 0, null, false)); + lst.add(new KnuthBox(4000, null, false)); + lst.add(new KnuthPenalty(0, KnuthElement.INFINITE, false, null, false)); + lst.add(new KnuthGlue(0, Integer.MAX_VALUE, 0, null, false)); + lst.add(new KnuthPenalty(0, -KnuthElement.INFINITE, false, null, false)); + + boolean res = ElementListUtils.removeLegalBreaksFromEnd(lst, 9000); + + assertFalse(res); + + //Must insert an INFINITE penalty + assertEquals(0, ((KnuthPenalty)lst.get(1)).getPenalty()); + assertEquals(KnuthElement.INFINITE, ((KnuthPenalty)lst.get(3)).getPenalty()); + assertEquals(KnuthElement.INFINITE, ((KnuthPenalty)lst.get(5)).getPenalty()); + assertEquals(0, ((KnuthGlue)lst.get(6)).getWidth()); + } +} diff --git a/src/test/java/org/apache/fop/util/HexEncoderTestCase.java b/src/test/java/org/apache/fop/util/HexEncoderTestCase.java new file mode 100644 index 000000000..cb366abdf --- /dev/null +++ b/src/test/java/org/apache/fop/util/HexEncoderTestCase.java @@ -0,0 +1,61 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.util; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +/** + * Test case for the conversion of characters into hex-encoded strings. + */ +public class HexEncoderTestCase { + + /** + * Tests that characters are properly encoded into hex strings. + */ + @Test + public void testEncodeChar() { + char[] digits = new char[] {'0', '0', '0', '0'}; + for (int c = 0; c <= 0xFFFF; c++) { + assertEquals(new String(digits), HexEncoder.encode((char) c)); + increment(digits); + } + } + + private static void increment(char[] digits) { + int d = 4; + do { + d--; + digits[d] = successor(digits[d]); + } while (digits[d] == '0' && d > 0); + } + + private static char successor(char d) { + if (d == '9') { + return 'A'; + } else if (d == 'F') { + return '0'; + } else { + return (char) (d + 1); + } + } + +} diff --git a/src/test/java/org/apache/fop/util/LanguageTagsTestCase.java b/src/test/java/org/apache/fop/util/LanguageTagsTestCase.java new file mode 100644 index 000000000..91861dcc6 --- /dev/null +++ b/src/test/java/org/apache/fop/util/LanguageTagsTestCase.java @@ -0,0 +1,58 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.util; + +import java.util.Locale; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +/** + * Tests {@link LanguageTags}. + */ +public class LanguageTagsTestCase { + + @Test(expected = NullPointerException.class) + public void toLanguageTagRejectsNull() { + LanguageTags.toLanguageTag(null); + } + + @Test + public void testToLanguageTag() throws Exception { + assertEquals("", LanguageTags.toLanguageTag(new Locale(""))); + assertEquals("en", LanguageTags.toLanguageTag(new Locale("en"))); + assertEquals("en-US", LanguageTags.toLanguageTag(new Locale("en", "US"))); + assertEquals("en-US", LanguageTags.toLanguageTag(new Locale("EN", "us"))); + } + + @Test(expected = NullPointerException.class) + public void toLocaleRejectsNull() { + LanguageTags.toLocale(null); + } + + @Test + public void testRFC3066ToLocale() throws Exception { + assertEquals(new Locale(""), LanguageTags.toLocale("")); + assertEquals(new Locale("en"), LanguageTags.toLocale("en")); + assertEquals(new Locale("en", "US"), LanguageTags.toLocale("en-US")); + assertEquals(new Locale("en", "US"), LanguageTags.toLocale("EN-us")); + } +} diff --git a/src/test/java/org/apache/fop/util/XMLResourceBundleTestCase.java b/src/test/java/org/apache/fop/util/XMLResourceBundleTestCase.java new file mode 100644 index 000000000..60aa16d83 --- /dev/null +++ b/src/test/java/org/apache/fop/util/XMLResourceBundleTestCase.java @@ -0,0 +1,65 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.util; + +import java.util.Locale; +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +/** + * Tests for XMLResourceBundle. + */ +public class XMLResourceBundleTestCase { + + @Test + public void testWithValidFile() throws Exception { + ResourceBundle bundle = XMLResourceBundle.getXMLBundle( + getClass().getName(), Locale.ENGLISH, getClass().getClassLoader()); + ResourceBundle bundleDE = XMLResourceBundle.getXMLBundle( + getClass().getName(), Locale.GERMAN, getClass().getClassLoader()); + + assertEquals("", bundle.getLocale().getLanguage()); + assertEquals("de", bundleDE.getLocale().getLanguage()); + + assertEquals("Hello World!", bundle.getString("hello-world")); + assertEquals("Hallo Welt!", bundleDE.getString("hello-world")); + + //Check fallback to English + assertEquals("Untranslatable", bundle.getString("untranslatable")); + assertEquals("Untranslatable", bundleDE.getString("untranslatable")); + } + + @Test + public void testWithInvalidFile() throws Exception { + try { + ResourceBundle bundle = XMLResourceBundle.getXMLBundle( + "org.apache.fop.util.invalid-translation-file", getClass().getClassLoader()); + fail("Expected exception"); + } catch (MissingResourceException e) { + //expected + } + } + +} diff --git a/src/test/java/org/apache/fop/util/XMLResourceBundleTestCase.xml b/src/test/java/org/apache/fop/util/XMLResourceBundleTestCase.xml new file mode 100644 index 000000000..5cdee49ec --- /dev/null +++ b/src/test/java/org/apache/fop/util/XMLResourceBundleTestCase.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<catalogue xml:lang="en"> + <message key="hello-world">Hello World!</message> + <message key="untranslatable">Untranslatable</message> +</catalogue>
\ No newline at end of file diff --git a/src/test/java/org/apache/fop/util/XMLResourceBundleTestCase_de.xml b/src/test/java/org/apache/fop/util/XMLResourceBundleTestCase_de.xml new file mode 100644 index 000000000..44cf5a5b4 --- /dev/null +++ b/src/test/java/org/apache/fop/util/XMLResourceBundleTestCase_de.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> +<catalogue xml:lang="de"> + <message key="hello-world">Hallo Welt!</message> +</catalogue>
\ No newline at end of file diff --git a/src/test/java/org/apache/fop/util/invalid-translation-file.xml b/src/test/java/org/apache/fop/util/invalid-translation-file.xml new file mode 100644 index 000000000..09306b7cc --- /dev/null +++ b/src/test/java/org/apache/fop/util/invalid-translation-file.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<catalogue xml:lang="en"> + <message key1="hello-world">Hello World!</message> + <something>blah</something> +</catalogue>
\ No newline at end of file diff --git a/src/test/java/org/apache/fop/visual/AbstractBitmapProducer.java b/src/test/java/org/apache/fop/visual/AbstractBitmapProducer.java new file mode 100644 index 000000000..fbbe1e22d --- /dev/null +++ b/src/test/java/org/apache/fop/visual/AbstractBitmapProducer.java @@ -0,0 +1,58 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.visual; + +import java.net.URI; + +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerConfigurationException; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * Abstract base class for converters. + */ +public abstract class AbstractBitmapProducer implements BitmapProducer { + + /** Logger */ + protected static Log log = LogFactory.getLog(AbstractBitmapProducer.class); + final URI baseUri; + + public AbstractBitmapProducer(URI baseUri) { + this.baseUri = baseUri; + } + + /** + * Returns a new JAXP Transformer based on information in the ProducerContext. + * @param context context information for the process + * @return a new Transformer instance (identity or set up with a stylesheet) + * @throws TransformerConfigurationException in case creating the Transformer fails. + */ + protected Transformer getTransformer(ProducerContext context) + throws TransformerConfigurationException { + if (context.getTemplates() != null) { + return context.getTemplates().newTransformer(); + } else { + return context.getTransformerFactory().newTransformer(); + } + } + +} diff --git a/src/test/java/org/apache/fop/visual/AbstractPSPDFBitmapProducer.java b/src/test/java/org/apache/fop/visual/AbstractPSPDFBitmapProducer.java new file mode 100644 index 000000000..162a83756 --- /dev/null +++ b/src/test/java/org/apache/fop/visual/AbstractPSPDFBitmapProducer.java @@ -0,0 +1,172 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.visual; + +import java.awt.image.BufferedImage; +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.net.URI; +import java.text.MessageFormat; + +import javax.xml.transform.Transformer; +import javax.xml.transform.sax.SAXResult; +import javax.xml.transform.stream.StreamSource; + +import org.apache.avalon.framework.configuration.Configurable; +import org.apache.avalon.framework.configuration.Configuration; +import org.apache.avalon.framework.configuration.ConfigurationException; +import org.apache.commons.io.IOUtils; + +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.apps.Fop; +import org.apache.fop.apps.FopFactory; +import org.apache.fop.util.DefaultErrorListener; + +/** + * BitmapProducer implementation that uses the PS or PDF renderer and an external converter + * to create bitmaps. + * <p> + * Here's what the configuration element looks like for the class: + * <p> + * <pre> + * <producer classname="<concrete class>"> + * <converter>mypdf2bmp {0} {1} {2}</converter> + * <delete-temp-files>false</delete-temp-files> + * </producer> + * </pre> + * <p> + * You will notice the three parameters in curly braces (java.util.MessageFormat style) to the + * converter call: + * <ul> + * <li>0: the input file + * <li>1: the output bitmap file + * <li>2: the requested resolution in dpi for the generated bitmap + * </ul> + * <p> + * The "delete-temp-files" element is optional and defaults to true. + */ +public abstract class AbstractPSPDFBitmapProducer extends AbstractBitmapProducer + implements Configurable { + + // configure fopFactory as desired + private final FopFactory fopFactory; + + private String converter; + private boolean deleteTempFiles; + /** the bitmap producer's target format */ + protected String targetFormat; + + public AbstractPSPDFBitmapProducer(URI baseUri) { + super(baseUri); + fopFactory = FopFactory.newInstance(baseUri); + } + + /** {@inheritDoc} */ + public void configure(Configuration cfg) throws ConfigurationException { + this.converter = cfg.getChild("converter").getValue(); + this.deleteTempFiles = cfg.getChild("delete-temp-files").getValueAsBoolean(true); + if (cfg.getChild("target-format", false) != null) { + this.targetFormat = cfg.getChild("target-format").getValue(); + } + } + + /** + * Calls an external converter to convert the file generated by FOP to a bitmap. + * @param inFile the generated output file to be converted + * @param outFile the target filename for the bitmap + * @param context context information (required bitmap resolution etc.) + * @throws IOException in case the conversion fails + */ + public void convert(File inFile, File outFile, ProducerContext context) throws IOException { + outFile.delete(); + + //Build command-line + String cmd = MessageFormat.format(converter, + new Object[] {inFile.toString(), outFile.toString(), + Integer.toString(context.getTargetResolution())}); + ConvertUtils.convert(cmd, null, null, log); + + if (!outFile.exists()) { + throw new IOException("The target file has not been generated"); + } + } + + /** + * @return the native extension generated by the output format, ex. "ps" or "pdf". + */ + protected abstract String getTargetExtension(); + + /** + * @return the output format for the FOP renderer, i.e. a MIME type. + */ + protected String getTargetFormat() { + return this.targetFormat; + } + + /** {@inheritDoc} */ + public BufferedImage produce(File src, int index, ProducerContext context) { + try { + FOUserAgent userAgent = fopFactory.newFOUserAgent(); + userAgent.setTargetResolution(context.getTargetResolution()); + + File tempOut = new File(context.getTargetDir(), + src.getName() + "." + index + "." + getTargetExtension()); + File tempPNG = new File(context.getTargetDir(), + src.getName() + "." + index + "." + getTargetExtension() + ".png"); + try { + OutputStream out = new FileOutputStream(tempOut); + out = new BufferedOutputStream(out); + try { + Fop fop = fopFactory.newFop(getTargetFormat(), userAgent, out); + SAXResult res = new SAXResult(fop.getDefaultHandler()); + + Transformer transformer = getTransformer(context); + transformer.setErrorListener(new DefaultErrorListener(log)); + transformer.transform(new StreamSource(src), res); + } finally { + IOUtils.closeQuietly(out); + } + + convert(tempOut, tempPNG, context); + BufferedImage img = BitmapComparator.getImage(tempPNG); + return img; + } finally { + if (deleteTempFiles) { + if (!tempOut.delete()) { + log.warn("Can't delete " + tempOut); + tempOut.deleteOnExit(); + } + if (!tempPNG.delete()) { + log.warn("Can't delete " + tempPNG); + tempPNG.deleteOnExit(); + } + } + } + } catch (Exception e) { + e.printStackTrace(); + log.error(e); + return null; + } + } + +} diff --git a/src/test/java/org/apache/fop/visual/AbstractRedirectorLineHandler.java b/src/test/java/org/apache/fop/visual/AbstractRedirectorLineHandler.java new file mode 100644 index 000000000..344d3199e --- /dev/null +++ b/src/test/java/org/apache/fop/visual/AbstractRedirectorLineHandler.java @@ -0,0 +1,39 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.visual; + +/** + * Abstract base implementation for a RedirectorLineHandler which provides empty notifyStart() + * and notifyEnd() methods. + */ +public abstract class AbstractRedirectorLineHandler + implements RedirectorLineHandler { + + /** @see org.apache.fop.visual.RedirectorLineHandler#notifyStart() */ + public void notifyStart() { + //nop + } + + /** @see org.apache.fop.visual.RedirectorLineHandler#notifyEnd() */ + public void notifyEnd() { + //nop + } + +} diff --git a/src/test/java/org/apache/fop/visual/BatchDiffer.java b/src/test/java/org/apache/fop/visual/BatchDiffer.java new file mode 100644 index 000000000..cb78028f4 --- /dev/null +++ b/src/test/java/org/apache/fop/visual/BatchDiffer.java @@ -0,0 +1,303 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.visual; + +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; +import java.net.URI; +import java.util.Collection; + +import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.stream.StreamSource; + +import org.xml.sax.SAXException; + +import org.apache.avalon.framework.configuration.Configuration; +import org.apache.avalon.framework.configuration.ConfigurationException; +import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder; +import org.apache.avalon.framework.container.ContainerUtil; +import org.apache.commons.io.FileUtils; +import org.apache.commons.io.filefilter.AndFileFilter; +import org.apache.commons.io.filefilter.IOFileFilter; +import org.apache.commons.io.filefilter.SuffixFileFilter; +import org.apache.commons.io.filefilter.WildcardFileFilter; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import org.apache.xmlgraphics.image.writer.ImageWriterUtil; + +import org.apache.fop.layoutengine.LayoutEngineTestUtils; + +/** + * This class is used to visually diff bitmap images created through various sources. + * <p> + * Here's what the configuration format looks like: + * <p> + * <pre> + * <batch-diff> + * <source-directory>C:/Dev/FOP/trunk/test/layoutengine</source-directory> + * <filter-disabled>false</filter-disabled> + * <max-files>10</max-files> + * <target-directory>C:/Temp/diff-out</target-directory> + * <resolution>100</resolution> + * <stop-on-exception>false</stop-on-exception> + * <create-diffs>false</create-diffs> + * <stylesheet>C:/Dev/FOP/trunk/test/layoutengine/testcase2fo.xsl</stylesheet> + * <producers> + * <producer classname="org.apache.fop.visual.BitmapProducerJava2D"> + * <delete-temp-files>false</delete-temp-files> + * </producer> + * <producer classname="org.apache.fop.visual.ReferenceBitmapLoader"> + * <directory>C:/Temp/diff-bitmaps</directory> + * </producer> + * </producers> + * </batch-diff> + * </pre> + * <p> + * The optional "filter-disabled" element determines whether the source files should be filtered + * using the same "disabled-testcases.txt" file used for the layout engine tests. Default: true + * <p> + * The optional "max-files" element controls how many files at maximum should be processed. + * Default is to process all the files found. + * <p> + * The optional "resolution" element controls the requested bitmap resolution in dpi for the + * generated bitmaps. Defaults to 72dpi. + * <p> + * The optional "stop-on-exception" element controls whether the batch should be aborted when + * an exception is caught. Defaults to true. + * <p> + * The optional "create-diffs" element controls whether the diff images should be created. + * Defaults to true. + * <p> + * The optional "stylesheet" element allows you to supply an XSLT stylesheet to preprocess all + * source files with. Default: no stylesheet, identity transform. + * <p> + * The "producers" element contains a list of producer implementations with configuration. + * The "classname" attribute specifies the fully qualified class name for the implementation. + */ +public class BatchDiffer { + + /** Logger */ + protected static Log log = LogFactory.getLog(BatchDiffer.class); + + /** + * Prints the usage of this app to stdout. + */ + public static void printUsage() { + System.out.println("Usage:"); + System.out.println("java " + BatchDiffer.class.getName() + " <cfgfile>"); + System.out.println(); + System.out.println("<cfgfile>: Path to an XML file with the configuration" + + " for the batch run."); + } + + /** + * Runs the batch. + * @param cfgFile configuration file to use + * @throws ConfigurationException In case of a problem with the configuration + * @throws SAXException In case of a problem during SAX processing + * @throws IOException In case of a I/O problem + */ + public void runBatch(File cfgFile) + throws ConfigurationException, SAXException, IOException { + DefaultConfigurationBuilder cfgBuilder = new DefaultConfigurationBuilder(); + Configuration cfg = cfgBuilder.buildFromFile(cfgFile); + runBatch(cfg); + } + + /** + * Runs the batch + * @param cfg Configuration for the batch + * @throws TransformerConfigurationException + */ + public void runBatch(Configuration cfg) { + try { + ProducerContext context = new ProducerContext(); + context.setTargetResolution(cfg.getChild("resolution").getValueAsInteger(72)); + String xslt = cfg.getChild("stylesheet").getValue(null); + if (xslt != null) { + try { + context.setTemplates(context.getTransformerFactory().newTemplates( + new StreamSource(xslt))); + } catch (TransformerConfigurationException e) { + log.error("Error setting up stylesheet", e); + throw new RuntimeException("Error setting up stylesheet"); + } + } + + + //Set up directories + File srcDir = new File(cfg.getChild("source-directory").getValue()); + if (!srcDir.exists()) { + throw new RuntimeException("source-directory does not exist: " + srcDir); + } + + BitmapProducer[] producers = getProducers(cfg.getChild("producers"), srcDir); + + final File targetDir = new File(cfg.getChild("target-directory").getValue()); + if (!targetDir.mkdirs() && !targetDir.exists()) { + throw new RuntimeException("target-directory is invalid: " + targetDir); + } + context.setTargetDir(targetDir); + + boolean stopOnException = cfg.getChild("stop-on-exception").getValueAsBoolean(true); + final boolean createDiffs = cfg.getChild("create-diffs").getValueAsBoolean(true); + + //RUN! + + IOFileFilter filter = new SuffixFileFilter(new String[] {".xml", ".fo"}); + //Same filtering as in layout engine tests + if (cfg.getChild("filter-disabled").getValueAsBoolean(true)) { + String disabled = System.getProperty("fop.layoutengine.disabled"); + filter = LayoutEngineTestUtils.decorateWithDisabledList(filter, disabled); + } + String manualFilter = cfg.getChild("manual-filter").getValue(null); + if (manualFilter != null) { + if (manualFilter.indexOf('*') < 0) { + manualFilter = manualFilter + '*'; + } + filter = new AndFileFilter( + new WildcardFileFilter(manualFilter), filter); + } + + int maxfiles = cfg.getChild("max-files").getValueAsInteger(-1); + Collection<File> files = FileUtils.listFiles(srcDir, filter, null); + for (final File f : files) { + try { + log.info("---=== " + f + " ===---"); + long[] times = new long[producers.length]; + final BufferedImage[] bitmaps = new BufferedImage[producers.length]; + for (int j = 0; j < producers.length; j++) { + times[j] = System.currentTimeMillis(); + bitmaps[j] = producers[j].produce(f, j, context); + times[j] = System.currentTimeMillis() - times[j]; + } + if (log.isDebugEnabled()) { + StringBuffer sb = new StringBuffer("Bitmap production times: "); + for (int j = 0; j < producers.length; j++) { + if (j > 0) { + sb.append(", "); + } + sb.append(times[j]).append("ms"); + } + log.debug(sb.toString()); + } + //Create combined image + if (bitmaps[0] == null) { + throw new RuntimeException("First producer didn't return a bitmap for " + + f + ". Cannot continue."); + } + + Runnable runnable = new Runnable() { + public void run() { + try { + saveBitmaps(targetDir, f, createDiffs, bitmaps); + } catch (IOException e) { + log.error("IO error while saving bitmaps: " + e.getMessage()); + } + } + }; + //This speeds it up a little on multi-core CPUs (very cheap, I know) + new Thread(runnable).start(); + } catch (RuntimeException e) { + log.error("Catching RE on file " + f + ": " + e.getMessage()); + if (stopOnException) { + log.error("rethrowing..."); + throw e; + } + } + maxfiles = (maxfiles < 0 ? maxfiles : maxfiles - 1); + if (maxfiles == 0) { + break; + } + } + } catch (ConfigurationException e) { + log.error("Error while configuring BatchDiffer", e); + throw new RuntimeException("Error while configuring BatchDiffer: " + e.getMessage()); + } + } + + private void saveBitmaps(File targetDir, File srcFile, boolean createDiffs, + BufferedImage[] bitmaps) throws IOException { + BufferedImage combined = BitmapComparator.buildCompareImage(bitmaps); + + //Save combined bitmap as PNG file + File outputFile = new File(targetDir, srcFile.getName() + "._combined.png"); + ImageWriterUtil.saveAsPNG(combined, outputFile); + + if (createDiffs) { + for (int k = 1; k < bitmaps.length; k++) { + BufferedImage diff = BitmapComparator.buildDiffImage( + bitmaps[0], bitmaps[k]); + outputFile = new File(targetDir, srcFile.getName() + "._diff" + k + ".png"); + ImageWriterUtil.saveAsPNG(diff, outputFile); + } + } + } + + private BitmapProducer[] getProducers(Configuration cfg, File srcDir) { + Configuration[] children = cfg.getChildren("producer"); + BitmapProducer[] producers = new BitmapProducer[children.length]; + for (int i = 0; i < children.length; i++) { + try { + Class<?> clazz = Class.forName(children[i].getAttribute("classname")); + Object producer = clazz.getDeclaredConstructor(URI.class) + .newInstance(srcDir.toURI()); + producers[i] = (BitmapProducer) producer; + ContainerUtil.configure(producers[i], children[i]); + } catch (Exception e) { + log.error("Error setting up producers", e); + throw new RuntimeException("Error while setting up producers"); + } + } + return producers; + } + + /** + * Main method. + * @param args command-line arguments + */ + public static void main(String[] args) { + try { + if (args.length == 0) { + System.err.println("Configuration file is missing!"); + printUsage(); + System.exit(-1); + } + File cfgFile = new File(args[0]); + if (!cfgFile.exists()) { + System.err.println("Configuration file cannot be found: " + args[0]); + printUsage(); + System.exit(-1); + } + + Thread.currentThread().setPriority(Thread.MIN_PRIORITY); + BatchDiffer differ = new BatchDiffer(); + differ.runBatch(cfgFile); + + System.out.println("Regular exit..."); + } catch (Exception e) { + System.out.println("Exception caught..."); + e.printStackTrace(); + } + } + +} diff --git a/src/test/java/org/apache/fop/visual/BitmapComparator.java b/src/test/java/org/apache/fop/visual/BitmapComparator.java new file mode 100644 index 000000000..f2157176b --- /dev/null +++ b/src/test/java/org/apache/fop/visual/BitmapComparator.java @@ -0,0 +1,224 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.visual; + +import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.image.BufferedImage; +import java.awt.image.ColorModel; +import java.awt.image.RenderedImage; +import java.awt.image.WritableRaster; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; + +import org.apache.commons.io.IOUtils; + +import org.apache.batik.ext.awt.image.GraphicsUtil; +import org.apache.batik.ext.awt.image.renderable.Filter; +import org.apache.batik.ext.awt.image.spi.ImageTagRegistry; +import org.apache.batik.util.ParsedURL; + +/** + * Helper class to visually compare two bitmap images. + * <p> + * This class was created by extracting reusable code from + * org.apache.batik.test.util.ImageCompareText (Apache Batik) + * into this separate class. + * <p> + * TODO Move as utility class to XML Graphics Commons when possible + */ +public final class BitmapComparator { + + + private BitmapComparator() { + } + + /** + * Builds a new BufferedImage that is the difference between the two input images + * @param ref the reference bitmap + * @param gen the newly generated bitmap + * @return the diff bitmap + */ + public static BufferedImage buildDiffImage(BufferedImage ref, + BufferedImage gen) { + BufferedImage diff = new BufferedImage(ref.getWidth(), + ref.getHeight(), + BufferedImage.TYPE_INT_ARGB); + WritableRaster refWR = ref.getRaster(); + WritableRaster genWR = gen.getRaster(); + WritableRaster dstWR = diff.getRaster(); + + boolean refPre = ref.isAlphaPremultiplied(); + if (!refPre) { + ColorModel cm = ref.getColorModel(); + cm = GraphicsUtil.coerceData(refWR, cm, true); + ref = new BufferedImage(cm, refWR, true, null); + } + boolean genPre = gen.isAlphaPremultiplied(); + if (!genPre) { + ColorModel cm = gen.getColorModel(); + cm = GraphicsUtil.coerceData(genWR, cm, true); + gen = new BufferedImage(cm, genWR, true, null); + } + + + int w = ref.getWidth(); + int h = ref.getHeight(); + + int [] refPix = null; + int [] genPix = null; + for (int y = 0; y < h; y++) { + refPix = refWR.getPixels(0, y, w, 1, refPix); + genPix = genWR.getPixels(0, y, w, 1, genPix); + for (int i = 0; i < refPix.length; i++) { + // val = ((genPix[i] - refPix[i]) * 5) + 128; + int val = ((refPix[i] - genPix[i]) * 10) + 128; + if ((val & 0xFFFFFF00) != 0) { + if ((val & 0x80000000) != 0) { + val = 0; + } else { + val = 255; + } + } + genPix[i] = val; + } + dstWR.setPixels(0, y, w, 1, genPix); + } + + if (!genPre) { + ColorModel cm = gen.getColorModel(); + cm = GraphicsUtil.coerceData(genWR, cm, false); + } + + if (!refPre) { + ColorModel cm = ref.getColorModel(); + cm = GraphicsUtil.coerceData(refWR, cm, false); + } + + return diff; + } + + /** + * Builds a combined image that places a number of images next to each other for + * manual, visual comparison. + * @param images the array of bitmaps + * @return the combined image + */ + public static BufferedImage buildCompareImage(BufferedImage[] images) { + BufferedImage cmp = new BufferedImage( + images[0].getWidth() * images.length, + images[0].getHeight(), BufferedImage.TYPE_INT_ARGB); + + Graphics2D g = cmp.createGraphics(); + g.setPaint(Color.white); + g.fillRect(0, 0, cmp.getWidth(), cmp.getHeight()); + int lastWidth = 0; + for (int i = 0; i < images.length; i++) { + if (lastWidth > 0) { + g.translate(lastWidth, 0); + } + if (images[i] != null) { + g.drawImage(images[i], 0, 0, null); + lastWidth = images[i].getWidth(); + } else { + lastWidth = 20; //Maybe add a special placeholder image instead later + } + } + g.dispose(); + + return cmp; + } + + /** + * Builds a combined image that places two images next to each other for + * manual, visual comparison. + * @param ref the reference image + * @param gen the actual image + * @return the combined image + */ + public static BufferedImage buildCompareImage(BufferedImage ref, + BufferedImage gen) { + return buildCompareImage(new BufferedImage[] {ref, gen}); + } + + /** + * Loads an image from a URL + * @param url the URL to the image + * @return the bitmap as BufferedImage + * TODO This method doesn't close the InputStream opened by the URL. + */ + public static BufferedImage getImage(URL url) { + ImageTagRegistry reg = ImageTagRegistry.getRegistry(); + Filter filt = reg.readURL(new ParsedURL(url)); + if (filt == null) { + return null; + } + + RenderedImage red = filt.createDefaultRendering(); + if (red == null) { + return null; + } + + BufferedImage img = new BufferedImage(red.getWidth(), + red.getHeight(), + BufferedImage.TYPE_INT_ARGB); + red.copyData(img.getRaster()); + + return img; + } + + /** + * Loads an image from a URL + * @param bitmapFile the bitmap file + * @return the bitmap as BufferedImage + */ + public static BufferedImage getImage(File bitmapFile) { + try { + InputStream in = new java.io.FileInputStream(bitmapFile); + try { + in = new java.io.BufferedInputStream(in); + + ImageTagRegistry reg = ImageTagRegistry.getRegistry(); + Filter filt = reg.readStream(in); + if (filt == null) { + return null; + } + + RenderedImage red = filt.createDefaultRendering(); + if (red == null) { + return null; + } + + BufferedImage img = new BufferedImage(red.getWidth(), + red.getHeight(), + BufferedImage.TYPE_INT_ARGB); + red.copyData(img.getRaster()); + return img; + } finally { + IOUtils.closeQuietly(in); + } + } catch (IOException e) { + return null; + } + } + +} diff --git a/src/test/java/org/apache/fop/visual/BitmapProducer.java b/src/test/java/org/apache/fop/visual/BitmapProducer.java new file mode 100644 index 000000000..9326656f4 --- /dev/null +++ b/src/test/java/org/apache/fop/visual/BitmapProducer.java @@ -0,0 +1,40 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.visual; + +import java.awt.image.BufferedImage; +import java.io.File; + +/** + * Interface for a converter. + */ +public interface BitmapProducer { + + /** + * Produces a BufferedImage from the source file by invoking the FO processor and + * converting the generated output file to a bitmap image if necessary. + * @param src the source FO or XML file + * @param index the index of the producer inside the test set + * @param context context information for the conversion + * @return the generated BufferedImage + */ + BufferedImage produce(File src, int index, ProducerContext context); + +} diff --git a/src/test/java/org/apache/fop/visual/BitmapProducerJava2D.java b/src/test/java/org/apache/fop/visual/BitmapProducerJava2D.java new file mode 100644 index 000000000..c29de1e85 --- /dev/null +++ b/src/test/java/org/apache/fop/visual/BitmapProducerJava2D.java @@ -0,0 +1,110 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.visual; + +import java.awt.image.BufferedImage; +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.OutputStream; +import java.net.URI; + +import javax.xml.transform.Transformer; +import javax.xml.transform.sax.SAXResult; +import javax.xml.transform.stream.StreamSource; + +import org.apache.avalon.framework.configuration.Configurable; +import org.apache.avalon.framework.configuration.Configuration; +import org.apache.avalon.framework.configuration.ConfigurationException; +import org.apache.commons.io.IOUtils; + +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.apps.Fop; +import org.apache.fop.apps.FopFactory; +import org.apache.fop.apps.MimeConstants; +import org.apache.fop.util.DefaultErrorListener; + +/** + * BitmapProducer implementation that uses the Java2DRenderer to create bitmaps. + * <p> + * Here's what the configuration element looks like for the class: + * <p> + * <pre> + * <producer classname="org.apache.fop.visual.BitmapProducerJava2D"> + * <delete-temp-files>false</delete-temp-files> + * </producer> + * </pre> + * <p> + * The "delete-temp-files" element is optional and defaults to true. + */ +public class BitmapProducerJava2D extends AbstractBitmapProducer implements Configurable { + + // configure fopFactory as desired + private final FopFactory fopFactory; + + private boolean deleteTempFiles; + + public BitmapProducerJava2D(URI baseUri) { + super(baseUri); + fopFactory = FopFactory.newInstance(baseUri); + } + + /** @see org.apache.avalon.framework.configuration.Configurable */ + public void configure(Configuration cfg) throws ConfigurationException { + this.deleteTempFiles = cfg.getChild("delete-temp-files").getValueAsBoolean(true); + } + + /** @see org.apache.fop.visual.BitmapProducer */ + public BufferedImage produce(File src, int index, ProducerContext context) { + try { + FOUserAgent userAgent = fopFactory.newFOUserAgent(); + userAgent.setTargetResolution(context.getTargetResolution()); + + File outputFile = new File(context.getTargetDir(), + src.getName() + "." + index + ".java2d.png"); + OutputStream out = new FileOutputStream(outputFile); + out = new BufferedOutputStream(out); + try { + Fop fop = fopFactory.newFop(MimeConstants.MIME_PNG, userAgent, out); + SAXResult res = new SAXResult(fop.getDefaultHandler()); + + Transformer transformer = getTransformer(context); + transformer.setErrorListener(new DefaultErrorListener(log)); + transformer.transform(new StreamSource(src), res); + } finally { + IOUtils.closeQuietly(out); + } + + BufferedImage img = BitmapComparator.getImage(outputFile); + if (deleteTempFiles) { + if (!outputFile.delete()) { + log.warn("Cannot delete " + outputFile); + outputFile.deleteOnExit(); + } + } + return img; + } catch (Exception e) { + e.printStackTrace(); + log.error(e); + return null; + } + } + +} diff --git a/src/test/java/org/apache/fop/visual/BitmapProducerPDF.java b/src/test/java/org/apache/fop/visual/BitmapProducerPDF.java new file mode 100644 index 000000000..d28ebfc2a --- /dev/null +++ b/src/test/java/org/apache/fop/visual/BitmapProducerPDF.java @@ -0,0 +1,47 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.visual; + +import java.net.URI; + +import org.apache.fop.apps.MimeConstants; + +/** + * BitmapProducer implementation that uses the PDFRenderer and an external converter + * to create bitmaps. + * <p> + * See the superclass' javadoc for info on the configuration format. + */ +public class BitmapProducerPDF extends AbstractPSPDFBitmapProducer { + + /** + * Default constructor. + */ + public BitmapProducerPDF(URI baseUri) { + super(baseUri); + this.targetFormat = MimeConstants.MIME_PDF; + } + + /** {@inheritDoc} */ + protected String getTargetExtension() { + return "pdf"; + } + +} diff --git a/src/test/java/org/apache/fop/visual/BitmapProducerPS.java b/src/test/java/org/apache/fop/visual/BitmapProducerPS.java new file mode 100644 index 000000000..1bbdba891 --- /dev/null +++ b/src/test/java/org/apache/fop/visual/BitmapProducerPS.java @@ -0,0 +1,47 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.visual; + +import java.net.URI; + +import org.apache.fop.apps.MimeConstants; + +/** + * BitmapProducer implementation that uses the PSRenderer and an external converter + * to create bitmaps. + * <p> + * See the superclass' javadoc for info on the configuration format. + */ +public class BitmapProducerPS extends AbstractPSPDFBitmapProducer { + + /** + * Default constructor. + */ + public BitmapProducerPS(URI baseUri) { + super(baseUri); + this.targetFormat = MimeConstants.MIME_POSTSCRIPT; + } + + /** {@inheritDoc} */ + protected String getTargetExtension() { + return "ps"; + } + +} diff --git a/src/test/java/org/apache/fop/visual/ConvertUtils.java b/src/test/java/org/apache/fop/visual/ConvertUtils.java new file mode 100644 index 000000000..aa4dadf47 --- /dev/null +++ b/src/test/java/org/apache/fop/visual/ConvertUtils.java @@ -0,0 +1,89 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.visual; + +import java.io.File; +import java.io.IOException; + +import org.apache.commons.logging.Log; + +/** + * Utilities for converting files with external converters. + */ +public final class ConvertUtils { + + private ConvertUtils() { + } + + /** + * Calls an external converter application (GhostScript, for example). + * @param cmd the full command + * @param envp array of strings, each element of which has environment variable settings + * in format name=value. + * @param workDir the working directory of the subprocess, or null if the subprocess should + * inherit the working directory of the current process. + * @param log the logger to log output by the external application to + * @throws IOException in case the external call fails + */ + public static void convert(String cmd, String[] envp, File workDir, final Log log) + throws IOException { + log.debug(cmd); + + Process process = null; + try { + process = Runtime.getRuntime().exec(cmd, envp, null); + + //Redirect stderr output + RedirectorLineHandler errorHandler = new AbstractRedirectorLineHandler() { + public void handleLine(String line) { + log.error("ERR> " + line); + } + }; + StreamRedirector errorRedirector + = new StreamRedirector(process.getErrorStream(), errorHandler); + + //Redirect stdout output + RedirectorLineHandler outputHandler = new AbstractRedirectorLineHandler() { + public void handleLine(String line) { + log.debug("OUT> " + line); + } + }; + StreamRedirector outputRedirector + = new StreamRedirector(process.getInputStream(), outputHandler); + new Thread(errorRedirector).start(); + new Thread(outputRedirector).start(); + + process.waitFor(); + } catch (java.lang.InterruptedException ie) { + throw new IOException("The call to the external converter failed: " + ie.getMessage()); + } catch (java.io.IOException ioe) { + throw new IOException("The call to the external converter failed: " + ioe.getMessage()); + } + + int exitValue = process.exitValue(); + if (exitValue != 0) { + throw new IOException("The call to the external converter failed. Result: " + + exitValue); + } + + } + + +} diff --git a/src/test/java/org/apache/fop/visual/ProducerContext.java b/src/test/java/org/apache/fop/visual/ProducerContext.java new file mode 100644 index 000000000..214820c82 --- /dev/null +++ b/src/test/java/org/apache/fop/visual/ProducerContext.java @@ -0,0 +1,91 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.visual; + +import java.io.File; + +import javax.xml.transform.Templates; +import javax.xml.transform.TransformerFactory; + +/** + * Context object for the bitmap production. + */ +public class ProducerContext { + + private TransformerFactory tFactory; + private Templates templates; + private int targetResolution; + private File targetDir; + + /** + * @return the TransformerFactory to be used. + */ + public TransformerFactory getTransformerFactory() { + if (tFactory == null) { + tFactory = TransformerFactory.newInstance(); + } + return tFactory; + } + + /** + * @return the requested bitmap resolution in dpi for all bitmaps. + */ + public int getTargetResolution() { + return targetResolution; + } + + /** + * Sets the requested bitmap resolution in dpi for all bitmaps. + * @param resolution the resolution in dpi + */ + public void setTargetResolution(int resolution) { + this.targetResolution = resolution; + } + + /** + * @return the XSLT stylesheet to preprocess the input files with. + */ + public Templates getTemplates() { + return templates; + } + + /** + * Sets an optional XSLT stylesheet which is used to preprocess all input files with. + * @param templates the XSLT stylesheet + */ + public void setTemplates(Templates templates) { + this.templates = templates; + } + + /** + * @return the target directory for all produced bitmaps + */ + public File getTargetDir() { + return targetDir; + } + + /** + * Sets the target directory for all produced bitmaps. + * @param targetDir the target directory + */ + public void setTargetDir(File targetDir) { + this.targetDir = targetDir; + } +} diff --git a/src/test/java/org/apache/fop/visual/RedirectorLineHandler.java b/src/test/java/org/apache/fop/visual/RedirectorLineHandler.java new file mode 100644 index 000000000..017dcbe5b --- /dev/null +++ b/src/test/java/org/apache/fop/visual/RedirectorLineHandler.java @@ -0,0 +1,42 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.visual; + +/** + * This interface is used to redirect output from an external application elsewhere. + */ +public interface RedirectorLineHandler { + + /** + * Called before the first handleLine() call. + */ + void notifyStart(); + + /** + * Called for each line of output to be processed. + * @param line a line of application output + */ + void handleLine(String line); + + /** + * Called after the last handleLine() call. + */ + void notifyEnd(); +} diff --git a/src/test/java/org/apache/fop/visual/ReferenceBitmapLoader.java b/src/test/java/org/apache/fop/visual/ReferenceBitmapLoader.java new file mode 100644 index 000000000..29b0afd00 --- /dev/null +++ b/src/test/java/org/apache/fop/visual/ReferenceBitmapLoader.java @@ -0,0 +1,73 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.visual; + +import java.awt.image.BufferedImage; +import java.io.File; +import java.net.URI; + +import org.apache.avalon.framework.configuration.Configurable; +import org.apache.avalon.framework.configuration.Configuration; +import org.apache.avalon.framework.configuration.ConfigurationException; + +/** + * BitmapProducer implementation that simply loads preproduced reference bitmaps from a + * certain directory. + * <p> + * Here's what the configuration element looks like for the class: + * <p> + * <pre> + * <producer classname="org.apache.fop.visual.ReferenceBitmapLoader"> + * <directory>C:/Temp/ref-bitmaps</directory> + * </producer> + * </pre> + */ +public class ReferenceBitmapLoader extends AbstractBitmapProducer implements Configurable { + + private File bitmapDirectory; + + public ReferenceBitmapLoader(URI baseUri) { + super(baseUri); + } + + /** @see org.apache.avalon.framework.configuration.Configurable */ + public void configure(Configuration cfg) throws ConfigurationException { + this.bitmapDirectory = new File(cfg.getChild("directory").getValue(null)); + if (!bitmapDirectory.exists()) { + throw new ConfigurationException("Directory could not be found: " + bitmapDirectory); + } + } + + /** @see org.apache.fop.visual.BitmapProducer */ + public BufferedImage produce(File src, int index, ProducerContext context) { + try { + File bitmap = new File(bitmapDirectory, src.getName() + ".png"); + if (bitmap.exists()) { + return BitmapComparator.getImage(bitmap); + } else { + return null; + } + } catch (Exception e) { + log.error(e); + return null; + } + } + +} diff --git a/src/test/java/org/apache/fop/visual/StreamRedirector.java b/src/test/java/org/apache/fop/visual/StreamRedirector.java new file mode 100644 index 000000000..543c539ff --- /dev/null +++ b/src/test/java/org/apache/fop/visual/StreamRedirector.java @@ -0,0 +1,82 @@ +/* + * 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. + */ + +/* $Id$ */ + +package org.apache.fop.visual; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.Reader; + +/** + * Redirects the content coming in through an InputStream using a separate thread to a + * RedirectorLineHandler instance. The default text encoding is used. + */ +public class StreamRedirector implements Runnable { + + private InputStream in; + private RedirectorLineHandler handler; + private Exception exception; + + /** + * @param in the InputStream to read the content from + * @param handler the handler that receives all the lines + */ + public StreamRedirector(InputStream in, RedirectorLineHandler handler) { + this.in = in; + this.handler = handler; + } + + /** + * @return true if the run() method was terminated by an exception. + */ + public boolean hasFailed() { + return (this.exception != null); + } + + /** + * @return the exception if the run() method was terminated by an exception, or null + */ + public Exception getException() { + return this.exception; + } + + /** @see java.lang.Runnable#run() */ + public void run() { + this.exception = null; + try { + Reader inr = new java.io.InputStreamReader(in); + BufferedReader br = new BufferedReader(inr); + if (handler != null) { + handler.notifyStart(); + } + String line = null; + while ((line = br.readLine()) != null) { + if (handler != null) { + handler.handleLine(line); + } + } + if (handler != null) { + handler.notifyStart(); + } + } catch (IOException ioe) { + this.exception = ioe; + } + } +} |