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

Build instructions #564

Open
ghost opened this issue Dec 11, 2022 · 9 comments
Open

Build instructions #564

ghost opened this issue Dec 11, 2022 · 9 comments

Comments

@ghost
Copy link

ghost commented Dec 11, 2022

Please consider adding build instructions to resvg and usvg showing people how to build a binary using rust/Cargo. (I tried for about 30 minutes before giving up.)

@RazrFalcon
Copy link
Owner

Sure. It should be as simple as: https://www.rust-lang.org/tools/install + cargo build --release

I will try to add it somewhere in the README.

Also, you cannot "build" usvg anymore. It's just a Rust library since the last release.

@ghost
Copy link
Author

ghost commented Dec 11, 2022

Also, you cannot "build" usvg anymore. It's just a Rust library since the last release.

Ah, that's too bad. I was looking for a way to clean up MermaidJS diagrams (see: mermaid-js/mermaid#2485) and usvg looked to be the only application that could do so.

And that would also explain why I couldn't produce a usvg binary.

Is it integrated with resvg? I looked through the help and didn't see a way to invoke the functionality.

Here's an example SVG file I was looking to 'simplify' in the hopes that it could render using EchoSVG:

mermaid

@ghost
Copy link
Author

ghost commented Dec 11, 2022

FWIW, I usually include a BUILD.md file in my apps that lists building requirements:

https://github.com/DaveJarvis/keenwrite/blob/main/BUILD.md

@RazrFalcon
Copy link
Owner

You could try using an older usvg version. Or even prebuilt one on the Releases page.

usvg CLI will eventually reemerge as a separate project. But for now there is nothing.

Yes, BUILD.md is a good idea!

@ghost
Copy link
Author

ghost commented Dec 11, 2022

Thank you!

mermaid

Unfortunately, the text is gone. Probably because MermaidJS uses some strange CSS variable magic that usvg doesn't recognize. This has nothing to do with building, just an FYI. Let me know if you'd like me to open a new ticket.

Thanks for the help.

@RazrFalcon
Copy link
Owner

Hm... this file is actually HTML pretending to be an SVG. See:

<foreignObject height="19" width="98.09375">
    <div style="display: inline-block; white-space: nowrap;" xmlns="http://www.w3.org/1999/xhtml">
        <span class="nodeLabel">Sharing ideas</span>
    </div>
</foreignObject>

This is not SVG. No SVG library would be able to render it, only browsers.

@ghost
Copy link
Author

ghost commented Dec 11, 2022

This is not SVG. No SVG library would be able to render it, only browsers.

I've integrated https://github.com/css4j/echosvg into KeenWrite. It can almost render the MermaidJS diagram correctly. I've also tried subjecting that snippet to a manual transform (something XSLT could do):

<g transform="translate(-40.0390625, -9.5)" style="" class="label">
  <text class="nodeLabel">Advocating</text>
</g>

That produces something semi-legible, at least:

mermaid-usvg

Of course, adding an XSLT processor is probably way beyond the purpose of usvg. Really, MermaidJS needs to emit pure SVG, instead of an SVG/HTML hybrid.

@RazrFalcon
Copy link
Owner

Yes, this is essentially not a bug, because it's not an SVG.

I never heard about EchoSVG, but Batik definitely fails.

@ghost
Copy link
Author

ghost commented Dec 11, 2022

Yes, this is essentially not a bug, because it's not an SVG.

Definitely. When the build instructions are updated, give me a shout and I'll review them then close this ticket.

(EchoSVG is a fork of Batik that is doing a great job at addressing Batik's failings.)

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