1pub use variation::Axis as VariationAxis;
2
3pub mod variation {
4 use crate::{prelude::*, FourByteTag};
5 use skia_bindings::{self as sb, SkFontParameters_Variation_Axis};
6
7 #[repr(C)]
8 #[derive(Clone, PartialEq, Default, Debug)]
9 pub struct Axis {
10 pub tag: FourByteTag,
11 pub min: f32,
12 pub def: f32,
13 pub max: f32,
14 flags: u16,
15 }
16
17 native_transmutable!(SkFontParameters_Variation_Axis, Axis, axis_layout);
18
19 impl Axis {
20 pub const fn new(tag: FourByteTag, min: f32, def: f32, max: f32, hidden: bool) -> Self {
21 #[allow(clippy::bool_to_int_with_if)]
22 Axis {
23 tag,
24 min,
25 def,
26 max,
27 flags: if hidden { 1 } else { 0 },
28 }
29 }
30
31 pub fn is_hidden(&self) -> bool {
32 unsafe { sb::C_SkFontParameters_Variation_Axis_isHidden(self.native()) }
33 }
34
35 pub fn set_hidden(&mut self, hidden: bool) -> &mut Self {
36 unsafe {
37 sb::C_SkFontParameters_Variation_Axis_setHidden(self.native_mut(), hidden);
38 }
39 self
40 }
41 }
42}
43