#font #glyph #font-rendering #gpu #rendered #handle #font-cache

no-std elefont

A library that handles caching rendered glyphs on the GPU

4 releases

0.1.3 Apr 11, 2020
0.1.2 Apr 5, 2020
0.1.1 Apr 5, 2020
0.1.0 Apr 4, 2020

#13 in #rendered

Download history 51/week @ 2023-11-27 41/week @ 2023-12-04 59/week @ 2023-12-11 70/week @ 2023-12-18 37/week @ 2023-12-25 24/week @ 2024-01-01 73/week @ 2024-01-08 59/week @ 2024-01-15 40/week @ 2024-01-22 27/week @ 2024-01-29 49/week @ 2024-02-05 62/week @ 2024-02-12 64/week @ 2024-02-19 84/week @ 2024-02-26 85/week @ 2024-03-04 83/week @ 2024-03-11

326 downloads per month
Used in quicksilver

MIT/Apache

395KB
326 lines

elefont

A library that handles caching rendered glyphs on the GPU

Elefont is a simple caching layer for a font rendering stack, which abstracts over both the font provider and the output format. It's intended for use mostly in games, but could serve in other applications as well.

Scope of this library:

  • DO support various font libraries / types of fonts (TTFs, bitmap fonts)
  • DO support whatever backend (rendering to an image, GPU frameworks, etc.)
  • DON'T handle complex tasks like shaping. The font stack should handle that elsewhere, and provide this library the glyphs to render
  • DON'T handle layout. This can be taken care of by the client application when rendering.

Support is available out-of-the-box for software rendering via image, rendering via rusttype, and performing automatic unicode normalization. All of these are optional features.


lib.rs:

A library that handles caching rendered glyphs on the GPU

This fits as a layer in your rendering pipeline between font rasterization and shaping and text rendering. In other words, first you turn a string into a series of font glyphs. Each of those glyphs is looked up against the cache, and if it hasn't been rendered, it is turned into a bitmap and uploaded to the GPU. The string is then laid out and rendered by the client application.

Scope of this library:

  • DO support various font libraries / types of fonts (TTFs, bitmap fonts)
  • DO support whatever backend (rendering to an image, GPU frameworks, etc.)
  • DON'T handle complex tasks like shaping. The font stack should handle that elsewhere, and provide this library the glyphs to render
  • DON'T handle layout. This can be taken care of by the client application when rendering.

Support is available out-of-the-box for software rendering via image, rendering via rusttype, and performing automatic unicode normalization. All of these are optional features.

Dependencies

~1–3.5MB
~30K SLoC