Changeset 14361 in josm for trunk/src/com/kitfox


Ignore:
Timestamp:
2018-10-25T22:03:02+02:00 (6 years ago)
Author:
Don-vip
Message:

see #14319, see #16838 - fix another NPE / regression from svgSalamander 1.1.2 (causing unit test failure in DXF plugin)

see https://github.com/blackears/svgSalamander/pull/34

File:
1 edited

Legend:

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

    r14331 r14361  
    44 * All rights reserved.
    55 *
    6  * Redistribution and use in source and binary forms, with or 
     6 * Redistribution and use in source and binary forms, with or
    77 * without modification, are permitted provided that the following
    88 * conditions are met:
    99 *
    10  *   - Redistributions of source code must retain the above 
     10 *   - Redistributions of source code must retain the above
    1111 *     copyright notice, this list of conditions and the following
    1212 *     disclaimer.
    1313 *   - Redistributions in binary form must reproduce the above
    1414 *     copyright notice, this list of conditions and the following
    15  *     disclaimer in the documentation and/or other materials 
     15 *     disclaimer in the documentation and/or other materials
    1616 *     provided with the distribution.
    1717 *
     
    2727 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    2828 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
    29  * OF THE POSSIBILITY OF SUCH DAMAGE. 
    30  * 
     29 * OF THE POSSIBILITY OF SUCH DAMAGE.
     30 *
    3131 * Mark McKay can be contacted at mark@kitfox.com.  Salamander and other
    3232 * projects can be found at http://www.kitfox.com
     
    3636package com.kitfox.svg;
    3737
    38 import com.kitfox.svg.util.FontSystem;
    39 import com.kitfox.svg.xml.StyleAttribute;
    4038import java.awt.Graphics2D;
    4139import java.awt.Shape;
     
    4543import java.awt.geom.Point2D;
    4644import java.awt.geom.Rectangle2D;
     45
     46import com.kitfox.svg.util.FontSystem;
     47import com.kitfox.svg.xml.StyleAttribute;
    4748
    4849/**
     
    229230        //Get font
    230231        Font font = diagram.getUniverse().getFont(fontFamily);
    231         if (font == null)
     232        if (font == null && fontFamily != null)
    232233        {
    233234            font = FontSystem.createFont(fontFamily, fontStyle, fontWeight, (int)fontSize);
     
    243244        float cursorX = (float)cursor.getX();
    244245        float cursorY = (float)cursor.getY();
    245    
     246
    246247        String drawText = this.text;
    247248        drawText = drawText.trim();
     
    255256                cursorX += dx[i];
    256257            }
    257            
     258
    258259            if (y != null && i < y.length)
    259260            {
     
    263264                cursorY += dy[i];
    264265            }
    265            
     266
    266267            xform.setToIdentity();
    267268            xform.setToTranslation(cursorX, cursorY);
     
    322323//            }
    323324////            i++;
    324 //           
     325//
    325326//            xform.setToIdentity();
    326327//            xform.setToTranslation(cursorX, cursorY);
     
    342343//            cursorX += glyphMetrics.getAdvance() + letterSpacing;
    343344//        }
    344 //       
     345//
    345346//        cursor.setLocation(cursorX, cursorY);
    346347//    }
     
    351352        float cursorX = 0;
    352353        float cursorY = 0;
    353    
     354
    354355        if (x != null)
    355356        {
     
    439440        float cursorX = 0;
    440441        float cursorY = 0;
    441    
     442
    442443        FontRenderContext frc = g.getFontRenderContext();
    443444
Note: See TracChangeset for help on using the changeset viewer.