Crate elefont

Source
Expand description

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.

Modules§

rusttype_provider

Structs§

Bounds
FontCache
The main structure for maintaing a cache of rendered glyphs
Glyph
The index of the font character to render
Metrics
The layout information for a glyph
TextureGlyph
The relevant information for a glyph stored on the texture

Enums§

CacheError
An error generated during a cache operation
PixelType
How the pixels of the rasterized font are represented

Traits§

FontProvider
Any object that can turn characters into glyphs and render them can be a FontProvider
Texture
Any object that can take the data for glyphs and store it over time