Debian Codegraph @

src/ttfp/variable.rs

raw symbols SCIP
1 use craterust-analyzer cargo ab_glyph 0.2.32 crate/::{FontRefrust-analyzer cargo ab_glyph 0.2.32 ttfp/FontRef#, FontVecrust-analyzer cargo ab_glyph 0.2.32 ttfp/FontVec#, VariableFontrust-analyzer cargo ab_glyph 0.2.32 variable/VariableFont#, VariationAxisrust-analyzer cargo ab_glyph 0.2.32 variable/VariationAxis#};
2 #[cfg(not(feature = "std"))]
3 use allocrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc crate/::vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/::Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#;
4 use owned_ttf_parserrust-analyzer cargo owned_ttf_parser 0.25.1 crate/::{selfrust-analyzer cargo owned_ttf_parser 0.25.1 crate/ as ttfprust-analyzer cargo owned_ttf_parser 0.25.1 crate/, AsFaceRefrust-analyzer cargo owned_ttf_parser 0.25.1 convert/AsFaceRef#, FaceMutrust-analyzer cargo owned_ttf_parser 0.25.1 convert/FaceMut#};
5
6 impl VariableFontrust-analyzer cargo ab_glyph 0.2.32 variable/VariableFont# for FontRefrust-analyzer cargo ab_glyph 0.2.32 ttfp/FontRef#<'_> {
7 fn set_variationrust-analyzer cargo ab_glyph 0.2.32 ttfp/variable/impl#[`FontRef<'_>`][VariableFont]set_variation().(&mut self, axis: &[u8; 4], value: f32) -> bool {
8 let tag = ttfprust-analyzer cargo owned_ttf_parser 0.25.1 crate/::Tagrust-analyzer cargo ttf-parser 0.25.1 Tag#::from_bytesrust-analyzer cargo ttf-parser 0.25.1 impl#[Tag]from_bytes().(axis);
9 // TODO remove existence check in next breaking version
10 let exists = self
11 .0rust-analyzer cargo ab_glyph 0.2.32 ttfp/FontRef#0.
12 .as_face_refrust-analyzer cargo owned_ttf_parser 0.25.1 preparse/impl#[`PreParsedSubtables<'_, F>`][AsFaceRef]as_face_ref().()
13 .variation_axesrust-analyzer cargo ttf-parser 0.25.1 impl#[`Face<'a>`]variation_axes().()
14 .into_iterrust-analyzer cargo ttf-parser 0.25.1 parser/impl#[`LazyArray16<'a, T>`][IntoIterator]into_iter().()
15 .anyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#any().(|axis| axis.tagrust-analyzer cargo ttf-parser 0.25.1 tables/fvar/VariationAxis#tag. rust-analyzer cargo ttf-parser 0.25.1 impl#[Tag][`PartialEq<Self>`]eq().==rust-analyzer cargo ttf-parser 0.25.1 impl#[Tag][`PartialEq<Self>`]eq(). rust-analyzer cargo ttf-parser 0.25.1 impl#[Tag][`PartialEq<Self>`]eq().tag);
16 if exists {
17 self.0rust-analyzer cargo ab_glyph 0.2.32 ttfp/FontRef#0..set_variationrust-analyzer cargo owned_ttf_parser 0.25.1 preparse/impl#[`PreParsedSubtables<'_, F>`][FaceMut]set_variation().(tag, value);
18 }
19 exists
20 }
21
22 fn variationsrust-analyzer cargo ab_glyph 0.2.32 ttfp/variable/impl#[`FontRef<'_>`][VariableFont]variations().(&self) -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<VariationAxisrust-analyzer cargo ab_glyph 0.2.32 variable/VariationAxis#> {
23 variationsrust-analyzer cargo ab_glyph 0.2.32 ttfp/variable/variations().(self.0rust-analyzer cargo ab_glyph 0.2.32 ttfp/FontRef#0..as_face_refrust-analyzer cargo owned_ttf_parser 0.25.1 preparse/impl#[`PreParsedSubtables<'_, F>`][AsFaceRef]as_face_ref().())
24 }
25 }
26
27 impl VariableFontrust-analyzer cargo ab_glyph 0.2.32 variable/VariableFont# for FontVecrust-analyzer cargo ab_glyph 0.2.32 ttfp/FontVec# {
28 fn set_variationrust-analyzer cargo ab_glyph 0.2.32 ttfp/variable/impl#[FontVec][VariableFont]set_variation().(&mut self, axis: &[u8; 4], value: f32) -> bool {
29 self.0rust-analyzer cargo ab_glyph 0.2.32 ttfp/FontVec#0.
30 .set_variationrust-analyzer cargo owned_ttf_parser 0.25.1 preparse/impl#[`PreParsedSubtables<'_, F>`][FaceMut]set_variation().(ttfprust-analyzer cargo owned_ttf_parser 0.25.1 crate/::Tagrust-analyzer cargo ttf-parser 0.25.1 Tag#::from_bytesrust-analyzer cargo ttf-parser 0.25.1 impl#[Tag]from_bytes().(axis), value)
31 .is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().()
32 }
33
34 fn variationsrust-analyzer cargo ab_glyph 0.2.32 ttfp/variable/impl#[FontVec][VariableFont]variations().(&self) -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<VariationAxisrust-analyzer cargo ab_glyph 0.2.32 variable/VariationAxis#> {
35 variationsrust-analyzer cargo ab_glyph 0.2.32 ttfp/variable/variations().(self.0rust-analyzer cargo ab_glyph 0.2.32 ttfp/FontVec#0..as_face_refrust-analyzer cargo owned_ttf_parser 0.25.1 preparse/impl#[`PreParsedSubtables<'_, F>`][AsFaceRef]as_face_ref().())
36 }
37 }
38
39 fn variationsrust-analyzer cargo ab_glyph 0.2.32 ttfp/variable/variations().(face: &ttfprust-analyzer cargo owned_ttf_parser 0.25.1 crate/::Facerust-analyzer cargo ttf-parser 0.25.1 Face#<'_>) -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<VariationAxisrust-analyzer cargo ab_glyph 0.2.32 variable/VariationAxis#> {
40 face.variation_axesrust-analyzer cargo ttf-parser 0.25.1 impl#[`Face<'a>`]variation_axes().()
41 .into_iterrust-analyzer cargo ttf-parser 0.25.1 parser/impl#[`LazyArray16<'a, T>`][IntoIterator]into_iter().()
42 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|axis| {
43 #[cfg(feature = "std")]
44 let name = face.namesrust-analyzer cargo ttf-parser 0.25.1 impl#[`Face<'a>`]names().().into_iterrust-analyzer cargo ttf-parser 0.25.1 tables/name/impl#[`Names<'a>`][IntoIterator]into_iter().().find_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#find_map().(|n| {
45 if n.name_idrust-analyzer cargo ttf-parser 0.25.1 tables/name/Name#name_id. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]eq().axis.name_idrust-analyzer cargo ttf-parser 0.25.1 tables/fvar/VariationAxis#name_id. {
46 n.to_stringrust-analyzer cargo ttf-parser 0.25.1 tables/name/impl#[`Name<'a>`]to_string().()
47 } else {
48 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#
49 }
50 });
51 #[cfg(not(feature = "std"))]
52 let name = Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#;
53 VariationAxisrust-analyzer cargo ab_glyph 0.2.32 variable/VariationAxis# {
54 tagrust-analyzer cargo ab_glyph 0.2.32 variable/VariationAxis#tag.: axis.tagrust-analyzer cargo ttf-parser 0.25.1 tables/fvar/VariationAxis#tag..to_bytesrust-analyzer cargo ttf-parser 0.25.1 impl#[Tag]to_bytes().(),
55 namerust-analyzer cargo ab_glyph 0.2.32 variable/VariationAxis#name.,
56 min_valuerust-analyzer cargo ab_glyph 0.2.32 variable/VariationAxis#min_value.: axis.min_valuerust-analyzer cargo ttf-parser 0.25.1 tables/fvar/VariationAxis#min_value.,
57 default_valuerust-analyzer cargo ab_glyph 0.2.32 variable/VariationAxis#default_value.: axis.def_valuerust-analyzer cargo ttf-parser 0.25.1 tables/fvar/VariationAxis#def_value.,
58 max_valuerust-analyzer cargo ab_glyph 0.2.32 variable/VariationAxis#max_value.: axis.max_valuerust-analyzer cargo ttf-parser 0.25.1 tables/fvar/VariationAxis#max_value.,
59 hiddenrust-analyzer cargo ab_glyph 0.2.32 variable/VariationAxis#hidden.: axis.hiddenrust-analyzer cargo ttf-parser 0.25.1 tables/fvar/VariationAxis#hidden.,
60 }
61 })
62 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().()
63 }