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;
29mod tag;
30mod uint24;
31mod version;
32
33#[cfg(all(test, feature = "serde"))]
34mod serde_test;
35
36pub use bbox::BoundingBox;
37pub use fixed::{F26Dot6, F2Dot14, F4Dot12, F6Dot10, Fixed};
38pub use fword::{FWord, UfWord};
39pub use glyph_id::{GlyphId, GlyphId16, TryFromGlyphIdError};
40pub use int24::Int24;
41pub use longdatetime::LongDateTime;
42pub use matrix::{Matrix, MatrixElement};
43pub use name_id::NameId;
44pub use offset::{Nullable, Offset16, Offset24, Offset32};
45pub use point::Point;
46pub use raw::{BigEndian, FixedSize, Scalar};
47pub use tag::{InvalidTag, Tag};
48pub use uint24::Uint24;
49pub use version::{Compatible, MajorMinor, Version16Dot16};
50
51/// The header tag for a font collection file.
52pub const TTC_HEADER_TAG: Tag = Tag::new(b"ttcf");
53
54/// The SFNT version for fonts containing TrueType outlines.
55pub const TT_SFNT_VERSION: u32 = 0x00010000;
56/// The SFNT version for legacy Apple fonts containing TrueType outlines.
57pub const TRUE_SFNT_VERSION: u32 = 0x74727565;
58/// The SFNT version for fonts containing CFF outlines.
59pub const CFF_SFNT_VERSION: u32 = 0x4F54544F;