aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Adams <gadams@apache.org>2012-05-28 03:30:37 +0000
committerGlenn Adams <gadams@apache.org>2012-05-28 03:30:37 +0000
commitd48e0e1f467c58a22c4d1b19591d4fa9d22aa8c6 (patch)
tree27f9f2afe4b8efcbd53066daa89a61aed6e5fa52
parent72ba7e572dccdb5ab1930ed9f20c9db7f720ae50 (diff)
downloadxmlgraphics-fop-d48e0e1f467c58a22c4d1b19591d4fa9d22aa8c6.tar.gz
xmlgraphics-fop-d48e0e1f467c58a22c4d1b19591d4fa9d22aa8c6.zip
Add version attribute to AT and IF intermediate formats. Also eliminate redundant use of reversed attribute in AT format.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1343133 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/documentation/intermediate-format-ng/fop-intermediate-format-ng.xsd1
-rw-r--r--src/java/org/apache/fop/render/intermediate/IFSerializer.java13
-rw-r--r--src/java/org/apache/fop/render/xml/XMLRenderer.java26
-rw-r--r--status.xml3
-rw-r--r--test/layoutengine/standard-testcases/bidi_propagation_1.xml4
-rw-r--r--test/layoutengine/standard-testcases/character_writing-mode_rl.xml10
6 files changed, 44 insertions, 13 deletions
diff --git a/src/documentation/intermediate-format-ng/fop-intermediate-format-ng.xsd b/src/documentation/intermediate-format-ng/fop-intermediate-format-ng.xsd
index bea5275a5..6e17c793b 100644
--- a/src/documentation/intermediate-format-ng/fop-intermediate-format-ng.xsd
+++ b/src/documentation/intermediate-format-ng/fop-intermediate-format-ng.xsd
@@ -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">
diff --git a/src/java/org/apache/fop/render/intermediate/IFSerializer.java b/src/java/org/apache/fop/render/intermediate/IFSerializer.java
index f8f286cb3..7114f51e3 100644
--- a/src/java/org/apache/fop/render/intermediate/IFSerializer.java
+++ b/src/java/org/apache/fop/render/intermediate/IFSerializer.java
@@ -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);
}
diff --git a/src/java/org/apache/fop/render/xml/XMLRenderer.java b/src/java/org/apache/fop/render/xml/XMLRenderer.java
index 4ac650269..cf3cbe5a2 100644
--- a/src/java/org/apache/fop/render/xml/XMLRenderer.java
+++ b/src/java/org/apache/fop/render/xml/XMLRenderer.java
@@ -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");
+ }
+ }
+
}
diff --git a/status.xml b/status.xml
index a18de8fca..6b1c4b849 100644
--- a/status.xml
+++ b/status.xml
@@ -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>
diff --git a/test/layoutengine/standard-testcases/bidi_propagation_1.xml b/test/layoutengine/standard-testcases/bidi_propagation_1.xml
index 947d9dac5..587bc6d2f 100644
--- a/test/layoutengine/standard-testcases/bidi_propagation_1.xml
+++ b/test/layoutengine/standard-testcases/bidi_propagation_1.xml
@@ -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>
diff --git a/test/layoutengine/standard-testcases/character_writing-mode_rl.xml b/test/layoutengine/standard-testcases/character_writing-mode_rl.xml
index adc126ec8..db65238c0 100644
--- a/test/layoutengine/standard-testcases/character_writing-mode_rl.xml
+++ b/test/layoutengine/standard-testcases/character_writing-mode_rl.xml
@@ -59,18 +59,18 @@
<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>