xmlgraphics-batik-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dewe...@apache.org
Subject cvs commit: xml-batik/test-resources/org/apache/batik/dom/svg bug30580.svg unitTesting.xml
Date Wed, 01 Sep 2004 09:35:24 GMT
deweese     2004/09/01 02:35:24

  Modified:    resources/org/apache/batik/svggen/font/resources
                        Messages.properties
               sources/org/apache/batik/apps/svgbrowser JAuthenticator.java
               sources/org/apache/batik/bridge SVGKernElementBridge.java
               sources/org/apache/batik/dom/svg SVGOMImageElement.java
                        SVGOMMarkerElement.java SVGOMPatternElement.java
                        SVGOMSVGElement.java SVGOMSymbolElement.java
                        SVGOMViewElement.java
               sources/org/apache/batik/gvt/font Kern.java
                        KerningTable.java SVGGVTGlyphVector.java
                        UnicodeRange.java
               sources/org/apache/batik/gvt/text ArabicTextHandler.java
               sources/org/apache/batik/svggen/font SVGFont.java
               sources/org/apache/batik/svggen/font/table CmapFormat.java
                        CmapFormat0.java CmapFormat2.java CmapFormat4.java
                        CmapFormat6.java
               sources/org/apache/batik/util RunnableQueue.java
                        SVGConstants.java
               test-resources/org/apache/batik/dom/svg unitTesting.xml
  Added:       sources/org/apache/batik/dom/svg
                        AbstractSVGPreserveAspectRatio.java
                        SVGOMAnimatedPreserveAspectRatio.java
                        SVGPreserveAspectRatioSupport.java
               test-resources/org/apache/batik/dom/svg bug30580.svg
  Log:
  1) Included Tonny's support for preserveAspectRatio DOM methods.
  2) Some improvements for Kerning in SVG Font (faster)
  3) ttf2svg now supports 'auto ranging' so it looks at the font
     to decide what to output.
  4) All Object.wait calls are now in while loops to prevent spurious wakeups.
  
  PR: 28432, 30580, 30739
  
  Revision  Changes    Path
  1.3       +1 -1      xml-batik/resources/org/apache/batik/svggen/font/resources/Messages.properties
  
  Index: Messages.properties
  ===================================================================
  RCS file: /home/cvs/xml-batik/resources/org/apache/batik/svggen/font/resources/Messages.properties,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Messages.properties	8 Aug 2003 11:39:28 -0000	1.2
  +++ Messages.properties	1 Sep 2004 09:35:22 -0000	1.3
  @@ -46,7 +46,7 @@
   ###############################################################################
   
   SVGFont.config.usage = \
  -usage: java org.apache.batik.svggen.font.SVGFont <ttf-path> [-l <range-begin>] [-h <range-end>] [-ascii] [-id <id>] [-o <output-path>] [-testcard]
  +usage: java org.apache.batik.svggen.font.SVGFont <ttf-path> [-l <range-begin>] [-h <range-end>] [-autorange] [-ascii] [-id <id>] [-o <output-path>] [-testcard]
   
   SVGFont.config.svg.begin = \
   <?xml version="1.0" standalone="no"?> \
  
  
  
  1.6       +9 -4      xml-batik/sources/org/apache/batik/apps/svgbrowser/JAuthenticator.java
  
  Index: JAuthenticator.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/apps/svgbrowser/JAuthenticator.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- JAuthenticator.java	18 Aug 2004 07:12:27 -0000	1.5
  +++ JAuthenticator.java	1 Sep 2004 09:35:22 -0000	1.6
  @@ -77,6 +77,7 @@
       Object lock = new Object();
   
       private boolean result;
  +    private boolean wasNotified;
       private String  userID;
       private char [] password;
   
  @@ -192,9 +193,12 @@
                           window.setVisible(true);
                       }
                   });
  -            try {
  -                lock.wait();
  -            } catch(InterruptedException ie) { }
  +            wasNotified = false;
  +            while (!wasNotified) {
  +                try {
  +                    lock.wait();
  +                } catch(InterruptedException ie) { }
  +            }
               if (!result)
                   return null;
   
  @@ -211,6 +215,7 @@
                       password = JPassword.getPassword();
                       JPassword.setText("");
                       result = true;
  +                    wasNotified = true;
                       lock.notifyAll();
                   }
               }
  @@ -226,7 +231,7 @@
                       password = null;
                       JPassword.setText("");
                       result = false;
  -                
  +                    wasNotified = true;
                       lock.notifyAll();
                   }
               }
  
  
  
  1.6       +89 -37    xml-batik/sources/org/apache/batik/bridge/SVGKernElementBridge.java
  
  Index: SVGKernElementBridge.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGKernElementBridge.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- SVGKernElementBridge.java	18 Aug 2004 07:12:35 -0000	1.5
  +++ SVGKernElementBridge.java	1 Sep 2004 09:35:22 -0000	1.6
  @@ -18,7 +18,8 @@
   package org.apache.batik.bridge;
   
   import java.util.StringTokenizer;
  -import java.util.Vector;
  +import java.util.List;
  +import java.util.ArrayList;
   
   import org.apache.batik.gvt.font.Kern;
   import org.apache.batik.gvt.font.UnicodeRange;
  @@ -55,16 +56,17 @@
           if (k.length() == 0) {
               k = SVG_KERN_K_DEFAULT_VALUE;
           }
  -
  +        
           // get the kern float value
           float kernValue = Float.parseFloat(k);
  -
  +        
           // set up the first and second glyph sets and unicode ranges
  -        Vector firstGlyphSet = new Vector();
  -        Vector secondGlyphSet = new Vector();
  -        Vector firstUnicodeRanges = new Vector();
  -        Vector secondUnicodeRanges = new Vector();
  -
  +        int firstGlyphLen = 0, secondGlyphLen = 0;
  +        int [] firstGlyphSet = null;
  +        int [] secondGlyphSet = null;
  +        List firstUnicodeRanges = new ArrayList();
  +        List secondUnicodeRanges = new ArrayList();
  +        
           // process the u1 attribute
           StringTokenizer st = new StringTokenizer(u1, ",");
           while (st.hasMoreTokens()) {
  @@ -73,12 +75,22 @@
                   firstUnicodeRanges.add(new UnicodeRange(token));
               } else {
                   int[] glyphCodes = font.getGlyphCodesForUnicode(token);
  -                for (int i = 0; i < glyphCodes.length; i++) {
  -                    firstGlyphSet.add(new Integer(glyphCodes[i]));
  +                if (firstGlyphSet == null)
  +                    firstGlyphSet = glyphCodes;
  +                else if ((firstGlyphLen + glyphCodes.length) > 
  +                         firstGlyphSet.length) {
  +                    int sz = firstGlyphSet.length*2;
  +                    if (sz <firstGlyphLen + glyphCodes.length)
  +                        sz = firstGlyphLen + glyphCodes.length;
  +                    int [] tmp = new int[sz];
  +                    for (int i = 0; i < glyphCodes.length; i++)
  +                        tmp[i] = firstGlyphSet[i];
                   }
  +                for (int i = 0; i < glyphCodes.length; i++)
  +                    firstGlyphSet[firstGlyphLen++] = glyphCodes[i];
               }
           }
  -
  +        
           // process the u2 attrbute
           st = new StringTokenizer(u2, ",");
           while (st.hasMoreTokens()) {
  @@ -87,51 +99,91 @@
                   secondUnicodeRanges.add(new UnicodeRange(token));
               } else {
                   int[] glyphCodes = font.getGlyphCodesForUnicode(token);
  -                for (int i = 0; i < glyphCodes.length; i++) {
  -                    secondGlyphSet.add(new Integer(glyphCodes[i]));
  +                if (secondGlyphSet == null)
  +                    secondGlyphSet = glyphCodes;
  +                else if ((secondGlyphLen + glyphCodes.length) > 
  +                         secondGlyphSet.length) {
  +                    int sz = secondGlyphSet.length*2;
  +                    if (sz <secondGlyphLen + glyphCodes.length)
  +                        sz = secondGlyphLen + glyphCodes.length;
  +                    int [] tmp = new int[sz];
  +                    for (int i = 0; i < glyphCodes.length; i++)
  +                        tmp[i] = secondGlyphSet[i];
                   }
  +                for (int i = 0; i < glyphCodes.length; i++)
  +                    secondGlyphSet[secondGlyphLen++] = glyphCodes[i];
               }
           }
  -
  +        
           // process the g1 attribute
           st = new StringTokenizer(g1, ",");
           while (st.hasMoreTokens()) {
               String token = st.nextToken();
               int[] glyphCodes = font.getGlyphCodesForName(token);
  -            for (int i = 0; i < glyphCodes.length; i++) {
  -                firstGlyphSet.add(new Integer(glyphCodes[i]));
  +            if (firstGlyphSet == null)
  +                firstGlyphSet = glyphCodes;
  +            else if ((firstGlyphLen + glyphCodes.length) > 
  +                     firstGlyphSet.length) {
  +                int sz = firstGlyphSet.length*2;
  +                if (sz <firstGlyphLen + glyphCodes.length)
  +                    sz = firstGlyphLen + glyphCodes.length;
  +                int [] tmp = new int[sz];
  +                for (int i = 0; i < glyphCodes.length; i++)
  +                    tmp[i] = firstGlyphSet[i];
               }
  +            for (int i = 0; i < glyphCodes.length; i++)
  +                firstGlyphSet[firstGlyphLen++] = glyphCodes[i];
           }
  -
  +        
           // process the g2 attribute
           st = new StringTokenizer(g2, ",");
           while (st.hasMoreTokens()) {
               String token = st.nextToken();
               int[] glyphCodes = font.getGlyphCodesForName(token);
  -            for (int i = 0; i < glyphCodes.length; i++) {
  -                secondGlyphSet.add(new Integer(glyphCodes[i]));
  +            if (secondGlyphSet == null)
  +                secondGlyphSet = glyphCodes;
  +            else if ((secondGlyphLen + glyphCodes.length) > 
  +                     secondGlyphSet.length) {
  +                int sz = secondGlyphSet.length*2;
  +                if (sz <secondGlyphLen + glyphCodes.length)
  +                    sz = secondGlyphLen + glyphCodes.length;
  +                int [] tmp = new int[sz];
  +                for (int i = 0; i < glyphCodes.length; i++)
  +                    tmp[i] = secondGlyphSet[i];
               }
  +            for (int i = 0; i < glyphCodes.length; i++)
  +                secondGlyphSet[secondGlyphLen++] = glyphCodes[i];
           }
   
           // construct the arrays
  -        int[] firstGlyphs = new int[firstGlyphSet.size()];
  -        int[] secondGlyphs = new int[secondGlyphSet.size()];
  -        UnicodeRange[] firstRanges = new UnicodeRange[firstUnicodeRanges.size()];
  -        UnicodeRange[] secondRanges = new UnicodeRange[secondUnicodeRanges.size()];
  -        for (int i = 0; i < firstGlyphSet.size(); i++) {
  -            firstGlyphs[i] = ((Integer)firstGlyphSet.elementAt(i)).intValue();
  -        }
  -        for (int i = 0; i < secondGlyphSet.size(); i++) {
  -            secondGlyphs[i] = ((Integer)secondGlyphSet.elementAt(i)).intValue();
  -        }
  -        for (int i = 0; i < firstUnicodeRanges.size(); i++) {
  -            firstRanges[i] = (UnicodeRange)firstUnicodeRanges.elementAt(i);
  -        }
  -        for (int i = 0; i < secondUnicodeRanges.size(); i++) {
  -            secondRanges[i] = (UnicodeRange)secondUnicodeRanges.elementAt(i);
  -        }
  +        int[] firstGlyphs;
  +        if ((firstGlyphLen == 0) || 
  +            (firstGlyphLen == firstGlyphSet.length)) {
  +            firstGlyphs = firstGlyphSet;
  +        } else {
  +            firstGlyphs = new int[firstGlyphLen];
  +            System.arraycopy(firstGlyphSet, 0, firstGlyphs, 0, firstGlyphLen);
  +        }
  +        int[] secondGlyphs;
  +        if ((secondGlyphLen == 0) || 
  +            (secondGlyphLen == secondGlyphSet.length)) {
  +            secondGlyphs = secondGlyphSet;
  +        } else {
  +            secondGlyphs = new int[secondGlyphLen];
  +            System.arraycopy(secondGlyphSet, 0, secondGlyphs, 0, 
  +                             secondGlyphLen);
  +        }
  +
  +        UnicodeRange[] firstRanges;
  +        firstRanges = new UnicodeRange[firstUnicodeRanges.size()];
  +        firstUnicodeRanges.toArray(firstRanges);
  +
  +        UnicodeRange[] secondRanges;
  +        secondRanges = new UnicodeRange[secondUnicodeRanges.size()];
  +        secondUnicodeRanges.toArray(secondRanges);
   
           // return the new Kern object
  -        return new Kern(firstGlyphs, secondGlyphs, firstRanges, secondRanges, kernValue);
  +        return new Kern(firstGlyphs, secondGlyphs, 
  +                        firstRanges, secondRanges, kernValue);
       }
   }
  
  
  
  1.12      +2 -2      xml-batik/sources/org/apache/batik/dom/svg/SVGOMImageElement.java
  
  Index: SVGOMImageElement.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/dom/svg/SVGOMImageElement.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- SVGOMImageElement.java	18 Aug 2004 07:13:17 -0000	1.11
  +++ SVGOMImageElement.java	1 Sep 2004 09:35:22 -0000	1.12
  @@ -117,7 +117,7 @@
        * <b>DOM</b>: Implements {@link SVGImageElement#getPreserveAspectRatio()}.
        */
       public SVGAnimatedPreserveAspectRatio getPreserveAspectRatio() {
  -        throw new RuntimeException(" !!! TODO: getPreserveAspectRatio()");
  +        return SVGPreserveAspectRatioSupport.getPreserveAspectRatio(this);
       }
   
       /**
  
  
  
  1.9       +2 -2      xml-batik/sources/org/apache/batik/dom/svg/SVGOMMarkerElement.java
  
  Index: SVGOMMarkerElement.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/dom/svg/SVGOMMarkerElement.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- SVGOMMarkerElement.java	18 Aug 2004 07:13:17 -0000	1.8
  +++ SVGOMMarkerElement.java	1 Sep 2004 09:35:22 -0000	1.9
  @@ -173,7 +173,7 @@
        * org.w3c.dom.svg.SVGFitToViewBox#getPreserveAspectRatio()}.
        */
       public SVGAnimatedPreserveAspectRatio getPreserveAspectRatio() {
  -	throw new RuntimeException(" !!! TODO: getPreserveAspectRatio()");
  +        return SVGPreserveAspectRatioSupport.getPreserveAspectRatio(this);
       }
   
       // SVGExternalResourcesRequired support /////////////////////////////
  
  
  
  1.15      +2 -2      xml-batik/sources/org/apache/batik/dom/svg/SVGOMPatternElement.java
  
  Index: SVGOMPatternElement.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/dom/svg/SVGOMPatternElement.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- SVGOMPatternElement.java	18 Aug 2004 07:13:17 -0000	1.14
  +++ SVGOMPatternElement.java	1 Sep 2004 09:35:22 -0000	1.15
  @@ -181,7 +181,7 @@
        * org.w3c.dom.svg.SVGFitToViewBox#getPreserveAspectRatio()}.
        */
       public SVGAnimatedPreserveAspectRatio getPreserveAspectRatio() {
  -        throw new RuntimeException(" !!! TODO: getPreserveAspectRatio()");
  +        return SVGPreserveAspectRatioSupport.getPreserveAspectRatio(this);
       }
   
       // SVGExternalResourcesRequired support /////////////////////////////
  
  
  
  1.27      +2 -2      xml-batik/sources/org/apache/batik/dom/svg/SVGOMSVGElement.java
  
  Index: SVGOMSVGElement.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/dom/svg/SVGOMSVGElement.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- SVGOMSVGElement.java	18 Aug 2004 07:13:18 -0000	1.26
  +++ SVGOMSVGElement.java	1 Sep 2004 09:35:22 -0000	1.27
  @@ -553,7 +553,7 @@
        * org.w3c.dom.svg.SVGFitToViewBox#getPreserveAspectRatio()}.
        */
       public SVGAnimatedPreserveAspectRatio getPreserveAspectRatio() {
  -        throw new RuntimeException(" !!! TODO: getPreserveAspectRatio()");
  +        return SVGPreserveAspectRatioSupport.getPreserveAspectRatio(this);
       }
   
       // SVGExternalResourcesRequired support /////////////////////////////
  
  
  
  1.13      +2 -2      xml-batik/sources/org/apache/batik/dom/svg/SVGOMSymbolElement.java
  
  Index: SVGOMSymbolElement.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/dom/svg/SVGOMSymbolElement.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- SVGOMSymbolElement.java	18 Aug 2004 07:13:18 -0000	1.12
  +++ SVGOMSymbolElement.java	1 Sep 2004 09:35:23 -0000	1.13
  @@ -136,7 +136,7 @@
        * org.w3c.dom.svg.SVGFitToViewBox#getPreserveAspectRatio()}.
        */
       public SVGAnimatedPreserveAspectRatio getPreserveAspectRatio() {
  -	throw new RuntimeException(" !!! TODO: getPreserveAspectRatio()");
  +        return SVGPreserveAspectRatioSupport.getPreserveAspectRatio(this);
       }
   
       // SVGExternalResourcesRequired support /////////////////////////////
  
  
  
  1.7       +2 -2      xml-batik/sources/org/apache/batik/dom/svg/SVGOMViewElement.java
  
  Index: SVGOMViewElement.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/dom/svg/SVGOMViewElement.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- SVGOMViewElement.java	18 Aug 2004 07:13:18 -0000	1.6
  +++ SVGOMViewElement.java	1 Sep 2004 09:35:23 -0000	1.7
  @@ -113,7 +113,7 @@
        * org.w3c.dom.svg.SVGFitToViewBox#getPreserveAspectRatio()}.
        */
       public SVGAnimatedPreserveAspectRatio getPreserveAspectRatio() {
  -        throw new RuntimeException(" !!! TODO: getPreserveAspectRatio()");
  +        return SVGPreserveAspectRatioSupport.getPreserveAspectRatio(this);
       }
   
       // SVGExternalResourcesRequired support /////////////////////////////
  
  
  
  1.1                  xml-batik/sources/org/apache/batik/dom/svg/AbstractSVGPreserveAspectRatio.java
  
  Index: AbstractSVGPreserveAspectRatio.java
  ===================================================================
  /*
  
     Copyright 2004  The Apache Software Foundation 
  
     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at
  
         http://www.apache.org/licenses/LICENSE-2.0
  
     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
  
   */
  package org.apache.batik.dom.svg;
  
  import java.util.StringTokenizer;
  
  import org.apache.batik.util.SVGConstants;
  import org.apache.batik.parser.ParseException;
  import org.apache.batik.parser.DefaultPreserveAspectRatioHandler;
  import org.apache.batik.parser.PreserveAspectRatioHandler;
  import org.apache.batik.parser.PreserveAspectRatioParser;
  
  import org.w3c.dom.DOMException;
  import org.w3c.dom.svg.SVGPreserveAspectRatio;
  
  /**
   * Abstract implementation for SVGPreservAspectRatio
   *
   * This is the base implementation for SVGPreservAspectRatio
   *
   * @author  Tonny Kohar
   */
  public abstract class AbstractSVGPreserveAspectRatio 
      implements SVGPreserveAspectRatio {
      
      /**
       * align property by default the value is
       * SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMIDYMID
       */
      protected short align = 
          SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMIDYMID;
      
      /**
       * meetOrSlice property
       * by default the value is SVGPreserveAspectRatio.SVG_MEETORSLICE_MEET;
       */
      protected short meetOrSlice = SVGPreserveAspectRatio.SVG_MEETORSLICE_MEET;
      
      /** Creates a new instance of AbstractSVGPreserveAspectRatio */
      public AbstractSVGPreserveAspectRatio() {
      }
      
      public short getAlign() {
          return this.align;
      }
      
      public short getMeetOrSlice() {
          return this.meetOrSlice;
      }
      
      public void setAlign(short align)  {
          this.align = align;
          setAttributeValue(getValueAsString());
      }
      
      public void setMeetOrSlice(short meetOrSlice) {
          this.meetOrSlice = meetOrSlice;
          setAttributeValue(getValueAsString());
      }
      
      public void reset() {
          align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMIDYMID;
          meetOrSlice = SVGPreserveAspectRatio.SVG_MEETORSLICE_MEET;
          //setAttributeValue(getValueAsString());
      }
      
      protected abstract void setAttributeValue(String value) 
          throws DOMException;
  
      protected abstract DOMException createDOMException(short type, String key, 
                                                         Object[] args);
      
      protected void setValueAsString(String value) throws DOMException {
          PreserveAspectRatioParserHandler ph;
          ph = new PreserveAspectRatioParserHandler();
          try {
              PreserveAspectRatioParser p = new PreserveAspectRatioParser();
              p.setPreserveAspectRatioHandler(ph);
              p.parse(value);
              align = ph.getAlign();
              meetOrSlice = ph.getMeetOrSlice();
          } catch (ParseException ex) {
              throw createDOMException(SVG_PRESERVEASPECTRATIO_UNKNOWN,
                                       "invalid value for preserveAspectRatio",
                                       null);
          }
      }
      
      /** Return the value of String to be used on setAttributeNS, in
       * other word the mapping of align meetOrSlice to representation
       * string use by SVG
       */
      protected String getValueAsString() {
          String value = null;
          
          switch (align) {
          case SVG_PRESERVEASPECTRATIO_NONE:
              value = SVGConstants.SVG_NONE_VALUE;
              return value; // if none ignore the rest
          case SVG_PRESERVEASPECTRATIO_XMINYMIN:
              value = SVGConstants.SVG_XMINYMIN_VALUE;
              break;
          case SVG_PRESERVEASPECTRATIO_XMIDYMIN:
              value = SVGConstants.SVG_XMIDYMIN_VALUE;
              break;
          case SVG_PRESERVEASPECTRATIO_XMAXYMIN:
              value = SVGConstants.SVG_XMAXYMIN_VALUE;
              break;
          case SVG_PRESERVEASPECTRATIO_XMINYMID:
              value = SVGConstants.SVG_XMINYMID_VALUE;
              break;
          case SVG_PRESERVEASPECTRATIO_XMIDYMID:
              value = SVGConstants.SVG_XMIDYMID_VALUE;
              break;
          case SVG_PRESERVEASPECTRATIO_XMAXYMID:
              value = SVGConstants.SVG_XMAXYMID_VALUE;
              break;
          case SVG_PRESERVEASPECTRATIO_XMINYMAX:
              value = SVGConstants.SVG_XMINYMAX_VALUE;
              break;
          case SVG_PRESERVEASPECTRATIO_XMIDYMAX:
              value = SVGConstants.SVG_XMIDYMAX_VALUE;
              break;
          case SVG_PRESERVEASPECTRATIO_XMAXYMAX:
              value = SVGConstants.SVG_XMAXYMAX_VALUE;
              break;
          default:
              throw createDOMException
                  (SVG_PRESERVEASPECTRATIO_UNKNOWN,
                   "invalid value for preserveAspectRatio",null);
              //break;
          }
          
          switch (meetOrSlice) {
          case SVG_MEETORSLICE_MEET:
              value = value + " " + SVGConstants.SVG_MEET_VALUE;
              break;
          case SVG_MEETORSLICE_SLICE:
              value = value + " " + SVGConstants.SVG_SLICE_VALUE;
              break;
          default:
              throw createDOMException(SVG_MEETORSLICE_UNKNOWN,
                                       "invalid value for preserveAspectRatio",
                                       null);
              //break;
          }
          
          return value;
      }
      
      protected class PreserveAspectRatioParserHandler 
          extends DefaultPreserveAspectRatioHandler {
          public short align = 
              SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMIDYMID;
          public short meetOrSlice = SVGPreserveAspectRatio.SVG_MEETORSLICE_MEET;
          
          public short getAlign() {
              return align;
          }
          
          public short getMeetOrSlice() {
              return meetOrSlice;
          }
          
          /**
           * Invoked when 'none' been parsed.
           * @exception ParseException if an error occured while processing
           * the transform
           */
          public void none() throws ParseException {
              align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_NONE;
          }
  
          /**
           * Invoked when 'xMaxYMax' has been parsed.
           * @exception ParseException if an error occured while processing
           * the transform
           */
          public void xMaxYMax() throws ParseException {
              align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMAXYMAX;
          }
  
          /**
           * Invoked when 'xMaxYMid' has been parsed.
           * @exception ParseException if an error occured while processing
           * the transform
           */
          public void xMaxYMid() throws ParseException {
              align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMAXYMID;
          }
  
          /**
           * Invoked when 'xMaxYMin' has been parsed.
           * @exception ParseException if an error occured while processing
           * the transform
           */
          public void xMaxYMin() throws ParseException {
              align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMAXYMIN;
          }
  
          /**
           * Invoked when 'xMidYMax' has been parsed.
           * @exception ParseException if an error occured while processing
           * the transform
           */
          public void xMidYMax() throws ParseException {
              align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMIDYMAX;
          }
  
          /**
           * Invoked when 'xMidYMid' has been parsed.
           * @exception ParseException if an error occured while processing
           * the transform
           */
          public void xMidYMid() throws ParseException {
              align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMIDYMID;
          }
  
          /**
           * Invoked when 'xMidYMin' has been parsed.
           * @exception ParseException if an error occured while processing
           * the transform
           */
          public void xMidYMin() throws ParseException {
              align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMIDYMIN;
          }
  
          /**
           * Invoked when 'xMinYMax' has been parsed.
           * @exception ParseException if an error occured while processing
           * the transform
           */
          public void xMinYMax() throws ParseException {
              align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMINYMAX;
          }
  
          /**
           * Invoked when 'xMinYMid' has been parsed.
           * @exception ParseException if an error occured while processing
           * the transform
           */
          public void xMinYMid() throws ParseException {
              align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMINYMID;
          }
  
          /**
           * Invoked when 'xMinYMin' has been parsed.
           * @exception ParseException if an error occured while processing
           * the transform
           */
          public void xMinYMin() throws ParseException {
              align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMINYMIN;
          }
  
          /**
           * Invoked when 'meet' has been parsed.
           * @exception ParseException if an error occured while processing
           * the transform
           */
          public void meet() throws ParseException {
              meetOrSlice = SVGPreserveAspectRatio.SVG_MEETORSLICE_MEET;
          }
  
          /**
           * Invoked when 'slice' has been parsed.
           * @exception ParseException if an error occured while processing
           * the transform
           */
          public void slice() throws ParseException {
              meetOrSlice = SVGPreserveAspectRatio.SVG_MEETORSLICE_SLICE;
          }
      }
  }
  
  
  
  1.1                  xml-batik/sources/org/apache/batik/dom/svg/SVGOMAnimatedPreserveAspectRatio.java
  
  Index: SVGOMAnimatedPreserveAspectRatio.java
  ===================================================================
  /*
  
     Copyright 2004  The Apache Software Foundation 
  
     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at
  
         http://www.apache.org/licenses/LICENSE-2.0
  
     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
  
   */
  package org.apache.batik.dom.svg;
  
  import org.apache.batik.util.SVGConstants;
  
  import org.w3c.dom.Attr;
  import org.w3c.dom.DOMException;
  import org.w3c.dom.svg.SVGAnimatedPreserveAspectRatio;
  import org.w3c.dom.svg.SVGPreserveAspectRatio;
  import org.w3c.dom.svg.SVGException;
  
  /**
   * This class implements the {@link SVGAnimatePreserveAspectRatio} interface.
   *
   * @author  Tonny Kohar
   */
  public class SVGOMAnimatedPreserveAspectRatio 
      implements SVGAnimatedPreserveAspectRatio, LiveAttributeValue {
      /**
       * The associated element.
       */
      protected AbstractElement element;
      
      /**
       * Whether the value is changing.
       */
      protected boolean changing = false;
      
      /**
       * SVGPreserveAspectRatio mapping the static 'preserveAspectRatio'
       * attribute.
       */
      protected AbstractSVGPreserveAspectRatio preserveAspectRatio;
      
      
      /** Creates a new instance of SVGOMAnimatePreserveAspectRatio */
      public SVGOMAnimatedPreserveAspectRatio(AbstractElement elt)  {
          element = elt;
          preserveAspectRatio = new SVGOMPreserveAspectRatio();
          String attrValue = elt.getAttributeNS
              (null,SVGConstants.SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE);
          if (attrValue != null) {
              preserveAspectRatio.setValueAsString(attrValue);
          }
      }
      
      public void attrAdded(Attr node, String newv) {
          if (!changing) {
              preserveAspectRatio.setValueAsString(newv);
              System.out.println("attr added: " + newv);
          }
      }
      
      public void attrModified(Attr node, String oldv, String newv) {
          if (!changing) {
              preserveAspectRatio.setValueAsString(newv);
          }
      }
      
      public void attrRemoved(Attr node, String oldv) {
          if (!changing) {
              preserveAspectRatio.reset();
          }
      }
      
      public SVGPreserveAspectRatio getAnimVal() {
          throw new RuntimeException("!!! TODO: getAnimVal()");
          
      }
      
      public SVGPreserveAspectRatio getBaseVal() {
          return preserveAspectRatio;
      }
      
      /** The implementation of SVGPreserveAspectRatio
       */
      public class SVGOMPreserveAspectRatio 
          extends AbstractSVGPreserveAspectRatio {
          
          /**
           * Create a DOMException.
           */
          protected DOMException createDOMException(short    type,
                                                    String   key,
                                                    Object[] args){
              return element.createDOMException(type,key,args);
          }
          
          protected void setAttributeValue(String value) throws DOMException {
              try {
                  changing = true;
                  element.setAttributeNS
                      (null,SVGConstants.SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE,
                       value);
              } finally {
                  changing = false;
              }
          }
      }
  }
  
  
  
  1.1                  xml-batik/sources/org/apache/batik/dom/svg/SVGPreserveAspectRatioSupport.java
  
  Index: SVGPreserveAspectRatioSupport.java
  ===================================================================
  /*
  
     Copyright 2004  The Apache Software Foundation 
  
     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at
  
         http://www.apache.org/licenses/LICENSE-2.0
  
     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
  
   */
  
  package org.apache.batik.dom.svg;
  
  import org.apache.batik.util.SVGConstants;
  import org.w3c.dom.svg.SVGAnimatedPreserveAspectRatio;
  
  /**
   *
   * @author  Tonny Kohar
   */
  public class SVGPreserveAspectRatioSupport {
      /**
       * To implement getPreserveAspectRatio.
       * Returns the value of the 'preserveAspectRatio' attribute of the
       * given element.
       */
      public static SVGAnimatedPreserveAspectRatio 
          getPreserveAspectRatio(AbstractElement elt) {
          SVGOMAnimatedPreserveAspectRatio ret;
          ret = (SVGOMAnimatedPreserveAspectRatio)elt.getLiveAttributeValue
              (null, SVGConstants.SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE);
  
          if (ret == null) {
              ret = new SVGOMAnimatedPreserveAspectRatio(elt);
              elt.putLiveAttributeValue
                  (null, SVGConstants.SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE, ret);
          }
          return ret;
      }
  }
  
  
  
  1.6       +63 -13    xml-batik/sources/org/apache/batik/gvt/font/Kern.java
  
  Index: Kern.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/gvt/font/Kern.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Kern.java	18 Aug 2004 07:14:35 -0000	1.5
  +++ Kern.java	1 Sep 2004 09:35:23 -0000	1.6
  @@ -17,6 +17,8 @@
    */
   package org.apache.batik.gvt.font;
   
  +import java.util.Arrays;
  +
   /**
    * The Kern class describes an entry in the "kerning table". It provides
    * a kerning value to be used when laying out characters side
  @@ -60,6 +62,11 @@
           this.firstUnicodeRanges = firstUnicodeRanges;
           this.secondUnicodeRanges = secondUnicodeRanges;
           this.kerningAdjust = adjustValue;
  +
  +        if (firstGlyphCodes != null) 
  +            Arrays.sort(this.firstGlyphCodes);
  +        if (secondGlyphCodes != null) 
  +            Arrays.sort(this.secondGlyphCodes);
       }
   
       /**
  @@ -68,19 +75,40 @@
        *
        * @param glyphCode The id of the glyph to test.
        * @param glyphUnicode The unicode value of the glyph to test.
  -     * @return True if this glyph is in the list of first glyphs for the kerning
  -     * entry 
  +     * @return True if this glyph is in the list of first glyphs for
  +     * the kerning entry
        */
       public boolean matchesFirstGlyph(int glyphCode, String glyphUnicode) {
  -        for (int i = 0; i < firstGlyphCodes.length; i++) {
  -            if (firstGlyphCodes[i] == glyphCode) {
  +        if (firstGlyphCodes != null) {
  +            int pt = Arrays.binarySearch(firstGlyphCodes, glyphCode);
  +            if (pt >= 0) return true;
  +        }
  +        if (glyphUnicode.length() < 1) return false;
  +        char glyphChar = glyphUnicode.charAt(0);
  +        for (int i = 0; i < firstUnicodeRanges.length; i++) {
  +            if (firstUnicodeRanges[i].contains(glyphChar))
                   return true;
  -            }
  +        }
  +        return false;
  +    }
  +
  +    /**
  +     * Returns true if the specified glyph is one of the glyphs considered
  +     * as first by this kerning entry. Returns false otherwise.
  +     *
  +     * @param glyphCode The id of the glyph to test.
  +     * @param glyphUnicode The unicode value of the glyph to test.
  +     * @return True if this glyph is in the list of first glyphs for
  +     *         the kerning entry
  +     */
  +    public boolean matchesFirstGlyph(int glyphCode, char glyphUnicode) {
  +        if (firstGlyphCodes != null) {
  +            int pt = Arrays.binarySearch(firstGlyphCodes, glyphCode);
  +            if (pt >= 0) return true;
           }
           for (int i = 0; i < firstUnicodeRanges.length; i++) {
  -            if (firstUnicodeRanges[i].contains(glyphUnicode)) {
  +            if (firstUnicodeRanges[i].contains(glyphUnicode))
                   return true;
  -            }
           }
           return false;
       }
  @@ -96,15 +124,37 @@
        * kerning entry 
        */
       public boolean matchesSecondGlyph(int glyphCode, String glyphUnicode) {
  -        for (int i = 0; i < secondGlyphCodes.length; i++) {
  -            if (secondGlyphCodes[i] == glyphCode) {
  +        if (secondGlyphCodes != null) {
  +            int pt = Arrays.binarySearch(secondGlyphCodes, glyphCode);
  +            if (pt >= 0) return true;
  +        }
  +        if (glyphUnicode.length() < 1) return false;
  +        char glyphChar = glyphUnicode.charAt(0);
  +        for (int i = 0; i < secondUnicodeRanges.length; i++) {
  +            if (secondUnicodeRanges[i].contains(glyphChar))
                   return true;
  -            }
  +        }
  +        return false;
  +    }
  +
  +    /**
  +     * Returns true if the specified glyph is one of the glyphs considered
  +     * as second by this kerning entry. Returns false otherwise.
  +     *
  +     * @param glyphCode The id of the glyph to test.
  +     * @param glyphUnicode The unicode value of the glyph to test.
  +
  +     * @return True if this glyph is in the list of second glyphs for the
  +     * kerning entry 
  +     */
  +    public boolean matchesSecondGlyph(int glyphCode, char glyphUnicode) {
  +        if (secondGlyphCodes != null) {
  +            int pt = Arrays.binarySearch(secondGlyphCodes, glyphCode);
  +            if (pt >= 0) return true;
           }
           for (int i = 0; i < secondUnicodeRanges.length; i++) {
  -            if (secondUnicodeRanges[i].contains(glyphUnicode)) {
  +            if (secondUnicodeRanges[i].contains(glyphUnicode))
                   return true;
  -            }
           }
           return false;
       }
  
  
  
  1.6       +5 -5      xml-batik/sources/org/apache/batik/gvt/font/KerningTable.java
  
  Index: KerningTable.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/gvt/font/KerningTable.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- KerningTable.java	18 Aug 2004 07:14:35 -0000	1.5
  +++ KerningTable.java	1 Sep 2004 09:35:23 -0000	1.6
  @@ -46,10 +46,10 @@
        *
        * @param glyphCode1 The id of the first glyph in the kerning pair
        * @param glyphCode2 The id of the second glyph in the kerning pair
  -     * @param glyphUnicode1 The unicode value of the first glyph in the kerning
  -     * pair
  -     * @param glyphUnicode2 The unicode vlaue of the second glyph in the kerning
  -     * pair
  +     * @param glyphUnicode1 The unicode value of the first glyph in
  +     * the kerning pair
  +     * @param glyphUnicode2 The unicode vlaue of the second glyph in
  +     * the kerning pair
        * @return The amount of kerning to be added when laying out the glyphs 
        */
       public float getKerningValue(int glyphCode1, 
  
  
  
  1.19      +5 -4      xml-batik/sources/org/apache/batik/gvt/font/SVGGVTGlyphVector.java
  
  Index: SVGGVTGlyphVector.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/gvt/font/SVGGVTGlyphVector.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- SVGGVTGlyphVector.java	18 Aug 2004 07:14:35 -0000	1.18
  +++ SVGGVTGlyphVector.java	1 Sep 2004 09:35:23 -0000	1.19
  @@ -663,6 +663,10 @@
        * layout is horizontal.
        */
       public void performDefaultLayout() {
  +        logicalBounds = null;
  +        outline       = null;
  +        bounds2D      = null;
  +
           float currentX = 0;
           float currentY = 0;
           for (int i = 0; i < glyphs.length; i++) {
  @@ -670,9 +674,6 @@
               glyphs[i].setTransform(null);
               glyphLogicalBounds[i] = null;
               currentX += glyphs[i].getHorizAdvX();
  -            logicalBounds = null;
  -            outline = null;
  -            bounds2D = null;
           }
           endPos = new Point2D.Float(currentX, currentY);
       }
  
  
  
  1.5       +11 -6     xml-batik/sources/org/apache/batik/gvt/font/UnicodeRange.java
  
  Index: UnicodeRange.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/gvt/font/UnicodeRange.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- UnicodeRange.java	18 Aug 2004 07:14:36 -0000	1.4
  +++ UnicodeRange.java	1 Sep 2004 09:35:23 -0000	1.5
  @@ -19,7 +19,9 @@
   
   
   /**
  - * A class that represents a CSS unicode range.
  + * A class that represents a CSS unicode range.  This only handles
  + * a single range of contigous chars, to handle multiple ranges
  + * (comma seperated) use a list of these.
    *
    * @author <a href="mailto:bella.robinson@cmis.csiro.au">Bella Robinson</a>
    * @version $Id$
  @@ -73,11 +75,14 @@
       public boolean contains(String unicode) {
           if (unicode.length() == 1) {
               int unicodeVal = unicode.charAt(0);
  -            if (unicodeVal >= firstUnicodeValue
  -                 && unicodeVal <= lastUnicodeValue) {
  -                return true;
  -            }
  +            return contains(unicodeVal);
           }
           return false;
       }
  +
  +    public boolean contains(int unicodeVal) {
  +        return ((unicodeVal >= firstUnicodeValue) &&
  +                (unicodeVal <= lastUnicodeValue));
  +    }
  +
   }
  
  
  
  1.7       +10 -8     xml-batik/sources/org/apache/batik/gvt/text/ArabicTextHandler.java
  
  Index: ArabicTextHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/gvt/text/ArabicTextHandler.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ArabicTextHandler.java	18 Aug 2004 07:14:40 -0000	1.6
  +++ ArabicTextHandler.java	1 Sep 2004 09:35:23 -0000	1.7
  @@ -374,15 +374,16 @@
       }
   
       /**
  -     * Where possible substitues plain arabic glyphs with their shaped forms.
  -     * This is needed when the arabic text is rendered using an AWT font.
  -     * Simple arabic ligatures will also be recognised and replaced by a single
  -     * character so the length of the resulting string may be shorter than the number
  -     * of characters in the aci.
  +     * Where possible substitues plain arabic glyphs with their shaped
  +     * forms.  This is needed when the arabic text is rendered using
  +     * an AWT font.  Simple arabic ligatures will also be recognised
  +     * and replaced by a single character so the length of the
  +     * resulting string may be shorter than the number of characters
  +     * in the aci.
        *
        * @param aci Contains the text to process. Arabic form attributes
        * should already be assigned to each arabic character.
  -     * @return A String containing the shaped versions of the arabic characters.
  +     * @return A String containing the shaped versions of the arabic characters
        */
       public static String createSubstituteString(AttributedCharacterIterator aci) {
   
  @@ -451,7 +452,8 @@
       }
   
       /**
  -     * Returns true if a ligature exists that starts with the specified character.
  +     * Returns true if a ligature exists that starts with the
  +     * specified character.
        *
        * @param c The character to test.
        * @return True if there is a ligature that starts with c, false otherwise.
  
  
  
  1.7       +22 -6     xml-batik/sources/org/apache/batik/svggen/font/SVGFont.java
  
  Index: SVGFont.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/svggen/font/SVGFont.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- SVGFont.java	9 Aug 2003 16:58:42 -0000	1.6
  +++ SVGFont.java	1 Sep 2004 09:35:23 -0000	1.7
  @@ -81,6 +81,9 @@
       static final String PROPERTY_LINE_SEPARATOR = "line.separator";
       static final String PROPERTY_LINE_SEPARATOR_DEFAULT = "\n";
   
  +    static final int DEFAULT_FIRST = 32;
  +    static final int DEFAULT_LAST = 128;
  +
       static {
           String  temp;
           try { 
  @@ -296,7 +299,7 @@
        * @param last The last character in the output range
        * @param forceAscii Force the use of the ASCII character map
        */
  -    protected static void writeFontAsSVGFragment(PrintStream ps, Font font, String id, int first, int last, boolean forceAscii)
  +    protected static void writeFontAsSVGFragment(PrintStream ps, Font font, String id, int first, int last, boolean autoRange, boolean forceAscii)
       throws Exception {
           //    StringBuffer sb = new StringBuffer();
           //    int horiz_advance_x = font.getHmtxTable().getAdvanceWidth(
  @@ -350,8 +353,9 @@
               throw new Exception("Cannot find a suitable cmap table");
           }
   
  -        // If this font includes arabic script, we want to specify substitutions
  -        // for initial, medial, terminal & isolated cases.
  +        // If this font includes arabic script, we want to specify
  +        // substitutions for initial, medial, terminal & isolated
  +        // cases.
           GsubTable gsub = (GsubTable) font.getTable(Table.GSUB);
           SingleSubst initialSubst = null;
           SingleSubst medialSubst = null;
  @@ -380,6 +384,15 @@
               initialSubst, medialSubst, terminalSubst, ""));
   
           try {
  +            if (first == -1) {
  +                if (!autoRange) first = DEFAULT_FIRST;
  +                else            first = cmapFmt.getFirst();
  +            }
  +            if (last == -1) {
  +                if (!autoRange) last = DEFAULT_LAST;
  +                else            last = cmapFmt.getLast();
  +            }
  +
               // Include our requested range
               for (int i = first; i <= last; i++) {
                   int glyphIndex = cmapFmt.mapCharCode(i);
  @@ -679,6 +692,7 @@
       public static final String ARG_KEY_ID = "-id";
       public static final String ARG_KEY_ASCII = "-ascii";
       public static final String ARG_KEY_TESTCARD = "-testcard";
  +    public static final String ARG_KEY_AUTO_RANGE = "-autorange";
       public static final String ARG_KEY_OUTPUT_PATH = "-o";
   
       /**
  @@ -694,6 +708,7 @@
               String ascii = parseArgs(args, ARG_KEY_ASCII);
               String testCard = parseArgs(args, ARG_KEY_TESTCARD);
               String outPath = parseArgs(args, ARG_KEY_OUTPUT_PATH);
  +            String autoRange = parseArgs(args, ARG_KEY_AUTO_RANGE);
               PrintStream ps = null;
               FileOutputStream fos = null;
   
  @@ -718,8 +733,9 @@
                       ps,
                       font,
                       id,
  -                    (low != null ? Integer.parseInt(low) : 32),
  -                    (high != null ? Integer.parseInt(high) : 127),
  +                    (low != null ? Integer.parseInt(low) : -1),
  +                    (high != null ? Integer.parseInt(high) : -1),
  +                    (autoRange != null),
                       (ascii != null));
                   writeSvgDefsEnd(ps);
                   if (testCard != null) {
  
  
  
  1.4       +4 -1      xml-batik/sources/org/apache/batik/svggen/font/table/CmapFormat.java
  
  Index: CmapFormat.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/svggen/font/table/CmapFormat.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- CmapFormat.java	18 Aug 2004 07:15:19 -0000	1.3
  +++ CmapFormat.java	1 Sep 2004 09:35:23 -0000	1.4
  @@ -64,6 +64,9 @@
   
       public abstract int mapCharCode(int charCode);
   
  +    public abstract int getFirst();
  +    public abstract int getLast();
  +
       public String toString() {
           return new StringBuffer()
           .append("format: ")
  
  
  
  1.4       +10 -1     xml-batik/sources/org/apache/batik/svggen/font/table/CmapFormat0.java
  
  Index: CmapFormat0.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/svggen/font/table/CmapFormat0.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- CmapFormat0.java	18 Aug 2004 07:15:19 -0000	1.3
  +++ CmapFormat0.java	1 Sep 2004 09:35:23 -0000	1.4
  @@ -29,14 +29,23 @@
   public class CmapFormat0 extends CmapFormat {
   
       private int[] glyphIdArray = new int[256];
  +    private int first, last;
   
       protected CmapFormat0(RandomAccessFile raf) throws IOException {
           super(raf);
           format = 0;
  +        first = -1;
           for (int i = 0; i < 256; i++) {
               glyphIdArray[i] = raf.readUnsignedByte();
  +            if (glyphIdArray[i] > 0) {
  +                if (first == -1) first = i;
  +                last = i;
  +            }
           }
       }
  +
  +    public int getFirst() { return first; }
  +    public int getLast()  { return last; }
   
       public int mapCharCode(int charCode) {
           if (0 <= charCode && charCode < 256) {
  
  
  
  1.4       +4 -1      xml-batik/sources/org/apache/batik/svggen/font/table/CmapFormat2.java
  
  Index: CmapFormat2.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/svggen/font/table/CmapFormat2.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- CmapFormat2.java	18 Aug 2004 07:15:20 -0000	1.3
  +++ CmapFormat2.java	1 Sep 2004 09:35:23 -0000	1.4
  @@ -36,6 +36,9 @@
           format = 2;
       }
   
  +    public int getFirst() { return 0; }
  +    public int getLast()  { return 0; }
  +    
       public int mapCharCode(int charCode) {
           return 0;
       }
  
  
  
  1.6       +8 -1      xml-batik/sources/org/apache/batik/svggen/font/table/CmapFormat4.java
  
  Index: CmapFormat4.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/svggen/font/table/CmapFormat4.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- CmapFormat4.java	27 Aug 2004 00:42:07 -0000	1.5
  +++ CmapFormat4.java	1 Sep 2004 09:35:23 -0000	1.6
  @@ -37,6 +37,7 @@
       private int[] idRangeOffset;
       private int[] glyphIdArray;
       private int segCount;
  +    private int first, last;
   
       protected CmapFormat4(RandomAccessFile raf) throws IOException {
           super(raf);
  @@ -50,12 +51,15 @@
           searchRange = raf.readUnsignedShort();
           entrySelector = raf.readUnsignedShort();
           rangeShift = raf.readUnsignedShort();
  +        last = -1;
           for (int i = 0; i < segCount; i++) {
               endCode[i] = raf.readUnsignedShort();
  +            if (endCode[i] > last) last = endCode[i];
           }
           raf.readUnsignedShort(); // reservePad
           for (int i = 0; i < segCount; i++) {
               startCode[i] = raf.readUnsignedShort();
  +            if ((i==0 ) || (startCode[i] < first)) first = startCode[i];
           }
           for (int i = 0; i < segCount; i++) {
               idDelta[i] = raf.readUnsignedShort();
  @@ -71,6 +75,9 @@
               glyphIdArray[i] = raf.readUnsignedShort();
           }
       }
  +
  +    public int getFirst() { return first; }
  +    public int getLast()  { return last; }
   
       public int mapCharCode(int charCode) {
           try {
  
  
  
  1.4       +4 -1      xml-batik/sources/org/apache/batik/svggen/font/table/CmapFormat6.java
  
  Index: CmapFormat6.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/svggen/font/table/CmapFormat6.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- CmapFormat6.java	18 Aug 2004 07:15:20 -0000	1.3
  +++ CmapFormat6.java	1 Sep 2004 09:35:23 -0000	1.4
  @@ -38,6 +38,9 @@
           format = 6;
       }
   
  +    public int getFirst() { return 0; }
  +    public int getLast()  { return 0; }
  +    
       public int mapCharCode(int charCode) {
           return 0;
       }
  
  
  
  1.17      +8 -5      xml-batik/sources/org/apache/batik/util/RunnableQueue.java
  
  Index: RunnableQueue.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/util/RunnableQueue.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- RunnableQueue.java	18 Aug 2004 07:15:49 -0000	1.16
  +++ RunnableQueue.java	1 Sep 2004 09:35:23 -0000	1.17
  @@ -329,10 +329,13 @@
                   }
               }
   
  -            if (waitTillSuspended)
  -                try {
  -                    stateLock.wait();
  -                } catch(InterruptedException ie) { }
  +            if (waitTillSuspended) {
  +                while (state == SUSPENDING) {
  +                    try {
  +                        stateLock.wait();
  +                    } catch(InterruptedException ie) { }
  +                }
  +            }
           }
       }
   
  
  
  
  1.73      +14 -2     xml-batik/sources/org/apache/batik/util/SVGConstants.java
  
  Index: SVGConstants.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/util/SVGConstants.java,v
  retrieving revision 1.72
  retrieving revision 1.73
  diff -u -r1.72 -r1.73
  --- SVGConstants.java	18 Aug 2004 07:15:50 -0000	1.72
  +++ SVGConstants.java	1 Sep 2004 09:35:23 -0000	1.73
  @@ -1,6 +1,6 @@
   /*
   
  -   Copyright 2000-2003  The Apache Software Foundation 
  +   Copyright 2000-2004  The Apache Software Foundation 
   
      Licensed under the Apache License, Version 2.0 (the "License");
      you may not use this file except in compliance with the License.
  @@ -453,6 +453,7 @@
       String SVG_LANG_ATTRIBUTE = "lang";
       String SVG_LENGTH_ADJUST_ATTRIBUTE = "lengthAdjust";
       String SVG_LIGHT_COLOR_ATTRIBUTE = "lightColor";
  +    String SVG_LIGHTING_COLOR_ATTRIBUTE = "lighting-color";
       String SVG_LIMITING_CONE_ANGLE_ATTRIBUTE = "limitingConeAngle";
       String SVG_LOCAL_ATTRIBUTE = "local";
       String SVG_MARKER_HEIGHT_ATTRIBUTE = "markerHeight";
  @@ -637,6 +638,7 @@
       String SVG_MAGNIFY_VALUE = "magnify";
       String SVG_MATRIX_VALUE = "matrix";
       String SVG_MEDIAL_VALUE = "medial";
  +    String SVG_MEET_VALUE = "meet";
       String SVG_MIDDLE_VALUE = "middle";
       String SVG_MITER_VALUE = "miter";
       String SVG_MOVE_VALUE = "move";
  @@ -673,6 +675,7 @@
       String SVG_SATURATION_VALUE = "saturation";
       String SVG_SCREEN_VALUE = "screen";
       String SVG_SE_RESIZE_VALUE = "se-resize";
  +    String SVG_SLICE_VALUE = "slice";
       String SVG_SOURCE_ALPHA_VALUE = "SourceAlpha";
       String SVG_SOURCE_GRAPHIC_VALUE = "SourceGraphic";
       String SVG_SPACING_AND_GLYPHS_VALUE = "spacingAndGlyphs";
  @@ -697,6 +700,15 @@
       String SVG_WAIT_VALUE = "wait";
       String SVG_WRAP_VALUE = "wrap";
       String SVG_W_RESIZE_VALUE = "w-resize";
  +    String SVG_XMAXYMAX_VALUE = "xMaxYMax";
  +    String SVG_XMAXYMID_VALUE = "xMaxYMid";
  +    String SVG_XMAXYMIN_VALUE = "xMaxYMin";
  +    String SVG_XMIDYMAX_VALUE = "xMidYMax";
  +    String SVG_XMIDYMID_VALUE = "xMidYMid";
  +    String SVG_XMIDYMIN_VALUE = "xMidYMin";
  +    String SVG_XMINYMAX_VALUE = "xMinYMax";
  +    String SVG_XMINYMID_VALUE = "xMinYMid";
  +    String SVG_XMINYMIN_VALUE = "xMinYMin";
       String SVG_XOR_VALUE = "xor";
       String SVG_ZERO_PERCENT_VALUE = "0%";
       String SVG_ZERO_VALUE = "0";
  
  
  
  1.7       +2 -1      xml-batik/test-resources/org/apache/batik/dom/svg/unitTesting.xml
  
  Index: unitTesting.xml
  ===================================================================
  RCS file: /home/cvs/xml-batik/test-resources/org/apache/batik/dom/svg/unitTesting.xml,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- unitTesting.xml	8 Aug 2003 11:39:45 -0000	1.6
  +++ unitTesting.xml	1 Sep 2004 09:35:24 -0000	1.7
  @@ -80,6 +80,7 @@
       <!-- ================================================================ -->
       <testGroup id="dom.svg.basic" name="Basic SVG DOM Testing"
                  class="org.apache.batik.dom.svg.EcmaScriptSVGDOMTest">
  +        <test id="bug30580"/>
           <test id="lengthTest"/>
           <test id="locatableTest"/>
           <test id="presentationAttrRemovalTest"/>
  
  
  
  1.1                  xml-batik/test-resources/org/apache/batik/dom/svg/bug30580.svg
  
  Index: bug30580.svg
  ===================================================================
  <?xml version="1.0" standalone="no"?>
  <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
  "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
  
  
  <svg xmlns="http://www.w3.org/2000/svg" 
       xmlns:xlink="http://www.w3.org/1999/xlink" 
       xmlns:test="http://xml.apache.org/batik/test"
       width="450" height="500" viewBox="0 0 450 500"
       onload="runTest(evt)">
  
    <test:testResult id="testResult" />
  
    <script type="text/ecmascript"><![CDATA[
       var testNS = "http://xml.apache.org/batik/test";
  
       function runTest() {
           var result = document.getElementById("testResult");
           result.setAttributeNS(null, "result", "failed");
          
           var img1 = document.getElementById("testImage");
           if (img1 == null){
            result.setAttributeNS(null, "errorCode", "cannot.find.test.element");
            var entry = document.createElementNS(testNS, "errorDescriptionEntry");
            entry.setAttributeNS(null, "id", "missing.element.id");
            entry.setAttributeNS(null, "value", "img1");
            result.appendChild(entry);
            return;
           }
  
           var attr1 = img1.getAttributeNodeNS(null,"preserveAspectRatio");
           if (attr1.value != "xMidYMid meet") {
             result.setAttributeNS(null, "errorCode", "wrong.attribute");
             var entry = document.createElementNS(testNS, "errorDescriptionEntry");
             entry.setAttributeNS(null, "value", "invalid.value");
             entry.setAttributeNS(null, "value", attr1.value);
             result.appendChild(entry);
             return;
           }
  
  	 ///////////////////////////////////////////////
  	 // test using standard dom setValue interface
  	 attr1.value = "xMaxYMax slice";
  	 	 
           if (img1.preserveAspectRatio.baseVal.align != 10 && img1.preserveAspectRatio.baseVal.meetOrSlice != 2) {
             result.setAttributeNS(null, "errorCode", "wrong.attribute");
             var entry = document.createElementNS(testNS, "errorDescriptionEntry");
             entry.setAttributeNS(null, "value", "invalid.value");
             entry.setAttributeNS(null, "value", attr1.value);
             result.appendChild(entry);
             return;
           }
  
  	 /////////////////////////////////////////////////
  	 // test using new preserveAspectRatio interface
  	 img1.preserveAspectRatio.baseVal.align = 2;
  	 img1.preserveAspectRatio.baseVal.meetOrSlice = 1;
  	 	 
           if (img1.preserveAspectRatio.baseVal.align != 2 && img1.preserveAspectRatio.baseVal.meetOrSlice != 1) {
             result.setAttributeNS(null, "errorCode", "wrong.attribute");
             var entry = document.createElementNS(testNS, "errorDescriptionEntry");
             entry.setAttributeNS(null, "value", "invalid.value");
             entry.setAttributeNS(null, "value", img1.preserveAspectRatio.baseVal.align + " " +  img1.preserveAspectRatio.baseVal.meetOrSlice);
             result.appendChild(entry);
             return;
           }
  	 
  	 if (attr1.value != "xMinYMin meet") {
             result.setAttributeNS(null, "errorCode", "wrong.attribute");
             var entry = document.createElementNS(testNS, "errorDescriptionEntry");
             entry.setAttributeNS(null, "value", "invalid.value");
             entry.setAttributeNS(null, "value", attr1.value);
             result.appendChild(entry);
             return;
           }
  	 
           result.setAttributeNS(null, "result", "passed");
  	 
       }
    ]]></script>
  
    <image id="testImage" x="10" y="10" width="256" height="256" xlink:href="bug30580_image.png" preserveAspectRatio="xMidYMid meet" />
  </svg>
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org


Mime
View raw message