Skip to content

Commit 8067505

Browse files
SchnWaltereliasnaur
authored andcommitted
text: add fmt.Stringer implementation for Weight
Signed-off-by: Walter Werner SCHNEIDER <[email protected]>
1 parent 03cfe55 commit 8067505

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

text/text.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,33 @@ func (s Style) String() string {
115115
}
116116
}
117117

118+
func (w Weight) String() string {
119+
switch w {
120+
case Thin:
121+
return "Thin"
122+
case ExtraLight:
123+
return "ExtraLight"
124+
case Light:
125+
return "Light"
126+
case Normal:
127+
return "Normal"
128+
case Medium:
129+
return "Medium"
130+
case SemiBold:
131+
return "SemiBold"
132+
case Bold:
133+
return "Bold"
134+
case ExtraBold:
135+
return "ExtraBold"
136+
case Black:
137+
return "Black"
138+
case ExtraBlack:
139+
return "ExtraBlack"
140+
default:
141+
panic("invalid Weight")
142+
}
143+
}
144+
118145
// weightDistance returns the distance value between two font weights.
119146
func weightDistance(wa Weight, wb Weight) int {
120147
// Avoid dealing with negative Weight values.

0 commit comments

Comments
 (0)