Skip to content

Fix reversed line order for top-positioned multiline image subtitles - #41

Merged
sannies merged 1 commit into
mainfrom
HDCP-1618
Aug 14, 2026
Merged

Fix reversed line order for top-positioned multiline image subtitles#41
sannies merged 1 commit into
mainfrom
HDCP-1618

Conversation

@sannies

@sannies sannies commented Aug 14, 2026

Copy link
Copy Markdown

Summary

  • Multiline image-based subtitles positioned at the top were rendered in reverse order (first line below the second). Bottom-positioned subtitles were correct.
  • Cause: printLine iterated the flattened caption lines in reverse for both top and bottom. Reversal is only correct for bottom, which anchors the last line and stacks upward; top stacks downward and needs source order.
  • Fix: only reverse the iteration order for bottom; top and source now both iterate in source order.

Test plan

  • New TestMultilineOrder test renders a narrow first line and a wide second line, detects the two rendered text bands via the alpha channel, and asserts the first line is above the second — parametrized over top and bottom.
  • Verified the test fails against the unfixed code (top variant) and passes with the fix.

🤖 Generated with Claude Code

Both 'top' and 'bottom' positions iterated caption lines in reverse,
which is only correct for 'bottom' (it anchors the last line and stacks
upward). 'top' stacks downward, so the reversed iteration rendered the
first line below the second. Only reverse for 'bottom' now.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@sannies
sannies merged commit 04e216e into main Aug 14, 2026
1 check passed
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.

1 participant