vhardy      02/02/19 08:48:23

  Modified:    sources/org/apache/batik/svggen SVGFont.java
               test-resources/org/apache/batik/svggen regsvggen.xml
  Added:       test-references/org/apache/batik/svggen Bug6535.svg
                        ContextBug6535.svg
               test-references/org/apache/batik/svggen/rendering
                        Bug6535.png ContextBug6535.png
               test-sources/org/apache/batik/svggen Bug6535.java
  Log:
  Fix for Bug 3565 along with test case for regressiong testing.
  
  Revision  Changes    Path
  1.14      +2 -2      xml-batik/sources/org/apache/batik/svggen/SVGFont.java
  
  Index: SVGFont.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/svggen/SVGFont.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- SVGFont.java      3 Aug 2001 04:21:53 -0000       1.13
  +++ SVGFont.java      19 Feb 2002 16:48:23 -0000      1.14
  @@ -31,7 +31,7 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Christophe Jolif</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Vincent Hardy</a>
  - * @version $Id: SVGFont.java,v 1.13 2001/08/03 04:21:53 bella Exp $
  + * @version $Id: SVGFont.java,v 1.14 2002/02/19 16:48:23 vhardy Exp $
    */
   public class SVGFont extends AbstractSVGConverter {
       public static final float EXTRA_LIGHT =
  @@ -207,7 +207,7 @@
        */
       public SVGFontDescriptor toSVG(Font font, FontRenderContext frc) {
   
  -        String fontSize = "" + font.getSize();
  +        String fontSize = "" + doubleString(font.getSize2D());
           String fontWeight = weightToSVG(font);
           String fontStyle = styleToSVG(font);
           String fontFamilyStr = familyToSVG(font);
  
  
  
  1.15      +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.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- regsvggen.xml     19 Nov 2001 15:11:36 -0000      1.14
  +++ regsvggen.xml     19 Feb 2002 16:48:23 -0000      1.15
  @@ -8,7 +8,7 @@
   
   <!-- ========================================================================= -->
   <!-- @author [EMAIL PROTECTED]                                         -->
  -<!-- @version $Id: regsvggen.xml,v 1.14 2001/11/19 15:11:36 vhardy Exp $ -->
  +<!-- @version $Id: regsvggen.xml,v 1.15 2002/02/19 16:48:23 vhardy Exp $ -->
   <!-- ========================================================================= -->
   <testSuite id="svggen" name="SVGGraphics2D Accuracy Testing" 
class="org.apache.batik.svggen.SVGGeneratorTests">
       <test id="ATransform" />
  @@ -18,6 +18,7 @@
       <test id="BStroke" />
       <test id="Bug4389" />
       <test id="Bug4945" />
  +    <test id="Bug6535" />
       <test id="Clip" />
       <test id="Color1" />
       <test id="Color2" />
  
  
  
  1.1                  xml-batik/test-references/org/apache/batik/svggen/Bug6535.svg
  
  Index: Bug6535.svg
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  
  <!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.0//EN' 
'http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd'>
  <svg fill-opacity="1" xmlns:xlink="http://www.w3.org/1999/xlink"; 
color-interpolation="auto" color-rendering="auto" text-rendering="auto" stroke="black" 
stroke-linecap="square" width="300" stroke-miterlimit="10" stroke-opacity="1" 
shape-rendering="auto" fill="black" stroke-dasharray="none" font-weight="normal" 
stroke-width="1" height="400" xmlns="http://www.w3.org/2000/svg"; 
font-family="&apos;Arial&apos;" font-style="normal" stroke-linejoin="miter" 
font-size="12" image-rendering="auto" stroke-dashoffset="0">
    <!--Generated by the Batik Graphics2D SVG Generator-->
    <defs id="genericDefs" />
    <g>
      <g text-rendering="optimizeLegibility" font-size="1" transform="scale(10,10)">
        <text xml:space="preserve" x="4" y="4" stroke="none">Hello, size 10
        </text>
        <text xml:space="preserve" x="4" font-size="1.5" y="8" stroke="none">Hello, 
size 15
        </text>
        <text x="160" font-size="10" y="40" transform="scale(0.1,0.1)" stroke="none" 
xml:space="preserve">Hello, size 10
        </text>
        <text x="160" font-size="15" y="80" transform="scale(0.1,0.1)" stroke="none" 
xml:space="preserve">Hello, size 15
        </text>
      </g>
    </g>
  </svg>
  
  
  
  1.1                  
xml-batik/test-references/org/apache/batik/svggen/ContextBug6535.svg
  
  Index: ContextBug6535.svg
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  
  <!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.0//EN' 
'http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd'>
  <svg contentScriptType="text/ecmascript" xmlns:xlink="http://www.w3.org/1999/xlink"; 
width="300" zoomAndPan="magnify" class="testC6" contentStyleType="text/css" 
height="400" preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg"; 
version="1.0">
    <!--Generated by the Batik Test Framework. Test:éj-->
    <defs id="genericDefs" />
    <g>
      <style type="text/css" xml:space="preserve">
        <![CDATA[.testC1 {text-rendering:optimizeLegibility;font-size:1;}
  .testC2 {stroke:none;}
  .testC3 {stroke:none;font-size:1.5;}
  .testC4 {stroke:none;font-size:10;}
  .testC5 {stroke:none;font-size:15;}
  .testC6 
{stroke-dashoffset:0;text-rendering:auto;color-rendering:auto;stroke-linecap:square;fill:black;font-size:12;stroke-linejoin:miter;font-weight:normal;stroke:black;fill-opacity:1;font-style:normal;stroke-dasharray:none;stroke-miterlimit:10;color-interpolation:auto;image-rendering:auto;shape-rendering:auto;font-family:'Arial';stroke-width:1;stroke-opacity:1;}
  ]]>
      </style>
      <g>
        <defs id="testdefs1">
          <font horiz-adv-x="75.0" id="testfont1">
            <font-face ascent="92.163086" descent="19.555664" units-per-em="100" 
font-family="Arial" font-style="normal" font-weight="normal" />
            <missing-glyph horiz-adv-x="75.0" d="M12.5 0 L12.5 62.5 L62.5 62.5 L62.5 0 
L12.5 0 ZM14.0625 1.5625 L60.9375 1.5625 L60.9375 60.9375 L14.0625 60.9375 L14.0625 
1.5625 Z" />
            <glyph unicode="0" horiz-adv-x="55.615234" d="M4.15625 35.296875 Q4.15625 
48 6.765625 55.7421875 Q9.375 63.484375 14.5234375 67.6796875 Q19.671875 71.875 
27.484375 71.875 Q33.25 71.875 37.59375 69.5546875 Q41.9375 67.234375 44.7734375 
62.8671875 Q47.609375 58.5 49.21875 52.2265625 Q50.828125 45.953125 50.828125 
35.296875 Q50.828125 22.703125 48.2421875 14.96875 Q45.65625 7.234375 40.5078125 
3.015625 Q35.359375 -1.203125 27.484375 -1.203125 Q17.140625 -1.203125 11.234375 
6.203125 Q4.15625 15.140625 4.15625 35.296875 ZM13.1875 35.296875 Q13.1875 17.671875 
17.3125 11.8359375 Q21.4375 6 27.484375 6 Q33.546875 6 37.671875 11.859375 Q41.796875 
17.71875 41.796875 35.296875 Q41.796875 52.984375 37.671875 58.7890625 Q33.546875 
64.59375 27.390625 64.59375 Q21.34375 64.59375 17.71875 59.46875 Q13.1875 52.9375 
13.1875 35.296875 Z" />
            <glyph unicode="1" horiz-adv-x="55.615234" d="M37.25 0 L28.46875 0 
L28.46875 56 Q25.296875 52.984375 20.140625 49.953125 Q14.984375 46.921875 10.890625 
45.40625 L10.890625 53.90625 Q18.265625 57.375 23.78125 62.3046875 Q29.296875 
67.234375 31.59375 71.875 L37.25 71.875 L37.25 0 Z" />
            <glyph unicode="z" horiz-adv-x="50.0" d="M1.953125 0 L1.953125 7.125 
L34.96875 45.015625 Q29.34375 44.734375 25.046875 44.734375 L3.90625 44.734375 
L3.90625 51.859375 L46.296875 51.859375 L46.296875 46.046875 L18.21875 13.140625 
L12.796875 7.125 Q18.703125 7.5625 23.875 7.5625 L47.859375 7.5625 L47.859375 0 
L1.953125 0 Z" />
            <glyph unicode="i" horiz-adv-x="22.216797" d="M6.640625 61.46875 L6.640625 
71.578125 L15.4375 71.578125 L15.4375 61.46875 L6.640625 61.46875 ZM6.640625 0 
L6.640625 51.859375 L15.4375 51.859375 L15.4375 0 L6.640625 0 Z" />
            <glyph unicode="s" horiz-adv-x="50.0" d="M3.078125 15.484375 L11.765625 
16.84375 Q12.5 11.625 15.84375 8.84375 Q19.1875 6.0625 25.203125 6.0625 Q31.25 6.0625 
34.1796875 8.5234375 Q37.109375 10.984375 37.109375 14.3125 Q37.109375 17.28125 
34.515625 19 Q32.71875 20.171875 25.53125 21.96875 Q15.875 24.421875 12.140625 
26.203125 Q8.40625 27.984375 6.4765625 31.1328125 Q4.546875 34.28125 4.546875 38.09375 
Q4.546875 41.546875 6.1328125 44.5078125 Q7.71875 47.46875 10.453125 49.421875 Q12.5 
50.921875 16.0390625 51.9765625 Q19.578125 53.03125 23.640625 53.03125 Q29.734375 
53.03125 34.3515625 51.2734375 Q38.96875 49.515625 41.1640625 46.5078125 Q43.359375 
43.5 44.1875 38.484375 L35.59375 37.3125 Q35.015625 41.3125 32.203125 43.5546875 
Q29.390625 45.796875 24.265625 45.796875 Q18.21875 45.796875 15.625 43.796875 
Q13.03125 41.796875 13.03125 39.109375 Q13.03125 37.40625 14.109375 36.03125 Q15.1875 
34.625 17.484375 33.6875 Q18.796875 33.203125 25.25 31.453125 Q34.578125 28.953125 
38.2578125 27.3671875 Q41.9375 25.78125 44.0390625 22.7578125 Q46.140625 19.734375 
46.140625 15.234375 Q46.140625 10.84375 43.578125 6.9609375 Q41.015625 3.078125 
36.1796875 0.9609375 Q31.34375 -1.15625 25.25 -1.15625 Q15.140625 -1.15625 9.84375 
3.0390625 Q4.546875 7.234375 3.078125 15.484375 Z" />
            <glyph unicode=" " horiz-adv-x="27.783203" d="" />
            <glyph unicode="," horiz-adv-x="27.783203" d="M8.890625 0 L8.890625 
10.015625 L18.890625 10.015625 L18.890625 0 Q18.890625 -5.5 16.9375 -8.8984375 
Q14.984375 -12.296875 10.75 -14.140625 L8.296875 -10.390625 Q11.078125 -9.171875 
12.3984375 -6.796875 Q13.71875 -4.421875 13.875 0 L8.890625 0 Z" />
            <glyph unicode="o" horiz-adv-x="55.615234" d="M3.328125 25.921875 
Q3.328125 40.328125 11.328125 47.265625 Q18.015625 53.03125 27.640625 53.03125 
Q38.328125 53.03125 45.1171875 46.0234375 Q51.90625 39.015625 51.90625 26.65625 
Q51.90625 16.65625 48.90625 10.9140625 Q45.90625 5.171875 40.1640625 2.0078125 
Q34.421875 -1.15625 27.640625 -1.15625 Q16.75 -1.15625 10.0390625 5.8203125 Q3.328125 
12.796875 3.328125 25.921875 ZM12.359375 25.921875 Q12.359375 15.96875 16.703125 
11.015625 Q21.046875 6.0625 27.640625 6.0625 Q34.1875 6.0625 38.53125 11.0390625 
Q42.875 16.015625 42.875 26.21875 Q42.875 35.84375 38.5 40.796875 Q34.125 45.75 
27.640625 45.75 Q21.046875 45.75 16.703125 40.8203125 Q12.359375 35.890625 12.359375 
25.921875 Z" />
            <glyph unicode="l" horiz-adv-x="22.216797" d="M6.390625 0 L6.390625 
71.578125 L15.1875 71.578125 L15.1875 0 L6.390625 0 Z" />
            <glyph unicode="e" horiz-adv-x="55.615234" d="M42.09375 16.703125 
L51.171875 15.578125 Q49.03125 7.625 43.21875 3.234375 Q37.40625 -1.15625 28.375 
-1.15625 Q17 -1.15625 10.328125 5.84375 Q3.65625 12.84375 3.65625 25.484375 Q3.65625 
38.578125 10.3984375 45.8046875 Q17.140625 53.03125 27.875 53.03125 Q38.28125 53.03125 
44.875 45.953125 Q51.46875 38.875 51.46875 26.03125 Q51.46875 25.25 51.421875 23.6875 
L12.75 23.6875 Q13.234375 15.140625 17.578125 10.6015625 Q21.921875 6.0625 28.421875 
6.0625 Q33.25 6.0625 36.671875 8.6015625 Q40.09375 11.140625 42.09375 16.703125 
ZM13.234375 30.90625 L42.1875 30.90625 Q41.609375 37.453125 38.875 40.71875 Q34.671875 
45.796875 27.984375 45.796875 Q21.921875 45.796875 17.796875 41.75 Q13.671875 
37.703125 13.234375 30.90625 Z" />
            <glyph unicode="H" horiz-adv-x="72.2168" d="M8.015625 0 L8.015625 
71.578125 L17.484375 71.578125 L17.484375 42.1875 L54.6875 42.1875 L54.6875 71.578125 
L64.15625 71.578125 L64.15625 0 L54.6875 0 L54.6875 33.734375 L17.484375 33.734375 
L17.484375 0 L8.015625 0 Z" />
            <glyph unicode="5" horiz-adv-x="55.615234" d="M4.15625 18.75 L13.375 
19.53125 Q14.40625 12.796875 18.140625 9.3984375 Q21.875 6 27.15625 6 Q33.5 6 
37.890625 10.7890625 Q42.28125 15.578125 42.28125 23.484375 Q42.28125 31 38.0625 
35.3515625 Q33.84375 39.703125 27 39.703125 Q22.75 39.703125 19.3359375 37.7734375 
Q15.921875 35.84375 13.96875 32.765625 L5.71875 33.84375 L12.640625 70.609375 L48.25 
70.609375 L48.25 62.203125 L19.671875 62.203125 L15.828125 42.96875 Q22.265625 
47.46875 29.34375 47.46875 Q38.71875 47.46875 45.1640625 40.96875 Q51.609375 34.46875 
51.609375 24.265625 Q51.609375 14.546875 45.953125 7.46875 Q39.0625 -1.203125 27.15625 
-1.203125 Q17.390625 -1.203125 11.2109375 4.2578125 Q5.03125 9.71875 4.15625 18.75 Z" 
/>
          </font>
        </defs>
        <g class="testC1" transform="scale(10,10)">
          <text xml:space="preserve" x="4" y="4" class="testC2">Hello, size 10
          </text>
          <text xml:space="preserve" x="4" y="8" class="testC3">Hello, size 15
          </text>
          <text xml:space="preserve" x="160" y="40" class="testC4" 
transform="scale(0.1,0.1)">Hello, size 10
          </text>
          <text xml:space="preserve" x="160" y="80" class="testC5" 
transform="scale(0.1,0.1)">Hello, size 15
          </text>
        </g>
      </g>
    </g>
  </svg>
  
  
  
  1.1                  
xml-batik/test-references/org/apache/batik/svggen/rendering/Bug6535.png
  
        <<Binary file>>
  
  
  1.1                  
xml-batik/test-references/org/apache/batik/svggen/rendering/ContextBug6535.png
  
        <<Binary file>>
  
  
  1.1                  xml-batik/test-sources/org/apache/batik/svggen/Bug6535.java
  
  Index: Bug6535.java
  ===================================================================
  /*****************************************************************************
   * Copyright (C) The Apache Software Foundation. All rights reserved.        *
   * ------------------------------------------------------------------------- *
   * This software is published under the terms of the Apache Software License *
   * version 1.1, a copy of which has been included with this distribution in  *
   * the LICENSE file.                                                         *
   *****************************************************************************/
  
  package org.apache.batik.svggen;
  
  import java.awt.*;
  import java.awt.geom.*;
  import java.awt.image.*;
  import javax.swing.ImageIcon;
  
  /**
   * This test validates outputing font-size as a float
   *
   * @author <a href="mailto:[EMAIL PROTECTED]";>Vincent Hardy</a>
   * @version $Id: Bug6535.java,v 1.1 2002/02/19 16:48:23 vhardy Exp $
   */
  public class Bug6535 implements Painter {
      public void paint(Graphics2D g){
          g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
                             RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
          g.setPaint(Color.black);
  
          g.scale(10,10);
  
          // Set default font
          Font font=new Font("Arial", Font.PLAIN, 1);
          Font font2=font.deriveFont(1.5f);
  
          g.setFont(font);
          g.drawString("Hello, size 10", 4, 4);
  
          g.setFont(font2);
          g.drawString("Hello, size 15", 4, 8);
  
          g.scale(.1, .1);
  
          font=new Font("Arial", Font.PLAIN, 10);
          font2=font.deriveFont(15f);
  
          g.setFont(font);
          g.drawString("Hello, size 10", 160, 40);
  
          g.setFont(font2);
          g.drawString("Hello, size 15", 160, 80);
  
      }
  }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to