Skip to content

tchayen/zig-text-rendering

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

zig-text-rendering

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.

Building

zig build

Running

zig build run

TODO

  • 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.

External

  • freetype - needed for plutosvg.
  • mach-freetype - Zig bindings for FreeType and HarfBuzz.
  • plutosvg - SVG rendering for OT SVG.
  • plutovg - dependency of plutosvg.
  • system-sdk - dependency of zgpu.
  • zglfw - Zig bindings for GLFW.
  • zgpu - Zig bindings for WebGPU.
  • zmath - 3D math library.
  • zpool - dependency of zgpu.

Links

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages