compat.msdfgen
#includemsdfgen — multi-channel signed distance field generator (core + FreeType import)
#include <msdfgen/msdfgen.h>
mcpp add compat.msdfgen@1.13
Usage
From this repository's own test project — built and run by CI, not written for the website.
// compat.msdfgen — generate a real multi-channel signed distance field and
// assert its contents, not just that the library links.
//
// The shape is a square built by hand, so the test needs no font file and no
// ext/ importer. What makes the assertions real:
// * the field must be signed -- inside the square the distance is positive,
// outside it is negative. A blank or all-zero bitmap fails both.
// * edge colouring must have run, otherwise the three channels are identical
// and the "multi-channel" part of MSDF did nothing.
//
// The `msdfgen/` include prefix is the one this package generates; using it
// here is what keeps the shim covered by CI.
#include <msdfgen/msdfgen.h>
#include <msdfgen/msdfgen-ext.h>
import std;
int main() {
bool ok = true;
auto check = [&](bool cond, std::string_view what) {
if (!cond) {
std::println("FAIL: {}", what);
// …
tests/examples/msdfgen/tests/generate.cpp · project tests/examples/msdfgen
Build
- targets
msdfgen (lib)- language
c++23- import std
- no
- include dirs
*, mcpp_generated
Sources (2)
*/core/*.cpp*/ext/import-font.cpp
Generated files
mcpp_generated/msdfgen/msdfgen-ext.hmcpp_generated/msdfgen/msdfgen-config.hmcpp_generated/msdfgen/msdfgen.h