Menu

#12 Title box too small when using command line

open
nobody
None
5
2009-03-30
2009-03-30
apb2006
No

When using sdedit from the command line an initial title box is too drawn small and chops the text.
When using the UI it correct.

---Sample sd file a.sd -------
#![aa bb bbbb bbbb bbbbbb bbbbb]
adminApplet:Actor
clientApplet:Actor
servers:Server[p] "servers"
autotrader:Actor

*101 clientApplet
xx fffff ffff.
*101
clientApplet:servers.xxxxxx
servers:clientApplet.yyyyyy
-------------
Command line:
java -jar sdedit-3.0.5.jar -tgif -ocmd.gif a.sd

Attachment shows gif files produced by command line and UI export.

Discussion

  • apb2006

    apb2006 - 2009-03-30
     
  • Markus Strauch

    Markus Strauch - 2009-03-30

    In both cases the same logic is used to draw the diagram, using java.awt.Graphics.getFontMetrics to determine the width and height of text.

    The problem is that the Freehep implementations of java.awt.Graphics do not seem to provide correct implementations of this method.

    Maybe somebody could find out the degree of deviance for each format. If it turns out to be a constant (given a format), the problem could quite easily be solved by, roughly spoken, overriding that method.

     
  • Darko Lombardo

    Darko Lombardo - 2010-08-10

    It hapens also with the PS, EPS format, but not the PNG format.

     
  • Darko Lombardo

    Darko Lombardo - 2010-08-10

    I have reviewed the code and I found a little misstype.

    Proposed patch in file:

    server\ExporterImpl.java

    Add:
    import java.awt.Font;

    Change:

    @Override
    protected Graphics2D createDummyGraphics(boolean bold) {
    dim = new Dimension(1,1);
    return getGraphics();
    }

    To:

    @Override
    protected Graphics2D createDummyGraphics(boolean bold) {
    dim = new Dimension(1,1);
    vg = getGraphics();

    Font font = getFont(bold);
    vg.setFont(font);

    return vg;
    }

    I have changed it and tested the new build - it seems to work.

    Kind regards,
    Darko

     

Log in to post a comment.

MongoDB Logo MongoDB