You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-commits@xmlgraphics.apache.org by de...@apache.org on 2006/03/23 11:48:16 UTC

svn commit: r388134 - in /xmlgraphics/batik/trunk: samples/tests/spec/scripting/ sources/org/apache/batik/bridge/ sources/org/apache/batik/bridge/svg12/ sources/org/apache/batik/css/dom/ sources/org/apache/batik/ext/awt/ sources/org/apache/batik/extens...

Author: deweese
Date: Thu Mar 23 02:47:49 2006
New Revision: 388134

URL: http://svn.apache.org/viewcvs?rev=388134&view=rev
Log:
1) 38990 - Fallthrough in CSSOMSVGColor fixed (Thanks Dieter)
    a) Most string concatenation uses are replaced with stringbuffer
    b) Added basic test of SVGColor interface.
2) Gradient Scaleback is now 0.999 rather than 0.97.
3) Major refactor of text in prep for removing TEXT_COMPOUND_DELIMITER,
   in static builds of GVT tree.
    a) Font derivation is now done in the Text Bridge.
       Needed since deriving an SVG font needs the element reference.
    b) FontFamilies are no longer attributed on string.
    c) Null TextPainterInfo (TPI) are now created/added in
       buildAttributedString (faster/cleaner).
    d) getElementStart/EndIndex now uses new fields in TPI so they
       are faster/simpler and don't rely on TEXT_COMPOUND_DELIMITER.
    e) getParentTextPaintInfo uses elemTPI and getParentNode
       to get parent TPI rather than complex/slow TEXT_COMPOUND_DELIMITER.


Added:
    xmlgraphics/batik/trunk/samples/tests/spec/scripting/domSVGcolor.svg
      - copied unchanged from r388007, xmlgraphics/batik/branches/svg11/samples/tests/spec/scripting/domSVGcolor.svg
    xmlgraphics/batik/trunk/test-references/samples/tests/spec/scripting/domSVGColor.png
      - copied unchanged from r388007, xmlgraphics/batik/branches/svg11/test-references/samples/tests/spec/scripting/domSVGColor.png
Modified:
    xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGSVGElementBridge.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGTextElementBridge.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/SVGFlowRootElementBridge.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/css/dom/CSSOMSVGColor.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/RadialGradientPaintContext.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/extension/svg/BatikFlowTextElementBridge.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/font/FontFamilyResolver.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/renderer/StrokingTextPainter.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/text/GVTAttributedCharacterIterator.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/text/GlyphLayout.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/text/TextPaintInfo.java
    xmlgraphics/batik/trunk/test-references/samples/tests/spec/paints/radialGradient.png
    xmlgraphics/batik/trunk/test-references/samples/tests/spec/paints/radialGradient2.png
    xmlgraphics/batik/trunk/test-references/samples/tests/spec/paints/radialGradient3.png
    xmlgraphics/batik/trunk/test-references/samples/tests/spec/paints/radialGradientOrientation.png
    xmlgraphics/batik/trunk/test-resources/org/apache/batik/test/samplesRendering.xml

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGSVGElementBridge.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGSVGElementBridge.java?rev=388134&r1=388133&r2=388134&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGSVGElementBridge.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGSVGElementBridge.java Thu Mar 23 02:47:49 2006
@@ -430,10 +430,6 @@
         }
     }
 
