You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by vh...@apache.org on 2001/11/19 14:47:43 UTC

cvs commit: xml-batik/test-resources/org/apache/batik/svggen regsvggen.xml

vhardy      01/11/19 05:47:43

  Modified:    sources/org/apache/batik/svggen SVGGraphics2D.java
               test-resources/org/apache/batik/svggen regsvggen.xml
  Log:
  Fixed bug 4945. Added corresponding regression test.
  
  Revision  Changes    Path
  1.29      +28 -1     xml-batik/sources/org/apache/batik/svggen/SVGGraphics2D.java
  
  Index: SVGGraphics2D.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/svggen/SVGGraphics2D.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- SVGGraphics2D.java	2001/11/02 12:58:31	1.28
  +++ SVGGraphics2D.java	2001/11/19 13:47:43	1.29
  @@ -45,7 +45,7 @@
    *
    *
    * @author <a href="mailto:vincent.hardy@eng.sun.com">Vincent Hardy</a>
  - * @version $Id: SVGGraphics2D.java,v 1.28 2001/11/02 12:58:31 vhardy Exp $
  + * @version $Id: SVGGraphics2D.java,v 1.29 2001/11/19 13:47:43 vhardy Exp $
    * @see                org.apache.batik.ext.awt.g2d.GraphicContext
    * @see                org.apache.batik.svggen.DOMTreeManager
    * @see                org.apache.batik.svggen.DOMGroupManager
  @@ -1086,6 +1086,28 @@
                   SVGFont.recordFontUsage(s, getFont());
               }
   
  +            Font font = getFont();
  +
  +            // Account for the font transform if there is one
  +            AffineTransform txtTxf = null;
  +            AffineTransform savTxf = getTransform();
  +
  +            if (font != null){
  +                txtTxf = font.getTransform();
  +                if (txtTxf != null && !txtTxf.isIdentity()){
  +                    // 
  +                    // The additional transform applies about the text's origin
  +                    //
  +                    AffineTransform t = new AffineTransform();
  +                    t.translate(x, y);
  +                    t.concatenate(txtTxf);
  +                    t.translate(-x, -y);
  +                    this.transform(t);
  +                } else {
  +                    txtTxf = null;
  +                }
  +            }
  +
               Element text =
                   getDOMFactory().createElementNS(SVG_NAMESPACE_URI, SVG_TEXT_TAG);
               text.setAttributeNS(null, SVG_X_ATTRIBUTE,
  @@ -1097,6 +1119,11 @@
                                   XML_PRESERVE_VALUE);
               text.appendChild(getDOMFactory().createTextNode(s));
               domGroupManager.addElement(text, DOMGroupManager.FILL);
  +
  +            if (txtTxf != null){
  +                this.setTransform(savTxf);
  +            }
  +                
           } else {
               GlyphVector gv = getFont().
                   createGlyphVector(getFontRenderContext(), s);
  
  
  
  1.13      +2 -1      xml-batik/test-resources/org/apache/batik/svggen/regsvggen.xml
  
  Index: regsvggen.xml
  ===================================================================
  RCS file: /home/cvs/xml-batik/test-resources/org/apache/batik/svggen/regsvggen.xml,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- regsvggen.xml	2001/11/13 07:23:04	1.12
  +++ regsvggen.xml	2001/11/19 13:47:43	1.13
  @@ -8,7 +8,7 @@
   
   <!-- ========================================================================= -->
   <!-- @author vincent.hardy@eng.sun.com                                         -->
  -<!-- @version $Id: regsvggen.xml,v 1.12 2001/11/13 07:23:04 vhardy Exp $ -->
  +<!-- @version $Id: regsvggen.xml,v 1.13 2001/11/19 13:47:43 vhardy Exp $ -->
   <!-- ========================================================================= -->
   <testSuite id="svggen" name="SVGGraphics2D Accuracy Testing" class="org.apache.batik.svggen.SVGGeneratorTests">
       <test id="ATransform" />
  @@ -17,6 +17,7 @@
       <test id="BasicShapes2" />
       <test id="BStroke" />
       <test id="Bug4389" />
  +    <test id="Bug4945" />
       <test id="Clip" />
       <test id="Color1" />
       <test id="Color2" />
  
  
  

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