diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a0a78f4..f9a3025 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: - name: Build no_std ab_glyph_rasterizer run: (cd rasterizer && cargo build --target thumbv6m-none-eabi --no-default-features --features libm) - name: Build no_std ab_glyph - run: (cd glyph && cargo build --target thumbv6m-none-eabi --no-default-features --features libm-math) + run: (cd glyph && cargo build --target thumbv6m-none-eabi --no-default-features --features libm) rustfmt: runs-on: ubuntu-latest diff --git a/glyph/CHANGELOG.md b/glyph/CHANGELOG.md index 078522c..1a9c707 100644 --- a/glyph/CHANGELOG.md +++ b/glyph/CHANGELOG.md @@ -1,2 +1,7 @@ +# Unreleased +* Add `_unscaled` suffix to `Font` trait methods that deal with unscaled metrics. + This helps distinguish `ScaleFont`'s scaled metrics and can avoid unintended behaviour. +* Rename "libm-math" -> "libm" for consistency with ab_glyph_rasterizer. + # 0.1 * Implement fast glyph layout, outline & drawing primitives. diff --git a/glyph/Cargo.toml b/glyph/Cargo.toml index ccc1754..eebb742 100644 --- a/glyph/Cargo.toml +++ b/glyph/Cargo.toml @@ -13,7 +13,8 @@ readme="README.md" owned_ttf_parser = { version = "0.5.1", default-features = false } ab_glyph_rasterizer = { version = "0.1.2", path = "../rasterizer", default-features = false } # no_std float stuff -libm = { version = "0.2.1", optional = true } +# renamed to enable a "libm" feature +libm2 = { package = "libm", version = "0.2.1", optional = true } [dev-dependencies] # don't add any, instead use ./dev @@ -23,4 +24,4 @@ default = ["std"] # Activates usage of std. std = ["owned_ttf_parser/default", "ab_glyph_rasterizer/default"] # Uses libm when not using std. This needs to be active in that case. -libm-math = ["libm", "ab_glyph_rasterizer/libm"] +libm = ["libm2", "ab_glyph_rasterizer/libm"] diff --git a/glyph/README.md b/glyph/README.md index 92f117b..9e3b146 100644 --- a/glyph/README.md +++ b/glyph/README.md @@ -21,7 +21,7 @@ if let Some(q) = font.outline_glyph(q_glyph) { ## no_std no_std environments are supported using `alloc` & [`libm`](https://github.com/rust-lang/libm). ```toml -ab_glyph = { default-features = false, features = ["libm-math"] } +ab_glyph = { default-features = false, features = ["libm"] } ``` ## Comparison with [`rusttype`](https://gitlab.redox-os.org/redox-os/rusttype) diff --git a/glyph/src/lib.rs b/glyph/src/lib.rs index dcc7276..acc77b9 100644 --- a/glyph/src/lib.rs +++ b/glyph/src/lib.rs @@ -26,7 +26,7 @@ mod font; #[cfg(feature = "std")] mod font_arc; mod glyph; -#[cfg(all(feature = "libm-math", not(feature = "std")))] +#[cfg(all(feature = "libm", not(feature = "std")))] mod nostd_float; mod outlined; mod scale; diff --git a/glyph/src/nostd_float.rs b/glyph/src/nostd_float.rs index 7d8bd5a..cc50df2 100644 --- a/glyph/src/nostd_float.rs +++ b/glyph/src/nostd_float.rs @@ -1,3 +1,5 @@ +use libm2 as libm; + /// Basic required float operations. pub(crate) trait FloatExt { fn floor(self) -> Self; diff --git a/glyph/src/outlined.rs b/glyph/src/outlined.rs index 4645cb0..fb9476f 100644 --- a/glyph/src/outlined.rs +++ b/glyph/src/outlined.rs @@ -1,4 +1,4 @@ -#[cfg(all(feature = "libm-math", not(feature = "std")))] +#[cfg(all(feature = "libm", not(feature = "std")))] use crate::nostd_float::FloatExt; use crate::{point, Glyph, Point, PxScaleFactor}; #[cfg(not(feature = "std"))] diff --git a/test b/test index d19eda5..489af78 100755 --- a/test +++ b/test @@ -10,6 +10,6 @@ cargo test cargo test --benches echo "==> no_std" (cd rasterizer && cargo build --target thumbv6m-none-eabi --no-default-features --features libm) -(cd glyph && cargo build --target thumbv6m-none-eabi --no-default-features --features libm-math) +(cd glyph && cargo build --target thumbv6m-none-eabi --no-default-features --features libm) echo "==> rustfmt" cargo fmt -- --check