struct Parser<'a> {
data: &'a [u8],
pos: usize,
}Fields§
§data: &'a [u8]§pos: usizeImplementations§
Source§impl<'a> Parser<'a>
impl<'a> Parser<'a>
fn new(data: &'a [u8]) -> Self
fn next(&mut self) -> Option<Token<'a>>
Sourcefn accept_blob_start(&mut self) -> bool
fn accept_blob_start(&mut self) -> bool
Special lookahead case for RD or -| which indicates a binary blob in Type1 fonts.
fn accept(&mut self, token: Token<'_>) -> bool
fn expect(&mut self, token: Token<'_>) -> Option<()>
fn next_byte(&mut self) -> Option<u8>
fn peek_byte(&self) -> Option<u8>
fn read_bytes(&mut self, len: usize) -> Option<&'a [u8]>
fn skip_whitespace(&mut self) -> Option<()>
fn skip_line(&mut self)
fn skip_until(&mut self, f: impl Fn(u8) -> bool) -> usize
fn read_proc(&mut self, start: usize) -> Option<Token<'a>>
fn read_lit_string(&mut self, start: usize) -> Option<Token<'a>>
fn read_hex_string(&mut self, start: usize) -> Option<Token<'a>>
fn read_int(&mut self) -> Option<i64>
fn read_num_as_int(&mut self) -> Option<i32>
fn read_string(&mut self) -> Option<String>
Source§impl Parser<'_>
impl Parser<'_>
Sourcefn read_font_matrix(&mut self) -> Option<ScaledFontMatrix>
fn read_font_matrix(&mut self) -> Option<ScaledFontMatrix>
Parse a font matrix.
Like FreeType, this is designed assuming a upem of 1000 and produces an identity matrix in that case. This is, the result is scaled such that 0.001 yields a value of 1.0.
Sourcefn read_subrs(&mut self, len_iv: i64) -> Option<Subrs>
fn read_subrs(&mut self, len_iv: i64) -> Option<Subrs>
Parse the set of subroutines.
The len_iv parameter defines the number of prefix padding bytes for
encrypted data. If < 0, then the data is not encrypted.
Sourcefn read_charstrings(&mut self, len_iv: i64) -> Option<Charstrings>
fn read_charstrings(&mut self, len_iv: i64) -> Option<Charstrings>
Parse the set of charstrings.
The len_iv parameter defines the number of prefix padding bytes for
encrypted data. If < 0, then the data is not encrypted.
Sourcefn read_font_bbox(&mut self) -> Option<[Fixed; 4]>
fn read_font_bbox(&mut self) -> Option<[Fixed; 4]>
Reads a /FontBBox, each component rounded to a whole unit as
FreeType rounds it.
In the /Blend dictionary of a multiple master font, each component
is an array with a value for each master. FreeType stores master 0’s
box over the font’s own, so this returns master 0’s values.
fn read_weight_vector(&mut self) -> Option<Vec<Fixed>>
Sourcefn read_fixed(&mut self) -> Option<Fixed>
fn read_fixed(&mut self) -> Option<Fixed>
Reads a number as a fixed point value.
Sourcefn read_blend_axis_types(&mut self) -> Option<Vec<String>>
fn read_blend_axis_types(&mut self) -> Option<Vec<String>>
Reads the names of the blend axes, as in [/Weight /Width].
Sourcefn read_blend_design_positions(&mut self) -> Option<Vec<Vec<Fixed>>>
fn read_blend_design_positions(&mut self) -> Option<Vec<Vec<Fixed>>>
Reads the position of each master in the blend space, as in
[[0 0] [1 0] [0 1] [1 1]].
Sourcefn read_blend_design_map(&mut self) -> Option<Vec<Vec<(i32, Fixed)>>>
fn read_blend_design_map(&mut self) -> Option<Vec<Vec<(i32, Fixed)>>>
Reads the map from design coordinates to blend coordinates for each
axis, as in [[[50 0] [1450 1]] [[50 0] [1450 1]]].
Sourcefn read_array_len(&mut self) -> Option<usize>
fn read_array_len(&mut self) -> Option<usize>
Reads an array and returns the number of elements in it.