xmlgraphics-batik-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tkorm...@apache.org
Subject cvs commit: xml-batik/sources/org/apache/batik/gvt/font AWTGVTGlyphVector.java
Date Fri, 09 Nov 2001 15:33:27 GMT
tkormann    01/11/09 07:33:27

  Modified:    sources/org/apache/batik/gvt/font AWTGVTGlyphVector.java
  Log:
  Apply Bella's workaround for text under jdk1.4
  
  Revision  Changes    Path
  1.13      +32 -1     xml-batik/sources/org/apache/batik/gvt/font/AWTGVTGlyphVector.java
  
  Index: AWTGVTGlyphVector.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/gvt/font/AWTGVTGlyphVector.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- AWTGVTGlyphVector.java	2001/11/06 18:48:17	1.12
  +++ AWTGVTGlyphVector.java	2001/11/09 15:33:27	1.13
  @@ -34,7 +34,7 @@
    * This is a wrapper class for a java.awt.font.GlyphVector instance.
    *
    * @author <a href="mailto:bella.robinson@cmis.csiro.au">Bella Robinson</a>
  - * @version $Id: AWTGVTGlyphVector.java,v 1.12 2001/11/06 18:48:17 deweese Exp $
  + * @version $Id: AWTGVTGlyphVector.java,v 1.13 2001/11/09 15:33:27 tkormann Exp $
    */
   public class AWTGVTGlyphVector implements GVTGlyphVector {
   
  @@ -369,12 +369,43 @@
               if (glyphTransform != null) {
                   tr.concatenate(glyphTransform);
               }
  +	    //
  +	    // <!> HACK
  +	    //
  +	    // GlyphVector.getGlyphOutline behavior changes between 1.3 and 1.4
  +	    //
  +	    // I've looked at this problem a bit more and the incorrect glyph
  +	    // positioning in Batik is definitely due to the change in
  +	    // behavior of GlyphVector.getGlyphOutline(glyphIndex). It used to
  +	    // return the outline of the glyph at position 0,0 which meant
  +	    // that we had to translate it to the actual glyph position before
  +	    // drawing it. Now, it returns the outline which has already been
  +	    // positioned.
  +	    //
  +	    // -- Bella
  +	    //
  +
  +	    if (isJDK1_4OrGreater()) {
  +		Point2D glyphPos = awtGlyphVector.getGlyphPosition(glyphIndex);
  +		tr.translate(-glyphPos.getX(), -glyphPos.getY());
  +	    }
   
               tr.scale(scaleFactor, scaleFactor);
               glyphOutlines[glyphIndex] = tr.createTransformedShape(glyphOutline);
           }
   
           return glyphOutlines[glyphIndex];
  +    }
  +
  +    private static final boolean is1_4OrGreater;
  +
  +    static {
  +	String s = System.getProperty("java.version");
  +	is1_4OrGreater = ("1.4".compareTo(s) < 0);
  +    }
  +
  +    private static boolean isJDK1_4OrGreater() {
  +	return is1_4OrGreater;
       }
   
       /**
  
  
  

---------------------------------------------------------------------
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