]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Add version attribute to AT and IF intermediate formats. Also eliminate redundant...
authorGlenn Adams <gadams@apache.org>
Mon, 28 May 2012 03:30:37 +0000 (03:30 +0000)
committerGlenn Adams <gadams@apache.org>
Mon, 28 May 2012 03:30:37 +0000 (03:30 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1343133 13f79535-47bb-0310-9956-ffa450edef68

src/documentation/intermediate-format-ng/fop-intermediate-format-ng.xsd
src/java/org/apache/fop/render/intermediate/IFSerializer.java
src/java/org/apache/fop/render/xml/XMLRenderer.java
status.xml
test/layoutengine/standard-testcases/bidi_propagation_1.xml
test/layoutengine/standard-testcases/character_writing-mode_rl.xml

index bea5275a5b42bc63b0f77bf8cbd8ded1d7a50812..6e17c793bfe4898b33fa9192c0535469493c148c 100644 (file)
@@ -34,6 +34,7 @@
         <xs:element ref="mf:page-sequence" minOccurs="1" maxOccurs="unbounded"/>
         <xs:element ref="mf:trailer"/>
       </xs:sequence>
+      <xs:attribute name="version" type="xs:string"/>
     </xs:complexType>
   </xs:element>
   <xs:element name="header">
index f8f286cb31c01ff3a8e9b0004badff026ffba2af..7114f51e36580e12878f6fde14741b9006a8f564 100644 (file)
@@ -64,6 +64,15 @@ import org.apache.fop.util.XMLUtil;
 public class IFSerializer extends AbstractXMLWritingIFDocumentHandler
         implements IFConstants, IFPainter, IFDocumentNavigationHandler {
 
+    /**
+     * Intermediate Format (IF) version, used to express an @version attribute
+     * in the root element of the IF document, the initial value of which
+     * is set to '2.0' to signify that something preceded it (but didn't
+     * happen to be marked as such), and that this version is not necessarily
+     * backwards compatible with the unmarked (<2.0) version.
+     */
+    public static final String VERSION = "2.0";
+
     private IFDocumentHandler mimicHandler;
     private int pageSequenceIndex; // used for accessibility
 
@@ -167,7 +176,9 @@ public class IFSerializer extends AbstractXMLWritingIFDocumentHandler
                     DocumentNavigationExtensionConstants.NAMESPACE);
             handler.startPrefixMapping(InternalElementMapping.STANDARD_PREFIX,
                     InternalElementMapping.URI);
-            handler.startElement(EL_DOCUMENT);
+            AttributesImpl atts = new AttributesImpl();
+            addAttribute(atts, "version", VERSION);
+            handler.startElement(EL_DOCUMENT, atts);
         } catch (SAXException e) {
             throw new IFException("SAX error in startDocument()", e);
         }
index 4ac6502692d24c9dfc78086b51f9aaf27f323fe6..cf3cbe5a2ae46fe8eca0c3c0ede2cace9c13401a 100644 (file)
@@ -97,6 +97,15 @@ import org.apache.fop.util.XMLUtil;
  */
 public class XMLRenderer extends AbstractXMLRenderer {
 
+    /**
+     * Area Tree  (AT) version, used to express an @version attribute
+     * in the root element of the AT document, the initial value of which
+     * is set to '2.0' to signify that something preceded it (but didn't
+     * happen to be marked as such), and that this version is not necessarily
+     * backwards compatible with the unmarked (<2.0) version.
+     */
+    public static final String VERSION = "2.0";
+
     /** XML MIME type */
     public static final String XML_MIME_TYPE = MimeConstants.MIME_FOP_AREA_TREE;
 
@@ -365,7 +374,9 @@ public class XMLRenderer extends AbstractXMLRenderer {
         if (userAgent.getProducer() != null) {
             comment("Produced by " + userAgent.getProducer());
         }
-        startElement("areaTree");
+        atts.clear();
+        addAttribute("version", VERSION);
+        startElement("areaTree", atts);
     }
 
     /** {@inheritDoc} */
@@ -825,11 +836,10 @@ public class XMLRenderer extends AbstractXMLRenderer {
         }
         maybeAddLevelAttribute(word);
         maybeAddPositionAdjustAttribute(word);
-        if ( word.isReversed() ) {
-            addAttribute("reversed", "true");
-        }
+        String text = word.getWord();
+        maybeAddReversedAttribute(word, text);
         startElement("word", atts);
-        characters(word.getWord());
+        characters(text);
         endElement("word");
         super.renderWord(word);
     }
@@ -917,5 +927,11 @@ public class XMLRenderer extends AbstractXMLRenderer {
         }
     }
 
+    private void maybeAddReversedAttribute ( WordArea w, String text ) {
+        if ( w.isReversed() && ( text.length() > 1 )  ) {
+            addAttribute("reversed", "true");
+        }
+    }
+
 
 }
index a18de8fca0b69398547d0bf863ccfc5a7e1886bb..6b1c4b849e4e2db06a2ca1da69c203a34de6687d 100644 (file)
@@ -63,6 +63,9 @@
       documents. Example: the fix of marks layering will be such a case when it's done.
     -->
     <release version="FOP Trunk" date="TBD">
