Browse Source

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
tags/fop-1_1rc1^2
Glenn Adams 12 years ago
parent
commit
d48e0e1f46

+ 1
- 0
src/documentation/intermediate-format-ng/fop-intermediate-format-ng.xsd View 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">

+ 12
- 1
src/java/org/apache/fop/render/intermediate/IFSerializer.java View 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);
}

+ 21
- 5
src/java/org/apache/fop/render/xml/XMLRenderer.java View 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");
}
}


}

+ 3
- 0
status.xml View 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>

+ 2
- 2
test/layoutengine/standard-testcases/bidi_propagation_1.xml View 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>

+ 5
- 5
test/layoutengine/standard-testcases/character_writing-mode_rl.xml View File

@@ -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>

Loading…
Cancel
Save