skrifa/
lib.rs

1//! A robust, ergonomic, high performance crate for OpenType fonts.
2//!  
3//! Skrifa is a mid level library that provides access to various types
4//! of [`metadata`](MetadataProvider) contained in a font as well as support
5//! for loading glyph [`outlines`](outline).
6//!
7//! It is described as "mid level" because the library is designed to sit
8//! above low level font parsing (provided by [`read-fonts`](https://crates.io/crates/read-fonts))
9//! and below a higher level text layout engine.
10//!
11//! See the [readme](https://github.com/googlefonts/fontations/blob/main/skrifa/README.md)
12//! for additional details.
13
14#![cfg_attr(docsrs, feature(doc_auto_cfg))]
15#![forbid(unsafe_code)]
16#![cfg_attr(not(any(test, feature = "std")), no_std)]
17
18#[cfg(not(any(feature = "libm", feature = "std")))]
19compile_error!("Either feature \"std\" or \"libm\" must be enabled for this crate.");
20
21#[cfg(not(any(test, feature = "std")))]
22#[macro_use]
23extern crate core as std;
24
25#[macro_use]
26extern crate alloc;
27
28/// Expose our "raw" underlying parser crate.
29pub extern crate read_fonts as raw;
30
31pub mod attribute;
32pub mod bitmap;
33pub mod charmap;
34pub mod color;
35pub mod font;
36pub mod instance;
37pub mod metrics;
38pub mod outline;
39
40pub mod setting;
41pub mod string;
42
43mod collections;
44mod decycler;
45mod glyph_name;
46mod provider;
47mod variation;
48
49pub use glyph_name::{GlyphName, GlyphNameSource, GlyphNames};
50#[doc(inline)]
51pub use outline::{OutlineGlyph, OutlineGlyphCollection};
52pub use variation::{Axis, AxisCollection, NamedInstance, NamedInstanceCollection};
53
54/// Useful collection of common types suitable for glob importing.
55pub mod prelude {
56    #[doc(no_inline)]
57    pub use super::{
58        font::FontRef,
59        instance::{LocationRef, NormalizedCoord, Size},
60        GlyphId, MetadataProvider, Tag,
61    };
62}
63
64pub use read_fonts::{
65    types::{GlyphId, GlyphId16, Tag},
66    FontRef,
67};
68
69#[doc(inline)]
70pub use provider::MetadataProvider;
71
72/// Limit for recursion when loading TrueType composite glyphs.
73const GLYF_COMPOSITE_RECURSION_LIMIT: usize = 32;