rpg-cards icon indicating copy to clipboard operation
rpg-cards copied to clipboard

Font size auto-adjust

Open ghost opened this issue 9 years ago • 3 comments

I'd really like it if you could have text auto-adjust its font-size depending on the area you want to fit it in.

ghost avatar Dec 30 '15 00:12 ghost

That would be a very useful feature. Unfortunately, this can't be done with HTML/CSS alone. The only way to find the optimal font size is to keep generating cards with differing font sizes until the text fits.

There's libraries to do this (like flowtype or fittext), but I'm not sure how well these would work with a tool that generates static HTML. If you know a good library, feel free to post a pull request!

crobi avatar Dec 31 '15 08:12 crobi

How about http://jquery-textfill.github.io/ ?

garylzimmer avatar Sep 15 '16 02:09 garylzimmer

Same as the above mentioned libraries, this one generates text with different font sizes until it fits. There's other libraries like http://danielhoffmann.github.io/jquery-bigtext/ that guess the optimal font size without rendering it repeatedly.

crobi avatar Sep 29 '16 19:09 crobi