Commit 44fef5dd authored by Christopher Serr's avatar Christopher Serr Committed by Alex Butler

Implement Support for no_std

This adds a `std` feature that is activated by default. When
deactivated, core is used instead of std. Byteorder is removed as a
dependency as core / std mostly support the same functionality nowadays.
parent 6e519618
......@@ -59,3 +59,11 @@ build:redox:
script:
- rustup target add x86_64-unknown-redox --toolchain nightly
- cargo +nightly build --target=x86_64-unknown-redox -v
build:no_std:
stage: build
variables:
toolchain: stable
script:
- rustup target add thumbv6m-none-eabi --toolchain stable
- cargo +stable build --target thumbv6m-none-eabi --no-default-features --features libm -v
......@@ -12,7 +12,12 @@ keywords = ["font", "truetype", "opentype", "ttf", "otf"]
exclude = ["/fonts/**"]
[dependencies]
byteorder = "1.1"
byteorder = { version = "1.1", default-features = false }
libm = { version = "0.1.4", optional = true }
[features]
default = ["std"]
std = []
[dev-dependencies]
approx = { version = "0.3", default-features = false }
......@@ -4,9 +4,18 @@
clippy::cast_lossless,
clippy::many_single_char_names
)]
#![cfg_attr(not(feature = "std"), no_std)]
extern crate alloc;
use alloc::vec::Vec;
use byteorder::{BigEndian as BE, ByteOrder};
use std::ops::Deref;
use core::ops::Deref;
#[cfg(all(feature = "libm", not(feature = "std")))]
use libm::F32Ext;
#[cfg(not(any(feature = "libm", feature = "std")))]
compile_error!("You need to activate either the `std` or `libm` feature.");
#[derive(Copy, Clone, Debug)]
pub struct FontInfo<Data: Deref<Target = [u8]>> {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment