1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*!
A complete [harfbuzz](https://github.com/harfbuzz/harfbuzz) shaping algorithm port to Rust.
*/

#![no_std]
#![warn(missing_docs)]

#[cfg(not(any(feature = "std", feature = "libm")))]
compile_error!("You have to activate either the `std` or the `libm` feature.");

#[cfg(feature = "std")]
extern crate std;

extern crate alloc;

#[macro_use]
mod buffer;
mod aat;
mod common;
mod complex;
mod face;
mod fallback;
mod glyph_set;
mod normalize;
mod ot;
mod plan;
mod shape;
mod tag;
mod tag_table;
mod text_parser;
mod unicode;
mod unicode_norm;

pub use ttf_parser;

pub use ttf_parser::Tag;

pub use crate::buffer::{
    BufferClusterLevel, BufferFlags, GlyphBuffer, GlyphInfo, GlyphPosition, SerializeFlags,
    UnicodeBuffer,
};
pub use crate::common::{script, Direction, Feature, Language, Script, Variation};
pub use crate::face::Face;
pub use crate::plan::ShapePlan;
pub use crate::shape::{shape, shape_with_plan};

type Mask = u32;

fn round(x: f32) -> f32 {
    #[cfg(feature = "std")]
    {
        x.round()
    }
    #[cfg(not(feature = "std"))]
    {
        libm::roundf(x)
    }
}