-    public static final 
-        AttributedCharacterIterator.Attribute TEXT_COMPOUND_DELIMITER 
-        = GVTAttributedCharacterIterator.TextAttribute.TEXT_COMPOUND_DELIMITER;
-
     public List getIntersectionList(SVGRect svgRect, Element end) {
         List ret = new ArrayList();
         Rectangle2D rect = new Rectangle2D.Float(svgRect.getX(),

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGTextElementBridge.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGTextElementBridge.java?rev=388134&r1=388133&r2=388134&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGTextElementBridge.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGTextElementBridge.java Thu Mar 23 02:47:49 2006
@@ -53,9 +53,12 @@
 import org.apache.batik.dom.util.XMLSupport;
 import org.apache.batik.gvt.GraphicsNode;
 import org.apache.batik.gvt.TextNode;
+import org.apache.batik.gvt.font.FontFamilyResolver;
+import org.apache.batik.gvt.font.GVTFont;
 import org.apache.batik.gvt.font.GVTFontFamily;
 import org.apache.batik.gvt.font.GVTGlyphMetrics;
 import org.apache.batik.gvt.font.GVTGlyphVector;
+import org.apache.batik.gvt.font.UnresolvedFontFamily;
 import org.apache.batik.gvt.renderer.StrokingTextPainter;
 import org.apache.batik.gvt.text.GVTAttributedCharacterIterator;
 import org.apache.batik.gvt.text.Mark;
@@ -96,6 +99,25 @@
         AttributedCharacterIterator.Attribute ALT_GLYPH_HANDLER =
         GVTAttributedCharacterIterator.TextAttribute.ALT_GLYPH_HANDLER;
         
+    public static final 
+        AttributedCharacterIterator.Attribute GVT_FONT_FAMILIES 
+        = GVTAttributedCharacterIterator.TextAttribute.GVT_FONT_FAMILIES;
+
+    public static final 
+        AttributedCharacterIterator.Attribute TEXTPATH
+        = GVTAttributedCharacterIterator.TextAttribute.TEXTPATH;
+
+    public static final 
+        AttributedCharacterIterator.Attribute ANCHOR_TYPE
+        = GVTAttributedCharacterIterator.TextAttribute.ANCHOR_TYPE;
+
+    public static final 
+        AttributedCharacterIterator.Attribute GVT_FONTS
+        = GVTAttributedCharacterIterator.TextAttribute.GVT_FONTS;
+
+    public static final 
+        AttributedCharacterIterator.Attribute BASELINE_SHIFT
+        = GVTAttributedCharacterIterator.TextAttribute.BASELINE_SHIFT;
 
     protected AttributedString laidoutText;
 
@@ -545,6 +567,8 @@
                                       Element e,
                                       GraphicsNode node) {
         TextNode tn = (TextNode)node;
+        elemTPI.clear();
+
         AttributedString as = buildAttributedString(ctx, e);
         if (as == null) {
             tn.setAttributedCharacterIterator(null);
@@ -555,10 +579,6 @@
         if (ctx.isDynamic()) {
             laidoutText = new AttributedString(as.getIterator());
         }
-        elemTPI.clear();
-        // Add null TPI objects to the text (after we set it on the
-        // Text we will swap in the correct values.
-        addNullPaintAttributes(as, e, ctx);
 
         // Install the ACI in the text node.
         tn.setAttributedCharacterIterator(as.getIterator());
@@ -584,56 +604,6 @@
     }
 
     /**
-     * This creates 'dummy' TPI objects for each element and records
-     * them in the elemTPI map so we can later update them with 
-     * the correct paint attributes.
-     */
-    protected void addNullPaintAttributes(AttributedString as, 
-                                          Element element,
-                                          BridgeContext ctx) {
-        // 'requiredFeatures', 'requiredExtensions' and 'systemLanguage'
-        if ((!SVGUtilities.matchUserAgent(element, ctx.getUserAgent())) ||
-            (!CSSUtilities.convertDisplay(element))) {
-            return;
-        }
-
-        AttributedCharacterIterator aci = as.getIterator();
-
-        // calculate which chars in the string belong to this element
-        int firstChar = getElementStartIndex(aci, element);
-        if (firstChar == -1)
-            return; // Element not part of aci (no chars in elem usually)
-
-        int lastChar = getElementEndIndex(aci, element);
-        TextPaintInfo pi = new TextPaintInfo();
-        // Set some basic props so we can get bounds info for complex paints.
-        pi.visible   = true;        
-        pi.fillPaint = Color.black;
-
-        as.addAttribute(PAINT_INFO, pi, firstChar, lastChar+1);
-        elemTPI.put(element, pi);
-
-        addChildNullPaintAttributes(as, element, ctx);
-    }
-    
-    protected void addChildNullPaintAttributes(AttributedString as,
-                                               Element element,
-                                               BridgeContext ctx) {
-        // Add Paint attributres for children of text element
-        for (Node child = getFirstChild(element);
-             child != null;
-             child = getNextSibling(child)) {
-            if (child.getNodeType() != Node.ELEMENT_NODE) 
-                continue;
-
-            Element childElement = (Element)child;
-            if (isTextChild(childElement)) {
-                addNullPaintAttributes(as, childElement, ctx);
-            }
-        }
-    }
-
-    /**
      * This flag bit indicates if a new ACI has been created in
      * response to a CSSEngineEvent.
      * Avoid creating one ShapePainter per CSS property change
@@ -776,8 +746,7 @@
             //and only update the section of the AtrtibutedString of
             //the child
             TextPaintInfo parentPI;
-            parentPI = getParentTextPaintInfo
-                (tn.getAttributedCharacterIterator(), cssProceedElement);
+            parentPI = getParentTextPaintInfo(cssProceedElement);
             pi = getTextPaintInfo(cssProceedElement, tn, parentPI, ctx);
             oldPI = (TextPaintInfo)elemTPI.get(cssProceedElement);
         }
@@ -790,36 +759,16 @@
                 (tn.getAttributedCharacterIterator());
     }
 
-    int getElementStartIndex
-        (AttributedCharacterIterator aci, Element element) {
-        if (aci == null) return -1;
-
-        // calculate which chars in the string belong to this element
-        for (int i = 0; i < aci.getEndIndex();) {
-            aci.setIndex(i);
-            Element delimeter;
-            delimeter = (Element)aci.getAttribute(TEXT_COMPOUND_DELIMITER);
-            if (delimeter == element || nodeAncestorOf(element, delimeter))
-                return i;
-            i = aci.getRunLimit(TEXT_COMPOUND_DELIMITER);
-        }
-        return -1;  
+    int getElementStartIndex(Element element) {
+        TextPaintInfo tpi = (TextPaintInfo)elemTPI.get(element);
+        if (tpi == null) return -1;
+        return tpi.startChar;
     }
 
-    int getElementEndIndex
-        (AttributedCharacterIterator aci, Element element) {
-        if (aci == null) return -1;
-
-        // calculate which chars in the string belong to this element
-        for (int i = aci.getEndIndex()-1; i >= 0;) {
-            aci.setIndex(i);
-            Element delimeter;
-            delimeter = (Element)aci.getAttribute(TEXT_COMPOUND_DELIMITER);
-            if (delimeter == element || nodeAncestorOf(element, delimeter))
-                return i;
-            i = aci.getRunStart(TEXT_COMPOUND_DELIMITER)-1;
-        }
-        return -1;  
+    int getElementEndIndex(Element element) {
+        TextPaintInfo tpi = (TextPaintInfo)elemTPI.get(element);
+        if (tpi == null) return -1;
+        return tpi.endChar;
     }
 
     // -----------------------------------------------------------------------
@@ -871,6 +820,7 @@
         boolean preserve = s.equals(SVG_PRESERVE_VALUE);
         boolean prevEndsWithSpace;
         Element nodeElement = element;
+        int elementStartChar = asb.length();
 
         if (top)
             endLimit = 0;
@@ -932,9 +882,15 @@
                     s = TextUtilities.getElementContent(ref);
                     s = normalizeString(s, preserve, prevEndsWithSpace);
                     if (s != null) {
+                        int trefStart = asb.length();
                         Map m = getAttributeMap(ctx, nodeElement, 
                                                 textPath, bidiLevel);
                         asb.append(s, m);
+                        int trefEnd = asb.length()-1;
+                        TextPaintInfo tpi;
+                        tpi = (TextPaintInfo)elemTPI.get(nodeElement);
+                        tpi.startChar = trefStart;
+                        tpi.endChar   = trefEnd;
                     }
                 } else if (ln.equals(SVG_A_TAG)) {
                     NodeEventTarget target = (NodeEventTarget)nodeElement;
@@ -966,9 +922,27 @@
         }
 
         if (top) {
-            while ((endLimit < asb.length()) && (asb.getLastChar() == ' '))
+            boolean strippedSome = false;
+            while ((endLimit < asb.length()) && (asb.getLastChar() == ' ')) {
                 asb.stripLast();
+                strippedSome = true;
+            }
+            if (strippedSome) {
+                Iterator iter = elemTPI.values().iterator();
+                while (iter.hasNext()) {
+                    TextPaintInfo tpi = (TextPaintInfo)iter.next();
+                    if (tpi.endChar >= asb.length()) {
+                        tpi.endChar = asb.length()-1;
+                        if (tpi.startChar > tpi.endChar)
+                            tpi.startChar = tpi.endChar;
+                    }
+                }
+            }
         }
+        int elementEndChar = asb.length()-1;
+        TextPaintInfo tpi = (TextPaintInfo)elemTPI.get(element);
+        tpi.startChar = elementStartChar;
+        tpi.endChar   = elementEndChar;
     }
 
     /**
@@ -1238,11 +1212,11 @@
         AttributedCharacterIterator aci = as.getIterator();
 
         // calculate which chars in the string belong to this element
-        int firstChar = getElementStartIndex(aci, element);
+        int firstChar = getElementStartIndex(element);
         // No match so no chars to annotate.
         if (firstChar == -1) return;
 
-        int lastChar = getElementEndIndex(aci, element);
+        int lastChar = getElementEndIndex(element);
 
         // get all of the glyph position attribute values
         String xAtt      = element.getAttributeNS(null, SVG_X_ATTRIBUTE);
@@ -1372,8 +1346,9 @@
             return;
         }
         Object o = elemTPI.get(element);
-        if (o == null) return;
-        node.swapTextPaintInfo(pi, (TextPaintInfo)o);
+        if (o != null) {
+            node.swapTextPaintInfo(pi, (TextPaintInfo)o);
+        }
         addChildPaintAttributes(as, element, node, pi, ctx);
     }
 
@@ -1406,16 +1381,20 @@
         map.put(TEXT_COMPOUND_DELIMITER, element);
 
         // Font size.
-        map.put(TextAttribute.SIZE, TextUtilities.convertFontSize(element));
+        map.put(TextAttribute.SIZE, 
+                TextUtilities.convertFontSize(element));
 
         // Font stretch
-        map.put(TextAttribute.WIDTH, TextUtilities.convertFontStretch(element));
+        map.put(TextAttribute.WIDTH, 
+                TextUtilities.convertFontStretch(element));
 
         // Font weight
-        map.put(TextAttribute.WEIGHT, TextUtilities.convertFontWeight(element));
+        map.put(TextAttribute.WEIGHT, 
+                TextUtilities.convertFontWeight(element));
 
         // Font style
-        map.put(TextAttribute.POSTURE, TextUtilities.convertFontStyle(element));
+        map.put(TextAttribute.POSTURE, 
+                TextUtilities.convertFontStyle(element));
 
         return map;
     }
@@ -1439,30 +1418,53 @@
                        new SVGAltGlyphHandler(ctx, element));
         }
 
+        // Add null TPI objects to the text (after we set it on the
+        // Text we will swap in the correct values.
+        TextPaintInfo pi = new TextPaintInfo();
+        // Set some basic props so we can get bounds info for complex paints.
+        pi.visible   = true;        
+        pi.fillPaint = Color.black;
+        result.put(PAINT_INFO, pi);
+        elemTPI.put(element, pi);
+
         if (textPath != null) {
-            result.put(GVTAttributedCharacterIterator.TextAttribute.TEXTPATH,
-                       textPath);
+            result.put(TEXTPATH, textPath);
         }
 
         // Text-anchor
         TextNode.Anchor a = TextUtilities.convertTextAnchor(element);
-        result.put(GVTAttributedCharacterIterator.TextAttribute.ANCHOR_TYPE,
-                   a);
+        result.put(ANCHOR_TYPE, a);
 
         // get font size/width/weight/posture properties
         getFontProperties(ctx, element, result);
 
         // Font family
         List fontFamilyList = getFontFamilyList(element, ctx);
-        result.put
-            (GVTAttributedCharacterIterator.TextAttribute.GVT_FONT_FAMILIES,
-             fontFamilyList);
+        // result.put(GVT_FONT_FAMILIES, fontFamilyList);
+
+        List fonts = new ArrayList(fontFamilyList.size());
+        Iterator iter = fontFamilyList.iterator();
+        float fontSize = 12;
+        Float fsFloat = (Float)result.get(TextAttribute.SIZE);
+        if (fsFloat != null) {
+            fontSize = fsFloat.floatValue();
+        }
+        while (iter.hasNext()) {
+            GVTFontFamily ff = (GVTFontFamily)iter.next();
+            if (ff instanceof UnresolvedFontFamily) {
+                ff = FontFamilyResolver.resolve((UnresolvedFontFamily)ff);
+            }
+            if (ff == null) continue;
+            GVTFont ft = ff.deriveFont(fontSize, result);
+            fonts.add(ft);
+        }
+        result.put(GVT_FONTS, fonts);
+
 
         // Text baseline adjustment.
         Object bs = TextUtilities.convertBaselineShift(element);
         if (bs != null) {
-            result.put(GVTAttributedCharacterIterator.
-                       TextAttribute.BASELINE_SHIFT, bs);
+            result.put(BASELINE_SHIFT, bs);
         }
 
         // Unicode-bidi mode
@@ -1719,34 +1721,14 @@
      * @param child an <code>Element</code> value
      * @return a <code>TextDecoration</code> value
      */
-    protected TextPaintInfo getParentTextPaintInfo
-        (AttributedCharacterIterator aci, Element child) {
-        if (aci == null)
-            return new TextPaintInfo();
-
-        Element parent = null;
-        // calculate which chars in the string belong to the parent
-        int firstChar = -1;
-        for (int i = 0; i < aci.getEndIndex();) {
-            aci.setIndex(i);
-            Element delimeter;
-            delimeter = (Element)aci.getAttribute(TEXT_COMPOUND_DELIMITER);
-            if (nodeAncestorOf(delimeter,child) &&
-                ((parent == null) || nodeAncestorOf(parent, delimeter))) {
-                parent = delimeter;
-                firstChar = i;
-            }
-            if (delimeter == child || nodeAncestorOf(child, delimeter)) {
-                break;
-            }
-            i = aci.getRunLimit(TEXT_COMPOUND_DELIMITER);
+    protected TextPaintInfo getParentTextPaintInfo(Element child) {
+        Node parent = getParentNode(child);
+        while (parent != null) {
+            TextPaintInfo tpi = (TextPaintInfo)elemTPI.get(parent);
+            if (tpi != null) return tpi;
+            parent = getParentNode(parent);
         }
-
-        if ( parent == null)
-            return new TextPaintInfo(); //no parent
-
-        aci.setIndex(firstChar);
-        return (TextPaintInfo)aci.getAttribute(PAINT_INFO);
+        return null;
     }
 
     /**
@@ -1756,13 +1738,13 @@
      */
     protected TextPaintInfo getTextPaintInfo(Element element,
                                              GraphicsNode node,
-                                             TextPaintInfo parent,
+                                             TextPaintInfo parentTPI,
                                              BridgeContext ctx) {
         // Force the engine to update stuff..
         CSSUtilities.getComputedStyle
             (element, SVGCSSEngine.TEXT_DECORATION_INDEX);
 
-        TextPaintInfo pi = new TextPaintInfo(parent);
+        TextPaintInfo pi = new TextPaintInfo(parentTPI);
 
         // Was text-decoration explicity set on this element?
         StyleMap sm = ((CSSStylableElement)element).getComputedStyleMap(null);
@@ -2230,12 +2212,12 @@
 
         //get the index in the aci for the first character
         //of the element
-        int firstChar = getElementStartIndex(aci,element);
+        int firstChar = getElementStartIndex(element);
 
         if (firstChar == -1)
             return 0; // Element not part of aci (no chars in elem usually)
 
-        int lastChar = getElementEndIndex(aci,element);
+        int lastChar = getElementEndIndex(element);
 
         return( lastChar - firstChar + 1 );
     }
@@ -2251,7 +2233,7 @@
         aci = ((TextNode)node).getAttributedCharacterIterator();
         if (aci == null) return null;
 
-        int firstChar = getElementStartIndex(aci,element);
+        int firstChar = getElementStartIndex(element);
 
         if ( firstChar == -1 )
             return null;
@@ -2309,7 +2291,7 @@
         if (aci == null) 
             return null;
 
-        int firstChar = getElementStartIndex(aci,element);
+        int firstChar = getElementStartIndex(element);
         if ( firstChar == -1 )
             return null;
 
@@ -2360,7 +2342,7 @@
         if (aci == null)
             return null;
 
-        int firstChar = getElementStartIndex(aci,element);
+        int firstChar = getElementStartIndex(element);
         if ( firstChar == -1 )
             return null;
 
@@ -2413,7 +2395,7 @@
             return 0;
 
         //first the first character for the element
-        int firstChar = getElementStartIndex(aci,element);
+        int firstChar = getElementStartIndex(element);
         if ( firstChar == -1 )
             return 0;
 
@@ -2494,7 +2476,7 @@
             return -1;
 
         TextNode textNode = (TextNode)node;
-        int firstChar = getElementStartIndex(aci,element);
+        int firstChar = getElementStartIndex(element);
 
         if ( firstChar == -1 )
             return -1;
@@ -2630,14 +2612,14 @@
             return;
 
         TextNode textNode = (TextNode)node;
-        int firstChar = getElementStartIndex(aci,element);
+        int firstChar = getElementStartIndex(element);
 
         if ( firstChar == -1 )
             return;
 
         List list = getTextRuns(textNode);
 
-        int lastChar = getElementEndIndex(aci,element);
+        int lastChar = getElementEndIndex(element);
 
         CharacterInformation firstInfo, lastInfo;
         firstInfo = getCharacterInformation(list, firstChar,charnum,aci);
@@ -2682,8 +2664,8 @@
 
 
         //found an hit, check if it belong to the element
-        int first = getElementStartIndex( aci, e );
-        int last  = getElementEndIndex( aci, e );
+        int first = getElementStartIndex( e );
+        int last  = getElementEndIndex( e );
 
         int hitIndex = hit.getCharIndex();
 

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/SVGFlowRootElementBridge.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/SVGFlowRootElementBridge.java?rev=388134&r1=388133&r2=388134&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/SVGFlowRootElementBridge.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/SVGFlowRootElementBridge.java Thu Mar 23 02:47:49 2006
@@ -18,6 +18,7 @@
 
 package org.apache.batik.bridge.svg12;
 
+import java.awt.Color;
 import java.awt.RenderingHints;
 import java.awt.Shape;
 import java.awt.font.TextAttribute;
@@ -69,6 +70,7 @@
 import org.apache.batik.gvt.flow.TextLineBreaks;
 
 import org.apache.batik.gvt.text.GVTAttributedCharacterIterator;
+import org.apache.batik.gvt.text.TextPaintInfo;
 import org.apache.batik.gvt.text.TextPath;
 
 import org.apache.batik.util.SVGConstants;
@@ -427,6 +429,12 @@
 
     protected AttributedString gatherFlowPara
         (BridgeContext ctx, Element div) {
+        TextPaintInfo divTPI = new TextPaintInfo();
+        // Set some basic props so we can get bounds info for complex paints.
+        divTPI.visible   = true;        
+        divTPI.fillPaint = Color.black;
+        elemTPI.put(div, divTPI);
+
         AttributedStringBuffer asb = new AttributedStringBuffer();
         List paraEnds  = new ArrayList();
         List paraElems = new ArrayList();
@@ -450,6 +458,8 @@
                 paraEnds.add(new Integer(asb.length()));
             }
         }
+        divTPI.startChar = 0;
+        divTPI.endChar   = asb.length()-1;
 
         // Layer in the PARAGRAPH/LINE_BREAK Attributes so we can
         // break up text chunks.
@@ -570,6 +580,7 @@
         boolean preserve = s.equals(SVG_PRESERVE_VALUE);
         boolean prevEndsWithSpace;
         Element nodeElement = element;
+        int elementStartChar = asb.length();
 
         if (top)
             endLimit = startLen = asb.length();
@@ -663,9 +674,15 @@
                     s = TextUtilities.getElementContent(ref);
                     s = normalizeString(s, preserve, prevEndsWithSpace);
                     if (s != null) {
+                        int trefStart = asb.length();
                         Map m = getAttributeMap(ctx, nodeElement, null, 
                                                 bidiLevel);
                         asb.append(s, m);
+                        int trefEnd = asb.length()-1;
+                        TextPaintInfo tpi;
+                        tpi = (TextPaintInfo)elemTPI.get(nodeElement);
+                        tpi.startChar = trefStart;
+                        tpi.endChar   = trefEnd;
                     }
                 }
                 break;
@@ -681,6 +698,7 @@
         }
 
         if (top) {
+            boolean strippedSome = false;
             while ((endLimit < asb.length()) && (asb.getLastChar() == ' ')) {
                 int idx = lnLocs.size()-1;
                 int len = asb.length();
@@ -700,8 +718,25 @@
                     }
                 }
                 asb.stripLast();
+                strippedSome = true;
+            }
+            if (strippedSome) {
+                Iterator iter = elemTPI.values().iterator();
+                while (iter.hasNext()) {
+                    TextPaintInfo tpi = (TextPaintInfo)iter.next();
+                    if (tpi.endChar >= asb.length()) {
+                        tpi.endChar = asb.length()-1;
+                        if (tpi.startChar > tpi.endChar)
+                            tpi.startChar = tpi.endChar;
+                    }
+                }
             }
         }
