mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-11 10:56:43 -08:00
A character budget is not a width budget. Codex measured a 34-character line of `W` at font-size 52 rendering ~1948px into 1072px of available space: the previous fix guaranteed line LENGTH, so its test passed while the card still cropped. Card text now wraps by estimated rendered width. `estimateTextWidth` assigns per-glyph advance factors — calibrated against that measurement and deliberately erring high, since over-estimating wraps a line early (invisible) while under-estimating crops the card — and every call site passes the real pixel budget instead of a character count. Text that still cannot fit is ellipsized to width, and each emitted line carries an SVG `textLength`/`spacingAndGlyphs` clamp when the estimate says it would overflow anyway, so a mis-measured glyph compresses rather than crops. Verified by rendering the pathological 60-`W` headline through sharp on both card layouts and the hero: all stay inside the canvas. Docs: the 60-character cap is now described as the authoring guideline it is, not a rendering guarantee. 187 tests passing. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>