Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

\ko fails to remove outline from shadow #733

Open
arch1t3cht opened this issue Feb 2, 2024 · 3 comments
Open

\ko fails to remove outline from shadow #733

arch1t3cht opened this issue Feb 2, 2024 · 3 comments

Comments

@arch1t3cht
Copy link
Contributor

arch1t3cht commented Feb 2, 2024

Screenshots

Libass:
image

VSFilter:
image

Description of the issue

The above screenshots are taken at time 0 with the provided file. On VSFilter (specifically pinterf's VSFilter 3.2.0.809 via arch1t3cht/Aegisub), the shadow is not offset by the border size, while on libass it is. After 0.5 seconds (the duration given in the \ko tag), VSFilter and libass match.

libass version

For convenience the screenshot was taken on meson, commit: 0.14.0-680-g4625653c4c857abdbe92cd03d2dbdfdaed29f933 via arch1t3cht/Aegisub on Windows (note that the 0.14.0 in the version string is just because TypesettingTools/libass is missing the newer version tags), but I also reproduced this on the latest git version (via libass-git on the AUR).

Is it a regression?

Not that I know of.

ASS Sample

[Script Info]
; Script generated by Aegisub 9715-feature-7f928e8d6
; http://www.aegisub.org/
Title: Default Aegisub file
ScriptType: v4.00+
WrapStyle: 0
ScaledBorderAndShadow: yes
YCbCr Matrix: None
PlayResX: 1920
PlayResY: 1080

[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: Default,Arial,20,&H00FFFFFF,&H000000FF,&H00000000,&H00000000,0,0,0,0,100,100,0,0,1,2,2,2,10,10,10,1

[Events]
Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
Dialogue: 0,0:00:00.00,0:00:05.00,Default,,0,0,0,,{\fs200\ko50\yshad-200\bord10}Lorem {\blur0.1}Ipsum

Special Fonts

The issue doesn't depend on a specific font

System Information

See above

Log

No response

Additional info

This was discovered when trying out a new version of the "shad trick" (i.e. using the shadow of an event with \bordXX\shad0.01\1a&HFE&\3a&HFF& to get a single bitmap of a thickened version of the event) that didn't need to draw the fill using \bordXX\shad0.01\1a&HFF&\2a&HFF&\3a&HFF&\ko. Since \ko is equivalent to \ko100, this would render differently on VSFilter. Of course this can be fixed by writing \ko0 instead, but nonetheless this led to discovering this rendering differential.

@astiob astiob changed the title Rendering: Difference to VSFilter involving \ko with run breaks \ko fails to remove outline from shadow Feb 3, 2024
@astiob
Copy link
Member

astiob commented Feb 3, 2024

Thanks! I believe this affects any use of \ko with shadow: VSFilter removes the outline from future syllables’ shadows, whereas libass doesn’t.

This is because we process karaoke very late, after the shadow has been generated. But \ko is simple enough that this should be reasonably easy to fix… if I can just remember yet again what exactly our karaoke variables mean at each point in time.

\bordXX\shad0.01\1a&HFF&\2a&HFF&\3a&HFF&\ko0

Oh, that’s clever! For any confused readers: this completely hides the fill and outline by setting their alpha to FF (rather than a very faint but still present FE), but because normally this causes the fill to be cropped out of the shadow (leaving a shadow of only the outline with a fill-shaped hole in the middle), this trick disables such cropping by adding a karaoke effect [VSFilter] [libass]. Even if the karaoke time is zero, the effect type is preserved, so this is enough to cause the shadow to be fully filled in.

Personally, I’ve been positioning the line off-screen and applying a big shadow to bring it back on screen, which achieves exact coordinates while avoiding any traces of the fill/outline: e. g. \bordXX\pos(-2000,XX)\xshad20XX (but as pointed out on Discord, this isn’t usable when animated \frz is desired)

@astiob
Copy link
Member

astiob commented Feb 3, 2024

By the way, \kf (\K) should work too for that trick and avoid current libass/VSFilter differences.

@astiob
Copy link
Member

astiob commented Feb 10, 2024

Curiously, although \ko removes the border from the shadow, making it seem equivalent to \bord0, \blur...\bord...\ko... doesn’t blur the upcoming syllable (neither the main glyph fill nor the shadow), so it’s more like \bord0\blur0\be0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants