Skip to content

Commit

Permalink
Make core_maths optional.
Browse files Browse the repository at this point in the history
  • Loading branch information
RazrFalcon committed Jul 2, 2024
1 parent a06b588 commit 374e5fb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ edition = "2018"
exclude = ["benches/**"]

[dependencies]
core_maths = { version = "0.1.0" } # No-op for `std` builds.
core_maths = { version = "0.1.0", optional = true } # only for no_std builds

[features]
default = ["std", "opentype-layout", "apple-layout", "variable-fonts", "glyph-names"]
# Enables the use of the standard library.
# When disabled, the `core_maths` feature must be enabled instead.
std = []
# Enables variable fonts support. Increases binary size almost twice.
# Includes avar, CFF2, fvar, gvar, HVAR, MVAR and VVAR tables.
Expand Down
7 changes: 5 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,11 @@ Font parsing starts with a [`Face`].
#[macro_use]
extern crate std;

#[allow(unused_imports)]
use core_maths::*;
#[cfg(not(any(feature = "std", feature = "core_maths")))]
compile_error!("You have to activate either the `std` or the `core_maths` feature.");

#[cfg(not(feature = "std"))]
use core_maths::CoreFloat;

#[cfg(feature = "apple-layout")]
mod aat;
Expand Down

0 comments on commit 374e5fb

Please sign in to comment.