diff --git a/font-codegen/src/fields.rs b/font-codegen/src/fields.rs index 899094278..6451553e4 100644 --- a/font-codegen/src/fields.rs +++ b/font-codegen/src/fields.rs @@ -831,6 +831,7 @@ impl Field { Some(quote! { #( #docs )* + #[inline] pub fn #name(&self) -> #return_type { let range = #range_stmt; #read_stmt @@ -876,6 +877,7 @@ impl Field { let offset_getter = self.typed_offset_field_getter(None, Some(record)); Some(quote! { #(#docs)* + #[inline] pub fn #name(&self) -> #add_borrow_just_for_record #return_type { #getter_expr } diff --git a/font-codegen/src/table.rs b/font-codegen/src/table.rs index b92f4b4eb..a04a569b9 100644 --- a/font-codegen/src/table.rs +++ b/font-codegen/src/table.rs @@ -170,6 +170,7 @@ fn generate_font_read(item: &Table) -> syn::Result { } impl<'a> FontReadWithArgs<'a> for #name<'a> { + #[inline] fn read_with_args(data: FontData<'a>, args: &#args_type) -> Result { let #destructure_pattern = *args; let #maybe_mut_kw cursor = data.cursor(); @@ -185,6 +186,7 @@ fn generate_font_read(item: &Table) -> syn::Result { /// /// This type requires some external state in order to be /// parsed. + #[inline] pub fn read(data: FontData<'a>, #( #constructor_args, )* ) -> Result { let args = #args_from_constructor_args; Self::read_with_args(data, &args) @@ -194,6 +196,7 @@ fn generate_font_read(item: &Table) -> syn::Result { } else { Ok(quote! { impl<'a, #generic> FontRead<'a> for #name<'a, #generic> { + #[inline] fn read(data: FontData<'a>) -> Result { let #maybe_mut_kw cursor = data.cursor(); #( #field_validation_stmts )* @@ -241,6 +244,7 @@ pub(crate) fn generate_group(item: &GenericGroup) -> syn::Result { } impl<'a> FontRead<'a> for #name <'a> { + #[inline] fn read(bytes: FontData<'a>) -> Result { let untyped = #inner::read(bytes)?; match untyped.#type_field() { diff --git a/read-fonts/generated/font.rs b/read-fonts/generated/font.rs index a74ce537f..53cd3f8bf 100644 --- a/read-fonts/generated/font.rs +++ b/read-fonts/generated/font.rs @@ -51,6 +51,7 @@ impl MinByteRange for TableDirectoryMarker { } impl<'a> FontRead<'a> for TableDirectory<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -74,33 +75,39 @@ pub type TableDirectory<'a> = TableRef<'a, TableDirectoryMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> TableDirectory<'a> { /// 0x00010000 or 0x4F54544F + #[inline] pub fn sfnt_version(&self) -> u32 { let range = self.shape.sfnt_version_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of tables. + #[inline] pub fn num_tables(&self) -> u16 { let range = self.shape.num_tables_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn search_range(&self) -> u16 { let range = self.shape.search_range_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn entry_selector(&self) -> u16 { let range = self.shape.entry_selector_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn range_shift(&self) -> u16 { let range = self.shape.range_shift_byte_range(); self.data.read_at(range.start).unwrap() } /// Table records array—one for each top-level table in the font + #[inline] pub fn table_records(&self) -> &'a [TableRecord] { let range = self.shape.table_records_byte_range(); self.data.read_array(range).unwrap() @@ -157,21 +164,25 @@ pub struct TableRecord { impl TableRecord { /// Table identifier. + #[inline] pub fn tag(&self) -> Tag { self.tag.get() } /// Checksum for the table. + #[inline] pub fn checksum(&self) -> u32 { self.checksum.get() } /// Offset from the beginning of the font data. + #[inline] pub fn offset(&self) -> u32 { self.offset.get() } /// Length of the table. + #[inline] pub fn length(&self) -> u32 { self.length.get() } @@ -253,6 +264,7 @@ impl MinByteRange for TTCHeaderMarker { } impl<'a> FontRead<'a> for TTCHeader<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -298,42 +310,49 @@ pub type TTCHeader<'a> = TableRef<'a, TTCHeaderMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> TTCHeader<'a> { /// Font Collection ID string: \"ttcf\" + #[inline] pub fn ttc_tag(&self) -> Tag { let range = self.shape.ttc_tag_byte_range(); self.data.read_at(range.start).unwrap() } /// Major/minor version of the TTC Header + #[inline] pub fn version(&self) -> MajorMinor { let range = self.shape.version_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of fonts in TTC + #[inline] pub fn num_fonts(&self) -> u32 { let range = self.shape.num_fonts_byte_range(); self.data.read_at(range.start).unwrap() } /// Array of offsets to the TableDirectory for each font from the beginning of the file + #[inline] pub fn table_directory_offsets(&self) -> &'a [BigEndian] { let range = self.shape.table_directory_offsets_byte_range(); self.data.read_array(range).unwrap() } /// Tag indicating that a DSIG table exists, 0x44534947 ('DSIG') (null if no signature) + #[inline] pub fn dsig_tag(&self) -> Option { let range = self.shape.dsig_tag_byte_range()?; Some(self.data.read_at(range.start).unwrap()) } /// The length (in bytes) of the DSIG table (null if no signature) + #[inline] pub fn dsig_length(&self) -> Option { let range = self.shape.dsig_length_byte_range()?; Some(self.data.read_at(range.start).unwrap()) } /// The offset (in bytes) of the DSIG table from the beginning of the TTC file (null if no signature) + #[inline] pub fn dsig_offset(&self) -> Option { let range = self.shape.dsig_offset_byte_range()?; Some(self.data.read_at(range.start).unwrap()) diff --git a/read-fonts/generated/generated_aat.rs b/read-fonts/generated/generated_aat.rs index 483f13975..97c8f3eb4 100644 --- a/read-fonts/generated/generated_aat.rs +++ b/read-fonts/generated/generated_aat.rs @@ -133,6 +133,7 @@ impl MinByteRange for Lookup0Marker { } impl<'a> FontRead<'a> for Lookup0<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -151,12 +152,14 @@ pub type Lookup0<'a> = TableRef<'a, Lookup0Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> Lookup0<'a> { /// Format number is set to 0. + #[inline] pub fn format(&self) -> u16 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Values, indexed by glyph index. + #[inline] pub fn values_data(&self) -> &'a [u8] { let range = self.shape.values_data_byte_range(); self.data.read_array(range).unwrap() @@ -242,6 +245,7 @@ impl MinByteRange for Lookup2Marker { } impl<'a> FontRead<'a> for Lookup2<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -268,42 +272,49 @@ pub type Lookup2<'a> = TableRef<'a, Lookup2Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> Lookup2<'a> { /// Format number is set to 2. + #[inline] pub fn format(&self) -> u16 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Size of a lookup unit for this search in bytes. + #[inline] pub fn unit_size(&self) -> u16 { let range = self.shape.unit_size_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of units of the preceding size to be searched. + #[inline] pub fn n_units(&self) -> u16 { let range = self.shape.n_units_byte_range(); self.data.read_at(range.start).unwrap() } /// The value of unitSize times the largest power of 2 that is less than or equal to the value of nUnits. + #[inline] pub fn search_range(&self) -> u16 { let range = self.shape.search_range_byte_range(); self.data.read_at(range.start).unwrap() } /// The log base 2 of the largest power of 2 less than or equal to the value of nUnits. + #[inline] pub fn entry_selector(&self) -> u16 { let range = self.shape.entry_selector_byte_range(); self.data.read_at(range.start).unwrap() } /// The value of unitSize times the difference of the value of nUnits minus the largest power of 2 less than or equal to the value of nUnits. + #[inline] pub fn range_shift(&self) -> u16 { let range = self.shape.range_shift_byte_range(); self.data.read_at(range.start).unwrap() } /// Segments. + #[inline] pub fn segments_data(&self) -> &'a [u8] { let range = self.shape.segments_data_byte_range(); self.data.read_array(range).unwrap() @@ -394,6 +405,7 @@ impl MinByteRange for Lookup4Marker { } impl<'a> FontRead<'a> for Lookup4<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -418,42 +430,49 @@ pub type Lookup4<'a> = TableRef<'a, Lookup4Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> Lookup4<'a> { /// Format number is set to 4. + #[inline] pub fn format(&self) -> u16 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Size of a lookup unit for this search in bytes. + #[inline] pub fn unit_size(&self) -> u16 { let range = self.shape.unit_size_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of units of the preceding size to be searched. + #[inline] pub fn n_units(&self) -> u16 { let range = self.shape.n_units_byte_range(); self.data.read_at(range.start).unwrap() } /// The value of unitSize times the largest power of 2 that is less than or equal to the value of nUnits. + #[inline] pub fn search_range(&self) -> u16 { let range = self.shape.search_range_byte_range(); self.data.read_at(range.start).unwrap() } /// The log base 2 of the largest power of 2 less than or equal to the value of nUnits. + #[inline] pub fn entry_selector(&self) -> u16 { let range = self.shape.entry_selector_byte_range(); self.data.read_at(range.start).unwrap() } /// The value of unitSize times the difference of the value of nUnits minus the largest power of 2 less than or equal to the value of nUnits. + #[inline] pub fn range_shift(&self) -> u16 { let range = self.shape.range_shift_byte_range(); self.data.read_at(range.start).unwrap() } /// Segments. + #[inline] pub fn segments(&self) -> &'a [LookupSegment4] { let range = self.shape.segments_byte_range(); self.data.read_array(range).unwrap() @@ -509,16 +528,19 @@ pub struct LookupSegment4 { impl LookupSegment4 { /// Last glyph index in this segment. + #[inline] pub fn last_glyph(&self) -> u16 { self.last_glyph.get() } /// First glyph index in this segment. + #[inline] pub fn first_glyph(&self) -> u16 { self.first_glyph.get() } /// A 16-bit offset from the start of the table to the data. + #[inline] pub fn value_offset(&self) -> u16 { self.value_offset.get() } @@ -600,6 +622,7 @@ impl MinByteRange for Lookup6Marker { } impl<'a> FontRead<'a> for Lookup6<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -625,42 +648,49 @@ pub type Lookup6<'a> = TableRef<'a, Lookup6Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> Lookup6<'a> { /// Format number is set to 6. + #[inline] pub fn format(&self) -> u16 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Size of a lookup unit for this search in bytes. + #[inline] pub fn unit_size(&self) -> u16 { let range = self.shape.unit_size_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of units of the preceding size to be searched. + #[inline] pub fn n_units(&self) -> u16 { let range = self.shape.n_units_byte_range(); self.data.read_at(range.start).unwrap() } /// The value of unitSize times the largest power of 2 that is less than or equal to the value of nUnits. + #[inline] pub fn search_range(&self) -> u16 { let range = self.shape.search_range_byte_range(); self.data.read_at(range.start).unwrap() } /// The log base 2 of the largest power of 2 less than or equal to the value of nUnits. + #[inline] pub fn entry_selector(&self) -> u16 { let range = self.shape.entry_selector_byte_range(); self.data.read_at(range.start).unwrap() } /// The value of unitSize times the difference of the value of nUnits minus the largest power of 2 less than or equal to the value of nUnits. + #[inline] pub fn range_shift(&self) -> u16 { let range = self.shape.range_shift_byte_range(); self.data.read_at(range.start).unwrap() } /// Values, indexed by glyph index. + #[inline] pub fn entries_data(&self) -> &'a [u8] { let range = self.shape.entries_data_byte_range(); self.data.read_array(range).unwrap() @@ -735,6 +765,7 @@ impl MinByteRange for Lookup8Marker { } impl<'a> FontRead<'a> for Lookup8<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -757,12 +788,14 @@ pub type Lookup8<'a> = TableRef<'a, Lookup8Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> Lookup8<'a> { /// Format number is set to 8. + #[inline] pub fn format(&self) -> u16 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// First glyph index included in the trimmed array. + #[inline] pub fn first_glyph(&self) -> u16 { let range = self.shape.first_glyph_byte_range(); self.data.read_at(range.start).unwrap() @@ -770,6 +803,7 @@ impl<'a> Lookup8<'a> { /// Total number of glyphs (equivalent to the last glyph minus the value /// of firstGlyph plus 1). + #[inline] pub fn glyph_count(&self) -> u16 { let range = self.shape.glyph_count_byte_range(); self.data.read_at(range.start).unwrap() @@ -777,6 +811,7 @@ impl<'a> Lookup8<'a> { /// The lookup values (indexed by the glyph index minus the value of /// firstGlyph). Entries in the value array must be two bytes. + #[inline] pub fn value_array(&self) -> &'a [BigEndian] { let range = self.shape.value_array_byte_range(); self.data.read_array(range).unwrap() @@ -853,6 +888,7 @@ impl MinByteRange for Lookup10Marker { } impl<'a> FontRead<'a> for Lookup10<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -876,6 +912,7 @@ pub type Lookup10<'a> = TableRef<'a, Lookup10Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> Lookup10<'a> { /// Format number is set to 10. + #[inline] pub fn format(&self) -> u16 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() @@ -883,12 +920,14 @@ impl<'a> Lookup10<'a> { /// Size of a lookup unit for this lookup table in bytes. Allowed values /// are 1, 2, 4, and 8. + #[inline] pub fn unit_size(&self) -> u16 { let range = self.shape.unit_size_byte_range(); self.data.read_at(range.start).unwrap() } /// First glyph index included in the trimmed array. + #[inline] pub fn first_glyph(&self) -> u16 { let range = self.shape.first_glyph_byte_range(); self.data.read_at(range.start).unwrap() @@ -896,6 +935,7 @@ impl<'a> Lookup10<'a> { /// Total number of glyphs (equivalent to the last glyph minus the value /// of firstGlyph plus 1). + #[inline] pub fn glyph_count(&self) -> u16 { let range = self.shape.glyph_count_byte_range(); self.data.read_at(range.start).unwrap() @@ -903,6 +943,7 @@ impl<'a> Lookup10<'a> { /// The lookup values (indexed by the glyph index minus the value of /// firstGlyph). + #[inline] pub fn values_data(&self) -> &'a [u8] { let range = self.shape.values_data_byte_range(); self.data.read_array(range).unwrap() @@ -968,6 +1009,7 @@ impl MinByteRange for StateHeaderMarker { } impl<'a> FontRead<'a> for StateHeader<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -985,12 +1027,14 @@ pub type StateHeader<'a> = TableRef<'a, StateHeaderMarker>; impl<'a> StateHeader<'a> { /// Size of a state, in bytes. The size is limited to 8 bits, although the /// field is 16 bits for alignment. + #[inline] pub fn state_size(&self) -> u16 { let range = self.shape.state_size_byte_range(); self.data.read_at(range.start).unwrap() } /// Byte offset from the beginning of the state table to the class subtable. + #[inline] pub fn class_table_offset(&self) -> Offset16 { let range = self.shape.class_table_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -1003,6 +1047,7 @@ impl<'a> StateHeader<'a> { } /// Byte offset from the beginning of the state table to the state array. + #[inline] pub fn state_array_offset(&self) -> Offset16 { let range = self.shape.state_array_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -1015,6 +1060,7 @@ impl<'a> StateHeader<'a> { } /// Byte offset from the beginning of the state table to the entry subtable. + #[inline] pub fn entry_table_offset(&self) -> Offset16 { let range = self.shape.entry_table_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -1091,6 +1137,7 @@ impl MinByteRange for ClassSubtableMarker { } impl<'a> FontRead<'a> for ClassSubtable<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -1111,12 +1158,14 @@ pub type ClassSubtable<'a> = TableRef<'a, ClassSubtableMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> ClassSubtable<'a> { /// Glyph index of the first glyph in the class table. + #[inline] pub fn first_glyph(&self) -> u16 { let range = self.shape.first_glyph_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of glyphs in class table. + #[inline] pub fn n_glyphs(&self) -> u16 { let range = self.shape.n_glyphs_byte_range(); self.data.read_at(range.start).unwrap() @@ -1124,6 +1173,7 @@ impl<'a> ClassSubtable<'a> { /// The class codes (indexed by glyph index minus firstGlyph). Class codes /// range from 0 to the value of stateSize minus 1. + #[inline] pub fn class_array(&self) -> &'a [u8] { let range = self.shape.class_array_byte_range(); self.data.read_array(range).unwrap() @@ -1174,6 +1224,7 @@ impl MinByteRange for RawBytesMarker { } impl<'a> FontRead<'a> for RawBytes<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let data_byte_len = cursor.remaining_bytes() / u8::RAW_BYTE_LEN * u8::RAW_BYTE_LEN; @@ -1187,6 +1238,7 @@ pub type RawBytes<'a> = TableRef<'a, RawBytesMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> RawBytes<'a> { + #[inline] pub fn data(&self) -> &'a [u8] { let range = self.shape.data_byte_range(); self.data.read_array(range).unwrap() @@ -1248,6 +1300,7 @@ impl MinByteRange for StxHeaderMarker { } impl<'a> FontRead<'a> for StxHeader<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -1264,12 +1317,14 @@ pub type StxHeader<'a> = TableRef<'a, StxHeaderMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> StxHeader<'a> { /// Number of classes, which is the number of 16-bit entry indices in a single line in the state array. + #[inline] pub fn n_classes(&self) -> u32 { let range = self.shape.n_classes_byte_range(); self.data.read_at(range.start).unwrap() } /// Byte offset from the beginning of the state table to the class subtable. + #[inline] pub fn class_table_offset(&self) -> Offset32 { let range = self.shape.class_table_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -1282,6 +1337,7 @@ impl<'a> StxHeader<'a> { } /// Byte offset from the beginning of the state table to the state array. + #[inline] pub fn state_array_offset(&self) -> Offset32 { let range = self.shape.state_array_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -1294,6 +1350,7 @@ impl<'a> StxHeader<'a> { } /// Byte offset from the beginning of the state table to the entry subtable. + #[inline] pub fn entry_table_offset(&self) -> Offset32 { let range = self.shape.entry_table_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -1360,6 +1417,7 @@ impl MinByteRange for RawWordsMarker { } impl<'a> FontRead<'a> for RawWords<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let data_byte_len = cursor.remaining_bytes() / u16::RAW_BYTE_LEN * u16::RAW_BYTE_LEN; @@ -1373,6 +1431,7 @@ pub type RawWords<'a> = TableRef<'a, RawWordsMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> RawWords<'a> { + #[inline] pub fn data(&self) -> &'a [BigEndian] { let range = self.shape.data_byte_range(); self.data.read_array(range).unwrap() diff --git a/read-fonts/generated/generated_ankr.rs b/read-fonts/generated/generated_ankr.rs index 0a4b42b7f..4dd251ea8 100644 --- a/read-fonts/generated/generated_ankr.rs +++ b/read-fonts/generated/generated_ankr.rs @@ -44,6 +44,7 @@ impl TopLevelTable for Ankr<'_> { } impl<'a> FontRead<'a> for Ankr<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -60,12 +61,14 @@ pub type Ankr<'a> = TableRef<'a, AnkrMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> Ankr<'a> { /// Version number (set to zero). + #[inline] pub fn version(&self) -> u16 { let range = self.shape.version_byte_range(); self.data.read_at(range.start).unwrap() } /// Flags (currently unused; set to zero). + #[inline] pub fn flags(&self) -> u16 { let range = self.shape.flags_byte_range(); self.data.read_at(range.start).unwrap() @@ -74,6 +77,7 @@ impl<'a> Ankr<'a> { /// Offset to the table's lookup table; currently this is always `0x0000000C`. /// /// Lookup values are two byte offsets into the glyph data table. + #[inline] pub fn lookup_table_offset(&self) -> Offset32 { let range = self.shape.lookup_table_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -86,6 +90,7 @@ impl<'a> Ankr<'a> { } /// Offset to the glyph data table. + #[inline] pub fn glyph_data_table_offset(&self) -> u32 { let range = self.shape.glyph_data_table_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -147,6 +152,7 @@ impl MinByteRange for GlyphDataEntryMarker { } impl<'a> FontRead<'a> for GlyphDataEntry<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let num_points: u32 = cursor.read()?; @@ -165,12 +171,14 @@ pub type GlyphDataEntry<'a> = TableRef<'a, GlyphDataEntryMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> GlyphDataEntry<'a> { /// Number of anchor points for this glyph. + #[inline] pub fn num_points(&self) -> u32 { let range = self.shape.num_points_byte_range(); self.data.read_at(range.start).unwrap() } /// Individual anchor points. + #[inline] pub fn anchor_points(&self) -> &'a [AnchorPoint] { let range = self.shape.anchor_points_byte_range(); self.data.read_array(range).unwrap() @@ -216,10 +224,12 @@ pub struct AnchorPoint { } impl AnchorPoint { + #[inline] pub fn x(&self) -> i16 { self.x.get() } + #[inline] pub fn y(&self) -> i16 { self.y.get() } diff --git a/read-fonts/generated/generated_avar.rs b/read-fonts/generated/generated_avar.rs index 8d1e74f3e..6b822fe8e 100644 --- a/read-fonts/generated/generated_avar.rs +++ b/read-fonts/generated/generated_avar.rs @@ -58,6 +58,7 @@ impl TopLevelTable for Avar<'_> { } impl<'a> FontRead<'a> for Avar<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let version: MajorMinor = cursor.read()?; @@ -97,24 +98,28 @@ pub type Avar<'a> = TableRef<'a, AvarMarker>; impl<'a> Avar<'a> { /// Major version number of the axis variations table — set to 1 or 2. /// Minor version number of the axis variations table — set to 0. + #[inline] pub fn version(&self) -> MajorMinor { let range = self.shape.version_byte_range(); self.data.read_at(range.start).unwrap() } /// The number of variation axes for this font. This must be the same number as axisCount in the 'fvar' table. + #[inline] pub fn axis_count(&self) -> u16 { let range = self.shape.axis_count_byte_range(); self.data.read_at(range.start).unwrap() } /// The segment maps array — one segment map for each axis, in the order of axes specified in the 'fvar' table. + #[inline] pub fn axis_segment_maps(&self) -> VarLenArray<'a, SegmentMaps<'a>> { let range = self.shape.axis_segment_maps_byte_range(); VarLenArray::read(self.data.split_off(range.start).unwrap()).unwrap() } /// Offset to DeltaSetIndexMap table (may be NULL). + #[inline] pub fn axis_index_map_offset(&self) -> Option> { let range = self.shape.axis_index_map_offset_byte_range()?; Some(self.data.read_at(range.start).unwrap()) @@ -127,6 +132,7 @@ impl<'a> Avar<'a> { } /// Offset to ItemVariationStore (may be NULL). + #[inline] pub fn var_store_offset(&self) -> Option> { let range = self.shape.var_store_offset_byte_range()?; Some(self.data.read_at(range.start).unwrap()) @@ -189,11 +195,13 @@ pub struct SegmentMaps<'a> { impl<'a> SegmentMaps<'a> { /// The number of correspondence pairs for this axis. + #[inline] pub fn position_map_count(&self) -> u16 { self.position_map_count.get() } /// The array of axis value map records for this axis. + #[inline] pub fn axis_value_maps(&self) -> &'a [AxisValueMap] { self.axis_value_maps } @@ -234,11 +242,13 @@ pub struct AxisValueMap { impl AxisValueMap { /// A normalized coordinate value obtained using default normalization. + #[inline] pub fn from_coordinate(&self) -> F2Dot14 { self.from_coordinate.get() } /// The modified, normalized coordinate value. + #[inline] pub fn to_coordinate(&self) -> F2Dot14 { self.to_coordinate.get() } diff --git a/read-fonts/generated/generated_base.rs b/read-fonts/generated/generated_base.rs index 4149390e2..db333a76a 100644 --- a/read-fonts/generated/generated_base.rs +++ b/read-fonts/generated/generated_base.rs @@ -46,6 +46,7 @@ impl TopLevelTable for Base<'_> { } impl<'a> FontRead<'a> for Base<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let version: MajorMinor = cursor.read()?; @@ -70,12 +71,14 @@ pub type Base<'a> = TableRef<'a, BaseMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> Base<'a> { /// (major, minor) Version for the BASE table (1,0) or (1,1) + #[inline] pub fn version(&self) -> MajorMinor { let range = self.shape.version_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset to horizontal Axis table, from beginning of BASE table (may be NULL) + #[inline] pub fn horiz_axis_offset(&self) -> Nullable { let range = self.shape.horiz_axis_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -88,6 +91,7 @@ impl<'a> Base<'a> { } /// Offset to vertical Axis table, from beginning of BASE table (may be NULL) + #[inline] pub fn vert_axis_offset(&self) -> Nullable { let range = self.shape.vert_axis_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -100,6 +104,7 @@ impl<'a> Base<'a> { } /// Offset to Item Variation Store table, from beginning of BASE table (may be null) + #[inline] pub fn item_var_store_offset(&self) -> Option> { let range = self.shape.item_var_store_offset_byte_range()?; Some(self.data.read_at(range.start).unwrap()) @@ -170,6 +175,7 @@ impl MinByteRange for AxisMarker { } impl<'a> FontRead<'a> for Axis<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -185,6 +191,7 @@ pub type Axis<'a> = TableRef<'a, AxisMarker>; impl<'a> Axis<'a> { /// Offset to BaseTagList table, from beginning of Axis table (may /// be NULL) + #[inline] pub fn base_tag_list_offset(&self) -> Nullable { let range = self.shape.base_tag_list_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -197,6 +204,7 @@ impl<'a> Axis<'a> { } /// Offset to BaseScriptList table, from beginning of Axis table + #[inline] pub fn base_script_list_offset(&self) -> Offset16 { let range = self.shape.base_script_list_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -263,6 +271,7 @@ impl MinByteRange for BaseTagListMarker { } impl<'a> FontRead<'a> for BaseTagList<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let base_tag_count: u16 = cursor.read()?; @@ -283,6 +292,7 @@ pub type BaseTagList<'a> = TableRef<'a, BaseTagListMarker>; impl<'a> BaseTagList<'a> { /// Number of baseline identification tags in this text direction /// — may be zero (0) + #[inline] pub fn base_tag_count(&self) -> u16 { let range = self.shape.base_tag_count_byte_range(); self.data.read_at(range.start).unwrap() @@ -290,6 +300,7 @@ impl<'a> BaseTagList<'a> { /// Array of 4-byte baseline identification tags — must be in /// alphabetical order + #[inline] pub fn baseline_tags(&self) -> &'a [BigEndian] { let range = self.shape.baseline_tags_byte_range(); self.data.read_array(range).unwrap() @@ -344,6 +355,7 @@ impl MinByteRange for BaseScriptListMarker { } impl<'a> FontRead<'a> for BaseScriptList<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let base_script_count: u16 = cursor.read()?; @@ -363,6 +375,7 @@ pub type BaseScriptList<'a> = TableRef<'a, BaseScriptListMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> BaseScriptList<'a> { /// Number of BaseScriptRecords defined + #[inline] pub fn base_script_count(&self) -> u16 { let range = self.shape.base_script_count_byte_range(); self.data.read_at(range.start).unwrap() @@ -370,6 +383,7 @@ impl<'a> BaseScriptList<'a> { /// Array of BaseScriptRecords, in alphabetical order by /// baseScriptTag + #[inline] pub fn base_script_records(&self) -> &'a [BaseScriptRecord] { let range = self.shape.base_script_records_byte_range(); self.data.read_array(range).unwrap() @@ -418,11 +432,13 @@ pub struct BaseScriptRecord { impl BaseScriptRecord { /// 4-byte script identification tag + #[inline] pub fn base_script_tag(&self) -> Tag { self.base_script_tag.get() } /// Offset to BaseScript table, from beginning of BaseScriptList + #[inline] pub fn base_script_offset(&self) -> Offset16 { self.base_script_offset.get() } @@ -494,6 +510,7 @@ impl MinByteRange for BaseScriptMarker { } impl<'a> FontRead<'a> for BaseScript<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -515,6 +532,7 @@ pub type BaseScript<'a> = TableRef<'a, BaseScriptMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> BaseScript<'a> { /// Offset to BaseValues table, from beginning of BaseScript table (may be NULL) + #[inline] pub fn base_values_offset(&self) -> Nullable { let range = self.shape.base_values_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -527,6 +545,7 @@ impl<'a> BaseScript<'a> { } /// Offset to MinMax table, from beginning of BaseScript table (may be NULL) + #[inline] pub fn default_min_max_offset(&self) -> Nullable { let range = self.shape.default_min_max_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -539,6 +558,7 @@ impl<'a> BaseScript<'a> { } /// Number of BaseLangSysRecords defined — may be zero (0) + #[inline] pub fn base_lang_sys_count(&self) -> u16 { let range = self.shape.base_lang_sys_count_byte_range(); self.data.read_at(range.start).unwrap() @@ -546,6 +566,7 @@ impl<'a> BaseScript<'a> { /// Array of BaseLangSysRecords, in alphabetical order by /// BaseLangSysTag + #[inline] pub fn base_lang_sys_records(&self) -> &'a [BaseLangSysRecord] { let range = self.shape.base_lang_sys_records_byte_range(); self.data.read_array(range).unwrap() @@ -605,11 +626,13 @@ pub struct BaseLangSysRecord { impl BaseLangSysRecord { /// 4-byte language system identification tag + #[inline] pub fn base_lang_sys_tag(&self) -> Tag { self.base_lang_sys_tag.get() } /// Offset to MinMax table, from beginning of BaseScript table + #[inline] pub fn min_max_offset(&self) -> Offset16 { self.min_max_offset.get() } @@ -676,6 +699,7 @@ impl MinByteRange for BaseValuesMarker { } impl<'a> FontRead<'a> for BaseValues<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -698,6 +722,7 @@ impl<'a> BaseValues<'a> { /// Index number of default baseline for this script — equals /// index position of baseline tag in baselineTags array of the /// BaseTagList + #[inline] pub fn default_baseline_index(&self) -> u16 { let range = self.shape.default_baseline_index_byte_range(); self.data.read_at(range.start).unwrap() @@ -705,6 +730,7 @@ impl<'a> BaseValues<'a> { /// Number of BaseCoord tables defined — should equal /// baseTagCount in the BaseTagList + #[inline] pub fn base_coord_count(&self) -> u16 { let range = self.shape.base_coord_count_byte_range(); self.data.read_at(range.start).unwrap() @@ -713,6 +739,7 @@ impl<'a> BaseValues<'a> { /// Array of offsets to BaseCoord tables, from beginning of /// BaseValues table — order matches baselineTags array in the /// BaseTagList + #[inline] pub fn base_coord_offsets(&self) -> &'a [BigEndian] { let range = self.shape.base_coord_offsets_byte_range(); self.data.read_array(range).unwrap() @@ -801,6 +828,7 @@ impl MinByteRange for MinMaxMarker { } impl<'a> FontRead<'a> for MinMax<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -823,6 +851,7 @@ pub type MinMax<'a> = TableRef<'a, MinMaxMarker>; impl<'a> MinMax<'a> { /// Offset to BaseCoord table that defines the minimum extent /// value, from the beginning of MinMax table (may be NULL) + #[inline] pub fn min_coord_offset(&self) -> Nullable { let range = self.shape.min_coord_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -836,6 +865,7 @@ impl<'a> MinMax<'a> { /// Offset to BaseCoord table that defines maximum extent value, /// from the beginning of MinMax table (may be NULL) + #[inline] pub fn max_coord_offset(&self) -> Nullable { let range = self.shape.max_coord_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -848,6 +878,7 @@ impl<'a> MinMax<'a> { } /// Number of FeatMinMaxRecords — may be zero (0) + #[inline] pub fn feat_min_max_count(&self) -> u16 { let range = self.shape.feat_min_max_count_byte_range(); self.data.read_at(range.start).unwrap() @@ -855,6 +886,7 @@ impl<'a> MinMax<'a> { /// Array of FeatMinMaxRecords, in alphabetical order by /// featureTableTag + #[inline] pub fn feat_min_max_records(&self) -> &'a [FeatMinMaxRecord] { let range = self.shape.feat_min_max_records_byte_range(); self.data.read_array(range).unwrap() @@ -917,12 +949,14 @@ pub struct FeatMinMaxRecord { impl FeatMinMaxRecord { /// 4-byte feature identification tag — must match feature tag in /// FeatureList + #[inline] pub fn feature_table_tag(&self) -> Tag { self.feature_table_tag.get() } /// Offset to BaseCoord table that defines the minimum extent /// value, from beginning of MinMax table (may be NULL) + #[inline] pub fn min_coord_offset(&self) -> Nullable { self.min_coord_offset.get() } @@ -938,6 +972,7 @@ impl FeatMinMaxRecord { /// Offset to BaseCoord table that defines the maximum extent /// value, from beginning of MinMax table (may be NULL) + #[inline] pub fn max_coord_offset(&self) -> Nullable { self.max_coord_offset.get() } @@ -1092,6 +1127,7 @@ impl MinByteRange for BaseCoordFormat1Marker { } impl<'a> FontRead<'a> for BaseCoordFormat1<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -1106,12 +1142,14 @@ pub type BaseCoordFormat1<'a> = TableRef<'a, BaseCoordFormat1Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> BaseCoordFormat1<'a> { /// Format identifier — format = 1 + #[inline] pub fn base_coord_format(&self) -> u16 { let range = self.shape.base_coord_format_byte_range(); self.data.read_at(range.start).unwrap() } /// X or Y value, in design units + #[inline] pub fn coordinate(&self) -> i16 { let range = self.shape.coordinate_byte_range(); self.data.read_at(range.start).unwrap() @@ -1178,6 +1216,7 @@ impl MinByteRange for BaseCoordFormat2Marker { } impl<'a> FontRead<'a> for BaseCoordFormat2<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -1194,24 +1233,28 @@ pub type BaseCoordFormat2<'a> = TableRef<'a, BaseCoordFormat2Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> BaseCoordFormat2<'a> { /// Format identifier — format = 2 + #[inline] pub fn base_coord_format(&self) -> u16 { let range = self.shape.base_coord_format_byte_range(); self.data.read_at(range.start).unwrap() } /// X or Y value, in design units + #[inline] pub fn coordinate(&self) -> i16 { let range = self.shape.coordinate_byte_range(); self.data.read_at(range.start).unwrap() } /// Glyph ID of control glyph + #[inline] pub fn reference_glyph(&self) -> u16 { let range = self.shape.reference_glyph_byte_range(); self.data.read_at(range.start).unwrap() } /// Index of contour point on the reference glyph + #[inline] pub fn base_coord_point(&self) -> u16 { let range = self.shape.base_coord_point_byte_range(); self.data.read_at(range.start).unwrap() @@ -1275,6 +1318,7 @@ impl MinByteRange for BaseCoordFormat3Marker { } impl<'a> FontRead<'a> for BaseCoordFormat3<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -1290,12 +1334,14 @@ pub type BaseCoordFormat3<'a> = TableRef<'a, BaseCoordFormat3Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> BaseCoordFormat3<'a> { /// Format identifier — format = 3 + #[inline] pub fn base_coord_format(&self) -> u16 { let range = self.shape.base_coord_format_byte_range(); self.data.read_at(range.start).unwrap() } /// X or Y value, in design units + #[inline] pub fn coordinate(&self) -> i16 { let range = self.shape.coordinate_byte_range(); self.data.read_at(range.start).unwrap() @@ -1304,6 +1350,7 @@ impl<'a> BaseCoordFormat3<'a> { /// Offset to Device table (non-variable font) / Variation Index /// table (variable font) for X or Y value, from beginning of /// BaseCoord table (may be NULL). + #[inline] pub fn device_offset(&self) -> Nullable { let range = self.shape.device_offset_byte_range(); self.data.read_at(range.start).unwrap() diff --git a/read-fonts/generated/generated_bitmap.rs b/read-fonts/generated/generated_bitmap.rs index af2bac926..c8639c111 100644 --- a/read-fonts/generated/generated_bitmap.rs +++ b/read-fonts/generated/generated_bitmap.rs @@ -39,62 +39,74 @@ pub struct BitmapSize { impl BitmapSize { /// Offset to IndexSubtableList, from beginning of EBLC/CBLC. + #[inline] pub fn index_subtable_list_offset(&self) -> u32 { self.index_subtable_list_offset.get() } /// Total size in bytes of the IndexSubtableList including its array of IndexSubtables. + #[inline] pub fn index_subtable_list_size(&self) -> u32 { self.index_subtable_list_size.get() } /// Number of IndexSubtables in the IndexSubtableList. + #[inline] pub fn number_of_index_subtables(&self) -> u32 { self.number_of_index_subtables.get() } /// Not used; set to 0. + #[inline] pub fn color_ref(&self) -> u32 { self.color_ref.get() } /// Line metrics for text rendered horizontally. + #[inline] pub fn hori(&self) -> &SbitLineMetrics { &self.hori } /// Line metrics for text rendered vertically. + #[inline] pub fn vert(&self) -> &SbitLineMetrics { &self.vert } /// Lowest glyph index for this size. + #[inline] pub fn start_glyph_index(&self) -> GlyphId16 { self.start_glyph_index.get() } /// Highest glyph index for this size. + #[inline] pub fn end_glyph_index(&self) -> GlyphId16 { self.end_glyph_index.get() } /// Horizontal pixels per em. + #[inline] pub fn ppem_x(&self) -> u8 { self.ppem_x } /// Vertical pixels per em. + #[inline] pub fn ppem_y(&self) -> u8 { self.ppem_y } /// The Microsoft rasterizer v.1.7 or greater supports the following /// bitDepth values, as described below: 1, 2, 4, and 8 (and 32 for CBLC). + #[inline] pub fn bit_depth(&self) -> u8 { self.bit_depth } /// Vertical or horizontal. + #[inline] pub fn flags(&self) -> BitmapFlags { self.flags.get() } @@ -169,50 +181,62 @@ pub struct SbitLineMetrics { } impl SbitLineMetrics { + #[inline] pub fn ascender(&self) -> i8 { self.ascender.get() } + #[inline] pub fn descender(&self) -> i8 { self.descender.get() } + #[inline] pub fn width_max(&self) -> u8 { self.width_max } + #[inline] pub fn caret_slope_numerator(&self) -> i8 { self.caret_slope_numerator.get() } + #[inline] pub fn caret_slope_denominator(&self) -> u8 { self.caret_slope_denominator } + #[inline] pub fn caret_offset(&self) -> i8 { self.caret_offset.get() } + #[inline] pub fn min_origin_sb(&self) -> i8 { self.min_origin_sb.get() } + #[inline] pub fn min_advance_sb(&self) -> i8 { self.min_advance_sb.get() } + #[inline] pub fn max_before_bl(&self) -> i8 { self.max_before_bl.get() } + #[inline] pub fn min_after_bl(&self) -> i8 { self.min_after_bl.get() } + #[inline] pub fn pad1(&self) -> i8 { self.pad1.get() } + #[inline] pub fn pad2(&self) -> i8 { self.pad2.get() } @@ -597,41 +621,49 @@ pub struct BigGlyphMetrics { impl BigGlyphMetrics { /// Number of rows of data. + #[inline] pub fn height(&self) -> u8 { self.height } /// Number of columns of data. + #[inline] pub fn width(&self) -> u8 { self.width } /// Distance in pixels from the horizontal origin to the left edge of the bitmap. + #[inline] pub fn hori_bearing_x(&self) -> i8 { self.hori_bearing_x.get() } /// Distance in pixels from the horizontal origin to the top edge of the bitmap. + #[inline] pub fn hori_bearing_y(&self) -> i8 { self.hori_bearing_y.get() } /// Horizontal advance width in pixels. + #[inline] pub fn hori_advance(&self) -> u8 { self.hori_advance } /// Distance in pixels from the vertical origin to the left edge of the bitmap. + #[inline] pub fn vert_bearing_x(&self) -> i8 { self.vert_bearing_x.get() } /// Distance in pixels from the vertical origin to the top edge of the bitmap. + #[inline] pub fn vert_bearing_y(&self) -> i8 { self.vert_bearing_y.get() } /// Vertical advance width in pixels. + #[inline] pub fn vert_advance(&self) -> u8 { self.vert_advance } @@ -688,26 +720,31 @@ pub struct SmallGlyphMetrics { impl SmallGlyphMetrics { /// Number of rows of data. + #[inline] pub fn height(&self) -> u8 { self.height } /// Number of columns of data. + #[inline] pub fn width(&self) -> u8 { self.width } /// Distance in pixels from the horizontal origin to the left edge of the bitmap (for horizontal text); or distance in pixels from the vertical origin to the top edge of the bitmap (for vertical text). + #[inline] pub fn bearing_x(&self) -> i8 { self.bearing_x.get() } /// Distance in pixels from the horizontal origin to the top edge of the bitmap (for horizontal text); or distance in pixels from the vertical origin to the left edge of the bitmap (for vertical text). + #[inline] pub fn bearing_y(&self) -> i8 { self.bearing_y.get() } /// Horizontal or vertical advance width in pixels. + #[inline] pub fn advance(&self) -> u8 { self.advance } @@ -764,6 +801,7 @@ impl ReadArgs for IndexSubtableList<'_> { } impl<'a> FontReadWithArgs<'a> for IndexSubtableList<'a> { + #[inline] fn read_with_args(data: FontData<'a>, args: &u32) -> Result { let number_of_index_subtables = *args; let mut cursor = data.cursor(); @@ -782,6 +820,7 @@ impl<'a> IndexSubtableList<'a> { /// /// This type requires some external state in order to be /// parsed. + #[inline] pub fn read(data: FontData<'a>, number_of_index_subtables: u32) -> Result { let args = number_of_index_subtables; Self::read_with_args(data, &args) @@ -794,6 +833,7 @@ pub type IndexSubtableList<'a> = TableRef<'a, IndexSubtableListMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> IndexSubtableList<'a> { /// Array of IndexSubtableRecords. + #[inline] pub fn index_subtable_records(&self) -> &'a [IndexSubtableRecord] { let range = self.shape.index_subtable_records_byte_range(); self.data.read_array(range).unwrap() @@ -842,16 +882,19 @@ pub struct IndexSubtableRecord { impl IndexSubtableRecord { /// First glyph ID of this range. + #[inline] pub fn first_glyph_index(&self) -> GlyphId16 { self.first_glyph_index.get() } /// Last glyph ID of this range (inclusive). + #[inline] pub fn last_glyph_index(&self) -> GlyphId16 { self.last_glyph_index.get() } /// Offset to an IndexSubtable from the start of the IndexSubtableList. + #[inline] pub fn index_subtable_offset(&self) -> Offset32 { self.index_subtable_offset.get() } @@ -934,6 +977,7 @@ impl ReadArgs for IndexSubtable1<'_> { } impl<'a> FontReadWithArgs<'a> for IndexSubtable1<'a> { + #[inline] fn read_with_args( data: FontData<'a>, args: &(GlyphId16, GlyphId16), @@ -959,6 +1003,7 @@ impl<'a> IndexSubtable1<'a> { /// /// This type requires some external state in order to be /// parsed. + #[inline] pub fn read( data: FontData<'a>, last_glyph_index: GlyphId16, @@ -975,23 +1020,27 @@ pub type IndexSubtable1<'a> = TableRef<'a, IndexSubtable1Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> IndexSubtable1<'a> { /// Format of this IndexSubTable. + #[inline] pub fn index_format(&self) -> u16 { let range = self.shape.index_format_byte_range(); self.data.read_at(range.start).unwrap() } /// Format of EBDT image data. + #[inline] pub fn image_format(&self) -> u16 { let range = self.shape.image_format_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset to image data in EBDT table. + #[inline] pub fn image_data_offset(&self) -> u32 { let range = self.shape.image_data_offset_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn sbit_offsets(&self) -> &'a [BigEndian] { let range = self.shape.sbit_offsets_byte_range(); self.data.read_array(range).unwrap() @@ -1067,6 +1116,7 @@ impl MinByteRange for IndexSubtable2Marker { } impl<'a> FontRead<'a> for IndexSubtable2<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -1087,30 +1137,35 @@ pub type IndexSubtable2<'a> = TableRef<'a, IndexSubtable2Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> IndexSubtable2<'a> { /// Format of this IndexSubTable. + #[inline] pub fn index_format(&self) -> u16 { let range = self.shape.index_format_byte_range(); self.data.read_at(range.start).unwrap() } /// Format of EBDT image data. + #[inline] pub fn image_format(&self) -> u16 { let range = self.shape.image_format_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset to image data in EBDT table. + #[inline] pub fn image_data_offset(&self) -> u32 { let range = self.shape.image_data_offset_byte_range(); self.data.read_at(range.start).unwrap() } /// All the glyphs are of the same size. + #[inline] pub fn image_size(&self) -> u32 { let range = self.shape.image_size_byte_range(); self.data.read_at(range.start).unwrap() } /// All glyphs have the same metrics; glyph data may be compressed, byte-aligned, or bit-aligned. + #[inline] pub fn big_metrics(&self) -> &'a [BigGlyphMetrics] { let range = self.shape.big_metrics_byte_range(); self.data.read_array(range).unwrap() @@ -1193,6 +1248,7 @@ impl ReadArgs for IndexSubtable3<'_> { } impl<'a> FontReadWithArgs<'a> for IndexSubtable3<'a> { + #[inline] fn read_with_args( data: FontData<'a>, args: &(GlyphId16, GlyphId16), @@ -1218,6 +1274,7 @@ impl<'a> IndexSubtable3<'a> { /// /// This type requires some external state in order to be /// parsed. + #[inline] pub fn read( data: FontData<'a>, last_glyph_index: GlyphId16, @@ -1234,23 +1291,27 @@ pub type IndexSubtable3<'a> = TableRef<'a, IndexSubtable3Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> IndexSubtable3<'a> { /// Format of this IndexSubTable. + #[inline] pub fn index_format(&self) -> u16 { let range = self.shape.index_format_byte_range(); self.data.read_at(range.start).unwrap() } /// Format of EBDT image data. + #[inline] pub fn image_format(&self) -> u16 { let range = self.shape.image_format_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset to image data in EBDT table. + #[inline] pub fn image_data_offset(&self) -> u32 { let range = self.shape.image_data_offset_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn sbit_offsets(&self) -> &'a [BigEndian] { let range = self.shape.sbit_offsets_byte_range(); self.data.read_array(range).unwrap() @@ -1326,6 +1387,7 @@ impl MinByteRange for IndexSubtable4Marker { } impl<'a> FontRead<'a> for IndexSubtable4<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -1348,30 +1410,35 @@ pub type IndexSubtable4<'a> = TableRef<'a, IndexSubtable4Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> IndexSubtable4<'a> { /// Format of this IndexSubTable. + #[inline] pub fn index_format(&self) -> u16 { let range = self.shape.index_format_byte_range(); self.data.read_at(range.start).unwrap() } /// Format of EBDT image data. + #[inline] pub fn image_format(&self) -> u16 { let range = self.shape.image_format_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset to image data in EBDT table. + #[inline] pub fn image_data_offset(&self) -> u32 { let range = self.shape.image_data_offset_byte_range(); self.data.read_at(range.start).unwrap() } /// Array length. + #[inline] pub fn num_glyphs(&self) -> u32 { let range = self.shape.num_glyphs_byte_range(); self.data.read_at(range.start).unwrap() } /// One per glyph. + #[inline] pub fn glyph_array(&self) -> &'a [GlyphIdOffsetPair] { let range = self.shape.glyph_array_byte_range(); self.data.read_array(range).unwrap() @@ -1423,11 +1490,13 @@ pub struct GlyphIdOffsetPair { impl GlyphIdOffsetPair { /// Glyph ID of glyph present. + #[inline] pub fn glyph_id(&self) -> GlyphId16 { self.glyph_id.get() } /// Location in EBDT. + #[inline] pub fn sbit_offset(&self) -> u16 { self.sbit_offset.get() } @@ -1508,6 +1577,7 @@ impl MinByteRange for IndexSubtable5Marker { } impl<'a> FontRead<'a> for IndexSubtable5<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -1534,42 +1604,49 @@ pub type IndexSubtable5<'a> = TableRef<'a, IndexSubtable5Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> IndexSubtable5<'a> { /// Format of this IndexSubTable. + #[inline] pub fn index_format(&self) -> u16 { let range = self.shape.index_format_byte_range(); self.data.read_at(range.start).unwrap() } /// Format of EBDT image data. + #[inline] pub fn image_format(&self) -> u16 { let range = self.shape.image_format_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset to image data in EBDT table. + #[inline] pub fn image_data_offset(&self) -> u32 { let range = self.shape.image_data_offset_byte_range(); self.data.read_at(range.start).unwrap() } /// All glyphs have the same data size. + #[inline] pub fn image_size(&self) -> u32 { let range = self.shape.image_size_byte_range(); self.data.read_at(range.start).unwrap() } /// All glyphs have the same metrics. + #[inline] pub fn big_metrics(&self) -> &'a [BigGlyphMetrics] { let range = self.shape.big_metrics_byte_range(); self.data.read_array(range).unwrap() } /// Array length. + #[inline] pub fn num_glyphs(&self) -> u32 { let range = self.shape.num_glyphs_byte_range(); self.data.read_at(range.start).unwrap() } /// One per glyph, sorted by glyhph ID. + #[inline] pub fn glyph_array(&self) -> &'a [BigEndian] { let range = self.shape.glyph_array_byte_range(); self.data.read_array(range).unwrap() @@ -1625,16 +1702,19 @@ pub struct BdtComponent { impl BdtComponent { /// Component glyph ID. + #[inline] pub fn glyph_id(&self) -> GlyphId16 { self.glyph_id.get() } /// Position of component left. + #[inline] pub fn x_offset(&self) -> i8 { self.x_offset.get() } /// Position of component top. + #[inline] pub fn y_offset(&self) -> i8 { self.y_offset.get() } diff --git a/read-fonts/generated/generated_cbdt.rs b/read-fonts/generated/generated_cbdt.rs index 900f1ce2f..60f2e23e0 100644 --- a/read-fonts/generated/generated_cbdt.rs +++ b/read-fonts/generated/generated_cbdt.rs @@ -34,6 +34,7 @@ impl TopLevelTable for Cbdt<'_> { } impl<'a> FontRead<'a> for Cbdt<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -48,12 +49,14 @@ pub type Cbdt<'a> = TableRef<'a, CbdtMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> Cbdt<'a> { /// Major version of the CBDT table, = 3. + #[inline] pub fn major_version(&self) -> u16 { let range = self.shape.major_version_byte_range(); self.data.read_at(range.start).unwrap() } /// Minor version of CBDT table, = 0. + #[inline] pub fn minor_version(&self) -> u16 { let range = self.shape.minor_version_byte_range(); self.data.read_at(range.start).unwrap() diff --git a/read-fonts/generated/generated_cblc.rs b/read-fonts/generated/generated_cblc.rs index 33bd528a7..c3c65adbf 100644 --- a/read-fonts/generated/generated_cblc.rs +++ b/read-fonts/generated/generated_cblc.rs @@ -46,6 +46,7 @@ impl TopLevelTable for Cblc<'_> { } impl<'a> FontRead<'a> for Cblc<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -67,24 +68,28 @@ pub type Cblc<'a> = TableRef<'a, CblcMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> Cblc<'a> { /// Major version of the CBLC table, = 3. + #[inline] pub fn major_version(&self) -> u16 { let range = self.shape.major_version_byte_range(); self.data.read_at(range.start).unwrap() } /// Minor version of CBLC table, = 0. + #[inline] pub fn minor_version(&self) -> u16 { let range = self.shape.minor_version_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of BitmapSize records. + #[inline] pub fn num_sizes(&self) -> u32 { let range = self.shape.num_sizes_byte_range(); self.data.read_at(range.start).unwrap() } /// BitmapSize records array. + #[inline] pub fn bitmap_sizes(&self) -> &'a [BitmapSize] { let range = self.shape.bitmap_sizes_byte_range(); self.data.read_array(range).unwrap() diff --git a/read-fonts/generated/generated_cff.rs b/read-fonts/generated/generated_cff.rs index 64668d9ee..a2cfeecad 100644 --- a/read-fonts/generated/generated_cff.rs +++ b/read-fonts/generated/generated_cff.rs @@ -52,6 +52,7 @@ impl MinByteRange for CffHeaderMarker { } impl<'a> FontRead<'a> for CffHeader<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -77,36 +78,42 @@ pub type CffHeader<'a> = TableRef<'a, CffHeaderMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> CffHeader<'a> { /// Format major version (starting at 1). + #[inline] pub fn major(&self) -> u8 { let range = self.shape.major_byte_range(); self.data.read_at(range.start).unwrap() } /// Format minor version (starting at 0). + #[inline] pub fn minor(&self) -> u8 { let range = self.shape.minor_byte_range(); self.data.read_at(range.start).unwrap() } /// Header size (bytes). + #[inline] pub fn hdr_size(&self) -> u8 { let range = self.shape.hdr_size_byte_range(); self.data.read_at(range.start).unwrap() } /// Absolute offset size. + #[inline] pub fn off_size(&self) -> u8 { let range = self.shape.off_size_byte_range(); self.data.read_at(range.start).unwrap() } /// Padding bytes before the start of the Name INDEX. + #[inline] pub fn _padding(&self) -> &'a [u8] { let range = self.shape._padding_byte_range(); self.data.read_array(range).unwrap() } /// Remaining table data. + #[inline] pub fn trailing_data(&self) -> &'a [u8] { let range = self.shape.trailing_data_byte_range(); self.data.read_array(range).unwrap() diff --git a/read-fonts/generated/generated_cff2.rs b/read-fonts/generated/generated_cff2.rs index 0bd7bd474..9a3f7640a 100644 --- a/read-fonts/generated/generated_cff2.rs +++ b/read-fonts/generated/generated_cff2.rs @@ -58,6 +58,7 @@ impl MinByteRange for Cff2HeaderMarker { } impl<'a> FontRead<'a> for Cff2Header<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -88,42 +89,49 @@ pub type Cff2Header<'a> = TableRef<'a, Cff2HeaderMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> Cff2Header<'a> { /// Format major version (set to 2). + #[inline] pub fn major_version(&self) -> u8 { let range = self.shape.major_version_byte_range(); self.data.read_at(range.start).unwrap() } /// Format minor version (set to 0). + #[inline] pub fn minor_version(&self) -> u8 { let range = self.shape.minor_version_byte_range(); self.data.read_at(range.start).unwrap() } /// Header size (bytes). + #[inline] pub fn header_size(&self) -> u8 { let range = self.shape.header_size_byte_range(); self.data.read_at(range.start).unwrap() } /// Length of Top DICT structure in bytes. + #[inline] pub fn top_dict_length(&self) -> u16 { let range = self.shape.top_dict_length_byte_range(); self.data.read_at(range.start).unwrap() } /// Padding bytes before the start of the Top DICT. + #[inline] pub fn _padding(&self) -> &'a [u8] { let range = self.shape._padding_byte_range(); self.data.read_array(range).unwrap() } /// Data containing the Top DICT. + #[inline] pub fn top_dict_data(&self) -> &'a [u8] { let range = self.shape.top_dict_data_byte_range(); self.data.read_array(range).unwrap() } /// Remaining table data. + #[inline] pub fn trailing_data(&self) -> &'a [u8] { let range = self.shape.trailing_data_byte_range(); self.data.read_array(range).unwrap() diff --git a/read-fonts/generated/generated_cmap.rs b/read-fonts/generated/generated_cmap.rs index 346562a33..39e67d502 100644 --- a/read-fonts/generated/generated_cmap.rs +++ b/read-fonts/generated/generated_cmap.rs @@ -41,6 +41,7 @@ impl TopLevelTable for Cmap<'_> { } impl<'a> FontRead<'a> for Cmap<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -61,17 +62,20 @@ pub type Cmap<'a> = TableRef<'a, CmapMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> Cmap<'a> { /// Table version number (0). + #[inline] pub fn version(&self) -> u16 { let range = self.shape.version_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of encoding tables that follow. + #[inline] pub fn num_tables(&self) -> u16 { let range = self.shape.num_tables_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn encoding_records(&self) -> &'a [EncodingRecord] { let range = self.shape.encoding_records_byte_range(); self.data.read_array(range).unwrap() @@ -124,17 +128,20 @@ pub struct EncodingRecord { impl EncodingRecord { /// Platform ID. + #[inline] pub fn platform_id(&self) -> PlatformId { self.platform_id.get() } /// Platform-specific encoding ID. + #[inline] pub fn encoding_id(&self) -> u16 { self.encoding_id.get() } /// Byte offset from beginning of the [`Cmap`] table to the subtable for this /// encoding. + #[inline] pub fn subtable_offset(&self) -> Offset32 { self.subtable_offset.get() } @@ -378,6 +385,7 @@ impl MinByteRange for Cmap0Marker { } impl<'a> FontRead<'a> for Cmap0<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -399,12 +407,14 @@ pub type Cmap0<'a> = TableRef<'a, Cmap0Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> Cmap0<'a> { /// Format number is set to 0. + #[inline] pub fn format(&self) -> u16 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// This is the length in bytes of the subtable. + #[inline] pub fn length(&self) -> u16 { let range = self.shape.length_byte_range(); self.data.read_at(range.start).unwrap() @@ -412,12 +422,14 @@ impl<'a> Cmap0<'a> { /// For requirements on use of the language field, see “Use of /// the language field in 'cmap' subtables” in this document. + #[inline] pub fn language(&self) -> u16 { let range = self.shape.language_byte_range(); self.data.read_at(range.start).unwrap() } /// An array that maps character codes to glyph index values. + #[inline] pub fn glyph_id_array(&self) -> &'a [u8] { let range = self.shape.glyph_id_array_byte_range(); self.data.read_array(range).unwrap() @@ -488,6 +500,7 @@ impl MinByteRange for Cmap2Marker { } impl<'a> FontRead<'a> for Cmap2<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -509,12 +522,14 @@ pub type Cmap2<'a> = TableRef<'a, Cmap2Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> Cmap2<'a> { /// Format number is set to 2. + #[inline] pub fn format(&self) -> u16 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// This is the length in bytes of the subtable. + #[inline] pub fn length(&self) -> u16 { let range = self.shape.length_byte_range(); self.data.read_at(range.start).unwrap() @@ -522,6 +537,7 @@ impl<'a> Cmap2<'a> { /// For requirements on use of the language field, see “Use of /// the language field in 'cmap' subtables” in this document. + #[inline] pub fn language(&self) -> u16 { let range = self.shape.language_byte_range(); self.data.read_at(range.start).unwrap() @@ -529,6 +545,7 @@ impl<'a> Cmap2<'a> { /// Array that maps high bytes to subHeaders: value is subHeader /// index × 8. + #[inline] pub fn sub_header_keys(&self) -> &'a [BigEndian] { let range = self.shape.sub_header_keys_byte_range(); self.data.read_array(range).unwrap() @@ -576,21 +593,25 @@ pub struct SubHeader { impl SubHeader { /// First valid low byte for this SubHeader. + #[inline] pub fn first_code(&self) -> u16 { self.first_code.get() } /// Number of valid low bytes for this SubHeader. + #[inline] pub fn entry_count(&self) -> u16 { self.entry_count.get() } /// See text below. + #[inline] pub fn id_delta(&self) -> i16 { self.id_delta.get() } /// See text below. + #[inline] pub fn id_range_offset(&self) -> u16 { self.id_range_offset.get() } @@ -707,6 +728,7 @@ impl MinByteRange for Cmap4Marker { } impl<'a> FontRead<'a> for Cmap4<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -752,12 +774,14 @@ pub type Cmap4<'a> = TableRef<'a, Cmap4Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> Cmap4<'a> { /// Format number is set to 4. + #[inline] pub fn format(&self) -> u16 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// This is the length in bytes of the subtable. + #[inline] pub fn length(&self) -> u16 { let range = self.shape.length_byte_range(); self.data.read_at(range.start).unwrap() @@ -765,12 +789,14 @@ impl<'a> Cmap4<'a> { /// For requirements on use of the language field, see “Use of /// the language field in 'cmap' subtables” in this document. + #[inline] pub fn language(&self) -> u16 { let range = self.shape.language_byte_range(); self.data.read_at(range.start).unwrap() } /// 2 × segCount. + #[inline] pub fn seg_count_x2(&self) -> u16 { let range = self.shape.seg_count_x2_byte_range(); self.data.read_at(range.start).unwrap() @@ -779,6 +805,7 @@ impl<'a> Cmap4<'a> { /// Maximum power of 2 less than or equal to segCount, times 2 /// ((2**floor(log2(segCount))) * 2, where “**” is an /// exponentiation operator) + #[inline] pub fn search_range(&self) -> u16 { let range = self.shape.search_range_byte_range(); self.data.read_at(range.start).unwrap() @@ -786,6 +813,7 @@ impl<'a> Cmap4<'a> { /// Log2 of the maximum power of 2 less than or equal to numTables /// (log2(searchRange/2), which is equal to floor(log2(segCount))) + #[inline] pub fn entry_selector(&self) -> u16 { let range = self.shape.entry_selector_byte_range(); self.data.read_at(range.start).unwrap() @@ -793,36 +821,42 @@ impl<'a> Cmap4<'a> { /// segCount times 2, minus searchRange ((segCount * 2) - /// searchRange) + #[inline] pub fn range_shift(&self) -> u16 { let range = self.shape.range_shift_byte_range(); self.data.read_at(range.start).unwrap() } /// End characterCode for each segment, last=0xFFFF. + #[inline] pub fn end_code(&self) -> &'a [BigEndian] { let range = self.shape.end_code_byte_range(); self.data.read_array(range).unwrap() } /// Start character code for each segment. + #[inline] pub fn start_code(&self) -> &'a [BigEndian] { let range = self.shape.start_code_byte_range(); self.data.read_array(range).unwrap() } /// Delta for all character codes in segment. + #[inline] pub fn id_delta(&self) -> &'a [BigEndian] { let range = self.shape.id_delta_byte_range(); self.data.read_array(range).unwrap() } /// Offsets into glyphIdArray or 0 + #[inline] pub fn id_range_offsets(&self) -> &'a [BigEndian] { let range = self.shape.id_range_offsets_byte_range(); self.data.read_array(range).unwrap() } /// Glyph index array (arbitrary length) + #[inline] pub fn glyph_id_array(&self) -> &'a [BigEndian] { let range = self.shape.glyph_id_array_byte_range(); self.data.read_array(range).unwrap() @@ -911,6 +945,7 @@ impl MinByteRange for Cmap6Marker { } impl<'a> FontRead<'a> for Cmap6<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -934,12 +969,14 @@ pub type Cmap6<'a> = TableRef<'a, Cmap6Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> Cmap6<'a> { /// Format number is set to 6. + #[inline] pub fn format(&self) -> u16 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// This is the length in bytes of the subtable. + #[inline] pub fn length(&self) -> u16 { let range = self.shape.length_byte_range(); self.data.read_at(range.start).unwrap() @@ -947,24 +984,28 @@ impl<'a> Cmap6<'a> { /// For requirements on use of the language field, see “Use of /// the language field in 'cmap' subtables” in this document. + #[inline] pub fn language(&self) -> u16 { let range = self.shape.language_byte_range(); self.data.read_at(range.start).unwrap() } /// First character code of subrange. + #[inline] pub fn first_code(&self) -> u16 { let range = self.shape.first_code_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of character codes in subrange. + #[inline] pub fn entry_count(&self) -> u16 { let range = self.shape.entry_count_byte_range(); self.data.read_at(range.start).unwrap() } /// Array of glyph index values for character codes in the range. + #[inline] pub fn glyph_id_array(&self) -> &'a [BigEndian] { let range = self.shape.glyph_id_array_byte_range(); self.data.read_array(range).unwrap() @@ -1053,6 +1094,7 @@ impl MinByteRange for Cmap8Marker { } impl<'a> FontRead<'a> for Cmap8<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -1081,12 +1123,14 @@ pub type Cmap8<'a> = TableRef<'a, Cmap8Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> Cmap8<'a> { /// Subtable format; set to 8. + #[inline] pub fn format(&self) -> u16 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Byte length of this subtable (including the header) + #[inline] pub fn length(&self) -> u32 { let range = self.shape.length_byte_range(); self.data.read_at(range.start).unwrap() @@ -1094,6 +1138,7 @@ impl<'a> Cmap8<'a> { /// For requirements on use of the language field, see “Use of /// the language field in 'cmap' subtables” in this document. + #[inline] pub fn language(&self) -> u32 { let range = self.shape.language_byte_range(); self.data.read_at(range.start).unwrap() @@ -1102,18 +1147,21 @@ impl<'a> Cmap8<'a> { /// Tightly packed array of bits (8K bytes total) indicating /// whether the particular 16-bit (index) value is the start of a /// 32-bit character code + #[inline] pub fn is32(&self) -> &'a [u8] { let range = self.shape.is32_byte_range(); self.data.read_array(range).unwrap() } /// Number of groupings which follow + #[inline] pub fn num_groups(&self) -> u32 { let range = self.shape.num_groups_byte_range(); self.data.read_at(range.start).unwrap() } /// Array of SequentialMapGroup records. + #[inline] pub fn groups(&self) -> &'a [SequentialMapGroup] { let range = self.shape.groups_byte_range(); self.data.read_array(range).unwrap() @@ -1175,17 +1223,20 @@ impl SequentialMapGroup { /// for one or more 16-bit character codes (which is determined /// from the is32 array), this 32-bit value will have the high /// 16-bits set to zero + #[inline] pub fn start_char_code(&self) -> u32 { self.start_char_code.get() } /// Last character code in this group; same condition as listed /// above for the startCharCode + #[inline] pub fn end_char_code(&self) -> u32 { self.end_char_code.get() } /// Glyph index corresponding to the starting character code + #[inline] pub fn start_glyph_id(&self) -> u32 { self.start_glyph_id.get() } @@ -1266,6 +1317,7 @@ impl MinByteRange for Cmap10Marker { } impl<'a> FontRead<'a> for Cmap10<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -1289,12 +1341,14 @@ pub type Cmap10<'a> = TableRef<'a, Cmap10Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> Cmap10<'a> { /// Subtable format; set to 10. + #[inline] pub fn format(&self) -> u16 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Byte length of this subtable (including the header) + #[inline] pub fn length(&self) -> u32 { let range = self.shape.length_byte_range(); self.data.read_at(range.start).unwrap() @@ -1302,24 +1356,28 @@ impl<'a> Cmap10<'a> { /// For requirements on use of the language field, see “Use of /// the language field in 'cmap' subtables” in this document. + #[inline] pub fn language(&self) -> u32 { let range = self.shape.language_byte_range(); self.data.read_at(range.start).unwrap() } /// First character code covered + #[inline] pub fn start_char_code(&self) -> u32 { let range = self.shape.start_char_code_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of character codes covered + #[inline] pub fn num_chars(&self) -> u32 { let range = self.shape.num_chars_byte_range(); self.data.read_at(range.start).unwrap() } /// Array of glyph indices for the character codes covered + #[inline] pub fn glyph_id_array(&self) -> &'a [BigEndian] { let range = self.shape.glyph_id_array_byte_range(); self.data.read_array(range).unwrap() @@ -1402,6 +1460,7 @@ impl MinByteRange for Cmap12Marker { } impl<'a> FontRead<'a> for Cmap12<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -1423,12 +1482,14 @@ pub type Cmap12<'a> = TableRef<'a, Cmap12Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> Cmap12<'a> { /// Subtable format; set to 12. + #[inline] pub fn format(&self) -> u16 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Byte length of this subtable (including the header) + #[inline] pub fn length(&self) -> u32 { let range = self.shape.length_byte_range(); self.data.read_at(range.start).unwrap() @@ -1436,18 +1497,21 @@ impl<'a> Cmap12<'a> { /// For requirements on use of the language field, see “Use of /// the language field in 'cmap' subtables” in this document. + #[inline] pub fn language(&self) -> u32 { let range = self.shape.language_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of groupings which follow + #[inline] pub fn num_groups(&self) -> u32 { let range = self.shape.num_groups_byte_range(); self.data.read_at(range.start).unwrap() } /// Array of SequentialMapGroup records. + #[inline] pub fn groups(&self) -> &'a [SequentialMapGroup] { let range = self.shape.groups_byte_range(); self.data.read_array(range).unwrap() @@ -1536,6 +1600,7 @@ impl MinByteRange for Cmap13Marker { } impl<'a> FontRead<'a> for Cmap13<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -1557,12 +1622,14 @@ pub type Cmap13<'a> = TableRef<'a, Cmap13Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> Cmap13<'a> { /// Subtable format; set to 13. + #[inline] pub fn format(&self) -> u16 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Byte length of this subtable (including the header) + #[inline] pub fn length(&self) -> u32 { let range = self.shape.length_byte_range(); self.data.read_at(range.start).unwrap() @@ -1570,18 +1637,21 @@ impl<'a> Cmap13<'a> { /// For requirements on use of the language field, see “Use of /// the language field in 'cmap' subtables” in this document. + #[inline] pub fn language(&self) -> u32 { let range = self.shape.language_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of groupings which follow + #[inline] pub fn num_groups(&self) -> u32 { let range = self.shape.num_groups_byte_range(); self.data.read_at(range.start).unwrap() } /// Array of ConstantMapGroup records. + #[inline] pub fn groups(&self) -> &'a [ConstantMapGroup] { let range = self.shape.groups_byte_range(); self.data.read_array(range).unwrap() @@ -1636,17 +1706,20 @@ pub struct ConstantMapGroup { impl ConstantMapGroup { /// First character code in this group + #[inline] pub fn start_char_code(&self) -> u32 { self.start_char_code.get() } /// Last character code in this group + #[inline] pub fn end_char_code(&self) -> u32 { self.end_char_code.get() } /// Glyph index to be used for all the characters in the group’s /// range. + #[inline] pub fn glyph_id(&self) -> u32 { self.glyph_id.get() } @@ -1712,6 +1785,7 @@ impl MinByteRange for Cmap14Marker { } impl<'a> FontRead<'a> for Cmap14<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -1733,24 +1807,28 @@ pub type Cmap14<'a> = TableRef<'a, Cmap14Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> Cmap14<'a> { /// Subtable format. Set to 14. + #[inline] pub fn format(&self) -> u16 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Byte length of this subtable (including this header) + #[inline] pub fn length(&self) -> u32 { let range = self.shape.length_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of variation Selector Records + #[inline] pub fn num_var_selector_records(&self) -> u32 { let range = self.shape.num_var_selector_records_byte_range(); self.data.read_at(range.start).unwrap() } /// Array of VariationSelector records. + #[inline] pub fn var_selector(&self) -> &'a [VariationSelector] { let range = self.shape.var_selector_byte_range(); self.data.read_array(range).unwrap() @@ -1808,12 +1886,14 @@ pub struct VariationSelector { impl VariationSelector { /// Variation selector + #[inline] pub fn var_selector(&self) -> Uint24 { self.var_selector.get() } /// Offset from the start of the [`Cmap14`] subtable to Default UVS /// Table. May be NULL. + #[inline] pub fn default_uvs_offset(&self) -> Nullable { self.default_uvs_offset.get() } @@ -1829,6 +1909,7 @@ impl VariationSelector { /// Offset from the start of the [`Cmap14`] subtable to Non-Default /// UVS Table. May be NULL. + #[inline] pub fn non_default_uvs_offset(&self) -> Nullable { self.non_default_uvs_offset.get() } @@ -1899,6 +1980,7 @@ impl MinByteRange for DefaultUvsMarker { } impl<'a> FontRead<'a> for DefaultUvs<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let num_unicode_value_ranges: u32 = cursor.read()?; @@ -1916,12 +1998,14 @@ pub type DefaultUvs<'a> = TableRef<'a, DefaultUvsMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> DefaultUvs<'a> { /// Number of Unicode character ranges. + #[inline] pub fn num_unicode_value_ranges(&self) -> u32 { let range = self.shape.num_unicode_value_ranges_byte_range(); self.data.read_at(range.start).unwrap() } /// Array of UnicodeRange records. + #[inline] pub fn ranges(&self) -> &'a [UnicodeRange] { let range = self.shape.ranges_byte_range(); self.data.read_array(range).unwrap() @@ -1986,6 +2070,7 @@ impl MinByteRange for NonDefaultUvsMarker { } impl<'a> FontRead<'a> for NonDefaultUvs<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let num_uvs_mappings: u32 = cursor.read()?; @@ -2004,11 +2089,13 @@ pub type NonDefaultUvs<'a> = TableRef<'a, NonDefaultUvsMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> NonDefaultUvs<'a> { + #[inline] pub fn num_uvs_mappings(&self) -> u32 { let range = self.shape.num_uvs_mappings_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn uvs_mapping(&self) -> &'a [UvsMapping] { let range = self.shape.uvs_mapping_byte_range(); self.data.read_array(range).unwrap() @@ -2057,11 +2144,13 @@ pub struct UvsMapping { impl UvsMapping { /// Base Unicode value of the UVS + #[inline] pub fn unicode_value(&self) -> Uint24 { self.unicode_value.get() } /// Glyph ID of the UVS + #[inline] pub fn glyph_id(&self) -> u16 { self.glyph_id.get() } @@ -2099,11 +2188,13 @@ pub struct UnicodeRange { impl UnicodeRange { /// First value in this range + #[inline] pub fn start_unicode_value(&self) -> Uint24 { self.start_unicode_value.get() } /// Number of additional values in this range + #[inline] pub fn additional_count(&self) -> u8 { self.additional_count } diff --git a/read-fonts/generated/generated_colr.rs b/read-fonts/generated/generated_colr.rs index ea9417481..efa3c00ca 100644 --- a/read-fonts/generated/generated_colr.rs +++ b/read-fonts/generated/generated_colr.rs @@ -80,6 +80,7 @@ impl TopLevelTable for Colr<'_> { } impl<'a> FontRead<'a> for Colr<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let version: u16 = cursor.read()?; @@ -138,18 +139,21 @@ pub type Colr<'a> = TableRef<'a, ColrMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> Colr<'a> { /// Table version number - set to 0 or 1. + #[inline] pub fn version(&self) -> u16 { let range = self.shape.version_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of BaseGlyph records; may be 0 in a version 1 table. + #[inline] pub fn num_base_glyph_records(&self) -> u16 { let range = self.shape.num_base_glyph_records_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset to baseGlyphRecords array (may be NULL). + #[inline] pub fn base_glyph_records_offset(&self) -> Nullable { let range = self.shape.base_glyph_records_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -164,6 +168,7 @@ impl<'a> Colr<'a> { } /// Offset to layerRecords array (may be NULL). + #[inline] pub fn layer_records_offset(&self) -> Nullable { let range = self.shape.layer_records_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -177,12 +182,14 @@ impl<'a> Colr<'a> { } /// Number of Layer records; may be 0 in a version 1 table. + #[inline] pub fn num_layer_records(&self) -> u16 { let range = self.shape.num_layer_records_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset to BaseGlyphList table. + #[inline] pub fn base_glyph_list_offset(&self) -> Option> { let range = self.shape.base_glyph_list_offset_byte_range()?; Some(self.data.read_at(range.start).unwrap()) @@ -195,6 +202,7 @@ impl<'a> Colr<'a> { } /// Offset to LayerList table (may be NULL). + #[inline] pub fn layer_list_offset(&self) -> Option> { let range = self.shape.layer_list_offset_byte_range()?; Some(self.data.read_at(range.start).unwrap()) @@ -207,6 +215,7 @@ impl<'a> Colr<'a> { } /// Offset to ClipList table (may be NULL). + #[inline] pub fn clip_list_offset(&self) -> Option> { let range = self.shape.clip_list_offset_byte_range()?; Some(self.data.read_at(range.start).unwrap()) @@ -219,6 +228,7 @@ impl<'a> Colr<'a> { } /// Offset to DeltaSetIndexMap table (may be NULL). + #[inline] pub fn var_index_map_offset(&self) -> Option> { let range = self.shape.var_index_map_offset_byte_range()?; Some(self.data.read_at(range.start).unwrap()) @@ -231,6 +241,7 @@ impl<'a> Colr<'a> { } /// Offset to ItemVariationStore (may be NULL). + #[inline] pub fn item_variation_store_offset(&self) -> Option> { let range = self.shape.item_variation_store_offset_byte_range()?; Some(self.data.read_at(range.start).unwrap()) @@ -330,16 +341,19 @@ pub struct BaseGlyph { impl BaseGlyph { /// Glyph ID of the base glyph. + #[inline] pub fn glyph_id(&self) -> GlyphId16 { self.glyph_id.get() } /// Index (base 0) into the layerRecords array. + #[inline] pub fn first_layer_index(&self) -> u16 { self.first_layer_index.get() } /// Number of color layers associated with this glyph. + #[inline] pub fn num_layers(&self) -> u16 { self.num_layers.get() } @@ -378,11 +392,13 @@ pub struct Layer { impl Layer { /// Glyph ID of the glyph used for a given layer. + #[inline] pub fn glyph_id(&self) -> GlyphId16 { self.glyph_id.get() } /// Index (base 0) for a palette entry in the CPAL table. + #[inline] pub fn palette_index(&self) -> u16 { self.palette_index.get() } @@ -433,6 +449,7 @@ impl MinByteRange for BaseGlyphListMarker { } impl<'a> FontRead<'a> for BaseGlyphList<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let num_base_glyph_paint_records: u32 = cursor.read()?; @@ -451,11 +468,13 @@ pub type BaseGlyphList<'a> = TableRef<'a, BaseGlyphListMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> BaseGlyphList<'a> { + #[inline] pub fn num_base_glyph_paint_records(&self) -> u32 { let range = self.shape.num_base_glyph_paint_records_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn base_glyph_paint_records(&self) -> &'a [BaseGlyphPaint] { let range = self.shape.base_glyph_paint_records_byte_range(); self.data.read_array(range).unwrap() @@ -507,11 +526,13 @@ pub struct BaseGlyphPaint { impl BaseGlyphPaint { /// Glyph ID of the base glyph. + #[inline] pub fn glyph_id(&self) -> GlyphId16 { self.glyph_id.get() } /// Offset to a Paint table, from the beginning of the [`BaseGlyphList`] table. + #[inline] pub fn paint_offset(&self) -> Offset32 { self.paint_offset.get() } @@ -573,6 +594,7 @@ impl MinByteRange for LayerListMarker { } impl<'a> FontRead<'a> for LayerList<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let num_layers: u32 = cursor.read()?; @@ -591,12 +613,14 @@ pub type LayerList<'a> = TableRef<'a, LayerListMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> LayerList<'a> { + #[inline] pub fn num_layers(&self) -> u32 { let range = self.shape.num_layers_byte_range(); self.data.read_at(range.start).unwrap() } /// Offsets to Paint tables. + #[inline] pub fn paint_offsets(&self) -> &'a [BigEndian] { let range = self.shape.paint_offsets_byte_range(); self.data.read_array(range).unwrap() @@ -676,6 +700,7 @@ impl MinByteRange for ClipListMarker { } impl<'a> FontRead<'a> for ClipList<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -694,18 +719,21 @@ pub type ClipList<'a> = TableRef<'a, ClipListMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> ClipList<'a> { /// Set to 1. + #[inline] pub fn format(&self) -> u8 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of Clip records. + #[inline] pub fn num_clips(&self) -> u32 { let range = self.shape.num_clips_byte_range(); self.data.read_at(range.start).unwrap() } /// Clip records. Sorted by startGlyphID. + #[inline] pub fn clips(&self) -> &'a [Clip] { let range = self.shape.clips_byte_range(); self.data.read_array(range).unwrap() @@ -757,16 +785,19 @@ pub struct Clip { impl Clip { /// First glyph ID in the range. + #[inline] pub fn start_glyph_id(&self) -> GlyphId16 { self.start_glyph_id.get() } /// Last glyph ID in the range. + #[inline] pub fn end_glyph_id(&self) -> GlyphId16 { self.end_glyph_id.get() } /// Offset to a ClipBox table, from the beginning of the [`ClipList`] table. + #[inline] pub fn clip_box_offset(&self) -> Offset24 { self.clip_box_offset.get() } @@ -951,6 +982,7 @@ impl MinByteRange for ClipBoxFormat1Marker { } impl<'a> FontRead<'a> for ClipBoxFormat1<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -968,30 +1000,35 @@ pub type ClipBoxFormat1<'a> = TableRef<'a, ClipBoxFormat1Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> ClipBoxFormat1<'a> { /// Set to 1. + #[inline] pub fn format(&self) -> u8 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Minimum x of clip box. + #[inline] pub fn x_min(&self) -> FWord { let range = self.shape.x_min_byte_range(); self.data.read_at(range.start).unwrap() } /// Minimum y of clip box. + #[inline] pub fn y_min(&self) -> FWord { let range = self.shape.y_min_byte_range(); self.data.read_at(range.start).unwrap() } /// Maximum x of clip box. + #[inline] pub fn x_max(&self) -> FWord { let range = self.shape.x_max_byte_range(); self.data.read_at(range.start).unwrap() } /// Maximum y of clip box. + #[inline] pub fn y_max(&self) -> FWord { let range = self.shape.y_max_byte_range(); self.data.read_at(range.start).unwrap() @@ -1071,6 +1108,7 @@ impl MinByteRange for ClipBoxFormat2Marker { } impl<'a> FontRead<'a> for ClipBoxFormat2<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -1089,36 +1127,42 @@ pub type ClipBoxFormat2<'a> = TableRef<'a, ClipBoxFormat2Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> ClipBoxFormat2<'a> { /// Set to 2. + #[inline] pub fn format(&self) -> u8 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Minimum x of clip box. For variation, use varIndexBase + 0. + #[inline] pub fn x_min(&self) -> FWord { let range = self.shape.x_min_byte_range(); self.data.read_at(range.start).unwrap() } /// Minimum y of clip box. For variation, use varIndexBase + 1. + #[inline] pub fn y_min(&self) -> FWord { let range = self.shape.y_min_byte_range(); self.data.read_at(range.start).unwrap() } /// Maximum x of clip box. For variation, use varIndexBase + 2. + #[inline] pub fn x_max(&self) -> FWord { let range = self.shape.x_max_byte_range(); self.data.read_at(range.start).unwrap() } /// Maximum y of clip box. For variation, use varIndexBase + 3. + #[inline] pub fn y_max(&self) -> FWord { let range = self.shape.y_max_byte_range(); self.data.read_at(range.start).unwrap() } /// Base index into DeltaSetIndexMap. + #[inline] pub fn var_index_base(&self) -> u32 { let range = self.shape.var_index_base_byte_range(); self.data.read_at(range.start).unwrap() @@ -1164,11 +1208,13 @@ pub struct ColorIndex { impl ColorIndex { /// Index for a CPAL palette entry. + #[inline] pub fn palette_index(&self) -> u16 { self.palette_index.get() } /// Alpha value. + #[inline] pub fn alpha(&self) -> F2Dot14 { self.alpha.get() } @@ -1208,16 +1254,19 @@ pub struct VarColorIndex { impl VarColorIndex { /// Index for a CPAL palette entry. + #[inline] pub fn palette_index(&self) -> u16 { self.palette_index.get() } /// Alpha value. For variation, use varIndexBase + 0. + #[inline] pub fn alpha(&self) -> F2Dot14 { self.alpha.get() } /// Base index into DeltaSetIndexMap. + #[inline] pub fn var_index_base(&self) -> u32 { self.var_index_base.get() } @@ -1258,16 +1307,19 @@ pub struct ColorStop { impl ColorStop { /// Position on a color line. + #[inline] pub fn stop_offset(&self) -> F2Dot14 { self.stop_offset.get() } /// Index for a CPAL palette entry. + #[inline] pub fn palette_index(&self) -> u16 { self.palette_index.get() } /// Alpha value. + #[inline] pub fn alpha(&self) -> F2Dot14 { self.alpha.get() } @@ -1310,21 +1362,25 @@ pub struct VarColorStop { impl VarColorStop { /// Position on a color line. For variation, use varIndexBase + 0. + #[inline] pub fn stop_offset(&self) -> F2Dot14 { self.stop_offset.get() } /// Index for a CPAL palette entry. + #[inline] pub fn palette_index(&self) -> u16 { self.palette_index.get() } /// Alpha value. For variation, use varIndexBase + 1. + #[inline] pub fn alpha(&self) -> F2Dot14 { self.alpha.get() } /// Base index into DeltaSetIndexMap. + #[inline] pub fn var_index_base(&self) -> u32 { self.var_index_base.get() } @@ -1383,6 +1439,7 @@ impl MinByteRange for ColorLineMarker { } impl<'a> FontRead<'a> for ColorLine<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -1403,17 +1460,20 @@ pub type ColorLine<'a> = TableRef<'a, ColorLineMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> ColorLine<'a> { /// An Extend enum value. + #[inline] pub fn extend(&self) -> Extend { let range = self.shape.extend_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of ColorStop records. + #[inline] pub fn num_stops(&self) -> u16 { let range = self.shape.num_stops_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn color_stops(&self) -> &'a [ColorStop] { let range = self.shape.color_stops_byte_range(); self.data.read_array(range).unwrap() @@ -1481,6 +1541,7 @@ impl MinByteRange for VarColorLineMarker { } impl<'a> FontRead<'a> for VarColorLine<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -1501,18 +1562,21 @@ pub type VarColorLine<'a> = TableRef<'a, VarColorLineMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> VarColorLine<'a> { /// An Extend enum value. + #[inline] pub fn extend(&self) -> Extend { let range = self.shape.extend_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of ColorStop records. + #[inline] pub fn num_stops(&self) -> u16 { let range = self.shape.num_stops_byte_range(); self.data.read_at(range.start).unwrap() } /// Allows for variations. + #[inline] pub fn color_stops(&self) -> &'a [VarColorStop] { let range = self.shape.color_stops_byte_range(); self.data.read_array(range).unwrap() @@ -1903,6 +1967,7 @@ impl MinByteRange for PaintColrLayersMarker { } impl<'a> FontRead<'a> for PaintColrLayers<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -1918,18 +1983,21 @@ pub type PaintColrLayers<'a> = TableRef<'a, PaintColrLayersMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> PaintColrLayers<'a> { /// Set to 1. + #[inline] pub fn format(&self) -> u8 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of offsets to paint tables to read from LayerList. + #[inline] pub fn num_layers(&self) -> u8 { let range = self.shape.num_layers_byte_range(); self.data.read_at(range.start).unwrap() } /// Index (base 0) into the LayerList. + #[inline] pub fn first_layer_index(&self) -> u32 { let range = self.shape.first_layer_index_byte_range(); self.data.read_at(range.start).unwrap() @@ -1992,6 +2060,7 @@ impl MinByteRange for PaintSolidMarker { } impl<'a> FontRead<'a> for PaintSolid<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -2007,18 +2076,21 @@ pub type PaintSolid<'a> = TableRef<'a, PaintSolidMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> PaintSolid<'a> { /// Set to 2. + #[inline] pub fn format(&self) -> u8 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Index for a CPAL palette entry. + #[inline] pub fn palette_index(&self) -> u16 { let range = self.shape.palette_index_byte_range(); self.data.read_at(range.start).unwrap() } /// Alpha value. + #[inline] pub fn alpha(&self) -> F2Dot14 { let range = self.shape.alpha_byte_range(); self.data.read_at(range.start).unwrap() @@ -2086,6 +2158,7 @@ impl MinByteRange for PaintVarSolidMarker { } impl<'a> FontRead<'a> for PaintVarSolid<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -2102,24 +2175,28 @@ pub type PaintVarSolid<'a> = TableRef<'a, PaintVarSolidMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> PaintVarSolid<'a> { /// Set to 3. + #[inline] pub fn format(&self) -> u8 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Index for a CPAL palette entry. + #[inline] pub fn palette_index(&self) -> u16 { let range = self.shape.palette_index_byte_range(); self.data.read_at(range.start).unwrap() } /// Alpha value. For variation, use varIndexBase + 0. + #[inline] pub fn alpha(&self) -> F2Dot14 { let range = self.shape.alpha_byte_range(); self.data.read_at(range.start).unwrap() } /// Base index into DeltaSetIndexMap. + #[inline] pub fn var_index_base(&self) -> u32 { let range = self.shape.var_index_base_byte_range(); self.data.read_at(range.start).unwrap() @@ -2208,6 +2285,7 @@ impl MinByteRange for PaintLinearGradientMarker { } impl<'a> FontRead<'a> for PaintLinearGradient<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -2228,12 +2306,14 @@ pub type PaintLinearGradient<'a> = TableRef<'a, PaintLinearGradientMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> PaintLinearGradient<'a> { /// Set to 4. + #[inline] pub fn format(&self) -> u8 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset to ColorLine table. + #[inline] pub fn color_line_offset(&self) -> Offset24 { let range = self.shape.color_line_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -2246,36 +2326,42 @@ impl<'a> PaintLinearGradient<'a> { } /// Start point (p₀) x coordinate. + #[inline] pub fn x0(&self) -> FWord { let range = self.shape.x0_byte_range(); self.data.read_at(range.start).unwrap() } /// Start point (p₀) y coordinate. + #[inline] pub fn y0(&self) -> FWord { let range = self.shape.y0_byte_range(); self.data.read_at(range.start).unwrap() } /// End point (p₁) x coordinate. + #[inline] pub fn x1(&self) -> FWord { let range = self.shape.x1_byte_range(); self.data.read_at(range.start).unwrap() } /// End point (p₁) y coordinate. + #[inline] pub fn y1(&self) -> FWord { let range = self.shape.y1_byte_range(); self.data.read_at(range.start).unwrap() } /// Rotation point (p₂) x coordinate. + #[inline] pub fn x2(&self) -> FWord { let range = self.shape.x2_byte_range(); self.data.read_at(range.start).unwrap() } /// Rotation point (p₂) y coordinate. + #[inline] pub fn y2(&self) -> FWord { let range = self.shape.y2_byte_range(); self.data.read_at(range.start).unwrap() @@ -2376,6 +2462,7 @@ impl MinByteRange for PaintVarLinearGradientMarker { } impl<'a> FontRead<'a> for PaintVarLinearGradient<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -2397,12 +2484,14 @@ pub type PaintVarLinearGradient<'a> = TableRef<'a, PaintVarLinearGradientMarker> #[allow(clippy::needless_lifetimes)] impl<'a> PaintVarLinearGradient<'a> { /// Set to 5. + #[inline] pub fn format(&self) -> u8 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset to VarColorLine table. + #[inline] pub fn color_line_offset(&self) -> Offset24 { let range = self.shape.color_line_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -2416,6 +2505,7 @@ impl<'a> PaintVarLinearGradient<'a> { /// Start point (p₀) x coordinate. For variation, use /// varIndexBase + 0. + #[inline] pub fn x0(&self) -> FWord { let range = self.shape.x0_byte_range(); self.data.read_at(range.start).unwrap() @@ -2423,6 +2513,7 @@ impl<'a> PaintVarLinearGradient<'a> { /// Start point (p₀) y coordinate. For variation, use /// varIndexBase + 1. + #[inline] pub fn y0(&self) -> FWord { let range = self.shape.y0_byte_range(); self.data.read_at(range.start).unwrap() @@ -2430,6 +2521,7 @@ impl<'a> PaintVarLinearGradient<'a> { /// End point (p₁) x coordinate. For variation, use varIndexBase /// + 2. + #[inline] pub fn x1(&self) -> FWord { let range = self.shape.x1_byte_range(); self.data.read_at(range.start).unwrap() @@ -2437,6 +2529,7 @@ impl<'a> PaintVarLinearGradient<'a> { /// End point (p₁) y coordinate. For variation, use varIndexBase /// + 3. + #[inline] pub fn y1(&self) -> FWord { let range = self.shape.y1_byte_range(); self.data.read_at(range.start).unwrap() @@ -2444,6 +2537,7 @@ impl<'a> PaintVarLinearGradient<'a> { /// Rotation point (p₂) x coordinate. For variation, use /// varIndexBase + 4. + #[inline] pub fn x2(&self) -> FWord { let range = self.shape.x2_byte_range(); self.data.read_at(range.start).unwrap() @@ -2451,12 +2545,14 @@ impl<'a> PaintVarLinearGradient<'a> { /// Rotation point (p₂) y coordinate. For variation, use /// varIndexBase + 5. + #[inline] pub fn y2(&self) -> FWord { let range = self.shape.y2_byte_range(); self.data.read_at(range.start).unwrap() } /// Base index into DeltaSetIndexMap. + #[inline] pub fn var_index_base(&self) -> u32 { let range = self.shape.var_index_base_byte_range(); self.data.read_at(range.start).unwrap() @@ -2553,6 +2649,7 @@ impl MinByteRange for PaintRadialGradientMarker { } impl<'a> FontRead<'a> for PaintRadialGradient<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -2573,12 +2670,14 @@ pub type PaintRadialGradient<'a> = TableRef<'a, PaintRadialGradientMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> PaintRadialGradient<'a> { /// Set to 6. + #[inline] pub fn format(&self) -> u8 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset to ColorLine table. + #[inline] pub fn color_line_offset(&self) -> Offset24 { let range = self.shape.color_line_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -2591,36 +2690,42 @@ impl<'a> PaintRadialGradient<'a> { } /// Start circle center x coordinate. + #[inline] pub fn x0(&self) -> FWord { let range = self.shape.x0_byte_range(); self.data.read_at(range.start).unwrap() } /// Start circle center y coordinate. + #[inline] pub fn y0(&self) -> FWord { let range = self.shape.y0_byte_range(); self.data.read_at(range.start).unwrap() } /// Start circle radius. + #[inline] pub fn radius0(&self) -> UfWord { let range = self.shape.radius0_byte_range(); self.data.read_at(range.start).unwrap() } /// End circle center x coordinate. + #[inline] pub fn x1(&self) -> FWord { let range = self.shape.x1_byte_range(); self.data.read_at(range.start).unwrap() } /// End circle center y coordinate. + #[inline] pub fn y1(&self) -> FWord { let range = self.shape.y1_byte_range(); self.data.read_at(range.start).unwrap() } /// End circle radius. + #[inline] pub fn radius1(&self) -> UfWord { let range = self.shape.radius1_byte_range(); self.data.read_at(range.start).unwrap() @@ -2721,6 +2826,7 @@ impl MinByteRange for PaintVarRadialGradientMarker { } impl<'a> FontRead<'a> for PaintVarRadialGradient<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -2742,12 +2848,14 @@ pub type PaintVarRadialGradient<'a> = TableRef<'a, PaintVarRadialGradientMarker> #[allow(clippy::needless_lifetimes)] impl<'a> PaintVarRadialGradient<'a> { /// Set to 7. + #[inline] pub fn format(&self) -> u8 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset to VarColorLine table. + #[inline] pub fn color_line_offset(&self) -> Offset24 { let range = self.shape.color_line_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -2761,6 +2869,7 @@ impl<'a> PaintVarRadialGradient<'a> { /// Start circle center x coordinate. For variation, use /// varIndexBase + 0. + #[inline] pub fn x0(&self) -> FWord { let range = self.shape.x0_byte_range(); self.data.read_at(range.start).unwrap() @@ -2768,12 +2877,14 @@ impl<'a> PaintVarRadialGradient<'a> { /// Start circle center y coordinate. For variation, use /// varIndexBase + 1. + #[inline] pub fn y0(&self) -> FWord { let range = self.shape.y0_byte_range(); self.data.read_at(range.start).unwrap() } /// Start circle radius. For variation, use varIndexBase + 2. + #[inline] pub fn radius0(&self) -> UfWord { let range = self.shape.radius0_byte_range(); self.data.read_at(range.start).unwrap() @@ -2781,6 +2892,7 @@ impl<'a> PaintVarRadialGradient<'a> { /// End circle center x coordinate. For variation, use varIndexBase /// + 3. + #[inline] pub fn x1(&self) -> FWord { let range = self.shape.x1_byte_range(); self.data.read_at(range.start).unwrap() @@ -2788,18 +2900,21 @@ impl<'a> PaintVarRadialGradient<'a> { /// End circle center y coordinate. For variation, use varIndexBase /// + 4. + #[inline] pub fn y1(&self) -> FWord { let range = self.shape.y1_byte_range(); self.data.read_at(range.start).unwrap() } /// End circle radius. For variation, use varIndexBase + 5. + #[inline] pub fn radius1(&self) -> UfWord { let range = self.shape.radius1_byte_range(); self.data.read_at(range.start).unwrap() } /// Base index into DeltaSetIndexMap. + #[inline] pub fn var_index_base(&self) -> u32 { let range = self.shape.var_index_base_byte_range(); self.data.read_at(range.start).unwrap() @@ -2886,6 +3001,7 @@ impl MinByteRange for PaintSweepGradientMarker { } impl<'a> FontRead<'a> for PaintSweepGradient<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -2904,12 +3020,14 @@ pub type PaintSweepGradient<'a> = TableRef<'a, PaintSweepGradientMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> PaintSweepGradient<'a> { /// Set to 8. + #[inline] pub fn format(&self) -> u8 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset to ColorLine table. + #[inline] pub fn color_line_offset(&self) -> Offset24 { let range = self.shape.color_line_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -2922,12 +3040,14 @@ impl<'a> PaintSweepGradient<'a> { } /// Center x coordinate. + #[inline] pub fn center_x(&self) -> FWord { let range = self.shape.center_x_byte_range(); self.data.read_at(range.start).unwrap() } /// Center y coordinate. + #[inline] pub fn center_y(&self) -> FWord { let range = self.shape.center_y_byte_range(); self.data.read_at(range.start).unwrap() @@ -2935,6 +3055,7 @@ impl<'a> PaintSweepGradient<'a> { /// Start of the angular range of the gradient, 180° in /// counter-clockwise degrees per 1.0 of value. + #[inline] pub fn start_angle(&self) -> F2Dot14 { let range = self.shape.start_angle_byte_range(); self.data.read_at(range.start).unwrap() @@ -2942,6 +3063,7 @@ impl<'a> PaintSweepGradient<'a> { /// End of the angular range of the gradient, 180° in /// counter-clockwise degrees per 1.0 of value. + #[inline] pub fn end_angle(&self) -> F2Dot14 { let range = self.shape.end_angle_byte_range(); self.data.read_at(range.start).unwrap() @@ -3030,6 +3152,7 @@ impl MinByteRange for PaintVarSweepGradientMarker { } impl<'a> FontRead<'a> for PaintVarSweepGradient<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -3049,12 +3172,14 @@ pub type PaintVarSweepGradient<'a> = TableRef<'a, PaintVarSweepGradientMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> PaintVarSweepGradient<'a> { /// Set to 9. + #[inline] pub fn format(&self) -> u8 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset to VarColorLine table. + #[inline] pub fn color_line_offset(&self) -> Offset24 { let range = self.shape.color_line_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -3067,12 +3192,14 @@ impl<'a> PaintVarSweepGradient<'a> { } /// Center x coordinate. For variation, use varIndexBase + 0. + #[inline] pub fn center_x(&self) -> FWord { let range = self.shape.center_x_byte_range(); self.data.read_at(range.start).unwrap() } /// Center y coordinate. For variation, use varIndexBase + 1. + #[inline] pub fn center_y(&self) -> FWord { let range = self.shape.center_y_byte_range(); self.data.read_at(range.start).unwrap() @@ -3081,6 +3208,7 @@ impl<'a> PaintVarSweepGradient<'a> { /// Start of the angular range of the gradient, 180° in /// counter-clockwise degrees per 1.0 of value. For variation, use /// varIndexBase + 2. + #[inline] pub fn start_angle(&self) -> F2Dot14 { let range = self.shape.start_angle_byte_range(); self.data.read_at(range.start).unwrap() @@ -3089,12 +3217,14 @@ impl<'a> PaintVarSweepGradient<'a> { /// End of the angular range of the gradient, 180° in /// counter-clockwise degrees per 1.0 of value. For variation, use /// varIndexBase + 3. + #[inline] pub fn end_angle(&self) -> F2Dot14 { let range = self.shape.end_angle_byte_range(); self.data.read_at(range.start).unwrap() } /// Base index into DeltaSetIndexMap. + #[inline] pub fn var_index_base(&self) -> u32 { let range = self.shape.var_index_base_byte_range(); self.data.read_at(range.start).unwrap() @@ -3164,6 +3294,7 @@ impl MinByteRange for PaintGlyphMarker { } impl<'a> FontRead<'a> for PaintGlyph<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -3179,12 +3310,14 @@ pub type PaintGlyph<'a> = TableRef<'a, PaintGlyphMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> PaintGlyph<'a> { /// Set to 10. + #[inline] pub fn format(&self) -> u8 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset to a Paint table. + #[inline] pub fn paint_offset(&self) -> Offset24 { let range = self.shape.paint_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -3197,6 +3330,7 @@ impl<'a> PaintGlyph<'a> { } /// Glyph ID for the source outline. + #[inline] pub fn glyph_id(&self) -> GlyphId16 { let range = self.shape.glyph_id_byte_range(); self.data.read_at(range.start).unwrap() @@ -3257,6 +3391,7 @@ impl MinByteRange for PaintColrGlyphMarker { } impl<'a> FontRead<'a> for PaintColrGlyph<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -3271,12 +3406,14 @@ pub type PaintColrGlyph<'a> = TableRef<'a, PaintColrGlyphMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> PaintColrGlyph<'a> { /// Set to 11. + #[inline] pub fn format(&self) -> u8 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Glyph ID for a BaseGlyphList base glyph. + #[inline] pub fn glyph_id(&self) -> GlyphId16 { let range = self.shape.glyph_id_byte_range(); self.data.read_at(range.start).unwrap() @@ -3338,6 +3475,7 @@ impl MinByteRange for PaintTransformMarker { } impl<'a> FontRead<'a> for PaintTransform<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -3353,12 +3491,14 @@ pub type PaintTransform<'a> = TableRef<'a, PaintTransformMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> PaintTransform<'a> { /// Set to 12. + #[inline] pub fn format(&self) -> u8 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset to a Paint subtable. + #[inline] pub fn paint_offset(&self) -> Offset24 { let range = self.shape.paint_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -3371,6 +3511,7 @@ impl<'a> PaintTransform<'a> { } /// Offset to an Affine2x3 table. + #[inline] pub fn transform_offset(&self) -> Offset24 { let range = self.shape.transform_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -3445,6 +3586,7 @@ impl MinByteRange for PaintVarTransformMarker { } impl<'a> FontRead<'a> for PaintVarTransform<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -3460,12 +3602,14 @@ pub type PaintVarTransform<'a> = TableRef<'a, PaintVarTransformMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> PaintVarTransform<'a> { /// Set to 13. + #[inline] pub fn format(&self) -> u8 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset to a Paint subtable. + #[inline] pub fn paint_offset(&self) -> Offset24 { let range = self.shape.paint_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -3478,6 +3622,7 @@ impl<'a> PaintVarTransform<'a> { } /// Offset to a VarAffine2x3 table. + #[inline] pub fn transform_offset(&self) -> Offset24 { let range = self.shape.transform_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -3563,6 +3708,7 @@ impl MinByteRange for Affine2x3Marker { } impl<'a> FontRead<'a> for Affine2x3<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -3581,36 +3727,42 @@ pub type Affine2x3<'a> = TableRef<'a, Affine2x3Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> Affine2x3<'a> { /// x-component of transformed x-basis vector. + #[inline] pub fn xx(&self) -> Fixed { let range = self.shape.xx_byte_range(); self.data.read_at(range.start).unwrap() } /// y-component of transformed x-basis vector. + #[inline] pub fn yx(&self) -> Fixed { let range = self.shape.yx_byte_range(); self.data.read_at(range.start).unwrap() } /// x-component of transformed y-basis vector. + #[inline] pub fn xy(&self) -> Fixed { let range = self.shape.xy_byte_range(); self.data.read_at(range.start).unwrap() } /// y-component of transformed y-basis vector. + #[inline] pub fn yy(&self) -> Fixed { let range = self.shape.yy_byte_range(); self.data.read_at(range.start).unwrap() } /// Translation in x direction. + #[inline] pub fn dx(&self) -> Fixed { let range = self.shape.dx_byte_range(); self.data.read_at(range.start).unwrap() } /// Translation in y direction. + #[inline] pub fn dy(&self) -> Fixed { let range = self.shape.dy_byte_range(); self.data.read_at(range.start).unwrap() @@ -3692,6 +3844,7 @@ impl MinByteRange for VarAffine2x3Marker { } impl<'a> FontRead<'a> for VarAffine2x3<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -3712,6 +3865,7 @@ pub type VarAffine2x3<'a> = TableRef<'a, VarAffine2x3Marker>; impl<'a> VarAffine2x3<'a> { /// x-component of transformed x-basis vector. For variation, use /// varIndexBase + 0. + #[inline] pub fn xx(&self) -> Fixed { let range = self.shape.xx_byte_range(); self.data.read_at(range.start).unwrap() @@ -3719,6 +3873,7 @@ impl<'a> VarAffine2x3<'a> { /// y-component of transformed x-basis vector. For variation, use /// varIndexBase + 1. + #[inline] pub fn yx(&self) -> Fixed { let range = self.shape.yx_byte_range(); self.data.read_at(range.start).unwrap() @@ -3726,6 +3881,7 @@ impl<'a> VarAffine2x3<'a> { /// x-component of transformed y-basis vector. For variation, use /// varIndexBase + 2. + #[inline] pub fn xy(&self) -> Fixed { let range = self.shape.xy_byte_range(); self.data.read_at(range.start).unwrap() @@ -3733,24 +3889,28 @@ impl<'a> VarAffine2x3<'a> { /// y-component of transformed y-basis vector. For variation, use /// varIndexBase + 3. + #[inline] pub fn yy(&self) -> Fixed { let range = self.shape.yy_byte_range(); self.data.read_at(range.start).unwrap() } /// Translation in x direction. For variation, use varIndexBase + 4. + #[inline] pub fn dx(&self) -> Fixed { let range = self.shape.dx_byte_range(); self.data.read_at(range.start).unwrap() } /// Translation in y direction. For variation, use varIndexBase + 5. + #[inline] pub fn dy(&self) -> Fixed { let range = self.shape.dy_byte_range(); self.data.read_at(range.start).unwrap() } /// Base index into DeltaSetIndexMap. + #[inline] pub fn var_index_base(&self) -> u32 { let range = self.shape.var_index_base_byte_range(); self.data.read_at(range.start).unwrap() @@ -3822,6 +3982,7 @@ impl MinByteRange for PaintTranslateMarker { } impl<'a> FontRead<'a> for PaintTranslate<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -3838,12 +3999,14 @@ pub type PaintTranslate<'a> = TableRef<'a, PaintTranslateMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> PaintTranslate<'a> { /// Set to 14. + #[inline] pub fn format(&self) -> u8 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset to a Paint subtable. + #[inline] pub fn paint_offset(&self) -> Offset24 { let range = self.shape.paint_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -3856,12 +4019,14 @@ impl<'a> PaintTranslate<'a> { } /// Translation in x direction. + #[inline] pub fn dx(&self) -> FWord { let range = self.shape.dx_byte_range(); self.data.read_at(range.start).unwrap() } /// Translation in y direction. + #[inline] pub fn dy(&self) -> FWord { let range = self.shape.dy_byte_range(); self.data.read_at(range.start).unwrap() @@ -3938,6 +4103,7 @@ impl MinByteRange for PaintVarTranslateMarker { } impl<'a> FontRead<'a> for PaintVarTranslate<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -3955,12 +4121,14 @@ pub type PaintVarTranslate<'a> = TableRef<'a, PaintVarTranslateMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> PaintVarTranslate<'a> { /// Set to 15. + #[inline] pub fn format(&self) -> u8 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset to a Paint subtable. + #[inline] pub fn paint_offset(&self) -> Offset24 { let range = self.shape.paint_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -3973,18 +4141,21 @@ impl<'a> PaintVarTranslate<'a> { } /// Translation in x direction. For variation, use varIndexBase + 0. + #[inline] pub fn dx(&self) -> FWord { let range = self.shape.dx_byte_range(); self.data.read_at(range.start).unwrap() } /// Translation in y direction. For variation, use varIndexBase + 1. + #[inline] pub fn dy(&self) -> FWord { let range = self.shape.dy_byte_range(); self.data.read_at(range.start).unwrap() } /// Base index into DeltaSetIndexMap. + #[inline] pub fn var_index_base(&self) -> u32 { let range = self.shape.var_index_base_byte_range(); self.data.read_at(range.start).unwrap() @@ -4057,6 +4228,7 @@ impl MinByteRange for PaintScaleMarker { } impl<'a> FontRead<'a> for PaintScale<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -4073,12 +4245,14 @@ pub type PaintScale<'a> = TableRef<'a, PaintScaleMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> PaintScale<'a> { /// Set to 16. + #[inline] pub fn format(&self) -> u8 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset to a Paint subtable. + #[inline] pub fn paint_offset(&self) -> Offset24 { let range = self.shape.paint_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -4091,12 +4265,14 @@ impl<'a> PaintScale<'a> { } /// Scale factor in x direction. + #[inline] pub fn scale_x(&self) -> F2Dot14 { let range = self.shape.scale_x_byte_range(); self.data.read_at(range.start).unwrap() } /// Scale factor in y direction. + #[inline] pub fn scale_y(&self) -> F2Dot14 { let range = self.shape.scale_y_byte_range(); self.data.read_at(range.start).unwrap() @@ -4173,6 +4349,7 @@ impl MinByteRange for PaintVarScaleMarker { } impl<'a> FontRead<'a> for PaintVarScale<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -4190,12 +4367,14 @@ pub type PaintVarScale<'a> = TableRef<'a, PaintVarScaleMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> PaintVarScale<'a> { /// Set to 17. + #[inline] pub fn format(&self) -> u8 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset to a Paint subtable. + #[inline] pub fn paint_offset(&self) -> Offset24 { let range = self.shape.paint_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -4209,6 +4388,7 @@ impl<'a> PaintVarScale<'a> { /// Scale factor in x direction. For variation, use varIndexBase + /// 0. + #[inline] pub fn scale_x(&self) -> F2Dot14 { let range = self.shape.scale_x_byte_range(); self.data.read_at(range.start).unwrap() @@ -4216,12 +4396,14 @@ impl<'a> PaintVarScale<'a> { /// Scale factor in y direction. For variation, use varIndexBase + /// 1. + #[inline] pub fn scale_y(&self) -> F2Dot14 { let range = self.shape.scale_y_byte_range(); self.data.read_at(range.start).unwrap() } /// Base index into DeltaSetIndexMap. + #[inline] pub fn var_index_base(&self) -> u32 { let range = self.shape.var_index_base_byte_range(); self.data.read_at(range.start).unwrap() @@ -4304,6 +4486,7 @@ impl MinByteRange for PaintScaleAroundCenterMarker { } impl<'a> FontRead<'a> for PaintScaleAroundCenter<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -4322,12 +4505,14 @@ pub type PaintScaleAroundCenter<'a> = TableRef<'a, PaintScaleAroundCenterMarker> #[allow(clippy::needless_lifetimes)] impl<'a> PaintScaleAroundCenter<'a> { /// Set to 18. + #[inline] pub fn format(&self) -> u8 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset to a Paint subtable. + #[inline] pub fn paint_offset(&self) -> Offset24 { let range = self.shape.paint_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -4340,24 +4525,28 @@ impl<'a> PaintScaleAroundCenter<'a> { } /// Scale factor in x direction. + #[inline] pub fn scale_x(&self) -> F2Dot14 { let range = self.shape.scale_x_byte_range(); self.data.read_at(range.start).unwrap() } /// Scale factor in y direction. + #[inline] pub fn scale_y(&self) -> F2Dot14 { let range = self.shape.scale_y_byte_range(); self.data.read_at(range.start).unwrap() } /// x coordinate for the center of scaling. + #[inline] pub fn center_x(&self) -> FWord { let range = self.shape.center_x_byte_range(); self.data.read_at(range.start).unwrap() } /// y coordinate for the center of scaling. + #[inline] pub fn center_y(&self) -> FWord { let range = self.shape.center_y_byte_range(); self.data.read_at(range.start).unwrap() @@ -4446,6 +4635,7 @@ impl MinByteRange for PaintVarScaleAroundCenterMarker { } impl<'a> FontRead<'a> for PaintVarScaleAroundCenter<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -4465,12 +4655,14 @@ pub type PaintVarScaleAroundCenter<'a> = TableRef<'a, PaintVarScaleAroundCenterM #[allow(clippy::needless_lifetimes)] impl<'a> PaintVarScaleAroundCenter<'a> { /// Set to 19. + #[inline] pub fn format(&self) -> u8 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset to a Paint subtable. + #[inline] pub fn paint_offset(&self) -> Offset24 { let range = self.shape.paint_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -4484,6 +4676,7 @@ impl<'a> PaintVarScaleAroundCenter<'a> { /// Scale factor in x direction. For variation, use varIndexBase + /// 0. + #[inline] pub fn scale_x(&self) -> F2Dot14 { let range = self.shape.scale_x_byte_range(); self.data.read_at(range.start).unwrap() @@ -4491,6 +4684,7 @@ impl<'a> PaintVarScaleAroundCenter<'a> { /// Scale factor in y direction. For variation, use varIndexBase + /// 1. + #[inline] pub fn scale_y(&self) -> F2Dot14 { let range = self.shape.scale_y_byte_range(); self.data.read_at(range.start).unwrap() @@ -4498,6 +4692,7 @@ impl<'a> PaintVarScaleAroundCenter<'a> { /// x coordinate for the center of scaling. For variation, use /// varIndexBase + 2. + #[inline] pub fn center_x(&self) -> FWord { let range = self.shape.center_x_byte_range(); self.data.read_at(range.start).unwrap() @@ -4505,12 +4700,14 @@ impl<'a> PaintVarScaleAroundCenter<'a> { /// y coordinate for the center of scaling. For variation, use /// varIndexBase + 3. + #[inline] pub fn center_y(&self) -> FWord { let range = self.shape.center_y_byte_range(); self.data.read_at(range.start).unwrap() } /// Base index into DeltaSetIndexMap. + #[inline] pub fn var_index_base(&self) -> u32 { let range = self.shape.var_index_base_byte_range(); self.data.read_at(range.start).unwrap() @@ -4580,6 +4777,7 @@ impl MinByteRange for PaintScaleUniformMarker { } impl<'a> FontRead<'a> for PaintScaleUniform<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -4595,12 +4793,14 @@ pub type PaintScaleUniform<'a> = TableRef<'a, PaintScaleUniformMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> PaintScaleUniform<'a> { /// Set to 20. + #[inline] pub fn format(&self) -> u8 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset to a Paint subtable. + #[inline] pub fn paint_offset(&self) -> Offset24 { let range = self.shape.paint_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -4613,6 +4813,7 @@ impl<'a> PaintScaleUniform<'a> { } /// Scale factor in x and y directions. + #[inline] pub fn scale(&self) -> F2Dot14 { let range = self.shape.scale_byte_range(); self.data.read_at(range.start).unwrap() @@ -4683,6 +4884,7 @@ impl MinByteRange for PaintVarScaleUniformMarker { } impl<'a> FontRead<'a> for PaintVarScaleUniform<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -4699,12 +4901,14 @@ pub type PaintVarScaleUniform<'a> = TableRef<'a, PaintVarScaleUniformMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> PaintVarScaleUniform<'a> { /// Set to 21. + #[inline] pub fn format(&self) -> u8 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset to a Paint subtable. + #[inline] pub fn paint_offset(&self) -> Offset24 { let range = self.shape.paint_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -4718,12 +4922,14 @@ impl<'a> PaintVarScaleUniform<'a> { /// Scale factor in x and y directions. For variation, use /// varIndexBase + 0. + #[inline] pub fn scale(&self) -> F2Dot14 { let range = self.shape.scale_byte_range(); self.data.read_at(range.start).unwrap() } /// Base index into DeltaSetIndexMap. + #[inline] pub fn var_index_base(&self) -> u32 { let range = self.shape.var_index_base_byte_range(); self.data.read_at(range.start).unwrap() @@ -4800,6 +5006,7 @@ impl MinByteRange for PaintScaleUniformAroundCenterMarker { } impl<'a> FontRead<'a> for PaintScaleUniformAroundCenter<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -4817,12 +5024,14 @@ pub type PaintScaleUniformAroundCenter<'a> = TableRef<'a, PaintScaleUniformAroun #[allow(clippy::needless_lifetimes)] impl<'a> PaintScaleUniformAroundCenter<'a> { /// Set to 22. + #[inline] pub fn format(&self) -> u8 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset to a Paint subtable. + #[inline] pub fn paint_offset(&self) -> Offset24 { let range = self.shape.paint_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -4835,18 +5044,21 @@ impl<'a> PaintScaleUniformAroundCenter<'a> { } /// Scale factor in x and y directions. + #[inline] pub fn scale(&self) -> F2Dot14 { let range = self.shape.scale_byte_range(); self.data.read_at(range.start).unwrap() } /// x coordinate for the center of scaling. + #[inline] pub fn center_x(&self) -> FWord { let range = self.shape.center_x_byte_range(); self.data.read_at(range.start).unwrap() } /// y coordinate for the center of scaling. + #[inline] pub fn center_y(&self) -> FWord { let range = self.shape.center_y_byte_range(); self.data.read_at(range.start).unwrap() @@ -4929,6 +5141,7 @@ impl MinByteRange for PaintVarScaleUniformAroundCenterMarker { } impl<'a> FontRead<'a> for PaintVarScaleUniformAroundCenter<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -4948,12 +5161,14 @@ pub type PaintVarScaleUniformAroundCenter<'a> = #[allow(clippy::needless_lifetimes)] impl<'a> PaintVarScaleUniformAroundCenter<'a> { /// Set to 23. + #[inline] pub fn format(&self) -> u8 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset to a Paint subtable. + #[inline] pub fn paint_offset(&self) -> Offset24 { let range = self.shape.paint_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -4967,6 +5182,7 @@ impl<'a> PaintVarScaleUniformAroundCenter<'a> { /// Scale factor in x and y directions. For variation, use /// varIndexBase + 0. + #[inline] pub fn scale(&self) -> F2Dot14 { let range = self.shape.scale_byte_range(); self.data.read_at(range.start).unwrap() @@ -4974,6 +5190,7 @@ impl<'a> PaintVarScaleUniformAroundCenter<'a> { /// x coordinate for the center of scaling. For variation, use /// varIndexBase + 1. + #[inline] pub fn center_x(&self) -> FWord { let range = self.shape.center_x_byte_range(); self.data.read_at(range.start).unwrap() @@ -4981,12 +5198,14 @@ impl<'a> PaintVarScaleUniformAroundCenter<'a> { /// y coordinate for the center of scaling. For variation, use /// varIndexBase + 2. + #[inline] pub fn center_y(&self) -> FWord { let range = self.shape.center_y_byte_range(); self.data.read_at(range.start).unwrap() } /// Base index into DeltaSetIndexMap. + #[inline] pub fn var_index_base(&self) -> u32 { let range = self.shape.var_index_base_byte_range(); self.data.read_at(range.start).unwrap() @@ -5055,6 +5274,7 @@ impl MinByteRange for PaintRotateMarker { } impl<'a> FontRead<'a> for PaintRotate<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -5070,12 +5290,14 @@ pub type PaintRotate<'a> = TableRef<'a, PaintRotateMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> PaintRotate<'a> { /// Set to 24. + #[inline] pub fn format(&self) -> u8 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset to a Paint subtable. + #[inline] pub fn paint_offset(&self) -> Offset24 { let range = self.shape.paint_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -5089,6 +5311,7 @@ impl<'a> PaintRotate<'a> { /// Rotation angle, 180° in counter-clockwise degrees per 1.0 of /// value. + #[inline] pub fn angle(&self) -> F2Dot14 { let range = self.shape.angle_byte_range(); self.data.read_at(range.start).unwrap() @@ -5159,6 +5382,7 @@ impl MinByteRange for PaintVarRotateMarker { } impl<'a> FontRead<'a> for PaintVarRotate<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -5175,12 +5399,14 @@ pub type PaintVarRotate<'a> = TableRef<'a, PaintVarRotateMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> PaintVarRotate<'a> { /// Set to 25. + #[inline] pub fn format(&self) -> u8 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset to a Paint subtable. + #[inline] pub fn paint_offset(&self) -> Offset24 { let range = self.shape.paint_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -5194,12 +5420,14 @@ impl<'a> PaintVarRotate<'a> { /// Rotation angle, 180° in counter-clockwise degrees per 1.0 of /// value. For variation, use varIndexBase + 0. + #[inline] pub fn angle(&self) -> F2Dot14 { let range = self.shape.angle_byte_range(); self.data.read_at(range.start).unwrap() } /// Base index into DeltaSetIndexMap. + #[inline] pub fn var_index_base(&self) -> u32 { let range = self.shape.var_index_base_byte_range(); self.data.read_at(range.start).unwrap() @@ -5276,6 +5504,7 @@ impl MinByteRange for PaintRotateAroundCenterMarker { } impl<'a> FontRead<'a> for PaintRotateAroundCenter<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -5293,12 +5522,14 @@ pub type PaintRotateAroundCenter<'a> = TableRef<'a, PaintRotateAroundCenterMarke #[allow(clippy::needless_lifetimes)] impl<'a> PaintRotateAroundCenter<'a> { /// Set to 26. + #[inline] pub fn format(&self) -> u8 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset to a Paint subtable. + #[inline] pub fn paint_offset(&self) -> Offset24 { let range = self.shape.paint_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -5312,18 +5543,21 @@ impl<'a> PaintRotateAroundCenter<'a> { /// Rotation angle, 180° in counter-clockwise degrees per 1.0 of /// value. + #[inline] pub fn angle(&self) -> F2Dot14 { let range = self.shape.angle_byte_range(); self.data.read_at(range.start).unwrap() } /// x coordinate for the center of rotation. + #[inline] pub fn center_x(&self) -> FWord { let range = self.shape.center_x_byte_range(); self.data.read_at(range.start).unwrap() } /// y coordinate for the center of rotation. + #[inline] pub fn center_y(&self) -> FWord { let range = self.shape.center_y_byte_range(); self.data.read_at(range.start).unwrap() @@ -5406,6 +5640,7 @@ impl MinByteRange for PaintVarRotateAroundCenterMarker { } impl<'a> FontRead<'a> for PaintVarRotateAroundCenter<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -5424,12 +5659,14 @@ pub type PaintVarRotateAroundCenter<'a> = TableRef<'a, PaintVarRotateAroundCente #[allow(clippy::needless_lifetimes)] impl<'a> PaintVarRotateAroundCenter<'a> { /// Set to 27. + #[inline] pub fn format(&self) -> u8 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset to a Paint subtable. + #[inline] pub fn paint_offset(&self) -> Offset24 { let range = self.shape.paint_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -5443,6 +5680,7 @@ impl<'a> PaintVarRotateAroundCenter<'a> { /// Rotation angle, 180° in counter-clockwise degrees per 1.0 of /// value. For variation, use varIndexBase + 0. + #[inline] pub fn angle(&self) -> F2Dot14 { let range = self.shape.angle_byte_range(); self.data.read_at(range.start).unwrap() @@ -5450,6 +5688,7 @@ impl<'a> PaintVarRotateAroundCenter<'a> { /// x coordinate for the center of rotation. For variation, use /// varIndexBase + 1. + #[inline] pub fn center_x(&self) -> FWord { let range = self.shape.center_x_byte_range(); self.data.read_at(range.start).unwrap() @@ -5457,12 +5696,14 @@ impl<'a> PaintVarRotateAroundCenter<'a> { /// y coordinate for the center of rotation. For variation, use /// varIndexBase + 2. + #[inline] pub fn center_y(&self) -> FWord { let range = self.shape.center_y_byte_range(); self.data.read_at(range.start).unwrap() } /// Base index into DeltaSetIndexMap. + #[inline] pub fn var_index_base(&self) -> u32 { let range = self.shape.var_index_base_byte_range(); self.data.read_at(range.start).unwrap() @@ -5536,6 +5777,7 @@ impl MinByteRange for PaintSkewMarker { } impl<'a> FontRead<'a> for PaintSkew<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -5552,12 +5794,14 @@ pub type PaintSkew<'a> = TableRef<'a, PaintSkewMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> PaintSkew<'a> { /// Set to 28. + #[inline] pub fn format(&self) -> u8 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset to a Paint subtable. + #[inline] pub fn paint_offset(&self) -> Offset24 { let range = self.shape.paint_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -5571,6 +5815,7 @@ impl<'a> PaintSkew<'a> { /// Angle of skew in the direction of the x-axis, 180° in /// counter-clockwise degrees per 1.0 of value. + #[inline] pub fn x_skew_angle(&self) -> F2Dot14 { let range = self.shape.x_skew_angle_byte_range(); self.data.read_at(range.start).unwrap() @@ -5578,6 +5823,7 @@ impl<'a> PaintSkew<'a> { /// Angle of skew in the direction of the y-axis, 180° in /// counter-clockwise degrees per 1.0 of value. + #[inline] pub fn y_skew_angle(&self) -> F2Dot14 { let range = self.shape.y_skew_angle_byte_range(); self.data.read_at(range.start).unwrap() @@ -5654,6 +5900,7 @@ impl MinByteRange for PaintVarSkewMarker { } impl<'a> FontRead<'a> for PaintVarSkew<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -5671,12 +5918,14 @@ pub type PaintVarSkew<'a> = TableRef<'a, PaintVarSkewMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> PaintVarSkew<'a> { /// Set to 29. + #[inline] pub fn format(&self) -> u8 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset to a Paint subtable. + #[inline] pub fn paint_offset(&self) -> Offset24 { let range = self.shape.paint_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -5691,6 +5940,7 @@ impl<'a> PaintVarSkew<'a> { /// Angle of skew in the direction of the x-axis, 180° ┬░ in /// counter-clockwise degrees per 1.0 of value. For variation, use /// varIndexBase + 0. + #[inline] pub fn x_skew_angle(&self) -> F2Dot14 { let range = self.shape.x_skew_angle_byte_range(); self.data.read_at(range.start).unwrap() @@ -5699,12 +5949,14 @@ impl<'a> PaintVarSkew<'a> { /// Angle of skew in the direction of the y-axis, 180° in /// counter-clockwise degrees per 1.0 of value. For variation, use /// varIndexBase + 1. + #[inline] pub fn y_skew_angle(&self) -> F2Dot14 { let range = self.shape.y_skew_angle_byte_range(); self.data.read_at(range.start).unwrap() } /// Base index into DeltaSetIndexMap. + #[inline] pub fn var_index_base(&self) -> u32 { let range = self.shape.var_index_base_byte_range(); self.data.read_at(range.start).unwrap() @@ -5787,6 +6039,7 @@ impl MinByteRange for PaintSkewAroundCenterMarker { } impl<'a> FontRead<'a> for PaintSkewAroundCenter<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -5805,12 +6058,14 @@ pub type PaintSkewAroundCenter<'a> = TableRef<'a, PaintSkewAroundCenterMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> PaintSkewAroundCenter<'a> { /// Set to 30. + #[inline] pub fn format(&self) -> u8 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset to a Paint subtable. + #[inline] pub fn paint_offset(&self) -> Offset24 { let range = self.shape.paint_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -5824,6 +6079,7 @@ impl<'a> PaintSkewAroundCenter<'a> { /// Angle of skew in the direction of the x-axis, 180° in /// counter-clockwise degrees per 1.0 of value. + #[inline] pub fn x_skew_angle(&self) -> F2Dot14 { let range = self.shape.x_skew_angle_byte_range(); self.data.read_at(range.start).unwrap() @@ -5831,18 +6087,21 @@ impl<'a> PaintSkewAroundCenter<'a> { /// Angle of skew in the direction of the y-axis, 180° in /// counter-clockwise degrees per 1.0 of value. + #[inline] pub fn y_skew_angle(&self) -> F2Dot14 { let range = self.shape.y_skew_angle_byte_range(); self.data.read_at(range.start).unwrap() } /// x coordinate for the center of rotation. + #[inline] pub fn center_x(&self) -> FWord { let range = self.shape.center_x_byte_range(); self.data.read_at(range.start).unwrap() } /// y coordinate for the center of rotation. + #[inline] pub fn center_y(&self) -> FWord { let range = self.shape.center_y_byte_range(); self.data.read_at(range.start).unwrap() @@ -5931,6 +6190,7 @@ impl MinByteRange for PaintVarSkewAroundCenterMarker { } impl<'a> FontRead<'a> for PaintVarSkewAroundCenter<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -5950,12 +6210,14 @@ pub type PaintVarSkewAroundCenter<'a> = TableRef<'a, PaintVarSkewAroundCenterMar #[allow(clippy::needless_lifetimes)] impl<'a> PaintVarSkewAroundCenter<'a> { /// Set to 31. + #[inline] pub fn format(&self) -> u8 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset to a Paint subtable. + #[inline] pub fn paint_offset(&self) -> Offset24 { let range = self.shape.paint_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -5970,6 +6232,7 @@ impl<'a> PaintVarSkewAroundCenter<'a> { /// Angle of skew in the direction of the x-axis, 180° in /// counter-clockwise degrees per 1.0 of value. For variation, use /// varIndexBase + 0. + #[inline] pub fn x_skew_angle(&self) -> F2Dot14 { let range = self.shape.x_skew_angle_byte_range(); self.data.read_at(range.start).unwrap() @@ -5978,6 +6241,7 @@ impl<'a> PaintVarSkewAroundCenter<'a> { /// Angle of skew in the direction of the y-axis, 180° in /// counter-clockwise degrees per 1.0 of value. For variation, use /// varIndexBase + 1. + #[inline] pub fn y_skew_angle(&self) -> F2Dot14 { let range = self.shape.y_skew_angle_byte_range(); self.data.read_at(range.start).unwrap() @@ -5985,6 +6249,7 @@ impl<'a> PaintVarSkewAroundCenter<'a> { /// x coordinate for the center of rotation. For variation, use /// varIndexBase + 2. + #[inline] pub fn center_x(&self) -> FWord { let range = self.shape.center_x_byte_range(); self.data.read_at(range.start).unwrap() @@ -5992,12 +6257,14 @@ impl<'a> PaintVarSkewAroundCenter<'a> { /// y coordinate for the center of rotation. For variation, use /// varIndexBase + 3. + #[inline] pub fn center_y(&self) -> FWord { let range = self.shape.center_y_byte_range(); self.data.read_at(range.start).unwrap() } /// Base index into DeltaSetIndexMap. + #[inline] pub fn var_index_base(&self) -> u32 { let range = self.shape.var_index_base_byte_range(); self.data.read_at(range.start).unwrap() @@ -6072,6 +6339,7 @@ impl MinByteRange for PaintCompositeMarker { } impl<'a> FontRead<'a> for PaintComposite<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -6088,12 +6356,14 @@ pub type PaintComposite<'a> = TableRef<'a, PaintCompositeMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> PaintComposite<'a> { /// Set to 32. + #[inline] pub fn format(&self) -> u8 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset to a source Paint table. + #[inline] pub fn source_paint_offset(&self) -> Offset24 { let range = self.shape.source_paint_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -6106,12 +6376,14 @@ impl<'a> PaintComposite<'a> { } /// A CompositeMode enumeration value. + #[inline] pub fn composite_mode(&self) -> CompositeMode { let range = self.shape.composite_mode_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset to a backdrop Paint table. + #[inline] pub fn backdrop_paint_offset(&self) -> Offset24 { let range = self.shape.backdrop_paint_offset_byte_range(); self.data.read_at(range.start).unwrap() diff --git a/read-fonts/generated/generated_cpal.rs b/read-fonts/generated/generated_cpal.rs index 71ab19550..70ed95180 100644 --- a/read-fonts/generated/generated_cpal.rs +++ b/read-fonts/generated/generated_cpal.rs @@ -74,6 +74,7 @@ impl TopLevelTable for Cpal<'_> { } impl<'a> FontRead<'a> for Cpal<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let version: u16 = cursor.read()?; @@ -121,24 +122,28 @@ pub type Cpal<'a> = TableRef<'a, CpalMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> Cpal<'a> { /// Table version number (=0). + #[inline] pub fn version(&self) -> u16 { let range = self.shape.version_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of palette entries in each palette. + #[inline] pub fn num_palette_entries(&self) -> u16 { let range = self.shape.num_palette_entries_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of palettes in the table. + #[inline] pub fn num_palettes(&self) -> u16 { let range = self.shape.num_palettes_byte_range(); self.data.read_at(range.start).unwrap() } /// Total number of color records, combined for all palettes. + #[inline] pub fn num_color_records(&self) -> u16 { let range = self.shape.num_color_records_byte_range(); self.data.read_at(range.start).unwrap() @@ -146,6 +151,7 @@ impl<'a> Cpal<'a> { /// Offset from the beginning of CPAL table to the first /// ColorRecord. + #[inline] pub fn color_records_array_offset(&self) -> Nullable { let range = self.shape.color_records_array_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -161,6 +167,7 @@ impl<'a> Cpal<'a> { /// Index of each palette’s first color record in the combined /// color record array. + #[inline] pub fn color_record_indices(&self) -> &'a [BigEndian] { let range = self.shape.color_record_indices_byte_range(); self.data.read_array(range).unwrap() @@ -171,6 +178,7 @@ impl<'a> Cpal<'a> { /// This is an array of 32-bit flag fields that describe properties of each palette. /// /// [Palette Types Array]: https://learn.microsoft.com/en-us/typography/opentype/spec/cpal#palette-type-array + #[inline] pub fn palette_types_array_offset(&self) -> Option> { let range = self.shape.palette_types_array_offset_byte_range()?; Some(self.data.read_at(range.start).unwrap()) @@ -191,6 +199,7 @@ impl<'a> Cpal<'a> { /// Use 0xFFFF if no name ID is provided for a palette. /// /// [Palette Labels Array]: https://learn.microsoft.com/en-us/typography/opentype/spec/cpal#palette-labels-array + #[inline] pub fn palette_labels_array_offset(&self) -> Option> { let range = self.shape.palette_labels_array_offset_byte_range()?; Some(self.data.read_at(range.start).unwrap()) @@ -213,6 +222,7 @@ impl<'a> Cpal<'a> { /// palette entry. /// /// [Palette Entry Labels Array]: https://learn.microsoft.com/en-us/typography/opentype/spec/cpal#palette-entry-label-array + #[inline] pub fn palette_entry_labels_array_offset(&self) -> Option> { let range = self.shape.palette_entry_labels_array_offset_byte_range()?; Some(self.data.read_at(range.start).unwrap()) @@ -620,21 +630,25 @@ pub struct ColorRecord { impl ColorRecord { /// Blue value (B0). + #[inline] pub fn blue(&self) -> u8 { self.blue } /// Green value (B1). + #[inline] pub fn green(&self) -> u8 { self.green } /// Red value (B2). + #[inline] pub fn red(&self) -> u8 { self.red } /// Alpha value (B3). + #[inline] pub fn alpha(&self) -> u8 { self.alpha } diff --git a/read-fonts/generated/generated_cvar.rs b/read-fonts/generated/generated_cvar.rs index f41e3575b..1c39dc2f9 100644 --- a/read-fonts/generated/generated_cvar.rs +++ b/read-fonts/generated/generated_cvar.rs @@ -46,6 +46,7 @@ impl TopLevelTable for Cvar<'_> { } impl<'a> FontRead<'a> for Cvar<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -65,6 +66,7 @@ pub type Cvar<'a> = TableRef<'a, CvarMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> Cvar<'a> { /// Major/minor version number of the CVT variations table — set to (1,0). + #[inline] pub fn version(&self) -> MajorMinor { let range = self.shape.version_byte_range(); self.data.read_at(range.start).unwrap() @@ -74,12 +76,14 @@ impl<'a> Cvar<'a> { /// are the number of tuple variation tables for this glyph. The /// number of tuple variation tables can be any number between 1 /// and 4095. + #[inline] pub fn tuple_variation_count(&self) -> TupleVariationCount { let range = self.shape.tuple_variation_count_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset from the start of the 'cvar' table to the serialized data. + #[inline] pub fn data_offset(&self) -> Offset16 { let range = self.shape.data_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -92,6 +96,7 @@ impl<'a> Cvar<'a> { } /// Array of tuple variation headers. + #[inline] pub fn tuple_variation_headers(&self) -> VarLenArray<'a, TupleVariationHeader> { let range = self.shape.tuple_variation_headers_byte_range(); VarLenArray::read(self.data.split_off(range.start).unwrap()).unwrap() diff --git a/read-fonts/generated/generated_ebdt.rs b/read-fonts/generated/generated_ebdt.rs index 5e6a498d9..9a993040d 100644 --- a/read-fonts/generated/generated_ebdt.rs +++ b/read-fonts/generated/generated_ebdt.rs @@ -34,6 +34,7 @@ impl TopLevelTable for Ebdt<'_> { } impl<'a> FontRead<'a> for Ebdt<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -48,12 +49,14 @@ pub type Ebdt<'a> = TableRef<'a, EbdtMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> Ebdt<'a> { /// Major version of the EBDT table, = 2. + #[inline] pub fn major_version(&self) -> u16 { let range = self.shape.major_version_byte_range(); self.data.read_at(range.start).unwrap() } /// Minor version of EBDT table, = 0. + #[inline] pub fn minor_version(&self) -> u16 { let range = self.shape.minor_version_byte_range(); self.data.read_at(range.start).unwrap() diff --git a/read-fonts/generated/generated_eblc.rs b/read-fonts/generated/generated_eblc.rs index 332d75244..303e5a23a 100644 --- a/read-fonts/generated/generated_eblc.rs +++ b/read-fonts/generated/generated_eblc.rs @@ -46,6 +46,7 @@ impl TopLevelTable for Eblc<'_> { } impl<'a> FontRead<'a> for Eblc<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -67,24 +68,28 @@ pub type Eblc<'a> = TableRef<'a, EblcMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> Eblc<'a> { /// Major version of the EBLC table, = 2. + #[inline] pub fn major_version(&self) -> u16 { let range = self.shape.major_version_byte_range(); self.data.read_at(range.start).unwrap() } /// Minor version of EBLC table, = 0. + #[inline] pub fn minor_version(&self) -> u16 { let range = self.shape.minor_version_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of BitmapSize records. + #[inline] pub fn num_sizes(&self) -> u32 { let range = self.shape.num_sizes_byte_range(); self.data.read_at(range.start).unwrap() } /// BitmapSize records array. + #[inline] pub fn bitmap_sizes(&self) -> &'a [BitmapSize] { let range = self.shape.bitmap_sizes_byte_range(); self.data.read_array(range).unwrap() diff --git a/read-fonts/generated/generated_feat.rs b/read-fonts/generated/generated_feat.rs index 94ccad03f..455fa2834 100644 --- a/read-fonts/generated/generated_feat.rs +++ b/read-fonts/generated/generated_feat.rs @@ -51,6 +51,7 @@ impl TopLevelTable for Feat<'_> { } impl<'a> FontRead<'a> for Feat<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -72,18 +73,21 @@ pub type Feat<'a> = TableRef<'a, FeatMarker>; impl<'a> Feat<'a> { /// Version number of the feature name table (0x00010000 for the current /// version). + #[inline] pub fn version(&self) -> MajorMinor { let range = self.shape.version_byte_range(); self.data.read_at(range.start).unwrap() } /// The number of entries in the feature name array. + #[inline] pub fn feature_name_count(&self) -> u16 { let range = self.shape.feature_name_count_byte_range(); self.data.read_at(range.start).unwrap() } /// The feature name array, sorted by feature type. + #[inline] pub fn names(&self) -> &'a [FeatureName] { let range = self.shape.names_byte_range(); self.data.read_array(range).unwrap() @@ -141,11 +145,13 @@ pub struct FeatureName { impl FeatureName { /// Feature type. + #[inline] pub fn feature(&self) -> u16 { self.feature.get() } /// The number of records in the setting name array. + #[inline] pub fn n_settings(&self) -> u16 { self.n_settings.get() } @@ -153,6 +159,7 @@ impl FeatureName { /// Offset in bytes from the beginning of this table to this feature's /// setting name array. The actual type of record this offset refers /// to will depend on the exclusivity value, as described below. + #[inline] pub fn setting_table_offset(&self) -> Offset32 { self.setting_table_offset.get() } @@ -169,11 +176,13 @@ impl FeatureName { } /// Flags associated with the feature type. + #[inline] pub fn feature_flags(&self) -> u16 { self.feature_flags.get() } /// The name table index for the feature's name. + #[inline] pub fn name_index(&self) -> NameId { self.name_index.get() } @@ -232,6 +241,7 @@ impl ReadArgs for SettingNameArray<'_> { } impl<'a> FontReadWithArgs<'a> for SettingNameArray<'a> { + #[inline] fn read_with_args(data: FontData<'a>, args: &u16) -> Result { let n_settings = *args; let mut cursor = data.cursor(); @@ -248,6 +258,7 @@ impl<'a> SettingNameArray<'a> { /// /// This type requires some external state in order to be /// parsed. + #[inline] pub fn read(data: FontData<'a>, n_settings: u16) -> Result { let args = n_settings; Self::read_with_args(data, &args) @@ -259,6 +270,7 @@ pub type SettingNameArray<'a> = TableRef<'a, SettingNameArrayMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> SettingNameArray<'a> { /// List of setting names for a feature. + #[inline] pub fn settings(&self) -> &'a [SettingName] { let range = self.shape.settings_byte_range(); self.data.read_array(range).unwrap() @@ -306,11 +318,13 @@ pub struct SettingName { impl SettingName { /// The setting. + #[inline] pub fn setting(&self) -> u16 { self.setting.get() } /// The name table index for the setting's name. + #[inline] pub fn name_index(&self) -> NameId { self.name_index.get() } diff --git a/read-fonts/generated/generated_fvar.rs b/read-fonts/generated/generated_fvar.rs index e020392a7..272fc54fb 100644 --- a/read-fonts/generated/generated_fvar.rs +++ b/read-fonts/generated/generated_fvar.rs @@ -59,6 +59,7 @@ impl TopLevelTable for Fvar<'_> { } impl<'a> FontRead<'a> for Fvar<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -79,6 +80,7 @@ pub type Fvar<'a> = TableRef<'a, FvarMarker>; impl<'a> Fvar<'a> { /// Major version number of the font variations table — set to 1. /// Minor version number of the font variations table — set to 0. + #[inline] pub fn version(&self) -> MajorMinor { let range = self.shape.version_byte_range(); self.data.read_at(range.start).unwrap() @@ -86,6 +88,7 @@ impl<'a> Fvar<'a> { /// Offset in bytes from the beginning of the table to the start of the VariationAxisRecord array. The /// InstanceRecord array directly follows. + #[inline] pub fn axis_instance_arrays_offset(&self) -> Offset16 { let range = self.shape.axis_instance_arrays_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -104,24 +107,28 @@ impl<'a> Fvar<'a> { } /// The number of variation axes in the font (the number of records in the axes array). + #[inline] pub fn axis_count(&self) -> u16 { let range = self.shape.axis_count_byte_range(); self.data.read_at(range.start).unwrap() } /// The size in bytes of each VariationAxisRecord — set to 20 (0x0014) for this version. + #[inline] pub fn axis_size(&self) -> u16 { let range = self.shape.axis_size_byte_range(); self.data.read_at(range.start).unwrap() } /// The number of named instances defined in the font (the number of records in the instances array). + #[inline] pub fn instance_count(&self) -> u16 { let range = self.shape.instance_count_byte_range(); self.data.read_at(range.start).unwrap() } /// The size in bytes of each InstanceRecord — set to either axisCount * sizeof(Fixed) + 4, or to axisCount * sizeof(Fixed) + 6. + #[inline] pub fn instance_size(&self) -> u16 { let range = self.shape.instance_size_byte_range(); self.data.read_at(range.start).unwrap() @@ -193,6 +200,7 @@ impl ReadArgs for AxisInstanceArrays<'_> { } impl<'a> FontReadWithArgs<'a> for AxisInstanceArrays<'a> { + #[inline] fn read_with_args(data: FontData<'a>, args: &(u16, u16, u16)) -> Result { let (axis_count, instance_count, instance_size) = *args; let mut cursor = data.cursor(); @@ -221,6 +229,7 @@ impl<'a> AxisInstanceArrays<'a> { /// /// This type requires some external state in order to be /// parsed. + #[inline] pub fn read( data: FontData<'a>, axis_count: u16, @@ -238,12 +247,14 @@ pub type AxisInstanceArrays<'a> = TableRef<'a, AxisInstanceArraysMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> AxisInstanceArrays<'a> { /// Variation axis record array. + #[inline] pub fn axes(&self) -> &'a [VariationAxisRecord] { let range = self.shape.axes_byte_range(); self.data.read_array(range).unwrap() } /// Instance record array. + #[inline] pub fn instances(&self) -> ComputedArray<'a, InstanceRecord<'a>> { let range = self.shape.instances_byte_range(); self.data @@ -317,31 +328,37 @@ pub struct VariationAxisRecord { impl VariationAxisRecord { /// Tag identifying the design variation for the axis. + #[inline] pub fn axis_tag(&self) -> Tag { self.axis_tag.get() } /// The minimum coordinate value for the axis. + #[inline] pub fn min_value(&self) -> Fixed { self.min_value.get() } /// The default coordinate value for the axis. + #[inline] pub fn default_value(&self) -> Fixed { self.default_value.get() } /// The maximum coordinate value for the axis. + #[inline] pub fn max_value(&self) -> Fixed { self.max_value.get() } /// Axis qualifiers — see details below. + #[inline] pub fn flags(&self) -> u16 { self.flags.get() } /// The name ID for entries in the 'name' table that provide a display name for this axis. + #[inline] pub fn axis_name_id(&self) -> NameId { self.axis_name_id.get() } diff --git a/read-fonts/generated/generated_gasp.rs b/read-fonts/generated/generated_gasp.rs index 866bc8773..6da3936e0 100644 --- a/read-fonts/generated/generated_gasp.rs +++ b/read-fonts/generated/generated_gasp.rs @@ -41,6 +41,7 @@ impl TopLevelTable for Gasp<'_> { } impl<'a> FontRead<'a> for Gasp<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -61,18 +62,21 @@ pub type Gasp<'a> = TableRef<'a, GaspMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> Gasp<'a> { /// Version number (set to 1) + #[inline] pub fn version(&self) -> u16 { let range = self.shape.version_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of records to follow + #[inline] pub fn num_ranges(&self) -> u16 { let range = self.shape.num_ranges_byte_range(); self.data.read_at(range.start).unwrap() } /// Sorted by ppem + #[inline] pub fn gasp_ranges(&self) -> &'a [GaspRange] { let range = self.shape.gasp_ranges_byte_range(); self.data.read_array(range).unwrap() @@ -121,11 +125,13 @@ pub struct GaspRange { impl GaspRange { /// Upper limit of range, in PPEM + #[inline] pub fn range_max_ppem(&self) -> u16 { self.range_max_ppem.get() } /// Flags describing desired rasterizer behavior. + #[inline] pub fn range_gasp_behavior(&self) -> GaspRangeBehavior { self.range_gasp_behavior.get() } diff --git a/read-fonts/generated/generated_gdef.rs b/read-fonts/generated/generated_gdef.rs index 165c68cfd..809f2e30c 100644 --- a/read-fonts/generated/generated_gdef.rs +++ b/read-fonts/generated/generated_gdef.rs @@ -62,6 +62,7 @@ impl TopLevelTable for Gdef<'_> { } impl<'a> FontRead<'a> for Gdef<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let version: MajorMinor = cursor.read()?; @@ -96,6 +97,7 @@ pub type Gdef<'a> = TableRef<'a, GdefMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> Gdef<'a> { /// The major/minor version of the GDEF table + #[inline] pub fn version(&self) -> MajorMinor { let range = self.shape.version_byte_range(); self.data.read_at(range.start).unwrap() @@ -103,6 +105,7 @@ impl<'a> Gdef<'a> { /// Offset to class definition table for glyph type, from beginning /// of GDEF header (may be NULL) + #[inline] pub fn glyph_class_def_offset(&self) -> Nullable { let range = self.shape.glyph_class_def_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -116,6 +119,7 @@ impl<'a> Gdef<'a> { /// Offset to attachment point list table, from beginning of GDEF /// header (may be NULL) + #[inline] pub fn attach_list_offset(&self) -> Nullable { let range = self.shape.attach_list_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -129,6 +133,7 @@ impl<'a> Gdef<'a> { /// Offset to ligature caret list table, from beginning of GDEF /// header (may be NULL) + #[inline] pub fn lig_caret_list_offset(&self) -> Nullable { let range = self.shape.lig_caret_list_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -142,6 +147,7 @@ impl<'a> Gdef<'a> { /// Offset to class definition table for mark attachment type, from /// beginning of GDEF header (may be NULL) + #[inline] pub fn mark_attach_class_def_offset(&self) -> Nullable { let range = self.shape.mark_attach_class_def_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -155,6 +161,7 @@ impl<'a> Gdef<'a> { /// Offset to the table of mark glyph set definitions, from /// beginning of GDEF header (may be NULL) + #[inline] pub fn mark_glyph_sets_def_offset(&self) -> Option> { let range = self.shape.mark_glyph_sets_def_offset_byte_range()?; Some(self.data.read_at(range.start).unwrap()) @@ -168,6 +175,7 @@ impl<'a> Gdef<'a> { /// Offset to the Item Variation Store table, from beginning of /// GDEF header (may be NULL) + #[inline] pub fn item_var_store_offset(&self) -> Option> { let range = self.shape.item_var_store_offset_byte_range()?; Some(self.data.read_at(range.start).unwrap()) @@ -312,6 +320,7 @@ impl MinByteRange for AttachListMarker { } impl<'a> FontRead<'a> for AttachList<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -332,6 +341,7 @@ pub type AttachList<'a> = TableRef<'a, AttachListMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> AttachList<'a> { /// Offset to Coverage table - from beginning of AttachList table + #[inline] pub fn coverage_offset(&self) -> Offset16 { let range = self.shape.coverage_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -344,6 +354,7 @@ impl<'a> AttachList<'a> { } /// Number of glyphs with attachment points + #[inline] pub fn glyph_count(&self) -> u16 { let range = self.shape.glyph_count_byte_range(); self.data.read_at(range.start).unwrap() @@ -351,6 +362,7 @@ impl<'a> AttachList<'a> { /// Array of offsets to AttachPoint tables-from beginning of /// AttachList table-in Coverage Index order + #[inline] pub fn attach_point_offsets(&self) -> &'a [BigEndian] { let range = self.shape.attach_point_offsets_byte_range(); self.data.read_array(range).unwrap() @@ -429,6 +441,7 @@ impl MinByteRange for AttachPointMarker { } impl<'a> FontRead<'a> for AttachPoint<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let point_count: u16 = cursor.read()?; @@ -448,12 +461,14 @@ pub type AttachPoint<'a> = TableRef<'a, AttachPointMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> AttachPoint<'a> { /// Number of attachment points on this glyph + #[inline] pub fn point_count(&self) -> u16 { let range = self.shape.point_count_byte_range(); self.data.read_at(range.start).unwrap() } /// Array of contour point indices -in increasing numerical order + #[inline] pub fn point_indices(&self) -> &'a [BigEndian] { let range = self.shape.point_indices_byte_range(); self.data.read_array(range).unwrap() @@ -513,6 +528,7 @@ impl MinByteRange for LigCaretListMarker { } impl<'a> FontRead<'a> for LigCaretList<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -533,6 +549,7 @@ pub type LigCaretList<'a> = TableRef<'a, LigCaretListMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> LigCaretList<'a> { /// Offset to Coverage table - from beginning of LigCaretList table + #[inline] pub fn coverage_offset(&self) -> Offset16 { let range = self.shape.coverage_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -545,6 +562,7 @@ impl<'a> LigCaretList<'a> { } /// Number of ligature glyphs + #[inline] pub fn lig_glyph_count(&self) -> u16 { let range = self.shape.lig_glyph_count_byte_range(); self.data.read_at(range.start).unwrap() @@ -552,6 +570,7 @@ impl<'a> LigCaretList<'a> { /// Array of offsets to LigGlyph tables, from beginning of /// LigCaretList table —in Coverage Index order + #[inline] pub fn lig_glyph_offsets(&self) -> &'a [BigEndian] { let range = self.shape.lig_glyph_offsets_byte_range(); self.data.read_array(range).unwrap() @@ -630,6 +649,7 @@ impl MinByteRange for LigGlyphMarker { } impl<'a> FontRead<'a> for LigGlyph<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let caret_count: u16 = cursor.read()?; @@ -649,6 +669,7 @@ pub type LigGlyph<'a> = TableRef<'a, LigGlyphMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> LigGlyph<'a> { /// Number of CaretValue tables for this ligature (components - 1) + #[inline] pub fn caret_count(&self) -> u16 { let range = self.shape.caret_count_byte_range(); self.data.read_at(range.start).unwrap() @@ -656,6 +677,7 @@ impl<'a> LigGlyph<'a> { /// Array of offsets to CaretValue tables, from beginning of /// LigGlyph table — in increasing coordinate order + #[inline] pub fn caret_value_offsets(&self) -> &'a [BigEndian] { let range = self.shape.caret_value_offsets_byte_range(); self.data.read_array(range).unwrap() @@ -810,6 +832,7 @@ impl MinByteRange for CaretValueFormat1Marker { } impl<'a> FontRead<'a> for CaretValueFormat1<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -824,12 +847,14 @@ pub type CaretValueFormat1<'a> = TableRef<'a, CaretValueFormat1Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> CaretValueFormat1<'a> { /// Format identifier: format = 1 + #[inline] pub fn caret_value_format(&self) -> u16 { let range = self.shape.caret_value_format_byte_range(); self.data.read_at(range.start).unwrap() } /// X or Y value, in design units + #[inline] pub fn coordinate(&self) -> i16 { let range = self.shape.coordinate_byte_range(); self.data.read_at(range.start).unwrap() @@ -886,6 +911,7 @@ impl MinByteRange for CaretValueFormat2Marker { } impl<'a> FontRead<'a> for CaretValueFormat2<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -900,12 +926,14 @@ pub type CaretValueFormat2<'a> = TableRef<'a, CaretValueFormat2Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> CaretValueFormat2<'a> { /// Format identifier: format = 2 + #[inline] pub fn caret_value_format(&self) -> u16 { let range = self.shape.caret_value_format_byte_range(); self.data.read_at(range.start).unwrap() } /// Contour point index on glyph + #[inline] pub fn caret_value_point_index(&self) -> u16 { let range = self.shape.caret_value_point_index_byte_range(); self.data.read_at(range.start).unwrap() @@ -970,6 +998,7 @@ impl MinByteRange for CaretValueFormat3Marker { } impl<'a> FontRead<'a> for CaretValueFormat3<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -985,12 +1014,14 @@ pub type CaretValueFormat3<'a> = TableRef<'a, CaretValueFormat3Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> CaretValueFormat3<'a> { /// Format identifier-format = 3 + #[inline] pub fn caret_value_format(&self) -> u16 { let range = self.shape.caret_value_format_byte_range(); self.data.read_at(range.start).unwrap() } /// X or Y value, in design units + #[inline] pub fn coordinate(&self) -> i16 { let range = self.shape.coordinate_byte_range(); self.data.read_at(range.start).unwrap() @@ -999,6 +1030,7 @@ impl<'a> CaretValueFormat3<'a> { /// Offset to Device table (non-variable font) / Variation Index /// table (variable font) for X or Y value-from beginning of /// CaretValue table + #[inline] pub fn device_offset(&self) -> Offset16 { let range = self.shape.device_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -1072,6 +1104,7 @@ impl MinByteRange for MarkGlyphSetsMarker { } impl<'a> FontRead<'a> for MarkGlyphSets<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -1092,12 +1125,14 @@ pub type MarkGlyphSets<'a> = TableRef<'a, MarkGlyphSetsMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> MarkGlyphSets<'a> { /// Format identifier == 1 + #[inline] pub fn format(&self) -> u16 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of mark glyph sets defined + #[inline] pub fn mark_glyph_set_count(&self) -> u16 { let range = self.shape.mark_glyph_set_count_byte_range(); self.data.read_at(range.start).unwrap() @@ -1105,6 +1140,7 @@ impl<'a> MarkGlyphSets<'a> { /// Array of offsets to mark glyph set coverage tables, from the /// start of the MarkGlyphSets table. + #[inline] pub fn coverage_offsets(&self) -> &'a [BigEndian] { let range = self.shape.coverage_offsets_byte_range(); self.data.read_array(range).unwrap() diff --git a/read-fonts/generated/generated_glyf.rs b/read-fonts/generated/generated_glyf.rs index 4015b6bc6..1766f8e78 100644 --- a/read-fonts/generated/generated_glyf.rs +++ b/read-fonts/generated/generated_glyf.rs @@ -18,6 +18,7 @@ impl TopLevelTable for Glyf<'_> { } impl<'a> FontRead<'a> for Glyf<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let cursor = data.cursor(); cursor.finish(GlyfMarker {}) @@ -116,6 +117,7 @@ impl MinByteRange for SimpleGlyphMarker { } impl<'a> FontRead<'a> for SimpleGlyph<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let number_of_contours: i16 = cursor.read()?; @@ -150,30 +152,35 @@ impl<'a> SimpleGlyph<'a> { /// If the number of contours is greater than or equal to zero, /// this is a simple glyph. If negative, this is a composite glyph /// — the value -1 should be used for composite glyphs. + #[inline] pub fn number_of_contours(&self) -> i16 { let range = self.shape.number_of_contours_byte_range(); self.data.read_at(range.start).unwrap() } /// Minimum x for coordinate data. + #[inline] pub fn x_min(&self) -> i16 { let range = self.shape.x_min_byte_range(); self.data.read_at(range.start).unwrap() } /// Minimum y for coordinate data. + #[inline] pub fn y_min(&self) -> i16 { let range = self.shape.y_min_byte_range(); self.data.read_at(range.start).unwrap() } /// Maximum x for coordinate data. + #[inline] pub fn x_max(&self) -> i16 { let range = self.shape.x_max_byte_range(); self.data.read_at(range.start).unwrap() } /// Maximum y for coordinate data. + #[inline] pub fn y_max(&self) -> i16 { let range = self.shape.y_max_byte_range(); self.data.read_at(range.start).unwrap() @@ -181,6 +188,7 @@ impl<'a> SimpleGlyph<'a> { /// Array of point indices for the last point of each contour, /// in increasing numeric order + #[inline] pub fn end_pts_of_contours(&self) -> &'a [BigEndian] { let range = self.shape.end_pts_of_contours_byte_range(); self.data.read_array(range).unwrap() @@ -189,18 +197,21 @@ impl<'a> SimpleGlyph<'a> { /// Total number of bytes for instructions. If instructionLength is /// zero, no instructions are present for this glyph, and this /// field is followed directly by the flags field. + #[inline] pub fn instruction_length(&self) -> u16 { let range = self.shape.instruction_length_byte_range(); self.data.read_at(range.start).unwrap() } /// Array of instruction byte code for the glyph. + #[inline] pub fn instructions(&self) -> &'a [u8] { let range = self.shape.instructions_byte_range(); self.data.read_array(range).unwrap() } /// the raw data for flags & x/y coordinates + #[inline] pub fn glyph_data(&self) -> &'a [u8] { let range = self.shape.glyph_data_byte_range(); self.data.read_array(range).unwrap() @@ -683,6 +694,7 @@ impl MinByteRange for CompositeGlyphMarker { } impl<'a> FontRead<'a> for CompositeGlyph<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -707,30 +719,35 @@ impl<'a> CompositeGlyph<'a> { /// If the number of contours is greater than or equal to zero, /// this is a simple glyph. If negative, this is a composite glyph /// — the value -1 should be used for composite glyphs. + #[inline] pub fn number_of_contours(&self) -> i16 { let range = self.shape.number_of_contours_byte_range(); self.data.read_at(range.start).unwrap() } /// Minimum x for coordinate data. + #[inline] pub fn x_min(&self) -> i16 { let range = self.shape.x_min_byte_range(); self.data.read_at(range.start).unwrap() } /// Minimum y for coordinate data. + #[inline] pub fn y_min(&self) -> i16 { let range = self.shape.y_min_byte_range(); self.data.read_at(range.start).unwrap() } /// Maximum x for coordinate data. + #[inline] pub fn x_max(&self) -> i16 { let range = self.shape.x_max_byte_range(); self.data.read_at(range.start).unwrap() } /// Maximum y for coordinate data. + #[inline] pub fn y_max(&self) -> i16 { let range = self.shape.y_max_byte_range(); self.data.read_at(range.start).unwrap() @@ -738,6 +755,7 @@ impl<'a> CompositeGlyph<'a> { /// component flag /// glyph index of component + #[inline] pub fn component_data(&self) -> &'a [u8] { let range = self.shape.component_data_byte_range(); self.data.read_array(range).unwrap() diff --git a/read-fonts/generated/generated_gpos.rs b/read-fonts/generated/generated_gpos.rs index 477632528..3654135ad 100644 --- a/read-fonts/generated/generated_gpos.rs +++ b/read-fonts/generated/generated_gpos.rs @@ -52,6 +52,7 @@ impl TopLevelTable for Gpos<'_> { } impl<'a> FontRead<'a> for Gpos<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let version: MajorMinor = cursor.read()?; @@ -78,12 +79,14 @@ pub type Gpos<'a> = TableRef<'a, GposMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> Gpos<'a> { /// The major and minor version of the GPOS table, as a tuple (u16, u16) + #[inline] pub fn version(&self) -> MajorMinor { let range = self.shape.version_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset to ScriptList table, from beginning of GPOS table + #[inline] pub fn script_list_offset(&self) -> Offset16 { let range = self.shape.script_list_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -96,6 +99,7 @@ impl<'a> Gpos<'a> { } /// Offset to FeatureList table, from beginning of GPOS table + #[inline] pub fn feature_list_offset(&self) -> Offset16 { let range = self.shape.feature_list_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -108,6 +112,7 @@ impl<'a> Gpos<'a> { } /// Offset to LookupList table, from beginning of GPOS table + #[inline] pub fn lookup_list_offset(&self) -> Offset16 { let range = self.shape.lookup_list_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -119,6 +124,7 @@ impl<'a> Gpos<'a> { self.lookup_list_offset().resolve(data) } + #[inline] pub fn feature_variations_offset(&self) -> Option> { let range = self.shape.feature_variations_offset_byte_range()?; Some(self.data.read_at(range.start).unwrap()) @@ -186,6 +192,7 @@ pub enum PositionLookup<'a> { } impl<'a> FontRead<'a> for PositionLookup<'a> { + #[inline] fn read(bytes: FontData<'a>) -> Result { let untyped = Lookup::read(bytes)?; match untyped.lookup_type() { @@ -730,6 +737,7 @@ impl MinByteRange for AnchorFormat1Marker { } impl<'a> FontRead<'a> for AnchorFormat1<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -745,18 +753,21 @@ pub type AnchorFormat1<'a> = TableRef<'a, AnchorFormat1Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> AnchorFormat1<'a> { /// Format identifier, = 1 + #[inline] pub fn anchor_format(&self) -> u16 { let range = self.shape.anchor_format_byte_range(); self.data.read_at(range.start).unwrap() } /// Horizontal value, in design units + #[inline] pub fn x_coordinate(&self) -> i16 { let range = self.shape.x_coordinate_byte_range(); self.data.read_at(range.start).unwrap() } /// Vertical value, in design units + #[inline] pub fn y_coordinate(&self) -> i16 { let range = self.shape.y_coordinate_byte_range(); self.data.read_at(range.start).unwrap() @@ -824,6 +835,7 @@ impl MinByteRange for AnchorFormat2Marker { } impl<'a> FontRead<'a> for AnchorFormat2<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -840,24 +852,28 @@ pub type AnchorFormat2<'a> = TableRef<'a, AnchorFormat2Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> AnchorFormat2<'a> { /// Format identifier, = 2 + #[inline] pub fn anchor_format(&self) -> u16 { let range = self.shape.anchor_format_byte_range(); self.data.read_at(range.start).unwrap() } /// Horizontal value, in design units + #[inline] pub fn x_coordinate(&self) -> i16 { let range = self.shape.x_coordinate_byte_range(); self.data.read_at(range.start).unwrap() } /// Vertical value, in design units + #[inline] pub fn y_coordinate(&self) -> i16 { let range = self.shape.y_coordinate_byte_range(); self.data.read_at(range.start).unwrap() } /// Index to glyph contour point + #[inline] pub fn anchor_point(&self) -> u16 { let range = self.shape.anchor_point_byte_range(); self.data.read_at(range.start).unwrap() @@ -931,6 +947,7 @@ impl MinByteRange for AnchorFormat3Marker { } impl<'a> FontRead<'a> for AnchorFormat3<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -948,18 +965,21 @@ pub type AnchorFormat3<'a> = TableRef<'a, AnchorFormat3Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> AnchorFormat3<'a> { /// Format identifier, = 3 + #[inline] pub fn anchor_format(&self) -> u16 { let range = self.shape.anchor_format_byte_range(); self.data.read_at(range.start).unwrap() } /// Horizontal value, in design units + #[inline] pub fn x_coordinate(&self) -> i16 { let range = self.shape.x_coordinate_byte_range(); self.data.read_at(range.start).unwrap() } /// Vertical value, in design units + #[inline] pub fn y_coordinate(&self) -> i16 { let range = self.shape.y_coordinate_byte_range(); self.data.read_at(range.start).unwrap() @@ -968,6 +988,7 @@ impl<'a> AnchorFormat3<'a> { /// Offset to Device table (non-variable font) / VariationIndex /// table (variable font) for X coordinate, from beginning of /// Anchor table (may be NULL) + #[inline] pub fn x_device_offset(&self) -> Nullable { let range = self.shape.x_device_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -982,6 +1003,7 @@ impl<'a> AnchorFormat3<'a> { /// Offset to Device table (non-variable font) / VariationIndex /// table (variable font) for Y coordinate, from beginning of /// Anchor table (may be NULL) + #[inline] pub fn y_device_offset(&self) -> Nullable { let range = self.shape.y_device_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -1051,6 +1073,7 @@ impl MinByteRange for MarkArrayMarker { } impl<'a> FontRead<'a> for MarkArray<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let mark_count: u16 = cursor.read()?; @@ -1070,6 +1093,7 @@ pub type MarkArray<'a> = TableRef<'a, MarkArrayMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> MarkArray<'a> { /// Number of MarkRecords + #[inline] pub fn mark_count(&self) -> u16 { let range = self.shape.mark_count_byte_range(); self.data.read_at(range.start).unwrap() @@ -1077,6 +1101,7 @@ impl<'a> MarkArray<'a> { /// Array of MarkRecords, ordered by corresponding glyphs in the /// associated mark Coverage table. + #[inline] pub fn mark_records(&self) -> &'a [MarkRecord] { let range = self.shape.mark_records_byte_range(); self.data.read_array(range).unwrap() @@ -1125,11 +1150,13 @@ pub struct MarkRecord { impl MarkRecord { /// Class defined for the associated mark. + #[inline] pub fn mark_class(&self) -> u16 { self.mark_class.get() } /// Offset to Anchor table, from beginning of MarkArray table. + #[inline] pub fn mark_anchor_offset(&self) -> Offset16 { self.mark_anchor_offset.get() } @@ -1293,6 +1320,7 @@ impl MinByteRange for SinglePosFormat1Marker { } impl<'a> FontRead<'a> for SinglePosFormat1<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -1312,12 +1340,14 @@ pub type SinglePosFormat1<'a> = TableRef<'a, SinglePosFormat1Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> SinglePosFormat1<'a> { /// Format identifier: format = 1 + #[inline] pub fn pos_format(&self) -> u16 { let range = self.shape.pos_format_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset to Coverage table, from beginning of SinglePos subtable. + #[inline] pub fn coverage_offset(&self) -> Offset16 { let range = self.shape.coverage_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -1330,6 +1360,7 @@ impl<'a> SinglePosFormat1<'a> { } /// Defines the types of data in the ValueRecord. + #[inline] pub fn value_format(&self) -> ValueFormat { let range = self.shape.value_format_byte_range(); self.data.read_at(range.start).unwrap() @@ -1337,6 +1368,7 @@ impl<'a> SinglePosFormat1<'a> { /// Defines positioning value(s) — applied to all glyphs in the /// Coverage table. + #[inline] pub fn value_record(&self) -> ValueRecord { let range = self.shape.value_record_byte_range(); self.data @@ -1420,6 +1452,7 @@ impl MinByteRange for SinglePosFormat2Marker { } impl<'a> FontRead<'a> for SinglePosFormat2<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -1442,12 +1475,14 @@ pub type SinglePosFormat2<'a> = TableRef<'a, SinglePosFormat2Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> SinglePosFormat2<'a> { /// Format identifier: format = 2 + #[inline] pub fn pos_format(&self) -> u16 { let range = self.shape.pos_format_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset to Coverage table, from beginning of SinglePos subtable. + #[inline] pub fn coverage_offset(&self) -> Offset16 { let range = self.shape.coverage_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -1460,6 +1495,7 @@ impl<'a> SinglePosFormat2<'a> { } /// Defines the types of data in the ValueRecords. + #[inline] pub fn value_format(&self) -> ValueFormat { let range = self.shape.value_format_byte_range(); self.data.read_at(range.start).unwrap() @@ -1467,12 +1503,14 @@ impl<'a> SinglePosFormat2<'a> { /// Number of ValueRecords — must equal glyphCount in the /// Coverage table. + #[inline] pub fn value_count(&self) -> u16 { let range = self.shape.value_count_byte_range(); self.data.read_at(range.start).unwrap() } /// Array of ValueRecords — positioning values applied to glyphs. + #[inline] pub fn value_records(&self) -> ComputedArray<'a, ValueRecord> { let range = self.shape.value_records_byte_range(); self.data @@ -1664,6 +1702,7 @@ impl MinByteRange for PairPosFormat1Marker { } impl<'a> FontRead<'a> for PairPosFormat1<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -1687,12 +1726,14 @@ pub type PairPosFormat1<'a> = TableRef<'a, PairPosFormat1Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> PairPosFormat1<'a> { /// Format identifier: format = 1 + #[inline] pub fn pos_format(&self) -> u16 { let range = self.shape.pos_format_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset to Coverage table, from beginning of PairPos subtable. + #[inline] pub fn coverage_offset(&self) -> Offset16 { let range = self.shape.coverage_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -1706,6 +1747,7 @@ impl<'a> PairPosFormat1<'a> { /// Defines the types of data in valueRecord1 — for the first /// glyph in the pair (may be zero). + #[inline] pub fn value_format1(&self) -> ValueFormat { let range = self.shape.value_format1_byte_range(); self.data.read_at(range.start).unwrap() @@ -1713,12 +1755,14 @@ impl<'a> PairPosFormat1<'a> { /// Defines the types of data in valueRecord2 — for the second /// glyph in the pair (may be zero). + #[inline] pub fn value_format2(&self) -> ValueFormat { let range = self.shape.value_format2_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of PairSet tables + #[inline] pub fn pair_set_count(&self) -> u16 { let range = self.shape.pair_set_count_byte_range(); self.data.read_at(range.start).unwrap() @@ -1726,6 +1770,7 @@ impl<'a> PairPosFormat1<'a> { /// Array of offsets to PairSet tables. Offsets are from beginning /// of PairPos subtable, ordered by Coverage Index. + #[inline] pub fn pair_set_offsets(&self) -> &'a [BigEndian] { let range = self.shape.pair_set_offsets_byte_range(); self.data.read_array(range).unwrap() @@ -1815,6 +1860,7 @@ impl ReadArgs for PairSet<'_> { } impl<'a> FontReadWithArgs<'a> for PairSet<'a> { + #[inline] fn read_with_args( data: FontData<'a>, args: &(ValueFormat, ValueFormat), @@ -1842,6 +1888,7 @@ impl<'a> PairSet<'a> { /// /// This type requires some external state in order to be /// parsed. + #[inline] pub fn read( data: FontData<'a>, value_format1: ValueFormat, @@ -1858,6 +1905,7 @@ pub type PairSet<'a> = TableRef<'a, PairSetMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> PairSet<'a> { /// Number of PairValueRecords + #[inline] pub fn pair_value_count(&self) -> u16 { let range = self.shape.pair_value_count_byte_range(); self.data.read_at(range.start).unwrap() @@ -1865,6 +1913,7 @@ impl<'a> PairSet<'a> { /// Array of PairValueRecords, ordered by glyph ID of the second /// glyph. + #[inline] pub fn pair_value_records(&self) -> ComputedArray<'a, PairValueRecord> { let range = self.shape.pair_value_records_byte_range(); self.data @@ -1925,16 +1974,19 @@ pub struct PairValueRecord { impl PairValueRecord { /// Glyph ID of second glyph in the pair (first glyph is listed in /// the Coverage table). + #[inline] pub fn second_glyph(&self) -> GlyphId16 { self.second_glyph.get() } /// Positioning data for the first glyph in the pair. + #[inline] pub fn value_record1(&self) -> &ValueRecord { &self.value_record1 } /// Positioning data for the second glyph in the pair. + #[inline] pub fn value_record2(&self) -> &ValueRecord { &self.value_record2 } @@ -2080,6 +2132,7 @@ impl MinByteRange for PairPosFormat2Marker { } impl<'a> FontRead<'a> for PairPosFormat2<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -2110,12 +2163,14 @@ pub type PairPosFormat2<'a> = TableRef<'a, PairPosFormat2Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> PairPosFormat2<'a> { /// Format identifier: format = 2 + #[inline] pub fn pos_format(&self) -> u16 { let range = self.shape.pos_format_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset to Coverage table, from beginning of PairPos subtable. + #[inline] pub fn coverage_offset(&self) -> Offset16 { let range = self.shape.coverage_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -2129,6 +2184,7 @@ impl<'a> PairPosFormat2<'a> { /// ValueRecord definition — for the first glyph of the pair (may /// be zero). + #[inline] pub fn value_format1(&self) -> ValueFormat { let range = self.shape.value_format1_byte_range(); self.data.read_at(range.start).unwrap() @@ -2136,6 +2192,7 @@ impl<'a> PairPosFormat2<'a> { /// ValueRecord definition — for the second glyph of the pair /// (may be zero). + #[inline] pub fn value_format2(&self) -> ValueFormat { let range = self.shape.value_format2_byte_range(); self.data.read_at(range.start).unwrap() @@ -2143,6 +2200,7 @@ impl<'a> PairPosFormat2<'a> { /// Offset to ClassDef table, from beginning of PairPos subtable /// — for the first glyph of the pair. + #[inline] pub fn class_def1_offset(&self) -> Offset16 { let range = self.shape.class_def1_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -2156,6 +2214,7 @@ impl<'a> PairPosFormat2<'a> { /// Offset to ClassDef table, from beginning of PairPos subtable /// — for the second glyph of the pair. + #[inline] pub fn class_def2_offset(&self) -> Offset16 { let range = self.shape.class_def2_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -2168,18 +2227,21 @@ impl<'a> PairPosFormat2<'a> { } /// Number of classes in classDef1 table — includes Class 0. + #[inline] pub fn class1_count(&self) -> u16 { let range = self.shape.class1_count_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of classes in classDef2 table — includes Class 0. + #[inline] pub fn class2_count(&self) -> u16 { let range = self.shape.class2_count_byte_range(); self.data.read_at(range.start).unwrap() } /// Array of Class1 records, ordered by classes in classDef1. + #[inline] pub fn class1_records(&self) -> ComputedArray<'a, Class1Record<'a>> { let range = self.shape.class1_records_byte_range(); self.data @@ -2249,6 +2311,7 @@ pub struct Class1Record<'a> { impl<'a> Class1Record<'a> { /// Array of Class2 records, ordered by classes in classDef2. + #[inline] pub fn class2_records(&self) -> &ComputedArray<'a, Class2Record> { &self.class2_records } @@ -2334,11 +2397,13 @@ pub struct Class2Record { impl Class2Record { /// Positioning for first glyph — empty if valueFormat1 = 0. + #[inline] pub fn value_record1(&self) -> &ValueRecord { &self.value_record1 } /// Positioning for second glyph — empty if valueFormat2 = 0. + #[inline] pub fn value_record2(&self) -> &ValueRecord { &self.value_record2 } @@ -2454,6 +2519,7 @@ impl MinByteRange for CursivePosFormat1Marker { } impl<'a> FontRead<'a> for CursivePosFormat1<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -2475,12 +2541,14 @@ pub type CursivePosFormat1<'a> = TableRef<'a, CursivePosFormat1Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> CursivePosFormat1<'a> { /// Format identifier: format = 1 + #[inline] pub fn pos_format(&self) -> u16 { let range = self.shape.pos_format_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset to Coverage table, from beginning of CursivePos subtable. + #[inline] pub fn coverage_offset(&self) -> Offset16 { let range = self.shape.coverage_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -2493,12 +2561,14 @@ impl<'a> CursivePosFormat1<'a> { } /// Number of EntryExit records + #[inline] pub fn entry_exit_count(&self) -> u16 { let range = self.shape.entry_exit_count_byte_range(); self.data.read_at(range.start).unwrap() } /// Array of EntryExit records, in Coverage index order. + #[inline] pub fn entry_exit_record(&self) -> &'a [EntryExitRecord] { let range = self.shape.entry_exit_record_byte_range(); self.data.read_array(range).unwrap() @@ -2555,6 +2625,7 @@ pub struct EntryExitRecord { impl EntryExitRecord { /// Offset to entryAnchor table, from beginning of CursivePos /// subtable (may be NULL). + #[inline] pub fn entry_anchor_offset(&self) -> Nullable { self.entry_anchor_offset.get() } @@ -2573,6 +2644,7 @@ impl EntryExitRecord { /// Offset to exitAnchor table, from beginning of CursivePos /// subtable (may be NULL). + #[inline] pub fn exit_anchor_offset(&self) -> Nullable { self.exit_anchor_offset.get() } @@ -2663,6 +2735,7 @@ impl MinByteRange for MarkBasePosFormat1Marker { } impl<'a> FontRead<'a> for MarkBasePosFormat1<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -2681,6 +2754,7 @@ pub type MarkBasePosFormat1<'a> = TableRef<'a, MarkBasePosFormat1Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> MarkBasePosFormat1<'a> { /// Format identifier: format = 1 + #[inline] pub fn pos_format(&self) -> u16 { let range = self.shape.pos_format_byte_range(); self.data.read_at(range.start).unwrap() @@ -2688,6 +2762,7 @@ impl<'a> MarkBasePosFormat1<'a> { /// Offset to markCoverage table, from beginning of MarkBasePos /// subtable. + #[inline] pub fn mark_coverage_offset(&self) -> Offset16 { let range = self.shape.mark_coverage_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -2701,6 +2776,7 @@ impl<'a> MarkBasePosFormat1<'a> { /// Offset to baseCoverage table, from beginning of MarkBasePos /// subtable. + #[inline] pub fn base_coverage_offset(&self) -> Offset16 { let range = self.shape.base_coverage_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -2713,6 +2789,7 @@ impl<'a> MarkBasePosFormat1<'a> { } /// Number of classes defined for marks + #[inline] pub fn mark_class_count(&self) -> u16 { let range = self.shape.mark_class_count_byte_range(); self.data.read_at(range.start).unwrap() @@ -2720,6 +2797,7 @@ impl<'a> MarkBasePosFormat1<'a> { /// Offset to MarkArray table, from beginning of MarkBasePos /// subtable. + #[inline] pub fn mark_array_offset(&self) -> Offset16 { let range = self.shape.mark_array_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -2733,6 +2811,7 @@ impl<'a> MarkBasePosFormat1<'a> { /// Offset to BaseArray table, from beginning of MarkBasePos /// subtable. + #[inline] pub fn base_array_offset(&self) -> Offset16 { let range = self.shape.base_array_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -2815,6 +2894,7 @@ impl ReadArgs for BaseArray<'_> { } impl<'a> FontReadWithArgs<'a> for BaseArray<'a> { + #[inline] fn read_with_args(data: FontData<'a>, args: &u16) -> Result { let mark_class_count = *args; let mut cursor = data.cursor(); @@ -2837,6 +2917,7 @@ impl<'a> BaseArray<'a> { /// /// This type requires some external state in order to be /// parsed. + #[inline] pub fn read(data: FontData<'a>, mark_class_count: u16) -> Result { let args = mark_class_count; Self::read_with_args(data, &args) @@ -2849,12 +2930,14 @@ pub type BaseArray<'a> = TableRef<'a, BaseArrayMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> BaseArray<'a> { /// Number of BaseRecords + #[inline] pub fn base_count(&self) -> u16 { let range = self.shape.base_count_byte_range(); self.data.read_at(range.start).unwrap() } /// Array of BaseRecords, in order of baseCoverage Index. + #[inline] pub fn base_records(&self) -> ComputedArray<'a, BaseRecord<'a>> { let range = self.shape.base_records_byte_range(); self.data @@ -2909,6 +2992,7 @@ impl<'a> BaseRecord<'a> { /// Array of offsets (one per mark class) to Anchor tables. Offsets /// are from beginning of BaseArray table, ordered by class /// (offsets may be NULL). + #[inline] pub fn base_anchor_offsets(&self) -> &'a [BigEndian>] { self.base_anchor_offsets } @@ -3038,6 +3122,7 @@ impl MinByteRange for MarkLigPosFormat1Marker { } impl<'a> FontRead<'a> for MarkLigPosFormat1<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -3056,6 +3141,7 @@ pub type MarkLigPosFormat1<'a> = TableRef<'a, MarkLigPosFormat1Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> MarkLigPosFormat1<'a> { /// Format identifier: format = 1 + #[inline] pub fn pos_format(&self) -> u16 { let range = self.shape.pos_format_byte_range(); self.data.read_at(range.start).unwrap() @@ -3063,6 +3149,7 @@ impl<'a> MarkLigPosFormat1<'a> { /// Offset to markCoverage table, from beginning of MarkLigPos /// subtable. + #[inline] pub fn mark_coverage_offset(&self) -> Offset16 { let range = self.shape.mark_coverage_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -3076,6 +3163,7 @@ impl<'a> MarkLigPosFormat1<'a> { /// Offset to ligatureCoverage table, from beginning of MarkLigPos /// subtable. + #[inline] pub fn ligature_coverage_offset(&self) -> Offset16 { let range = self.shape.ligature_coverage_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -3088,6 +3176,7 @@ impl<'a> MarkLigPosFormat1<'a> { } /// Number of defined mark classes + #[inline] pub fn mark_class_count(&self) -> u16 { let range = self.shape.mark_class_count_byte_range(); self.data.read_at(range.start).unwrap() @@ -3095,6 +3184,7 @@ impl<'a> MarkLigPosFormat1<'a> { /// Offset to MarkArray table, from beginning of MarkLigPos /// subtable. + #[inline] pub fn mark_array_offset(&self) -> Offset16 { let range = self.shape.mark_array_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -3108,6 +3198,7 @@ impl<'a> MarkLigPosFormat1<'a> { /// Offset to LigatureArray table, from beginning of MarkLigPos /// subtable. + #[inline] pub fn ligature_array_offset(&self) -> Offset16 { let range = self.shape.ligature_array_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -3190,6 +3281,7 @@ impl ReadArgs for LigatureArray<'_> { } impl<'a> FontReadWithArgs<'a> for LigatureArray<'a> { + #[inline] fn read_with_args(data: FontData<'a>, args: &u16) -> Result { let mark_class_count = *args; let mut cursor = data.cursor(); @@ -3210,6 +3302,7 @@ impl<'a> LigatureArray<'a> { /// /// This type requires some external state in order to be /// parsed. + #[inline] pub fn read(data: FontData<'a>, mark_class_count: u16) -> Result { let args = mark_class_count; Self::read_with_args(data, &args) @@ -3222,6 +3315,7 @@ pub type LigatureArray<'a> = TableRef<'a, LigatureArrayMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> LigatureArray<'a> { /// Number of LigatureAttach table offsets + #[inline] pub fn ligature_count(&self) -> u16 { let range = self.shape.ligature_count_byte_range(); self.data.read_at(range.start).unwrap() @@ -3230,6 +3324,7 @@ impl<'a> LigatureArray<'a> { /// Array of offsets to LigatureAttach tables. Offsets are from /// beginning of LigatureArray table, ordered by ligatureCoverage /// index. + #[inline] pub fn ligature_attach_offsets(&self) -> &'a [BigEndian] { let range = self.shape.ligature_attach_offsets_byte_range(); self.data.read_array(range).unwrap() @@ -3315,6 +3410,7 @@ impl ReadArgs for LigatureAttach<'_> { } impl<'a> FontReadWithArgs<'a> for LigatureAttach<'a> { + #[inline] fn read_with_args(data: FontData<'a>, args: &u16) -> Result { let mark_class_count = *args; let mut cursor = data.cursor(); @@ -3337,6 +3433,7 @@ impl<'a> LigatureAttach<'a> { /// /// This type requires some external state in order to be /// parsed. + #[inline] pub fn read(data: FontData<'a>, mark_class_count: u16) -> Result { let args = mark_class_count; Self::read_with_args(data, &args) @@ -3349,12 +3446,14 @@ pub type LigatureAttach<'a> = TableRef<'a, LigatureAttachMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> LigatureAttach<'a> { /// Number of ComponentRecords in this ligature + #[inline] pub fn component_count(&self) -> u16 { let range = self.shape.component_count_byte_range(); self.data.read_at(range.start).unwrap() } /// Array of Component records, ordered in writing direction. + #[inline] pub fn component_records(&self) -> ComputedArray<'a, ComponentRecord<'a>> { let range = self.shape.component_records_byte_range(); self.data @@ -3409,6 +3508,7 @@ impl<'a> ComponentRecord<'a> { /// Array of offsets (one per class) to Anchor tables. Offsets are /// from beginning of LigatureAttach table, ordered by class /// (offsets may be NULL). + #[inline] pub fn ligature_anchor_offsets(&self) -> &'a [BigEndian>] { self.ligature_anchor_offsets } @@ -3538,6 +3638,7 @@ impl MinByteRange for MarkMarkPosFormat1Marker { } impl<'a> FontRead<'a> for MarkMarkPosFormat1<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -3556,6 +3657,7 @@ pub type MarkMarkPosFormat1<'a> = TableRef<'a, MarkMarkPosFormat1Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> MarkMarkPosFormat1<'a> { /// Format identifier: format = 1 + #[inline] pub fn pos_format(&self) -> u16 { let range = self.shape.pos_format_byte_range(); self.data.read_at(range.start).unwrap() @@ -3563,6 +3665,7 @@ impl<'a> MarkMarkPosFormat1<'a> { /// Offset to Combining Mark Coverage table, from beginning of /// MarkMarkPos subtable. + #[inline] pub fn mark1_coverage_offset(&self) -> Offset16 { let range = self.shape.mark1_coverage_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -3576,6 +3679,7 @@ impl<'a> MarkMarkPosFormat1<'a> { /// Offset to Base Mark Coverage table, from beginning of /// MarkMarkPos subtable. + #[inline] pub fn mark2_coverage_offset(&self) -> Offset16 { let range = self.shape.mark2_coverage_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -3588,6 +3692,7 @@ impl<'a> MarkMarkPosFormat1<'a> { } /// Number of Combining Mark classes defined + #[inline] pub fn mark_class_count(&self) -> u16 { let range = self.shape.mark_class_count_byte_range(); self.data.read_at(range.start).unwrap() @@ -3595,6 +3700,7 @@ impl<'a> MarkMarkPosFormat1<'a> { /// Offset to MarkArray table for mark1, from beginning of /// MarkMarkPos subtable. + #[inline] pub fn mark1_array_offset(&self) -> Offset16 { let range = self.shape.mark1_array_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -3608,6 +3714,7 @@ impl<'a> MarkMarkPosFormat1<'a> { /// Offset to Mark2Array table for mark2, from beginning of /// MarkMarkPos subtable. + #[inline] pub fn mark2_array_offset(&self) -> Offset16 { let range = self.shape.mark2_array_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -3690,6 +3797,7 @@ impl ReadArgs for Mark2Array<'_> { } impl<'a> FontReadWithArgs<'a> for Mark2Array<'a> { + #[inline] fn read_with_args(data: FontData<'a>, args: &u16) -> Result { let mark_class_count = *args; let mut cursor = data.cursor(); @@ -3712,6 +3820,7 @@ impl<'a> Mark2Array<'a> { /// /// This type requires some external state in order to be /// parsed. + #[inline] pub fn read(data: FontData<'a>, mark_class_count: u16) -> Result { let args = mark_class_count; Self::read_with_args(data, &args) @@ -3724,12 +3833,14 @@ pub type Mark2Array<'a> = TableRef<'a, Mark2ArrayMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> Mark2Array<'a> { /// Number of Mark2 records + #[inline] pub fn mark2_count(&self) -> u16 { let range = self.shape.mark2_count_byte_range(); self.data.read_at(range.start).unwrap() } /// Array of Mark2Records, in Coverage order. + #[inline] pub fn mark2_records(&self) -> ComputedArray<'a, Mark2Record<'a>> { let range = self.shape.mark2_records_byte_range(); self.data @@ -3784,6 +3895,7 @@ impl<'a> Mark2Record<'a> { /// Array of offsets (one per class) to Anchor tables. Offsets are /// from beginning of Mark2Array table, in class order (offsets may /// be NULL). + #[inline] pub fn mark2_anchor_offsets(&self) -> &'a [BigEndian>] { self.mark2_anchor_offsets } @@ -3908,6 +4020,7 @@ impl Clone for ExtensionPosFormat1Marker { impl Copy for ExtensionPosFormat1Marker {} impl<'a, T> FontRead<'a> for ExtensionPosFormat1<'a, T> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -3952,6 +4065,7 @@ pub type ExtensionPosFormat1<'a, T> = TableRef<'a, ExtensionPosFormat1Marker> #[allow(clippy::needless_lifetimes)] impl<'a, T> ExtensionPosFormat1<'a, T> { /// Format identifier: format = 1 + #[inline] pub fn pos_format(&self) -> u16 { let range = self.shape.pos_format_byte_range(); self.data.read_at(range.start).unwrap() @@ -3959,6 +4073,7 @@ impl<'a, T> ExtensionPosFormat1<'a, T> { /// Lookup type of subtable referenced by extensionOffset (i.e. the /// extension subtable). + #[inline] pub fn extension_lookup_type(&self) -> u16 { let range = self.shape.extension_lookup_type_byte_range(); self.data.read_at(range.start).unwrap() @@ -3967,6 +4082,7 @@ impl<'a, T> ExtensionPosFormat1<'a, T> { /// Offset to the extension subtable, of lookup type /// extensionLookupType, relative to the start of the /// ExtensionPosFormat1 subtable. + #[inline] pub fn extension_offset(&self) -> Offset32 { let range = self.shape.extension_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -4024,6 +4140,7 @@ pub enum ExtensionSubtable<'a> { } impl<'a> FontRead<'a> for ExtensionSubtable<'a> { + #[inline] fn read(bytes: FontData<'a>) -> Result { let untyped = ExtensionPosFormat1::read(bytes)?; match untyped.extension_lookup_type() { diff --git a/read-fonts/generated/generated_gsub.rs b/read-fonts/generated/generated_gsub.rs index a6d0eafa0..16b8b1c78 100644 --- a/read-fonts/generated/generated_gsub.rs +++ b/read-fonts/generated/generated_gsub.rs @@ -51,6 +51,7 @@ impl TopLevelTable for Gsub<'_> { } impl<'a> FontRead<'a> for Gsub<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let version: MajorMinor = cursor.read()?; @@ -76,12 +77,14 @@ pub type Gsub<'a> = TableRef<'a, GsubMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> Gsub<'a> { /// The major and minor version of the GSUB table, as a tuple (u16, u16) + #[inline] pub fn version(&self) -> MajorMinor { let range = self.shape.version_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset to ScriptList table, from beginning of GSUB table + #[inline] pub fn script_list_offset(&self) -> Offset16 { let range = self.shape.script_list_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -94,6 +97,7 @@ impl<'a> Gsub<'a> { } /// Offset to FeatureList table, from beginning of GSUB table + #[inline] pub fn feature_list_offset(&self) -> Offset16 { let range = self.shape.feature_list_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -106,6 +110,7 @@ impl<'a> Gsub<'a> { } /// Offset to LookupList table, from beginning of GSUB table + #[inline] pub fn lookup_list_offset(&self) -> Offset16 { let range = self.shape.lookup_list_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -119,6 +124,7 @@ impl<'a> Gsub<'a> { /// Offset to FeatureVariations table, from beginning of the GSUB /// table (may be NULL) + #[inline] pub fn feature_variations_offset(&self) -> Option> { let range = self.shape.feature_variations_offset_byte_range()?; Some(self.data.read_at(range.start).unwrap()) @@ -185,6 +191,7 @@ pub enum SubstitutionLookup<'a> { } impl<'a> FontRead<'a> for SubstitutionLookup<'a> { + #[inline] fn read(bytes: FontData<'a>) -> Result { let untyped = Lookup::read(bytes)?; match untyped.lookup_type() { @@ -367,6 +374,7 @@ impl MinByteRange for SingleSubstFormat1Marker { } impl<'a> FontRead<'a> for SingleSubstFormat1<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -382,6 +390,7 @@ pub type SingleSubstFormat1<'a> = TableRef<'a, SingleSubstFormat1Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> SingleSubstFormat1<'a> { /// Format identifier: format = 1 + #[inline] pub fn subst_format(&self) -> u16 { let range = self.shape.subst_format_byte_range(); self.data.read_at(range.start).unwrap() @@ -389,6 +398,7 @@ impl<'a> SingleSubstFormat1<'a> { /// Offset to Coverage table, from beginning of substitution /// subtable + #[inline] pub fn coverage_offset(&self) -> Offset16 { let range = self.shape.coverage_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -401,6 +411,7 @@ impl<'a> SingleSubstFormat1<'a> { } /// Add to original glyph ID to get substitute glyph ID + #[inline] pub fn delta_glyph_id(&self) -> i16 { let range = self.shape.delta_glyph_id_byte_range(); self.data.read_at(range.start).unwrap() @@ -473,6 +484,7 @@ impl MinByteRange for SingleSubstFormat2Marker { } impl<'a> FontRead<'a> for SingleSubstFormat2<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -494,6 +506,7 @@ pub type SingleSubstFormat2<'a> = TableRef<'a, SingleSubstFormat2Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> SingleSubstFormat2<'a> { /// Format identifier: format = 2 + #[inline] pub fn subst_format(&self) -> u16 { let range = self.shape.subst_format_byte_range(); self.data.read_at(range.start).unwrap() @@ -501,6 +514,7 @@ impl<'a> SingleSubstFormat2<'a> { /// Offset to Coverage table, from beginning of substitution /// subtable + #[inline] pub fn coverage_offset(&self) -> Offset16 { let range = self.shape.coverage_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -513,12 +527,14 @@ impl<'a> SingleSubstFormat2<'a> { } /// Number of glyph IDs in the substituteGlyphIDs array + #[inline] pub fn glyph_count(&self) -> u16 { let range = self.shape.glyph_count_byte_range(); self.data.read_at(range.start).unwrap() } /// Array of substitute glyph IDs — ordered by Coverage index + #[inline] pub fn substitute_glyph_ids(&self) -> &'a [BigEndian] { let range = self.shape.substitute_glyph_ids_byte_range(); self.data.read_array(range).unwrap() @@ -595,6 +611,7 @@ impl MinByteRange for MultipleSubstFormat1Marker { } impl<'a> FontRead<'a> for MultipleSubstFormat1<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -616,6 +633,7 @@ pub type MultipleSubstFormat1<'a> = TableRef<'a, MultipleSubstFormat1Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> MultipleSubstFormat1<'a> { /// Format identifier: format = 1 + #[inline] pub fn subst_format(&self) -> u16 { let range = self.shape.subst_format_byte_range(); self.data.read_at(range.start).unwrap() @@ -623,6 +641,7 @@ impl<'a> MultipleSubstFormat1<'a> { /// Offset to Coverage table, from beginning of substitution /// subtable + #[inline] pub fn coverage_offset(&self) -> Offset16 { let range = self.shape.coverage_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -635,6 +654,7 @@ impl<'a> MultipleSubstFormat1<'a> { } /// Number of Sequence table offsets in the sequenceOffsets array + #[inline] pub fn sequence_count(&self) -> u16 { let range = self.shape.sequence_count_byte_range(); self.data.read_at(range.start).unwrap() @@ -642,6 +662,7 @@ impl<'a> MultipleSubstFormat1<'a> { /// Array of offsets to Sequence tables. Offsets are from beginning /// of substitution subtable, ordered by Coverage index + #[inline] pub fn sequence_offsets(&self) -> &'a [BigEndian] { let range = self.shape.sequence_offsets_byte_range(); self.data.read_array(range).unwrap() @@ -721,6 +742,7 @@ impl MinByteRange for SequenceMarker { } impl<'a> FontRead<'a> for Sequence<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let glyph_count: u16 = cursor.read()?; @@ -741,12 +763,14 @@ pub type Sequence<'a> = TableRef<'a, SequenceMarker>; impl<'a> Sequence<'a> { /// Number of glyph IDs in the substituteGlyphIDs array. This must /// always be greater than 0. + #[inline] pub fn glyph_count(&self) -> u16 { let range = self.shape.glyph_count_byte_range(); self.data.read_at(range.start).unwrap() } /// String of glyph IDs to substitute + #[inline] pub fn substitute_glyph_ids(&self) -> &'a [BigEndian] { let range = self.shape.substitute_glyph_ids_byte_range(); self.data.read_array(range).unwrap() @@ -818,6 +842,7 @@ impl MinByteRange for AlternateSubstFormat1Marker { } impl<'a> FontRead<'a> for AlternateSubstFormat1<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -839,6 +864,7 @@ pub type AlternateSubstFormat1<'a> = TableRef<'a, AlternateSubstFormat1Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> AlternateSubstFormat1<'a> { /// Format identifier: format = 1 + #[inline] pub fn subst_format(&self) -> u16 { let range = self.shape.subst_format_byte_range(); self.data.read_at(range.start).unwrap() @@ -846,6 +872,7 @@ impl<'a> AlternateSubstFormat1<'a> { /// Offset to Coverage table, from beginning of substitution /// subtable + #[inline] pub fn coverage_offset(&self) -> Offset16 { let range = self.shape.coverage_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -858,6 +885,7 @@ impl<'a> AlternateSubstFormat1<'a> { } /// Number of AlternateSet tables + #[inline] pub fn alternate_set_count(&self) -> u16 { let range = self.shape.alternate_set_count_byte_range(); self.data.read_at(range.start).unwrap() @@ -865,6 +893,7 @@ impl<'a> AlternateSubstFormat1<'a> { /// Array of offsets to AlternateSet tables. Offsets are from /// beginning of substitution subtable, ordered by Coverage index + #[inline] pub fn alternate_set_offsets(&self) -> &'a [BigEndian] { let range = self.shape.alternate_set_offsets_byte_range(); self.data.read_array(range).unwrap() @@ -947,6 +976,7 @@ impl MinByteRange for AlternateSetMarker { } impl<'a> FontRead<'a> for AlternateSet<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let glyph_count: u16 = cursor.read()?; @@ -966,12 +996,14 @@ pub type AlternateSet<'a> = TableRef<'a, AlternateSetMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> AlternateSet<'a> { /// Number of glyph IDs in the alternateGlyphIDs array + #[inline] pub fn glyph_count(&self) -> u16 { let range = self.shape.glyph_count_byte_range(); self.data.read_at(range.start).unwrap() } /// Array of alternate glyph IDs, in arbitrary order + #[inline] pub fn alternate_glyph_ids(&self) -> &'a [BigEndian] { let range = self.shape.alternate_glyph_ids_byte_range(); self.data.read_array(range).unwrap() @@ -1043,6 +1075,7 @@ impl MinByteRange for LigatureSubstFormat1Marker { } impl<'a> FontRead<'a> for LigatureSubstFormat1<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -1064,6 +1097,7 @@ pub type LigatureSubstFormat1<'a> = TableRef<'a, LigatureSubstFormat1Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> LigatureSubstFormat1<'a> { /// Format identifier: format = 1 + #[inline] pub fn subst_format(&self) -> u16 { let range = self.shape.subst_format_byte_range(); self.data.read_at(range.start).unwrap() @@ -1071,6 +1105,7 @@ impl<'a> LigatureSubstFormat1<'a> { /// Offset to Coverage table, from beginning of substitution /// subtable + #[inline] pub fn coverage_offset(&self) -> Offset16 { let range = self.shape.coverage_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -1083,6 +1118,7 @@ impl<'a> LigatureSubstFormat1<'a> { } /// Number of LigatureSet tables + #[inline] pub fn ligature_set_count(&self) -> u16 { let range = self.shape.ligature_set_count_byte_range(); self.data.read_at(range.start).unwrap() @@ -1090,6 +1126,7 @@ impl<'a> LigatureSubstFormat1<'a> { /// Array of offsets to LigatureSet tables. Offsets are from /// beginning of substitution subtable, ordered by Coverage index + #[inline] pub fn ligature_set_offsets(&self) -> &'a [BigEndian] { let range = self.shape.ligature_set_offsets_byte_range(); self.data.read_array(range).unwrap() @@ -1169,6 +1206,7 @@ impl MinByteRange for LigatureSetMarker { } impl<'a> FontRead<'a> for LigatureSet<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let ligature_count: u16 = cursor.read()?; @@ -1188,6 +1226,7 @@ pub type LigatureSet<'a> = TableRef<'a, LigatureSetMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> LigatureSet<'a> { /// Number of Ligature tables + #[inline] pub fn ligature_count(&self) -> u16 { let range = self.shape.ligature_count_byte_range(); self.data.read_at(range.start).unwrap() @@ -1195,6 +1234,7 @@ impl<'a> LigatureSet<'a> { /// Array of offsets to Ligature tables. Offsets are from beginning /// of LigatureSet table, ordered by preference. + #[inline] pub fn ligature_offsets(&self) -> &'a [BigEndian] { let range = self.shape.ligature_offsets_byte_range(); self.data.read_array(range).unwrap() @@ -1274,6 +1314,7 @@ impl MinByteRange for LigatureMarker { } impl<'a> FontRead<'a> for Ligature<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -1294,12 +1335,14 @@ pub type Ligature<'a> = TableRef<'a, LigatureMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> Ligature<'a> { /// glyph ID of ligature to substitute + #[inline] pub fn ligature_glyph(&self) -> GlyphId16 { let range = self.shape.ligature_glyph_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of components in the ligature + #[inline] pub fn component_count(&self) -> u16 { let range = self.shape.component_count_byte_range(); self.data.read_at(range.start).unwrap() @@ -1307,6 +1350,7 @@ impl<'a> Ligature<'a> { /// Array of component glyph IDs — start with the second /// component, ordered in writing direction + #[inline] pub fn component_glyph_ids(&self) -> &'a [BigEndian] { let range = self.shape.component_glyph_ids_byte_range(); self.data.read_array(range).unwrap() @@ -1382,6 +1426,7 @@ impl Clone for ExtensionSubstFormat1Marker { impl Copy for ExtensionSubstFormat1Marker {} impl<'a, T> FontRead<'a> for ExtensionSubstFormat1<'a, T> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -1426,6 +1471,7 @@ pub type ExtensionSubstFormat1<'a, T> = TableRef<'a, ExtensionSubstFormat1Marker #[allow(clippy::needless_lifetimes)] impl<'a, T> ExtensionSubstFormat1<'a, T> { /// Format identifier. Set to 1. + #[inline] pub fn subst_format(&self) -> u16 { let range = self.shape.subst_format_byte_range(); self.data.read_at(range.start).unwrap() @@ -1433,6 +1479,7 @@ impl<'a, T> ExtensionSubstFormat1<'a, T> { /// Lookup type of subtable referenced by extensionOffset (that is, /// the extension subtable). + #[inline] pub fn extension_lookup_type(&self) -> u16 { let range = self.shape.extension_lookup_type_byte_range(); self.data.read_at(range.start).unwrap() @@ -1441,6 +1488,7 @@ impl<'a, T> ExtensionSubstFormat1<'a, T> { /// Offset to the extension subtable, of lookup type /// extensionLookupType, relative to the start of the /// ExtensionSubstFormat1 subtable. + #[inline] pub fn extension_offset(&self) -> Offset32 { let range = self.shape.extension_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -1497,6 +1545,7 @@ pub enum ExtensionSubtable<'a> { } impl<'a> FontRead<'a> for ExtensionSubtable<'a> { + #[inline] fn read(bytes: FontData<'a>) -> Result { let untyped = ExtensionSubstFormat1::read(bytes)?; match untyped.extension_lookup_type() { @@ -1624,6 +1673,7 @@ impl MinByteRange for ReverseChainSingleSubstFormat1Marker { } impl<'a> FontRead<'a> for ReverseChainSingleSubstFormat1<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -1657,6 +1707,7 @@ pub type ReverseChainSingleSubstFormat1<'a> = TableRef<'a, ReverseChainSingleSub #[allow(clippy::needless_lifetimes)] impl<'a> ReverseChainSingleSubstFormat1<'a> { /// Format identifier: format = 1 + #[inline] pub fn subst_format(&self) -> u16 { let range = self.shape.subst_format_byte_range(); self.data.read_at(range.start).unwrap() @@ -1664,6 +1715,7 @@ impl<'a> ReverseChainSingleSubstFormat1<'a> { /// Offset to Coverage table, from beginning of substitution /// subtable. + #[inline] pub fn coverage_offset(&self) -> Offset16 { let range = self.shape.coverage_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -1676,6 +1728,7 @@ impl<'a> ReverseChainSingleSubstFormat1<'a> { } /// Number of glyphs in the backtrack sequence. + #[inline] pub fn backtrack_glyph_count(&self) -> u16 { let range = self.shape.backtrack_glyph_count_byte_range(); self.data.read_at(range.start).unwrap() @@ -1683,6 +1736,7 @@ impl<'a> ReverseChainSingleSubstFormat1<'a> { /// Array of offsets to coverage tables in backtrack sequence, in /// glyph sequence order. + #[inline] pub fn backtrack_coverage_offsets(&self) -> &'a [BigEndian] { let range = self.shape.backtrack_coverage_offsets_byte_range(); self.data.read_array(range).unwrap() @@ -1696,6 +1750,7 @@ impl<'a> ReverseChainSingleSubstFormat1<'a> { } /// Number of glyphs in lookahead sequence. + #[inline] pub fn lookahead_glyph_count(&self) -> u16 { let range = self.shape.lookahead_glyph_count_byte_range(); self.data.read_at(range.start).unwrap() @@ -1703,6 +1758,7 @@ impl<'a> ReverseChainSingleSubstFormat1<'a> { /// Array of offsets to coverage tables in lookahead sequence, in /// glyph sequence order. + #[inline] pub fn lookahead_coverage_offsets(&self) -> &'a [BigEndian] { let range = self.shape.lookahead_coverage_offsets_byte_range(); self.data.read_array(range).unwrap() @@ -1716,12 +1772,14 @@ impl<'a> ReverseChainSingleSubstFormat1<'a> { } /// Number of glyph IDs in the substituteGlyphIDs array. + #[inline] pub fn glyph_count(&self) -> u16 { let range = self.shape.glyph_count_byte_range(); self.data.read_at(range.start).unwrap() } /// Array of substitute glyph IDs — ordered by Coverage index. + #[inline] pub fn substitute_glyph_ids(&self) -> &'a [BigEndian] { let range = self.shape.substitute_glyph_ids_byte_range(); self.data.read_array(range).unwrap() diff --git a/read-fonts/generated/generated_gvar.rs b/read-fonts/generated/generated_gvar.rs index e65862fd3..2e8e2008b 100644 --- a/read-fonts/generated/generated_gvar.rs +++ b/read-fonts/generated/generated_gvar.rs @@ -66,6 +66,7 @@ impl TopLevelTable for Gvar<'_> { } impl<'a> FontRead<'a> for Gvar<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -91,6 +92,7 @@ pub type Gvar<'a> = TableRef<'a, GvarMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> Gvar<'a> { /// Major/minor version number of the glyph variations table — set to (1,0). + #[inline] pub fn version(&self) -> MajorMinor { let range = self.shape.version_byte_range(); self.data.read_at(range.start).unwrap() @@ -98,6 +100,7 @@ impl<'a> Gvar<'a> { /// The number of variation axes for this font. This must be the /// same number as axisCount in the 'fvar' table. + #[inline] pub fn axis_count(&self) -> u16 { let range = self.shape.axis_count_byte_range(); self.data.read_at(range.start).unwrap() @@ -107,12 +110,14 @@ impl<'a> Gvar<'a> { /// referenced within glyph variation data tables for multiple /// glyphs, as opposed to other tuple records stored directly /// within a glyph variation data table. + #[inline] pub fn shared_tuple_count(&self) -> u16 { let range = self.shape.shared_tuple_count_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset from the start of this table to the shared tuple records. + #[inline] pub fn shared_tuples_offset(&self) -> Offset32 { let range = self.shape.shared_tuples_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -127,6 +132,7 @@ impl<'a> Gvar<'a> { /// The number of glyphs in this font. This must match the number /// of glyphs stored elsewhere in the font. + #[inline] pub fn glyph_count(&self) -> u16 { let range = self.shape.glyph_count_byte_range(); self.data.read_at(range.start).unwrap() @@ -135,6 +141,7 @@ impl<'a> Gvar<'a> { /// Bit-field that gives the format of the offset array that /// follows. If bit 0 is clear, the offsets are uint16; if bit 0 is /// set, the offsets are uint32. + #[inline] pub fn flags(&self) -> GvarFlags { let range = self.shape.flags_byte_range(); self.data.read_at(range.start).unwrap() @@ -142,6 +149,7 @@ impl<'a> Gvar<'a> { /// Offset from the start of this table to the array of /// GlyphVariationData tables. + #[inline] pub fn glyph_variation_data_array_offset(&self) -> u32 { let range = self.shape.glyph_variation_data_array_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -149,6 +157,7 @@ impl<'a> Gvar<'a> { /// Offsets from the start of the GlyphVariationData array to each /// GlyphVariationData table. + #[inline] pub fn glyph_variation_data_offsets(&self) -> ComputedArray<'a, U16Or32> { let range = self.shape.glyph_variation_data_offsets_byte_range(); self.data.read_with_args(range, &self.flags()).unwrap() @@ -519,6 +528,7 @@ impl ReadArgs for SharedTuples<'_> { } impl<'a> FontReadWithArgs<'a> for SharedTuples<'a> { + #[inline] fn read_with_args(data: FontData<'a>, args: &(u16, u16)) -> Result { let (shared_tuple_count, axis_count) = *args; let mut cursor = data.cursor(); @@ -538,6 +548,7 @@ impl<'a> SharedTuples<'a> { /// /// This type requires some external state in order to be /// parsed. + #[inline] pub fn read( data: FontData<'a>, shared_tuple_count: u16, @@ -553,6 +564,7 @@ pub type SharedTuples<'a> = TableRef<'a, SharedTuplesMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> SharedTuples<'a> { + #[inline] pub fn tuples(&self) -> ComputedArray<'a, Tuple<'a>> { let range = self.shape.tuples_byte_range(); self.data.read_with_args(range, &self.axis_count()).unwrap() @@ -618,6 +630,7 @@ impl MinByteRange for GlyphVariationDataHeaderMarker { } impl<'a> FontRead<'a> for GlyphVariationDataHeader<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -639,6 +652,7 @@ impl<'a> GlyphVariationDataHeader<'a> { /// are the number of tuple variation tables for this glyph. The /// number of tuple variation tables can be any number between 1 /// and 4095. + #[inline] pub fn tuple_variation_count(&self) -> TupleVariationCount { let range = self.shape.tuple_variation_count_byte_range(); self.data.read_at(range.start).unwrap() @@ -646,6 +660,7 @@ impl<'a> GlyphVariationDataHeader<'a> { /// Offset from the start of the GlyphVariationData table to the /// serialized data + #[inline] pub fn serialized_data_offset(&self) -> Offset16 { let range = self.shape.serialized_data_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -658,6 +673,7 @@ impl<'a> GlyphVariationDataHeader<'a> { } /// Array of tuple variation headers. + #[inline] pub fn tuple_variation_headers(&self) -> VarLenArray<'a, TupleVariationHeader> { let range = self.shape.tuple_variation_headers_byte_range(); VarLenArray::read(self.data.split_off(range.start).unwrap()).unwrap() diff --git a/read-fonts/generated/generated_hdmx.rs b/read-fonts/generated/generated_hdmx.rs index a883d3d4c..011ed8f43 100644 --- a/read-fonts/generated/generated_hdmx.rs +++ b/read-fonts/generated/generated_hdmx.rs @@ -51,6 +51,7 @@ impl ReadArgs for Hdmx<'_> { } impl<'a> FontReadWithArgs<'a> for Hdmx<'a> { + #[inline] fn read_with_args(data: FontData<'a>, args: &u16) -> Result { let num_glyphs = *args; let mut cursor = data.cursor(); @@ -76,6 +77,7 @@ impl<'a> Hdmx<'a> { /// /// This type requires some external state in order to be /// parsed. + #[inline] pub fn read(data: FontData<'a>, num_glyphs: u16) -> Result { let args = num_glyphs; Self::read_with_args(data, &args) @@ -88,24 +90,28 @@ pub type Hdmx<'a> = TableRef<'a, HdmxMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> Hdmx<'a> { /// Table version number (set to 0). + #[inline] pub fn version(&self) -> u16 { let range = self.shape.version_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of device records. + #[inline] pub fn num_records(&self) -> u16 { let range = self.shape.num_records_byte_range(); self.data.read_at(range.start).unwrap() } /// Size of device record, 32-bit aligned. + #[inline] pub fn size_device_record(&self) -> u32 { let range = self.shape.size_device_record_byte_range(); self.data.read_at(range.start).unwrap() } /// Array of device records. + #[inline] pub fn records(&self) -> ComputedArray<'a, DeviceRecord<'a>> { let range = self.shape.records_byte_range(); self.data diff --git a/read-fonts/generated/generated_head.rs b/read-fonts/generated/generated_head.rs index 88057c57d..480e5c201 100644 --- a/read-fonts/generated/generated_head.rs +++ b/read-fonts/generated/generated_head.rs @@ -797,6 +797,7 @@ impl TopLevelTable for Head<'_> { } impl<'a> FontRead<'a> for Head<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -827,12 +828,14 @@ pub type Head<'a> = TableRef<'a, HeadMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> Head<'a> { /// Version number of the font header table, set to (1, 0) + #[inline] pub fn version(&self) -> MajorMinor { let range = self.shape.version_byte_range(); self.data.read_at(range.start).unwrap() } /// Set by font manufacturer. + #[inline] pub fn font_revision(&self) -> Fixed { let range = self.shape.font_revision_byte_range(); self.data.read_at(range.start).unwrap() @@ -843,18 +846,21 @@ impl<'a> Head<'a> { /// font collection file, the value of this field will be /// invalidated by changes to the file structure and font table /// directory, and must be ignored. + #[inline] pub fn checksum_adjustment(&self) -> u32 { let range = self.shape.checksum_adjustment_byte_range(); self.data.read_at(range.start).unwrap() } /// Set to 0x5F0F3CF5. + #[inline] pub fn magic_number(&self) -> u32 { let range = self.shape.magic_number_byte_range(); self.data.read_at(range.start).unwrap() } /// See the flags enum. + #[inline] pub fn flags(&self) -> Flags { let range = self.shape.flags_byte_range(); self.data.read_at(range.start).unwrap() @@ -864,6 +870,7 @@ impl<'a> Head<'a> { /// valid. In fonts that have TrueType outlines, a power of 2 is /// recommended as this allows performance optimizations in some /// rasterizers. + #[inline] pub fn units_per_em(&self) -> u16 { let range = self.shape.units_per_em_byte_range(); self.data.read_at(range.start).unwrap() @@ -871,6 +878,7 @@ impl<'a> Head<'a> { /// Number of seconds since 12:00 midnight that started January 1st /// 1904 in GMT/UTC time zone. + #[inline] pub fn created(&self) -> LongDateTime { let range = self.shape.created_byte_range(); self.data.read_at(range.start).unwrap() @@ -878,60 +886,70 @@ impl<'a> Head<'a> { /// Number of seconds since 12:00 midnight that started January 1st /// 1904 in GMT/UTC time zone. + #[inline] pub fn modified(&self) -> LongDateTime { let range = self.shape.modified_byte_range(); self.data.read_at(range.start).unwrap() } /// Minimum x coordinate across all glyph bounding boxes. + #[inline] pub fn x_min(&self) -> i16 { let range = self.shape.x_min_byte_range(); self.data.read_at(range.start).unwrap() } /// Minimum y coordinate across all glyph bounding boxes. + #[inline] pub fn y_min(&self) -> i16 { let range = self.shape.y_min_byte_range(); self.data.read_at(range.start).unwrap() } /// Maximum x coordinate across all glyph bounding boxes. + #[inline] pub fn x_max(&self) -> i16 { let range = self.shape.x_max_byte_range(); self.data.read_at(range.start).unwrap() } /// Maximum y coordinate across all glyph bounding boxes. + #[inline] pub fn y_max(&self) -> i16 { let range = self.shape.y_max_byte_range(); self.data.read_at(range.start).unwrap() } /// Bits identifying the font's style; see [MacStyle] + #[inline] pub fn mac_style(&self) -> MacStyle { let range = self.shape.mac_style_byte_range(); self.data.read_at(range.start).unwrap() } /// Smallest readable size in pixels. + #[inline] pub fn lowest_rec_ppem(&self) -> u16 { let range = self.shape.lowest_rec_ppem_byte_range(); self.data.read_at(range.start).unwrap() } /// Deprecated (Set to 2). + #[inline] pub fn font_direction_hint(&self) -> i16 { let range = self.shape.font_direction_hint_byte_range(); self.data.read_at(range.start).unwrap() } /// 0 for short offsets (Offset16), 1 for long (Offset32). + #[inline] pub fn index_to_loc_format(&self) -> i16 { let range = self.shape.index_to_loc_format_byte_range(); self.data.read_at(range.start).unwrap() } /// 0 for current format. + #[inline] pub fn glyph_data_format(&self) -> i16 { let range = self.shape.glyph_data_format_byte_range(); self.data.read_at(range.start).unwrap() diff --git a/read-fonts/generated/generated_hhea.rs b/read-fonts/generated/generated_hhea.rs index 73912bacd..c04c79676 100644 --- a/read-fonts/generated/generated_hhea.rs +++ b/read-fonts/generated/generated_hhea.rs @@ -109,6 +109,7 @@ impl TopLevelTable for Hhea<'_> { } impl<'a> FontRead<'a> for Hhea<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -138,18 +139,21 @@ pub type Hhea<'a> = TableRef<'a, HheaMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> Hhea<'a> { /// The major/minor version (1, 0) + #[inline] pub fn version(&self) -> MajorMinor { let range = self.shape.version_byte_range(); self.data.read_at(range.start).unwrap() } /// Typographic ascent. + #[inline] pub fn ascender(&self) -> FWord { let range = self.shape.ascender_byte_range(); self.data.read_at(range.start).unwrap() } /// Typographic descent. + #[inline] pub fn descender(&self) -> FWord { let range = self.shape.descender_byte_range(); self.data.read_at(range.start).unwrap() @@ -157,12 +161,14 @@ impl<'a> Hhea<'a> { /// Typographic line gap. Negative LineGap values are treated as /// zero in some legacy platform implementations. + #[inline] pub fn line_gap(&self) -> FWord { let range = self.shape.line_gap_byte_range(); self.data.read_at(range.start).unwrap() } /// Maximum advance width value in 'hmtx' table. + #[inline] pub fn advance_width_max(&self) -> UfWord { let range = self.shape.advance_width_max_byte_range(); self.data.read_at(range.start).unwrap() @@ -170,6 +176,7 @@ impl<'a> Hhea<'a> { /// Minimum left sidebearing value in 'hmtx' table for glyphs with /// contours (empty glyphs should be ignored). + #[inline] pub fn min_left_side_bearing(&self) -> FWord { let range = self.shape.min_left_side_bearing_byte_range(); self.data.read_at(range.start).unwrap() @@ -177,12 +184,14 @@ impl<'a> Hhea<'a> { /// Minimum right sidebearing value; calculated as min(aw - (lsb + /// xMax - xMin)) for glyphs with contours (empty glyphs should be ignored). + #[inline] pub fn min_right_side_bearing(&self) -> FWord { let range = self.shape.min_right_side_bearing_byte_range(); self.data.read_at(range.start).unwrap() } /// Max(lsb + (xMax-xMin)) + #[inline] pub fn x_max_extent(&self) -> FWord { let range = self.shape.x_max_extent_byte_range(); self.data.read_at(range.start).unwrap() @@ -190,12 +199,14 @@ impl<'a> Hhea<'a> { /// Used to calculate the slope of the cursor (rise/run); 1 for /// vertical caret, 0 for horizontal. + #[inline] pub fn caret_slope_rise(&self) -> i16 { let range = self.shape.caret_slope_rise_byte_range(); self.data.read_at(range.start).unwrap() } /// 0 for vertical caret, 1 for horizontal. + #[inline] pub fn caret_slope_run(&self) -> i16 { let range = self.shape.caret_slope_run_byte_range(); self.data.read_at(range.start).unwrap() @@ -204,18 +215,21 @@ impl<'a> Hhea<'a> { /// The amount by which a slanted highlight on a glyph needs to be /// shifted to produce the best appearance. Set to 0 for /// non-slanted fonts + #[inline] pub fn caret_offset(&self) -> i16 { let range = self.shape.caret_offset_byte_range(); self.data.read_at(range.start).unwrap() } /// 0 for current format. + #[inline] pub fn metric_data_format(&self) -> i16 { let range = self.shape.metric_data_format_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of hMetric entries in 'hmtx' table + #[inline] pub fn number_of_h_metrics(&self) -> u16 { let range = self.shape.number_of_h_metrics_byte_range(); self.data.read_at(range.start).unwrap() diff --git a/read-fonts/generated/generated_hmtx.rs b/read-fonts/generated/generated_hmtx.rs index 85a8d565a..5875ee23d 100644 --- a/read-fonts/generated/generated_hmtx.rs +++ b/read-fonts/generated/generated_hmtx.rs @@ -41,6 +41,7 @@ impl ReadArgs for Hmtx<'_> { } impl<'a> FontReadWithArgs<'a> for Hmtx<'a> { + #[inline] fn read_with_args(data: FontData<'a>, args: &u16) -> Result { let number_of_h_metrics = *args; let mut cursor = data.cursor(); @@ -63,6 +64,7 @@ impl<'a> Hmtx<'a> { /// /// This type requires some external state in order to be /// parsed. + #[inline] pub fn read(data: FontData<'a>, number_of_h_metrics: u16) -> Result { let args = number_of_h_metrics; Self::read_with_args(data, &args) @@ -76,6 +78,7 @@ pub type Hmtx<'a> = TableRef<'a, HmtxMarker>; impl<'a> Hmtx<'a> { /// Paired advance width/height and left/top side bearing values for each /// glyph. Records are indexed by glyph ID. + #[inline] pub fn h_metrics(&self) -> &'a [LongMetric] { let range = self.shape.h_metrics_byte_range(); self.data.read_array(range).unwrap() @@ -83,6 +86,7 @@ impl<'a> Hmtx<'a> { /// Leading (left/top) side bearings for glyph IDs greater than or equal to /// numberOfLongMetrics. + #[inline] pub fn left_side_bearings(&self) -> &'a [BigEndian] { let range = self.shape.left_side_bearings_byte_range(); self.data.read_array(range).unwrap() @@ -130,11 +134,13 @@ pub struct LongMetric { impl LongMetric { /// Advance width/height, in font design units. + #[inline] pub fn advance(&self) -> u16 { self.advance.get() } /// Glyph leading (left/top) side bearing, in font design units. + #[inline] pub fn side_bearing(&self) -> i16 { self.side_bearing.get() } diff --git a/read-fonts/generated/generated_hvar.rs b/read-fonts/generated/generated_hvar.rs index 8afca3166..e165f7b94 100644 --- a/read-fonts/generated/generated_hvar.rs +++ b/read-fonts/generated/generated_hvar.rs @@ -49,6 +49,7 @@ impl TopLevelTable for Hvar<'_> { } impl<'a> FontRead<'a> for Hvar<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -67,12 +68,14 @@ pub type Hvar<'a> = TableRef<'a, HvarMarker>; impl<'a> Hvar<'a> { /// Major version number of the horizontal metrics variations table — set to 1. /// Minor version number of the horizontal metrics variations table — set to 0. + #[inline] pub fn version(&self) -> MajorMinor { let range = self.shape.version_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset in bytes from the start of this table to the item variation store table. + #[inline] pub fn item_variation_store_offset(&self) -> Offset32 { let range = self.shape.item_variation_store_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -85,6 +88,7 @@ impl<'a> Hvar<'a> { } /// Offset in bytes from the start of this table to the delta-set index mapping for advance widths (may be NULL). + #[inline] pub fn advance_width_mapping_offset(&self) -> Nullable { let range = self.shape.advance_width_mapping_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -97,6 +101,7 @@ impl<'a> Hvar<'a> { } /// Offset in bytes from the start of this table to the delta-set index mapping for left side bearings (may be NULL). + #[inline] pub fn lsb_mapping_offset(&self) -> Nullable { let range = self.shape.lsb_mapping_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -109,6 +114,7 @@ impl<'a> Hvar<'a> { } /// Offset in bytes from the start of this table to the delta-set index mapping for right side bearings (may be NULL). + #[inline] pub fn rsb_mapping_offset(&self) -> Nullable { let range = self.shape.rsb_mapping_offset_byte_range(); self.data.read_at(range.start).unwrap() diff --git a/read-fonts/generated/generated_ift.rs b/read-fonts/generated/generated_ift.rs index 19699fb4e..8fc706f0c 100644 --- a/read-fonts/generated/generated_ift.rs +++ b/read-fonts/generated/generated_ift.rs @@ -532,6 +532,7 @@ impl MinByteRange for PatchMapFormat1Marker { } impl<'a> FontRead<'a> for PatchMapFormat1<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -584,40 +585,47 @@ pub type PatchMapFormat1<'a> = TableRef<'a, PatchMapFormat1Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> PatchMapFormat1<'a> { /// Format identifier: format = 1 + #[inline] pub fn format(&self) -> u8 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn field_flags(&self) -> PatchMapFieldPresenceFlags { let range = self.shape.field_flags_byte_range(); self.data.read_at(range.start).unwrap() } /// Unique ID that identifies compatible patches. + #[inline] pub fn compatibility_id(&self) -> CompatibilityId { let range = self.shape.compatibility_id_byte_range(); self.data.read_at(range.start).unwrap() } /// Largest entry index which appears in either the glyph map or feature map. + #[inline] pub fn max_entry_index(&self) -> u16 { let range = self.shape.max_entry_index_byte_range(); self.data.read_at(range.start).unwrap() } /// Largest entry index which appears in the glyph map. + #[inline] pub fn max_glyph_map_entry_index(&self) -> u16 { let range = self.shape.max_glyph_map_entry_index_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn glyph_count(&self) -> Uint24 { let range = self.shape.glyph_count_byte_range(); self.data.read_at(range.start).unwrap() } /// Sub table that maps glyph ids to entry indices. + #[inline] pub fn glyph_map_offset(&self) -> Offset32 { let range = self.shape.glyph_map_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -631,6 +639,7 @@ impl<'a> PatchMapFormat1<'a> { } /// Sub table that maps feature and glyph ids to entry indices. + #[inline] pub fn feature_map_offset(&self) -> Nullable { let range = self.shape.feature_map_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -643,32 +652,38 @@ impl<'a> PatchMapFormat1<'a> { self.feature_map_offset().resolve_with_args(data, &args) } + #[inline] pub fn applied_entries_bitmap(&self) -> &'a [u8] { let range = self.shape.applied_entries_bitmap_byte_range(); self.data.read_array(range).unwrap() } + #[inline] pub fn url_template_length(&self) -> u16 { let range = self.shape.url_template_length_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn url_template(&self) -> &'a [u8] { let range = self.shape.url_template_byte_range(); self.data.read_array(range).unwrap() } /// Patch format number for patches referenced by this mapping. + #[inline] pub fn patch_format(&self) -> u8 { let range = self.shape.patch_format_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn cff_charstrings_offset(&self) -> Option { let range = self.shape.cff_charstrings_offset_byte_range()?; Some(self.data.read_at(range.start).unwrap()) } + #[inline] pub fn cff2_charstrings_offset(&self) -> Option { let range = self.shape.cff2_charstrings_offset_byte_range()?; Some(self.data.read_at(range.start).unwrap()) @@ -770,6 +785,7 @@ impl ReadArgs for GlyphMap<'_> { } impl<'a> FontReadWithArgs<'a> for GlyphMap<'a> { + #[inline] fn read_with_args(data: FontData<'a>, args: &(Uint24, u16)) -> Result { let (glyph_count, max_entry_index) = *args; let mut cursor = data.cursor(); @@ -790,6 +806,7 @@ impl<'a> GlyphMap<'a> { /// /// This type requires some external state in order to be /// parsed. + #[inline] pub fn read( data: FontData<'a>, glyph_count: Uint24, @@ -804,11 +821,13 @@ pub type GlyphMap<'a> = TableRef<'a, GlyphMapMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> GlyphMap<'a> { + #[inline] pub fn first_mapped_glyph(&self) -> u16 { let range = self.shape.first_mapped_glyph_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn entry_index(&self) -> ComputedArray<'a, U8Or16> { let range = self.shape.entry_index_byte_range(); self.data @@ -879,6 +898,7 @@ impl ReadArgs for FeatureMap<'_> { } impl<'a> FontReadWithArgs<'a> for FeatureMap<'a> { + #[inline] fn read_with_args(data: FontData<'a>, args: &u16) -> Result { let max_entry_index = *args; let mut cursor = data.cursor(); @@ -905,6 +925,7 @@ impl<'a> FeatureMap<'a> { /// /// This type requires some external state in order to be /// parsed. + #[inline] pub fn read(data: FontData<'a>, max_entry_index: u16) -> Result { let args = max_entry_index; Self::read_with_args(data, &args) @@ -915,11 +936,13 @@ pub type FeatureMap<'a> = TableRef<'a, FeatureMapMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> FeatureMap<'a> { + #[inline] pub fn feature_count(&self) -> u16 { let range = self.shape.feature_count_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn feature_records(&self) -> ComputedArray<'a, FeatureRecord> { let range = self.shape.feature_records_byte_range(); self.data @@ -927,6 +950,7 @@ impl<'a> FeatureMap<'a> { .unwrap() } + #[inline] pub fn entry_map_data(&self) -> &'a [u8] { let range = self.shape.entry_map_data_byte_range(); self.data.read_array(range).unwrap() @@ -968,14 +992,17 @@ pub struct FeatureRecord { } impl FeatureRecord { + #[inline] pub fn feature_tag(&self) -> Tag { self.feature_tag.get() } + #[inline] pub fn first_new_entry_index(&self) -> &U8Or16 { &self.first_new_entry_index } + #[inline] pub fn entry_map_count(&self) -> &U8Or16 { &self.entry_map_count } @@ -1053,10 +1080,12 @@ pub struct EntryMapRecord { } impl EntryMapRecord { + #[inline] pub fn first_entry_index(&self) -> &U8Or16 { &self.first_entry_index } + #[inline] pub fn last_entry_index(&self) -> &U8Or16 { &self.last_entry_index } @@ -1217,6 +1246,7 @@ impl MinByteRange for PatchMapFormat2Marker { } impl<'a> FontRead<'a> for PatchMapFormat2<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -1262,33 +1292,39 @@ pub type PatchMapFormat2<'a> = TableRef<'a, PatchMapFormat2Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> PatchMapFormat2<'a> { /// Format identifier: format = 2 + #[inline] pub fn format(&self) -> u8 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn field_flags(&self) -> PatchMapFieldPresenceFlags { let range = self.shape.field_flags_byte_range(); self.data.read_at(range.start).unwrap() } /// Unique ID that identifies compatible patches. + #[inline] pub fn compatibility_id(&self) -> CompatibilityId { let range = self.shape.compatibility_id_byte_range(); self.data.read_at(range.start).unwrap() } /// Patch format number for patches referenced by this mapping. + #[inline] pub fn default_patch_format(&self) -> u8 { let range = self.shape.default_patch_format_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn entry_count(&self) -> Uint24 { let range = self.shape.entry_count_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn entries_offset(&self) -> Offset32 { let range = self.shape.entries_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -1300,6 +1336,7 @@ impl<'a> PatchMapFormat2<'a> { self.entries_offset().resolve(data) } + #[inline] pub fn entry_id_string_data_offset(&self) -> Nullable { let range = self.shape.entry_id_string_data_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -1311,21 +1348,25 @@ impl<'a> PatchMapFormat2<'a> { self.entry_id_string_data_offset().resolve(data) } + #[inline] pub fn url_template_length(&self) -> u16 { let range = self.shape.url_template_length_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn url_template(&self) -> &'a [u8] { let range = self.shape.url_template_byte_range(); self.data.read_array(range).unwrap() } + #[inline] pub fn cff_charstrings_offset(&self) -> Option { let range = self.shape.cff_charstrings_offset_byte_range()?; Some(self.data.read_at(range.start).unwrap()) } + #[inline] pub fn cff2_charstrings_offset(&self) -> Option { let range = self.shape.cff2_charstrings_offset_byte_range()?; Some(self.data.read_at(range.start).unwrap()) @@ -1414,6 +1455,7 @@ impl MinByteRange for MappingEntriesMarker { } impl<'a> FontRead<'a> for MappingEntries<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let entry_data_byte_len = cursor.remaining_bytes() / u8::RAW_BYTE_LEN * u8::RAW_BYTE_LEN; @@ -1428,6 +1470,7 @@ pub type MappingEntries<'a> = TableRef<'a, MappingEntriesMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> MappingEntries<'a> { + #[inline] pub fn entry_data(&self) -> &'a [u8] { let range = self.shape.entry_data_byte_range(); self.data.read_array(range).unwrap() @@ -1544,6 +1587,7 @@ impl MinByteRange for EntryDataMarker { } impl<'a> FontRead<'a> for EntryData<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let format_flags: EntryFormatFlags = cursor.read()?; @@ -1637,41 +1681,49 @@ pub type EntryData<'a> = TableRef<'a, EntryDataMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> EntryData<'a> { + #[inline] pub fn format_flags(&self) -> EntryFormatFlags { let range = self.shape.format_flags_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn feature_count(&self) -> Option { let range = self.shape.feature_count_byte_range()?; Some(self.data.read_at(range.start).unwrap()) } + #[inline] pub fn feature_tags(&self) -> Option<&'a [BigEndian]> { let range = self.shape.feature_tags_byte_range()?; Some(self.data.read_array(range).unwrap()) } + #[inline] pub fn design_space_count(&self) -> Option { let range = self.shape.design_space_count_byte_range()?; Some(self.data.read_at(range.start).unwrap()) } + #[inline] pub fn design_space_segments(&self) -> Option<&'a [DesignSpaceSegment]> { let range = self.shape.design_space_segments_byte_range()?; Some(self.data.read_array(range).unwrap()) } + #[inline] pub fn match_mode_and_count(&self) -> Option { let range = self.shape.match_mode_and_count_byte_range()?; Some(self.data.read_at(range.start).unwrap()) } + #[inline] pub fn child_indices(&self) -> Option<&'a [BigEndian]> { let range = self.shape.child_indices_byte_range()?; Some(self.data.read_array(range).unwrap()) } + #[inline] pub fn trailing_data(&self) -> &'a [u8] { let range = self.shape.trailing_data_byte_range(); self.data.read_array(range).unwrap() @@ -2067,14 +2119,17 @@ pub struct DesignSpaceSegment { } impl DesignSpaceSegment { + #[inline] pub fn axis_tag(&self) -> Tag { self.axis_tag.get() } + #[inline] pub fn start(&self) -> Fixed { self.start.get() } + #[inline] pub fn end(&self) -> Fixed { self.end.get() } @@ -2120,6 +2175,7 @@ impl MinByteRange for IdStringDataMarker { } impl<'a> FontRead<'a> for IdStringData<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let id_data_byte_len = cursor.remaining_bytes() / u8::RAW_BYTE_LEN * u8::RAW_BYTE_LEN; @@ -2132,6 +2188,7 @@ pub type IdStringData<'a> = TableRef<'a, IdStringDataMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> IdStringData<'a> { + #[inline] pub fn id_data(&self) -> &'a [u8] { let range = self.shape.id_data_byte_range(); self.data.read_array(range).unwrap() @@ -2200,6 +2257,7 @@ impl MinByteRange for TableKeyedPatchMarker { } impl<'a> FontRead<'a> for TableKeyedPatch<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -2221,22 +2279,26 @@ pub type TableKeyedPatch<'a> = TableRef<'a, TableKeyedPatchMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> TableKeyedPatch<'a> { + #[inline] pub fn format(&self) -> Tag { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Unique ID that identifies compatible patches. + #[inline] pub fn compatibility_id(&self) -> CompatibilityId { let range = self.shape.compatibility_id_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn patches_count(&self) -> u16 { let range = self.shape.patches_count_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn patch_offsets(&self) -> &'a [BigEndian] { let range = self.shape.patch_offsets_byte_range(); self.data.read_array(range).unwrap() @@ -2326,6 +2388,7 @@ impl MinByteRange for TablePatchMarker { } impl<'a> FontRead<'a> for TablePatch<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -2344,21 +2407,25 @@ pub type TablePatch<'a> = TableRef<'a, TablePatchMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> TablePatch<'a> { + #[inline] pub fn tag(&self) -> Tag { let range = self.shape.tag_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn flags(&self) -> TablePatchFlags { let range = self.shape.flags_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn max_uncompressed_length(&self) -> u32 { let range = self.shape.max_uncompressed_length_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn brotli_stream(&self) -> &'a [u8] { let range = self.shape.brotli_stream_byte_range(); self.data.read_array(range).unwrap() @@ -2743,6 +2810,7 @@ impl MinByteRange for GlyphKeyedPatchMarker { } impl<'a> FontRead<'a> for GlyphKeyedPatch<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -2763,26 +2831,31 @@ pub type GlyphKeyedPatch<'a> = TableRef<'a, GlyphKeyedPatchMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> GlyphKeyedPatch<'a> { + #[inline] pub fn format(&self) -> Tag { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn flags(&self) -> GlyphKeyedFlags { let range = self.shape.flags_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn compatibility_id(&self) -> CompatibilityId { let range = self.shape.compatibility_id_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn max_uncompressed_length(&self) -> u32 { let range = self.shape.max_uncompressed_length_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn brotli_stream(&self) -> &'a [u8] { let range = self.shape.brotli_stream_byte_range(); self.data.read_array(range).unwrap() @@ -3173,6 +3246,7 @@ impl ReadArgs for GlyphPatches<'_> { } impl<'a> FontReadWithArgs<'a> for GlyphPatches<'a> { + #[inline] fn read_with_args(data: FontData<'a>, args: &GlyphKeyedFlags) -> Result { let flags = *args; let mut cursor = data.cursor(); @@ -3205,6 +3279,7 @@ impl<'a> GlyphPatches<'a> { /// /// This type requires some external state in order to be /// parsed. + #[inline] pub fn read(data: FontData<'a>, flags: GlyphKeyedFlags) -> Result { let args = flags; Self::read_with_args(data, &args) @@ -3216,26 +3291,31 @@ pub type GlyphPatches<'a> = TableRef<'a, GlyphPatchesMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> GlyphPatches<'a> { + #[inline] pub fn glyph_count(&self) -> u32 { let range = self.shape.glyph_count_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn table_count(&self) -> u8 { let range = self.shape.table_count_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn glyph_ids(&self) -> ComputedArray<'a, U16Or24> { let range = self.shape.glyph_ids_byte_range(); self.data.read_with_args(range, &self.flags()).unwrap() } + #[inline] pub fn tables(&self) -> &'a [BigEndian] { let range = self.shape.tables_byte_range(); self.data.read_array(range).unwrap() } + #[inline] pub fn glyph_data_offsets(&self) -> &'a [BigEndian] { let range = self.shape.glyph_data_offsets_byte_range(); self.data.read_array(range).unwrap() @@ -3311,6 +3391,7 @@ impl MinByteRange for GlyphDataMarker { } impl<'a> FontRead<'a> for GlyphData<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let data_byte_len = cursor.remaining_bytes() / u8::RAW_BYTE_LEN * u8::RAW_BYTE_LEN; @@ -3323,6 +3404,7 @@ pub type GlyphData<'a> = TableRef<'a, GlyphDataMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> GlyphData<'a> { + #[inline] pub fn data(&self) -> &'a [u8] { let range = self.shape.data_byte_range(); self.data.read_array(range).unwrap() diff --git a/read-fonts/generated/generated_kern.rs b/read-fonts/generated/generated_kern.rs index b67f5c4a6..905df550d 100644 --- a/read-fonts/generated/generated_kern.rs +++ b/read-fonts/generated/generated_kern.rs @@ -36,6 +36,7 @@ impl MinByteRange for OtKernMarker { } impl<'a> FontRead<'a> for OtKern<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -54,18 +55,21 @@ pub type OtKern<'a> = TableRef<'a, OtKernMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> OtKern<'a> { /// Table version number—set to 0. + #[inline] pub fn version(&self) -> u16 { let range = self.shape.version_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of subtables in the kerning table. + #[inline] pub fn n_tables(&self) -> u16 { let range = self.shape.n_tables_byte_range(); self.data.read_at(range.start).unwrap() } /// Data for subtables, immediately following the header. + #[inline] pub fn subtable_data(&self) -> &'a [u8] { let range = self.shape.subtable_data_byte_range(); self.data.read_array(range).unwrap() @@ -126,6 +130,7 @@ impl MinByteRange for AatKernMarker { } impl<'a> FontRead<'a> for AatKern<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -144,18 +149,21 @@ pub type AatKern<'a> = TableRef<'a, AatKernMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> AatKern<'a> { /// The version number of the kerning table (0x00010000 for the current version). + #[inline] pub fn version(&self) -> MajorMinor { let range = self.shape.version_byte_range(); self.data.read_at(range.start).unwrap() } /// The number of subtables included in the kerning table. + #[inline] pub fn n_tables(&self) -> u32 { let range = self.shape.n_tables_byte_range(); self.data.read_at(range.start).unwrap() } /// Data for subtables, immediately following the header. + #[inline] pub fn subtable_data(&self) -> &'a [u8] { let range = self.shape.subtable_data_byte_range(); self.data.read_array(range).unwrap() @@ -221,6 +229,7 @@ impl MinByteRange for OtSubtableMarker { } impl<'a> FontRead<'a> for OtSubtable<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -238,24 +247,28 @@ pub type OtSubtable<'a> = TableRef<'a, OtSubtableMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> OtSubtable<'a> { /// Kern subtable version number-- set to 0. + #[inline] pub fn version(&self) -> u16 { let range = self.shape.version_byte_range(); self.data.read_at(range.start).unwrap() } /// The length of this subtable in bytes, including this header. + #[inline] pub fn length(&self) -> u16 { let range = self.shape.length_byte_range(); self.data.read_at(range.start).unwrap() } /// Circumstances under which this table is used. + #[inline] pub fn coverage(&self) -> u16 { let range = self.shape.coverage_byte_range(); self.data.read_at(range.start).unwrap() } /// Subtable specific data. + #[inline] pub fn data(&self) -> &'a [u8] { let range = self.shape.data_byte_range(); self.data.read_array(range).unwrap() @@ -322,6 +335,7 @@ impl MinByteRange for AatSubtableMarker { } impl<'a> FontRead<'a> for AatSubtable<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -339,24 +353,28 @@ pub type AatSubtable<'a> = TableRef<'a, AatSubtableMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> AatSubtable<'a> { /// The length of this subtable in bytes, including this header. + #[inline] pub fn length(&self) -> u32 { let range = self.shape.length_byte_range(); self.data.read_at(range.start).unwrap() } /// Circumstances under which this table is used. + #[inline] pub fn coverage(&self) -> u16 { let range = self.shape.coverage_byte_range(); self.data.read_at(range.start).unwrap() } /// The tuple index (used for variations fonts). This value specifies which tuple this subtable covers. + #[inline] pub fn tuple_index(&self) -> u16 { let range = self.shape.tuple_index_byte_range(); self.data.read_at(range.start).unwrap() } /// Subtable specific data. + #[inline] pub fn data(&self) -> &'a [u8] { let range = self.shape.data_byte_range(); self.data.read_array(range).unwrap() @@ -428,6 +446,7 @@ impl MinByteRange for Subtable0Marker { } impl<'a> FontRead<'a> for Subtable0<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let n_pairs: u16 = cursor.read()?; @@ -448,30 +467,35 @@ pub type Subtable0<'a> = TableRef<'a, Subtable0Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> Subtable0<'a> { /// The number of kerning pairs in this subtable. + #[inline] pub fn n_pairs(&self) -> u16 { let range = self.shape.n_pairs_byte_range(); self.data.read_at(range.start).unwrap() } /// The largest power of two less than or equal to the value of nPairs, multiplied by the size in bytes of an entry in the subtable. + #[inline] pub fn search_range(&self) -> u16 { let range = self.shape.search_range_byte_range(); self.data.read_at(range.start).unwrap() } /// This is calculated as log2 of the largest power of two less than or equal to the value of nPairs. This value indicates how many iterations of the search loop have to be made. For example, in a list of eight items, there would be three iterations of the loop. + #[inline] pub fn entry_selector(&self) -> u16 { let range = self.shape.entry_selector_byte_range(); self.data.read_at(range.start).unwrap() } /// The value of nPairs minus the largest power of two less than or equal to nPairs. This is multiplied by the size in bytes of an entry in the table. + #[inline] pub fn range_shift(&self) -> u16 { let range = self.shape.range_shift_byte_range(); self.data.read_at(range.start).unwrap() } /// Kerning records. + #[inline] pub fn pairs(&self) -> &'a [Subtable0Pair] { let range = self.shape.pairs_byte_range(); self.data.read_array(range).unwrap() @@ -541,6 +565,7 @@ impl MinByteRange for Subtable2ClassTableMarker { } impl<'a> FontRead<'a> for Subtable2ClassTable<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -559,18 +584,21 @@ pub type Subtable2ClassTable<'a> = TableRef<'a, Subtable2ClassTableMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> Subtable2ClassTable<'a> { /// First glyph in class range. + #[inline] pub fn first_glyph(&self) -> GlyphId16 { let range = self.shape.first_glyph_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of glyph in class range. + #[inline] pub fn n_glyphs(&self) -> u16 { let range = self.shape.n_glyphs_byte_range(); self.data.read_at(range.start).unwrap() } /// The offsets array for all of the glyphs in the range. + #[inline] pub fn offsets(&self) -> &'a [BigEndian] { let range = self.shape.offsets_byte_range(); self.data.read_array(range).unwrap() @@ -664,6 +692,7 @@ impl MinByteRange for Subtable3Marker { } impl<'a> FontRead<'a> for Subtable3<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let glyph_count: u16 = cursor.read()?; @@ -703,54 +732,63 @@ pub type Subtable3<'a> = TableRef<'a, Subtable3Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> Subtable3<'a> { /// The number of glyphs in this font. + #[inline] pub fn glyph_count(&self) -> u16 { let range = self.shape.glyph_count_byte_range(); self.data.read_at(range.start).unwrap() } /// The number of kerning values. + #[inline] pub fn kern_value_count(&self) -> u8 { let range = self.shape.kern_value_count_byte_range(); self.data.read_at(range.start).unwrap() } /// The number of left-hand classes. + #[inline] pub fn left_class_count(&self) -> u8 { let range = self.shape.left_class_count_byte_range(); self.data.read_at(range.start).unwrap() } /// The number of right-hand classes. + #[inline] pub fn right_class_count(&self) -> u8 { let range = self.shape.right_class_count_byte_range(); self.data.read_at(range.start).unwrap() } /// Set to zero (reserved for future use). + #[inline] pub fn flags(&self) -> u8 { let range = self.shape.flags_byte_range(); self.data.read_at(range.start).unwrap() } /// The kerning values. + #[inline] pub fn kern_value(&self) -> &'a [BigEndian] { let range = self.shape.kern_value_byte_range(); self.data.read_array(range).unwrap() } /// The left-hand classes. + #[inline] pub fn left_class(&self) -> &'a [u8] { let range = self.shape.left_class_byte_range(); self.data.read_array(range).unwrap() } /// The right-hand classes. + #[inline] pub fn right_class(&self) -> &'a [u8] { let range = self.shape.right_class_byte_range(); self.data.read_array(range).unwrap() } /// The indices into the kernValue array. + #[inline] pub fn kern_index(&self) -> &'a [u8] { let range = self.shape.kern_index_byte_range(); self.data.read_array(range).unwrap() diff --git a/read-fonts/generated/generated_kerx.rs b/read-fonts/generated/generated_kerx.rs index 21880e467..b2699d9c8 100644 --- a/read-fonts/generated/generated_kerx.rs +++ b/read-fonts/generated/generated_kerx.rs @@ -46,6 +46,7 @@ impl TopLevelTable for Kerx<'_> { } impl<'a> FontRead<'a> for Kerx<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -66,17 +67,20 @@ pub type Kerx<'a> = TableRef<'a, KerxMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> Kerx<'a> { /// The version number of the extended kerning table (currently 2, 3, or 4) + #[inline] pub fn version(&self) -> u16 { let range = self.shape.version_byte_range(); self.data.read_at(range.start).unwrap() } /// The number of subtables included in the extended kerning table. + #[inline] pub fn n_tables(&self) -> u32 { let range = self.shape.n_tables_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn subtables(&self) -> VarLenArray<'a, Subtable<'a>> { let range = self.shape.subtables_byte_range(); VarLenArray::read(self.data.split_off(range.start).unwrap()).unwrap() @@ -145,6 +149,7 @@ impl MinByteRange for SubtableMarker { } impl<'a> FontRead<'a> for Subtable<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -162,24 +167,28 @@ pub type Subtable<'a> = TableRef<'a, SubtableMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> Subtable<'a> { /// The length of this subtable in bytes, including this header. + #[inline] pub fn length(&self) -> u32 { let range = self.shape.length_byte_range(); self.data.read_at(range.start).unwrap() } /// Circumstances under which this table is used. + #[inline] pub fn coverage(&self) -> u32 { let range = self.shape.coverage_byte_range(); self.data.read_at(range.start).unwrap() } /// The tuple count. This value is only used with variation fonts and should be 0 for all other fonts. The subtable's tupleCount will be ignored if the 'kerx' table version is less than 4. + #[inline] pub fn tuple_count(&self) -> u32 { let range = self.shape.tuple_count_byte_range(); self.data.read_at(range.start).unwrap() } /// Subtable specific data. + #[inline] pub fn data(&self) -> &'a [u8] { let range = self.shape.data_byte_range(); self.data.read_array(range).unwrap() @@ -251,6 +260,7 @@ impl MinByteRange for Subtable0Marker { } impl<'a> FontRead<'a> for Subtable0<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let n_pairs: u32 = cursor.read()?; @@ -271,30 +281,35 @@ pub type Subtable0<'a> = TableRef<'a, Subtable0Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> Subtable0<'a> { /// The number of kerning pairs in this subtable. + #[inline] pub fn n_pairs(&self) -> u32 { let range = self.shape.n_pairs_byte_range(); self.data.read_at(range.start).unwrap() } /// The largest power of two less than or equal to the value of nPairs, multiplied by the size in bytes of an entry in the subtable. + #[inline] pub fn search_range(&self) -> u32 { let range = self.shape.search_range_byte_range(); self.data.read_at(range.start).unwrap() } /// This is calculated as log2 of the largest power of two less than or equal to the value of nPairs. This value indicates how many iterations of the search loop have to be made. For example, in a list of eight items, there would be three iterations of the loop. + #[inline] pub fn entry_selector(&self) -> u32 { let range = self.shape.entry_selector_byte_range(); self.data.read_at(range.start).unwrap() } /// The value of nPairs minus the largest power of two less than or equal to nPairs. This is multiplied by the size in bytes of an entry in the table. + #[inline] pub fn range_shift(&self) -> u32 { let range = self.shape.range_shift_byte_range(); self.data.read_at(range.start).unwrap() } /// Kerning records. + #[inline] pub fn pairs(&self) -> &'a [Subtable0Pair] { let range = self.shape.pairs_byte_range(); self.data.read_array(range).unwrap() @@ -348,16 +363,19 @@ pub struct Subtable0Pair { impl Subtable0Pair { /// The glyph index for the lefthand glyph in the kerning pair. + #[inline] pub fn left(&self) -> GlyphId16 { self.left.get() } /// The glyph index for the righthand glyph in the kerning pair. + #[inline] pub fn right(&self) -> GlyphId16 { self.right.get() } /// Kerning value. + #[inline] pub fn value(&self) -> i16 { self.value.get() } diff --git a/read-fonts/generated/generated_layout.rs b/read-fonts/generated/generated_layout.rs index 3b4bb04e8..fd46c92ec 100644 --- a/read-fonts/generated/generated_layout.rs +++ b/read-fonts/generated/generated_layout.rs @@ -31,6 +31,7 @@ impl MinByteRange for ScriptListMarker { } impl<'a> FontRead<'a> for ScriptList<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let script_count: u16 = cursor.read()?; @@ -50,12 +51,14 @@ pub type ScriptList<'a> = TableRef<'a, ScriptListMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> ScriptList<'a> { /// Number of ScriptRecords + #[inline] pub fn script_count(&self) -> u16 { let range = self.shape.script_count_byte_range(); self.data.read_at(range.start).unwrap() } /// Array of ScriptRecords, listed alphabetically by script tag + #[inline] pub fn script_records(&self) -> &'a [ScriptRecord] { let range = self.shape.script_records_byte_range(); self.data.read_array(range).unwrap() @@ -104,11 +107,13 @@ pub struct ScriptRecord { impl ScriptRecord { /// 4-byte script tag identifier + #[inline] pub fn script_tag(&self) -> Tag { self.script_tag.get() } /// Offset to Script table, from beginning of ScriptList + #[inline] pub fn script_offset(&self) -> Offset16 { self.script_offset.get() } @@ -175,6 +180,7 @@ impl MinByteRange for ScriptMarker { } impl<'a> FontRead<'a> for Script<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -196,6 +202,7 @@ pub type Script<'a> = TableRef<'a, ScriptMarker>; impl<'a> Script<'a> { /// Offset to default LangSys table, from beginning of Script table /// — may be NULL + #[inline] pub fn default_lang_sys_offset(&self) -> Nullable { let range = self.shape.default_lang_sys_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -209,12 +216,14 @@ impl<'a> Script<'a> { /// Number of LangSysRecords for this script — excluding the /// default LangSys + #[inline] pub fn lang_sys_count(&self) -> u16 { let range = self.shape.lang_sys_count_byte_range(); self.data.read_at(range.start).unwrap() } /// Array of LangSysRecords, listed alphabetically by LangSys tag + #[inline] pub fn lang_sys_records(&self) -> &'a [LangSysRecord] { let range = self.shape.lang_sys_records_byte_range(); self.data.read_array(range).unwrap() @@ -266,11 +275,13 @@ pub struct LangSysRecord { impl LangSysRecord { /// 4-byte LangSysTag identifier + #[inline] pub fn lang_sys_tag(&self) -> Tag { self.lang_sys_tag.get() } /// Offset to LangSys table, from beginning of Script table + #[inline] pub fn lang_sys_offset(&self) -> Offset16 { self.lang_sys_offset.get() } @@ -342,6 +353,7 @@ impl MinByteRange for LangSysMarker { } impl<'a> FontRead<'a> for LangSys<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -364,6 +376,7 @@ pub type LangSys<'a> = TableRef<'a, LangSysMarker>; impl<'a> LangSys<'a> { /// Index of a feature required for this language system; if no /// required features = 0xFFFF + #[inline] pub fn required_feature_index(&self) -> u16 { let range = self.shape.required_feature_index_byte_range(); self.data.read_at(range.start).unwrap() @@ -371,12 +384,14 @@ impl<'a> LangSys<'a> { /// Number of feature index values for this language system — /// excludes the required feature + #[inline] pub fn feature_index_count(&self) -> u16 { let range = self.shape.feature_index_count_byte_range(); self.data.read_at(range.start).unwrap() } /// Array of indices into the FeatureList, in arbitrary order + #[inline] pub fn feature_indices(&self) -> &'a [BigEndian] { let range = self.shape.feature_indices_byte_range(); self.data.read_array(range).unwrap() @@ -438,6 +453,7 @@ impl MinByteRange for FeatureListMarker { } impl<'a> FontRead<'a> for FeatureList<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let feature_count: u16 = cursor.read()?; @@ -457,6 +473,7 @@ pub type FeatureList<'a> = TableRef<'a, FeatureListMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> FeatureList<'a> { /// Number of FeatureRecords in this table + #[inline] pub fn feature_count(&self) -> u16 { let range = self.shape.feature_count_byte_range(); self.data.read_at(range.start).unwrap() @@ -464,6 +481,7 @@ impl<'a> FeatureList<'a> { /// Array of FeatureRecords — zero-based (first feature has /// FeatureIndex = 0), listed alphabetically by feature tag + #[inline] pub fn feature_records(&self) -> &'a [FeatureRecord] { let range = self.shape.feature_records_byte_range(); self.data.read_array(range).unwrap() @@ -512,11 +530,13 @@ pub struct FeatureRecord { impl FeatureRecord { /// 4-byte feature identification tag + #[inline] pub fn feature_tag(&self) -> Tag { self.feature_tag.get() } /// Offset to Feature table, from beginning of FeatureList + #[inline] pub fn feature_offset(&self) -> Offset16 { self.feature_offset.get() } @@ -589,6 +609,7 @@ impl ReadArgs for Feature<'_> { } impl<'a> FontReadWithArgs<'a> for Feature<'a> { + #[inline] fn read_with_args(data: FontData<'a>, args: &Tag) -> Result { let feature_tag = *args; let mut cursor = data.cursor(); @@ -610,6 +631,7 @@ impl<'a> Feature<'a> { /// /// This type requires some external state in order to be /// parsed. + #[inline] pub fn read(data: FontData<'a>, feature_tag: Tag) -> Result { let args = feature_tag; Self::read_with_args(data, &args) @@ -622,6 +644,7 @@ pub type Feature<'a> = TableRef<'a, FeatureMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> Feature<'a> { /// Offset from start of Feature table to FeatureParams table, if defined for the feature and present, else NULL + #[inline] pub fn feature_params_offset(&self) -> Nullable { let range = self.shape.feature_params_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -635,6 +658,7 @@ impl<'a> Feature<'a> { } /// Number of LookupList indices for this feature + #[inline] pub fn lookup_index_count(&self) -> u16 { let range = self.shape.lookup_index_count_byte_range(); self.data.read_at(range.start).unwrap() @@ -642,6 +666,7 @@ impl<'a> Feature<'a> { /// Array of indices into the LookupList — zero-based (first /// lookup is LookupListIndex = 0) + #[inline] pub fn lookup_list_indices(&self) -> &'a [BigEndian] { let range = self.shape.lookup_list_indices_byte_range(); self.data.read_array(range).unwrap() @@ -716,6 +741,7 @@ impl Clone for LookupListMarker { impl Copy for LookupListMarker {} impl<'a, T> FontRead<'a> for LookupList<'a, T> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let lookup_count: u16 = cursor.read()?; @@ -765,6 +791,7 @@ pub type LookupList<'a, T> = TableRef<'a, LookupListMarker>; #[allow(clippy::needless_lifetimes)] impl<'a, T> LookupList<'a, T> { /// Number of lookups in this table + #[inline] pub fn lookup_count(&self) -> u16 { let range = self.shape.lookup_count_byte_range(); self.data.read_at(range.start).unwrap() @@ -772,6 +799,7 @@ impl<'a, T> LookupList<'a, T> { /// Array of offsets to Lookup tables, from beginning of LookupList /// — zero based (first lookup is Lookup index = 0) + #[inline] pub fn lookup_offsets(&self) -> &'a [BigEndian] { let range = self.shape.lookup_offsets_byte_range(); self.data.read_array(range).unwrap() @@ -874,6 +902,7 @@ impl Clone for LookupMarker { impl Copy for LookupMarker {} impl<'a, T> FontRead<'a> for Lookup<'a, T> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -935,18 +964,21 @@ pub type Lookup<'a, T> = TableRef<'a, LookupMarker>; #[allow(clippy::needless_lifetimes)] impl<'a, T> Lookup<'a, T> { /// Different enumerations for GSUB and GPOS + #[inline] pub fn lookup_type(&self) -> u16 { let range = self.shape.lookup_type_byte_range(); self.data.read_at(range.start).unwrap() } /// Lookup qualifiers + #[inline] pub fn lookup_flag(&self) -> LookupFlag { let range = self.shape.lookup_flag_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of subtables for this lookup + #[inline] pub fn sub_table_count(&self) -> u16 { let range = self.shape.sub_table_count_byte_range(); self.data.read_at(range.start).unwrap() @@ -954,6 +986,7 @@ impl<'a, T> Lookup<'a, T> { /// Array of offsets to lookup subtables, from beginning of Lookup /// table + #[inline] pub fn subtable_offsets(&self) -> &'a [BigEndian] { let range = self.shape.subtable_offsets_byte_range(); self.data.read_array(range).unwrap() @@ -972,6 +1005,7 @@ impl<'a, T> Lookup<'a, T> { /// Index (base 0) into GDEF mark glyph sets structure. This field /// is only present if the USE_MARK_FILTERING_SET lookup flag is /// set. + #[inline] pub fn mark_filtering_set(&self) -> Option { let range = self.shape.mark_filtering_set_byte_range()?; Some(self.data.read_at(range.start).unwrap()) @@ -1055,6 +1089,7 @@ impl MinByteRange for CoverageFormat1Marker { } impl<'a> FontRead<'a> for CoverageFormat1<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -1075,18 +1110,21 @@ pub type CoverageFormat1<'a> = TableRef<'a, CoverageFormat1Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> CoverageFormat1<'a> { /// Format identifier — format = 1 + #[inline] pub fn coverage_format(&self) -> u16 { let range = self.shape.coverage_format_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of glyphs in the glyph array + #[inline] pub fn glyph_count(&self) -> u16 { let range = self.shape.glyph_count_byte_range(); self.data.read_at(range.start).unwrap() } /// Array of glyph IDs — in numerical order + #[inline] pub fn glyph_array(&self) -> &'a [BigEndian] { let range = self.shape.glyph_array_byte_range(); self.data.read_array(range).unwrap() @@ -1151,6 +1189,7 @@ impl MinByteRange for CoverageFormat2Marker { } impl<'a> FontRead<'a> for CoverageFormat2<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -1171,18 +1210,21 @@ pub type CoverageFormat2<'a> = TableRef<'a, CoverageFormat2Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> CoverageFormat2<'a> { /// Format identifier — format = 2 + #[inline] pub fn coverage_format(&self) -> u16 { let range = self.shape.coverage_format_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of RangeRecords + #[inline] pub fn range_count(&self) -> u16 { let range = self.shape.range_count_byte_range(); self.data.read_at(range.start).unwrap() } /// Array of glyph ranges — ordered by startGlyphID. + #[inline] pub fn range_records(&self) -> &'a [RangeRecord] { let range = self.shape.range_records_byte_range(); self.data.read_array(range).unwrap() @@ -1234,16 +1276,19 @@ pub struct RangeRecord { impl RangeRecord { /// First glyph ID in the range + #[inline] pub fn start_glyph_id(&self) -> GlyphId16 { self.start_glyph_id.get() } /// Last glyph ID in the range + #[inline] pub fn end_glyph_id(&self) -> GlyphId16 { self.end_glyph_id.get() } /// Coverage Index of first glyph ID in range + #[inline] pub fn start_coverage_index(&self) -> u16 { self.start_coverage_index.get() } @@ -1385,6 +1430,7 @@ impl MinByteRange for ClassDefFormat1Marker { } impl<'a> FontRead<'a> for ClassDefFormat1<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -1406,24 +1452,28 @@ pub type ClassDefFormat1<'a> = TableRef<'a, ClassDefFormat1Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> ClassDefFormat1<'a> { /// Format identifier — format = 1 + #[inline] pub fn class_format(&self) -> u16 { let range = self.shape.class_format_byte_range(); self.data.read_at(range.start).unwrap() } /// First glyph ID of the classValueArray + #[inline] pub fn start_glyph_id(&self) -> GlyphId16 { let range = self.shape.start_glyph_id_byte_range(); self.data.read_at(range.start).unwrap() } /// Size of the classValueArray + #[inline] pub fn glyph_count(&self) -> u16 { let range = self.shape.glyph_count_byte_range(); self.data.read_at(range.start).unwrap() } /// Array of Class Values — one per glyph ID + #[inline] pub fn class_value_array(&self) -> &'a [BigEndian] { let range = self.shape.class_value_array_byte_range(); self.data.read_array(range).unwrap() @@ -1489,6 +1539,7 @@ impl MinByteRange for ClassDefFormat2Marker { } impl<'a> FontRead<'a> for ClassDefFormat2<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -1509,18 +1560,21 @@ pub type ClassDefFormat2<'a> = TableRef<'a, ClassDefFormat2Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> ClassDefFormat2<'a> { /// Format identifier — format = 2 + #[inline] pub fn class_format(&self) -> u16 { let range = self.shape.class_format_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of ClassRangeRecords + #[inline] pub fn class_range_count(&self) -> u16 { let range = self.shape.class_range_count_byte_range(); self.data.read_at(range.start).unwrap() } /// Array of ClassRangeRecords — ordered by startGlyphID + #[inline] pub fn class_range_records(&self) -> &'a [ClassRangeRecord] { let range = self.shape.class_range_records_byte_range(); self.data.read_array(range).unwrap() @@ -1572,16 +1626,19 @@ pub struct ClassRangeRecord { impl ClassRangeRecord { /// First glyph ID in the range + #[inline] pub fn start_glyph_id(&self) -> GlyphId16 { self.start_glyph_id.get() } /// Last glyph ID in the range + #[inline] pub fn end_glyph_id(&self) -> GlyphId16 { self.end_glyph_id.get() } /// Applied to all glyphs in the range + #[inline] pub fn class(&self) -> u16 { self.class.get() } @@ -1693,11 +1750,13 @@ pub struct SequenceLookupRecord { impl SequenceLookupRecord { /// Index (zero-based) into the input glyph sequence + #[inline] pub fn sequence_index(&self) -> u16 { self.sequence_index.get() } /// Index (zero-based) into the LookupList + #[inline] pub fn lookup_list_index(&self) -> u16 { self.lookup_list_index.get() } @@ -1762,6 +1821,7 @@ impl MinByteRange for SequenceContextFormat1Marker { } impl<'a> FontRead<'a> for SequenceContextFormat1<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -1783,6 +1843,7 @@ pub type SequenceContextFormat1<'a> = TableRef<'a, SequenceContextFormat1Marker> #[allow(clippy::needless_lifetimes)] impl<'a> SequenceContextFormat1<'a> { /// Format identifier: format = 1 + #[inline] pub fn format(&self) -> u16 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() @@ -1790,6 +1851,7 @@ impl<'a> SequenceContextFormat1<'a> { /// Offset to Coverage table, from beginning of /// SequenceContextFormat1 table + #[inline] pub fn coverage_offset(&self) -> Offset16 { let range = self.shape.coverage_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -1802,6 +1864,7 @@ impl<'a> SequenceContextFormat1<'a> { } /// Number of SequenceRuleSet tables + #[inline] pub fn seq_rule_set_count(&self) -> u16 { let range = self.shape.seq_rule_set_count_byte_range(); self.data.read_at(range.start).unwrap() @@ -1809,6 +1872,7 @@ impl<'a> SequenceContextFormat1<'a> { /// Array of offsets to SequenceRuleSet tables, from beginning of /// SequenceContextFormat1 table (offsets may be NULL) + #[inline] pub fn seq_rule_set_offsets(&self) -> &'a [BigEndian>] { let range = self.shape.seq_rule_set_offsets_byte_range(); self.data.read_array(range).unwrap() @@ -1888,6 +1952,7 @@ impl MinByteRange for SequenceRuleSetMarker { } impl<'a> FontRead<'a> for SequenceRuleSet<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let seq_rule_count: u16 = cursor.read()?; @@ -1907,6 +1972,7 @@ pub type SequenceRuleSet<'a> = TableRef<'a, SequenceRuleSetMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> SequenceRuleSet<'a> { /// Number of SequenceRule tables + #[inline] pub fn seq_rule_count(&self) -> u16 { let range = self.shape.seq_rule_count_byte_range(); self.data.read_at(range.start).unwrap() @@ -1914,6 +1980,7 @@ impl<'a> SequenceRuleSet<'a> { /// Array of offsets to SequenceRule tables, from beginning of the /// SequenceRuleSet table + #[inline] pub fn seq_rule_offsets(&self) -> &'a [BigEndian] { let range = self.shape.seq_rule_offsets_byte_range(); self.data.read_array(range).unwrap() @@ -1999,6 +2066,7 @@ impl MinByteRange for SequenceRuleMarker { } impl<'a> FontRead<'a> for SequenceRule<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let glyph_count: u16 = cursor.read()?; @@ -2024,24 +2092,28 @@ pub type SequenceRule<'a> = TableRef<'a, SequenceRuleMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> SequenceRule<'a> { /// Number of glyphs in the input glyph sequence + #[inline] pub fn glyph_count(&self) -> u16 { let range = self.shape.glyph_count_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of SequenceLookupRecords + #[inline] pub fn seq_lookup_count(&self) -> u16 { let range = self.shape.seq_lookup_count_byte_range(); self.data.read_at(range.start).unwrap() } /// Array of input glyph IDs—starting with the second glyph + #[inline] pub fn input_sequence(&self) -> &'a [BigEndian] { let range = self.shape.input_sequence_byte_range(); self.data.read_array(range).unwrap() } /// Array of Sequence lookup records + #[inline] pub fn seq_lookup_records(&self) -> &'a [SequenceLookupRecord] { let range = self.shape.seq_lookup_records_byte_range(); self.data.read_array(range).unwrap() @@ -2124,6 +2196,7 @@ impl MinByteRange for SequenceContextFormat2Marker { } impl<'a> FontRead<'a> for SequenceContextFormat2<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -2146,6 +2219,7 @@ pub type SequenceContextFormat2<'a> = TableRef<'a, SequenceContextFormat2Marker> #[allow(clippy::needless_lifetimes)] impl<'a> SequenceContextFormat2<'a> { /// Format identifier: format = 2 + #[inline] pub fn format(&self) -> u16 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() @@ -2153,6 +2227,7 @@ impl<'a> SequenceContextFormat2<'a> { /// Offset to Coverage table, from beginning of /// SequenceContextFormat2 table + #[inline] pub fn coverage_offset(&self) -> Offset16 { let range = self.shape.coverage_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -2166,6 +2241,7 @@ impl<'a> SequenceContextFormat2<'a> { /// Offset to ClassDef table, from beginning of /// SequenceContextFormat2 table + #[inline] pub fn class_def_offset(&self) -> Offset16 { let range = self.shape.class_def_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -2178,6 +2254,7 @@ impl<'a> SequenceContextFormat2<'a> { } /// Number of ClassSequenceRuleSet tables + #[inline] pub fn class_seq_rule_set_count(&self) -> u16 { let range = self.shape.class_seq_rule_set_count_byte_range(); self.data.read_at(range.start).unwrap() @@ -2185,6 +2262,7 @@ impl<'a> SequenceContextFormat2<'a> { /// Array of offsets to ClassSequenceRuleSet tables, from beginning /// of SequenceContextFormat2 table (may be NULL) + #[inline] pub fn class_seq_rule_set_offsets(&self) -> &'a [BigEndian>] { let range = self.shape.class_seq_rule_set_offsets_byte_range(); self.data.read_array(range).unwrap() @@ -2273,6 +2351,7 @@ impl MinByteRange for ClassSequenceRuleSetMarker { } impl<'a> FontRead<'a> for ClassSequenceRuleSet<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let class_seq_rule_count: u16 = cursor.read()?; @@ -2292,6 +2371,7 @@ pub type ClassSequenceRuleSet<'a> = TableRef<'a, ClassSequenceRuleSetMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> ClassSequenceRuleSet<'a> { /// Number of ClassSequenceRule tables + #[inline] pub fn class_seq_rule_count(&self) -> u16 { let range = self.shape.class_seq_rule_count_byte_range(); self.data.read_at(range.start).unwrap() @@ -2299,6 +2379,7 @@ impl<'a> ClassSequenceRuleSet<'a> { /// Array of offsets to ClassSequenceRule tables, from beginning of /// ClassSequenceRuleSet table + #[inline] pub fn class_seq_rule_offsets(&self) -> &'a [BigEndian] { let range = self.shape.class_seq_rule_offsets_byte_range(); self.data.read_array(range).unwrap() @@ -2387,6 +2468,7 @@ impl MinByteRange for ClassSequenceRuleMarker { } impl<'a> FontRead<'a> for ClassSequenceRule<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let glyph_count: u16 = cursor.read()?; @@ -2412,12 +2494,14 @@ pub type ClassSequenceRule<'a> = TableRef<'a, ClassSequenceRuleMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> ClassSequenceRule<'a> { /// Number of glyphs to be matched + #[inline] pub fn glyph_count(&self) -> u16 { let range = self.shape.glyph_count_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of SequenceLookupRecords + #[inline] pub fn seq_lookup_count(&self) -> u16 { let range = self.shape.seq_lookup_count_byte_range(); self.data.read_at(range.start).unwrap() @@ -2425,12 +2509,14 @@ impl<'a> ClassSequenceRule<'a> { /// Sequence of classes to be matched to the input glyph sequence, /// beginning with the second glyph position + #[inline] pub fn input_sequence(&self) -> &'a [BigEndian] { let range = self.shape.input_sequence_byte_range(); self.data.read_array(range).unwrap() } /// Array of SequenceLookupRecords + #[inline] pub fn seq_lookup_records(&self) -> &'a [SequenceLookupRecord] { let range = self.shape.seq_lookup_records_byte_range(); self.data.read_array(range).unwrap() @@ -2514,6 +2600,7 @@ impl MinByteRange for SequenceContextFormat3Marker { } impl<'a> FontRead<'a> for SequenceContextFormat3<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -2540,18 +2627,21 @@ pub type SequenceContextFormat3<'a> = TableRef<'a, SequenceContextFormat3Marker> #[allow(clippy::needless_lifetimes)] impl<'a> SequenceContextFormat3<'a> { /// Format identifier: format = 3 + #[inline] pub fn format(&self) -> u16 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of glyphs in the input sequence + #[inline] pub fn glyph_count(&self) -> u16 { let range = self.shape.glyph_count_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of SequenceLookupRecords + #[inline] pub fn seq_lookup_count(&self) -> u16 { let range = self.shape.seq_lookup_count_byte_range(); self.data.read_at(range.start).unwrap() @@ -2559,6 +2649,7 @@ impl<'a> SequenceContextFormat3<'a> { /// Array of offsets to Coverage tables, from beginning of /// SequenceContextFormat3 subtable + #[inline] pub fn coverage_offsets(&self) -> &'a [BigEndian] { let range = self.shape.coverage_offsets_byte_range(); self.data.read_array(range).unwrap() @@ -2572,6 +2663,7 @@ impl<'a> SequenceContextFormat3<'a> { } /// Array of SequenceLookupRecords + #[inline] pub fn seq_lookup_records(&self) -> &'a [SequenceLookupRecord] { let range = self.shape.seq_lookup_records_byte_range(); self.data.read_array(range).unwrap() @@ -2740,6 +2832,7 @@ impl MinByteRange for ChainedSequenceContextFormat1Marker { } impl<'a> FontRead<'a> for ChainedSequenceContextFormat1<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -2761,6 +2854,7 @@ pub type ChainedSequenceContextFormat1<'a> = TableRef<'a, ChainedSequenceContext #[allow(clippy::needless_lifetimes)] impl<'a> ChainedSequenceContextFormat1<'a> { /// Format identifier: format = 1 + #[inline] pub fn format(&self) -> u16 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() @@ -2768,6 +2862,7 @@ impl<'a> ChainedSequenceContextFormat1<'a> { /// Offset to Coverage table, from beginning of /// ChainSequenceContextFormat1 table + #[inline] pub fn coverage_offset(&self) -> Offset16 { let range = self.shape.coverage_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -2780,6 +2875,7 @@ impl<'a> ChainedSequenceContextFormat1<'a> { } /// Number of ChainedSequenceRuleSet tables + #[inline] pub fn chained_seq_rule_set_count(&self) -> u16 { let range = self.shape.chained_seq_rule_set_count_byte_range(); self.data.read_at(range.start).unwrap() @@ -2787,6 +2883,7 @@ impl<'a> ChainedSequenceContextFormat1<'a> { /// Array of offsets to ChainedSeqRuleSet tables, from beginning of /// ChainedSequenceContextFormat1 table (may be NULL) + #[inline] pub fn chained_seq_rule_set_offsets(&self) -> &'a [BigEndian>] { let range = self.shape.chained_seq_rule_set_offsets_byte_range(); self.data.read_array(range).unwrap() @@ -2871,6 +2968,7 @@ impl MinByteRange for ChainedSequenceRuleSetMarker { } impl<'a> FontRead<'a> for ChainedSequenceRuleSet<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let chained_seq_rule_count: u16 = cursor.read()?; @@ -2890,6 +2988,7 @@ pub type ChainedSequenceRuleSet<'a> = TableRef<'a, ChainedSequenceRuleSetMarker> #[allow(clippy::needless_lifetimes)] impl<'a> ChainedSequenceRuleSet<'a> { /// Number of ChainedSequenceRule tables + #[inline] pub fn chained_seq_rule_count(&self) -> u16 { let range = self.shape.chained_seq_rule_count_byte_range(); self.data.read_at(range.start).unwrap() @@ -2897,6 +2996,7 @@ impl<'a> ChainedSequenceRuleSet<'a> { /// Array of offsets to ChainedSequenceRule tables, from beginning /// of ChainedSequenceRuleSet table + #[inline] pub fn chained_seq_rule_offsets(&self) -> &'a [BigEndian] { let range = self.shape.chained_seq_rule_offsets_byte_range(); self.data.read_array(range).unwrap() @@ -3007,6 +3107,7 @@ impl MinByteRange for ChainedSequenceRuleMarker { } impl<'a> FontRead<'a> for ChainedSequenceRule<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let backtrack_glyph_count: u16 = cursor.read()?; @@ -3044,48 +3145,56 @@ pub type ChainedSequenceRule<'a> = TableRef<'a, ChainedSequenceRuleMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> ChainedSequenceRule<'a> { /// Number of glyphs in the backtrack sequence + #[inline] pub fn backtrack_glyph_count(&self) -> u16 { let range = self.shape.backtrack_glyph_count_byte_range(); self.data.read_at(range.start).unwrap() } /// Array of backtrack glyph IDs + #[inline] pub fn backtrack_sequence(&self) -> &'a [BigEndian] { let range = self.shape.backtrack_sequence_byte_range(); self.data.read_array(range).unwrap() } /// Number of glyphs in the input sequence + #[inline] pub fn input_glyph_count(&self) -> u16 { let range = self.shape.input_glyph_count_byte_range(); self.data.read_at(range.start).unwrap() } /// Array of input glyph IDs—start with second glyph + #[inline] pub fn input_sequence(&self) -> &'a [BigEndian] { let range = self.shape.input_sequence_byte_range(); self.data.read_array(range).unwrap() } /// Number of glyphs in the lookahead sequence + #[inline] pub fn lookahead_glyph_count(&self) -> u16 { let range = self.shape.lookahead_glyph_count_byte_range(); self.data.read_at(range.start).unwrap() } /// Array of lookahead glyph IDs + #[inline] pub fn lookahead_sequence(&self) -> &'a [BigEndian] { let range = self.shape.lookahead_sequence_byte_range(); self.data.read_array(range).unwrap() } /// Number of SequenceLookupRecords + #[inline] pub fn seq_lookup_count(&self) -> u16 { let range = self.shape.seq_lookup_count_byte_range(); self.data.read_at(range.start).unwrap() } /// Array of SequenceLookupRecords + #[inline] pub fn seq_lookup_records(&self) -> &'a [SequenceLookupRecord] { let range = self.shape.seq_lookup_records_byte_range(); self.data.read_array(range).unwrap() @@ -3188,6 +3297,7 @@ impl MinByteRange for ChainedSequenceContextFormat2Marker { } impl<'a> FontRead<'a> for ChainedSequenceContextFormat2<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -3213,6 +3323,7 @@ pub type ChainedSequenceContextFormat2<'a> = TableRef<'a, ChainedSequenceContext #[allow(clippy::needless_lifetimes)] impl<'a> ChainedSequenceContextFormat2<'a> { /// Format identifier: format = 2 + #[inline] pub fn format(&self) -> u16 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() @@ -3220,6 +3331,7 @@ impl<'a> ChainedSequenceContextFormat2<'a> { /// Offset to Coverage table, from beginning of /// ChainedSequenceContextFormat2 table + #[inline] pub fn coverage_offset(&self) -> Offset16 { let range = self.shape.coverage_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -3233,6 +3345,7 @@ impl<'a> ChainedSequenceContextFormat2<'a> { /// Offset to ClassDef table containing backtrack sequence context, /// from beginning of ChainedSequenceContextFormat2 table + #[inline] pub fn backtrack_class_def_offset(&self) -> Offset16 { let range = self.shape.backtrack_class_def_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -3246,6 +3359,7 @@ impl<'a> ChainedSequenceContextFormat2<'a> { /// Offset to ClassDef table containing input sequence context, /// from beginning of ChainedSequenceContextFormat2 table + #[inline] pub fn input_class_def_offset(&self) -> Offset16 { let range = self.shape.input_class_def_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -3259,6 +3373,7 @@ impl<'a> ChainedSequenceContextFormat2<'a> { /// Offset to ClassDef table containing lookahead sequence context, /// from beginning of ChainedSequenceContextFormat2 table + #[inline] pub fn lookahead_class_def_offset(&self) -> Offset16 { let range = self.shape.lookahead_class_def_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -3271,6 +3386,7 @@ impl<'a> ChainedSequenceContextFormat2<'a> { } /// Number of ChainedClassSequenceRuleSet tables + #[inline] pub fn chained_class_seq_rule_set_count(&self) -> u16 { let range = self.shape.chained_class_seq_rule_set_count_byte_range(); self.data.read_at(range.start).unwrap() @@ -3278,6 +3394,7 @@ impl<'a> ChainedSequenceContextFormat2<'a> { /// Array of offsets to ChainedClassSequenceRuleSet tables, from /// beginning of ChainedSequenceContextFormat2 table (may be NULL) + #[inline] pub fn chained_class_seq_rule_set_offsets(&self) -> &'a [BigEndian>] { let range = self.shape.chained_class_seq_rule_set_offsets_byte_range(); self.data.read_array(range).unwrap() @@ -3380,6 +3497,7 @@ impl MinByteRange for ChainedClassSequenceRuleSetMarker { } impl<'a> FontRead<'a> for ChainedClassSequenceRuleSet<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let chained_class_seq_rule_count: u16 = cursor.read()?; @@ -3399,6 +3517,7 @@ pub type ChainedClassSequenceRuleSet<'a> = TableRef<'a, ChainedClassSequenceRule #[allow(clippy::needless_lifetimes)] impl<'a> ChainedClassSequenceRuleSet<'a> { /// Number of ChainedClassSequenceRule tables + #[inline] pub fn chained_class_seq_rule_count(&self) -> u16 { let range = self.shape.chained_class_seq_rule_count_byte_range(); self.data.read_at(range.start).unwrap() @@ -3406,6 +3525,7 @@ impl<'a> ChainedClassSequenceRuleSet<'a> { /// Array of offsets to ChainedClassSequenceRule tables, from /// beginning of ChainedClassSequenceRuleSet + #[inline] pub fn chained_class_seq_rule_offsets(&self) -> &'a [BigEndian] { let range = self.shape.chained_class_seq_rule_offsets_byte_range(); self.data.read_array(range).unwrap() @@ -3518,6 +3638,7 @@ impl MinByteRange for ChainedClassSequenceRuleMarker { } impl<'a> FontRead<'a> for ChainedClassSequenceRule<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let backtrack_glyph_count: u16 = cursor.read()?; @@ -3555,18 +3676,21 @@ pub type ChainedClassSequenceRule<'a> = TableRef<'a, ChainedClassSequenceRuleMar #[allow(clippy::needless_lifetimes)] impl<'a> ChainedClassSequenceRule<'a> { /// Number of glyphs in the backtrack sequence + #[inline] pub fn backtrack_glyph_count(&self) -> u16 { let range = self.shape.backtrack_glyph_count_byte_range(); self.data.read_at(range.start).unwrap() } /// Array of backtrack-sequence classes + #[inline] pub fn backtrack_sequence(&self) -> &'a [BigEndian] { let range = self.shape.backtrack_sequence_byte_range(); self.data.read_array(range).unwrap() } /// Total number of glyphs in the input sequence + #[inline] pub fn input_glyph_count(&self) -> u16 { let range = self.shape.input_glyph_count_byte_range(); self.data.read_at(range.start).unwrap() @@ -3574,30 +3698,35 @@ impl<'a> ChainedClassSequenceRule<'a> { /// Array of input sequence classes, beginning with the second /// glyph position + #[inline] pub fn input_sequence(&self) -> &'a [BigEndian] { let range = self.shape.input_sequence_byte_range(); self.data.read_array(range).unwrap() } /// Number of glyphs in the lookahead sequence + #[inline] pub fn lookahead_glyph_count(&self) -> u16 { let range = self.shape.lookahead_glyph_count_byte_range(); self.data.read_at(range.start).unwrap() } /// Array of lookahead-sequence classes + #[inline] pub fn lookahead_sequence(&self) -> &'a [BigEndian] { let range = self.shape.lookahead_sequence_byte_range(); self.data.read_array(range).unwrap() } /// Number of SequenceLookupRecords + #[inline] pub fn seq_lookup_count(&self) -> u16 { let range = self.shape.seq_lookup_count_byte_range(); self.data.read_at(range.start).unwrap() } /// Array of SequenceLookupRecords + #[inline] pub fn seq_lookup_records(&self) -> &'a [SequenceLookupRecord] { let range = self.shape.seq_lookup_records_byte_range(); self.data.read_array(range).unwrap() @@ -3713,6 +3842,7 @@ impl MinByteRange for ChainedSequenceContextFormat3Marker { } impl<'a> FontRead<'a> for ChainedSequenceContextFormat3<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -3751,18 +3881,21 @@ pub type ChainedSequenceContextFormat3<'a> = TableRef<'a, ChainedSequenceContext #[allow(clippy::needless_lifetimes)] impl<'a> ChainedSequenceContextFormat3<'a> { /// Format identifier: format = 3 + #[inline] pub fn format(&self) -> u16 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of glyphs in the backtrack sequence + #[inline] pub fn backtrack_glyph_count(&self) -> u16 { let range = self.shape.backtrack_glyph_count_byte_range(); self.data.read_at(range.start).unwrap() } /// Array of offsets to coverage tables for the backtrack sequence + #[inline] pub fn backtrack_coverage_offsets(&self) -> &'a [BigEndian] { let range = self.shape.backtrack_coverage_offsets_byte_range(); self.data.read_array(range).unwrap() @@ -3776,12 +3909,14 @@ impl<'a> ChainedSequenceContextFormat3<'a> { } /// Number of glyphs in the input sequence + #[inline] pub fn input_glyph_count(&self) -> u16 { let range = self.shape.input_glyph_count_byte_range(); self.data.read_at(range.start).unwrap() } /// Array of offsets to coverage tables for the input sequence + #[inline] pub fn input_coverage_offsets(&self) -> &'a [BigEndian] { let range = self.shape.input_coverage_offsets_byte_range(); self.data.read_array(range).unwrap() @@ -3795,12 +3930,14 @@ impl<'a> ChainedSequenceContextFormat3<'a> { } /// Number of glyphs in the lookahead sequence + #[inline] pub fn lookahead_glyph_count(&self) -> u16 { let range = self.shape.lookahead_glyph_count_byte_range(); self.data.read_at(range.start).unwrap() } /// Array of offsets to coverage tables for the lookahead sequence + #[inline] pub fn lookahead_coverage_offsets(&self) -> &'a [BigEndian] { let range = self.shape.lookahead_coverage_offsets_byte_range(); self.data.read_array(range).unwrap() @@ -3814,12 +3951,14 @@ impl<'a> ChainedSequenceContextFormat3<'a> { } /// Number of SequenceLookupRecords + #[inline] pub fn seq_lookup_count(&self) -> u16 { let range = self.shape.seq_lookup_count_byte_range(); self.data.read_at(range.start).unwrap() } /// Array of SequenceLookupRecords + #[inline] pub fn seq_lookup_records(&self) -> &'a [SequenceLookupRecord] { let range = self.shape.seq_lookup_records_byte_range(); self.data.read_array(range).unwrap() @@ -4074,6 +4213,7 @@ impl MinByteRange for DeviceMarker { } impl<'a> FontRead<'a> for Device<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let start_size: u16 = cursor.read()?; @@ -4095,24 +4235,28 @@ pub type Device<'a> = TableRef<'a, DeviceMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> Device<'a> { /// Smallest size to correct, in ppem + #[inline] pub fn start_size(&self) -> u16 { let range = self.shape.start_size_byte_range(); self.data.read_at(range.start).unwrap() } /// Largest size to correct, in ppem + #[inline] pub fn end_size(&self) -> u16 { let range = self.shape.end_size_byte_range(); self.data.read_at(range.start).unwrap() } /// Format of deltaValue array data: 0x0001, 0x0002, or 0x0003 + #[inline] pub fn delta_format(&self) -> DeltaFormat { let range = self.shape.delta_format_byte_range(); self.data.read_at(range.start).unwrap() } /// Array of compressed data + #[inline] pub fn delta_value(&self) -> &'a [BigEndian] { let range = self.shape.delta_value_byte_range(); self.data.read_array(range).unwrap() @@ -4172,6 +4316,7 @@ impl MinByteRange for VariationIndexMarker { } impl<'a> FontRead<'a> for VariationIndex<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -4188,6 +4333,7 @@ pub type VariationIndex<'a> = TableRef<'a, VariationIndexMarker>; impl<'a> VariationIndex<'a> { /// A delta-set outer index — used to select an item variation /// data subtable within the item variation store. + #[inline] pub fn delta_set_outer_index(&self) -> u16 { let range = self.shape.delta_set_outer_index_byte_range(); self.data.read_at(range.start).unwrap() @@ -4195,12 +4341,14 @@ impl<'a> VariationIndex<'a> { /// A delta-set inner index — used to select a delta-set row /// within an item variation data subtable. + #[inline] pub fn delta_set_inner_index(&self) -> u16 { let range = self.shape.delta_set_inner_index_byte_range(); self.data.read_at(range.start).unwrap() } /// Format, = 0x8000 + #[inline] pub fn delta_format(&self) -> DeltaFormat { let range = self.shape.delta_format_byte_range(); self.data.read_at(range.start).unwrap() @@ -4337,6 +4485,7 @@ impl MinByteRange for FeatureVariationsMarker { } impl<'a> FontRead<'a> for FeatureVariations<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -4356,18 +4505,21 @@ pub type FeatureVariations<'a> = TableRef<'a, FeatureVariationsMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> FeatureVariations<'a> { + #[inline] pub fn version(&self) -> MajorMinor { let range = self.shape.version_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of feature variation records. + #[inline] pub fn feature_variation_record_count(&self) -> u32 { let range = self.shape.feature_variation_record_count_byte_range(); self.data.read_at(range.start).unwrap() } /// Array of feature variation records. + #[inline] pub fn feature_variation_records(&self) -> &'a [FeatureVariationRecord] { let range = self.shape.feature_variation_records_byte_range(); self.data.read_array(range).unwrap() @@ -4423,6 +4575,7 @@ pub struct FeatureVariationRecord { impl FeatureVariationRecord { /// Offset to a condition set table, from beginning of /// FeatureVariations table. + #[inline] pub fn condition_set_offset(&self) -> Nullable { self.condition_set_offset.get() } @@ -4441,6 +4594,7 @@ impl FeatureVariationRecord { /// Offset to a feature table substitution table, from beginning of /// the FeatureVariations table. + #[inline] pub fn feature_table_substitution_offset(&self) -> Nullable { self.feature_table_substitution_offset.get() } @@ -4512,6 +4666,7 @@ impl MinByteRange for ConditionSetMarker { } impl<'a> FontRead<'a> for ConditionSet<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let condition_count: u16 = cursor.read()?; @@ -4531,6 +4686,7 @@ pub type ConditionSet<'a> = TableRef<'a, ConditionSetMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> ConditionSet<'a> { /// Number of conditions for this condition set. + #[inline] pub fn condition_count(&self) -> u16 { let range = self.shape.condition_count_byte_range(); self.data.read_at(range.start).unwrap() @@ -4538,6 +4694,7 @@ impl<'a> ConditionSet<'a> { /// Array of offsets to condition tables, from beginning of the /// ConditionSet table. + #[inline] pub fn condition_offsets(&self) -> &'a [BigEndian] { let range = self.shape.condition_offsets_byte_range(); self.data.read_array(range).unwrap() @@ -4717,6 +4874,7 @@ impl MinByteRange for ConditionFormat1Marker { } impl<'a> FontRead<'a> for ConditionFormat1<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -4733,6 +4891,7 @@ pub type ConditionFormat1<'a> = TableRef<'a, ConditionFormat1Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> ConditionFormat1<'a> { /// Format, = 1 + #[inline] pub fn format(&self) -> u16 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() @@ -4740,6 +4899,7 @@ impl<'a> ConditionFormat1<'a> { /// Index (zero-based) for the variation axis within the 'fvar' /// table. + #[inline] pub fn axis_index(&self) -> u16 { let range = self.shape.axis_index_byte_range(); self.data.read_at(range.start).unwrap() @@ -4747,6 +4907,7 @@ impl<'a> ConditionFormat1<'a> { /// Minimum value of the font variation instances that satisfy this /// condition. + #[inline] pub fn filter_range_min_value(&self) -> F2Dot14 { let range = self.shape.filter_range_min_value_byte_range(); self.data.read_at(range.start).unwrap() @@ -4754,6 +4915,7 @@ impl<'a> ConditionFormat1<'a> { /// Maximum value of the font variation instances that satisfy this /// condition. + #[inline] pub fn filter_range_max_value(&self) -> F2Dot14 { let range = self.shape.filter_range_max_value_byte_range(); self.data.read_at(range.start).unwrap() @@ -4823,6 +4985,7 @@ impl MinByteRange for ConditionFormat2Marker { } impl<'a> FontRead<'a> for ConditionFormat2<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -4838,18 +5001,21 @@ pub type ConditionFormat2<'a> = TableRef<'a, ConditionFormat2Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> ConditionFormat2<'a> { /// Format, = 2 + #[inline] pub fn format(&self) -> u16 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Value at default instance. + #[inline] pub fn default_value(&self) -> i16 { let range = self.shape.default_value_byte_range(); self.data.read_at(range.start).unwrap() } /// Variation index to vary the value based on current designspace location. + #[inline] pub fn var_index(&self) -> u32 { let range = self.shape.var_index_byte_range(); self.data.read_at(range.start).unwrap() @@ -4914,6 +5080,7 @@ impl MinByteRange for ConditionFormat3Marker { } impl<'a> FontRead<'a> for ConditionFormat3<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -4934,18 +5101,21 @@ pub type ConditionFormat3<'a> = TableRef<'a, ConditionFormat3Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> ConditionFormat3<'a> { /// Format, = 3 + #[inline] pub fn format(&self) -> u16 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of conditions. + #[inline] pub fn condition_count(&self) -> u8 { let range = self.shape.condition_count_byte_range(); self.data.read_at(range.start).unwrap() } /// Array of condition tables for this conjunction (AND) expression. + #[inline] pub fn condition_offsets(&self) -> &'a [BigEndian] { let range = self.shape.condition_offsets_byte_range(); self.data.read_array(range).unwrap() @@ -5030,6 +5200,7 @@ impl MinByteRange for ConditionFormat4Marker { } impl<'a> FontRead<'a> for ConditionFormat4<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -5050,18 +5221,21 @@ pub type ConditionFormat4<'a> = TableRef<'a, ConditionFormat4Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> ConditionFormat4<'a> { /// Format, = 4 + #[inline] pub fn format(&self) -> u16 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of conditions. + #[inline] pub fn condition_count(&self) -> u8 { let range = self.shape.condition_count_byte_range(); self.data.read_at(range.start).unwrap() } /// Array of condition tables for this disjunction (OR) expression. + #[inline] pub fn condition_offsets(&self) -> &'a [BigEndian] { let range = self.shape.condition_offsets_byte_range(); self.data.read_array(range).unwrap() @@ -5139,6 +5313,7 @@ impl MinByteRange for ConditionFormat5Marker { } impl<'a> FontRead<'a> for ConditionFormat5<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -5153,12 +5328,14 @@ pub type ConditionFormat5<'a> = TableRef<'a, ConditionFormat5Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> ConditionFormat5<'a> { /// Format, = 5 + #[inline] pub fn format(&self) -> u16 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Condition to negate. + #[inline] pub fn condition_offset(&self) -> Offset24 { let range = self.shape.condition_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -5227,6 +5404,7 @@ impl MinByteRange for FeatureTableSubstitutionMarker { } impl<'a> FontRead<'a> for FeatureTableSubstitution<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -5247,18 +5425,21 @@ pub type FeatureTableSubstitution<'a> = TableRef<'a, FeatureTableSubstitutionMar #[allow(clippy::needless_lifetimes)] impl<'a> FeatureTableSubstitution<'a> { /// Major & minor version of the table: (1, 0) + #[inline] pub fn version(&self) -> MajorMinor { let range = self.shape.version_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of feature table substitution records. + #[inline] pub fn substitution_count(&self) -> u16 { let range = self.shape.substitution_count_byte_range(); self.data.read_at(range.start).unwrap() } /// Array of feature table substitution records. + #[inline] pub fn substitutions(&self) -> &'a [FeatureTableSubstitutionRecord] { let range = self.shape.substitutions_byte_range(); self.data.read_array(range).unwrap() @@ -5309,12 +5490,14 @@ pub struct FeatureTableSubstitutionRecord { impl FeatureTableSubstitutionRecord { /// The feature table index to match. + #[inline] pub fn feature_index(&self) -> u16 { self.feature_index.get() } /// Offset to an alternate feature table, from start of the /// FeatureTableSubstitution table. + #[inline] pub fn alternate_feature_offset(&self) -> Offset32 { self.alternate_feature_offset.get() } @@ -5383,6 +5566,7 @@ impl MinByteRange for SizeParamsMarker { } impl<'a> FontRead<'a> for SizeParams<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -5402,6 +5586,7 @@ impl<'a> SizeParams<'a> { /// /// The design size entry must be non-zero. When there is a design size but /// no recommended size range, the rest of the array will consist of zeros. + #[inline] pub fn design_size(&self) -> u16 { let range = self.shape.design_size_byte_range(); self.data.read_at(range.start).unwrap() @@ -5413,6 +5598,7 @@ impl<'a> SizeParams<'a> { /// only by size range shall have the same subfamily value, and no fonts /// which differ in weight or style shall have the same subfamily value. /// If this value is zero, the remaining fields in the array will be ignored. + #[inline] pub fn identifier(&self) -> u16 { let range = self.shape.identifier_byte_range(); self.data.read_at(range.start).unwrap() @@ -5428,6 +5614,7 @@ impl<'a> SizeParams<'a> { /// an application should use, in combination with the family name, to /// represent the subfamily in a menu. Applications will choose the /// appropriate version based on their selection criteria. + #[inline] pub fn name_entry(&self) -> u16 { let range = self.shape.name_entry_byte_range(); self.data.read_at(range.start).unwrap() @@ -5438,11 +5625,13 @@ impl<'a> SizeParams<'a> { /// (inclusive), stored in 720/inch units (decipoints). /// /// Ranges must not overlap, and should generally be contiguous. + #[inline] pub fn range_start(&self) -> u16 { let range = self.shape.range_start_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn range_end(&self) -> u16 { let range = self.shape.range_end_byte_range(); self.data.read_at(range.start).unwrap() @@ -5497,6 +5686,7 @@ impl MinByteRange for StylisticSetParamsMarker { } impl<'a> FontRead<'a> for StylisticSetParams<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -5509,6 +5699,7 @@ pub type StylisticSetParams<'a> = TableRef<'a, StylisticSetParamsMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> StylisticSetParams<'a> { + #[inline] pub fn version(&self) -> u16 { let range = self.shape.version_byte_range(); self.data.read_at(range.start).unwrap() @@ -5523,6 +5714,7 @@ impl<'a> StylisticSetParams<'a> { /// be provided in multiple languages. An English string should be included /// as a fallback. The string should be kept to a minimal length to fit /// comfortably with different application interfaces. + #[inline] pub fn ui_name_id(&self) -> NameId { let range = self.shape.ui_name_id_byte_range(); self.data.read_at(range.start).unwrap() @@ -5611,6 +5803,7 @@ impl MinByteRange for CharacterVariantParamsMarker { } impl<'a> FontRead<'a> for CharacterVariantParams<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -5634,6 +5827,7 @@ pub type CharacterVariantParams<'a> = TableRef<'a, CharacterVariantParamsMarker> #[allow(clippy::needless_lifetimes)] impl<'a> CharacterVariantParams<'a> { /// Format number is set to 0. + #[inline] pub fn format(&self) -> u16 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() @@ -5642,6 +5836,7 @@ impl<'a> CharacterVariantParams<'a> { /// The 'name' table name ID that specifies a string (or strings, /// for multiple languages) for a user-interface label for this /// feature. (May be NULL.) + #[inline] pub fn feat_ui_label_name_id(&self) -> NameId { let range = self.shape.feat_ui_label_name_id_byte_range(); self.data.read_at(range.start).unwrap() @@ -5650,6 +5845,7 @@ impl<'a> CharacterVariantParams<'a> { /// The 'name' table name ID that specifies a string (or strings, /// for multiple languages) that an application can use for tooltip /// text for this feature. (May be NULL.) + #[inline] pub fn feat_ui_tooltip_text_name_id(&self) -> NameId { let range = self.shape.feat_ui_tooltip_text_name_id_byte_range(); self.data.read_at(range.start).unwrap() @@ -5657,12 +5853,14 @@ impl<'a> CharacterVariantParams<'a> { /// The 'name' table name ID that specifies sample text that /// illustrates the effect of this feature. (May be NULL.) + #[inline] pub fn sample_text_name_id(&self) -> NameId { let range = self.shape.sample_text_name_id_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of named parameters. (May be zero.) + #[inline] pub fn num_named_parameters(&self) -> u16 { let range = self.shape.num_named_parameters_byte_range(); self.data.read_at(range.start).unwrap() @@ -5671,6 +5869,7 @@ impl<'a> CharacterVariantParams<'a> { /// The first 'name' table name ID used to specify strings for /// user-interface labels for the feature parameters. (Must be zero /// if numParameters is zero.) + #[inline] pub fn first_param_ui_label_name_id(&self) -> NameId { let range = self.shape.first_param_ui_label_name_id_byte_range(); self.data.read_at(range.start).unwrap() @@ -5678,6 +5877,7 @@ impl<'a> CharacterVariantParams<'a> { /// The count of characters for which this feature provides glyph /// variants. (May be zero.) + #[inline] pub fn char_count(&self) -> u16 { let range = self.shape.char_count_byte_range(); self.data.read_at(range.start).unwrap() @@ -5685,6 +5885,7 @@ impl<'a> CharacterVariantParams<'a> { /// The Unicode Scalar Value of the characters for which this /// feature provides glyph variants. + #[inline] pub fn character(&self) -> &'a [BigEndian] { let range = self.shape.character_byte_range(); self.data.read_array(range).unwrap() diff --git a/read-fonts/generated/generated_ltag.rs b/read-fonts/generated/generated_ltag.rs index 45e991043..c7e8018cd 100644 --- a/read-fonts/generated/generated_ltag.rs +++ b/read-fonts/generated/generated_ltag.rs @@ -46,6 +46,7 @@ impl TopLevelTable for Ltag<'_> { } impl<'a> FontRead<'a> for Ltag<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -67,24 +68,28 @@ pub type Ltag<'a> = TableRef<'a, LtagMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> Ltag<'a> { /// Table version; currently 1. + #[inline] pub fn version(&self) -> u32 { let range = self.shape.version_byte_range(); self.data.read_at(range.start).unwrap() } /// Table flags; currently none defined. + #[inline] pub fn flags(&self) -> u32 { let range = self.shape.flags_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of language tags which follow. + #[inline] pub fn num_tags(&self) -> u32 { let range = self.shape.num_tags_byte_range(); self.data.read_at(range.start).unwrap() } /// Range of each tag's string. + #[inline] pub fn tag_ranges(&self) -> &'a [FTStringRange] { let range = self.shape.tag_ranges_byte_range(); self.data.read_array(range).unwrap() @@ -135,11 +140,13 @@ pub struct FTStringRange { impl FTStringRange { /// Offset from the start of the table to the beginning of the string. + #[inline] pub fn offset(&self) -> u16 { self.offset.get() } /// String length (in bytes). + #[inline] pub fn length(&self) -> u16 { self.length.get() } diff --git a/read-fonts/generated/generated_maxp.rs b/read-fonts/generated/generated_maxp.rs index 40e560994..849fcc551 100644 --- a/read-fonts/generated/generated_maxp.rs +++ b/read-fonts/generated/generated_maxp.rs @@ -113,6 +113,7 @@ impl TopLevelTable for Maxp<'_> { } impl<'a> FontRead<'a> for Maxp<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let version: Version16Dot16 = cursor.read()?; @@ -232,36 +233,42 @@ pub type Maxp<'a> = TableRef<'a, MaxpMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> Maxp<'a> { /// The version: 0x00005000 for version 0.5, 0x00010000 for version 1.0. + #[inline] pub fn version(&self) -> Version16Dot16 { let range = self.shape.version_byte_range(); self.data.read_at(range.start).unwrap() } /// The number of glyphs in the font. + #[inline] pub fn num_glyphs(&self) -> u16 { let range = self.shape.num_glyphs_byte_range(); self.data.read_at(range.start).unwrap() } /// Maximum points in a non-composite glyph. + #[inline] pub fn max_points(&self) -> Option { let range = self.shape.max_points_byte_range()?; Some(self.data.read_at(range.start).unwrap()) } /// Maximum contours in a non-composite glyph. + #[inline] pub fn max_contours(&self) -> Option { let range = self.shape.max_contours_byte_range()?; Some(self.data.read_at(range.start).unwrap()) } /// Maximum points in a composite glyph. + #[inline] pub fn max_composite_points(&self) -> Option { let range = self.shape.max_composite_points_byte_range()?; Some(self.data.read_at(range.start).unwrap()) } /// Maximum contours in a composite glyph. + #[inline] pub fn max_composite_contours(&self) -> Option { let range = self.shape.max_composite_contours_byte_range()?; Some(self.data.read_at(range.start).unwrap()) @@ -269,30 +276,35 @@ impl<'a> Maxp<'a> { /// 1 if instructions do not use the twilight zone (Z0), or 2 if /// instructions do use Z0; should be set to 2 in most cases. + #[inline] pub fn max_zones(&self) -> Option { let range = self.shape.max_zones_byte_range()?; Some(self.data.read_at(range.start).unwrap()) } /// Maximum points used in Z0. + #[inline] pub fn max_twilight_points(&self) -> Option { let range = self.shape.max_twilight_points_byte_range()?; Some(self.data.read_at(range.start).unwrap()) } /// Number of Storage Area locations. + #[inline] pub fn max_storage(&self) -> Option { let range = self.shape.max_storage_byte_range()?; Some(self.data.read_at(range.start).unwrap()) } /// Number of FDEFs, equal to the highest function number + 1. + #[inline] pub fn max_function_defs(&self) -> Option { let range = self.shape.max_function_defs_byte_range()?; Some(self.data.read_at(range.start).unwrap()) } /// Number of IDEFs. + #[inline] pub fn max_instruction_defs(&self) -> Option { let range = self.shape.max_instruction_defs_byte_range()?; Some(self.data.read_at(range.start).unwrap()) @@ -301,12 +313,14 @@ impl<'a> Maxp<'a> { /// Maximum stack depth across Font Program ('fpgm' table), CVT /// Program ('prep' table) and all glyph instructions (in the /// 'glyf' table). + #[inline] pub fn max_stack_elements(&self) -> Option { let range = self.shape.max_stack_elements_byte_range()?; Some(self.data.read_at(range.start).unwrap()) } /// Maximum byte count for glyph instructions. + #[inline] pub fn max_size_of_instructions(&self) -> Option { let range = self.shape.max_size_of_instructions_byte_range()?; Some(self.data.read_at(range.start).unwrap()) @@ -314,12 +328,14 @@ impl<'a> Maxp<'a> { /// Maximum number of components referenced at “top level” for /// any composite glyph. + #[inline] pub fn max_component_elements(&self) -> Option { let range = self.shape.max_component_elements_byte_range()?; Some(self.data.read_at(range.start).unwrap()) } /// Maximum levels of recursion; 1 for simple components. + #[inline] pub fn max_component_depth(&self) -> Option { let range = self.shape.max_component_depth_byte_range()?; Some(self.data.read_at(range.start).unwrap()) diff --git a/read-fonts/generated/generated_meta.rs b/read-fonts/generated/generated_meta.rs index 556d5d9ad..15a60c7a1 100644 --- a/read-fonts/generated/generated_meta.rs +++ b/read-fonts/generated/generated_meta.rs @@ -51,6 +51,7 @@ impl TopLevelTable for Meta<'_> { } impl<'a> FontRead<'a> for Meta<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -71,24 +72,28 @@ pub type Meta<'a> = TableRef<'a, MetaMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> Meta<'a> { /// Version number of the metadata table — set to 1. + #[inline] pub fn version(&self) -> u32 { let range = self.shape.version_byte_range(); self.data.read_at(range.start).unwrap() } /// Flags — currently unused; set to 0. + #[inline] pub fn flags(&self) -> u32 { let range = self.shape.flags_byte_range(); self.data.read_at(range.start).unwrap() } /// The number of data maps in the table. + #[inline] pub fn data_maps_count(&self) -> u32 { let range = self.shape.data_maps_count_byte_range(); self.data.read_at(range.start).unwrap() } /// Array of data map records. + #[inline] pub fn data_maps(&self) -> &'a [DataMapRecord] { let range = self.shape.data_maps_byte_range(); self.data.read_array(range).unwrap() @@ -141,11 +146,13 @@ pub struct DataMapRecord { impl DataMapRecord { /// A tag indicating the type of metadata. + #[inline] pub fn tag(&self) -> Tag { self.tag.get() } /// Offset in bytes from the beginning of the metadata table to the data for this tag. + #[inline] pub fn data_offset(&self) -> Offset32 { self.data_offset.get() } @@ -160,6 +167,7 @@ impl DataMapRecord { } /// Length of the data, in bytes. The data is not required to be padded to any byte boundary. + #[inline] pub fn data_length(&self) -> u32 { self.data_length.get() } diff --git a/read-fonts/generated/generated_morx.rs b/read-fonts/generated/generated_morx.rs index 045febe5d..247f7c4c2 100644 --- a/read-fonts/generated/generated_morx.rs +++ b/read-fonts/generated/generated_morx.rs @@ -46,6 +46,7 @@ impl TopLevelTable for Morx<'_> { } impl<'a> FontRead<'a> for Morx<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -66,17 +67,20 @@ pub type Morx<'a> = TableRef<'a, MorxMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> Morx<'a> { /// Version number of the extended glyph metamorphosis table (either 2 or 3). + #[inline] pub fn version(&self) -> u16 { let range = self.shape.version_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of metamorphosis chains contained in this table. + #[inline] pub fn n_chains(&self) -> u32 { let range = self.shape.n_chains_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn chains(&self) -> VarLenArray<'a, Chain<'a>> { let range = self.shape.chains_byte_range(); VarLenArray::read(self.data.split_off(range.start).unwrap()).unwrap() @@ -156,6 +160,7 @@ impl MinByteRange for ChainMarker { } impl<'a> FontRead<'a> for Chain<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -184,36 +189,42 @@ pub type Chain<'a> = TableRef<'a, ChainMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> Chain<'a> { /// The default specification for subtables. + #[inline] pub fn default_flags(&self) -> u32 { let range = self.shape.default_flags_byte_range(); self.data.read_at(range.start).unwrap() } /// Total byte count, including this header; must be a multiple of 4. + #[inline] pub fn chain_length(&self) -> u32 { let range = self.shape.chain_length_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of feature subtable entries. + #[inline] pub fn n_feature_entries(&self) -> u32 { let range = self.shape.n_feature_entries_byte_range(); self.data.read_at(range.start).unwrap() } /// The number of subtables in the chain. + #[inline] pub fn n_subtables(&self) -> u32 { let range = self.shape.n_subtables_byte_range(); self.data.read_at(range.start).unwrap() } /// Feature entries for this chain. + #[inline] pub fn features(&self) -> &'a [Feature] { let range = self.shape.features_byte_range(); self.data.read_array(range).unwrap() } /// Array of chain subtables. + #[inline] pub fn subtables(&self) -> VarLenArray<'a, Subtable<'a>> { let range = self.shape.subtables_byte_range(); VarLenArray::read(self.data.split_off(range.start).unwrap()).unwrap() @@ -273,21 +284,25 @@ pub struct Feature { impl Feature { /// The type of feature. + #[inline] pub fn feature_type(&self) -> u16 { self.feature_type.get() } /// The feature's setting (aka selector). + #[inline] pub fn feature_settings(&self) -> u16 { self.feature_settings.get() } /// Flags for the settings that this feature and setting enables. + #[inline] pub fn enable_flags(&self) -> u32 { self.enable_flags.get() } /// Complement of flags for the settings that this feature and setting disable. + #[inline] pub fn disable_flags(&self) -> u32 { self.disable_flags.get() } @@ -351,6 +366,7 @@ impl MinByteRange for SubtableMarker { } impl<'a> FontRead<'a> for Subtable<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -368,24 +384,28 @@ pub type Subtable<'a> = TableRef<'a, SubtableMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> Subtable<'a> { /// Total subtable length, including this header. + #[inline] pub fn length(&self) -> u32 { let range = self.shape.length_byte_range(); self.data.read_at(range.start).unwrap() } /// Coverage flags and subtable type. + #[inline] pub fn coverage(&self) -> u32 { let range = self.shape.coverage_byte_range(); self.data.read_at(range.start).unwrap() } /// The 32-bit mask identifying which subtable this is (the subtable being executed if the AND of this value and the processed defaultFlags is nonzero). + #[inline] pub fn sub_feature_flags(&self) -> u32 { let range = self.shape.sub_feature_flags_byte_range(); self.data.read_at(range.start).unwrap() } /// Data for specific subtable. + #[inline] pub fn data(&self) -> &'a [u8] { let range = self.shape.data_byte_range(); self.data.read_array(range).unwrap() @@ -432,12 +452,14 @@ pub struct ContextualEntryData { impl ContextualEntryData { /// Index of the substitution table for the marked glyph (use 0xFFFF for /// none). + #[inline] pub fn mark_index(&self) -> u16 { self.mark_index.get() } /// Index of the substitution table for the current glyph (use 0xFFFF for /// none) + #[inline] pub fn current_index(&self) -> u16 { self.current_index.get() } @@ -482,6 +504,7 @@ impl InsertionEntryData { /// Zero-based index into the insertion glyph table. The number of glyphs /// to be inserted is contained in the currentInsertCount field in the /// flags (see below). A value of 0xFFFF indicates no insertion is to be done. + #[inline] pub fn current_insert_index(&self) -> u16 { self.current_insert_index.get() } @@ -490,6 +513,7 @@ impl InsertionEntryData { /// to be inserted is contained in the markedInsertCount field in the /// flags (see below). A value of 0xFFFF indicates no insertion is to be /// done. + #[inline] pub fn marked_insert_index(&self) -> u16 { self.marked_insert_index.get() } diff --git a/read-fonts/generated/generated_mvar.rs b/read-fonts/generated/generated_mvar.rs index 7cb806489..76be92d64 100644 --- a/read-fonts/generated/generated_mvar.rs +++ b/read-fonts/generated/generated_mvar.rs @@ -56,6 +56,7 @@ impl TopLevelTable for Mvar<'_> { } impl<'a> FontRead<'a> for Mvar<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -80,24 +81,28 @@ pub type Mvar<'a> = TableRef<'a, MvarMarker>; impl<'a> Mvar<'a> { /// Major version number of the horizontal metrics variations table — set to 1. /// Minor version number of the horizontal metrics variations table — set to 0. + #[inline] pub fn version(&self) -> MajorMinor { let range = self.shape.version_byte_range(); self.data.read_at(range.start).unwrap() } /// The size in bytes of each value record — must be greater than zero. + #[inline] pub fn value_record_size(&self) -> u16 { let range = self.shape.value_record_size_byte_range(); self.data.read_at(range.start).unwrap() } /// The number of value records — may be zero. + #[inline] pub fn value_record_count(&self) -> u16 { let range = self.shape.value_record_count_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset in bytes from the start of this table to the item variation store table. If valueRecordCount is zero, set to zero; if valueRecordCount is greater than zero, must be greater than zero. + #[inline] pub fn item_variation_store_offset(&self) -> Nullable { let range = self.shape.item_variation_store_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -110,6 +115,7 @@ impl<'a> Mvar<'a> { } /// Array of value records that identify target items and the associated delta-set index for each. The valueTag records must be in binary order of their valueTag field. + #[inline] pub fn value_records(&self) -> &'a [ValueRecord] { let range = self.shape.value_records_byte_range(); self.data.read_array(range).unwrap() @@ -169,16 +175,19 @@ pub struct ValueRecord { impl ValueRecord { /// Four-byte tag identifying a font-wide measure. + #[inline] pub fn value_tag(&self) -> Tag { self.value_tag.get() } /// A delta-set outer index — used to select an item variation data subtable within the item variation store. + #[inline] pub fn delta_set_outer_index(&self) -> u16 { self.delta_set_outer_index.get() } /// A delta-set inner index — used to select a delta-set row within an item variation data subtable. + #[inline] pub fn delta_set_inner_index(&self) -> u16 { self.delta_set_inner_index.get() } diff --git a/read-fonts/generated/generated_name.rs b/read-fonts/generated/generated_name.rs index 3b9cb83ba..47c5a0a7e 100644 --- a/read-fonts/generated/generated_name.rs +++ b/read-fonts/generated/generated_name.rs @@ -59,6 +59,7 @@ impl TopLevelTable for Name<'_> { } impl<'a> FontRead<'a> for Name<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let version: u16 = cursor.read()?; @@ -104,36 +105,42 @@ pub type Name<'a> = TableRef<'a, NameMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> Name<'a> { /// Table version number (0 or 1) + #[inline] pub fn version(&self) -> u16 { let range = self.shape.version_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of name records. + #[inline] pub fn count(&self) -> u16 { let range = self.shape.count_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset to start of string storage (from start of table). + #[inline] pub fn storage_offset(&self) -> u16 { let range = self.shape.storage_offset_byte_range(); self.data.read_at(range.start).unwrap() } /// The name records where count is the number of records. + #[inline] pub fn name_record(&self) -> &'a [NameRecord] { let range = self.shape.name_record_byte_range(); self.data.read_array(range).unwrap() } /// Number of language-tag records. + #[inline] pub fn lang_tag_count(&self) -> Option { let range = self.shape.lang_tag_count_byte_range()?; Some(self.data.read_at(range.start).unwrap()) } /// The language-tag records where langTagCount is the number of records. + #[inline] pub fn lang_tag_record(&self) -> Option<&'a [LangTagRecord]> { let range = self.shape.lang_tag_record_byte_range()?; Some(self.data.read_array(range).unwrap()) @@ -197,12 +204,14 @@ pub struct LangTagRecord { impl LangTagRecord { /// Language-tag string length (in bytes) + #[inline] pub fn length(&self) -> u16 { self.length.get() } /// Language-tag string offset from start of storage area (in /// bytes). + #[inline] pub fn lang_tag_offset(&self) -> Offset16 { self.lang_tag_offset.get() } @@ -248,31 +257,37 @@ pub struct NameRecord { impl NameRecord { /// Platform ID. + #[inline] pub fn platform_id(&self) -> u16 { self.platform_id.get() } /// Platform-specific encoding ID. + #[inline] pub fn encoding_id(&self) -> u16 { self.encoding_id.get() } /// Language ID. + #[inline] pub fn language_id(&self) -> u16 { self.language_id.get() } /// Name ID. + #[inline] pub fn name_id(&self) -> NameId { self.name_id.get() } /// String length (in bytes). + #[inline] pub fn length(&self) -> u16 { self.length.get() } /// String offset from start of storage area (in bytes). + #[inline] pub fn string_offset(&self) -> Offset16 { self.string_offset.get() } diff --git a/read-fonts/generated/generated_os2.rs b/read-fonts/generated/generated_os2.rs index 13d89c197..5a88ce174 100644 --- a/read-fonts/generated/generated_os2.rs +++ b/read-fonts/generated/generated_os2.rs @@ -583,6 +583,7 @@ impl TopLevelTable for Os2<'_> { } impl<'a> FontRead<'a> for Os2<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let version: u16 = cursor.read()?; @@ -683,6 +684,7 @@ pub type Os2<'a> = TableRef<'a, Os2Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> Os2<'a> { + #[inline] pub fn version(&self) -> u16 { let range = self.shape.version_byte_range(); self.data.read_at(range.start).unwrap() @@ -692,6 +694,7 @@ impl<'a> Os2<'a> { /// /// The Average Character Width parameter specifies the arithmetic average /// of the escapement (width) of all non-zero width glyphs in the font. + #[inline] pub fn x_avg_char_width(&self) -> i16 { let range = self.shape.x_avg_char_width_byte_range(); self.data.read_at(range.start).unwrap() @@ -701,6 +704,7 @@ impl<'a> Os2<'a> { /// /// Indicates the visual weight (degree of blackness or thickness of /// strokes) of the characters in the font. Values from 1 to 1000 are valid. + #[inline] pub fn us_weight_class(&self) -> u16 { let range = self.shape.us_weight_class_byte_range(); self.data.read_at(range.start).unwrap() @@ -710,6 +714,7 @@ impl<'a> Os2<'a> { /// /// Indicates a relative change from the normal aspect ratio (width to height /// ratio) as specified by a font designer for the glyphs in a font. + #[inline] pub fn us_width_class(&self) -> u16 { let range = self.shape.us_width_class_byte_range(); self.data.read_at(range.start).unwrap() @@ -718,6 +723,7 @@ impl<'a> Os2<'a> { /// [Type flags](https://learn.microsoft.com/en-us/typography/opentype/spec/os2#fstype). /// /// Indicates font embedding licensing rights for the font. + #[inline] pub fn fs_type(&self) -> u16 { let range = self.shape.fs_type_byte_range(); self.data.read_at(range.start).unwrap() @@ -725,6 +731,7 @@ impl<'a> Os2<'a> { /// The recommended horizontal size in font design units for subscripts for /// this font. + #[inline] pub fn y_subscript_x_size(&self) -> i16 { let range = self.shape.y_subscript_x_size_byte_range(); self.data.read_at(range.start).unwrap() @@ -732,6 +739,7 @@ impl<'a> Os2<'a> { /// The recommended vertical size in font design units for subscripts for /// this font. + #[inline] pub fn y_subscript_y_size(&self) -> i16 { let range = self.shape.y_subscript_y_size_byte_range(); self.data.read_at(range.start).unwrap() @@ -739,6 +747,7 @@ impl<'a> Os2<'a> { /// The recommended horizontal offset in font design units for subscripts /// for this font. + #[inline] pub fn y_subscript_x_offset(&self) -> i16 { let range = self.shape.y_subscript_x_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -746,6 +755,7 @@ impl<'a> Os2<'a> { /// The recommended vertical offset in font design units for subscripts /// for this font. + #[inline] pub fn y_subscript_y_offset(&self) -> i16 { let range = self.shape.y_subscript_y_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -753,6 +763,7 @@ impl<'a> Os2<'a> { /// The recommended horizontal size in font design units for superscripts /// for this font. + #[inline] pub fn y_superscript_x_size(&self) -> i16 { let range = self.shape.y_superscript_x_size_byte_range(); self.data.read_at(range.start).unwrap() @@ -760,6 +771,7 @@ impl<'a> Os2<'a> { /// The recommended vertical size in font design units for superscripts /// for this font. + #[inline] pub fn y_superscript_y_size(&self) -> i16 { let range = self.shape.y_superscript_y_size_byte_range(); self.data.read_at(range.start).unwrap() @@ -767,6 +779,7 @@ impl<'a> Os2<'a> { /// The recommended horizontal offset in font design units for superscripts /// for this font. + #[inline] pub fn y_superscript_x_offset(&self) -> i16 { let range = self.shape.y_superscript_x_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -774,12 +787,14 @@ impl<'a> Os2<'a> { /// The recommended vertical offset in font design units for superscripts /// for this font. + #[inline] pub fn y_superscript_y_offset(&self) -> i16 { let range = self.shape.y_superscript_y_offset_byte_range(); self.data.read_at(range.start).unwrap() } /// Thickness of the strikeout stroke in font design units. + #[inline] pub fn y_strikeout_size(&self) -> i16 { let range = self.shape.y_strikeout_size_byte_range(); self.data.read_at(range.start).unwrap() @@ -787,6 +802,7 @@ impl<'a> Os2<'a> { /// The position of the top of the strikeout stroke relative to the /// baseline in font design units. + #[inline] pub fn y_strikeout_position(&self) -> i16 { let range = self.shape.y_strikeout_position_byte_range(); self.data.read_at(range.start).unwrap() @@ -794,6 +810,7 @@ impl<'a> Os2<'a> { /// [Font-family class and subclass](https://learn.microsoft.com/en-us/typography/opentype/spec/os2#sfamilyclass). /// This parameter is a classification of font-family design. + #[inline] pub fn s_family_class(&self) -> i16 { let range = self.shape.s_family_class_byte_range(); self.data.read_at(range.start).unwrap() @@ -803,6 +820,7 @@ impl<'a> Os2<'a> { /// /// Additional specifications are required for PANOSE to classify non-Latin /// character sets. + #[inline] pub fn panose_10(&self) -> &'a [u8] { let range = self.shape.panose_10_byte_range(); self.data.read_array(range).unwrap() @@ -811,24 +829,28 @@ impl<'a> Os2<'a> { /// [Unicode Character Range](https://learn.microsoft.com/en-us/typography/opentype/spec/os2#ulunicoderange1-bits-031ulunicoderange2-bits-3263ulunicoderange3-bits-6495ulunicoderange4-bits-96127). /// /// Unicode Character Range (bits 0-31). + #[inline] pub fn ul_unicode_range_1(&self) -> u32 { let range = self.shape.ul_unicode_range_1_byte_range(); self.data.read_at(range.start).unwrap() } /// Unicode Character Range (bits 32-63). + #[inline] pub fn ul_unicode_range_2(&self) -> u32 { let range = self.shape.ul_unicode_range_2_byte_range(); self.data.read_at(range.start).unwrap() } /// Unicode Character Range (bits 64-95). + #[inline] pub fn ul_unicode_range_3(&self) -> u32 { let range = self.shape.ul_unicode_range_3_byte_range(); self.data.read_at(range.start).unwrap() } /// Unicode Character Range (bits 96-127). + #[inline] pub fn ul_unicode_range_4(&self) -> u32 { let range = self.shape.ul_unicode_range_4_byte_range(); self.data.read_at(range.start).unwrap() @@ -837,6 +859,7 @@ impl<'a> Os2<'a> { /// [Font Vendor Identification](https://learn.microsoft.com/en-us/typography/opentype/spec/os2#achvendid). /// /// The four-character identifier for the vendor of the given type face. + #[inline] pub fn ach_vend_id(&self) -> Tag { let range = self.shape.ach_vend_id_byte_range(); self.data.read_at(range.start).unwrap() @@ -845,36 +868,42 @@ impl<'a> Os2<'a> { /// [Font selection flags](https://learn.microsoft.com/en-us/typography/opentype/spec/os2#fsselection). /// /// Contains information concerning the nature of the font patterns. + #[inline] pub fn fs_selection(&self) -> SelectionFlags { let range = self.shape.fs_selection_byte_range(); self.data.read_at(range.start).unwrap() } /// The minimum Unicode index (character code) in this font. + #[inline] pub fn us_first_char_index(&self) -> u16 { let range = self.shape.us_first_char_index_byte_range(); self.data.read_at(range.start).unwrap() } /// The maximum Unicode index (character code) in this font. + #[inline] pub fn us_last_char_index(&self) -> u16 { let range = self.shape.us_last_char_index_byte_range(); self.data.read_at(range.start).unwrap() } /// The typographic ascender for this font. + #[inline] pub fn s_typo_ascender(&self) -> i16 { let range = self.shape.s_typo_ascender_byte_range(); self.data.read_at(range.start).unwrap() } /// The typographic descender for this font. + #[inline] pub fn s_typo_descender(&self) -> i16 { let range = self.shape.s_typo_descender_byte_range(); self.data.read_at(range.start).unwrap() } /// The typographic line gap for this font. + #[inline] pub fn s_typo_line_gap(&self) -> i16 { let range = self.shape.s_typo_line_gap_byte_range(); self.data.read_at(range.start).unwrap() @@ -884,6 +913,7 @@ impl<'a> Os2<'a> { /// /// This should be used to specify the height above the baseline for a /// clipping region. + #[inline] pub fn us_win_ascent(&self) -> u16 { let range = self.shape.us_win_ascent_byte_range(); self.data.read_at(range.start).unwrap() @@ -893,18 +923,21 @@ impl<'a> Os2<'a> { /// /// This should be used to specify the vertical extent below the baseline /// for a clipping region. + #[inline] pub fn us_win_descent(&self) -> u16 { let range = self.shape.us_win_descent_byte_range(); self.data.read_at(range.start).unwrap() } /// Code page character range bits 0-31. + #[inline] pub fn ul_code_page_range_1(&self) -> Option { let range = self.shape.ul_code_page_range_1_byte_range()?; Some(self.data.read_at(range.start).unwrap()) } /// Code page character range bits 32-63. + #[inline] pub fn ul_code_page_range_2(&self) -> Option { let range = self.shape.ul_code_page_range_2_byte_range()?; Some(self.data.read_at(range.start).unwrap()) @@ -913,6 +946,7 @@ impl<'a> Os2<'a> { /// This metric specifies the distance between the baseline and the /// approximate height of non-ascending lowercase letters measured in /// FUnits. + #[inline] pub fn sx_height(&self) -> Option { let range = self.shape.sx_height_byte_range()?; Some(self.data.read_at(range.start).unwrap()) @@ -920,6 +954,7 @@ impl<'a> Os2<'a> { /// This metric specifies the distance between the baseline and the /// approximate height of uppercase letters measured in FUnits. + #[inline] pub fn s_cap_height(&self) -> Option { let range = self.shape.s_cap_height_byte_range()?; Some(self.data.read_at(range.start).unwrap()) @@ -927,6 +962,7 @@ impl<'a> Os2<'a> { /// This is the Unicode codepoint, in UTF-16 encoding, of a character that /// can be used for a default glyph. + #[inline] pub fn us_default_char(&self) -> Option { let range = self.shape.us_default_char_byte_range()?; Some(self.data.read_at(range.start).unwrap()) @@ -934,24 +970,28 @@ impl<'a> Os2<'a> { /// This is the Unicode codepoint, in UTF-16 encoding, of a character that /// can be used as a default break character. + #[inline] pub fn us_break_char(&self) -> Option { let range = self.shape.us_break_char_byte_range()?; Some(self.data.read_at(range.start).unwrap()) } /// This field is used for fonts with multiple optical styles. + #[inline] pub fn us_max_context(&self) -> Option { let range = self.shape.us_max_context_byte_range()?; Some(self.data.read_at(range.start).unwrap()) } /// This field is used for fonts with multiple optical styles. + #[inline] pub fn us_lower_optical_point_size(&self) -> Option { let range = self.shape.us_lower_optical_point_size_byte_range()?; Some(self.data.read_at(range.start).unwrap()) } /// This field is used for fonts with multiple optical styles. + #[inline] pub fn us_upper_optical_point_size(&self) -> Option { let range = self.shape.us_upper_optical_point_size_byte_range()?; Some(self.data.read_at(range.start).unwrap()) diff --git a/read-fonts/generated/generated_post.rs b/read-fonts/generated/generated_post.rs index af65dba1a..0a57637c5 100644 --- a/read-fonts/generated/generated_post.rs +++ b/read-fonts/generated/generated_post.rs @@ -90,6 +90,7 @@ impl TopLevelTable for Post<'_> { } impl<'a> FontRead<'a> for Post<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let version: Version16Dot16 = cursor.read()?; @@ -150,6 +151,7 @@ impl<'a> Post<'a> { /// 0x00010000 for version 1.0 0x00020000 for version 2.0 /// 0x00025000 for version 2.5 (deprecated) 0x00030000 for version /// 3.0 + #[inline] pub fn version(&self) -> Version16Dot16 { let range = self.shape.version_byte_range(); self.data.read_at(range.start).unwrap() @@ -158,6 +160,7 @@ impl<'a> Post<'a> { /// Italic angle in counter-clockwise degrees from the vertical. /// Zero for upright text, negative for text that leans to the /// right (forward). + #[inline] pub fn italic_angle(&self) -> Fixed { let range = self.shape.italic_angle_byte_range(); self.data.read_at(range.start).unwrap() @@ -170,6 +173,7 @@ impl<'a> Post<'a> { /// historical reasons. The value of the PostScript key may be /// calculated by subtracting half the underlineThickness from the /// value of this field. + #[inline] pub fn underline_position(&self) -> FWord { let range = self.shape.underline_position_byte_range(); self.data.read_at(range.start).unwrap() @@ -179,6 +183,7 @@ impl<'a> Post<'a> { /// underline thickness should match the thickness of the /// underscore character (U+005F LOW LINE), and should also match /// the strikeout thickness, which is specified in the OS/2 table. + #[inline] pub fn underline_thickness(&self) -> FWord { let range = self.shape.underline_thickness_byte_range(); self.data.read_at(range.start).unwrap() @@ -186,18 +191,21 @@ impl<'a> Post<'a> { /// Set to 0 if the font is proportionally spaced, non-zero if the /// font is not proportionally spaced (i.e. monospaced). + #[inline] pub fn is_fixed_pitch(&self) -> u32 { let range = self.shape.is_fixed_pitch_byte_range(); self.data.read_at(range.start).unwrap() } /// Minimum memory usage when an OpenType font is downloaded. + #[inline] pub fn min_mem_type42(&self) -> u32 { let range = self.shape.min_mem_type42_byte_range(); self.data.read_at(range.start).unwrap() } /// Maximum memory usage when an OpenType font is downloaded. + #[inline] pub fn max_mem_type42(&self) -> u32 { let range = self.shape.max_mem_type42_byte_range(); self.data.read_at(range.start).unwrap() @@ -205,6 +213,7 @@ impl<'a> Post<'a> { /// Minimum memory usage when an OpenType font is downloaded as a /// Type 1 font. + #[inline] pub fn min_mem_type1(&self) -> u32 { let range = self.shape.min_mem_type1_byte_range(); self.data.read_at(range.start).unwrap() @@ -212,6 +221,7 @@ impl<'a> Post<'a> { /// Maximum memory usage when an OpenType font is downloaded as a /// Type 1 font. + #[inline] pub fn max_mem_type1(&self) -> u32 { let range = self.shape.max_mem_type1_byte_range(); self.data.read_at(range.start).unwrap() @@ -219,18 +229,21 @@ impl<'a> Post<'a> { /// Number of glyphs (this should be the same as numGlyphs in /// 'maxp' table). + #[inline] pub fn num_glyphs(&self) -> Option { let range = self.shape.num_glyphs_byte_range()?; Some(self.data.read_at(range.start).unwrap()) } /// Array of indices into the string data. See below for details. + #[inline] pub fn glyph_name_index(&self) -> Option<&'a [BigEndian]> { let range = self.shape.glyph_name_index_byte_range()?; Some(self.data.read_array(range).unwrap()) } /// Storage for the string data. + #[inline] pub fn string_data(&self) -> Option>> { let range = self.shape.string_data_byte_range()?; Some(VarLenArray::read(self.data.split_off(range.start).unwrap()).unwrap()) diff --git a/read-fonts/generated/generated_postscript.rs b/read-fonts/generated/generated_postscript.rs index f037a29fa..f7fb6162e 100644 --- a/read-fonts/generated/generated_postscript.rs +++ b/read-fonts/generated/generated_postscript.rs @@ -42,6 +42,7 @@ impl MinByteRange for Index1Marker { } impl<'a> FontRead<'a> for Index1<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let count: u16 = cursor.read()?; @@ -65,24 +66,28 @@ pub type Index1<'a> = TableRef<'a, Index1Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> Index1<'a> { /// Number of objects stored in INDEX. + #[inline] pub fn count(&self) -> u16 { let range = self.shape.count_byte_range(); self.data.read_at(range.start).unwrap() } /// Object array element size. + #[inline] pub fn off_size(&self) -> u8 { let range = self.shape.off_size_byte_range(); self.data.read_at(range.start).unwrap() } /// Bytes containing `count + 1` offsets each of `off_size`. + #[inline] pub fn offsets(&self) -> &'a [u8] { let range = self.shape.offsets_byte_range(); self.data.read_array(range).unwrap() } /// Array containing the object data. + #[inline] pub fn data(&self) -> &'a [u8] { let range = self.shape.data_byte_range(); self.data.read_array(range).unwrap() @@ -150,6 +155,7 @@ impl MinByteRange for Index2Marker { } impl<'a> FontRead<'a> for Index2<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let count: u32 = cursor.read()?; @@ -173,24 +179,28 @@ pub type Index2<'a> = TableRef<'a, Index2Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> Index2<'a> { /// Number of objects stored in INDEX. + #[inline] pub fn count(&self) -> u32 { let range = self.shape.count_byte_range(); self.data.read_at(range.start).unwrap() } /// Object array element size. + #[inline] pub fn off_size(&self) -> u8 { let range = self.shape.off_size_byte_range(); self.data.read_at(range.start).unwrap() } /// Bytes containing `count + 1` offsets each of `off_size`. + #[inline] pub fn offsets(&self) -> &'a [u8] { let range = self.shape.offsets_byte_range(); self.data.read_array(range).unwrap() } /// Array containing the object data. + #[inline] pub fn data(&self) -> &'a [u8] { let range = self.shape.data_byte_range(); self.data.read_array(range).unwrap() @@ -329,6 +339,7 @@ impl MinByteRange for FdSelectFormat0Marker { } impl<'a> FontRead<'a> for FdSelectFormat0<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -344,12 +355,14 @@ pub type FdSelectFormat0<'a> = TableRef<'a, FdSelectFormat0Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> FdSelectFormat0<'a> { /// Format = 0. + #[inline] pub fn format(&self) -> u8 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// FD selector array (one entry for each glyph). + #[inline] pub fn fds(&self) -> &'a [u8] { let range = self.shape.fds_byte_range(); self.data.read_array(range).unwrap() @@ -418,6 +431,7 @@ impl MinByteRange for FdSelectFormat3Marker { } impl<'a> FontRead<'a> for FdSelectFormat3<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -437,24 +451,28 @@ pub type FdSelectFormat3<'a> = TableRef<'a, FdSelectFormat3Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> FdSelectFormat3<'a> { /// Format = 3. + #[inline] pub fn format(&self) -> u8 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of ranges. + #[inline] pub fn n_ranges(&self) -> u16 { let range = self.shape.n_ranges_byte_range(); self.data.read_at(range.start).unwrap() } /// Range3 array. + #[inline] pub fn ranges(&self) -> &'a [FdSelectRange3] { let range = self.shape.ranges_byte_range(); self.data.read_array(range).unwrap() } /// Sentinel GID. Set equal to the number of glyphs in the font. + #[inline] pub fn sentinel(&self) -> u16 { let range = self.shape.sentinel_byte_range(); self.data.read_at(range.start).unwrap() @@ -505,11 +523,13 @@ pub struct FdSelectRange3 { impl FdSelectRange3 { /// First glyph index in range. + #[inline] pub fn first(&self) -> u16 { self.first.get() } /// FD index for all glyphs in range. + #[inline] pub fn fd(&self) -> u8 { self.fd } @@ -574,6 +594,7 @@ impl MinByteRange for FdSelectFormat4Marker { } impl<'a> FontRead<'a> for FdSelectFormat4<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -593,24 +614,28 @@ pub type FdSelectFormat4<'a> = TableRef<'a, FdSelectFormat4Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> FdSelectFormat4<'a> { /// Format = 4. + #[inline] pub fn format(&self) -> u8 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of ranges. + #[inline] pub fn n_ranges(&self) -> u32 { let range = self.shape.n_ranges_byte_range(); self.data.read_at(range.start).unwrap() } /// Range4 array. + #[inline] pub fn ranges(&self) -> &'a [FdSelectRange4] { let range = self.shape.ranges_byte_range(); self.data.read_array(range).unwrap() } /// Sentinel GID. Set equal to the number of glyphs in the font. + #[inline] pub fn sentinel(&self) -> u32 { let range = self.shape.sentinel_byte_range(); self.data.read_at(range.start).unwrap() @@ -661,11 +686,13 @@ pub struct FdSelectRange4 { impl FdSelectRange4 { /// First glyph index in range. + #[inline] pub fn first(&self) -> u32 { self.first.get() } /// FD index for all glyphs in range. + #[inline] pub fn fd(&self) -> u16 { self.fd.get() } @@ -798,6 +825,7 @@ impl MinByteRange for CharsetFormat0Marker { } impl<'a> FontRead<'a> for CharsetFormat0<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -813,12 +841,14 @@ pub type CharsetFormat0<'a> = TableRef<'a, CharsetFormat0Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> CharsetFormat0<'a> { /// Format; =0 + #[inline] pub fn format(&self) -> u8 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Glyph name array. + #[inline] pub fn glyph(&self) -> &'a [BigEndian] { let range = self.shape.glyph_byte_range(); self.data.read_array(range).unwrap() @@ -877,6 +907,7 @@ impl MinByteRange for CharsetFormat1Marker { } impl<'a> FontRead<'a> for CharsetFormat1<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -893,12 +924,14 @@ pub type CharsetFormat1<'a> = TableRef<'a, CharsetFormat1Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> CharsetFormat1<'a> { /// Format; =1 + #[inline] pub fn format(&self) -> u8 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Range1 array. + #[inline] pub fn ranges(&self) -> &'a [CharsetRange1] { let range = self.shape.ranges_byte_range(); self.data.read_array(range).unwrap() @@ -947,11 +980,13 @@ pub struct CharsetRange1 { impl CharsetRange1 { /// First glyph in range. + #[inline] pub fn first(&self) -> u16 { self.first.get() } /// Glyphs left in range (excluding first). + #[inline] pub fn n_left(&self) -> u8 { self.n_left } @@ -1006,6 +1041,7 @@ impl MinByteRange for CharsetFormat2Marker { } impl<'a> FontRead<'a> for CharsetFormat2<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -1022,12 +1058,14 @@ pub type CharsetFormat2<'a> = TableRef<'a, CharsetFormat2Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> CharsetFormat2<'a> { /// Format; =2 + #[inline] pub fn format(&self) -> u8 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Range2 array. + #[inline] pub fn ranges(&self) -> &'a [CharsetRange2] { let range = self.shape.ranges_byte_range(); self.data.read_array(range).unwrap() @@ -1076,11 +1114,13 @@ pub struct CharsetRange2 { impl CharsetRange2 { /// First glyph in range. + #[inline] pub fn first(&self) -> u16 { self.first.get() } /// Glyphs left in range (excluding first). + #[inline] pub fn n_left(&self) -> u16 { self.n_left.get() } diff --git a/read-fonts/generated/generated_sbix.rs b/read-fonts/generated/generated_sbix.rs index f4a4f1d72..1d56ceb05 100644 --- a/read-fonts/generated/generated_sbix.rs +++ b/read-fonts/generated/generated_sbix.rs @@ -359,6 +359,7 @@ impl ReadArgs for Sbix<'_> { } impl<'a> FontReadWithArgs<'a> for Sbix<'a> { + #[inline] fn read_with_args(data: FontData<'a>, args: &u16) -> Result { let num_glyphs = *args; let mut cursor = data.cursor(); @@ -381,6 +382,7 @@ impl<'a> Sbix<'a> { /// /// This type requires some external state in order to be /// parsed. + #[inline] pub fn read(data: FontData<'a>, num_glyphs: u16) -> Result { let args = num_glyphs; Self::read_with_args(data, &args) @@ -393,6 +395,7 @@ pub type Sbix<'a> = TableRef<'a, SbixMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> Sbix<'a> { /// Table version number — set to 1. + #[inline] pub fn version(&self) -> u16 { let range = self.shape.version_byte_range(); self.data.read_at(range.start).unwrap() @@ -401,18 +404,21 @@ impl<'a> Sbix<'a> { /// Bit 0: Set to 1. /// Bit 1: Draw outlines. /// Bits 2 to 15: reserved (set to 0). + #[inline] pub fn flags(&self) -> HeaderFlags { let range = self.shape.flags_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of bitmap strikes. + #[inline] pub fn num_strikes(&self) -> u32 { let range = self.shape.num_strikes_byte_range(); self.data.read_at(range.start).unwrap() } /// Offsets from the beginning of the 'sbix' table to data for each individual bitmap strike. + #[inline] pub fn strike_offsets(&self) -> &'a [BigEndian] { let range = self.shape.strike_offsets_byte_range(); self.data.read_array(range).unwrap() @@ -504,6 +510,7 @@ impl ReadArgs for Strike<'_> { } impl<'a> FontReadWithArgs<'a> for Strike<'a> { + #[inline] fn read_with_args(data: FontData<'a>, args: &u16) -> Result { let num_glyphs = *args; let mut cursor = data.cursor(); @@ -524,6 +531,7 @@ impl<'a> Strike<'a> { /// /// This type requires some external state in order to be /// parsed. + #[inline] pub fn read(data: FontData<'a>, num_glyphs: u16) -> Result { let args = num_glyphs; Self::read_with_args(data, &args) @@ -536,18 +544,21 @@ pub type Strike<'a> = TableRef<'a, StrikeMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> Strike<'a> { /// The PPEM size for which this strike was designed. + #[inline] pub fn ppem(&self) -> u16 { let range = self.shape.ppem_byte_range(); self.data.read_at(range.start).unwrap() } /// The device pixel density (in PPI) for which this strike was designed. (E.g., 96 PPI, 192 PPI.) + #[inline] pub fn ppi(&self) -> u16 { let range = self.shape.ppi_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset from the beginning of the strike data header to bitmap data for an individual glyph ID. + #[inline] pub fn glyph_data_offsets(&self) -> &'a [BigEndian] { let range = self.shape.glyph_data_offsets_byte_range(); self.data.read_array(range).unwrap() @@ -613,6 +624,7 @@ impl MinByteRange for GlyphDataMarker { } impl<'a> FontRead<'a> for GlyphData<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -630,24 +642,28 @@ pub type GlyphData<'a> = TableRef<'a, GlyphDataMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> GlyphData<'a> { /// The horizontal (x-axis) position of the left edge of the bitmap graphic in relation to the glyph design space origin. + #[inline] pub fn origin_offset_x(&self) -> i16 { let range = self.shape.origin_offset_x_byte_range(); self.data.read_at(range.start).unwrap() } /// The vertical (y-axis) position of the bottom edge of the bitmap graphic in relation to the glyph design space origin. + #[inline] pub fn origin_offset_y(&self) -> i16 { let range = self.shape.origin_offset_y_byte_range(); self.data.read_at(range.start).unwrap() } /// Indicates the format of the embedded graphic data: one of 'jpg ', 'png ' or 'tiff', or the special format 'dupe'. + #[inline] pub fn graphic_type(&self) -> Tag { let range = self.shape.graphic_type_byte_range(); self.data.read_at(range.start).unwrap() } /// The actual embedded graphic data. The total length is inferred from sequential entries in the glyphDataOffsets array and the fixed size (8 bytes) of the preceding fields. + #[inline] pub fn data(&self) -> &'a [u8] { let range = self.shape.data_byte_range(); self.data.read_array(range).unwrap() diff --git a/read-fonts/generated/generated_stat.rs b/read-fonts/generated/generated_stat.rs index 5b54a2663..c9704878f 100644 --- a/read-fonts/generated/generated_stat.rs +++ b/read-fonts/generated/generated_stat.rs @@ -61,6 +61,7 @@ impl TopLevelTable for Stat<'_> { } impl<'a> FontRead<'a> for Stat<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let version: MajorMinor = cursor.read()?; @@ -88,12 +89,14 @@ pub type Stat<'a> = TableRef<'a, StatMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> Stat<'a> { /// Major/minor version number. Set to 1.2 for new fonts. + #[inline] pub fn version(&self) -> MajorMinor { let range = self.shape.version_byte_range(); self.data.read_at(range.start).unwrap() } /// The size in bytes of each axis record. + #[inline] pub fn design_axis_size(&self) -> u16 { let range = self.shape.design_axis_size_byte_range(); self.data.read_at(range.start).unwrap() @@ -103,6 +106,7 @@ impl<'a> Stat<'a> { /// this value must be greater than or equal to the axisCount value /// in the 'fvar' table. In all fonts, must be greater than zero if /// axisValueCount is greater than zero. + #[inline] pub fn design_axis_count(&self) -> u16 { let range = self.shape.design_axis_count_byte_range(); self.data.read_at(range.start).unwrap() @@ -112,6 +116,7 @@ impl<'a> Stat<'a> { /// start of the design axes array. If designAxisCount is zero, set /// to zero; if designAxisCount is greater than zero, must be /// greater than zero. + #[inline] pub fn design_axes_offset(&self) -> Offset32 { let range = self.shape.design_axes_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -125,6 +130,7 @@ impl<'a> Stat<'a> { } /// The number of axis value tables. + #[inline] pub fn axis_value_count(&self) -> u16 { let range = self.shape.axis_value_count_byte_range(); self.data.read_at(range.start).unwrap() @@ -134,6 +140,7 @@ impl<'a> Stat<'a> { /// start of the design axes value offsets array. If axisValueCount /// is zero, set to zero; if axisValueCount is greater than zero, /// must be greater than zero. + #[inline] pub fn offset_to_axis_value_offsets(&self) -> Nullable { let range = self.shape.offset_to_axis_value_offsets_byte_range(); self.data.read_at(range.start).unwrap() @@ -150,6 +157,7 @@ impl<'a> Stat<'a> { /// Name ID used as fallback when projection of names into a /// particular font model produces a subfamily name containing only /// elidable elements. + #[inline] pub fn elided_fallback_name_id(&self) -> Option { let range = self.shape.elided_fallback_name_id_byte_range()?; Some(self.data.read_at(range.start).unwrap()) @@ -219,12 +227,14 @@ pub struct AxisRecord { impl AxisRecord { /// A tag identifying the axis of design variation. + #[inline] pub fn axis_tag(&self) -> Tag { self.axis_tag.get() } /// The name ID for entries in the 'name' table that provide a /// display string for this axis. + #[inline] pub fn axis_name_id(&self) -> NameId { self.axis_name_id.get() } @@ -232,6 +242,7 @@ impl AxisRecord { /// A value that applications can use to determine primary sorting /// of face names, or for ordering of labels when composing family /// or face names. + #[inline] pub fn axis_ordering(&self) -> u16 { self.axis_ordering.get() } @@ -282,6 +293,7 @@ impl ReadArgs for AxisValueArray<'_> { } impl<'a> FontReadWithArgs<'a> for AxisValueArray<'a> { + #[inline] fn read_with_args(data: FontData<'a>, args: &u16) -> Result { let axis_value_count = *args; let mut cursor = data.cursor(); @@ -300,6 +312,7 @@ impl<'a> AxisValueArray<'a> { /// /// This type requires some external state in order to be /// parsed. + #[inline] pub fn read(data: FontData<'a>, axis_value_count: u16) -> Result { let args = axis_value_count; Self::read_with_args(data, &args) @@ -313,6 +326,7 @@ pub type AxisValueArray<'a> = TableRef<'a, AxisValueArrayMarker>; impl<'a> AxisValueArray<'a> { /// Array of offsets to axis value tables, in bytes from the start /// of the axis value offsets array. + #[inline] pub fn axis_value_offsets(&self) -> &'a [BigEndian] { let range = self.shape.axis_value_offsets_byte_range(); self.data.read_array(range).unwrap() @@ -508,6 +522,7 @@ impl MinByteRange for AxisValueFormat1Marker { } impl<'a> FontRead<'a> for AxisValueFormat1<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -525,6 +540,7 @@ pub type AxisValueFormat1<'a> = TableRef<'a, AxisValueFormat1Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> AxisValueFormat1<'a> { /// Format identifier — set to 1. + #[inline] pub fn format(&self) -> u16 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() @@ -533,12 +549,14 @@ impl<'a> AxisValueFormat1<'a> { /// Zero-base index into the axis record array identifying the axis /// of design variation to which the axis value table applies. Must /// be less than designAxisCount. + #[inline] pub fn axis_index(&self) -> u16 { let range = self.shape.axis_index_byte_range(); self.data.read_at(range.start).unwrap() } /// Flags — see below for details. + #[inline] pub fn flags(&self) -> AxisValueTableFlags { let range = self.shape.flags_byte_range(); self.data.read_at(range.start).unwrap() @@ -546,12 +564,14 @@ impl<'a> AxisValueFormat1<'a> { /// The name ID for entries in the 'name' table that provide a /// display string for this attribute value. + #[inline] pub fn value_name_id(&self) -> NameId { let range = self.shape.value_name_id_byte_range(); self.data.read_at(range.start).unwrap() } /// A numeric value for this attribute value. + #[inline] pub fn value(&self) -> Fixed { let range = self.shape.value_byte_range(); self.data.read_at(range.start).unwrap() @@ -636,6 +656,7 @@ impl MinByteRange for AxisValueFormat2Marker { } impl<'a> FontRead<'a> for AxisValueFormat2<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -655,6 +676,7 @@ pub type AxisValueFormat2<'a> = TableRef<'a, AxisValueFormat2Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> AxisValueFormat2<'a> { /// Format identifier — set to 2. + #[inline] pub fn format(&self) -> u16 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() @@ -663,12 +685,14 @@ impl<'a> AxisValueFormat2<'a> { /// Zero-base index into the axis record array identifying the axis /// of design variation to which the axis value table applies. Must /// be less than designAxisCount. + #[inline] pub fn axis_index(&self) -> u16 { let range = self.shape.axis_index_byte_range(); self.data.read_at(range.start).unwrap() } /// Flags — see below for details. + #[inline] pub fn flags(&self) -> AxisValueTableFlags { let range = self.shape.flags_byte_range(); self.data.read_at(range.start).unwrap() @@ -676,12 +700,14 @@ impl<'a> AxisValueFormat2<'a> { /// The name ID for entries in the 'name' table that provide a /// display string for this attribute value. + #[inline] pub fn value_name_id(&self) -> NameId { let range = self.shape.value_name_id_byte_range(); self.data.read_at(range.start).unwrap() } /// A nominal numeric value for this attribute value. + #[inline] pub fn nominal_value(&self) -> Fixed { let range = self.shape.nominal_value_byte_range(); self.data.read_at(range.start).unwrap() @@ -689,6 +715,7 @@ impl<'a> AxisValueFormat2<'a> { /// The minimum value for a range associated with the specified /// name ID. + #[inline] pub fn range_min_value(&self) -> Fixed { let range = self.shape.range_min_value_byte_range(); self.data.read_at(range.start).unwrap() @@ -696,6 +723,7 @@ impl<'a> AxisValueFormat2<'a> { /// The maximum value for a range associated with the specified /// name ID. + #[inline] pub fn range_max_value(&self) -> Fixed { let range = self.shape.range_max_value_byte_range(); self.data.read_at(range.start).unwrap() @@ -777,6 +805,7 @@ impl MinByteRange for AxisValueFormat3Marker { } impl<'a> FontRead<'a> for AxisValueFormat3<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -795,6 +824,7 @@ pub type AxisValueFormat3<'a> = TableRef<'a, AxisValueFormat3Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> AxisValueFormat3<'a> { /// Format identifier — set to 3. + #[inline] pub fn format(&self) -> u16 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() @@ -803,12 +833,14 @@ impl<'a> AxisValueFormat3<'a> { /// Zero-base index into the axis record array identifying the axis /// of design variation to which the axis value table applies. Must /// be less than designAxisCount. + #[inline] pub fn axis_index(&self) -> u16 { let range = self.shape.axis_index_byte_range(); self.data.read_at(range.start).unwrap() } /// Flags — see below for details. + #[inline] pub fn flags(&self) -> AxisValueTableFlags { let range = self.shape.flags_byte_range(); self.data.read_at(range.start).unwrap() @@ -816,18 +848,21 @@ impl<'a> AxisValueFormat3<'a> { /// The name ID for entries in the 'name' table that provide a /// display string for this attribute value. + #[inline] pub fn value_name_id(&self) -> NameId { let range = self.shape.value_name_id_byte_range(); self.data.read_at(range.start).unwrap() } /// A numeric value for this attribute value. + #[inline] pub fn value(&self) -> Fixed { let range = self.shape.value_byte_range(); self.data.read_at(range.start).unwrap() } /// The numeric value for a style-linked mapping from this value. + #[inline] pub fn linked_value(&self) -> Fixed { let range = self.shape.linked_value_byte_range(); self.data.read_at(range.start).unwrap() @@ -905,6 +940,7 @@ impl MinByteRange for AxisValueFormat4Marker { } impl<'a> FontRead<'a> for AxisValueFormat4<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -927,6 +963,7 @@ pub type AxisValueFormat4<'a> = TableRef<'a, AxisValueFormat4Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> AxisValueFormat4<'a> { /// Format identifier — set to 4. + #[inline] pub fn format(&self) -> u16 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() @@ -934,12 +971,14 @@ impl<'a> AxisValueFormat4<'a> { /// The total number of axes contributing to this axis-values /// combination. + #[inline] pub fn axis_count(&self) -> u16 { let range = self.shape.axis_count_byte_range(); self.data.read_at(range.start).unwrap() } /// Flags — see below for details. + #[inline] pub fn flags(&self) -> AxisValueTableFlags { let range = self.shape.flags_byte_range(); self.data.read_at(range.start).unwrap() @@ -947,6 +986,7 @@ impl<'a> AxisValueFormat4<'a> { /// The name ID for entries in the 'name' table that provide a /// display string for this combination of axis values. + #[inline] pub fn value_name_id(&self) -> NameId { let range = self.shape.value_name_id_byte_range(); self.data.read_at(range.start).unwrap() @@ -954,6 +994,7 @@ impl<'a> AxisValueFormat4<'a> { /// Array of AxisValue records that provide the combination of axis /// values, one for each contributing axis. + #[inline] pub fn axis_values(&self) -> &'a [AxisValueRecord] { let range = self.shape.axis_values_byte_range(); self.data.read_array(range).unwrap() @@ -1007,11 +1048,13 @@ pub struct AxisValueRecord { impl AxisValueRecord { /// Zero-base index into the axis record array identifying the axis /// to which this value applies. Must be less than designAxisCount. + #[inline] pub fn axis_index(&self) -> u16 { self.axis_index.get() } /// A numeric value for this attribute value. + #[inline] pub fn value(&self) -> Fixed { self.value.get() } diff --git a/read-fonts/generated/generated_svg.rs b/read-fonts/generated/generated_svg.rs index 0d4e75cff..858ba6ed3 100644 --- a/read-fonts/generated/generated_svg.rs +++ b/read-fonts/generated/generated_svg.rs @@ -39,6 +39,7 @@ impl TopLevelTable for Svg<'_> { } impl<'a> FontRead<'a> for Svg<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -54,6 +55,7 @@ pub type Svg<'a> = TableRef<'a, SvgMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> Svg<'a> { /// Table version (starting at 0). Set to 0. + #[inline] pub fn version(&self) -> u16 { let range = self.shape.version_byte_range(); self.data.read_at(range.start).unwrap() @@ -61,6 +63,7 @@ impl<'a> Svg<'a> { /// Offset to the SVGDocumentList, from the start of the SVG table. /// Must be non-zero. + #[inline] pub fn svg_document_list_offset(&self) -> Offset32 { let range = self.shape.svg_document_list_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -124,6 +127,7 @@ impl MinByteRange for SVGDocumentListMarker { } impl<'a> FontRead<'a> for SVGDocumentList<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let num_entries: u16 = cursor.read()?; @@ -143,12 +147,14 @@ pub type SVGDocumentList<'a> = TableRef<'a, SVGDocumentListMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> SVGDocumentList<'a> { /// Number of SVGDocumentRecords. Must be non-zero. + #[inline] pub fn num_entries(&self) -> u16 { let range = self.shape.num_entries_byte_range(); self.data.read_at(range.start).unwrap() } /// Array of SVGDocumentRecords. + #[inline] pub fn document_records(&self) -> &'a [SVGDocumentRecord] { let range = self.shape.document_records_byte_range(); self.data.read_array(range).unwrap() @@ -202,22 +208,26 @@ pub struct SVGDocumentRecord { impl SVGDocumentRecord { /// The first glyph ID for the range covered by this record. + #[inline] pub fn start_glyph_id(&self) -> GlyphId16 { self.start_glyph_id.get() } /// The last glyph ID for the range covered by this record. + #[inline] pub fn end_glyph_id(&self) -> GlyphId16 { self.end_glyph_id.get() } /// Offset from the beginning of the SVGDocumentList to an SVG /// document. Must be non-zero. + #[inline] pub fn svg_doc_offset(&self) -> u32 { self.svg_doc_offset.get() } /// Length of the SVG document data. Must be non-zero. + #[inline] pub fn svg_doc_length(&self) -> u32 { self.svg_doc_length.get() } diff --git a/read-fonts/generated/generated_test_conditions.rs b/read-fonts/generated/generated_test_conditions.rs index c720ffd88..7db37251d 100644 --- a/read-fonts/generated/generated_test_conditions.rs +++ b/read-fonts/generated/generated_test_conditions.rs @@ -41,6 +41,7 @@ impl MinByteRange for MajorMinorVersionMarker { } impl<'a> FontRead<'a> for MajorMinorVersion<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let version: MajorMinor = cursor.read()?; @@ -70,21 +71,25 @@ pub type MajorMinorVersion<'a> = TableRef<'a, MajorMinorVersionMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> MajorMinorVersion<'a> { + #[inline] pub fn version(&self) -> MajorMinor { let range = self.shape.version_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn always_present(&self) -> u16 { let range = self.shape.always_present_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn if_11(&self) -> Option { let range = self.shape.if_11_byte_range()?; Some(self.data.read_at(range.start).unwrap()) } + #[inline] pub fn if_20(&self) -> Option { let range = self.shape.if_20_byte_range()?; Some(self.data.read_at(range.start).unwrap()) @@ -467,6 +472,7 @@ impl MinByteRange for FlagDayMarker { } impl<'a> FontRead<'a> for FlagDay<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -504,26 +510,31 @@ pub type FlagDay<'a> = TableRef<'a, FlagDayMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> FlagDay<'a> { + #[inline] pub fn volume(&self) -> u16 { let range = self.shape.volume_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn flags(&self) -> GotFlags { let range = self.shape.flags_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn foo(&self) -> Option { let range = self.shape.foo_byte_range()?; Some(self.data.read_at(range.start).unwrap()) } + #[inline] pub fn bar(&self) -> Option { let range = self.shape.bar_byte_range()?; Some(self.data.read_at(range.start).unwrap()) } + #[inline] pub fn baz(&self) -> Option { let range = self.shape.baz_byte_range()?; Some(self.data.read_at(range.start).unwrap()) @@ -620,6 +631,7 @@ impl MinByteRange for FieldsAfterConditionalsMarker { } impl<'a> FontRead<'a> for FieldsAfterConditionals<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let flags: GotFlags = cursor.read()?; @@ -659,36 +671,43 @@ pub type FieldsAfterConditionals<'a> = TableRef<'a, FieldsAfterConditionalsMarke #[allow(clippy::needless_lifetimes)] impl<'a> FieldsAfterConditionals<'a> { + #[inline] pub fn flags(&self) -> GotFlags { let range = self.shape.flags_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn foo(&self) -> Option { let range = self.shape.foo_byte_range()?; Some(self.data.read_at(range.start).unwrap()) } + #[inline] pub fn always_here(&self) -> u16 { let range = self.shape.always_here_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn bar(&self) -> Option { let range = self.shape.bar_byte_range()?; Some(self.data.read_at(range.start).unwrap()) } + #[inline] pub fn baz(&self) -> Option { let range = self.shape.baz_byte_range()?; Some(self.data.read_at(range.start).unwrap()) } + #[inline] pub fn also_always_here(&self) -> u16 { let range = self.shape.also_always_here_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn and_me_too(&self) -> u16 { let range = self.shape.and_me_too_byte_range(); self.data.read_at(range.start).unwrap() diff --git a/read-fonts/generated/generated_test_count_all.rs b/read-fonts/generated/generated_test_count_all.rs index 052e07fdc..781440eb3 100644 --- a/read-fonts/generated/generated_test_count_all.rs +++ b/read-fonts/generated/generated_test_count_all.rs @@ -30,6 +30,7 @@ impl MinByteRange for CountAll16Marker { } impl<'a> FontRead<'a> for CountAll16<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -43,11 +44,13 @@ pub type CountAll16<'a> = TableRef<'a, CountAll16Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> CountAll16<'a> { + #[inline] pub fn some_field(&self) -> u16 { let range = self.shape.some_field_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn remainder(&self) -> &'a [BigEndian] { let range = self.shape.remainder_byte_range(); self.data.read_array(range).unwrap() @@ -101,6 +104,7 @@ impl MinByteRange for CountAll32Marker { } impl<'a> FontRead<'a> for CountAll32<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -114,11 +118,13 @@ pub type CountAll32<'a> = TableRef<'a, CountAll32Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> CountAll32<'a> { + #[inline] pub fn some_field(&self) -> u16 { let range = self.shape.some_field_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn remainder(&self) -> &'a [BigEndian] { let range = self.shape.remainder_byte_range(); self.data.read_array(range).unwrap() diff --git a/read-fonts/generated/generated_test_enum.rs b/read-fonts/generated/generated_test_enum.rs index e5879ed8b..bdf8e49f0 100644 --- a/read-fonts/generated/generated_test_enum.rs +++ b/read-fonts/generated/generated_test_enum.rs @@ -105,10 +105,12 @@ pub struct MyRecord { } impl MyRecord { + #[inline] pub fn my_enum1(&self) -> MyEnum1 { self.my_enum1.get() } + #[inline] pub fn my_enum2(&self) -> MyEnum2 { self.my_enum2.get() } diff --git a/read-fonts/generated/generated_test_formats.rs b/read-fonts/generated/generated_test_formats.rs index 225e10006..5587b82f5 100644 --- a/read-fonts/generated/generated_test_formats.rs +++ b/read-fonts/generated/generated_test_formats.rs @@ -37,6 +37,7 @@ impl MinByteRange for Table1Marker { } impl<'a> FontRead<'a> for Table1<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -50,16 +51,19 @@ pub type Table1<'a> = TableRef<'a, Table1Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> Table1<'a> { + #[inline] pub fn format(&self) -> u16 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn heft(&self) -> u32 { let range = self.shape.heft_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn flex(&self) -> u16 { let range = self.shape.flex_byte_range(); self.data.read_at(range.start).unwrap() @@ -123,6 +127,7 @@ impl MinByteRange for Table2Marker { } impl<'a> FontRead<'a> for Table2<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -139,16 +144,19 @@ pub type Table2<'a> = TableRef<'a, Table2Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> Table2<'a> { + #[inline] pub fn format(&self) -> u16 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn value_count(&self) -> u16 { let range = self.shape.value_count_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn values(&self) -> &'a [BigEndian] { let range = self.shape.values_byte_range(); self.data.read_array(range).unwrap() @@ -205,6 +213,7 @@ impl MinByteRange for Table3Marker { } impl<'a> FontRead<'a> for Table3<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -217,11 +226,13 @@ pub type Table3<'a> = TableRef<'a, Table3Marker>; #[allow(clippy::needless_lifetimes)] impl<'a> Table3<'a> { + #[inline] pub fn format(&self) -> u16 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn something(&self) -> u16 { let range = self.shape.something_byte_range(); self.data.read_at(range.start).unwrap() diff --git a/read-fonts/generated/generated_test_offsets_arrays.rs b/read-fonts/generated/generated_test_offsets_arrays.rs index 365c9e8a8..14df3c0aa 100644 --- a/read-fonts/generated/generated_test_offsets_arrays.rs +++ b/read-fonts/generated/generated_test_offsets_arrays.rs @@ -67,6 +67,7 @@ impl MinByteRange for KindsOfOffsetsMarker { } impl<'a> FontRead<'a> for KindsOfOffsets<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let version: MajorMinor = cursor.read()?; @@ -109,12 +110,14 @@ pub type KindsOfOffsets<'a> = TableRef<'a, KindsOfOffsetsMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> KindsOfOffsets<'a> { /// The major/minor version of the GDEF table + #[inline] pub fn version(&self) -> MajorMinor { let range = self.shape.version_byte_range(); self.data.read_at(range.start).unwrap() } /// A normal offset + #[inline] pub fn nonnullable_offset(&self) -> Offset16 { let range = self.shape.nonnullable_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -127,6 +130,7 @@ impl<'a> KindsOfOffsets<'a> { } /// An offset that is nullable, but always present + #[inline] pub fn nullable_offset(&self) -> Nullable { let range = self.shape.nullable_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -139,12 +143,14 @@ impl<'a> KindsOfOffsets<'a> { } /// count of the array at array_offset + #[inline] pub fn array_offset_count(&self) -> u16 { let range = self.shape.array_offset_count_byte_range(); self.data.read_at(range.start).unwrap() } /// An offset to an array: + #[inline] pub fn array_offset(&self) -> Offset16 { let range = self.shape.array_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -158,6 +164,7 @@ impl<'a> KindsOfOffsets<'a> { } /// An offset to an array of records + #[inline] pub fn record_array_offset(&self) -> Offset16 { let range = self.shape.record_array_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -171,6 +178,7 @@ impl<'a> KindsOfOffsets<'a> { } /// A nullable, versioned offset to an array of records + #[inline] pub fn versioned_nullable_record_array_offset(&self) -> Option> { let range = self .shape @@ -187,6 +195,7 @@ impl<'a> KindsOfOffsets<'a> { } /// A normal offset that is versioned + #[inline] pub fn versioned_nonnullable_offset(&self) -> Option { let range = self.shape.versioned_nonnullable_offset_byte_range()?; Some(self.data.read_at(range.start).unwrap()) @@ -199,6 +208,7 @@ impl<'a> KindsOfOffsets<'a> { } /// An offset that is nullable and versioned + #[inline] pub fn versioned_nullable_offset(&self) -> Option> { let range = self.shape.versioned_nullable_offset_byte_range()?; Some(self.data.read_at(range.start).unwrap()) @@ -328,6 +338,7 @@ impl MinByteRange for KindsOfArraysOfOffsetsMarker { } impl<'a> FontRead<'a> for KindsOfArraysOfOffsets<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let version: MajorMinor = cursor.read()?; @@ -380,18 +391,21 @@ pub type KindsOfArraysOfOffsets<'a> = TableRef<'a, KindsOfArraysOfOffsetsMarker> #[allow(clippy::needless_lifetimes)] impl<'a> KindsOfArraysOfOffsets<'a> { /// The version + #[inline] pub fn version(&self) -> MajorMinor { let range = self.shape.version_byte_range(); self.data.read_at(range.start).unwrap() } /// The number of items in each array + #[inline] pub fn count(&self) -> u16 { let range = self.shape.count_byte_range(); self.data.read_at(range.start).unwrap() } /// A normal array offset + #[inline] pub fn nonnullable_offsets(&self) -> &'a [BigEndian] { let range = self.shape.nonnullable_offsets_byte_range(); self.data.read_array(range).unwrap() @@ -405,6 +419,7 @@ impl<'a> KindsOfArraysOfOffsets<'a> { } /// An offset that is nullable, but always present + #[inline] pub fn nullable_offsets(&self) -> &'a [BigEndian>] { let range = self.shape.nullable_offsets_byte_range(); self.data.read_array(range).unwrap() @@ -418,6 +433,7 @@ impl<'a> KindsOfArraysOfOffsets<'a> { } /// A normal offset that is versioned + #[inline] pub fn versioned_nonnullable_offsets(&self) -> Option<&'a [BigEndian]> { let range = self.shape.versioned_nonnullable_offsets_byte_range()?; Some(self.data.read_array(range).unwrap()) @@ -431,6 +447,7 @@ impl<'a> KindsOfArraysOfOffsets<'a> { } /// An offset that is nullable and versioned + #[inline] pub fn versioned_nullable_offsets(&self) -> Option<&'a [BigEndian>]> { let range = self.shape.versioned_nullable_offsets_byte_range()?; Some(self.data.read_array(range).unwrap()) @@ -573,6 +590,7 @@ impl MinByteRange for KindsOfArraysMarker { } impl<'a> FontRead<'a> for KindsOfArrays<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let version: u16 = cursor.read()?; @@ -624,36 +642,42 @@ pub type KindsOfArrays<'a> = TableRef<'a, KindsOfArraysMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> KindsOfArrays<'a> { + #[inline] pub fn version(&self) -> u16 { let range = self.shape.version_byte_range(); self.data.read_at(range.start).unwrap() } /// the number of items in each array + #[inline] pub fn count(&self) -> u16 { let range = self.shape.count_byte_range(); self.data.read_at(range.start).unwrap() } /// an array of scalars + #[inline] pub fn scalars(&self) -> &'a [BigEndian] { let range = self.shape.scalars_byte_range(); self.data.read_array(range).unwrap() } /// an array of records + #[inline] pub fn records(&self) -> &'a [Shmecord] { let range = self.shape.records_byte_range(); self.data.read_array(range).unwrap() } /// a versioned array of scalars + #[inline] pub fn versioned_scalars(&self) -> Option<&'a [BigEndian]> { let range = self.shape.versioned_scalars_byte_range()?; Some(self.data.read_array(range).unwrap()) } /// a versioned array of scalars + #[inline] pub fn versioned_records(&self) -> Option<&'a [Shmecord]> { let range = self.shape.versioned_records_byte_range()?; Some(self.data.read_array(range).unwrap()) @@ -734,6 +758,7 @@ impl MinByteRange for VarLenHaverMarker { } impl<'a> FontRead<'a> for VarLenHaver<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let count: u16 = cursor.read()?; @@ -751,16 +776,19 @@ pub type VarLenHaver<'a> = TableRef<'a, VarLenHaverMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> VarLenHaver<'a> { + #[inline] pub fn count(&self) -> u16 { let range = self.shape.count_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn var_len(&self) -> VarLenArray<'a, VarSizeDummy> { let range = self.shape.var_len_byte_range(); VarLenArray::read(self.data.split_off(range.start).unwrap()).unwrap() } + #[inline] pub fn other_field(&self) -> u32 { let range = self.shape.other_field_byte_range(); self.data.read_at(range.start).unwrap() @@ -813,6 +841,7 @@ impl MinByteRange for DummyMarker { } impl<'a> FontRead<'a> for Dummy<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -825,6 +854,7 @@ pub type Dummy<'a> = TableRef<'a, DummyMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> Dummy<'a> { + #[inline] pub fn value(&self) -> u16 { let range = self.shape.value_byte_range(); self.data.read_at(range.start).unwrap() @@ -861,10 +891,12 @@ pub struct Shmecord { } impl Shmecord { + #[inline] pub fn length(&self) -> u16 { self.length.get() } + #[inline] pub fn breadth(&self) -> u32 { self.breadth.get() } diff --git a/read-fonts/generated/generated_test_records.rs b/read-fonts/generated/generated_test_records.rs index 4181801ef..5f2088fca 100644 --- a/read-fonts/generated/generated_test_records.rs +++ b/read-fonts/generated/generated_test_records.rs @@ -46,6 +46,7 @@ impl MinByteRange for BasicTableMarker { } impl<'a> FontRead<'a> for BasicTable<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let simple_count: u16 = cursor.read()?; @@ -72,26 +73,31 @@ pub type BasicTable<'a> = TableRef<'a, BasicTableMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> BasicTable<'a> { + #[inline] pub fn simple_count(&self) -> u16 { let range = self.shape.simple_count_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn simple_records(&self) -> &'a [SimpleRecord] { let range = self.shape.simple_records_byte_range(); self.data.read_array(range).unwrap() } + #[inline] pub fn arrays_inner_count(&self) -> u16 { let range = self.shape.arrays_inner_count_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn array_records_count(&self) -> u32 { let range = self.shape.array_records_count_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn array_records(&self) -> ComputedArray<'a, ContainsArrays<'a>> { let range = self.shape.array_records_byte_range(); self.data @@ -151,10 +157,12 @@ pub struct SimpleRecord { } impl SimpleRecord { + #[inline] pub fn val1(&self) -> u16 { self.val1.get() } + #[inline] pub fn va2(&self) -> u32 { self.va2.get() } @@ -186,10 +194,12 @@ pub struct ContainsArrays<'a> { } impl<'a> ContainsArrays<'a> { + #[inline] pub fn scalars(&self) -> &'a [BigEndian] { self.scalars } + #[inline] pub fn records(&self) -> &'a [SimpleRecord] { self.records } @@ -277,10 +287,12 @@ pub struct ContainsOffsets { } impl ContainsOffsets { + #[inline] pub fn off_array_count(&self) -> u16 { self.off_array_count.get() } + #[inline] pub fn array_offset(&self) -> Offset16 { self.array_offset.get() } @@ -293,6 +305,7 @@ impl ContainsOffsets { self.array_offset().resolve_with_args(data, &args) } + #[inline] pub fn other_offset(&self) -> Offset32 { self.other_offset.get() } @@ -361,6 +374,7 @@ impl MinByteRange for VarLenItemMarker { } impl<'a> FontRead<'a> for VarLenItem<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -374,11 +388,13 @@ pub type VarLenItem<'a> = TableRef<'a, VarLenItemMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> VarLenItem<'a> { + #[inline] pub fn length(&self) -> u32 { let range = self.shape.length_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn data(&self) -> &'a [u8] { let range = self.shape.data_byte_range(); self.data.read_array(range).unwrap() diff --git a/read-fonts/generated/generated_trak.rs b/read-fonts/generated/generated_trak.rs index 6c2d58a60..e9516e994 100644 --- a/read-fonts/generated/generated_trak.rs +++ b/read-fonts/generated/generated_trak.rs @@ -49,6 +49,7 @@ impl TopLevelTable for Trak<'_> { } impl<'a> FontRead<'a> for Trak<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -66,18 +67,21 @@ pub type Trak<'a> = TableRef<'a, TrakMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> Trak<'a> { /// Version number of the tracking table (0x00010000 for the current version). + #[inline] pub fn version(&self) -> MajorMinor { let range = self.shape.version_byte_range(); self.data.read_at(range.start).unwrap() } /// Format of the tracking table (set to 0). + #[inline] pub fn format(&self) -> u16 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset from start of tracking table to TrackData for horizontal text (or 0 if none). + #[inline] pub fn horiz_offset(&self) -> Nullable { let range = self.shape.horiz_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -90,6 +94,7 @@ impl<'a> Trak<'a> { } /// Offset from start of tracking table to TrackData for vertical text (or 0 if none). + #[inline] pub fn vert_offset(&self) -> Nullable { let range = self.shape.vert_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -168,6 +173,7 @@ impl MinByteRange for TrackDataMarker { } impl<'a> FontRead<'a> for TrackData<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let n_tracks: u16 = cursor.read()?; @@ -189,24 +195,28 @@ pub type TrackData<'a> = TableRef<'a, TrackDataMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> TrackData<'a> { /// Number of separate tracks included in this table. + #[inline] pub fn n_tracks(&self) -> u16 { let range = self.shape.n_tracks_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of point sizes included in this table. + #[inline] pub fn n_sizes(&self) -> u16 { let range = self.shape.n_sizes_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset from the start of the tracking table to the start of the size subtable. + #[inline] pub fn size_table_offset(&self) -> u32 { let range = self.shape.size_table_offset_byte_range(); self.data.read_at(range.start).unwrap() } /// Array of TrackTableEntry records. + #[inline] pub fn track_table(&self) -> &'a [TrackTableEntry] { let range = self.shape.track_table_byte_range(); self.data.read_array(range).unwrap() @@ -259,16 +269,19 @@ pub struct TrackTableEntry { impl TrackTableEntry { /// Track value for this record. + #[inline] pub fn track(&self) -> Fixed { self.track.get() } /// The 'name' table index for this track (a short word or phrase like \"loose\" or \"very tight\"). NameIndex has a value greater than 255 and less than 32768. + #[inline] pub fn name_index(&self) -> NameId { self.name_index.get() } /// Offset from the start of the tracking table to per-size tracking values for this track. + #[inline] pub fn offset(&self) -> u16 { self.offset.get() } diff --git a/read-fonts/generated/generated_varc.rs b/read-fonts/generated/generated_varc.rs index e137ba6d0..0573bb76a 100644 --- a/read-fonts/generated/generated_varc.rs +++ b/read-fonts/generated/generated_varc.rs @@ -56,6 +56,7 @@ impl TopLevelTable for Varc<'_> { } impl<'a> FontRead<'a> for Varc<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -76,11 +77,13 @@ pub type Varc<'a> = TableRef<'a, VarcMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> Varc<'a> { /// Major/minor version number. Set to 1.0. + #[inline] pub fn version(&self) -> MajorMinor { let range = self.shape.version_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn coverage_offset(&self) -> Offset32 { let range = self.shape.coverage_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -92,6 +95,7 @@ impl<'a> Varc<'a> { self.coverage_offset().resolve(data) } + #[inline] pub fn multi_var_store_offset(&self) -> Nullable { let range = self.shape.multi_var_store_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -103,6 +107,7 @@ impl<'a> Varc<'a> { self.multi_var_store_offset().resolve(data) } + #[inline] pub fn condition_list_offset(&self) -> Nullable { let range = self.shape.condition_list_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -114,6 +119,7 @@ impl<'a> Varc<'a> { self.condition_list_offset().resolve(data) } + #[inline] pub fn axis_indices_list_offset(&self) -> Nullable { let range = self.shape.axis_indices_list_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -125,6 +131,7 @@ impl<'a> Varc<'a> { self.axis_indices_list_offset().resolve(data) } + #[inline] pub fn var_composite_glyphs_offset(&self) -> Offset32 { let range = self.shape.var_composite_glyphs_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -222,6 +229,7 @@ impl MinByteRange for MultiItemVariationStoreMarker { } impl<'a> FontRead<'a> for MultiItemVariationStore<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -243,11 +251,13 @@ pub type MultiItemVariationStore<'a> = TableRef<'a, MultiItemVariationStoreMarke #[allow(clippy::needless_lifetimes)] impl<'a> MultiItemVariationStore<'a> { + #[inline] pub fn format(&self) -> u16 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn region_list_offset(&self) -> Offset32 { let range = self.shape.region_list_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -259,11 +269,13 @@ impl<'a> MultiItemVariationStore<'a> { self.region_list_offset().resolve(data) } + #[inline] pub fn variation_data_count(&self) -> u16 { let range = self.shape.variation_data_count_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn variation_data_offsets(&self) -> &'a [BigEndian] { let range = self.shape.variation_data_offsets_byte_range(); self.data.read_array(range).unwrap() @@ -345,6 +357,7 @@ impl MinByteRange for SparseVariationRegionListMarker { } impl<'a> FontRead<'a> for SparseVariationRegionList<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let region_count: u16 = cursor.read()?; @@ -362,11 +375,13 @@ pub type SparseVariationRegionList<'a> = TableRef<'a, SparseVariationRegionListM #[allow(clippy::needless_lifetimes)] impl<'a> SparseVariationRegionList<'a> { + #[inline] pub fn region_count(&self) -> u16 { let range = self.shape.region_count_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn region_offsets(&self) -> &'a [BigEndian] { let range = self.shape.region_offsets_byte_range(); self.data.read_array(range).unwrap() @@ -440,6 +455,7 @@ impl MinByteRange for SparseVariationRegionMarker { } impl<'a> FontRead<'a> for SparseVariationRegion<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let region_axis_count: u16 = cursor.read()?; @@ -457,11 +473,13 @@ pub type SparseVariationRegion<'a> = TableRef<'a, SparseVariationRegionMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> SparseVariationRegion<'a> { + #[inline] pub fn region_axis_count(&self) -> u16 { let range = self.shape.region_axis_count_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn region_axis_offsets(&self) -> &'a [SparseRegionAxisCoordinates] { let range = self.shape.region_axis_offsets_byte_range(); self.data.read_array(range).unwrap() @@ -508,18 +526,22 @@ pub struct SparseRegionAxisCoordinates { } impl SparseRegionAxisCoordinates { + #[inline] pub fn axis_index(&self) -> u16 { self.axis_index.get() } + #[inline] pub fn start(&self) -> F2Dot14 { self.start.get() } + #[inline] pub fn peak(&self) -> F2Dot14 { self.peak.get() } + #[inline] pub fn end(&self) -> F2Dot14 { self.end.get() } @@ -587,6 +609,7 @@ impl MinByteRange for MultiItemVariationDataMarker { } impl<'a> FontRead<'a> for MultiItemVariationData<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -609,21 +632,25 @@ pub type MultiItemVariationData<'a> = TableRef<'a, MultiItemVariationDataMarker> #[allow(clippy::needless_lifetimes)] impl<'a> MultiItemVariationData<'a> { + #[inline] pub fn format(&self) -> u8 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn region_index_count(&self) -> u16 { let range = self.shape.region_index_count_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn region_indices(&self) -> &'a [BigEndian] { let range = self.shape.region_indices_byte_range(); self.data.read_array(range).unwrap() } + #[inline] pub fn raw_delta_sets(&self) -> &'a [u8] { let range = self.shape.raw_delta_sets_byte_range(); self.data.read_array(range).unwrap() @@ -679,6 +706,7 @@ impl MinByteRange for ConditionListMarker { } impl<'a> FontRead<'a> for ConditionList<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let condition_count: u32 = cursor.read()?; @@ -696,11 +724,13 @@ pub type ConditionList<'a> = TableRef<'a, ConditionListMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> ConditionList<'a> { + #[inline] pub fn condition_count(&self) -> u32 { let range = self.shape.condition_count_byte_range(); self.data.read_at(range.start).unwrap() } + #[inline] pub fn condition_offsets(&self) -> &'a [BigEndian] { let range = self.shape.condition_offsets_byte_range(); self.data.read_array(range).unwrap() diff --git a/read-fonts/generated/generated_variations.rs b/read-fonts/generated/generated_variations.rs index cd0733183..f5a3a9ede 100644 --- a/read-fonts/generated/generated_variations.rs +++ b/read-fonts/generated/generated_variations.rs @@ -52,6 +52,7 @@ impl ReadArgs for TupleVariationHeader<'_> { } impl<'a> FontReadWithArgs<'a> for TupleVariationHeader<'a> { + #[inline] fn read_with_args(data: FontData<'a>, args: &u16) -> Result { let axis_count = *args; let mut cursor = data.cursor(); @@ -84,6 +85,7 @@ impl<'a> TupleVariationHeader<'a> { /// /// This type requires some external state in order to be /// parsed. + #[inline] pub fn read(data: FontData<'a>, axis_count: u16) -> Result { let args = axis_count; Self::read_with_args(data, &args) @@ -97,6 +99,7 @@ pub type TupleVariationHeader<'a> = TableRef<'a, TupleVariationHeaderMarker>; impl<'a> TupleVariationHeader<'a> { /// The size in bytes of the serialized data for this tuple /// variation table. + #[inline] pub fn variation_data_size(&self) -> u16 { let range = self.shape.variation_data_size_byte_range(); self.data.read_at(range.start).unwrap() @@ -104,6 +107,7 @@ impl<'a> TupleVariationHeader<'a> { /// A packed field. The high 4 bits are flags (see below). The low /// 12 bits are an index into a shared tuple records array. + #[inline] pub fn tuple_index(&self) -> TupleIndex { let range = self.shape.tuple_index_byte_range(); self.data.read_at(range.start).unwrap() @@ -154,6 +158,7 @@ impl<'a> Tuple<'a> { /// /// The number of elements must match the axisCount specified in the /// 'fvar' table. + #[inline] pub fn values(&self) -> &'a [BigEndian] { self.values } @@ -249,6 +254,7 @@ impl MinByteRange for DeltaSetIndexMapFormat0Marker { } impl<'a> FontRead<'a> for DeltaSetIndexMapFormat0<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -268,6 +274,7 @@ pub type DeltaSetIndexMapFormat0<'a> = TableRef<'a, DeltaSetIndexMapFormat0Marke #[allow(clippy::needless_lifetimes)] impl<'a> DeltaSetIndexMapFormat0<'a> { /// DeltaSetIndexMap format: set to 0. + #[inline] pub fn format(&self) -> u8 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() @@ -275,18 +282,21 @@ impl<'a> DeltaSetIndexMapFormat0<'a> { /// A packed field that describes the compressed representation of /// delta-set indices. See details below. + #[inline] pub fn entry_format(&self) -> EntryFormat { let range = self.shape.entry_format_byte_range(); self.data.read_at(range.start).unwrap() } /// The number of mapping entries. + #[inline] pub fn map_count(&self) -> u16 { let range = self.shape.map_count_byte_range(); self.data.read_at(range.start).unwrap() } /// The delta-set index mapping data. See details below. + #[inline] pub fn map_data(&self) -> &'a [u8] { let range = self.shape.map_data_byte_range(); self.data.read_array(range).unwrap() @@ -357,6 +367,7 @@ impl MinByteRange for DeltaSetIndexMapFormat1Marker { } impl<'a> FontRead<'a> for DeltaSetIndexMapFormat1<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -376,6 +387,7 @@ pub type DeltaSetIndexMapFormat1<'a> = TableRef<'a, DeltaSetIndexMapFormat1Marke #[allow(clippy::needless_lifetimes)] impl<'a> DeltaSetIndexMapFormat1<'a> { /// DeltaSetIndexMap format: set to 1. + #[inline] pub fn format(&self) -> u8 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() @@ -383,18 +395,21 @@ impl<'a> DeltaSetIndexMapFormat1<'a> { /// A packed field that describes the compressed representation of /// delta-set indices. See details below. + #[inline] pub fn entry_format(&self) -> EntryFormat { let range = self.shape.entry_format_byte_range(); self.data.read_at(range.start).unwrap() } /// The number of mapping entries. + #[inline] pub fn map_count(&self) -> u32 { let range = self.shape.map_count_byte_range(); self.data.read_at(range.start).unwrap() } /// The delta-set index mapping data. See details below. + #[inline] pub fn map_data(&self) -> &'a [u8] { let range = self.shape.map_data_byte_range(); self.data.read_array(range).unwrap() @@ -856,6 +871,7 @@ impl MinByteRange for VariationRegionListMarker { } impl<'a> FontRead<'a> for VariationRegionList<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let axis_count: u16 = cursor.read()?; @@ -877,6 +893,7 @@ pub type VariationRegionList<'a> = TableRef<'a, VariationRegionListMarker>; impl<'a> VariationRegionList<'a> { /// The number of variation axes for this font. This must be the /// same number as axisCount in the 'fvar' table. + #[inline] pub fn axis_count(&self) -> u16 { let range = self.shape.axis_count_byte_range(); self.data.read_at(range.start).unwrap() @@ -884,12 +901,14 @@ impl<'a> VariationRegionList<'a> { /// The number of variation region tables in the variation region /// list. Must be less than 32,768. + #[inline] pub fn region_count(&self) -> u16 { let range = self.shape.region_count_byte_range(); self.data.read_at(range.start).unwrap() } /// Array of variation regions. + #[inline] pub fn variation_regions(&self) -> ComputedArray<'a, VariationRegion<'a>> { let range = self.shape.variation_regions_byte_range(); self.data.read_with_args(range, &self.axis_count()).unwrap() @@ -937,6 +956,7 @@ pub struct VariationRegion<'a> { impl<'a> VariationRegion<'a> { /// Array of region axis coordinates records, in the order of axes /// given in the 'fvar' table. + #[inline] pub fn region_axes(&self) -> &'a [RegionAxisCoordinates] { self.region_axes } @@ -1014,16 +1034,19 @@ pub struct RegionAxisCoordinates { impl RegionAxisCoordinates { /// The region start coordinate value for the current axis. + #[inline] pub fn start_coord(&self) -> F2Dot14 { self.start_coord.get() } /// The region peak coordinate value for the current axis. + #[inline] pub fn peak_coord(&self) -> F2Dot14 { self.peak_coord.get() } /// The region end coordinate value for the current axis. + #[inline] pub fn end_coord(&self) -> F2Dot14 { self.end_coord.get() } @@ -1086,6 +1109,7 @@ impl MinByteRange for ItemVariationStoreMarker { } impl<'a> FontRead<'a> for ItemVariationStore<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -1107,6 +1131,7 @@ pub type ItemVariationStore<'a> = TableRef<'a, ItemVariationStoreMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> ItemVariationStore<'a> { /// Format— set to 1 + #[inline] pub fn format(&self) -> u16 { let range = self.shape.format_byte_range(); self.data.read_at(range.start).unwrap() @@ -1114,6 +1139,7 @@ impl<'a> ItemVariationStore<'a> { /// Offset in bytes from the start of the item variation store to /// the variation region list. + #[inline] pub fn variation_region_list_offset(&self) -> Offset32 { let range = self.shape.variation_region_list_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -1126,6 +1152,7 @@ impl<'a> ItemVariationStore<'a> { } /// The number of item variation data subtables. + #[inline] pub fn item_variation_data_count(&self) -> u16 { let range = self.shape.item_variation_data_count_byte_range(); self.data.read_at(range.start).unwrap() @@ -1133,6 +1160,7 @@ impl<'a> ItemVariationStore<'a> { /// Offsets in bytes from the start of the item variation store to /// each item variation data subtable. + #[inline] pub fn item_variation_data_offsets(&self) -> &'a [BigEndian>] { let range = self.shape.item_variation_data_offsets_byte_range(); self.data.read_array(range).unwrap() @@ -1236,6 +1264,7 @@ impl MinByteRange for ItemVariationDataMarker { } impl<'a> FontRead<'a> for ItemVariationData<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); let item_count: u16 = cursor.read()?; @@ -1263,18 +1292,21 @@ pub type ItemVariationData<'a> = TableRef<'a, ItemVariationDataMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> ItemVariationData<'a> { /// The number of delta sets for distinct items. + #[inline] pub fn item_count(&self) -> u16 { let range = self.shape.item_count_byte_range(); self.data.read_at(range.start).unwrap() } /// A packed field: the high bit is a flag—see details below. + #[inline] pub fn word_delta_count(&self) -> u16 { let range = self.shape.word_delta_count_byte_range(); self.data.read_at(range.start).unwrap() } /// The number of variation regions referenced. + #[inline] pub fn region_index_count(&self) -> u16 { let range = self.shape.region_index_count_byte_range(); self.data.read_at(range.start).unwrap() @@ -1282,12 +1314,14 @@ impl<'a> ItemVariationData<'a> { /// Array of indices into the variation region list for the regions /// referenced by this item variation data table. + #[inline] pub fn region_indexes(&self) -> &'a [BigEndian] { let range = self.shape.region_indexes_byte_range(); self.data.read_array(range).unwrap() } /// Delta-set rows. + #[inline] pub fn delta_sets(&self) -> &'a [u8] { let range = self.shape.delta_sets_byte_range(); self.data.read_array(range).unwrap() diff --git a/read-fonts/generated/generated_vhea.rs b/read-fonts/generated/generated_vhea.rs index 9034afe35..2e228a682 100644 --- a/read-fonts/generated/generated_vhea.rs +++ b/read-fonts/generated/generated_vhea.rs @@ -109,6 +109,7 @@ impl TopLevelTable for Vhea<'_> { } impl<'a> FontRead<'a> for Vhea<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -138,18 +139,21 @@ pub type Vhea<'a> = TableRef<'a, VheaMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> Vhea<'a> { /// The major/minor version (1, 1) + #[inline] pub fn version(&self) -> Version16Dot16 { let range = self.shape.version_byte_range(); self.data.read_at(range.start).unwrap() } /// Typographic ascent. + #[inline] pub fn ascender(&self) -> FWord { let range = self.shape.ascender_byte_range(); self.data.read_at(range.start).unwrap() } /// Typographic descent. + #[inline] pub fn descender(&self) -> FWord { let range = self.shape.descender_byte_range(); self.data.read_at(range.start).unwrap() @@ -157,12 +161,14 @@ impl<'a> Vhea<'a> { /// Typographic line gap. Negative LineGap values are treated as /// zero in some legacy platform implementations. + #[inline] pub fn line_gap(&self) -> FWord { let range = self.shape.line_gap_byte_range(); self.data.read_at(range.start).unwrap() } /// Maximum advance height value in 'vmtx' table. + #[inline] pub fn advance_height_max(&self) -> UfWord { let range = self.shape.advance_height_max_byte_range(); self.data.read_at(range.start).unwrap() @@ -170,18 +176,21 @@ impl<'a> Vhea<'a> { /// Minimum top sidebearing value in 'vmtx' table for glyphs with /// contours (empty glyphs should be ignored). + #[inline] pub fn min_top_side_bearing(&self) -> FWord { let range = self.shape.min_top_side_bearing_byte_range(); self.data.read_at(range.start).unwrap() } /// Minimum bottom sidebearing value + #[inline] pub fn min_bottom_side_bearing(&self) -> FWord { let range = self.shape.min_bottom_side_bearing_byte_range(); self.data.read_at(range.start).unwrap() } /// Defined as max( tsb + (yMax-yMin)). + #[inline] pub fn y_max_extent(&self) -> FWord { let range = self.shape.y_max_extent_byte_range(); self.data.read_at(range.start).unwrap() @@ -189,12 +198,14 @@ impl<'a> Vhea<'a> { /// Used to calculate the slope of the cursor (rise/run); 1 for /// vertical caret, 0 for horizontal. + #[inline] pub fn caret_slope_rise(&self) -> i16 { let range = self.shape.caret_slope_rise_byte_range(); self.data.read_at(range.start).unwrap() } /// 0 for vertical caret, 1 for horizontal. + #[inline] pub fn caret_slope_run(&self) -> i16 { let range = self.shape.caret_slope_run_byte_range(); self.data.read_at(range.start).unwrap() @@ -203,18 +214,21 @@ impl<'a> Vhea<'a> { /// The amount by which a slanted highlight on a glyph needs to be /// shifted to produce the best appearance. Set to 0 for /// non-slanted fonts + #[inline] pub fn caret_offset(&self) -> i16 { let range = self.shape.caret_offset_byte_range(); self.data.read_at(range.start).unwrap() } /// 0 for current format. + #[inline] pub fn metric_data_format(&self) -> i16 { let range = self.shape.metric_data_format_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of advance heights in the vertical metrics (`vmtx`) table. + #[inline] pub fn number_of_long_ver_metrics(&self) -> u16 { let range = self.shape.number_of_long_ver_metrics_byte_range(); self.data.read_at(range.start).unwrap() diff --git a/read-fonts/generated/generated_vmtx.rs b/read-fonts/generated/generated_vmtx.rs index a57110389..c880ca514 100644 --- a/read-fonts/generated/generated_vmtx.rs +++ b/read-fonts/generated/generated_vmtx.rs @@ -41,6 +41,7 @@ impl ReadArgs for Vmtx<'_> { } impl<'a> FontReadWithArgs<'a> for Vmtx<'a> { + #[inline] fn read_with_args(data: FontData<'a>, args: &u16) -> Result { let number_of_long_ver_metrics = *args; let mut cursor = data.cursor(); @@ -63,6 +64,7 @@ impl<'a> Vmtx<'a> { /// /// This type requires some external state in order to be /// parsed. + #[inline] pub fn read(data: FontData<'a>, number_of_long_ver_metrics: u16) -> Result { let args = number_of_long_ver_metrics; Self::read_with_args(data, &args) @@ -76,12 +78,14 @@ pub type Vmtx<'a> = TableRef<'a, VmtxMarker>; impl<'a> Vmtx<'a> { /// Paired advance height and top side bearing values for each /// glyph. Records are indexed by glyph ID. + #[inline] pub fn v_metrics(&self) -> &'a [LongMetric] { let range = self.shape.v_metrics_byte_range(); self.data.read_array(range).unwrap() } /// Top side bearings for glyph IDs greater than or equal to numberOfLongMetrics. + #[inline] pub fn top_side_bearings(&self) -> &'a [BigEndian] { let range = self.shape.top_side_bearings_byte_range(); self.data.read_array(range).unwrap() diff --git a/read-fonts/generated/generated_vorg.rs b/read-fonts/generated/generated_vorg.rs index d7ae485b1..f0342eb0b 100644 --- a/read-fonts/generated/generated_vorg.rs +++ b/read-fonts/generated/generated_vorg.rs @@ -46,6 +46,7 @@ impl TopLevelTable for Vorg<'_> { } impl<'a> FontRead<'a> for Vorg<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -67,6 +68,7 @@ pub type Vorg<'a> = TableRef<'a, VorgMarker>; #[allow(clippy::needless_lifetimes)] impl<'a> Vorg<'a> { /// Major/minor version number. Set to 1.0. + #[inline] pub fn version(&self) -> MajorMinor { let range = self.shape.version_byte_range(); self.data.read_at(range.start).unwrap() @@ -75,18 +77,21 @@ impl<'a> Vorg<'a> { /// The y coordinate of a glyph’s vertical origin, in the font’s design /// coordinate system, to be used if no entry is present for the glyph /// in the vertOriginYMetrics array. + #[inline] pub fn default_vert_origin_y(&self) -> i16 { let range = self.shape.default_vert_origin_y_byte_range(); self.data.read_at(range.start).unwrap() } /// Number of elements in the vertOriginYMetrics array. + #[inline] pub fn num_vert_origin_y_metrics(&self) -> u16 { let range = self.shape.num_vert_origin_y_metrics_byte_range(); self.data.read_at(range.start).unwrap() } /// Array of VertOriginYMetrics records, sorted by glyph ID. + #[inline] pub fn vert_origin_y_metrics(&self) -> &'a [VertOriginYMetrics] { let range = self.shape.vert_origin_y_metrics_byte_range(); self.data.read_array(range).unwrap() @@ -143,11 +148,13 @@ pub struct VertOriginYMetrics { impl VertOriginYMetrics { /// Glyph index. + #[inline] pub fn glyph_index(&self) -> GlyphId16 { self.glyph_index.get() } /// Y coordinate, in the font’s design coordinate system, of the glyph’s vertical origin. + #[inline] pub fn vert_origin_y(&self) -> i16 { self.vert_origin_y.get() } diff --git a/read-fonts/generated/generated_vvar.rs b/read-fonts/generated/generated_vvar.rs index be82f8056..5f3741988 100644 --- a/read-fonts/generated/generated_vvar.rs +++ b/read-fonts/generated/generated_vvar.rs @@ -54,6 +54,7 @@ impl TopLevelTable for Vvar<'_> { } impl<'a> FontRead<'a> for Vvar<'a> { + #[inline] fn read(data: FontData<'a>) -> Result { let mut cursor = data.cursor(); cursor.advance::(); @@ -73,12 +74,14 @@ pub type Vvar<'a> = TableRef<'a, VvarMarker>; impl<'a> Vvar<'a> { /// Major version number of the horizontal metrics variations table — set to 1. /// Minor version number of the horizontal metrics variations table — set to 0. + #[inline] pub fn version(&self) -> MajorMinor { let range = self.shape.version_byte_range(); self.data.read_at(range.start).unwrap() } /// Offset in bytes from the start of this table to the item variation store table. + #[inline] pub fn item_variation_store_offset(&self) -> Offset32 { let range = self.shape.item_variation_store_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -91,6 +94,7 @@ impl<'a> Vvar<'a> { } /// Offset in bytes from the start of this table to the delta-set index mapping for advance heights (may be NULL). + #[inline] pub fn advance_height_mapping_offset(&self) -> Nullable { let range = self.shape.advance_height_mapping_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -103,6 +107,7 @@ impl<'a> Vvar<'a> { } /// Offset in bytes from the start of this table to the delta-set index mapping for top side bearings (may be NULL). + #[inline] pub fn tsb_mapping_offset(&self) -> Nullable { let range = self.shape.tsb_mapping_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -115,6 +120,7 @@ impl<'a> Vvar<'a> { } /// Offset in bytes from the start of this table to the delta-set index mapping for bottom side bearings (may be NULL). + #[inline] pub fn bsb_mapping_offset(&self) -> Nullable { let range = self.shape.bsb_mapping_offset_byte_range(); self.data.read_at(range.start).unwrap() @@ -127,6 +133,7 @@ impl<'a> Vvar<'a> { } /// Offset in bytes from the start of this table to the delta-set index mapping for Y coordinates of vertical origins (may be NULL). + #[inline] pub fn v_org_mapping_offset(&self) -> Nullable { let range = self.shape.v_org_mapping_offset_byte_range(); self.data.read_at(range.start).unwrap()