use thiserror::Error; use std::io::Write; use std::ops::RangeInclusive; use std::collections::HashMap; use bimap::BiMap; use enumset::{ EnumSet, EnumSetType }; use flate2::{ Compress, Compression, FlushCompress }; use chrono::{ DateTime, Utc }; use range_set::RangeSet; use image::DynamicImage; use mchr::Pullable; use mttf::FontFile; use mttf::core::{ RandomAccess, Fixed }; use mttf::common::{ Platform, PlatformEncoding, WindowsEncoding }; use mttf::name::{ NamingTable, NameKind }; use mttf::os_2::Os2MetricsTable; use mttf::cmap::{ CharacterToGlyphMap, Subtable, SegmentMappingTable, SegmentCoverageTable }; use mttf::gsub::{ GlyphSubstitutionTable, LookupTable }; pub const A3: (f32, f32) = (841.89, 1190.55); pub const A4: (f32, f32) = (595.28, 841.89); pub const A5: (f32, f32) = (420.94, 595.28); pub const LETTER: (f32, f32) = (612.0, 792.0); pub const LEGAL: (f32, f32) = (612.0, 1008.0); fn compress(data: &[u8]) -> Vec { let mut out = Vec::with_capacity(data.len()); let mut compressor = Compress::new(Compression::best(), true); compressor.compress_vec(data, &mut out, FlushCompress::Full).unwrap(); out.shrink_to_fit(); out } // Fonts #[derive(Debug, EnumSetType)] pub enum Script { Default, Latin, } pub type ScriptSet = EnumSet