<fit-text> Web Component Unlicensed source on GitHub
Try it yourself...
Resize container max-width (10-100%): and/or resize your Browser window
And load another font:
A Native JavaScript Web Component <fit-text> [your text] </fit-text> sets font-size style to fill text to container width The Web Component sets the inline style font-size on the <fit-text> DOM element
The Web Component resizes its content on resize and font loadingdone events

Using <fit-text> - Two line minimal path to happiness:

<script src="https://fit-text.github.io/element.js">
<fit-text>Hello World!</fit-text>

<fit-text> minified GZIP Filesize is small