keiron      01/08/16 23:42:56

  Modified:    src/org/apache/fop/svg PDFGraphics2D.java
  Log:
  should now handle rotated text properly
  
  Revision  Changes    Path
  1.16      +20 -16    xml-fop/src/org/apache/fop/svg/PDFGraphics2D.java
  
  Index: PDFGraphics2D.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/svg/PDFGraphics2D.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- PDFGraphics2D.java        2001/08/15 10:33:34     1.15
  +++ PDFGraphics2D.java        2001/08/17 06:42:56     1.16
  @@ -1,5 +1,5 @@
   /*
  - * $Id: PDFGraphics2D.java,v 1.15 2001/08/15 10:33:34 keiron Exp $
  + * $Id: PDFGraphics2D.java,v 1.16 2001/08/17 06:42:56 keiron Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -43,7 +43,7 @@
    * implementing a <tt>Graphic2D</tt> piece-meal.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Keiron Liddle</a>
  - * @version $Id: PDFGraphics2D.java,v 1.15 2001/08/15 10:33:34 keiron Exp $
  + * @version $Id: PDFGraphics2D.java,v 1.16 2001/08/17 06:42:56 keiron Exp $
    * @see org.apache.batik.ext.awt.g2d.AbstractGraphics2D
    */
   public class PDFGraphics2D extends AbstractGraphics2D {
  @@ -786,15 +786,6 @@
       public void drawString(String s, float x, float y) {
           // System.out.println("drawString(String)");
   
  -        Shape imclip = getClip();
  -        writeClip(imclip);
  -        Color c = getColor();
  -        applyColor(c, true);
  -        c = getBackground();
  -        applyColor(c, false);
  -
  -        currentStream.write("BT\n");
  -
           if(ovFontState == null) {
               Font gFont = getFont();
               String n = gFont.getFamily();
  @@ -813,20 +804,31 @@
           } else {
               fontState = ovFontState;
               ovFontState = null;
  -        }
  +        }       
           String name;
           int size;
           name = fontState.getFontName();
           size = fontState.getFontSize() / 1000;
  -
  +    
           if ((!name.equals(this.currentFontName))
                   || (size != this.currentFontSize)) {
  -            this.currentFontName = name;
  +            this.currentFontName = name; 
               this.currentFontSize = size;
               currentStream.write("/" + name + " " + size + " Tf\n");
   
           }
   
  +        currentStream.write("q\n");
  +
  +        Shape imclip = getClip();
  +        writeClip(imclip);
  +        Color c = getColor();
  +        applyColor(c, true);
  +        c = getBackground();
  +        applyColor(c, false);
  +
  +        currentStream.write("BT\n");
  +
           Hashtable kerning = null;
           boolean kerningAvailable = false;
   
  @@ -859,9 +861,10 @@
           currentStream.write(PDFNumber.doubleOut(vals[0]) + " "
                               + PDFNumber.doubleOut(vals[1]) + " "
                               + PDFNumber.doubleOut(vals[2]) + " "
  -                            + PDFNumber.doubleOut(-vals[3]) + " "
  +                            + PDFNumber.doubleOut(vals[3]) + " "
                               + PDFNumber.doubleOut(vals[4]) + " "
  -                            + PDFNumber.doubleOut(vals[5]) + " Tm [" + startText);
  +                            + PDFNumber.doubleOut(vals[5]) + " cm\n");
  +        currentStream.write("1 0 0 -1 0 0 Tm [" + startText);
   
           int l = s.length();
   
  @@ -899,6 +902,7 @@
           currentStream.write("] TJ\n");
   
           currentStream.write("ET\n");
  +        currentStream.write("Q\n");
       }
   
       private void addKerning(StringWriter buf, Integer ch1, Integer ch2,
  
  
  

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

Reply via email to