Skip to content

Commit fd483c8

Browse files
committed
fix unexcepted vector effect deleted
1 parent 10aea4a commit fd483c8

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

ASFMKV_dev.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -811,10 +811,12 @@ def assFontList(assInfo: dict, eventSplit: dict) -> dict:
811811
'''
812812
fontList = {}
813813

814+
effectRe = re.compile(r'\{.*?\\.*?\}')
815+
814816
for i in eventSplit.keys():
815817
for l in eventSplit[i]:
816818
fn = l['Fontname'].lstrip('@')
817-
text = re.sub(r'\{.*?\\.*?\}', '', l['Text'])
819+
text = re.sub(effectRe, '', l['Text'])
818820
if len(assInfo['Subset']) > 0 and fn in assInfo['Subset']:
819821
fn = assInfo['Subset'][fn]
820822
flIndex = (fn, abs(int(l['Italic'])), abs(int(l['Bold'])))
@@ -2091,6 +2093,8 @@ def assFontChange(newfont_name: dict, asspath: str, assInfo: dict, splitEvents:
20912093
for k in used_nf_name2.keys():
20922094
used_nf_name[(k[0].upper(), k[1], k[2])] = used_nf_name2[k]
20932095

2096+
fnFound = re.compile(r'\{.*?\\fn.*?\}')
2097+
20942098
if len(splitEvents) > 0:
20952099

20962100
# 处理fn标签
@@ -2114,13 +2118,11 @@ def assFontChange(newfont_name: dict, asspath: str, assInfo: dict, splitEvents:
21142118

21152119
if replaceFn is not None:
21162120
if replaceFn[1] is not None:
2117-
fnTags = re.findall(r'\{.*?\\fn.*?\}', l['Text'])
2121+
fnTags = re.findall(fnFound, l['Text'])
21182122
for t in fnTags:
2119-
l['Text'] = l['Text'].replace(t, t.replace(l['Fontname'], replaceFn[1]))
2123+
assInfo['Events'][fnLine]['Text'] = assInfo['Events'][fnLine]['Text'].replace(t, t.replace(l['Fontname'], replaceFn[1]))
21202124
l['Fontname'] = replaceFn[1]
21212125

2122-
assInfo['Events'][fnLine]['Text'] = ''.join([v['Text'] for v in splitEvents[fnLine]])
2123-
21242126
for k in used_nf_name2:
21252127
assInfo['Subset'][newfont_name[k][1]] = k[0].split('|')[0]
21262128

0 commit comments

Comments
 (0)