fonterator
Load fonts as vector graphics in pure Rust with advanced text layout.
When you want to render text, fonterator gives you an iterator over
footile PathOp
s, which you can easily
pass right into footile.
- Loads TTF/OTF fonts and font collections.
- Automatic kerning and font layout.
- Horizontal and vertical text layout.
- Left-to-right and right-to-left text layout.
- Uses fallback fonts if a character is not available from one font.
- Can Align text left/center/right/vertical
- Line Wrapping
Todo
- Arabic and other script text shaping
- Better interoperability for monospace when mixing scripts.
Table of Contents
Getting Started
Add the following to your Cargo.toml
.
[]
= "0.8"
Example
use fonterator as font; // For parsing font file.
// For rendering text
use ;
use Encoder; // For saving PNG
use ;
const FONT_SIZE: f32 = 32.0;
API
API documentation can be found on docs.rs.
Features
monospace-font
Embeds a monospace font accessible with the monospace_font()
public API in
the root of the crate.
normal-font
Embeds a variable-width font accessible with the normal_font()
public API in
the root of the crate.
Upgrade
You can use the changelog to facilitate upgrading this crate as a dependency.
License
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
- Zlib License, (LICENSE-ZLIB or https://opensource.org/licenses/Zlib)
at your option.
Contribution
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.
Contributors are always welcome (thank you for being interested!), whether it be a bug report, bug fix, feature request, feature implementation or whatever. Don't be shy about getting involved. I always make time to fix bugs, so usually a patched version of the library will be out a few days after a report. Features requests will not complete as fast. If you have any questions, design critques, or want me to find you something to work on based on your skill level, you can email me at jeronlau@plopgrizzly.com. Otherwise, here's a link to the issues on GitHub. Before contributing, check out the contribution guidelines, and, as always, make sure to follow the code of conduct.