glyphon

Fast, simple 2D text rendering for wgpu, handling glyph shaping, atlas packing, and GPU drawing.

Library
Cargo
v0.12.0
749stars
MIT OR Apache-2.0 OR Zlib

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
61/100Good
Development Activity48
Maintenance40
Community60
Maturity56
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
80/100Excellent
Architecture82
Code Quality78
Innovation78
Learning Curve62

glyphon is a small Rust crate that provides a fast, simple way to render 2D text on the GPU with wgpu. It ties together cosmic-text for shaping, layout, and rasterization, etagere for packing glyphs into a texture atlas, and wgpu for sampling from that atlas to draw the final text.

To avoid extra render passes, glyphon follows the middleware pattern and renders inside your existing wgpu render passes, making it easy to drop text into games, GUIs, and other GPU-accelerated applications.

What You Get

  • GPU-accelerated 2D text rendering built directly on wgpu
  • Glyph shaping, layout, and rasterization via cosmic-text
  • A dynamic texture atlas that packs rasterized glyphs with etagere
  • Middleware-style rendering that reuses your existing wgpu render passes
  • A small, focused API with runnable examples for common cases

Common Use Cases

  • Drawing UI and HUD text in wgpu-based games and engines
  • Rendering labels and captions in GPU-accelerated visualization tools
  • Adding text to custom cross-platform GUI frameworks built on wgpu
  • Displaying dynamic, frequently-updated text without extra render passes

Under The Hood

Architecture - glyphon is a single-crate library whose pipeline flows through a few core types in src: a TextAtlas holds the wgpu texture atlas, a TextRenderer prepares vertex data and issues draw calls, and buffers from cosmic-text supply shaped glyph runs. Rasterized glyphs are packed into the atlas with etagere, then sampled during the render pass following wgpu’s middleware pattern so no dedicated pass is required.

Tech Stack - Written in Rust (edition 2021, MSRV 1.92), it depends on wgpu 30 for GPU access, cosmic-text 0.19 for shaping and rasterization, etagere for atlas allocation, and lru plus rustc-hash for glyph caching. Dev-dependencies include winit, resvg, pollster, and criterion for examples and benchmarks.

Code Quality - The crate keeps a tight surface area with example programs under examples/ and integration-style tests under tests/ (hello-world, custom glyphs, ligatures, text sizes) plus a criterion benchmark for the prepare step, giving practical coverage of the public API. CI runs on GitHub Actions.

API Design - The public API is deliberately minimal — construct an atlas and renderer, prepare buffers, then render — which lowers the boilerplate needed to get text on screen. Triple-licensing (MIT/Apache-2.0/Zlib) and docs.rs documentation make it easy to adopt, though users still need familiarity with wgpu’s render-pass model.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search