1//! API for loading, scaling, positioning and rasterizing OpenType font glyphs.
2//!
3//! # Example
4//! ```
5//! use ab_glyph::{point, Font, FontRef, Glyph};
6//!
7//! # fn main() -> Result<(), ab_glyph::InvalidFont> {
8//! let font = FontRef::try_from_slice(include_bytes!("../../dev/fonts/Exo2-Light.otf"))?;
9//!
10//! // Get a glyph for 'q' with a scale & position.
11//! let q_glyph: Glyph = font
12//! .glyph_id('q')
13//! .with_scale_and_position(24.0, point(100.0, 0.0));
14//!
15//! // Draw it.
16//! if let Some(q) = font.outline_glyph(q_glyph) {
17//! q.draw(|x, y, c| { /* draw pixel `(x, y)` with coverage: `c` */ });
18//! }
19//! # Ok(()) }
20//! ```
21#![warn(missing_debug_implementations)]
22#![cfg_attr(not(feature = "std"), no_std)]
23
24extern crate alloc;
25
26mod codepoint_ids;
27mod err;
28mod font;
29#[cfg(feature = "std")]
30mod font_arc;
31mod glyph;
32#[cfg(all(feature = "libm", not(feature = "std")))]
33mod nostd_float;
34mod outlined;
35mod scale;
36mod ttfp;
37#[cfg(feature = "variable-fonts")]
38mod variable;
39
40#[cfg(feature = "std")]
41pub use crate::font_arc::*;
42#[allow(deprecated)]
43pub use crate::{
44 codepoint_ids::*,
45 err::*,
46 font::*,
47 glyph::*,
48 outlined::*,
49 scale::*,
50 ttfp::{FontRef, FontVec},
51};
52pub use ab_glyph_rasterizer::{point, Point};
53#[cfg(feature = "variable-fonts")]
54pub use variable::*;
55