Crate gfx_text

source ·
Expand description

A library for drawing text for gfx-rs graphics API. Uses freetype-rs underneath to former the font bitmap texture and collect information about face glyphs.

Examples

Basic usage:

// Initialize text renderer.
let mut text = gfx_text::new(factory).build().unwrap();

// In render loop:

// Add some text 10 pixels down and right from the top left screen corner.
text.add(
    "The quick brown fox jumps over the lazy dog",  // Text to add
    [10, 10],                                       // Position
    [0.65, 0.16, 0.16, 1.0],                        // Text color
);

// Draw text.
text.draw(&mut stream);

Structs

Enums

  • General error type returned by the library. Wraps all other errors.
  • Represents possible errors which may occur during the font loading.
  • An anchor aligns text horizontally to its given x position.
  • An anchor aligns text vertically to its given y position.

Functions

  • Create a new text renderer builder. Alias for RendererBuilder::new.