fontique/
lib.rs

1// Copyright 2024 the Parley Authors
2// SPDX-License-Identifier: Apache-2.0 OR MIT
3
4//! Font enumeration and fallback.
5
6// LINEBENDER LINT SET - lib.rs - v4
7// See https://linebender.org/wiki/canonical-lints/
8// These lints shouldn't apply to examples or tests.
9#![cfg_attr(not(test), warn(unused_crate_dependencies))]
10// These lints shouldn't apply to examples.
11#![warn(clippy::print_stdout, clippy::print_stderr)]
12// Targeting e.g. 32-bit means structs containing usize can give false positives for 64-bit.
13#![cfg_attr(target_pointer_width = "64", warn(clippy::trivially_copy_pass_by_ref))]
14// END LINEBENDER LINT SET
15#![cfg_attr(docsrs, feature(doc_cfg))]
16#![cfg_attr(not(feature = "std"), no_std)]
17#![allow(unsafe_code, reason = "We access platform libraries using ffi.")]
18#![allow(missing_docs, reason = "We have many as-yet undocumented items.")]
19#![expect(
20    missing_debug_implementations,
21    unnameable_types,
22    unreachable_pub,
23    clippy::allow_attributes_without_reason,
24    clippy::cast_possible_truncation,
25    reason = "Deferred"
26)]
27#![allow(
28    single_use_lifetimes,
29    reason = "False positive: https://github.com/rust-lang/rust/issues/129255"
30)]
31
32#[cfg(not(any(feature = "std", feature = "libm")))]
33compile_error!("fontique requires either the `std` or `libm` feature to be enabled");
34
35extern crate alloc;
36
37mod attributes;
38mod backend;
39mod charmap;
40mod collection;
41mod fallback;
42mod family;
43mod family_name;
44mod font;
45mod generic;
46mod matching;
47mod scan;
48mod script;
49mod source;
50
51mod source_cache;
52
53pub use icu_locale_core::LanguageIdentifier as Language;
54pub use linebender_resource_handle::Blob;
55
56pub use attributes::{Attributes, FontStyle, FontWeight, FontWidth};
57pub use charmap::{Charmap, CharmapIndex};
58pub use collection::{Collection, CollectionOptions, Query, QueryFamily, QueryFont, QueryStatus};
59pub use fallback::FallbackKey;
60pub use family::{FamilyId, FamilyInfo};
61pub use font::{AxisInfo, FontInfo, FontInfoOverride, Synthesis};
62pub use generic::GenericFamily;
63pub use script::Script;
64pub use source::{SourceId, SourceInfo, SourceKind};
65
66#[cfg(all(feature = "system", target_vendor = "apple"))]
67use objc2 as _;
68pub use source_cache::{SourceCache, SourceCacheOptions};
69
70#[cfg(not(target_has_atomic = "64"))]
71use core::sync::atomic::AtomicU32 as AtomicCounter;
72#[cfg(target_has_atomic = "64")]
73use core::sync::atomic::AtomicU64 as AtomicCounter;