pub mod ctf;
pub mod eot;
pub mod lzcomp;
pub mod mtx;
mod woff1;
pub mod woff2;
#[cfg(test)]
pub(crate) fn compressed_eot_fixture() -> Vec<u8> {
match std::env::var("WEBMEDIA_EOT_FIXTURE") {
Ok(path) => std::fs::read(path).expect("read EOT test fixture"),
Err(_) => {
include_bytes!("../../tests/fixtures/fonts/roboto-v20-latin-regular.eot").to_vec()
}
}
}
pub const WOFF2_MAGIC: [u8; 4] = [0x77, 0x4F, 0x46, 0x32];
pub const WOFF1_MAGIC: [u8; 4] = [0x77, 0x4F, 0x46, 0x46];
#[inline]
pub fn decode(data: &[u8]) -> Option<Vec<u8>> {
if data.starts_with(&WOFF2_MAGIC) {
woff2::decode(data)
} else if data.starts_with(&WOFF1_MAGIC) {
woff1::decode(data)
} else {
None
}
}