JSFiddle: https://jsfiddle.net/crfyv9bj/
In this fiddle, I'm using Paper.JS to draw text in the custom "Roberto Mono" Font.
I followed all the tips to "initialize" the custom font in an empty/dummy DIV before using Paper.JS, listed here: https://stackoverflow.com/a/72504869/1005607 , https://stackoverflow.com/a/24936013/1005607 .
However, as you can see in this fiddle, even with this empty/dummy DIV,
- Firefox: Works instantly, auto-loads the font
- Chrome: DOES NOT AUTO-LOAD THE FONT: Resizing the window is necessary to see the font
- Edge: DOES NOT AUTO-LOAD THE FONT: Resizing the window is necessary to see the font
You can double-click the title bar to resize the window and only then will PaperJS display the correct custom font in Chrome and Edge. What's going on here? Can someone advise?
<!-- This is an empty/dummy DIV to "initialize" the font, STILL DOESN'T HELP -->
<div style="display: none; font-family: 'Roboto Mono';"></div>
<!-- Canvas -->
<canvas id="mycanvas" resize></canvas>
JS
canvasElem = $('#mycanvas').get(0);
paper.install(window);
paper.setup(canvasElem);
// Draw Text
var text = new paper.PointText(new paper.Point(50, 50));
text.justification = 'center';
text.fillColor = 'red';
text.fontFamily = 'Roboto Mono';
text.fontSize = '30px';
text.fontWeight = 'bold';
text.content = 'This is a test 1234567890';
paper.view.draw();