Repository navigation
fix(captions): keep Cyrillic captions inside the frame - #215
Open
stephanvoytov wants to merge 3 commits into
Open
stephanvoytov wants to merge 3 commits into
stephanvoytov wants to merge 3 commits into
Conversation
libass may fall back to a wider face than the measured Anton/Montserrat for Cyrillic, so the line fitter allowed lines that clip on both edges. Clamp a Cyrillic caption block to 10 characters before fitting; lone long words keep the existing narrowing. Latin captions are unchanged.
The editor preview rendered caption text at 58% of its burned size (it treated PlayRes units as CSS pixels of a scaled-down player), so a size that clipped in the export looked fine in the modal. Compose at 1080x1920 scale, clamp Cyrillic to the same 10 characters the burn uses, anchor at the same 15% margins, and re-base the size presets around the new 20 default.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Cyrillic captions could exceed the 9:16 frame. libass may substitute a wider fallback face for Cyrillic, while
subtitles.line_fittermeasures the bundled Anton/Montserrat; a line the fitter accepted then clipped on both edges (for exampleИ ВОТ В ЧЁМ,).Fix
Clamp a Cyrillic caption block to 10 characters before the line fitter runs (
_CYRILLIC_LANGUAGES,_CYRILLIC_MAX_CHARS). A lone long word still uses the existing narrowing (\fscx), and Latin captions are unchanged.Testing
tests/test_cyrillic_captions.pychecks that a Cyrillic line is split and no block exceeds the limit.pytest tests/ -q: 2711 passed, 43 skipped (before the new test; run the subtree in CI).cd dashboard && npm run build && npm run lint.