Skip to content
modkitv0.2

Slug curve-based glyph rendering

← All examples73_slug

Slug evaluates each glyph's Bezier outlines analytically in the fragment shader instead of sampling a baked atlas. The point of this example is the zoom control: drag it up and MTSDF hits its resolution ceiling and goes soft, while Slug stays exact, because one copy of the curve data serves every size with no re-bake. It is not free. Slug loops over curves per pixel, so at UI sizes MTSDF is cheaper and looks better (it is hinted). The stats panel shows the cost so the trade-off is visible rather than implied. Both a TrueType face (quadratic outlines) and a CFF/OTF one (cubics, which Slug subdivides) are loaded, since those are different code paths. ./scripts/build-linux.sh --slug --shaping --target=73_slug --run Controls: mouse wheel or [ / ] = zoom, Tab = switch font, S = toggle side-by-side, C = cycle render style, O = background, ESC = quit.

Slug curve-based glyph rendering

Runs the WebAssembly build on this page. Click the canvas to give it keyboard focus.

Number
73
Tags
textsluginputshadersuiimguilayout
Requires
MODKIT_ENABLE_SLUG
Capture frame
30
Source
examples/73_slug/main.c

Build and run

./scripts/build-linux.sh release --target=73_slug --run