Text Fit is not working on casparcg

Good Morning all ,

I have a problem when i try to fit the text in a div when this one is bigger than the div, i use a function is call Fittowidht.
The problem i think is the font is not loaded at the beginning so i use another function is:

And here is the real problem , when i go throw the web is working perfectly
but when i build for sending to casparcg this method is not working at all and i dont know how to fixed

any idea what is going on ??


If you comment out these console.log lines, while you play it in Caspar, do they show up in the console or the log file? In other words: Are you sure, that document.fonts.ready.then fires in Caspar?

yes, is working

sorry i mean is fire in caspar but still not working

1 Like

Probably a timing issue. FitText is running before the text has been inserted into the DOM from the update() call.

And how i can fix that i use this
link rel=“preload” href=“./fonts/PierSans-Black.otf” as=“font” crossorigin=“anonymous”

in web is working but in caspar dont, how can i preload a font in caspar ???

I would suggest to put a


to reload the function a bit later, so you can understand if it is a timing problem.

Check if Chromium versions are the same with CasparCG and Web browser, sometimes there is an issue when something works on web but not Caspar. :slight_smile:

how can i check the Chromium version on casparcg ??

thanks for the asnwer

play() {
// Caspar PLAY directive
setTimeout(() => {
}, 500);

Thank you its work