skanaar / nomnoml

The sassy UML diagram renderer
https://www.nomnoml.com
MIT License
2.66k stars 208 forks source link

low dpi in downloaded image, can we download svg? #76

Closed beppe9000 closed 5 years ago

skanaar commented 5 years ago

The SVG renderer is not 100% implemented yet (for example the classifiers are not rendered correctly). That is the only thing standing in our way of downloading SVG.

beppe9000 commented 5 years ago

ok, so this will be fixed eventually

ronkok commented 5 years ago

It appears that the SVG renderer's measureText function could use some improvement in its measurement of string width. Could you create a dummy canvas context and use it for nothing but ctx.measureText(text)?

Are there any other SVG issues and would you be interested in a pull request?

skanaar commented 5 years ago

Yes, pull requests are most welcome 😄

When SVG is exported and shared we can no longer be sure which fonts it will be rendered with. So exactly measure the text size in one environment will not necessarily match the sizes when the SVG is actually viewed.

That is why I use a heuristic instead of more exact measurements.

Additionally, in a browser you can spin up a canvas to measure the text, but on a server (in a node.js environment) that is not readily available.

There is a discussion about these things here (closed issue): https://github.com/skanaar/nomnoml/issues/49

ronkok commented 5 years ago

Okay, I'll move the discussion to the other thread.

skanaar commented 5 years ago

Happy to say that this is now released! Thanks for all the help.