svg-flatten: Fix document scale with newer USVG

This commit is contained in:
jaseg 2025-01-22 15:25:05 +01:00
parent 05d4b0195f
commit 302d7d3db7
2 changed files with 6 additions and 1 deletions

View file

@ -60,7 +60,7 @@ bool gerbolyze::SVGDocument::load(istream &in, double scale) {
/* Set up the document's viewport transform */
istringstream vb_stream(root_elem.attribute("viewBox").value());
vb_stream >> vb_x >> vb_y >> vb_w >> vb_h;
if (vb_stream.eof() || vb_stream.fail()) {
if (vb_stream.fail()) {
if (root_elem.attribute("viewBox")) { /* A document with just width/height and no viewBox is okay. */
cerr << "Warning: Invalid viewBox, defaulting to width/height values" << endl;
}

View file

@ -94,6 +94,11 @@ int gerbolyze::run_cargo_command(const char *cmd_name, std::vector<std::string>
if (proc_rc) {
std::cerr << cmd_name << " returned an error code: " << proc_rc << std::endl;
std::cerr << "Command line:";
for (auto elem:cmdline) {
std::cerr << " " << elem;
}
std::cerr << std::endl;
return EXIT_FAILURE;
}