Skip to content

Commit

Permalink
Rename "libm-math" feature to "libm" for consistency (#4)
Browse files Browse the repository at this point in the history
* Rename "libm-math" feature to "libm" for consistency
* Update changelog
  • Loading branch information
alexheretic authored May 13, 2020
1 parent 48b356c commit 652a36c
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions glyph/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
5 changes: 3 additions & 2 deletions glyph/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"]
2 changes: 1 addition & 1 deletion glyph/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion glyph/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions glyph/src/nostd_float.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use libm2 as libm;

/// Basic required float operations.
pub(crate) trait FloatExt {
fn floor(self) -> Self;
Expand Down
2 changes: 1 addition & 1 deletion glyph/src/outlined.rs
Original file line number Diff line number Diff line change
@@ -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"))]
Expand Down
2 changes: 1 addition & 1 deletion test
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 652a36c

Please sign in to comment.