mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-08-30 12:12:40 +08:00
feat(字体渲染): 统一字体处理位置
This commit is contained in:
+2
-7
@@ -19,7 +19,6 @@ import (
|
||||
"io/fs"
|
||||
"path"
|
||||
"sort"
|
||||
"strings"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -183,12 +182,8 @@ func (r *Renderer) matchFont(names ...string) (string, bool) {
|
||||
// 入参: fsys 字体文件系统, names 字体名称列表
|
||||
// 返回: string 匹配字体文件
|
||||
func matchFontFS(fsys fs.FS, names ...string) string {
|
||||
for _, name := range names {
|
||||
name = strings.TrimSpace(name)
|
||||
if name == "" {
|
||||
continue
|
||||
}
|
||||
matches, err := fs.Glob(fsys, name+"*")
|
||||
for _, pattern := range fontFilePatterns(names...) {
|
||||
matches, err := fs.Glob(fsys, pattern)
|
||||
if err == nil && len(matches) > 0 {
|
||||
return matches[0]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user