+      <action context="Renderers" dev="GA" type="fix" fixes-bug="53304,53306">
+        Add version attribute to AT and IF intermediate formats. Also eliminate redundant use of reversed attribute in AT format.
+      </action>
       <action context="Renderers" dev="GA" type="fix" fixes-bug="53295" due-to="Luis Bernardo">
         Add extension to place code just before PostScript %PageTrailer.
       </action>
index 947d9dac504da7941a0f1794b1a96ded47f9c0f2..587bc6d2f684e95e7c31c41ff0abd81c988ae145 100644 (file)
@@ -66,7 +66,7 @@
                           <fo:table-cell margin-left="0" text-align="right">
                             <fo:block>
                               <fo:inline>
-                                <fo:inline><fo:bidi-override unicode-bidi="bidi-override" direction="rtl">X</fo:bidi-override></fo:inline>
+                                <fo:inline><fo:bidi-override unicode-bidi="bidi-override" direction="rtl">XY</fo:bidi-override></fo:inline>
                               </fo:inline>
                             </fo:block>
                           </fo:table-cell>
@@ -93,7 +93,7 @@
                           <fo:table-cell margin-left="0" text-align="right">
                             <fo:block>
                               <fo:inline>
-                                <fo:inline><fo:bidi-override unicode-bidi="bidi-override" direction="rtl">X</fo:bidi-override></fo:inline>
+                                <fo:inline><fo:bidi-override unicode-bidi="bidi-override" direction="rtl">XY</fo:bidi-override></fo:inline>
                               </fo:inline>
                             </fo:block>
                           </fo:table-cell>
index adc126ec8732401809e1a30eb5d08b9d71c86d76..db65238c01c330fb5c55282f590aa2702e95ad91 100644 (file)
     <eval expected="6672" xpath="//flow/block[2]/block[1]/block[1]/lineArea/inlineparent/text[1]/@ipd"/>
     <eval expected="4" xpath="//flow/block[2]/block[1]/block[1]/lineArea/inlineparent/text[1]/word[1]"/>
     <eval expected="3" xpath="//flow/block[2]/block[1]/block[1]/lineArea/inlineparent/text[1]/word[1]/@level"/>
-    <true xpath="boolean(//flow/block[2]/block[1]/block[1]/lineArea/inlineparent/text[1]/word[1]/@reversed)"/>
+    <eval expected="" xpath="//flow/block[2]/block[1]/block[1]/lineArea/inlineparent/text[1]/word[1]/@reversed"/>
     <eval expected="6672" xpath="//flow/block[2]/block[1]/block[1]/lineArea/inlineparent/text[2]/@ipd"/>
     <eval expected="3" xpath="//flow/block[2]/block[1]/block[1]/lineArea/inlineparent/text[2]/word[1]"/>
-    <eval expected="3" xpath="//flow/block[2]/block[1]/block[1]/lineArea/inlineparent/text[1]/word[1]/@level"/>
-    <true xpath="boolean(//flow/block[2]/block[1]/block[1]/lineArea/inlineparent/text[1]/word[1]/@reversed)"/>
+    <eval expected="3" xpath="//flow/block[2]/block[1]/block[1]/lineArea/inlineparent/text[2]/word[1]/@level"/>
+    <eval expected="" xpath="//flow/block[2]/block[1]/block[1]/lineArea/inlineparent/text[2]/word[1]/@reversed"/>
     <eval expected="6672" xpath="//flow/block[2]/block[1]/block[1]/lineArea/inlineparent/text[3]/@ipd"/>
     <eval expected="2" xpath="//flow/block[2]/block[1]/block[1]/lineArea/inlineparent/text[3]/word[1]"/>
     <eval expected="3" xpath="//flow/block[2]/block[1]/block[1]/lineArea/inlineparent/text[3]/word[1]/@level"/>
-    <true xpath="boolean(//flow/block[2]/block[1]/block[1]/lineArea/inlineparent/text[3]/word[1]/@reversed)"/>
+    <eval expected="" xpath="//flow/block[2]/block[1]/block[1]/lineArea/inlineparent/text[3]/word[1]/@reversed"/>
     <eval expected="6672" xpath="//flow/block[2]/block[1]/block[1]/lineArea/inlineparent/text[4]/@ipd"/>
     <eval expected="1" xpath="//flow/block[2]/block[1]/block[1]/lineArea/inlineparent/text[4]/word[1]"/>
     <eval expected="3" xpath="//flow/block[2]/block[1]/block[1]/lineArea/inlineparent/text[4]/word[1]/@level"/>
-    <true xpath="boolean(//flow/block[2]/block[1]/block[1]/lineArea/inlineparent/text[4]/word[1]/@reversed)"/>
+    <eval expected="" xpath="//flow/block[2]/block[1]/block[1]/lineArea/inlineparent/text[4]/word[1]/@reversed"/>
   </checks>
 </testcase>