Re: [csswg-drafts] [css-fonts-4] Feature for making text always fit the width of its parent (#2528)

This would be very useful and I'm missing it in almost every project. I guess the most important use-case is if you have a fixed rectangle and want to fit the text inside. For example a stage component that takes the whole viewport with an image. Now if you want to fit a headline for that stage inside a 60vw x 60vh rectangle with optimal font-size you shouldn't have to resort to JS. Perhaps the algorithm could be optimized to avoid being too expensive. Perhaps take two font-sizes apart and quickly narrow it down until it matches the height by halving the range. Considering there's video decoding etc. in today's browsers I wonder if it'd really by that much of a performance hog. Perhaps the amount of HTML that can be inside such an element could be limited somehow. I don't think we'd need tables etc. Simple formatted text with bold italic and so on would probably be sufficient for many cases and reduce the strain on the browser.



-- 
GitHub Notification of comment by rgpublic
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2528#issuecomment-2439636530 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Saturday, 26 October 2024 16:12:12 UTC