+
+        int elementEndChar = asb.length()-1;
+        TextPaintInfo tpi = (TextPaintInfo)elemTPI.get(element);
+        tpi.startChar = elementStartChar;
+        tpi.endChar   = elementEndChar;
     }
 
     /**

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/css/dom/CSSOMSVGColor.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/css/dom/CSSOMSVGColor.java?rev=388134&r1=388133&r2=388134&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/css/dom/CSSOMSVGColor.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/css/dom/CSSOMSVGColor.java Thu Mar 23 02:47:49 2006
@@ -634,27 +634,30 @@
          * Called when the red value text has changed.
          */
         public void redTextChanged(String text) throws DOMException {
+            StringBuffer sb = new StringBuffer(40);
             switch (getColorType()) {
             case SVG_COLORTYPE_RGBCOLOR:
-                text = "rgb(" +
-                    text + ", " +
-                    getValue().getGreen().getCssText() + ", " +
-                    getValue().getBlue().getCssText() + ")";
+                sb.append("rgb(");
+                sb.append(text); sb.append(',');
+                sb.append(getValue().getGreen().getCssText()); sb.append(',');
+                sb.append(getValue().getBlue().getCssText()); sb.append(')');
                 break;
 
             case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR:
-                text = "rgb(" +
-                    text + ", " +
-                    getValue().item(0).getGreen().getCssText() + ", " +
-                    getValue().item(0).getBlue().getCssText() + ") " +
-                    getValue().item(1).getCssText();
+                sb.append("rgb(");
+                sb.append(text); sb.append(',');
+                sb.append(getValue().item(0).getGreen().getCssText()); 
+                sb.append(',');
+                sb.append(getValue().item(0).getBlue().getCssText()); 
+                sb.append(')');
+                sb.append(getValue().item(1).getCssText());
                 break;
-
+            
             default:
                 throw new DOMException
                     (DOMException.NO_MODIFICATION_ALLOWED_ERR, "");
             }
-            textChanged(text);
+            textChanged(sb.toString());
         }
 
         /**
@@ -662,55 +665,62 @@
          */
         public void redFloatValueChanged(short unit, float value)
             throws DOMException {
-            String text;
+            StringBuffer sb = new StringBuffer(40);
             switch (getColorType()) {
             case SVG_COLORTYPE_RGBCOLOR:
-                text = "rgb(" +
-                    FloatValue.getCssText(unit, value) + ", " +
-                    getValue().getGreen().getCssText() + ", " +
-                    getValue().getBlue().getCssText() + ")";
+                sb.append("rgb(");
+                sb.append(FloatValue.getCssText(unit, value)); sb.append(',');
+                sb.append(getValue().getGreen().getCssText()); sb.append(',');
+                sb.append(getValue().getBlue().getCssText()); sb.append(')');
                 break;
 
             case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR:
-                text = "rgb(" +
-                    FloatValue.getCssText(unit, value) + ", " +
-                    getValue().item(0).getGreen().getCssText() + ", " +
-                    getValue().item(0).getBlue().getCssText() + ") " +
-                    getValue().item(1).getCssText();
+                sb.append("rgb(");
+                sb.append(FloatValue.getCssText(unit, value)); 
+                sb.append(',');
+                sb.append(getValue().item(0).getGreen().getCssText()); 
+                sb.append(',');
+                sb.append(getValue().item(0).getBlue().getCssText()); 
+                sb.append(')');
+                sb.append(getValue().item(1).getCssText());
                 break;
 
             default:
                 throw new DOMException
                     (DOMException.NO_MODIFICATION_ALLOWED_ERR, "");
             }
-            textChanged(text);
+            textChanged(sb.toString());
         }
 
         /**
          * Called when the green value text has changed.
          */
         public void greenTextChanged(String text) throws DOMException {
+            StringBuffer sb = new StringBuffer(40);
             switch (getColorType()) {
             case SVG_COLORTYPE_RGBCOLOR:
-                text = "rgb(" +
-                    getValue().getRed().getCssText() + ", " +
-                    text + ", " +
-                    getValue().getBlue().getCssText() + ")";
+                sb.append("rgb(");
+                sb.append(getValue().getRed().getCssText()); sb.append(',');
+                sb.append(text); sb.append(',');
+                sb.append(getValue().getBlue().getCssText()); sb.append(')');
                 break;
 
             case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR:
-                text = "rgb(" +
-                    getValue().item(0).getRed().getCssText() + ", " +
-                    text + ", " +
-                    getValue().item(0).getBlue().getCssText() + ") " +
-                    getValue().item(1).getCssText();
+                sb.append("rgb(");
+                sb.append(getValue().item(0).getRed().getCssText()); 
+                sb.append(',');
+                sb.append(text); 
+                sb.append(',');
+                sb.append(getValue().item(0).getBlue().getCssText()); 
+                sb.append(')');
+                sb.append(getValue().item(1).getCssText());
                 break;
 
             default:
                 throw new DOMException
                     (DOMException.NO_MODIFICATION_ALLOWED_ERR, "");
             }
-            textChanged(text);
+            textChanged(sb.toString());
         }
 
         /**
@@ -718,54 +728,62 @@
          */
         public void greenFloatValueChanged(short unit, float value)
             throws DOMException {
-            String text;
+            StringBuffer sb = new StringBuffer(40);
             switch (getColorType()) {
             case SVG_COLORTYPE_RGBCOLOR:
-                text = "rgb(" +
-                    getValue().getRed().getCssText() + ", " +
-                    FloatValue.getCssText(unit, value) + ", " +
-                    getValue().getBlue().getCssText() + ")";
+                sb.append("rgb(");
+                sb.append(getValue().getRed().getCssText()); sb.append(',');
+                sb.append(FloatValue.getCssText(unit, value)); sb.append(',');
+                sb.append(getValue().getBlue().getCssText()); sb.append(')');
                 break;
 
             case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR:
-                text = "rgb(" +
-                    getValue().item(0).getRed().getCssText() + ", " +
-                    FloatValue.getCssText(unit, value) + ", " +
-                    getValue().item(0).getBlue().getCssText() + ") " +
-                    getValue().item(1).getCssText();
+                sb.append("rgb(");
+                sb.append(getValue().item(0).getRed().getCssText()); 
+                sb.append(',');
+                sb.append(FloatValue.getCssText(unit, value)); 
+                sb.append(',');
+                sb.append(getValue().item(0).getBlue().getCssText()); 
+                sb.append(')');
+                sb.append(getValue().item(1).getCssText());
                 break;
 
             default:
                 throw new DOMException
                     (DOMException.NO_MODIFICATION_ALLOWED_ERR, "");
             }
-            textChanged(text);
+            textChanged(sb.toString());
         }
 
         /**
          * Called when the blue value text has changed.
          */
         public void blueTextChanged(String text) throws DOMException {
+            StringBuffer sb = new StringBuffer(40);
             switch (getColorType()) {
             case SVG_COLORTYPE_RGBCOLOR:
-                text = "rgb(" +
-                    getValue().getRed().getCssText() + ", " +
-                    getValue().getGreen().getCssText() + ", " +
-                    text + ")";
+                sb.append("rgb(");
+                sb.append(getValue().getRed().getCssText()); sb.append(',');
+                sb.append(getValue().getGreen().getCssText()); sb.append(',');
+                sb.append(text); sb.append(')');
                 break;
 
             case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR:
-                text = "rgb(" +
-                    getValue().item(0).getRed().getCssText() + ", " +
-                    getValue().item(0).getGreen().getCssText() + ", " +
-                    text + ") " +
-                    getValue().item(1).getCssText();
+                sb.append("rgb(");
+                sb.append(getValue().item(0).getRed().getCssText()); 
+                sb.append(',');
+                sb.append(getValue().item(0).getGreen().getCssText()); 
+                sb.append(',');
+                sb.append(text); 
+                sb.append(')');
+                sb.append(getValue().item(1).getCssText());
+                break;
 
             default:
                 throw new DOMException
                     (DOMException.NO_MODIFICATION_ALLOWED_ERR, "");
             }
-            textChanged(text);
+            textChanged(sb.toString());
         }
 
         /**
@@ -773,28 +791,31 @@
          */
         public void blueFloatValueChanged(short unit, float value)
             throws DOMException {
-            String text;
+            StringBuffer sb = new StringBuffer(40);
             switch (getColorType()) {
             case SVG_COLORTYPE_RGBCOLOR:
-                text = "rgb(" +
-                    getValue().getRed().getCssText() + ", " +
-                    getValue().getGreen().getCssText() + ", " +
-                    FloatValue.getCssText(unit, value) + ")";
+                sb.append("rgb(");
+                sb.append(getValue().getRed().getCssText()); sb.append(',');
+                sb.append(getValue().getGreen().getCssText()); sb.append(',');
+                sb.append(FloatValue.getCssText(unit, value)); sb.append(')');
                 break;
 
             case SVG_COLORTYPE_RGBCOLOR_ICCCOLOR:
-                text = "rgb(" +
-                    getValue().item(0).getRed().getCssText() + ", " +
-                    getValue().item(0).getGreen().getCssText() + ", " +
-                    FloatValue.getCssText(unit, value) + ") " +
-                    getValue().item(1).getCssText();
+                sb.append("rgb(");
+                sb.append(getValue().item(0).getRed().getCssText()); 
+                sb.append(',');
+                sb.append(getValue().item(0).getGreen().getCssText()); 
+                sb.append(',');
+                sb.append(FloatValue.getCssText(unit, value)); 
+                sb.append(')');
+                sb.append(getValue().item(1).getCssText());
                 break;
 
             default:
                 throw new DOMException
                     (DOMException.NO_MODIFICATION_ALLOWED_ERR, "");
             }
-            textChanged(text);
+            textChanged(sb.toString());
         }
         
         /**
@@ -867,10 +888,10 @@
                 sb.append(cp);
                 ICCColor iccc = (ICCColor)getValue().item(1);
                 for (int i = 0; i < iccc.getLength(); i++) {
-                    sb.append(",");
+                    sb.append(',');
                     sb.append(iccc.getColor(i));
                 }
-                sb.append(")");
+                sb.append(')');
                 textChanged(sb.toString());
                 break;
 
@@ -891,7 +912,7 @@
                 sb.append(" icc-color(");
                 ICCColor iccc = (ICCColor)getValue().item(1);
                 sb.append(iccc.getColorProfile());
-                sb.append(")");
+                sb.append(')');
                 textChanged(sb.toString());
                 break;
 
@@ -912,9 +933,9 @@
                 sb.append(" icc-color(");
                 ICCColor iccc = (ICCColor)getValue().item(1);
                 sb.append(iccc.getColorProfile());
-                sb.append(",");
+                sb.append(',');
                 sb.append(f);
-                sb.append(")");
+                sb.append(')');
                 textChanged(sb.toString());
                 break;
 
@@ -936,16 +957,16 @@
                 ICCColor iccc = (ICCColor)getValue().item(1);
                 sb.append(iccc.getColorProfile());
                 for (int i = 0; i < idx; i++) {
-                    sb.append(",");
+                    sb.append(',');
                     sb.append(iccc.getColor(i));
                 }
-                sb.append(",");
+                sb.append(',');
                 sb.append(f);
                 for (int i = idx; i < iccc.getLength(); i++) {
-                    sb.append(",");
+                    sb.append(',');
                     sb.append(iccc.getColor(i));
                 }
-                sb.append(")");
+                sb.append(')');
                 textChanged(sb.toString());
                 break;
 
@@ -967,16 +988,16 @@
                 ICCColor iccc = (ICCColor)getValue().item(1);
                 sb.append(iccc.getColorProfile());
                 for (int i = 0; i < idx; i++) {
-                    sb.append(",");
+                    sb.append(',');
                     sb.append(iccc.getColor(i));
                 }
-                sb.append(",");
+                sb.append(',');
                 sb.append(f);
                 for (int i = idx + 1; i < iccc.getLength(); i++) {
-                    sb.append(",");
+                    sb.append(',');
                     sb.append(iccc.getColor(i));
                 }
-                sb.append(")");
+                sb.append(')');
                 textChanged(sb.toString());
                 break;
 
@@ -998,14 +1019,14 @@
                 ICCColor iccc = (ICCColor)getValue().item(1);
                 sb.append(iccc.getColorProfile());
                 for (int i = 0; i < idx; i++) {
-                    sb.append(",");
+                    sb.append(',');
                     sb.append(iccc.getColor(i));
                 }
                 for (int i = idx + 1; i < iccc.getLength(); i++) {
-                    sb.append(",");
+                    sb.append(',');
                     sb.append(iccc.getColor(i));
                 }
-                sb.append(")");
+                sb.append(')');
                 textChanged(sb.toString());
                 break;
 
@@ -1027,12 +1048,12 @@
                 ICCColor iccc = (ICCColor)getValue().item(1);
                 sb.append(iccc.getColorProfile());
                 for (int i = 0; i < iccc.getLength(); i++) {
-                    sb.append(",");
+                    sb.append(',');
                     sb.append(iccc.getColor(i));
                 }
-                sb.append(",");
+                sb.append(',');
                 sb.append(f);
-                sb.append(")");
+                sb.append(')');
                 textChanged(sb.toString());
                 break;
 

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/RadialGradientPaintContext.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/RadialGradientPaintContext.java?rev=388134&r1=388133&r2=388134&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/RadialGradientPaintContext.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/RadialGradientPaintContext.java Thu Mar 23 02:47:49 2006
@@ -69,7 +69,7 @@
     private int fillMethod;
     
     /** Amount for offset when clamping focus. */
