Struct ttf_parser::tables::cff::dict::DictionaryParser
source · pub struct DictionaryParser<'a> {
data: &'a [u8],
offset: usize,
operands_offset: usize,
operands: &'a mut [f64],
operands_len: u16,
}
Fields§
§data: &'a [u8]
§offset: usize
§operands_offset: usize
§operands: &'a mut [f64]
§operands_len: u16
Implementations§
source§impl<'a> DictionaryParser<'a>
impl<'a> DictionaryParser<'a>
pub fn new(data: &'a [u8], operands_buffer: &'a mut [f64]) -> Self
pub fn parse_next(&mut self) -> Option<Operator>
sourcepub fn parse_operands(&mut self) -> Option<()>
pub fn parse_operands(&mut self) -> Option<()>
Parses operands of the current operator.
In the DICT structure, operands are defined before an operator. So we are trying to find an operator first and the we can actually parse the operands.
Since this methods is pretty expensive and we do not care about most of the operators, we can speed up parsing by parsing operands only for required operators.
We still have to “skip” operands during operators search (see skip_number()
),
but it’s still faster that a naive method.
pub fn operands(&self) -> &[f64]
pub fn parse_number(&mut self) -> Option<f64>
pub fn parse_offset(&mut self) -> Option<usize>
pub fn parse_range(&mut self) -> Option<Range<usize>>
Auto Trait Implementations§
impl<'a> Freeze for DictionaryParser<'a>
impl<'a> RefUnwindSafe for DictionaryParser<'a>
impl<'a> Send for DictionaryParser<'a>
impl<'a> Sync for DictionaryParser<'a>
impl<'a> Unpin for DictionaryParser<'a>
impl<'a> !UnwindSafe for DictionaryParser<'a>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more