Changeset 8083 in josm


Ignore:
Timestamp:
2015-02-18T15:49:56+01:00 (9 years ago)
Author:
bastiK
Message:

update svgsalamander to r200

Location:
trunk
Files:
3 added
1 deleted
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/patches/10trim_svgsalamander.patch

    r7676 r8083  
    1919Only in kitfox/svg/app: VersionDialog.java
    2020Only in kitfox/svg: SVGDisplayPanel.form
     21Only in kitfox/svg: SVGDisplayPanel.java
    2122diff -ur kitfox/svg/SVGElement.java src/com/kitfox/svg/SVGElement.java
    22 --- kitfox/svg/SVGElement.java  2014-10-30 11:31:46.229650244 +0100
    23 +++ src/com/kitfox/svg/SVGElement.java  2014-10-29 23:30:19.882171106 +0100
     23--- kitfox/svg/SVGElement.java  2015-02-18 15:16:19.968664918 +0100
     24+++ src/com/kitfox/svg/SVGElement.java  2015-02-18 15:25:38.763435836 +0100
    2425@@ -35,9 +35,6 @@
    2526  */
     
    246247         {
    247248diff -ur kitfox/svg/SVGLoaderHelper.java src/com/kitfox/svg/SVGLoaderHelper.java
    248 --- kitfox/svg/SVGLoaderHelper.java     2014-10-29 22:49:38.193473772 +0100
    249 +++ src/com/kitfox/svg/SVGLoaderHelper.java     2014-10-29 22:54:17.671385584 +0100
     249--- kitfox/svg/SVGLoaderHelper.java     2015-02-18 15:16:20.160665871 +0100
     250+++ src/com/kitfox/svg/SVGLoaderHelper.java     2015-02-18 15:25:38.763435836 +0100
    250251@@ -37,9 +37,6 @@
    251252 package com.kitfox.svg;
     
    271272     public SVGLoaderHelper(URI xmlBase, SVGUniverse universe, SVGDiagram diagram)
    272273diff -ur kitfox/svg/SVGLoader.java src/com/kitfox/svg/SVGLoader.java
    273 --- kitfox/svg/SVGLoader.java   2014-10-29 22:49:38.193473772 +0100
    274 +++ src/com/kitfox/svg/SVGLoader.java   2014-10-29 22:53:56.462392128 +0100
     274--- kitfox/svg/SVGLoader.java   2015-02-18 15:16:20.188666018 +0100
     275+++ src/com/kitfox/svg/SVGLoader.java   2015-02-18 15:25:38.763435836 +0100
    275276@@ -42,7 +42,6 @@
    276277 import org.xml.sax.*;
  • trunk/src/com/kitfox/svg/Font.java

    r6002 r8083  
    144144    }
    145145
     146    public void setFontFace(FontFace face)
     147    {
     148        fontFace = face;
     149    }
     150
    146151    public MissingGlyph getGlyph(String unicode)
    147152    {
  • trunk/src/com/kitfox/svg/FontFace.java

    r6002 r8083  
    5454     * Em size of coordinate system font is defined in
    5555     */
    56     int unitsPerEm = 1000;
    57     int ascent = -1;
    58     int descent = -1;
    59     int accentHeight = -1;
    60     int underlinePosition = -1;
    61     int underlineThickness = -1;
    62     int strikethroughPosition = -1;
    63     int strikethroughThickness = -1;
    64     int overlinePosition = -1;
    65     int overlineThickness = -1;
     56    private int unitsPerEm = 1000;
     57    private int ascent = -1;
     58    private int descent = -1;
     59    private int accentHeight = -1;
     60    private int underlinePosition = -1;
     61    private int underlineThickness = -1;
     62    private int strikethroughPosition = -1;
     63    private int strikethroughThickness = -1;
     64    private int overlinePosition = -1;
     65    private int overlineThickness = -1;
    6666
    6767    /**
     
    234234        return false;
    235235    }
     236
     237    /**
     238     * @param unitsPerEm the unitsPerEm to set
     239     */
     240    public void setUnitsPerEm(int unitsPerEm)
     241    {
     242        this.unitsPerEm = unitsPerEm;
     243    }
     244
     245    /**
     246     * @param ascent the ascent to set
     247     */
     248    public void setAscent(int ascent)
     249    {
     250        this.ascent = ascent;
     251    }
     252
     253    /**
     254     * @param descent the descent to set
     255     */
     256    public void setDescent(int descent)
     257    {
     258        this.descent = descent;
     259    }
     260
     261    /**
     262     * @param accentHeight the accentHeight to set
     263     */
     264    public void setAccentHeight(int accentHeight)
     265    {
     266        this.accentHeight = accentHeight;
     267    }
     268
     269    /**
     270     * @param underlinePosition the underlinePosition to set
     271     */
     272    public void setUnderlinePosition(int underlinePosition)
     273    {
     274        this.underlinePosition = underlinePosition;
     275    }
     276
     277    /**
     278     * @param underlineThickness the underlineThickness to set
     279     */
     280    public void setUnderlineThickness(int underlineThickness)
     281    {
     282        this.underlineThickness = underlineThickness;
     283    }
     284
     285    /**
     286     * @param strikethroughPosition the strikethroughPosition to set
     287     */
     288    public void setStrikethroughPosition(int strikethroughPosition)
     289    {
     290        this.strikethroughPosition = strikethroughPosition;
     291    }
     292
     293    /**
     294     * @param strikethroughThickness the strikethroughThickness to set
     295     */
     296    public void setStrikethroughThickness(int strikethroughThickness)
     297    {
     298        this.strikethroughThickness = strikethroughThickness;
     299    }
     300
     301    /**
     302     * @param overlinePosition the overlinePosition to set
     303     */
     304    public void setOverlinePosition(int overlinePosition)
     305    {
     306        this.overlinePosition = overlinePosition;
     307    }
     308
     309    /**
     310     * @param overlineThickness the overlineThickness to set
     311     */
     312    public void setOverlineThickness(int overlineThickness)
     313    {
     314        this.overlineThickness = overlineThickness;
     315    }
    236316}
  • trunk/src/com/kitfox/svg/Group.java

    r7676 r8083  
    150150        //Don't process if not visible
    151151        StyleAttribute styleAttrib = new StyleAttribute();
    152         if (getStyle(styleAttrib.setName("visibility")))
    153         {
    154             if (!styleAttrib.getStringValue().equals("visible"))
     152        //Visibility can be overridden by children
     153
     154        if (getStyle(styleAttrib.setName("display")))
     155        {
     156            if (styleAttrib.getStringValue().equals("none"))
    155157            {
    156158                return;
    157159            }
    158160        }
    159 
     161       
    160162        //Do not process offscreen groups
    161163        boolean ignoreClip = diagram.ignoringClipHeuristic();
  • trunk/src/com/kitfox/svg/ImageSVG.java

    r7676 r8083  
    207207        {
    208208            if (!styleAttrib.getStringValue().equals("visible"))
     209            {
     210                return;
     211            }
     212        }
     213
     214        if (getStyle(styleAttrib.setName("display")))
     215        {
     216            if (styleAttrib.getStringValue().equals("none"))
    209217            {
    210218                return;
  • trunk/src/com/kitfox/svg/Marker.java

    r6002 r8083  
    5656    float refX;
    5757    float refY;
    58     float markerWidth = 3;
    59     float markerHeight = 3;
     58    float markerWidth = 1;
     59    float markerHeight = 1;
    6060    float orient = Float.NaN;
    6161    boolean markerUnitsStrokeWidth = true; //if set to false 'userSpaceOnUse' is assumed
     
    196196        boolean changeState = super.updateTime(curTime);
    197197
     198        build();
     199       
    198200        //Marker properties do not change
    199201        return changeState;
  • trunk/src/com/kitfox/svg/MissingGlyph.java

    r6002 r8083  
    5959   
    6060    //We may define a path
    61     Shape path = null;
     61    private Shape path = null;
    6262    //Alternately, we may have child graphical elements
    63     int horizAdvX = -1;  //Inherits font's value if not set
    64     int vertOriginX = -1;  //Inherits font's value if not set
    65     int vertOriginY = -1;  //Inherits font's value if not set
    66     int vertAdvY = -1;  //Inherits font's value if not set
     63    private int horizAdvX = -1;  //Inherits font's value if not set
     64    private int vertOriginX = -1;  //Inherits font's value if not set
     65    private int vertOriginY = -1;  //Inherits font's value if not set
     66    private int vertAdvY = -1;  //Inherits font's value if not set
    6767
    6868    /**
     
    242242        return false;
    243243    }
     244
     245    /**
     246     * @param path the path to set
     247     */
     248    public void setPath(Shape path)
     249    {
     250        this.path = path;
     251    }
     252
     253    /**
     254     * @param horizAdvX the horizAdvX to set
     255     */
     256    public void setHorizAdvX(int horizAdvX)
     257    {
     258        this.horizAdvX = horizAdvX;
     259    }
     260
     261    /**
     262     * @param vertOriginX the vertOriginX to set
     263     */
     264    public void setVertOriginX(int vertOriginX)
     265    {
     266        this.vertOriginX = vertOriginX;
     267    }
     268
     269    /**
     270     * @param vertOriginY the vertOriginY to set
     271     */
     272    public void setVertOriginY(int vertOriginY)
     273    {
     274        this.vertOriginY = vertOriginY;
     275    }
     276
     277    /**
     278     * @param vertAdvY the vertAdvY to set
     279     */
     280    public void setVertAdvY(int vertAdvY)
     281    {
     282        this.vertAdvY = vertAdvY;
     283    }
    244284}
  • trunk/src/com/kitfox/svg/SVGElement.java

    r7676 r8083  
    588588    static public AffineTransform parseSingleTransform(String val) throws SVGException
    589589    {
    590         final Matcher matchWord = Pattern.compile("([a-zA-Z]+|-?\\d+(\\.\\d+)?|-?\\.\\d+)").matcher("");
     590        final Matcher matchWord = Pattern.compile("([a-zA-Z]+|-?\\d+(\\.\\d+)?(e-?\\d+)?|-?\\.\\d+(e-?\\d+)?)").matcher("");
    591591
    592592        AffineTransform retXform = new AffineTransform();
  • trunk/src/com/kitfox/svg/Text.java

    r7676 r8083  
    3636package com.kitfox.svg;
    3737
     38import com.kitfox.svg.util.FontSystem;
     39import com.kitfox.svg.util.TextBuilder;
    3840import com.kitfox.svg.xml.StyleAttribute;
    3941import java.awt.Graphics2D;
     
    8991    int fontWeight;
    9092
     93    float textLength = -1;
     94    String lengthAdjust = "spacing";
     95   
    9196    /**
    9297     * Creates a new instance of Stop
     
    167172        {
    168173            fontFamily = sty.getStringValue();
    169         } else
     174        }
     175        else
    170176        {
    171177            fontFamily = "Sans Serif";
     
    175181        {
    176182            fontSize = sty.getFloatValueWithUnits();
    177         } else
     183        }
     184        else
    178185        {
    179186            fontSize = 12f;
     187        }
     188
     189        if (getStyle(sty.setName("textLength")))
     190        {
     191            textLength = sty.getFloatValueWithUnits();
     192        }
     193        else
     194        {
     195            textLength = -1;
     196        }
     197
     198        if (getStyle(sty.setName("lengthAdjust")))
     199        {
     200            lengthAdjust = sty.getStringValue();
     201        }
     202        else
     203        {
     204            lengthAdjust = "spacing";
    180205        }
    181206
     
    235260        //text-rendering
    236261
    237         buildFont();
    238     }
    239 
    240     protected void buildFont() throws SVGException
    241     {
    242         int style;
    243         switch (fontStyle)
    244         {
    245             case TXST_ITALIC:
    246                 style = java.awt.Font.ITALIC;
    247                 break;
    248             default:
    249                 style = java.awt.Font.PLAIN;
    250                 break;
    251         }
    252 
    253         int weight;
    254         switch (fontWeight)
    255         {
    256             case TXWE_BOLD:
    257             case TXWE_BOLDER:
    258                 weight = java.awt.Font.BOLD;
    259                 break;
    260             default:
    261                 weight = java.awt.Font.PLAIN;
    262                 break;
    263         }
     262        buildText();
     263    }
     264
     265    protected void buildText() throws SVGException
     266    {
    264267
    265268        //Get font
     
    269272//            System.err.println("Could not load font");
    270273
    271             java.awt.Font sysFont = new java.awt.Font(fontFamily, style | weight, (int) fontSize);
    272             buildSysFont(sysFont);
    273             return;
     274            font = new FontSystem(fontFamily, fontStyle, fontWeight, (int)fontSize);
     275//            java.awt.Font sysFont = new java.awt.Font(fontFamily, style | weight, (int)fontSize);
     276//            buildSysFont(sysFont);
     277//            return;
    274278        }
    275279
     
    288292
    289293//        AffineTransform oldXform = g.getTransform();
     294//        TextBuilder builder = new TextBuilder();
     295//       
     296//        for (Iterator it = content.iterator(); it.hasNext();)
     297//        {
     298//            Object obj = it.next();
     299//
     300//            if (obj instanceof String)
     301//            {
     302//                String text = (String) obj;
     303//                if (text != null)
     304//                {
     305//                    text = text.trim();
     306//                }
     307//               
     308//                for (int i = 0; i < text.length(); i++)
     309//                {
     310//                    String unicode = text.substring(i, i + 1);
     311//                    MissingGlyph glyph = font.getGlyph(unicode);
     312//                   
     313//                    builder.appendGlyph(glyph);
     314//                }
     315//            }
     316//            else if (obj instanceof Tspan)
     317//            {
     318//                Tspan tspan = (Tspan)obj;
     319//                tspan.buildGlyphs(builder);
     320//            }
     321//        }
     322//
     323//        builder.formatGlyphs();
     324       
     325       
     326
     327               
     328               
     329       
     330       
     331       
    290332        AffineTransform xform = new AffineTransform();
    291333
     
    328370
    329371                strokeWidthScalar = 1f;
    330             } else if (obj instanceof Tspan)
    331             {
    332                 Tspan tspan = (Tspan) obj;
    333 
    334                 xform.setToIdentity();
    335                 xform.setToTranslation(cursorX, cursorY);
    336                 xform.scale(fontScale, fontScale);
    337 //                tspan.setCursorX(cursorX);
    338 //                tspan.setCursorY(cursorY);
    339 
    340                 Shape tspanShape = tspan.getShape();
    341                 tspanShape = xform.createTransformedShape(tspanShape);
    342                 textPath.append(tspanShape, false);
    343 //                tspan.render(g);
    344 //                cursorX = tspan.getCursorX();
    345 //                cursorY = tspan.getCursorY();
    346             }
    347 
    348         }
    349 
    350         switch (textAnchor)
    351         {
    352             case TXAN_MIDDLE:
    353             {
    354                 AffineTransform at = new AffineTransform();
    355                 at.translate(-textPath.getBounds().getWidth() / 2, 0);
    356                 textPath.transform(at);
    357                 break;
    358             }
    359             case TXAN_END:
    360             {
    361                 AffineTransform at = new AffineTransform();
    362                 at.translate(-textPath.getBounds().getWidth(), 0);
    363                 textPath.transform(at);
    364                 break;
    365             }
    366         }
    367     }
    368 
    369     private void buildSysFont(java.awt.Font font) throws SVGException
    370     {
    371         GeneralPath textPath = new GeneralPath();
    372         textShape = textPath;
    373 
    374         float cursorX = x, cursorY = y;
    375 
    376 //        FontMetrics fm = g.getFontMetrics(font);
    377         FontRenderContext frc = new FontRenderContext(null, true, true);
    378 
    379 //        FontFace fontFace = font.getFontFace();
    380         //int unitsPerEm = fontFace.getUnitsPerEm();
    381 //        int ascent = fm.getAscent();
    382 //        float fontScale = fontSize / (float)ascent;
    383 
    384 //        AffineTransform oldXform = g.getTransform();
    385         AffineTransform xform = new AffineTransform();
    386 
    387         for (Iterator it = content.iterator(); it.hasNext();)
    388         {
    389             Object obj = it.next();
    390 
    391             if (obj instanceof String)
    392             {
    393                 String text = (String)obj;
    394                 text = text.trim();
    395 
    396                 Shape textShape = font.createGlyphVector(frc, text).getOutline(cursorX, cursorY);
    397                 textPath.append(textShape, false);
    398 //                renderShape(g, textShape);
    399 //                g.drawString(text, cursorX, cursorY);
    400 
    401                 Rectangle2D rect = font.getStringBounds(text, frc);
    402                 cursorX += (float) rect.getWidth();
    403             } else if (obj instanceof Tspan)
    404             {
    405                 /*
    406                  Tspan tspan = (Tspan)obj;
    407                  
    408                  xform.setToIdentity();
    409                  xform.setToTranslation(cursorX, cursorY);
    410                  
    411                  Shape tspanShape = tspan.getShape();
    412                  tspanShape = xform.createTransformedShape(tspanShape);
    413                  textArea.add(new Area(tspanShape));
    414                  
    415                  cursorX += tspanShape.getBounds2D().getWidth();
    416                  */
    417 
    418 
     372            }
     373            else if (obj instanceof Tspan)
     374            {
     375//                Tspan tspan = (Tspan) obj;
     376//
     377//                xform.setToIdentity();
     378//                xform.setToTranslation(cursorX, cursorY);
     379//                xform.scale(fontScale, fontScale);
     380////                tspan.setCursorX(cursorX);
     381////                tspan.setCursorY(cursorY);
     382//
     383//                Shape tspanShape = tspan.getShape();
     384//                tspanShape = xform.createTransformedShape(tspanShape);
     385//                textPath.append(tspanShape, false);
     386////                tspan.render(g);
     387////                cursorX = tspan.getCursorX();
     388////                cursorY = tspan.getCursorY();
     389               
     390               
    419391                Tspan tspan = (Tspan)obj;
    420392                Point2D cursor = new Point2D.Float(cursorX, cursorY);
     
    426398                cursorX = (float)cursor.getX();
    427399                cursorY = (float)cursor.getY();
    428 
    429             }
     400               
     401            }
     402
    430403        }
    431404
     
    442415            {
    443416                AffineTransform at = new AffineTransform();
    444                 at.translate(-Math.ceil(textPath.getBounds().getWidth()), 0);
     417                at.translate(-textPath.getBounds().getWidth(), 0);
    445418                textPath.transform(at);
    446419                break;
     
    448421        }
    449422    }
     423
     424//    private void buildSysFont(java.awt.Font font) throws SVGException
     425//    {
     426//        GeneralPath textPath = new GeneralPath();
     427//        textShape = textPath;
     428//
     429//        float cursorX = x, cursorY = y;
     430//
     431////        FontMetrics fm = g.getFontMetrics(font);
     432//        FontRenderContext frc = new FontRenderContext(null, true, true);
     433//
     434////        FontFace fontFace = font.getFontFace();
     435//        //int unitsPerEm = fontFace.getUnitsPerEm();
     436////        int ascent = fm.getAscent();
     437////        float fontScale = fontSize / (float)ascent;
     438//
     439////        AffineTransform oldXform = g.getTransform();
     440//        AffineTransform xform = new AffineTransform();
     441//
     442//        for (Iterator it = content.iterator(); it.hasNext();)
     443//        {
     444//            Object obj = it.next();
     445//
     446//            if (obj instanceof String)
     447//            {
     448//                String text = (String)obj;
     449//                text = text.trim();
     450//
     451//                Shape textShape = font.createGlyphVector(frc, text).getOutline(cursorX, cursorY);
     452//                textPath.append(textShape, false);
     453////                renderShape(g, textShape);
     454////                g.drawString(text, cursorX, cursorY);
     455//
     456//                Rectangle2D rect = font.getStringBounds(text, frc);
     457//                cursorX += (float) rect.getWidth();
     458//            } else if (obj instanceof Tspan)
     459//            {
     460//                /*
     461//                 Tspan tspan = (Tspan)obj;
     462//                 
     463//                 xform.setToIdentity();
     464//                 xform.setToTranslation(cursorX, cursorY);
     465//                 
     466//                 Shape tspanShape = tspan.getShape();
     467//                 tspanShape = xform.createTransformedShape(tspanShape);
     468//                 textArea.add(new Area(tspanShape));
     469//                 
     470//                 cursorX += tspanShape.getBounds2D().getWidth();
     471//                 */
     472//
     473//
     474//                Tspan tspan = (Tspan)obj;
     475//                Point2D cursor = new Point2D.Float(cursorX, cursorY);
     476////                tspan.setCursorX(cursorX);
     477////                tspan.setCursorY(cursorY);
     478//                tspan.appendToShape(textPath, cursor);
     479////                cursorX = tspan.getCursorX();
     480////                cursorY = tspan.getCursorY();
     481//                cursorX = (float)cursor.getX();
     482//                cursorY = (float)cursor.getY();
     483//
     484//            }
     485//        }
     486//
     487//        switch (textAnchor)
     488//        {
     489//            case TXAN_MIDDLE:
     490//            {
     491//                AffineTransform at = new AffineTransform();
     492//                at.translate(-textPath.getBounds().getWidth() / 2, 0);
     493//                textPath.transform(at);
     494//                break;
     495//            }
     496//            case TXAN_END:
     497//            {
     498//                AffineTransform at = new AffineTransform();
     499//                at.translate(-Math.ceil(textPath.getBounds().getWidth()), 0);
     500//                textPath.transform(at);
     501//                break;
     502//            }
     503//        }
     504//    }
    450505
    451506    public void render(Graphics2D g) throws SVGException
     
    502557        }
    503558
     559        if (getStyle(sty.setName("textLength")))
     560        {
     561            textLength = sty.getFloatValueWithUnits();
     562        }
     563        else
     564        {
     565            textLength = -1;
     566        }
     567
     568        if (getStyle(sty.setName("lengthAdjust")))
     569        {
     570            lengthAdjust = sty.getStringValue();
     571        }
     572        else
     573        {
     574            lengthAdjust = "spacing";
     575        }
     576
    504577        if (getPres(sty.setName("font-family")))
    505578        {
  • trunk/src/com/kitfox/svg/Tspan.java

    r7676 r8083  
    3636package com.kitfox.svg;
    3737
     38import com.kitfox.svg.util.FontSystem;
    3839import com.kitfox.svg.xml.StyleAttribute;
    3940import java.awt.Graphics2D;
     
    168169    public void appendToShape(GeneralPath addShape, Point2D cursor) throws SVGException
    169170    {
    170 //        if (x != null)
    171 //        {
    172 //            cursorX = x[0];
    173 //        } else if (dx != null)
    174 //        {
    175 //            cursorX += dx[0];
    176 //        }
    177 //
    178 //        if (y != null)
    179 //        {
    180 //            cursorY = y[0];
    181 //        } else if (dy != null)
    182 //        {
    183 //            cursorY += dy[0];
    184 //        }
    185 
    186171        StyleAttribute sty = new StyleAttribute();
    187172
     
    203188        {
    204189            letterSpacing = sty.getFloatValueWithUnits();
     190        }
     191
     192        int fontStyle = 0;
     193        if (getStyle(sty.setName("font-style")))
     194        {
     195            String s = sty.getStringValue();
     196            if ("normal".equals(s))
     197            {
     198                fontStyle = Text.TXST_NORMAL;
     199            } else if ("italic".equals(s))
     200            {
     201                fontStyle = Text.TXST_ITALIC;
     202            } else if ("oblique".equals(s))
     203            {
     204                fontStyle = Text.TXST_OBLIQUE;
     205            }
     206        } else
     207        {
     208            fontStyle = Text.TXST_NORMAL;
     209        }
     210
     211        int fontWeight = 0;
     212        if (getStyle(sty.setName("font-weight")))
     213        {
     214            String s = sty.getStringValue();
     215            if ("normal".equals(s))
     216            {
     217                fontWeight = Text.TXWE_NORMAL;
     218            } else if ("bold".equals(s))
     219            {
     220                fontWeight = Text.TXWE_BOLD;
     221            }
     222        } else
     223        {
     224            fontWeight = Text.TXWE_NORMAL;
    205225        }
    206226
     
    210230        if (font == null)
    211231        {
    212             addShapeSysFont(addShape, font, fontFamily, fontSize, letterSpacing, cursor);
    213             return;
     232            font = new FontSystem(fontFamily, fontStyle, fontWeight, (int)fontSize);
     233//            addShapeSysFont(addShape, font, fontFamily, fontSize, letterSpacing, cursor);
     234//            return;
    214235        }
    215236
     
    275296    }
    276297
    277     private void addShapeSysFont(GeneralPath addShape, Font font,
    278         String fontFamily, float fontSize, float letterSpacing, Point2D cursor)
    279     {
    280 
    281         java.awt.Font sysFont = new java.awt.Font(fontFamily, java.awt.Font.PLAIN, (int) fontSize);
    282 
    283         FontRenderContext frc = new FontRenderContext(null, true, true);
    284         String renderText = this.text.trim();
    285 
    286         AffineTransform xform = new AffineTransform();
    287 
    288         float cursorX = (float)cursor.getX();
    289         float cursorY = (float)cursor.getY();
    290 //        int i = 0;
    291         for (int i = 0; i < renderText.length(); i++)
    292         {
    293             if (x != null && i < x.length)
    294             {
    295                 cursorX = x[i];
    296             } else if (dx != null && i < dx.length)
    297             {
    298                 cursorX += dx[i];
    299             }
    300 
    301             if (y != null && i < y.length)
    302             {
    303                 cursorY = y[i];
    304             } else if (dy != null && i < dy.length)
    305             {
    306                 cursorY += dy[i];
    307             }
    308 //            i++;
    309            
    310             xform.setToIdentity();
    311             xform.setToTranslation(cursorX, cursorY);
    312             if (rotate != null)
    313             {
    314                 xform.rotate(rotate[Math.min(i, rotate.length - 1)]);
    315             }
    316 
    317 //            String unicode = renderText.substring(i, i + 1);
    318             GlyphVector textVector = sysFont.createGlyphVector(frc, renderText.substring(i, i + 1));
    319             Shape glyphOutline = textVector.getGlyphOutline(0);
    320             GlyphMetrics glyphMetrics = textVector.getGlyphMetrics(0);
    321 
    322             glyphOutline = xform.createTransformedShape(glyphOutline);
    323             addShape.append(glyphOutline, false);
    324 
    325 
    326 //            cursorX += fontScale * glyph.getHorizAdvX() + letterSpacing;
    327             cursorX += glyphMetrics.getAdvance() + letterSpacing;
    328         }
    329        
    330         cursor.setLocation(cursorX, cursorY);
    331     }
     298//    private void addShapeSysFont(GeneralPath addShape, Font font,
     299//        String fontFamily, float fontSize, float letterSpacing, Point2D cursor)
     300//    {
     301//
     302//        java.awt.Font sysFont = new java.awt.Font(fontFamily, java.awt.Font.PLAIN, (int) fontSize);
     303//
     304//        FontRenderContext frc = new FontRenderContext(null, true, true);
     305//        String renderText = this.text.trim();
     306//
     307//        AffineTransform xform = new AffineTransform();
     308//
     309//        float cursorX = (float)cursor.getX();
     310//        float cursorY = (float)cursor.getY();
     311////        int i = 0;
     312//        for (int i = 0; i < renderText.length(); i++)
     313//        {
     314//            if (x != null && i < x.length)
     315//            {
     316//                cursorX = x[i];
     317//            } else if (dx != null && i < dx.length)
     318//            {
     319//                cursorX += dx[i];
     320//            }
     321//
     322//            if (y != null && i < y.length)
     323//            {
     324//                cursorY = y[i];
     325//            } else if (dy != null && i < dy.length)
     326//            {
     327//                cursorY += dy[i];
     328//            }
     329////            i++;
     330//           
     331//            xform.setToIdentity();
     332//            xform.setToTranslation(cursorX, cursorY);
     333//            if (rotate != null)
     334//            {
     335//                xform.rotate(rotate[Math.min(i, rotate.length - 1)]);
     336//            }
     337//
     338////            String unicode = renderText.substring(i, i + 1);
     339//            GlyphVector textVector = sysFont.createGlyphVector(frc, renderText.substring(i, i + 1));
     340//            Shape glyphOutline = textVector.getGlyphOutline(0);
     341//            GlyphMetrics glyphMetrics = textVector.getGlyphMetrics(0);
     342//
     343//            glyphOutline = xform.createTransformedShape(glyphOutline);
     344//            addShape.append(glyphOutline, false);
     345//
     346//
     347////            cursorX += fontScale * glyph.getHorizAdvX() + letterSpacing;
     348//            cursorX += glyphMetrics.getAdvance() + letterSpacing;
     349//        }
     350//       
     351//        cursor.setLocation(cursorX, cursorY);
     352//    }
    332353
    333354    public void render(Graphics2D g) throws SVGException
Note: See TracChangeset for help on using the changeset viewer.