@@ -33,6 +33,40 @@ impl Default for FontStretch {
33
33
}
34
34
}
35
35
36
+ #[ cfg( feature = "text" ) ]
37
+ impl From < fontdb:: Stretch > for FontStretch {
38
+ fn from ( stretch : fontdb:: Stretch ) -> Self {
39
+ match stretch {
40
+ fontdb:: Stretch :: UltraCondensed => FontStretch :: UltraCondensed ,
41
+ fontdb:: Stretch :: ExtraCondensed => FontStretch :: ExtraCondensed ,
42
+ fontdb:: Stretch :: Condensed => FontStretch :: Condensed ,
43
+ fontdb:: Stretch :: SemiCondensed => FontStretch :: SemiCondensed ,
44
+ fontdb:: Stretch :: Normal => FontStretch :: Normal ,
45
+ fontdb:: Stretch :: SemiExpanded => FontStretch :: SemiExpanded ,
46
+ fontdb:: Stretch :: Expanded => FontStretch :: Expanded ,
47
+ fontdb:: Stretch :: ExtraExpanded => FontStretch :: ExtraExpanded ,
48
+ fontdb:: Stretch :: UltraExpanded => FontStretch :: UltraExpanded ,
49
+ }
50
+ }
51
+ }
52
+
53
+ #[ cfg( feature = "text" ) ]
54
+ impl From < FontStretch > for fontdb:: Stretch {
55
+ fn from ( stretch : FontStretch ) -> Self {
56
+ match stretch {
57
+ FontStretch :: UltraCondensed => fontdb:: Stretch :: UltraCondensed ,
58
+ FontStretch :: ExtraCondensed => fontdb:: Stretch :: ExtraCondensed ,
59
+ FontStretch :: Condensed => fontdb:: Stretch :: Condensed ,
60
+ FontStretch :: SemiCondensed => fontdb:: Stretch :: SemiCondensed ,
61
+ FontStretch :: Normal => fontdb:: Stretch :: Normal ,
62
+ FontStretch :: SemiExpanded => fontdb:: Stretch :: SemiExpanded ,
63
+ FontStretch :: Expanded => fontdb:: Stretch :: Expanded ,
64
+ FontStretch :: ExtraExpanded => fontdb:: Stretch :: ExtraExpanded ,
65
+ FontStretch :: UltraExpanded => fontdb:: Stretch :: UltraExpanded ,
66
+ }
67
+ }
68
+ }
69
+
36
70
/// A font style property.
37
71
#[ derive( Clone , Copy , PartialEq , Eq , Debug , Hash ) ]
38
72
pub enum FontStyle {
@@ -51,6 +85,28 @@ impl Default for FontStyle {
51
85
}
52
86
}
53
87
88
+ #[ cfg( feature = "text" ) ]
89
+ impl From < fontdb:: Style > for FontStyle {
90
+ fn from ( style : fontdb:: Style ) -> Self {
91
+ match style {
92
+ fontdb:: Style :: Normal => FontStyle :: Normal ,
93
+ fontdb:: Style :: Italic => FontStyle :: Italic ,
94
+ fontdb:: Style :: Oblique => FontStyle :: Oblique ,
95
+ }
96
+ }
97
+ }
98
+
99
+ #[ cfg( feature = "text" ) ]
100
+ impl From < FontStyle > for fontdb:: Style {
101
+ fn from ( style : FontStyle ) -> Self {
102
+ match style {
103
+ FontStyle :: Normal => fontdb:: Style :: Normal ,
104
+ FontStyle :: Italic => fontdb:: Style :: Italic ,
105
+ FontStyle :: Oblique => fontdb:: Style :: Oblique ,
106
+ }
107
+ }
108
+ }
109
+
54
110
/// Text font properties.
55
111
#[ derive( Clone , Eq , PartialEq , Hash , Debug ) ]
56
112
pub struct Font {
0 commit comments