make font/spacing configuration option
This commit is contained in:
parent
2a5d741ccf
commit
3f9280e0ba
1 changed files with 12 additions and 4 deletions
16
render.py
16
render.py
|
|
@ -953,16 +953,24 @@ YCbCr Matrix: None
|
||||||
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
|
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
|
||||||
'''
|
'''
|
||||||
ass = header
|
ass = header
|
||||||
offset = 10
|
offset = options.get("sub_margin", 10)
|
||||||
|
spacing = options.get("sub_spacing", 20)
|
||||||
height = 42
|
height = 42
|
||||||
styles = []
|
styles = []
|
||||||
for lang in reversed(langs):
|
for lang in reversed(langs):
|
||||||
font = 'SimHei' if lang in ('zh', 'jp') else 'Menlo'
|
if isinstance(options.get("font"), list) and lang in options["font"]:
|
||||||
size = 46 if font == 'SimHei' else 42
|
font = options["font"][lang]
|
||||||
|
else:
|
||||||
|
font = 'SimHei' if lang in ('zh', 'jp') else 'Menlo'
|
||||||
|
if isinstance(options.get("font_size"), list) and lang in options["font_size"]:
|
||||||
|
size = options["font_size"][lang]
|
||||||
|
else:
|
||||||
|
size = 46 if font == 'SimHei' else 42
|
||||||
|
|
||||||
styles.append(
|
styles.append(
|
||||||
f'Style: {lang},{font},{size},&Hffffff,&Hffffff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,{offset},1'
|
f'Style: {lang},{font},{size},&Hffffff,&Hffffff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,{offset},1'
|
||||||
)
|
)
|
||||||
offset += size + 20
|
offset += size + spacing
|
||||||
ass += '\n'.join(reversed(styles)) + '\n'
|
ass += '\n'.join(reversed(styles)) + '\n'
|
||||||
events = [
|
events = [
|
||||||
'Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text'
|
'Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue