Login | Register
My pages Projects Community openCollabNet

Discussions > commits > svn commit: r1110 - trunk/src/org/tigris/gef/persistence/export/SvgWriter.java

gef
Discussion topic

Back to topic list

svn commit: r1110 - trunk/src/org/tigris/gef/persistence/export/SvgWriter.java

Author mvw
Full name Michiel van der Wulp
Date 2008-10-26 11:43:53 PDT
Message Author: mvw
Date: 2008-10-26 11:43:53-0700
New Revision: 1110

Modified:
   trunk/src/org/tigris​/gef/persistence/exp​ort/SvgWriter.java

Log:
Fixing issue 321: Update SvgWriter to SVG 1.1.

Modified: trunk/src/org/tigris​/gef/persistence/exp​ort/SvgWriter.java
Url: http://gef.tigris.or​g/source/browse/gef/​trunk/src/org/tigris​/gef/persistence/exp​ort/SvgWriter.java?v​iew=diff&rev=111​0&p1=trunk/src/o​rg/tigris/gef/persis​tence/export/SvgWrit​er.java&p2=trunk​/src/org/tigris/gef/​persistence/export/S​vgWriter.java&r1​=1109&r2=1110
====================​====================​====================​==================
--- trunk/src/org/tigris​/gef/persistence/exp​ort/SvgWriter.java (original)
+++ trunk/src/org/tigris​/gef/persistence/exp​ort/SvgWriter.java 2008-10-26 11:43:53-0700
@@ -1,5 +1,5 @@
 // %1031243478619:org.t​igris.gef.persistenc​e%
-// Copyright (c) 1996-99 The Regents of the University of California. All
+// Copyright (c) 1996-2008 The Regents of the University of California. All
 // Rights Reserved. Permission to use, copy, modify, and distribute this
 // software and its documentation without fee, and without a written
 // agreement is hereby granted, provided that the above copyright notice
@@ -151,9 +151,10 @@
 
         _svg = builder.newDocument();
         _root = _svg.createElement("svg");
- _root.setAttribute("xmlns", "http://www.w3.org/2000/svg");
+ _root.setAttribute("xmlns", SVGns);
         _root.setAttribute("width", "" + (2 * _hInset + scaleX(_drawingArea.width)));
         _root.setAttribute("height", "" + (2 * _vInset + scaleY(_drawingArea.height)));
+ _root.setAttribute("version", "1.1");
     }
 
     public Graphics create() {
@@ -179,7 +180,9 @@
             case Node.DOCUMENT_NODE:
                 {
                     _writer.println("<?xml version=\"1.0\" encoding=\"utf-8\" ?>");
- _writer.print("<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 20001102//EN' 'http://www.w3.org/TR​/2000/CR-SVG-2000110​2/DTD/svg-20001102.d​td'>\n");
+ _writer.print("<!DOCTYPE svg PUBLIC " +
+ "\"-//W3C//DTD SVG 1.1//EN\" " +
+ "\"http://www.w3.org/Gr​aphics/SVG/1.1/DTD/s​vg11.dtd\">\n");
                     printDOMTree(((Docum​ent)node).getDocumen​tElement());
                     break;
                 }
@@ -375,17 +378,18 @@
      * @return The style of the current font as a SVG attribute.
      */
     private String getFontStyleSVG() {
- String style = "font-family:" + _font.getFamily() + "; font-size:" + _font.getSize() + ";";
+ StringBuilder style = new StringBuilder("font-family:" + _font.getFamily() + ";");
+ style.append(" font-size:" + _font.getSize() + "px;");
 
         // If this is a bold font, add the appropriate attribute.
         if(getFont().isBold())
- style += " font-weight:bold;";
+ style.append(" font-weight:bold;");
 
         // If this is a italic font, add the appropriate attribute.
         if(getFont().isItalic())
- style += " font-style:italic;";
+ style.append(" font-style:italic;");
 
- return style;
+ return style.toString();
     }
 
     public void copyArea(int x, int y, int width, int height, int dx, int dy) {

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

svn commit: r1110 - trunk/src/org/tigris/gef/persistence/export/SvgWriter.java mvw Michiel van der Wulp 2008-10-26 11:43:53 PDT
Messages per page: