1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#![deny(clippy::all)]

//! Riddle crate for loading font files and rendering text to riddle_image images.
//!
//! Built largely on the back of `rusttype` and its dependencies.
//!
//! # Example
//!
//! ```
//! # use riddle_font::*;
//! # fn main() -> Result<(), FontError> {
//! // Load font from TTF file
//! let ttf_bytes = include_bytes!("../../example_assets/Roboto-Regular.ttf");
//! let font = TTFont::load(&ttf_bytes[..])?;
//!
//! // Render the loaded font to a Riddle image
//! let image = font.render_simple("Simple String", 24)?;
//! # Ok(())
//! # }
//! ```

mod error;
mod ttfont;

pub mod rusttype_ext;

pub use error::*;
pub use ttfont::TTFont;

use riddle_common::CommonError;

type Result<R> = std::result::Result<R, FontError>;