Repository navigation
fix(web): size subtitles by the window, not the film's aspect ratio - #5510
Conversation
In a window wider than the film, a 2.40:1 film's subtitles were drawn up to 1.35 times larger than a 16:9 episode's at the same size setting, because the font scale followed the picture's own aspect ratio. The scale now comes from the largest 16:9 frame that fits the player, so every film gets the same text size in a given window. A 16:9 episode keeps its current size in every window. Closes Silo-Server#5444
Code Review Could Not Complete
|
| Options | Enabled |
|---|---|
| Bug | ✅ |
| Performance | ✅ |
| Security | ✅ |
| Business Logic | ❌ |
|
Warning Review limit reachedThis organization requires a seat for paid usage-based reviews, including automatic and on-demand reviews. Ask an admin to assign a seat or enable paid usage-based reviews for users without a seat in Billing. Next included review available in 59 minutes. View limit details
|
Problem
Closes #5444
Related issue: N/A
Validation tasks: none (reaches #1159 C1 and C4, neither run yet)
Other clients: Apple Silo-Server/silo-apple#1208; Android Silo-Server/silo-android#1087; Roku N/A (silo-roku has no subtitle size scaling of its own)
In the web player, a wide film's subtitles were larger than a 16:9 episode's in the same window. This happened whenever the window was wider than the film. At 1600×600 with Size X-Large, a 2.40:1 film drew 45 px text against 33 px for a 16:9 episode; on a 3440×1239 ultrawide it was 93 px against 69 px. Landscape phones hit it too. This change gives every film the same subtitle size in a given window.
Approach
computeSubtitleFontScaletook its reference height from the picture's own aspect ratio, so a wide film that filled the window's height got a taller reference than a 16:9 picture. In Fit, the scale now comes from the largest 16:9 frame that fits the player:min(height, width × 9/16) / 720. That is the value a 16:9 picture already had, so 16:9 sizes do not change in any window. A 4:3 picture in a window narrower than 16:9, which used to get larger text, now matches too.Fill still sizes text from the player height, as before. That size never depended on the film, and dropping it would shrink Fill text in narrow and portrait windows, which the issue did not ask for. Unlike the patch attached to the issue, this change keeps the fit mode as an input for that reason.
Top and Lower Third positions are still placed from the picture's reference frame. The issue notes they can sit outside the window for a wide film in an ultrawide window. That is left for a separate change.
Validation
format:check,buildwith the type check, andbudget:checkpass.verify-local-paths,verify-bidi,verify-size-ratchetandverify-case-collisionspass. No Go code changed.Evidence
Evidence: https://evidence.siloserver.org/r/silo-server/pr-5510/
Computed subtitle font size, X-Large, same build and data before and after
Risks
Wide films get smaller subtitles than before in windows wider than 16:9, down to the size a 16:9 episode already gets there. 16:9 content is unchanged everywhere. None identified otherwise.
Checklist
AI Disclosure
useSubtitleLayouthook. It stays on the scale function, because that is the logic that broke and the hook only passes the player size through.