158
158
# 结构为:{ platformID(Decimal) : { LCID : textcoding } }
159
159
# 目前Textcoding没有实际作用,仅用于让这个词典可读性更强
160
160
# 详情可在 https://docs.microsoft.com/en-us/typography/opentype/spec/name#platform-encoding-and-language-ids 查询
161
- lcidfil = {3 : {
161
+ lcidfil = {
162
+ 3 : {
162
163
2052 : 'gbk' ,
163
164
1042 : 'euc-kr' ,
164
165
1041 : 'shift-jis' ,
@@ -669,8 +670,6 @@ def assStylesEventsRead(tagLine: int) -> list[dict]:
669
670
break
670
671
else :
671
672
singleLine [lineFormat [j ]] = line [j ]
672
- if not isEvent :
673
- singleLine ['Fontname' ] = singleLine ['Fontname' ].lstrip ('@' )
674
673
675
674
if (isEvent and len (singleLine ) != len (lineFormat ) + 1 ) or (not isEvent and len (singleLine ) != len (lineFormat )):
676
675
raise Exception (f'ASS/SSA格式错误 - 缺少逗号分隔 - 位于行{ i + 1 } 文件\" { path .basename (assPath )} \" ' )
@@ -776,7 +775,7 @@ def assFontList(assInfo: dict, eventSplit: dict) -> dict:
776
775
777
776
for i in eventSplit .keys ():
778
777
for l in eventSplit [i ]:
779
- fn = l ['Fontname' ]
778
+ fn = l ['Fontname' ]. lstrip ( '@' )
780
779
l ['Text' ] = re .sub (r'\{.*?\\.*?\}' , '' , l ['Text' ])
781
780
if len (assInfo ['Subset' ]) > 0 and fn in assInfo ['Subset' ]:
782
781
fn = assInfo ['Subset' ][fn ]
@@ -1966,12 +1965,13 @@ def assFontChange(newfont_name: dict, asspath: str, assInfo: dict, splitEvents:
1966
1965
styleItalic = abs (int (assInfo ['Styles' ][k ]['Italic' ]))
1967
1966
styleBold = abs (int (assInfo ['Styles' ][k ]['Bold' ]))
1968
1967
fontstr = assInfo ['Styles' ][k ]['Fontname' ]
1969
- nfnKey = (fontstr , styleItalic , styleBold )
1968
+ nfnKey = (fontstr . lstrip ( '@' ) , styleItalic , styleBold )
1970
1969
if newfont_name .get (nfnKey ) is None :
1971
1970
continue
1972
1971
else :
1973
1972
if not newfont_name [nfnKey ][1 ] is None :
1974
1973
assInfo ['Styles' ][k ]['Fontname' ] = newfont_name [nfnKey ][1 ].split ('?' )[0 ]
1974
+ if fontstr [0 ] == '@' : assInfo ['Styles' ][k ]['Fontname' ] = '@' + assInfo ['Styles' ][k ]['Fontname' ]
1975
1975
1976
1976
used_nf_name2 = {}
1977
1977
for k2 in [k for k in newfont_name .keys () if not newfont_name [k ][1 ] is None ]:
@@ -1989,7 +1989,7 @@ def assFontChange(newfont_name: dict, asspath: str, assInfo: dict, splitEvents:
1989
1989
for fnLine in splitEvents .keys ():
1990
1990
if len (splitEvents [fnLine ]) == 1 : continue
1991
1991
for l in splitEvents [fnLine ]:
1992
- fname = l ['Fontname' ]
1992
+ fname = l ['Fontname' ]. lstrip ( '@' )
1993
1993
#if len(fname) > 0 and not used_nf_name[fname.upper()][1] is None:
1994
1994
if len (fname ) > 0 :
1995
1995
replaceFn = None
@@ -3686,7 +3686,7 @@ def cFontSubset(font_info):
3686
3686
if work == 19 :
3687
3687
muxer = 2
3688
3688
for subp in subonlyp :
3689
- newasspaths , newfont_name , mkvr = main (font_info2 , [subp [ 1 ] ],
3689
+ newasspaths , newfont_name , mkvr = main (font_info2 , [subp ],
3690
3690
mux = False ,
3691
3691
outdir = [assout_cache , fontout_cache , mkvout_cache ],
3692
3692
FFmuxer = muxer )
0 commit comments