-    private static final float SCALEBACK = .97f;
+    private static final float SCALEBACK = .999f;
     
     /** 
      * Constructor for RadialGradientPaintContext.

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/extension/svg/BatikFlowTextElementBridge.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/extension/svg/BatikFlowTextElementBridge.java?rev=388134&r1=388133&r2=388134&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/extension/svg/BatikFlowTextElementBridge.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/extension/svg/BatikFlowTextElementBridge.java Thu Mar 23 02:47:49 2006
@@ -18,6 +18,7 @@
 
 package org.apache.batik.extension.svg;
 
+import java.awt.Color;
 import java.awt.font.TextAttribute;
 import java.awt.geom.Point2D;
 import java.text.AttributedCharacterIterator;
@@ -205,63 +206,6 @@
         }
     }
 
-    protected void addNullPaintAttributes(AttributedString as, 
-                                          Element element,
-                                          BridgeContext ctx) {
-        if (element.getNodeType() != Node.ELEMENT_NODE) return;
-        String eNS = element.getNamespaceURI();
-        if ((!eNS.equals(getNamespaceURI())) &&
-            (!eNS.equals(SVG_NAMESPACE_URI)))
-            return;
-        if (element.getLocalName()    != BATIK_EXT_FLOW_TEXT_TAG) {
-            // System.out.println("Elem: " + element);
-            super.addNullPaintAttributes(as, element, ctx);
-            return;
-        }
-
-        for (Node n = element.getFirstChild();
-             n != null; n = n.getNextSibling()) {
-            if (n.getNodeType()     != Node.ELEMENT_NODE) continue;
-            if (!getNamespaceURI().equals(n.getNamespaceURI())) continue;
-            Element e = (Element)n;
-            String ln = e.getLocalName();
-            if (ln.equals(BATIK_EXT_FLOW_DIV_TAG)) {
-                // System.out.println("D Elem: " + e);
-                super.addNullPaintAttributes(as, e, ctx);
-                return;
-            }
-        }
-    }
-
-
-    protected void addChildNullPaintAttributes(AttributedString as,
-                                               Element element,
-                                               BridgeContext ctx) {
-        // Add Paint attributres for children of text element
-        for (Node child = element.getFirstChild();
-             child != null;
-             child = child.getNextSibling()) {
-            if (child.getNodeType() != Node.ELEMENT_NODE) {
-                continue;
-            }
-            String cNS = child.getNamespaceURI();
-            if ((!getNamespaceURI().equals(cNS)) &&
-                (!SVG_NAMESPACE_URI.equals(cNS))) {
-                continue;
-            }
-            String ln = child.getLocalName();
-            if (ln.equals(BATIK_EXT_FLOW_PARA_TAG) ||
-                ln.equals(BATIK_EXT_FLOW_REGION_BREAK_TAG) ||
-                ln.equals(BATIK_EXT_FLOW_LINE_TAG) ||
-                ln.equals(BATIK_EXT_FLOW_SPAN_TAG) ||
-                ln.equals(SVG_A_TAG) ||
-                ln.equals(SVG_TREF_TAG)) {
-                Element childElement = (Element)child;
-                addNullPaintAttributes(as, childElement, ctx);
-            }
-        }
-    }
-
     /**
      * Adds painting attributes to an AttributedString.
      */
