Skip to content

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

@hugobuddel

Description

@hugobuddel

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions