Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

text-renderer

A TrueType font renderer. Parses glyph outline data out of the font file and reconstructs each glyph's contours as quadratic Bezier curves, rendered using Bevy.

Built as a learning project to understand how fonts actually encode glyph shapes, and how a rendering engine turns that raw outline data into something drawn on screen. Inspired by Sebastian Lague's video on Text Rendering.

Showcase

glyph rendering example debug view showing contour points

What it does

  • Parses .ttf files
  • Reconstructs each glyph's outline from the raw contour point data, stitching points together into quadratic Bezier curve segments
  • Renders the resulting glyph shapes using Bevy

Controls

  • Click — move around the viewport
  • Scroll wheel — zoom in on a glyph
  • Caps Lock — toggle debug mode, showing all contour points and how they connect to form each glyph

Notes

  • TrueType fonts don't store glyph outlines as simple line segments, they store a set of on-curve and off-curve points, and the actual curve shape has to be reconstructed from that point data according to the format's rules (including implied on-curve points between consecutive off-curve points). Parsing that directly out of the binary font format, and turning it into properly stitched quadratic Bezier segments, was the core challenge here. The debug mode (Caps Lock) exists specifically to visualize that reconstruction, seeing the raw contour points and how they get connected into curves.

  • Rendering is handled through Bevy, which is a full game engine. A lighter weight renderer would be the better choice for this

About

Rendering Text by parsing TrueType font files

Resources

Stars

2 stars

Watchers

1 watching

Forks

Used by

Contributors

Languages