@@ -345,6 +289,12 @@
 
     protected AttributedString gatherFlowPara
         (BridgeContext ctx, Element div) {
+        TextPaintInfo divTPI = new TextPaintInfo();
+        // Set some basic props so we can get bounds info for complex paints.
+        divTPI.visible   = true;        
+        divTPI.fillPaint = Color.black;
+        elemTPI.put(div, divTPI);
+
         AttributedStringBuffer asb = new AttributedStringBuffer();
         List paraEnds  = new ArrayList();
         List paraElems = new ArrayList();
@@ -368,6 +318,8 @@
                 paraEnds.add(new Integer(asb.length()));
             }
         }
+        divTPI.startChar = 0;
+        divTPI.endChar   = asb.length()-1;
 
         // Layer in the PARAGRAPH/LINE_BREAK Attributes so we can
         // break up text chunks.
@@ -546,17 +498,18 @@
         boolean preserve = s.equals(SVG_PRESERVE_VALUE);
         boolean prevEndsWithSpace;
         Element nodeElement = element;
+        int elementStartChar = asb.length();
 
         if (top)
             endLimit = 0;
         if (preserve)
             endLimit = asb.length();
         
-	Map map = getAttributeMap(ctx, element, null, bidiLevel);
-	Object o = map.get(TextAttribute.BIDI_EMBEDDING);
+        Map map = getAttributeMap(ctx, element, null, bidiLevel);
+        Object o = map.get(TextAttribute.BIDI_EMBEDDING);
         Integer subBidiLevel = bidiLevel;
