Author: jeremias
Date: Mon Dec 22 06:11:52 2008
New Revision: 728699

URL: http://svn.apache.org/viewvc?rev=728699&view=rev
Log:
Need to use xml:space="preserve" on text elements in IF and SVG output to avoid 
problems with editing those files in XML editors and rendering SVG text 
starting or ending with whitespace.

Modified:
    
xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFSerializer.java
    
xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/util/XMLConstants.java
    
xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/sandbox/org/apache/fop/render/svg/SVGPainter.java

Modified: 
xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFSerializer.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFSerializer.java?rev=728699&r1=728698&r2=728699&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFSerializer.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFSerializer.java
 Mon Dec 22 06:11:52 2008
@@ -511,6 +511,7 @@
     public void drawText(int x, int y, int[] dx, int[] dy, String text) throws 
IFException {
         try {
             AttributesImpl atts = new AttributesImpl();
+            XMLUtil.addAttribute(atts, XMLConstants.XML_SPACE, "preserve");
             addAttribute(atts, "x", Integer.toString(x));
             addAttribute(atts, "y", Integer.toString(y));
             if (dx != null) {

Modified: 
xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/util/XMLConstants.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/util/XMLConstants.java?rev=728699&r1=728698&r2=728699&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/util/XMLConstants.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/util/XMLConstants.java
 Mon Dec 22 06:11:52 2008
@@ -32,6 +32,9 @@
     String XML_PREFIX = "xml";
     /** XML namespace URI */
     String XML_NAMESPACE = "http://www.w3.org/XML/1998/namespace";;
+    /** xml:space attribute */
+    org.apache.xmlgraphics.util.QName XML_SPACE = new 
org.apache.xmlgraphics.util.QName(
+            XML_NAMESPACE, XML_PREFIX, "space");
 
     /** XMLNS namespace prefix */
     String XMLNS_PREFIX = "xmlns";

Modified: 
xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/sandbox/org/apache/fop/render/svg/SVGPainter.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/sandbox/org/apache/fop/render/svg/SVGPainter.java?rev=728699&r1=728698&r2=728699&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/sandbox/org/apache/fop/render/svg/SVGPainter.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/sandbox/org/apache/fop/render/svg/SVGPainter.java
 Mon Dec 22 06:11:52 2008
@@ -58,6 +58,7 @@
 import org.apache.fop.traits.RuleStyle;
 import org.apache.fop.util.ColorUtil;
 import org.apache.fop.util.GenerationHelperContentHandler;
+import org.apache.fop.util.XMLConstants;
 import org.apache.fop.util.XMLUtil;
 
 /**
@@ -330,6 +331,7 @@
         try {
             establish(MODE_TEXT);
             AttributesImpl atts = new AttributesImpl();
+            XMLUtil.addAttribute(atts, XMLConstants.XML_SPACE, "preserve");
             XMLUtil.addAttribute(atts, "x", Integer.toString(x));
             XMLUtil.addAttribute(atts, "y", Integer.toString(y));
             if (dx != null) {



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to