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 de...@apache.org on 2003/09/15 02:18:00 UTC

cvs commit: xml-batik/sources/org/apache/batik/gvt/font AWTGVTGlyphVector.java

deweese     2003/09/14 17:18:00

  Modified:    sources/org/apache/batik/gvt/font AWTGVTGlyphVector.java
  Log:
  Now fills/strokes text for geometricPrecision rather than using
  drawGlyphVector.
  
  Revision  Changes    Path
  1.29      +22 -9     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.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- AWTGVTGlyphVector.java	7 Sep 2003 22:25:28 -0000	1.28
  +++ AWTGVTGlyphVector.java	15 Sep 2003 00:17:59 -0000	1.29
  @@ -53,6 +53,7 @@
   import java.awt.Color;
   import java.awt.Graphics2D;
   import java.awt.Paint;
  +import java.awt.RenderingHints;
   import java.awt.Shape;
   import java.awt.Stroke;
   import java.awt.font.FontRenderContext;
  @@ -832,7 +833,8 @@
               return;
   
           boolean useHinting = drawGlyphVectorWorks;
  -        if ((stroke != null) && (strokePaint != null))
  +        if (useHinting && (stroke != null) && (strokePaint != null))
  +            // Can't stroke with drawGlyphVector.
               useHinting = false;
   
           if (useHinting && 
  @@ -841,6 +843,17 @@
               // So complex paints aren't positioned properly.
               useHinting = false;
   
  +        if (useHinting) {
  +            Object v1 = graphics2D.getRenderingHint
  +                (RenderingHints.KEY_TEXT_ANTIALIASING);
  +            Object v2 = graphics2D.getRenderingHint
  +                (RenderingHints.KEY_STROKE_CONTROL);
  +            // text-rendering = geometricPrecision so fill shapes.
  +            if ((v1 == RenderingHints.VALUE_TEXT_ANTIALIAS_ON) &&
  +                (v2 == RenderingHints.VALUE_STROKE_PURE))
  +                useHinting = false;
  +        }
  +
           final int typeGRot   = AffineTransform.TYPE_GENERAL_ROTATION;
           final int typeGTrans = AffineTransform.TYPE_GENERAL_TRANSFORM;
   
  @@ -918,19 +931,19 @@
               }
   
           } else {
  -        Shape outline = getOutline();
  +            Shape outline = getOutline();
   
  -        // check if we need to fill this glyph
  +            // check if we need to fill this glyph
               if (fillPaint != null) {
                   graphics2D.setPaint(fillPaint);
  -            graphics2D.fill(outline);
  -        }
  +                graphics2D.fill(outline);
  +            }
   
  -        // check if we need to draw the outline of this glyph
  +            // check if we need to draw the outline of this glyph
               if (stroke != null && strokePaint != null) {
  -            graphics2D.setStroke(stroke);
  +                graphics2D.setStroke(stroke);
                   graphics2D.setPaint(strokePaint);
  -            graphics2D.draw(outline);
  +                graphics2D.draw(outline);
               }
           }
       }
  
  
  

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