-	if (o != null)
-	    subBidiLevel = (Integer)o;
+        if (o != null)
+            subBidiLevel = (Integer)o;
 
         for (Node n = element.getFirstChild();
              n != null;
@@ -585,7 +538,7 @@
                 if (ln.equals(BATIK_EXT_FLOW_LINE_TAG)) {
                     fillAttributedStringBuffer(ctx, nodeElement, 
                                                false, subBidiLevel, 
-					       asb, lnLocs);
+                                               asb, lnLocs);
                     // System.out.println("Line: " + asb.length() + 
                     //                    " - '" +  asb + "'");
                     lnLocs.add(new Integer(asb.length()));
@@ -593,7 +546,7 @@
                            ln.equals(SVG_ALT_GLYPH_TAG)) {
                     fillAttributedStringBuffer(ctx, nodeElement,
                                                false, subBidiLevel, 
-					       asb, lnLocs);
+                                               asb, lnLocs);
                 } else if (ln.equals(SVG_A_TAG)) {
                     if (ctx.isInteractive()) {
                         NodeEventTarget target = (NodeEventTarget)nodeElement;
@@ -626,9 +579,15 @@
                     s = TextUtilities.getElementContent(ref);
                     s = normalizeString(s, preserve, prevEndsWithSpace);
                     if (s != null) {
+                        int trefStart = asb.length();
                         Map m = getAttributeMap(ctx, nodeElement, null, 
-						bidiLevel);
+                                                bidiLevel);
                         asb.append(s, m);
+                        int trefEnd = asb.length()-1;
+                        TextPaintInfo tpi;
+                        tpi = (TextPaintInfo)elemTPI.get(nodeElement);
+                        tpi.startChar = trefStart;
+                        tpi.endChar   = trefEnd;
                     }
                 } 
                 break;
@@ -644,9 +603,27 @@
         }
 
         if (top) {
-            while ((endLimit < asb.length()) && (asb.getLastChar() == ' '))
+            boolean strippedSome = false;;
+            while ((endLimit < asb.length()) && (asb.getLastChar() == ' ')) {
                 asb.stripLast();
+                strippedSome = true;
+            }
+            if (strippedSome) {
+                Iterator iter = elemTPI.values().iterator();
+                while (iter.hasNext()) {
+                    TextPaintInfo tpi = (TextPaintInfo)iter.next();
+                    if (tpi.endChar >= asb.length()) {
+                        tpi.endChar = asb.length()-1;
+                        if (tpi.startChar > tpi.endChar)
+                            tpi.startChar = tpi.endChar;
+                    }
+                }
+            }
         }
+        int elementEndChar = asb.length()-1;
+        TextPaintInfo tpi = (TextPaintInfo)elemTPI.get(element);
+        tpi.startChar = elementStartChar;
+        tpi.endChar   = elementEndChar;
     }
 
     /**

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/font/FontFamilyResolver.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/font/FontFamilyResolver.java?rev=388134&r1=388133&r2=388134&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/font/FontFamilyResolver.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/font/FontFamilyResolver.java Thu Mar 23 02:47:49 2006
@@ -137,20 +137,21 @@
         if (resolvedFontFamilies == null) {
             resolvedFontFamilies = new HashMap();
         }
+        familyName = familyName.toLowerCase();
 
         // first see if this font family has already been resolved
         GVTFontFamily resolvedFF = 
-            (GVTFontFamily)resolvedFontFamilies.get(familyName.toLowerCase());
+            (GVTFontFamily)resolvedFontFamilies.get(familyName);
 
         if (resolvedFF == null) { // hasn't been resolved yet
             // try to find a matching family name in the list of
             // available fonts
-            String awtFamilyName = (String)fonts.get(familyName.toLowerCase());
+            String awtFamilyName = (String)fonts.get(familyName);
             if (awtFamilyName != null) {
                 resolvedFF = new AWTFontFamily(awtFamilyName);
             }
 
-            resolvedFontFamilies.put(familyName.toLowerCase(), resolvedFF);
+            resolvedFontFamilies.put(familyName, resolvedFF);
         }
 
         //  if (resolvedFF != null) {

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/renderer/StrokingTextPainter.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/renderer/StrokingTextPainter.java?rev=388134&r1=388133&r2=388134&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/renderer/StrokingTextPainter.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/renderer/StrokingTextPainter.java Thu Mar 23 02:47:49 2006
@@ -44,7 +44,6 @@
 import org.apache.batik.gvt.font.GVTFontFamily;
 import org.apache.batik.gvt.font.GVTGlyphMetrics;
 import org.apache.batik.gvt.font.GVTLineMetrics;
-import org.apache.batik.gvt.font.UnresolvedFontFamily;
 import org.apache.batik.gvt.text.AttributedCharacterSpanIterator;
 import org.apache.batik.gvt.text.BidiAttributedCharacterIterator;
 import org.apache.batik.gvt.text.GVTAttributedCharacterIterator;
@@ -90,8 +89,8 @@
         = GVTAttributedCharacterIterator.TextAttribute.GVT_FONT;
 
     public static final 
-        AttributedCharacterIterator.Attribute GVT_FONT_FAMILIES 
-        = GVTAttributedCharacterIterator.TextAttribute.GVT_FONT_FAMILIES;
+        AttributedCharacterIterator.Attribute GVT_FONTS
+        = GVTAttributedCharacterIterator.TextAttribute.GVT_FONTS;
 
     public static final 
         AttributedCharacterIterator.Attribute BIDI_LEVEL
@@ -224,7 +223,7 @@
             // reorderTime += t1-t0;
             // t0=t1;
             chunkACIs    [i] = createModifiedACIForFontMatching
-                (node, chunkACIs[i]);
+                (chunkACIs[i]);
             
             chunkStart += (chunkACIs[i].getEndIndex()-
                            chunkACIs[i].getBeginIndex());
@@ -408,8 +407,8 @@
      *
      * @return The new modified aci.  
      */
