style(代码风格): 整理声明顺序与字体模块
build.yaml / build (push) Successful in 51s

This commit is contained in:
xiaoqidun committed 2026-09-28 15:17:45 +08:00
1 parent 5e0da3da28
commit ee6c9f6a16
82 files changed
+4316 -4310

No files matched your search

+9 -9
View File
@@ -29,15 +29,21 @@ import (
"github.com/tdewolff/font"
)
// fontSourceKind 字体来源类型
type fontSourceKind uint8
const (
fontSourceFile fontSourceKind = iota
fontSourceFS
fontSourceSystem
)
// systemFontIndex 串行初始化系统字体索引,不注册绘图后端
var systemFontIndex struct {
sync.Mutex
fonts *font.SystemFonts
}
// fontSourceKind 字体来源类型
type fontSourceKind uint8
// fontSource 字体来源
type fontSource struct {
kind fontSourceKind
@@ -78,12 +84,6 @@ func newFontSourceCache() *fontSourceCache {
return &fontSourceCache{candidates: make(map[string][]fontSource), directories: make(map[string][]fontFileCandidate), filesystems: make(map[int][]fontFileCandidate), data: make(map[fontSourceKey]fontSourceData)}
}
// systemFontIndex 串行初始化系统字体索引,不注册绘图后端
var systemFontIndex struct {
sync.Mutex
fonts *font.SystemFonts
}
// readFontSource 读取并拆出独立字体,保留集合中的名称和样式选择
// 入参: source 字体来源, definition 字体定义
// 返回: []byte 字体数据, error 读取或集合错误