JS/jQuery

Font-To-Width, fit pieces of text snugly within their containers

Font‑To‑Width (FTW!) is a small Javascript routine by Nick Sherman and Chris Lewis that takes advantage of large type families to fit text to the width of an element using multiple font families of different widths.

Unlike other text-fitting tools like FitText.js, Font‑To‑Width does not scale the font-size (at least not by default). Instead, it chooses a width or weight variant according to what fits best, and then allows for letter- and word-spacing adjustments as needed.

Font-To-Width is meant for headlines and other short pieces of text. It was not built for justifying multi-line body type. Due to its use of micro spacing adjustments, Font-To-Width works best in browsers like Chrome, where subpixel spacing is supported. Other browsers that round spacing to integer values will show rounding errors.

Font-To-Width

Share/Like

Article Navigation

Wait .. there's more!

Online CV Jan Rajtoral