o
odin.langpkg.dev
packages / binding / msdf-gen-odin

msdf-gen-odin

754f273binding

Odin bindings for https://github.com/Chlumsky/msdfgen

MIT · updated 5 months ago

msdfgen-odin

Odin bindings for msdfgen, with a local bridge layer for:

  • Core C API usage.
  • TTF glyph loading (FreeType) and PNG output via msdfgen-ext.

lib/msdfgen is an unmodified git submodule to keep it isolated. Bridge code between msdfgen and the odin bindings lives in bridge/.

Dependencies

Linux

  • CMake 3.15+
  • C++ compiler (g++/clang++)
  • Odin compiler
  • FreeType development package
  • libpng development package

Windows (MSVC)

  • CMake 3.15+
  • MSVC C++ toolchain (cl.exe, link.exe, lib.exe)
  • Odin compiler
  • FreeType and libpng libraries discoverable by CMake/toolchain
  • Run from a VS developer shell, or otherwise ensure CMake + MSVC are in PATH

Build

The underlying msdfgen library and the C bridge code need to be built with CMake. Several optional dependencies are excluded.

git submodule update --init --recursive

cmake -S lib/msdfgen -B lib/msdfgen/build -DMSDFGEN_CORE_ONLY=OFF -DMSDFGEN_USE_VCPKG=OFF -DMSDFGEN_DISABLE_SVG=ON -DMSDFGEN_USE_SKIA=OFF -DCMAKE_BUILD_TYPE=Release
cmake --build lib/msdfgen/build --config Release

Expected bridge artifacts:

  • Windows: build/Release/msdfgen-c.lib, build/Release/msdfgen-ext-c.lib
  • Linux: build/libmsdfgen-c.a, build/libmsdfgen-ext-c.a

Run Demo

The demo loads a TTF font, generates MSDF for glyph 'A', and writes demo-msdf-A.png.

odin run demo