compat.msdfgen
#includemsdfgen — multi-channel signed distance field generator (core + FreeType import)
#include <msdfgen/msdfgen.h>
mcpp add compat.msdfgen@1.13
用法
来自本仓库自己的测试项目 —— CI 真的编译并运行过,不是为了网站写的。
// 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 · 项目 tests/examples/msdfgen
构建
- targets
msdfgen (lib)- language
c++23- import std
- no
- include dirs
*, mcpp_generated
源文件 (2)
*/core/*.cpp*/ext/import-font.cpp
生成的文件
mcpp_generated/msdfgen/msdfgen-ext.hmcpp_generated/msdfgen/msdfgen-config.hmcpp_generated/msdfgen/msdfgen.h