-    protected AttributedCharacterIterator createModifiedACIForFontMatching
-        (TextNode node, AttributedCharacterIterator aci) {
+    protected static AttributedCharacterIterator createModifiedACIForFontMatching
+        (AttributedCharacterIterator aci) {
 
         aci.first();
         AttributedString as = null; 
@@ -422,39 +421,21 @@
             end = aci.getRunLimit(TEXT_COMPOUND_DELIMITER);
             int aciLength = end-start;
 
-            List fontFamilies;
-            fontFamilies = (List)aci.getAttributes().get(GVT_FONT_FAMILIES);
-
-            if (fontFamilies == null ) {
-                // no font families set this chunk so just increment...
-                asOff += aciLength;
-                moreChunks = (aci.setIndex(end) != AttributedCharacterIterator.DONE);
-                continue;
-            }
-
-            // resolve any unresolved font families in the list
-            List resolvedFontFamilies = new ArrayList(fontFamilies.size());
-            for (int i = 0; i < fontFamilies.size(); i++) {
-                GVTFontFamily fontFamily = (GVTFontFamily)fontFamilies.get(i);
-                if (fontFamily instanceof UnresolvedFontFamily) {
-                    fontFamily = FontFamilyResolver.resolve
-                        ((UnresolvedFontFamily)fontFamily);
-                }
-                if (fontFamily != null) // Add font family if resolved
-                    resolvedFontFamilies.add(fontFamily);
-            }
+            List fonts;
+            fonts = (List)aci.getAttributes().get(GVT_FONTS);
 
-            // if could not resolve at least one of the fontFamilies
-            // then use the default font
-            if (resolvedFontFamilies.size() == 0) {
-                resolvedFontFamilies.add(FontFamilyResolver.defaultFont);
-            }
 
-            // create a list of fonts of the correct size
             float fontSize = 12;
             Float fsFloat = (Float)aci.getAttributes().get(TextAttribute.SIZE);
-            if (fsFloat != null) {
+            if (fsFloat != null)
                 fontSize = fsFloat.floatValue();
+
+            // if could not resolve at least one of the fontFamilies
+            // then use the default font
+            if (fonts.size() == 0) {
+                // create a list of fonts of the correct size
+                fonts.add(FontFamilyResolver.defaultFont.deriveFont
+                    (fontSize, aci));
             }
 
             // now for each char or group of chars in the string,
@@ -468,16 +449,14 @@
             int numSet=0;
             int firstUnset=start;
             boolean firstUnsetSet;
-            for (int i = 0; i < resolvedFontFamilies.size(); i++) {
+            for (int i = 0; i < fonts.size(); i++) {
                 // assign this font to all characters it can display if it has
                 // not already been assigned
                 int currentIndex = firstUnset;
                 firstUnsetSet = false;
                 aci.setIndex(currentIndex);
 
-                GVTFontFamily ff;
-                ff = ((GVTFontFamily)resolvedFontFamilies.get(i));
-                GVTFont font = ff.deriveFont(fontSize, aci);
+                GVTFont font = (GVTFont)fonts.get(i);
                 if (defaultFont == null)
                     defaultFont = font;
 

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/text/GVTAttributedCharacterIterator.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/text/GVTAttributedCharacterIterator.java?rev=388134&r1=388133&r2=388134&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/text/GVTAttributedCharacterIterator.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/text/GVTAttributedCharacterIterator.java Thu Mar 23 02:47:49 2006
@@ -320,6 +320,8 @@
 
         public final static TextAttribute GVT_FONT_FAMILIES =
                                           new TextAttribute("GVT_FONT_FAMILIES");
+        public final static TextAttribute GVT_FONTS =
+                                          new TextAttribute("GVT_FONTS");
 
         public final static TextAttribute GVT_FONT =
                                           new TextAttribute("GVT_FONT");

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/text/GlyphLayout.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/text/GlyphLayout.java?rev=388134&r1=388133&r2=388134&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/text/GlyphLayout.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/text/GlyphLayout.java Thu Mar 23 02:47:49 2006
@@ -98,10 +98,6 @@
         = GVTAttributedCharacterIterator.TextAttribute.LINE_HEIGHT;
 
     public static final AttributedCharacterIterator.Attribute 
-        TEXT_COMPOUND_DELIMITER 
-        = GVTAttributedCharacterIterator.TextAttribute.TEXT_COMPOUND_DELIMITER;
-
-    public static final AttributedCharacterIterator.Attribute 
         VERTICAL_ORIENTATION 
         = GVTAttributedCharacterIterator.TextAttribute.VERTICAL_ORIENTATION;
 

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/text/TextPaintInfo.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/text/TextPaintInfo.java?rev=388134&r1=388133&r2=388134&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/text/TextPaintInfo.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/text/TextPaintInfo.java Thu Mar 23 02:47:49 2006
@@ -48,6 +48,8 @@
     public Paint  strikethroughStrokePaint;
     public Stroke strikethroughStroke;
 
+    public int    startChar, endChar;
+
     public TextPaintInfo() { }
     
     public TextPaintInfo(TextPaintInfo pi) {

Modified: xmlgraphics/batik/trunk/test-references/samples/tests/spec/paints/radialGradient.png
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/test-references/samples/tests/spec/paints/radialGradient.png?rev=388134&r1=388133&r2=388134&view=diff
==============================================================================
Binary files - no diff available.

Modified: xmlgraphics/batik/trunk/test-references/samples/tests/spec/paints/radialGradient2.png
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/test-references/samples/tests/spec/paints/radialGradient2.png?rev=388134&r1=388133&r2=388134&view=diff
==============================================================================
Binary files - no diff available.

Modified: xmlgraphics/batik/trunk/test-references/samples/tests/spec/paints/radialGradient3.png
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/test-references/samples/tests/spec/paints/radialGradient3.png?rev=388134&r1=388133&r2=388134&view=diff
==============================================================================
Binary files - no diff available.

Modified: xmlgraphics/batik/trunk/test-references/samples/tests/spec/paints/radialGradientOrientation.png
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/test-references/samples/tests/spec/paints/radialGradientOrientation.png?rev=388134&r1=388133&r2=388134&view=diff
==============================================================================
Binary files - no diff available.

Modified: xmlgraphics/batik/trunk/test-resources/org/apache/batik/test/samplesRendering.xml
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/test-resources/org/apache/batik/test/samplesRendering.xml?rev=388134&r1=388133&r2=388134&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/test-resources/org/apache/batik/test/samplesRendering.xml (original)
+++ xmlgraphics/batik/trunk/test-resources/org/apache/batik/test/samplesRendering.xml Thu Mar 23 02:47:49 2006
@@ -362,6 +362,7 @@
         <test id="samples/tests/spec/scripting/bbox.svg" />
         <test id="samples/tests/spec/scripting/circle.svg" />
         <test id="samples/tests/spec/scripting/display.svg" />
+        <test id="samples/tests/spec/scripting/domSVGColor.svg" />
         <test id="samples/tests/spec/scripting/ellipse.svg" />
         <test id="samples/tests/spec/scripting/enclosureList.svg" />
         <test id="samples/tests/spec/scripting/enclosureList2.svg" />