pub struct File {Show 13 fields
pub header: Header,
pub smallest_char: Char,
pub char_dimens: BTreeMap<Char, CharDimensions>,
pub char_tags: BTreeMap<Char, CharTag>,
pub unset_char_tags: BTreeMap<Char, u8>,
pub widths: Vec<Number>,
pub heights: Vec<Number>,
pub depths: Vec<Number>,
pub italic_corrections: Vec<Number>,
pub lig_kern_program: Program,
pub kerns: Vec<Number>,
pub extensible_chars: Vec<ExtensibleRecipe>,
pub params: Vec<Number>,
}
Expand description
Complete contents of a TeX font metric (.tfm) file.
The struct contain multiple vectors. In TeX and TFtoPL there is an optimization in which all of data in the vectors is stored in one large vector of 32-bit integers. The conversion from u32 to the specific types like Number are then done when the data is needed. This makes the memory footprint of this type much more compact, and such a change may be considered in the future.
In fact in TeX the font data for all fonts is stored in one contiguous piece of memory
(font_info
, defined in TeX82.2021.549).
This is a little too unsafe to pull off though.
Fields§
§header: Header
Header.
smallest_char: Char
Smallest character in the .tfm.
char_dimens: BTreeMap<Char, CharDimensions>
Character dimensions.
Character tags.
Note there is no correlation between a character having a tag and a character having a dimension. All four combinations of (has or hasn’t dimensions) and (has or hasn’t a tag) are possible.
Tags that have been unset, but whose discriminant is still written to a .tfm file by PLtoTF.
widths: Vec<Number>
Character widths
heights: Vec<Number>
Character heights
depths: Vec<Number>
Character depths
italic_corrections: Vec<Number>
Character italic corrections
lig_kern_program: Program
Lig kern program.
kerns: Vec<Number>
Kerns. These are referenced from inside the lig kern commands.
extensible_chars: Vec<ExtensibleRecipe>
Extensible characters.
params: Vec<Number>
Font parameters.
Implementations§
source§impl File
impl File
pub fn from_raw_file(raw_file: &RawFile<'_>) -> Self
pub fn validate_and_fix(&mut self) -> Vec<ValidationWarning>
pub fn deserialize( b: &[u8] ) -> (Result<File, DeserializationError>, Vec<DeserializationWarning>)
pub fn serialize(&self) -> Vec<u8>
sourcepub fn lig_kern_entrypoints(&self) -> HashMap<Char, u8>
pub fn lig_kern_entrypoints(&self) -> HashMap<Char, u8>
Return a map from characters to the lig/kern entrypoint for that character. TODO: can probably return impl Iterator<Item=(Char, u8)>