Basic setup of libraries for:
- WebGPU graphics
- FreeType font rendering with HarfBuzz shaping
Following zig-gamedev - I am using its libraries - this project uses Zig 0.13.0-dev.351+64ef45eb0 (locally managing it using zigup).
NOTE: this is WIP, publishing this repo to gather feedback and opinions but the results are not satisfactory yet.
NOTE: for some reason Dawn is crashing a lot on macOS (at least for me). I saw some people having the same issue, I had the same issue in C++ with Dawn, I had it with other Dawn bindings for Zig so it looks like a Dawn issue. I don't have any reliable solution for this – I just developed most of this project on Windows.
zig build
zig build run
- Margins between characters in the atlas (to fix bleeding).
- Splitting shaping into ranges handled by different fonts.
- ICU4X for line breaking link.
- Devanagari shaping seems incorrect - नमस्ते is rendering as "नमस् ते". Rework how glyphs are stored so that whole font is used not just glyphs with direct unicode mapping. This is causing ligatures to be missing.
- Unless Devanagari script is selected in HarfBuzz, it will use wrong ligatures. Figure out how to select script automatically.
- Ranges seem to have off-by-one errors – missing last character in each one.
- Debug why arabic breaks font atlas (it was overlapping indexes between font faces).
- Retina support.
- OT SVG hooks.
- SVG rendering.
- Consider replacing atlas packing algorithm with skyline bottom-left.
- Caching font atlas (texture and binary data).
- Fix icu4zig compilation on Windows.
- Detect if given unicode character is already present in the atlas and skip it. This is a solution for all font faces including latin alphabet.
- Proper line breaking.
- (optionally) contribute missing errors to
mach-freetype
. - Different text sizes in the atlas.
- Text selection.
freetype
- needed forplutosvg
.mach-freetype
- Zig bindings for FreeType and HarfBuzz.plutosvg
- SVG rendering for OT SVG.plutovg
- dependency ofplutosvg
.system-sdk
- dependency ofzgpu
.zglfw
- Zig bindings for GLFW.zgpu
- Zig bindings for WebGPU.zmath
- 3D math library.zpool
- dependency ofzgpu
.
- Overview of text rendering on Linux
- HarfBuzz example
- HarfBuzz example
- FreeType and HarfBuzz in Zig
- FreeType and HarfBuzz used in Mach engine
- ImGUI WebGPU backend
- ImGUI usage of FT (includes color fonts via OT SVG hooks)
- Pseucode for doing fonts fallback in HB
- Docs on SVG hooks in FT
- Docs on SVG fonts in FT
- Note on COLRv1
- Pseudocode of COLRv1 renderer
- A tool for converting SVG emojis to COLRv1