Index: trunk/src/com/kitfox/svg/MissingGlyph.java
===================================================================
--- trunk/src/com/kitfox/svg/MissingGlyph.java	(revision 4256)
+++ trunk/src/com/kitfox/svg/MissingGlyph.java	(revision 6002)
@@ -1,39 +1,48 @@
 /*
- * Font.java
- *
- *
- *  The Salamander Project - 2D and 3D graphics libraries in Java
- *  Copyright (C) 2004 Mark McKay
- *
- *  This library is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU Lesser General Public
- *  License as published by the Free Software Foundation; either
- *  version 2.1 of the License, or (at your option) any later version.
- *
- *  This library is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- *  Lesser General Public License for more details.
- *
- *  You should have received a copy of the GNU Lesser General Public
- *  License along with this library; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- *  Mark McKay can be contacted at mark@kitfox.com.  Salamander and other
- *  projects can be found at http://www.kitfox.com
+ * SVG Salamander
+ * Copyright (c) 2004, Mark McKay
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or 
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ *   - Redistributions of source code must retain the above 
+ *     copyright notice, this list of conditions and the following
+ *     disclaimer.
+ *   - Redistributions in binary form must reproduce the above
+ *     copyright notice, this list of conditions and the following
+ *     disclaimer in the documentation and/or other materials 
+ *     provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE. 
+ * 
+ * Mark McKay can be contacted at mark@kitfox.com.  Salamander and other
+ * projects can be found at http://www.kitfox.com
  *
  * Created on February 20, 2004, 10:00 PM
  */
-
 package com.kitfox.svg;
 
-import com.kitfox.svg.xml.*;
-
-import java.awt.*;
-import java.awt.geom.*;
-import java.util.*;
-
-import com.kitfox.svg.pathcmd.*;
-//import org.apache.batik.ext.awt.geom.ExtendedGeneralPath;
+import com.kitfox.svg.pathcmd.BuildHistory;
+import com.kitfox.svg.pathcmd.PathCommand;
+import com.kitfox.svg.xml.StyleAttribute;
+import java.awt.Graphics2D;
+import java.awt.Shape;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.GeneralPath;
+import java.awt.geom.Rectangle2D;
+import java.util.Iterator;
 
 /**
@@ -47,10 +56,9 @@
 public class MissingGlyph extends ShapeElement
 {
+    public static final String TAG_NAME = "missingglyph";
+    
     //We may define a path
-//    ExtendedGeneralPath path = null;
     Shape path = null;
-
     //Alternately, we may have child graphical elements
-
     int horizAdvX = -1;  //Inherits font's value if not set
     int vertOriginX = -1;  //Inherits font's value if not set
@@ -58,24 +66,45 @@
     int vertAdvY = -1;  //Inherits font's value if not set
 
-    /** Creates a new instance of Font */
+    /**
+     * Creates a new instance of Font
+     */
     public MissingGlyph()
     {
     }
