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

Backports from Cyberbeing + negative Encoding #46

Merged

Conversation

TheOneric
Copy link
Contributor

Backports recently merged changes from Cyberbeing/xy-VSFilter and the CSRI name change mentioned in #38:

@Masaiki: Cyberbeing/xy-VSFilter#20 and Cyberbeing/xy-VSFilter#22 di not apply cleanly. The former has a large swath of conflicts, for the latter exactly the edited section changed between Cyberbeing and pinterf. Not only were comments moved, but one version uses plain Div the other NormalizedDiv versions in their respective calculations. Are those patches also needed in pinterf/xy-VSFilter and if yes, can you take a look?

I omitted the not-yet-merged VapourSynth PR by Masaiki due to having no experience with the code they touch Cyberbeing/xy-VSFilter#24

@pinterf: with this and potentially the remaining PRs by Masaiki merged, it should presumably be in good shape for a new release such that people can actually use LayoutRes etc

TheOneric and others added 8 commits December 8, 2023 15:48
The GUI settings only define the default behaviour
for files without LayoutRes{X,Y} headers.

Backported from: Cyberbeing/xy-VSFilter@1ca5e4b
Similar to the preceeding commit backported from Cyberbeing/xy-VSFilter,
let’s adjust the name so users can distinguish Cyberbeing/xy-VSFilter
from pinterf/xy-VSFilter if say builds from both are placed into
Aegisub’s csri directory.

Latest releases are numbered 3.2.x.x,
so update the version advertised in CSRI to match.
Back in 2012 libass added a custom Encoding=-1 extension to enable
automatic BiDi base direction instead of the usual LTR default.
The assumption/hope presumably was that since all valid font encodings
are positive VSFilter would just gracefully ignore them. However, this
is unfortuantely not the case.
When passed to GDI the charSet is cast to a byte and will wrap around to
a valid value, severely restricting which fonts can be used.

Searching through a large pile of subtitles the only hits for negative
values in the Encoding field were from generally corrupted files.
It thus appears so far fortunately nobody used the extension in released
fiels (only transient conversion from other  formats during playback)
and also nobody is relying on the wraparound in VSFilter.

To minimise future problems treat all negative Encodings as the default
charset. This matches how libass does fontselection for -1 albeit it
doesn't reproduce the BiDi base direction.
It also conveniently carves out the [-2, INT_MIN] range for potential
future extensions common to VSFilters and libass, e.g. Encoding=-2
for a RTL base direction (which should be easier to implement in
VSFilter than auto base direction)
@pinterf
Copy link
Owner

pinterf commented Dec 12, 2023

Great work, thanks. Then these changes can safely be merged and this PR will not get further modifications?

@TheOneric
Copy link
Contributor Author

TheOneric commented Dec 12, 2023

Yes, no further modifications to the PR are planned and everything should be good to merge.

@pinterf pinterf merged commit 0e6c749 into pinterf:xy_sub_filter_rc5 Dec 13, 2023
@TheOneric TheOneric deleted the pinterf_backport+encoding branch December 13, 2023 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants