[−][src]Crate fonterator
Fonterator is a pure Rust font loader. When you want to render text, fonterator gives you an
iterator over footile PathOp
s, which you can easily pass
right into footile.
Simple Example
In Cargo.toml,
[dependencies]
fonterator = "0.4.0"
In main.rs,
use fonterator::FontGroup; use footile::{FillRule, Plotter, Raster, Rgba8}; fn main() { // Load the default FontGroup (font and fallbacks). let font = FontGroup::default(); // Init rendering let mut p = Plotter::new(2048, 2048); let mut r = Raster::new(p.width(), p.height()); // Render the text let mut path = font.render( "Héllö,\nWørłd!‽i", /*text*/ (0.0, 0.0), /*position*/ (256.0, 256.0), /*size*/ ); r.over( p.fill(&mut path, FillRule::NonZero), Rgba8::rgb(0, 0, 0), /*color*/ ); r.write_png("main.png").unwrap(); /*save as PNG*/ }
Re-exports
pub use footile; |
Structs
FontGroup | A |
PathIterator | An iterator created by |
Enums
Error | The type for errors returned by Fonterator. |
PathOp | Path operation. |
SharedBytes |
|