See if this change in PdfGraphics2D solves the problem:

    public void drawString(String s, float x, float y) {
        if (s.length() == 0)
            return;
        setFillPaint();
        if (onlyShapes) {
            TextLayout tl = new TextLayout(s, this.font, new
FontRenderContext(new AffineTransform(), false, true));
            tl.draw(this, x, y);
        }
        else {
            AffineTransform at = getTransform();
            AffineTransform at2 = getTransform();
            at2.translate(x, y);
            at2.concatenate(font.getTransform());
            setTransform(at2);
            AffineTransform inverse = this.normalizeMatrix();
            AffineTransform flipper =
AffineTransform.getScaleInstance(1,-1);
            inverse.concatenate(flipper);
            double[] mx = new double[6];
            inverse.getMatrix(mx);
            cb.beginText();
            cb.setFontAndSize(baseFont, fontSize);
            cb.setTextMatrix((float)mx[0], (float)mx[1], (float)mx[2],
(float)mx[3], (float)mx[4], (float)mx[5]);
            double width = font.deriveFont(IDENTITY).getStringBounds(s,
getFontRenderContext()).getWidth(); // ***** CHANGED HERE *****
            if (s.length() > 1) {
                float adv = ((float)width - baseFont.getWidthPoint(s,
fontSize)) / (s.length() - 1);
                cb.setCharacterSpacing(adv);
            }
            cb.showText(s);
            if (s.length() > 1) {
                cb.setCharacterSpacing(0);
            }
            cb.endText();
            setTransform(at);
            if(underline)
            {
                // These two are supposed to be taken from the .AFM file
                int UnderlinePosition = -100;
                int UnderlineThickness = 50;
                //
                double d = asPoints((double)UnderlineThickness,
(int)fontSize);
                setStroke(new BasicStroke((float)d));
                y = (float)((double)(y) +
asPoints((double)(-UnderlineThickness), (int)fontSize));
                Line2D line = new Line2D.Double((double)x, (double)y,
(double)(width+x), (double)y);
                draw(line);
            }
        }
    } 


> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Christian Lauer
> Sent: Thursday, January 20, 2005 10:24 PM
> To: iText Mailing List
> Subject: [iText-questions] Problems with rotated text
> 
> Hi Paulo,
> 
> I guess this is one for you.
> 
> Since version 1.2.1 there seems to be a bug in the PDF Graphics2D
> implementation. As you can see in the attached documents, the version
> created with 1.1.4 renders rotated texts perfectly while 1.2.1
> vertically squeezes the rotated text.
> 
> Is this a bug?
> 
> Regards,
> Christian
> 


-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to