Controlling precision of generated floats in svg

0 votes
asked Jul 15, 2020 in Question / help by baerrach2 (220 points)

I'm building a gastby plugin to integrate plantuml with their remark/mdx generation.

See https://github.com/baerrach/gatsby-remark-plantuml

Everything works fine.

My test cases are storing the generated svg's to do textual diffs against to check for bugs.

On two different windows machines using the same version of Java:

$ java -version
java version "1.8.0_261"
Java(TM) SE Runtime Environment (build 1.8.0_261-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.261-b12, mixed mode)

will produces different results.

Here is just one example:

    - <g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 226.9)\">
    + <g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 226.895)\">


You can see the precision in the translate, in the original file was "226.9" and in the newly generated file "226.895"

I've downloaded the code and had a quick look but its too much for me to locate how the output is generated.

I can see no option available to limit the output precision so that I would have more chances of getting stable output for diff comparison.

Is this something that I can force plantuml to do?

commented Jan 14, 2023 by The-Lu (64,760 points)

Hello PlantUML team,

On the pseudo-same topic, and on a SVG output.

  • Is it necessary or not to have a lot of digits of precision of 'stroke-width', on SVG output?

As :

<ellipse cx="115.8854" cy="20.8333" fill="#0073BB" rx="10.4167" ry="10.4167" style="stroke:#222222;stroke-width:1.0416666666666667;"/>
<rect fill="url(#g1nd6nmen8zrr50)" height="45.8008" rx="4.1667" ry="4.1667" style="stroke:#EC7211;stroke-width:0.5208333333333334;" width="51.0417" x="90.3646" y="52.0833"/>

Example:

Is it possible to reduce the precision or not?

Regards.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:

[Antispam2 Feature: please please wait 1 or 2 minutes (this message will disappear) before pressing the button otherwise it will fail](--------)
To avoid this verification in future, please log in or register.
...