-/*
-    public void loaderStartElement(SVGLoaderHelper helper, Attributes attrs, SVGElement parent)
-    {
-		//Load style string
-        super.loaderStartElement(helper, attrs, parent);
+
+    public String getTagName()
+    {
+        return TAG_NAME;
+    }
+
+    /**
+     * Called after the start element but before the end element to indicate
+     * each child tag that has been processed
+     */
+    public void loaderAddChild(SVGLoaderHelper helper, SVGElement child) throws SVGElementException
+    {
+        super.loaderAddChild(helper, child);
+    }
+
+    protected void build() throws SVGException
+    {
+        super.build();
+
+        StyleAttribute sty = new StyleAttribute();
+
+        String commandList = "";
+        if (getPres(sty.setName("d")))
+        {
+            commandList = sty.getStringValue();
+        }
+
 
         //If glyph path was specified, calculate it
-        String commandList = attrs.getValue("d");
         if (commandList != null)
         {
-            StyleAttribute atyleAttrib = getStyle("fill-rule");
-            String fillRule = (atyleAttrib == null) ? "nonzero" : atyleAttrib.getStringValue();
+            String fillRule = getStyle(sty.setName("fill-rule")) ? sty.getStringValue() : "nonzero";
 
             PathCommand[] commands = parsePathList(commandList);
 
-//            ExtendedGeneralPath buildPath = new ExtendedGeneralPath(
             GeneralPath buildPath = new GeneralPath(
                 fillRule.equals("evenodd") ? GeneralPath.WIND_EVEN_ODD : GeneralPath.WIND_NON_ZERO,
@@ -98,72 +127,23 @@
 
         //Read glyph spacing info
-        String horizAdvX = attrs.getValue("horiz-adv-x");
-        String vertOriginX = attrs.getValue("vert-origin-x");
-        String vertOriginY = attrs.getValue("vert-origin-y");
-        String vertAdvY = attrs.getValue("vert-adv-y");
-
-        if (horizAdvX != null) this.horizAdvX = XMLParseUtil.parseInt(horizAdvX);
-        if (vertOriginX != null) this.vertOriginX = XMLParseUtil.parseInt(vertOriginX);
-        if (vertOriginY != null) this.vertOriginY = XMLParseUtil.parseInt(vertOriginY);
-        if (vertAdvY != null) this.vertAdvY = XMLParseUtil.parseInt(vertAdvY);
-
-    }
-*/
-    /**
-     * Called after the start element but before the end element to indicate
-     * each child tag that has been processed
-     */
-    public void loaderAddChild(SVGLoaderHelper helper, SVGElement child) throws SVGElementException
-    {
-        super.loaderAddChild(helper, child);
-    }
-
-    
-    protected void build() throws SVGException
-    {
-        super.build();
-        
-        StyleAttribute sty = new StyleAttribute();
-        
-        String commandList = "";
-        if (getPres(sty.setName("d"))) commandList = sty.getStringValue();
-
-    
-        //If glyph path was specified, calculate it
-        if (commandList != null)
-        {
-//            StyleAttribute atyleAttrib = getStyle("fill-rule");
-            String fillRule = getStyle(sty.setName("fill-rule")) ? sty.getStringValue() : "nonzero";
-
-            PathCommand[] commands = parsePathList(commandList);
-
-//            ExtendedGeneralPath buildPath = new ExtendedGeneralPath(
-            GeneralPath buildPath = new GeneralPath(
-                fillRule.equals("evenodd") ? GeneralPath.WIND_EVEN_ODD : GeneralPath.WIND_NON_ZERO,
-                commands.length);
-
-            BuildHistory hist = new BuildHistory();
-
-            for (int i = 0; i < commands.length; i++)
-            {
-                PathCommand cmd = commands[i];
-                cmd.appendPath(buildPath, hist);
-            }
-
-            //Reflect glyph path to put it in user coordinate system
-            AffineTransform at = new AffineTransform();
-            at.scale(1, -1);
-            path = at.createTransformedShape(buildPath);
-        }
-
-
-        //Read glyph spacing info
-        if (getPres(sty.setName("horiz-adv-x"))) horizAdvX = sty.getIntValue();
-
-        if (getPres(sty.setName("vert-origin-x"))) vertOriginX = sty.getIntValue();
-
-        if (getPres(sty.setName("vert-origin-y"))) vertOriginY = sty.getIntValue();
-
-        if (getPres(sty.setName("vert-adv-y"))) vertAdvY = sty.getIntValue();
+        if (getPres(sty.setName("horiz-adv-x")))
+        {
+            horizAdvX = sty.getIntValue();
+        }
+
+        if (getPres(sty.setName("vert-origin-x")))
+        {
+            vertOriginX = sty.getIntValue();
+        }
+
+        if (getPres(sty.setName("vert-origin-y")))
+        {
+            vertOriginY = sty.getIntValue();
+        }
+
+        if (getPres(sty.setName("vert-adv-y")))
+        {
+            vertAdvY = sty.getIntValue();
+        }
     }
 
@@ -177,13 +157,16 @@
         //Do not push or pop stack
 
-        if (path != null) renderShape(g, path);
-        
+        if (path != null)
+        {
+            renderShape(g, path);
+        }
+
         Iterator it = children.iterator();
         while (it.hasNext())
         {
-            SVGElement ele = (SVGElement)it.next();
+            SVGElement ele = (SVGElement) it.next();
             if (ele instanceof RenderableElement)
             {
-                ((RenderableElement)ele).render(g);
+                ((RenderableElement) ele).render(g);
             }
         }
@@ -195,5 +178,7 @@
     {
         if (horizAdvX == -1)
-            horizAdvX = ((Font)parent).getHorizAdvX();
+        {
+            horizAdvX = ((Font) parent).getHorizAdvX();
+        }
         return horizAdvX;
     }
@@ -202,5 +187,7 @@
     {
         if (vertOriginX == -1)
+        {
             vertOriginX = getHorizAdvX() / 2;
+        }
         return vertOriginX;
     }
@@ -209,5 +196,7 @@
     {
         if (vertOriginY == -1)
-            vertOriginY = ((Font)parent).getFontFace().getAscent();
+        {
+            vertOriginY = ((Font) parent).getFontFace().getAscent();
+        }
         return vertOriginY;
     }
@@ -216,5 +205,7 @@
     {
         if (vertAdvY == -1)
-            vertAdvY = ((Font)parent).getFontFace().getUnitsPerEm();
+        {
+            vertAdvY = ((Font) parent).getFontFace().getUnitsPerEm();
+        }
         return vertAdvY;
 
@@ -223,5 +214,8 @@
     public Shape getShape()
     {
-        if (path != null) return shapeToParent(path);
+        if (path != null)
+        {
+            return shapeToParent(path);
+        }
         return null;
     }
@@ -229,11 +223,15 @@
     public Rectangle2D getBoundingBox() throws SVGException
     {
-        if (path != null) return boundsToParent(includeStrokeInBounds(path.getBounds2D()));
+        if (path != null)
+        {
+            return boundsToParent(includeStrokeInBounds(path.getBounds2D()));
+        }
         return null;
     }
 
     /**
-     * Updates all attributes in this diagram associated with a time event.
-     * Ie, all attributes with track information.
+     * Updates all attributes in this diagram associated with a time event. Ie,
+     * all attributes with track information.
+     *
      * @return - true if this node has changed state as a result of the time
      * update
