mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-10-29 17:27:08 +08:00
This commit is contained in:
1 parent
6525b01bab
commit
c2ddde7c0e
1 file changed
+12
-3
+12
-3
@@ -190,6 +190,18 @@ func (fsys *FontFS) matchStyle(names []string, bold, italic bool) []fontFileMatc
|
|||||||
func fontFileMatches(candidates []fontFileCandidate, names []string, bold, italic bool) []fontFileMatch {
|
func fontFileMatches(candidates []fontFileCandidate, names []string, bold, italic bool) []fontFileMatch {
|
||||||
matches := make([]fontFileMatch, 0, len(candidates))
|
matches := make([]fontFileMatch, 0, len(candidates))
|
||||||
seen := make(map[string]int, len(candidates))
|
seen := make(map[string]int, len(candidates))
|
||||||
|
if len(names) == 0 {
|
||||||
|
for _, name := range fontDefaultSystemNames() {
|
||||||
|
for _, match := range fontFileMatches(candidates, []string{name}, bold, italic) {
|
||||||
|
key := strings.ToLower(match.name)
|
||||||
|
if _, ok := seen[key]; !ok {
|
||||||
|
seen[key] = len(matches)
|
||||||
|
matches = append(matches, match)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return matches
|
||||||
|
}
|
||||||
for i, name := range names {
|
for i, name := range names {
|
||||||
if name == "" {
|
if name == "" {
|
||||||
continue
|
continue
|
||||||
@@ -206,9 +218,6 @@ func fontFileMatches(candidates []fontFileCandidate, names []string, bold, itali
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(names) == 0 {
|
|
||||||
names = fontDefaultSystemNames()
|
|
||||||
}
|
|
||||||
for _, matcher := range newFontPatternMatchers(fontFilePatterns(names...)) {
|
for _, matcher := range newFontPatternMatchers(fontFilePatterns(names...)) {
|
||||||
for _, file := range candidates {
|
for _, file := range candidates {
|
||||||
rank := matcher.rankCandidate(file)
|
rank := matcher.rankCandidate(file)
|
||||||
|
|||||||
Reference in new issue
Block a user