weizhenye / ASS

A lightweight JavaScript ASS subtitle renderer
https://ass.js.org
MIT License
534 stars 79 forks source link

Second line too low when margins are used #41

Closed qtoden closed 5 months ago

qtoden commented 1 year ago

When a dialogue line breaks because it is slightly too long to fit on one line, the subtitle will sometimes still be positioned as if it only has one single line.

It seems like the measured element height that is used to calculate the y position doesn't take margins into account.

image

[Script Info]
ScriptType: v4.00+
PlayResX: 1920
PlayResY: 1080
WrapStyle: 1

[V4+ Styles]
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
Style: nxt-default,FreeSans,80,&H00FFFFFF,&H000000FF,&H80000000,&H0,0,0,0,0,100,100,0.7,0,3,0.001,0,1,196,30,43,1

[Events]
Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
Dialogue: 0,0:00:00.00,9:59:59.00,nxt-default,,0000,0000,0000,,Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed