GNOME Bugzilla – Bug 451006
Custom Shape Sizing
Last modified: 2014-03-02 12:17:22 UTC
Please describe the problem: When creating custom shapes and loading them into sheets and then using the created shapes, the scaling is incorrect. For shapes with no textbox, the shapes are resized to 2cm height and for shapes with a textbox the shape seems to be doubled in size. This makes using the program very unsatisfing and slows productivty. Steps to reproduce: 1. Create a rectangle with a textbox 2. Export as custom shape 3. Add to a sheet 4. Use new shape in diagram 5. Observe behaviour Actual results: THe shape scale is incorrect, with a textbox is it too big, 2x size. Expected results: The shape should be the size speced by the xml shape file. Does this happen every time? Yes. Other information: Windows Platform. Example File: <?xml version="1.0" encoding="UTF-8"?> <shape xmlns="http://www.daa.com.au/~james/dia-shape-ns" xmlns:svg="http://www.w3.org/2000/svg"> <name>\ - Test</name> <icon>Test.png</icon> <connections> <point x="0.0" y="0.0"/> <point x="14.0" y="3.0"/> <point x="0.0" y="3.0"/> <point x="0.0" y="3.0"/> <point x="14.0" y="0.0"/> <point x="14.0" y="3.0"/> <point x="7.0" y="3.0"/> <point x="7.0" y="0.0"/> </connections> <aspectratio type="fixed"/> <textbox x1="3.0" y1="1.0" x2="11.0" y2="2.0"/> <svg:svg> <svg:rect style="fill: #ffffff" x="0.0" y="0.0" width="14.0" height="3.0"/> <svg:rect style="fill: none; fill-opacity:0; stroke-width: 0.1; stroke: #000000" x="0.0" y="0.0" width="14.0" height="3.0"/> </svg:svg> </shape>
The spec file doesn't really specify a size as such, merely a bunch of things that have their various sizes, including connections, textbox and the SVG. Getting all that to give a correct size is not trivial, especially when SVG is involved. At the same time, shape makers have not been considering the actual size of the object important, so some shapes may have overly large or small sizes. I also believe there's another bug reported about this problem. The fact that a textbox causes a different size is a problem which should be fixed. Trying with your shape, I see the difference based on the presence of the textbox. I just don't see a similar thing in any other shape, so I have little idea what could have caused this. It's not the aspect ratio or the particular coords you've used. BTW, I suggest using 'foreground' and 'background' instead of #ffffff and #000000, unless there's a strong reason to force the objects to be black and white.
Fixed by Lars. Fix will be included in version 0.97. Thanks for the bug report!
No, I just fixed the caching issue that was confusing us in examining the real problem, namely why the textbox appears to make the shape larger. Doesn't have anything to do with the connectionpoints or aspect ratio, AFAICT.
AFAIK resize_with_text is an option of Dia's textbox, general custom shape sizing is a difficult feature because it would apply to all those existing shape files which somewhat rely on fixed sizing. OTOH additional attributes could be used to have a reliable default size?
For a change to be made for 0.97 I would need either a patch or at least understand what the suggested change would be. From my understanding of http://svn.gnome.org/viewvc/dia/trunk/doc/custom-shapes?view=log the given shape works exactly as specified.
AFAICT obsoleted by the addition of default-width and default-height attributes.