mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-10-29 15:06:46 +08:00
This commit is contained in:
1 parent
3ba9317cf3
commit
81e6657c65
8 files changed
+337
-80
No files matched your search
@@ -18,6 +18,7 @@ import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"encoding/xml"
|
||||
"fmt"
|
||||
"io"
|
||||
"maps"
|
||||
"path"
|
||||
@@ -172,14 +173,18 @@ func (e *Editor) compactSourceResources(parts map[string][]byte, progress editor
|
||||
}
|
||||
key := strings.ToLower(cleanPackagePath(name))
|
||||
usage := fontFiles[key]
|
||||
if usage == nil || usage.unsafe || refs.files[key] || removed[key] || parts[name] != nil {
|
||||
if e.backends.Resources == nil || usage == nil || usage.unsafe || refs.files[key] || removed[key] || parts[name] != nil {
|
||||
continue
|
||||
}
|
||||
data, err := reader.readFile(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if subset := subsetSourceFont(data, usage); subset != nil {
|
||||
subset, err := e.backends.Resources.SubsetSourceFont(data, FontUsage{Characters: slices.Sorted(maps.Keys(usage.chars)), Glyphs: slices.Sorted(maps.Keys(usage.glyphs)), Unsafe: usage.unsafe})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("subset font %s: %w", name, err)
|
||||
}
|
||||
if subset != nil {
|
||||
updates[name] = subset
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user