@@ -811,10 +811,12 @@ def assFontList(assInfo: dict, eventSplit: dict) -> dict:
811
811
'''
812
812
fontList = {}
813
813
814
+ effectRe = re .compile (r'\{.*?\\.*?\}' )
815
+
814
816
for i in eventSplit .keys ():
815
817
for l in eventSplit [i ]:
816
818
fn = l ['Fontname' ].lstrip ('@' )
817
- text = re .sub (r'\{.*?\\.*?\}' , '' , l ['Text' ])
819
+ text = re .sub (effectRe , '' , l ['Text' ])
818
820
if len (assInfo ['Subset' ]) > 0 and fn in assInfo ['Subset' ]:
819
821
fn = assInfo ['Subset' ][fn ]
820
822
flIndex = (fn , abs (int (l ['Italic' ])), abs (int (l ['Bold' ])))
@@ -2091,6 +2093,8 @@ def assFontChange(newfont_name: dict, asspath: str, assInfo: dict, splitEvents:
2091
2093
for k in used_nf_name2 .keys ():
2092
2094
used_nf_name [(k [0 ].upper (), k [1 ], k [2 ])] = used_nf_name2 [k ]
2093
2095
2096
+ fnFound = re .compile (r'\{.*?\\fn.*?\}' )
2097
+
2094
2098
if len (splitEvents ) > 0 :
2095
2099
2096
2100
# 处理fn标签
@@ -2114,13 +2118,11 @@ def assFontChange(newfont_name: dict, asspath: str, assInfo: dict, splitEvents:
2114
2118
2115
2119
if replaceFn is not None :
2116
2120
if replaceFn [1 ] is not None :
2117
- fnTags = re .findall (r'\{.*?\\fn.*?\}' , l ['Text' ])
2121
+ fnTags = re .findall (fnFound , l ['Text' ])
2118
2122
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 ]))
2120
2124
l ['Fontname' ] = replaceFn [1 ]
2121
2125
2122
- assInfo ['Events' ][fnLine ]['Text' ] = '' .join ([v ['Text' ] for v in splitEvents [fnLine ]])
2123
-
2124
2126
for k in used_nf_name2 :
2125
2127
assInfo ['Subset' ][newfont_name [k ][1 ]] = k [0 ].split ('|' )[0 ]
2126
2128
0 commit comments