From 3f9280e0ba46e451d843e27edebc2666f0649bf5 Mon Sep 17 00:00:00 2001 From: j Date: Thu, 27 Nov 2025 17:49:29 +0100 Subject: [PATCH] make font/spacing configuration option --- render.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/render.py b/render.py index f06b606..aafa8fe 100644 --- a/render.py +++ b/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 ''' ass = header - offset = 10 + offset = options.get("sub_margin", 10) + spacing = options.get("sub_spacing", 20) height = 42 styles = [] for lang in reversed(langs): - font = 'SimHei' if lang in ('zh', 'jp') else 'Menlo' - size = 46 if font == 'SimHei' else 42 + if isinstance(options.get("font"), list) and lang in options["font"]: + 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( 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' events = [ 'Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text'