I want to write a build step that will use msdf-atlas-gen tool (https://github.com/Chlumsky/msdf-atlas-gen)
I have two build options that are passed to the tool:
font_filename and font_size.
The question is: How can I handle absence of the build options?
My current implementation looks like this:
const font_size = b.option(u16, "font_size", "Size of glyph in font atlas generated with msdf-atlas-gen");
const msdf_atlas_gen = b.addSystemCommand(&.{"msdf-atlas-gen"});
if (font_filename != null and font_size != null) {
msdf_atlas_gen.addArgs(&.{
b.fmt("-font {s}.ttf", .{font_filename.?}),
b.fmt("-size {}", .{font_size.?}),
"-type msdf",
"-yorigin top",
b.fmt("-imageout {s}.png", .{font_filename.?}),
b.fmt("-json {s}.json", .{font_filename.?}),
"-charset assets/charset.txt",
"-uniformgrid",
"-uniformorigin on",
"-pxpadding 4",
});
}
const atlas_gen = b.step("atlas_gen", "Generate .png font atlas and .json metrics data using msdf-atlas-gen");
atlas_gen.dependOn(&msdf_atlas_gen.step);```