Crate gfx_text [] [src]

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:

This example is not tested
// 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

Renderer

Text renderer.

RendererBuilder

Text renderer builder. Allows to set rendering options using builder pattern.

Enums

Error

General error type returned by the library. Wraps all other errors.

FontError

Represents possible errors which may occur during the font loading.

HorizontalAnchor

An anchor aligns text horizontally to its given x position.

VerticalAnchor

An anchor aligns text vertically to its given y position.

Functions

new

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