summaryrefslogtreecommitdiff
path: root/mkvlib/ass.go
diff options
context:
space:
mode:
authorb5f0d6c3 <[email protected]>2022-05-01 22:13:14 +0800
committerb5f0d6c3 <[email protected]>2022-05-01 22:13:14 +0800
commit89f27047788d34429c79b222411836c4a7d90824 (patch)
tree7be99220b06889094afcf168f942a9efb1281ec1 /mkvlib/ass.go
parent1b9356d8ff5a06364c980360c28c92a6e742ab85 (diff)
update mkvlib:update cache support
Diffstat (limited to 'mkvlib/ass.go')
-rw-r--r--mkvlib/ass.go48
1 files changed, 26 insertions, 22 deletions
diff --git a/mkvlib/ass.go b/mkvlib/ass.go
index 664a45b..c29b281 100644
--- a/mkvlib/ass.go
+++ b/mkvlib/ass.go
@@ -537,7 +537,7 @@ func (self *assProcessor) createFontSubset(font *fontInfo) bool {
ok = err == nil && s.ExitCode() == 0
}
if !ok {
- printLog(self.lcb, `Failed to subset font: "%s"[%s].`, font.oldName, font.index)
+ printLog(self.lcb, `Failed to subset font: "%s"[%d].`, font.oldName, font.index)
} else {
font.sFont = _fn
}
@@ -827,30 +827,34 @@ func (self *assProcessor) copyFontsFromCache() bool {
return ec == 0
}
-func (self *assProcessor) loadCache(p string) {
- if data, err := ioutil.ReadFile(p); err == nil {
- cache := make([]fontCache, 0)
- if json.Unmarshal(data, &cache) == nil {
- for _, v := range cache {
- list := make([][]map[string]bool, 0)
- l := len(v.Fonts)
- for i := 0; i < l; i++ {
- m := make([]map[string]bool, 2)
- for _, n := range v.Fonts[i] {
- if m[0] == nil {
- m[0] = make(map[string]bool)
- }
- m[0][n] = true
- }
- for _, f := range v.Types[i] {
- if m[1] == nil {
- m[1] = make(map[string]bool)
+func (self *assProcessor) loadCache(ccs []string) {
+ if len(ccs) > 0 {
+ for _, p := range ccs {
+ if data, err := ioutil.ReadFile(p); err == nil {
+ cache := make([]fontCache, 0)
+ if json.Unmarshal(data, &cache) == nil {
+ for _, v := range cache {
+ list := make([][]map[string]bool, 0)
+ l := len(v.Fonts)
+ for i := 0; i < l; i++ {
+ m := make([]map[string]bool, 2)
+ for _, n := range v.Fonts[i] {
+ if m[0] == nil {
+ m[0] = make(map[string]bool)
+ }
+ m[0][n] = true
+ }
+ for _, f := range v.Types[i] {
+ if m[1] == nil {
+ m[1] = make(map[string]bool)
+ }
+ m[1][f] = true
+ }
+ list = append(list, m)
}
- m[1][f] = true
+ self.cache = append(self.cache, cacheInfo{v.File, list})
}
- list = append(list, m)
}
- self.cache = append(self.cache, cacheInfo{v.File, list})
}
}
}