@@ -59,10 +59,47 @@ struct HTMLTagStyleAttributeToMarkupStyleVisitor: HTMLTagStyleAttributeVisitor {
59
59
return MarkupStyle ( font: MarkupStyleFont ( weight: . style( . regular) ) )
60
60
}
61
61
case . rawValue( let value) :
62
- return MarkupStyle ( font: MarkupStyleFont ( weight: . rawValue( value) ) )
62
+ /*
63
+ https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight#common_weight_name_mapping
64
+ Value Common weight name
65
+ 100 Thin (Hairline)
66
+ 200 Extra Light (Ultra Light)
67
+ 300 Light
68
+ 400 Normal (Regular)
69
+ 500 Medium
70
+ 600 Semi Bold (Demi Bold)
71
+ 700 Bold
72
+ 800 Extra Bold (Ultra Bold)
73
+ 900 Black (Heavy)
74
+ 950 Extra Black (Ultra Black)
75
+ */
76
+ switch value {
77
+ case 100 :
78
+ return MarkupStyle ( font: MarkupStyleFont ( weight: . style( . thin) ) )
79
+ case 200 :
80
+ return MarkupStyle ( font: MarkupStyleFont ( weight: . style( . ultraLight) ) )
81
+ case 300 :
82
+ return MarkupStyle ( font: MarkupStyleFont ( weight: . style( . light) ) )
83
+ case 400 :
84
+ return MarkupStyle ( font: MarkupStyleFont ( weight: . style( . regular) ) )
85
+ case 500 :
86
+ return MarkupStyle ( font: MarkupStyleFont ( weight: . style( . medium) ) )
87
+ case 600 :
88
+ return MarkupStyle ( font: MarkupStyleFont ( weight: . style( . semibold) ) )
89
+ case 700 :
90
+ return MarkupStyle ( font: MarkupStyleFont ( weight: . style( . bold) ) )
91
+ case 800 :
92
+ return MarkupStyle ( font: MarkupStyleFont ( weight: . style( . heavy) ) )
93
+ case 900 :
94
+ return MarkupStyle ( font: MarkupStyleFont ( weight: . style( . black) ) )
95
+ case 950 :
96
+ return MarkupStyle ( font: MarkupStyleFont ( weight: . style( . black) ) )
97
+ default :
98
+ return MarkupStyle ( font: MarkupStyleFont ( weight: . rawValue( value) ) )
99
+ }
63
100
}
64
101
}
65
-
102
+
66
103
func visit( _ styleAttribute: FontFamilyHTMLTagStyleAttribute ) -> MarkupStyle ? {
67
104
// e.g. "Times New Roman", Times, serif
68
105
// use first match font
0 commit comments