Skip to content

Commit d07f3ef

Browse files
committed
Rename font width to glyph width
1 parent 458d55c commit d07f3ef

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

build/generate-font-width.go renamed to build/generate-glyph-width.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424

2525
const dejavuZip = "https://github.com/dejavu-fonts/dejavu-fonts/releases/download/version_2_37/dejavu-sans-ttf-2.37.zip"
2626

27-
var flagOut = flag.String("o", "modules/badge/badge_font_width.go", "out")
27+
var flagOut = flag.String("o", "modules/badge/badge_glyph_width.go", "out")
2828

2929
func main() {
3030
flag.Parse()
@@ -117,7 +117,7 @@ const hdr = `// Copyright 2025 The Gitea Authors. All rights reserved.
117117
118118
package badge
119119
120-
// Code generated by build/generate-font-width.go. DO NOT EDIT.
120+
// Code generated by build/generate-glyph-width.go. DO NOT EDIT.
121121
// Sourced from %s
122-
var DejaVuFontWidthData = %s
122+
var DejaVuGlyphWidthData = %s
123123
`

modules/badge/badge.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,11 @@ func calculateTextWidth(text string) int {
9090
width := 0
9191

9292
for _, char := range text {
93-
charWidth, ok := DejaVuFontWidthData[char]
93+
charWidth, ok := DejaVuGlyphWidthData[char]
9494
if !ok {
95-
// use the width of 'm' in case of missing font width data for a printable character
95+
// use the width of 'm' in case of missing glyph width data for a printable character
9696
if unicode.IsPrint(char) {
97-
charWidth = DejaVuFontWidthData['m']
97+
charWidth = DejaVuGlyphWidthData['m']
9898
} else {
9999
charWidth = 0
100100
}

modules/badge/badge_font_width.go renamed to modules/badge/badge_glyph_width.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)