Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What determines the SVG font size? Different machines produce different results. #72

Open
hugobuddel opened this issue Nov 23, 2021 · 0 comments

Comments

@hugobuddel
Copy link

What determines the font size that is used when generating SVG figures?

We create some documentation, like class diagrams, going from classes to ditaa to SVG to tikz (a LaTeX figure). Most text in the SVG figures has font size 15, however, some text has size 14 or 13. The figures are mostly text in boxes, and it is roughly the case that a smaller font size is selected in order to fit text in the box (text with many Ms and Ws often has a smaller font size than text with many Is). The main problem for us is that different machines produce different results. Which means that currently we can only consistently create figures on one particular machine.

I've not yet been able to determine what influences the font size being used. As in, I tried to create a Docker container that matches the other machine as closely as I could, but it still produces different results, so I'm probably missing something.

Attached differentsizes.zip with a ditaa file and two svg files (apparently these cannot be uploaded to github directly). The diff (machine1 is the main machine, machine2 a docker container, both Ubuntu 20.04):

diff ApplyAstrom.machine1.svg ApplyAstrom.machine2.svg 
24,27c24,27
<     <text x='40' y='166' font-family='Courier' font-size='13' stroke='none' fill='#ffffff' ><![CDATA[ASTROM_HDR]]></text>
<     <text x='280' y='68' font-family='Courier' font-size='15' stroke='none' fill='#ffffff' ><![CDATA[DETRENDFINALAI_IMG or]]></text>
<     <text x='280' y='82' font-family='Courier' font-size='14' stroke='none' fill='#ffffff' ><![CDATA[DETRENDFINAL_IMG]]></text>
<     <text x='335' y='250' font-family='Courier' font-size='15' stroke='none' fill='#ffffff' ><![CDATA[apply_astrom]]></text>
---
>     <text x='41' y='166' font-family='Courier' font-size='14' stroke='none' fill='#ffffff' ><![CDATA[ASTROM_HDR]]></text>
>     <text x='280' y='69' font-family='Courier' font-size='15' stroke='none' fill='#ffffff' ><![CDATA[DETRENDFINALAI_IMG or]]></text>
>     <text x='280' y='83' font-family='Courier' font-size='15' stroke='none' fill='#ffffff' ><![CDATA[DETRENDFINAL_IMG]]></text>
>     <text x='341' y='251' font-family='Courier' font-size='15' stroke='none' fill='#ffffff' ><![CDATA[apply_astrom]]></text>

Both files are created through

java -jar ditaa-0.11.0-standalone.jar "ApplyAstrom.ditaa" -E --no-shadows --svg "ApplyAstrom.svg"

My guess is that it has something to do with the exact font that is being used. But I don't understand what font exactly is chosen or how. So maybe the font size can be made consistent by using --svg-font-url, but I don't understand how to use that either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant