We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ea71a32 commit 8849764Copy full SHA for 8849764
modules/badge/badge.go
@@ -4,6 +4,8 @@
4
package badge
5
6
import (
7
+ "unicode"
8
+
9
actions_model "code.gitea.io/gitea/models/actions"
10
)
11
@@ -90,7 +92,12 @@ func calculateTextWidth(text string) int {
90
92
for _, char := range text {
91
93
charWidth, ok := DejaVuFontWidthData[char]
94
if !ok {
- charWidth = 0
95
+ // use the width of 'm' in case of missing font width data for a printable character
96
+ if unicode.IsPrint(char) {
97
+ charWidth = DejaVuFontWidthData['m']
98
+ } else {
99
+ charWidth = 0
100
+ }
101
}
102
width += int(charWidth)
103
0 commit comments