fix(virtues): add body-text auto-shrink for vertical overflow (#190) - #420
Merged
Merged
Conversation
Extends the proven title auto-shrink mechanism (PR #400, issue #316) to handle vertical text overflow in card body content. - New autoFitBodyText() function in frame.js: binary search on font-size for .desc_* and .exemple_* children of .texte container until scrollHeight <= clientHeight (2px tolerance, matching OverflowDetector.cs) - Targets all language variants (.desc_fr, .desc_en, .desc_ru, etc.) - No-op when text fits (common case) — same idempotent design as title shrink - Min font floor: 7px (readable even at print DPI) - Applied to all cards generically before capture Worst Virtues overflow candidates: 'Argument pertinent' (178 ch combined desc+remark), 'Arguments vertueux' (167 ch), 'Distance émotionnelle adequat' (143 ch desc only). Fixes overflow in ALL languages — RU Cyrillic (~15-20% wider), AR/FA/ZH with different font metrics all benefit. Build: 0 errors, 131/131 tests pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
Author
ai-01 Code Review — APPROVE (pending QA visuelle)Code review OK — clean extension of #400 title auto-shrink pattern to body text. Verified
One cosmetic noteThe selector hardcodes .desc_XX / .exemple_XX for 8 langs. Could use attribute selectors for future-proofing, but matches existing title-shrink pattern — not blocking. Before mergeQA visuelle on a Virtues card with long text (e.g. Argument pertinent 178ch FR) to confirm body text auto-shrinks instead of clipping. |
5 tasks
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
Virtues cards (and potentially other CardSets) have text that overflows vertically — the .texte container has overflow: hidden, so text is silently clipped. Issue #190 tracks this.
Worst FR offenders: Argument pertinent (178 ch), Arguments vertueux (167 ch), Distance emotionnelle adequat (143 ch). All languages affected — RU Cyrillic ~15-20pct wider.
Solution
Extends the proven title auto-shrink (PR #400, issue #316) to vertical body text overflow:
Scope
Validation
Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com