Crates.io | rusttype |
lib.rs | rusttype |
version | 0.9.3 |
source | src |
created_at | 2016-02-05 17:24:38.164341 |
updated_at | 2022-11-02 15:25:50.237708 |
description | A pure Rust alternative to libraries like FreeType. RustType provides an API for loading, querying and rasterising TrueType fonts. It also provides an implementation of a dynamic GPU glyph cache for hardware font rendering. |
homepage | https://gitlab.redox-os.org/redox-os/rusttype |
repository | https://gitlab.redox-os.org/redox-os/rusttype |
max_upload_size | |
id | 4087 |
size | 112,168 |
RustType is a pure Rust alternative to libraries like FreeType.
The current capabilities of RustType:
*.ttf
as well as *.otf
font files.gpu_cache
module. This keeps
recently used glyph renderings in a dynamic cache in GPU memory to minimise
texture uploads per-frame. It also allows you keep the draw call count for
text very low, as all glyphs are kept in one GPU texture.Notable things that RustType does not support yet:
Heavier examples, tests & benchmarks are in the ./dev
directory. This avoids dev-dependency feature bleed.
Run all tests with cargo test --all --all-features
.
Run examples with cargo run --example <NAME> -p dev
To hit the ground running with RustType, look at dev/examples/ascii.rs
supplied with the crate. It demonstrates loading a font file, rasterising an
arbitrary string, and displaying the result as ASCII art. If you prefer to just
look at the documentation, the entry point for loading fonts is Font
,
from which you can access individual fonts, then their glyphs.
The initial motivation for the project was to provide easy-to-use font rendering for games. There are numerous avenues for improving RustType. Ideas:
If you think you could help with achieving any of these goals, feel free to open a tracking issue for discussing them.
This crate is maintained with latest stable rust.
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.