Skip to main content

font_types/
lib.rs

1//! Common [scalar data types][data types] used in font files
2//!
3//! [data types]: https://docs.microsoft.com/en-us/typography/opentype/spec/otff#data-types
4
5#![cfg_attr(docsrs, feature(doc_cfg))]
6#![deny(rustdoc::broken_intra_doc_links)]
7#![warn(clippy::doc_markdown)]
8#![cfg_attr(not(feature = "std"), no_std)]
9
10#[cfg(feature = "std")]
11#[macro_use]
12extern crate std;
13
14#[cfg(not(feature = "std"))]
15#[macro_use]
16extern crate core as std;
17
18mod bbox;
19mod fixed;
20mod fword;
21mod glyph_id;
22mod int24;
23mod longdatetime;
24mod matrix;
25mod name_id;
26mod offset;
27mod point;
28mod raw;
29#[cfg(feature = "bytemuck")]
30mod table_data;
31mod tag;
32mod uint24;
33mod version;
34
35#[cfg(all(test, feature = "serde"))]
36mod serde_test;
37
38pub use bbox::BoundingBox;
39pub use fixed::{F26Dot6, F2Dot14, F48Dot16, F4Dot12, F6Dot10, Fixed};
40pub use fword::{FWord, UfWord};
41pub use glyph_id::{GlyphId, GlyphId16, GlyphId24, TryFromGlyphIdError};
42pub use int24::Int24;
43pub use longdatetime::LongDateTime;
44pub use matrix::{Matrix, MatrixElement};
45pub use name_id::NameId;
46pub use offset::{Nullable, Offset16, Offset24, Offset32};
47pub use point::Point;
48pub use raw::{BigEndian, FixedSize, Scalar};
49#[cfg(feature = "bytemuck")]
50pub use table_data::TableDataRef;
51pub use tag::{InvalidTag, Tag};
52pub use uint24::Uint24;
53pub use version::{Compatible, MajorMinor, Version16Dot16};
54
55/// The header tag for a font collection file.
56pub const TTC_HEADER_TAG: Tag = Tag::new(b"ttcf");
57
58/// The SFNT version for fonts containing TrueType outlines.
59pub const TT_SFNT_VERSION: u32 = 0x00010000;
60/// The SFNT version for legacy Apple fonts containing TrueType outlines.
61pub const TRUE_SFNT_VERSION: u32 = 0x74727565;
62/// The SFNT version for fonts containing CFF outlines.
63pub const CFF_SFNT_VERSION: u32 = 0x4F54544F;