Skip to main content

widgetkit_render/
style.rs

1#[derive(Clone, Copy, Debug, PartialEq)]
2pub struct Stroke {
3    pub width: f32,
4}
5
6impl Stroke {
7    pub const fn new(width: f32) -> Self {
8        Self { width }
9    }
10}
11
12impl Default for Stroke {
13    fn default() -> Self {
14        Self { width: 1.0 }
15    }
16}
17
18#[derive(Clone, Debug, PartialEq)]
19pub struct TextStyle {
20    size: f32,
21}
22
23impl TextStyle {
24    pub fn new() -> Self {
25        Self { size: 14.0 }
26    }
27
28    pub fn size(mut self, size: f32) -> Self {
29        self.size = size.max(1.0);
30        self
31    }
32
33    pub fn pixel_size(&self) -> f32 {
34        self.size
35    }
36}
37
38impl Default for TextStyle {
39    fn default() -> Self {
40        Self::new()
41    }
42}