001    /*
002     * Font.java
003     *
004     *
005     *  The Salamander Project - 2D and 3D graphics libraries in Java
006     *  Copyright (C) 2004 Mark McKay
007     *
008     *  This library is free software; you can redistribute it and/or
009     *  modify it under the terms of the GNU Lesser General Public
010     *  License as published by the Free Software Foundation; either
011     *  version 2.1 of the License, or (at your option) any later version.
012     *
013     *  This library is distributed in the hope that it will be useful,
014     *  but WITHOUT ANY WARRANTY; without even the implied warranty of
015     *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
016     *  Lesser General Public License for more details.
017     *
018     *  You should have received a copy of the GNU Lesser General Public
019     *  License along with this library; if not, write to the Free Software
020     *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
021     *
022     *  Mark McKay can be contacted at mark@kitfox.com.  Salamander and other
023     *  projects can be found at http://www.kitfox.com
024     *
025     * Created on February 20, 2004, 10:00 PM
026     */
027    
028    package com.kitfox.svg;
029    
030    import com.kitfox.svg.xml.StyleAttribute;
031    import com.kitfox.svg.xml.*;
032    import org.xml.sax.*;
033    
034    import java.awt.*;
035    import java.awt.geom.*;
036    import java.util.*;
037    
038    import com.kitfox.svg.pathcmd.*;
039    //import org.apache.batik.ext.awt.geom.ExtendedGeneralPath;
040    
041    /**
042     * Implements an embedded font.
043     *
044     * SVG specification: http://www.w3.org/TR/SVG/fonts.html
045     *
046     * @author Mark McKay
047     * @author <a href="mailto:mark@kitfox.com">Mark McKay</a>
048     */
049    public class Glyph extends MissingGlyph
050    {
051        /**
052         * One or more characters indicating the unicode sequence that denotes
053         * this glyph.
054         */
055        String unicode;
056    
057        /** Creates a new instance of Font */
058        public Glyph()
059        {
060        }
061    /*
062        public void loaderStartElement(SVGLoaderHelper helper, Attributes attrs, SVGElement parent)
063        {
064                    //Load style string
065            super.loaderStartElement(helper, attrs, parent);
066    
067            //Get unicode sequence that maps to this glyph
068            unicode = attrs.getValue("unicode");
069        }
070    */
071        /*
072        public void loaderEndElement(SVGLoaderHelper helper)
073        {
074            super.loaderEndElement(helper);
075    
076            build();
077        }
078         */
079        
080        protected void build() throws SVGException
081        {
082            super.build();
083            
084            StyleAttribute sty = new StyleAttribute();
085            
086            if (getPres(sty.setName("unicode"))) unicode = sty.getStringValue();
087        }
088        
089        public String getUnicode() { return unicode; }
090        
091        /**
092         * Updates all attributes in this diagram associated with a time event.
093         * Ie, all attributes with track information.
094         * @return - true if this node has changed state as a result of the time
095         * update
096         */
097        public boolean updateTime(double curTime) throws SVGException
098        {
099            //Fonts can't change
100            return false;
101        }
102    }