diff options
| author | b5f0d6c3 <[email protected]> | 2021-11-02 13:46:35 +0800 |
|---|---|---|
| committer | b5f0d6c3 <[email protected]> | 2021-11-02 13:46:35 +0800 |
| commit | f8bf1574ede8f241e339044cc4c3f436592b87d9 (patch) | |
| tree | 6bf53da1c9bf36f3432f084a28be5d5a37e68655 /mkvlib | |
| parent | d8986a4708007a098071c3a6063251132d10c56f (diff) | |
update mkvlib:fix bugs
Diffstat (limited to 'mkvlib')
| -rw-r--r-- | mkvlib/ass.go | 14 | ||||
| -rw-r--r-- | mkvlib/shared.go | 2 |
2 files changed, 4 insertions, 12 deletions
diff --git a/mkvlib/ass.go b/mkvlib/ass.go index e529f73..ed20f87 100644 --- a/mkvlib/ass.go +++ b/mkvlib/ass.go @@ -140,7 +140,7 @@ func (self *assProcessor) dumpFont(file string, full bool) bool { ok := false count := 1 _, n, _, _ := splitPath(file) - if strings.HasSuffix(file, ".ttc") { + if e, _ := regexp.MatchString(`\.(?i)ttc$`, n); e { count = self.getTTCCount(file) if count < 1 { printLog(self.lcb, `Failed to get the ttc font count: "%s".`, n) @@ -271,7 +271,7 @@ func (self *assProcessor) createFontSubset(font *fontInfo) bool { ok := false fn := fmt.Sprintf(`%s.txt`, font.file) _, n, e, ne := splitPath(font.file) - if e == ".ttc" { + if _e, _ := regexp.MatchString(`\.(?i)ttc$`, e); _e { e = ".ttf" } if os.MkdirAll(self.output, os.ModePerm) != nil { @@ -287,17 +287,9 @@ func (self *assProcessor) createFontSubset(font *fontInfo) bool { args = append(args, "--name-languages="+"*") args = append(args, "--font-number="+font.index) args = append(args, font.file) - buf := bytes.NewBufferString("") - if p, err := newProcess(nil, nil, buf, "", pyftsubset, args...); err == nil { + if p, err := newProcess(nil, nil, nil, "", pyftsubset, args...); err == nil { s, err := p.Wait() ok = err == nil && s.ExitCode() == 0 - if strings.Contains(buf.String(), "WARNING: mort NOT subset; don't know how to subset; dropped") { - _ = os.Remove(_fn) - if len(findFonts(self.output)) == 0 { - _ = os.RemoveAll(self.output) - } - ok = false - } } if !ok { printLog(self.lcb, `Failed to subset font: "%s"[%s].`, n, font.index) diff --git a/mkvlib/shared.go b/mkvlib/shared.go index 51072f2..e2fa424 100644 --- a/mkvlib/shared.go +++ b/mkvlib/shared.go @@ -11,7 +11,7 @@ import ( ) const libName = "mkvlib" -const libVer = "v1.1.4" +const libVer = "v1.1.5" const LibFName = libName + " " + libVer |
