Title box too small when using command line
Brought to you by:
sdedit
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.
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.
It hapens also with the PS, EPS format, but not the PNG format.
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