Skip to content

SVG to PNG conversion tries to call Windows EXE on Linux #1223

@inert-aesthetic

Description

@inert-aesthetic

Hello,

When trying to load an SVG resource, I encounter an error saying that msdfgen.exe could not be found.
This seems to originate from this line:
https://github.com/HeapsIO/heaps/blob/master/hxd/fs/Convert.hx#L404

command("msdfgen.exe", ["-svg", srcPath, "-size", '$size', '$size', "-autoframe", "-o", dstPath]);

To account for Linux systems, something like this could be considered.

class ConvertSVGToMSDF extends Convert {
	override function convert() {
		var size = hasParam("size") ? getParam("size") : 128;
		switch(Sys.systemName()){
			case "Windows":
				command("msdfgen.exe", ["-svg", srcPath, "-size", '$size', '$size', "-autoframe", "-o", dstPath]);
			case "Linux":
				command("inkscape", [srcPath, "-o", dstPath]);
			default:
				throw("No SVG to PNG converter specified.");
		}
	}

	static var _ = Convert.register(new ConvertSVGToMSDF("svg", "png"));
}

This is sufficient for my use-case but doesn't take size into account, and does throw an access violation from Hashlink.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions