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

SVG standard informations (size & line breaks) #202

Closed
Daryes opened this issue Sep 24, 2018 · 9 comments
Closed

SVG standard informations (size & line breaks) #202

Daryes opened this issue Sep 24, 2018 · 9 comments

Comments

@Daryes
Copy link

Daryes commented Sep 24, 2018

version : latest release (v1.4.3)

Currently, the SVG rendering, while working fine, seems to lack some information to have the same rendering as the png format

  • the header <svg xmlns="" ...> seems to be lacking the height and width and/or the viewBox. While it doesn't stop the browsers to render the files, some converter tools doesn't always plays ball when such information is missing

  • the line break between each directory name and the used space isn't supported as is.
    For example, this doesn't work, the text is rendered on a single line :

<text x='339' y='364' font-size='8pt' fill='black' stroke-width='0'>modules
60.6M</text>

On the other hand, using tspan with dy used for a relative vertical placement works :

<text x='339' y='364' font-size='8pt' fill='black' stroke-width='0'>
<tspan x="339" dy="0">modules</tspan>
<tspan x="339" dy="1.2em">60.6M</tspan>
</text>

nb : presented as multi-line for the example, but a single line is also valid, the line break comes from the <tspan ... dy="xx"> tag.

Could both be implemented ? Especially the tspan, as it helps with the readability.

@zevv
Copy link
Owner

zevv commented Sep 24, 2018 via email

@Daryes
Copy link
Author

Daryes commented Sep 24, 2018

I'm compiling using usually the tgz releases. Can try directly from master, still.

Anyway, Cairo is the weak link here, at least for my purpose :

  • on systems with X11 installed, I'm rendering to PNG using cairo.
  • on headless servers, because cairo requirements are linked to too much X11 libs packages on debian/ubuntu, the output is using the SVG format with a dedicated binary built with --disable-x11 --disable-cairo.

Because of that, the native SVG rendered in Duc is clearly appreciated, and is a nice complement to the monitoring for pinpointing files stealing disk space.

@zevv
Copy link
Owner

zevv commented Sep 25, 2018 via email

@zevv
Copy link
Owner

zevv commented Sep 25, 2018

Implemented in dd4db66

SVG attached, does this look ok to you?

duc-svg.zip

@Daryes
Copy link
Author

Daryes commented Sep 26, 2018

Tested it with both the svg generation and IM convert and the result is much better, without the need to fiddle with additional parameters.

One last thing I just found, related to having 2 lines for both black and white text.
fill='black' paint-order='stroke' stroke='white' would do the same in a single line, but paint-order doesn't play well with older navigator.

Playing with this, I found that using stroke-opacity for the white line declaration gives a much readable text, and a very close result to the Cairo PNG generator :

<text x='369' y='348' font-size='8pt' stroke='white' stroke-width='3' stroke-opacity='0.5'>
 <tspan x='369' dy='0.0em'>firmware</tspan>
 <tspan x='369' dy='1.2em'>41.8M</tspan>
</text>
<text x='369' y='348' font-size='8pt' fill='black'>
 <tspan x='369' dy='0.0em'>firmware</tspan>
 <tspan x='369' dy='1.2em'>41.8M</tspan>
</text>

The changes are on the white line : +1 for the stroke-width and stroke-opacity='0.5' added.
On the other hand, unless I'm mistaken, stroke-width has no effect for the black line without a color for stroke. I didn't see any difference with Firefox and both IE versions

@zevv
Copy link
Owner

zevv commented Sep 26, 2018 via email

@Daryes
Copy link
Author

Daryes commented Sep 28, 2018

Updated the binary, working fine, thank you.

Btw, could you generate a new release ? the last one is 1 year and a half old.

@zevv
Copy link
Owner

zevv commented Sep 28, 2018 via email

@zevv
Copy link
Owner

zevv commented Sep 28, 2018

1.4.4 is released.

@zevv zevv closed this as completed Sep 28, 2018
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

2 participants