Ignore:
Timestamp:
2014-10-30T11:39:47+01:00 (11 years ago)
Author:
stoecker
Message:

update SVG code to current SVN (fix line endings), see #10479

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/com/kitfox/svg/Text.java

    r6002 r7676  
    4242import java.awt.geom.AffineTransform;
    4343import java.awt.geom.GeneralPath;
     44import java.awt.geom.Point2D;
    4445import java.awt.geom.Rectangle2D;
    4546import java.util.Iterator;
     
    209210        } else
    210211        {
    211             fontWeight = TXWE_BOLD;
     212            fontWeight = TXWE_NORMAL;
    212213        }
    213214
     
    352353            {
    353354                AffineTransform at = new AffineTransform();
    354                 at.translate(-textPath.getBounds2D().getWidth() / 2, 0);
     355                at.translate(-textPath.getBounds().getWidth() / 2, 0);
    355356                textPath.transform(at);
    356357                break;
     
    359360            {
    360361                AffineTransform at = new AffineTransform();
    361                 at.translate(-textPath.getBounds2D().getWidth(), 0);
     362                at.translate(-textPath.getBounds().getWidth(), 0);
    362363                textPath.transform(at);
    363364                break;
     
    390391            if (obj instanceof String)
    391392            {
    392                 String text = (String) obj;
     393                String text = (String)obj;
     394                text = text.trim();
    393395
    394396                Shape textShape = font.createGlyphVector(frc, text).getOutline(cursorX, cursorY);
     
    415417
    416418
    417                 Tspan tspan = (Tspan) obj;
    418                 tspan.setCursorX(cursorX);
    419                 tspan.setCursorY(cursorY);
    420                 tspan.addShape(textPath);
    421                 cursorX = tspan.getCursorX();
    422                 cursorY = tspan.getCursorY();
     419                Tspan tspan = (Tspan)obj;
     420                Point2D cursor = new Point2D.Float(cursorX, cursorY);
     421//                tspan.setCursorX(cursorX);
     422//                tspan.setCursorY(cursorY);
     423                tspan.appendToShape(textPath, cursor);
     424//                cursorX = tspan.getCursorX();
     425//                cursorY = tspan.getCursorY();
     426                cursorX = (float)cursor.getX();
     427                cursorY = (float)cursor.getY();
    423428
    424429            }
     
    430435            {
    431436                AffineTransform at = new AffineTransform();
    432                 at.translate(-textPath.getBounds2D().getWidth() / 2, 0);
     437                at.translate(-textPath.getBounds().getWidth() / 2, 0);
    433438                textPath.transform(at);
    434439                break;
     
    437442            {
    438443                AffineTransform at = new AffineTransform();
    439                 at.translate(-textPath.getBounds2D().getWidth(), 0);
     444                at.translate(-Math.ceil(textPath.getBounds().getWidth()), 0);
    440445                textPath.transform(at);
    441446                break;
Note: See TracChangeset for help on using the changeset viewer.