| 1 | //! Building the STAT table |
| 2 | |
| 3 | // Largely stolen from fea-rs, where it's all private so we can't use it. |
| 4 | // We're uninterested in anything other than 3/1/0x409, so we use Strings instead |
| 5 | // of the more correct NameSpec. |
| 6 | |
| 7 | use fontationsrust-analyzer cargo fontations 0.2.0 crate/::writerust-analyzer cargo write-fonts 0.39.0 crate/::{ |
| 8 | tablesrust-analyzer cargo write-fonts 0.39.0 tables/::{namerust-analyzer cargo write-fonts 0.39.0 tables/name/::NameRecordrust-analyzer cargo write-fonts 0.39.0 tables/name/NameRecord#, statrust-analyzer cargo write-fonts 0.39.0 tables/stat/ as write_statrust-analyzer cargo write-fonts 0.39.0 tables/stat/}, |
| 9 | typesrust-analyzer cargo font-types 0.9.0 crate/::{Fixedrust-analyzer cargo font-types 0.9.0 fixed/Fixed#, NameIdrust-analyzer cargo font-types 0.9.0 name_id/NameId#, Tagrust-analyzer cargo font-types 0.9.0 tag/Tag#}, |
| 10 | }; |
| 11 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::collectionsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/::HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#; |
| 12 | |
| 13 | use craterust-analyzer cargo google-fonts-axisregistry 0.4.15 crate/::nametablerust-analyzer cargo google-fonts-axisregistry 0.4.15 nametable/::find_or_add_namerust-analyzer cargo google-fonts-axisregistry 0.4.15 nametable/find_or_add_name().; |
| 14 | |
| 15 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 16 | pub(craterust-analyzer cargo google-fonts-axisregistry 0.4.15 crate/) struct StatBuilderrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/StatBuilder# { |
| 17 | // pub name: StatFallbackName, |
| 18 | pub recordsrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/StatBuilder#records.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<AxisRecordrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisRecord#>, |
| 19 | pub valuesrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/StatBuilder#values.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<AxisValuerust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisValue#>, |
| 20 | } |
| 21 | |
| 22 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 23 | pub(craterust-analyzer cargo google-fonts-axisregistry 0.4.15 crate/) struct AxisRecordrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisRecord# { |
| 24 | pub tagrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisRecord#tag.: Tagrust-analyzer cargo font-types 0.9.0 tag/Tag#, |
| 25 | pub namerust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisRecord#name.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, |
| 26 | pub orderingrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisRecord#ordering.: u16, |
| 27 | } |
| 28 | |
| 29 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 30 | pub(craterust-analyzer cargo google-fonts-axisregistry 0.4.15 crate/) struct AxisValuerust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisValue# { |
| 31 | pub flagsrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisValue#flags.: u16, |
| 32 | pub namerust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisValue#name.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, |
| 33 | pub locationrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisValue#location.: AxisLocationrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisLocation#, |
| 34 | } |
| 35 | |
| 36 | #[allow(dead_code)] |
| 37 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 38 | pub enum AxisLocationrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisLocation# { |
| 39 | Onerust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisLocation#One# { |
| 40 | tagrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisLocation#One#tag.: Tagrust-analyzer cargo font-types 0.9.0 tag/Tag#, |
| 41 | valuerust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisLocation#One#value.: Fixedrust-analyzer cargo font-types 0.9.0 fixed/Fixed#, |
| 42 | }, |
| 43 | Tworust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisLocation#Two# { |
| 44 | tagrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisLocation#Two#tag.: Tagrust-analyzer cargo font-types 0.9.0 tag/Tag#, |
| 45 | nominalrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisLocation#Two#nominal.: Fixedrust-analyzer cargo font-types 0.9.0 fixed/Fixed#, |
| 46 | minrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisLocation#Two#min.: Fixedrust-analyzer cargo font-types 0.9.0 fixed/Fixed#, |
| 47 | maxrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisLocation#Two#max.: Fixedrust-analyzer cargo font-types 0.9.0 fixed/Fixed#, |
| 48 | }, |
| 49 | Threerust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisLocation#Three# { |
| 50 | tagrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisLocation#Three#tag.: Tagrust-analyzer cargo font-types 0.9.0 tag/Tag#, |
| 51 | valuerust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisLocation#Three#value.: Fixedrust-analyzer cargo font-types 0.9.0 fixed/Fixed#, |
| 52 | linkedrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisLocation#Three#linked.: Fixedrust-analyzer cargo font-types 0.9.0 fixed/Fixed#, |
| 53 | }, |
| 54 | Fourrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisLocation#Four#(Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(Tagrust-analyzer cargo font-types 0.9.0 tag/Tag#, Fixedrust-analyzer cargo font-types 0.9.0 fixed/Fixed#)>), |
| 55 | } |
| 56 | |
| 57 | impl StatBuilderrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/StatBuilder# { |
| 58 | pub(craterust-analyzer cargo google-fonts-axisregistry 0.4.15 crate/) fn buildrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/impl#[StatBuilder]build().(&self, name_records: &mut Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<NameRecordrust-analyzer cargo write-fonts 0.39.0 tables/name/NameRecord#>) -> write_statrust-analyzer cargo write-fonts 0.39.0 tables/stat/::Statrust-analyzer cargo write-fonts 0.39.0 tables/stat/Stat# { |
| 59 | // let elided_fallback_name_id = match &self.name { |
| 60 | // StatFallbackName::Id(id) => *id, |
| 61 | // StatFallbackName::Record(name) => find_or_add_name(name_records, name), |
| 62 | // }; |
| 63 | |
| 64 | //HACK: we jump through a bunch of hoops to ensure our output matches |
| 65 | //feaLib's; in particular we want to add our name table entries grouped by |
| 66 | //axis. |
| 67 | let mut sorted_values = HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#::<Tagrust-analyzer cargo font-types 0.9.0 tag/Tag#, Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V>`]new().(); |
| 68 | let mut sorted_records = self.recordsrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/StatBuilder#records..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>(); |
| 69 | sorted_records.sort_by_keyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]sort_by_key().(|x| x.orderingrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisRecord#ordering.); |
| 70 | |
| 71 | for axis_value in &self.valuesrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/StatBuilder#values. { |
| 72 | match axis_value.locationrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisValue#location. { |
| 73 | AxisLocationrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisLocation#::Onerust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisLocation#One# { tagrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisLocation#One#tag., .. } |
| 74 | | AxisLocationrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisLocation#::Tworust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisLocation#Two# { tagrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisLocation#Two#tag., .. } |
| 75 | | AxisLocationrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisLocation#::Threerust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisLocation#Three# { tagrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisLocation#Three#tag., .. } => { |
| 76 | sorted_values.entryrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]entry().(tag).or_defaultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`Entry<'a, K, V>`]or_default().().pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(axis_value) |
| 77 | } |
| 78 | AxisLocationrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisLocation#::Fourrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisLocation#Four#(_) => sorted_values |
| 79 | .entryrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]entry().(Tagrust-analyzer cargo font-types 0.9.0 tag/Tag#::defaultrust-analyzer cargo font-types 0.9.0 tag/impl#[Tag][Default]default().()) |
| 80 | .or_defaultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`Entry<'a, K, V>`]or_default().() |
| 81 | .pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(axis_value), |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | let mut design_axes = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::with_capacityrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]with_capacity().(self.recordsrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/StatBuilder#records..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().()); |
| 86 | let mut axis_values = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::with_capacityrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]with_capacity().(self.valuesrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/StatBuilder#values..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().()); |
| 87 | |
| 88 | for (i, record) in self.recordsrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/StatBuilder#records..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().() { |
| 89 | let name_id = find_or_add_namerust-analyzer cargo google-fonts-axisregistry 0.4.15 nametable/find_or_add_name().(name_records, &record.namerust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisRecord#name.); |
| 90 | let record = write_statrust-analyzer cargo write-fonts 0.39.0 tables/stat/::AxisRecordrust-analyzer cargo write-fonts 0.39.0 tables/stat/AxisRecord# { |
| 91 | axis_tagrust-analyzer cargo write-fonts 0.39.0 tables/stat/AxisRecord#axis_tag.: record.tagrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisRecord#tag., |
| 92 | axis_name_idrust-analyzer cargo write-fonts 0.39.0 tables/stat/AxisRecord#axis_name_id.: name_id, |
| 93 | axis_orderingrust-analyzer cargo write-fonts 0.39.0 tables/stat/AxisRecord#axis_ordering.: record.orderingrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisRecord#ordering., |
| 94 | }; |
| 95 | for axis_value in sorted_values |
| 96 | .getrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get().(&record.axis_tagrust-analyzer cargo write-fonts 0.39.0 tables/stat/AxisRecord#axis_tag.) |
| 97 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]iter().() |
| 98 | .flat_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#flat_map().(|x| x.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()) |
| 99 | { |
| 100 | let flags = write_statrust-analyzer cargo write-fonts 0.39.0 tables/stat/::AxisValueTableFlagsrust-analyzer cargo read-fonts 0.30.1 tables/stat/AxisValueTableFlags#::from_bitsrust-analyzer cargo read-fonts 0.30.1 tables/stat/impl#[AxisValueTableFlags]from_bits().(axis_value.flagsrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisValue#flags.).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 101 | let name_id = find_or_add_namerust-analyzer cargo google-fonts-axisregistry 0.4.15 nametable/find_or_add_name().(name_records, &axis_value.namerust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisValue#name.); |
| 102 | |
| 103 | let value = match &axis_value.locationrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisValue#location. { |
| 104 | AxisLocationrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisLocation#::Onerust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisLocation#One# { valuerust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisLocation#One#value., .. } => write_statrust-analyzer cargo write-fonts 0.39.0 tables/stat/::AxisValuerust-analyzer cargo write-fonts 0.39.0 tables/stat/AxisValue#::format_1rust-analyzer cargo write-fonts 0.39.0 tables/stat/impl#[AxisValue]format_1().( |
| 105 | //TODO: validate that all referenced tags refer to existing axes |
| 106 | i as u16, flags, name_id, *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().value, |
| 107 | ), |
| 108 | AxisLocationrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisLocation#::Tworust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisLocation#Two# { |
| 109 | nominalrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisLocation#Two#nominal., minrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisLocation#Two#min., maxrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisLocation#Two#max., .. |
| 110 | } => write_statrust-analyzer cargo write-fonts 0.39.0 tables/stat/::AxisValuerust-analyzer cargo write-fonts 0.39.0 tables/stat/AxisValue#::format_2rust-analyzer cargo write-fonts 0.39.0 tables/stat/impl#[AxisValue]format_2().( |
| 111 | i as _, flags, name_id, *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().nominal, *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().min, *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().max, |
| 112 | ), |
| 113 | AxisLocationrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisLocation#::Threerust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisLocation#Three# { valuerust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisLocation#Three#value., linkedrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisLocation#Three#linked., .. } => { |
| 114 | write_statrust-analyzer cargo write-fonts 0.39.0 tables/stat/::AxisValuerust-analyzer cargo write-fonts 0.39.0 tables/stat/AxisValue#::format_3rust-analyzer cargo write-fonts 0.39.0 tables/stat/impl#[AxisValue]format_3().(i as _, flags, name_id, *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().value, *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().linked) |
| 115 | } |
| 116 | |
| 117 | AxisLocationrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisLocation#::Fourrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisLocation#Four#(_) => panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("assigned to separate group"), |
| 118 | }; |
| 119 | axis_values.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(value); |
| 120 | } |
| 121 | |
| 122 | design_axes.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(record); |
| 123 | } |
| 124 | |
| 125 | let format4 = sorted_values |
| 126 | .removerust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]remove().(&Tagrust-analyzer cargo font-types 0.9.0 tag/Tag#::defaultrust-analyzer cargo font-types 0.9.0 tag/impl#[Tag][Default]default().()) |
| 127 | .unwrap_or_defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_default().() |
| 128 | .into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().() |
| 129 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|format4| { |
| 130 | let flags = write_statrust-analyzer cargo write-fonts 0.39.0 tables/stat/::AxisValueTableFlagsrust-analyzer cargo read-fonts 0.30.1 tables/stat/AxisValueTableFlags#::from_bitsrust-analyzer cargo read-fonts 0.30.1 tables/stat/impl#[AxisValueTableFlags]from_bits().(format4.flagsrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisValue#flags.).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 131 | let name_id = find_or_add_namerust-analyzer cargo google-fonts-axisregistry 0.4.15 nametable/find_or_add_name().(name_records, &format4.namerust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisValue#name.); |
| 132 | |
| 133 | let AxisLocationrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisLocation#::Fourrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisLocation#Four#(values) = &format4.locationrust-analyzer cargo google-fonts-axisregistry 0.4.15 stat/AxisValue#location. else { |
| 134 | panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("only format 4 in this group") |
| 135 | }; |
| 136 | let mapping = values |
| 137 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 138 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(tag, value)| { |
| 139 | let axis_index = design_axes |
| 140 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 141 | .positionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'a, T>`][Iterator]position().(|rec| rec.axis_tagrust-analyzer cargo write-fonts 0.39.0 tables/stat/AxisRecord#axis_tag. rust-analyzer cargo font-types 0.9.0 tag/impl#[Tag][`PartialEq<Self>`]eq().==rust-analyzer cargo font-types 0.9.0 tag/impl#[Tag][`PartialEq<Self>`]eq(). rust-analyzer cargo font-types 0.9.0 tag/impl#[Tag][`PartialEq<Self>`]eq().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().tag) |
| 142 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]expect().("validated"); |
| 143 | write_statrust-analyzer cargo write-fonts 0.39.0 tables/stat/::AxisValueRecordrust-analyzer cargo write-fonts 0.39.0 tables/stat/AxisValueRecord#::newrust-analyzer cargo write-fonts 0.39.0 tables/stat/impl#[AxisValueRecord]new().(axis_index as _, *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().value) |
| 144 | }) |
| 145 | .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 146 | write_statrust-analyzer cargo write-fonts 0.39.0 tables/stat/::AxisValuerust-analyzer cargo write-fonts 0.39.0 tables/stat/AxisValue#::format_4rust-analyzer cargo write-fonts 0.39.0 tables/stat/impl#[AxisValue]format_4().(flags, name_id, mapping) |
| 147 | }); |
| 148 | |
| 149 | //feaLib puts format4 records first |
| 150 | let axis_values = format4.chainrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#chain().(axis_values).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 151 | write_statrust-analyzer cargo write-fonts 0.39.0 tables/stat/::Statrust-analyzer cargo write-fonts 0.39.0 tables/stat/Stat#::newrust-analyzer cargo write-fonts 0.39.0 tables/stat/impl#[Stat]new().(design_axes, axis_values, NameIdrust-analyzer cargo font-types 0.9.0 name_id/NameId#::fromrust-analyzer cargo font-types 0.9.0 name_id/impl#[NameId][`From<u16>`]from().(2)) |
| 152 | } |
| 153 | } |