#![cfg_attr(not(feature = "std"), no_std)]
#![forbid(unsafe_code)]
#![warn(missing_docs)]
extern crate alloc;
mod hb;
#[cfg(feature = "std")]
pub(crate) type U32Set = read_fonts::collections::int_set::U32Set;
#[cfg(not(feature = "std"))]
mod digest_u32_set;
#[cfg(not(feature = "std"))]
pub(crate) type U32Set = digest_u32_set::DigestU32Set;
pub use read_fonts::{types::Tag, FontRef};
pub use hb::buffer::{GlyphBuffer, GlyphInfo, GlyphPosition, UnicodeBuffer};
pub use hb::common::{script, Direction, Feature, Language, Script, Variation};
pub use hb::face::{hb_font_t as Shaper, ShaperBuilder, ShaperData, ShaperInstance};
pub use hb::ot_shape_plan::{hb_ot_shape_plan_t as ShapePlan, ShapePlanKey};
pub type NormalizedCoord = read_fonts::types::F2Dot14;
bitflags::bitflags! {
#[derive(Default, Debug, Clone, Copy)]
pub struct BufferFlags: u32 {
const BEGINNING_OF_TEXT = 0x0000_0001;
const END_OF_TEXT = 0x0000_0002;
const PRESERVE_DEFAULT_IGNORABLES = 0x0000_0004;
const REMOVE_DEFAULT_IGNORABLES = 0x0000_0008;
const DO_NOT_INSERT_DOTTED_CIRCLE = 0x0000_0010;
const VERIFY = 0x0000_0020;
const PRODUCE_UNSAFE_TO_CONCAT = 0x0000_0040;
const PRODUCE_SAFE_TO_INSERT_TATWEEL = 0x0000_0080;
const DEFINED = 0x0000_00FF;
}
}
#[allow(missing_docs)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
pub enum BufferClusterLevel {
MonotoneGraphemes,
MonotoneCharacters,
Characters,
Graphemes,
}
impl BufferClusterLevel {
#[inline]
fn new(level: u32) -> Self {
match level {
0 => Self::MonotoneGraphemes,
1 => Self::MonotoneCharacters,
2 => Self::Characters,
3 => Self::Graphemes,
_ => Self::MonotoneGraphemes,
}
}
#[inline]
fn is_monotone(self) -> bool {
matches!(self, Self::MonotoneGraphemes | Self::MonotoneCharacters)
}
#[inline]
fn is_graphemes(self) -> bool {
matches!(self, Self::MonotoneGraphemes | Self::Graphemes)
}
#[inline]
fn _is_characters(self) -> bool {
matches!(self, Self::MonotoneCharacters | Self::Characters)
}
}
impl Default for BufferClusterLevel {
#[inline]
fn default() -> Self {
BufferClusterLevel::MonotoneGraphemes
}
}
bitflags::bitflags! {
#[derive(Default)]
pub struct SerializeFlags: u8 {
const NO_CLUSTERS = 0b0000_0001;
const NO_POSITIONS = 0b0000_0010;
const NO_GLYPH_NAMES = 0b0000_0100;
const GLYPH_EXTENTS = 0b0000_1000;
const GLYPH_FLAGS = 0b0001_0000;
const NO_ADVANCES = 0b0010_0000;
const DEFINED = 0b0011_1111;
}
}