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

Rendering issue with nomnoml #1375

Open
arisolt opened this issue Nov 9, 2022 · 5 comments
Open

Rendering issue with nomnoml #1375

arisolt opened this issue Nov 9, 2022 · 5 comments

Comments

@arisolt
Copy link

arisolt commented Nov 9, 2022

The following code renders correctly on https://www.nomnoml.com/, but not on kroki, so I assume this is a kroki specific issue.

#font: iA Writer Duo V
[construct|abstraction of higher degree] <- [abstraction]

Screenshot 2022-11-09 at 05 39 46
Screenshot 2022-11-09 at 05 39 39

@ggrossetie
Copy link
Member

This is a font discrepancy issue, similar to #1345
nomnoml.com runs in your browser using fonts available on your system. When you are using Nomnoml server-side it will use fonts available on the server (where "iA Writer Duo V" is not available).

On my system the same definition renders as:

image

The root cause is that <text> elements in SVG are rendered client-side (using fonts available on your system) whereas Nomnoml computes box sizes using fonts available server-side.

The only workaround is to convert <text> to <path> (for instance using https://github.com/shrhdk/text-to-svg) but this change must be done upstream.

@arisolt
Copy link
Author

arisolt commented Nov 10, 2022

Nomnoml computes box sizes using fonts available server-side.

I am getting the same outcome on https://kroki.io/, which continues to work (i.e editing the definition updates the rendering preview accordingly) even after blocking Internet access to the browser via firewall. This suggests that kroki.io computes everything client-side, with the rendering issue persisting.

I also identified a second rendering issue for the following definition. The #edges directive appears to be ignored on kroki.io, while on nomnoml.com it works as expected. I'm not sure if the two issues are related. Perhaps nomnoml might be using a different version of the library which added support for the edges directive + enhanced support for local fonts?

#edges: rounded
#spacing: 50

[a] -> [b]
[a] -> [c]
[a] -> [d]
[a] -> [e]
[a] -> [f]

Screenshot 2022-11-10 at 02 00 34
Screenshot 2022-11-10 at 02 00 41

@ggrossetie
Copy link
Member

I am getting the same outcome on kroki.io, which continues to work (i.e editing the definition updates the rendering preview accordingly) even after blocking Internet access to the browser via firewall. This suggests that kroki.io computes everything client-side, with the rendering issue persisting.

Images are cached by your browser.
kroki.io does not compute anything client-side.

You can see the same effect on nomnoml.com when the SVG is generated server-side: https://nomnoml.com/image.svg?source=%23font%3A%20iA%20Writer%20Duo%20V%0A%5Bconstruct%7Cabstraction%20of%20higher%20degree%5D%20%3C-%20%5Babstraction%5D

I also identified a second rendering issue for the following definition. The #edges directive appears to be ignored on kroki.io, while on nomnoml.com it works as expected. I'm not sure if the two issues are related. Perhaps nomnoml might be using a different version of the library which added support for the edges directive + enhanced support for local fonts?

Probably, we are currently using version 1.5.1. The latest version is 1.5.2

@ggrossetie
Copy link
Member

I also identified a second rendering issue for the following definition. The #edges directive appears to be ignored on kroki.io, while on nomnoml.com it works as expected. I'm not sure if the two issues are related. Perhaps nomnoml might be using a different version of the library which added support for the edges directive + enhanced support for local fonts?

I take it back, it seems that this feature is only supported client-side. See: https://nomnoml.com/image.svg?source=%23edges%3A%20rounded%0A%23spacing%3A%2050%0A%0A%5Ba%5D%20-%3E%20%5Bb%5D%0A%5Ba%5D%20-%3E%20%5Bc%5D%0A%5Ba%5D%20-%3E%20%5Bd%5D%0A%5Ba%5D%20-%3E%20%5Be%5D%0A%5Ba%5D%20-%3E%20%5Bf%5D

@arisolt
Copy link
Author

arisolt commented Nov 11, 2022

oh ok. will reach out to nomnoml then and see why the inconsistency between client/server-side rendering. thanks for looking into it!

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

No branches or pull requests

2 participants