问题
I can't get Safari(11.1) to load font files via the FontFace interface, if those files font names begin with numbers.
The same files that show an error in Safari load perfectly fine in Chrome and Firefox. Here is the most simplified version I could create that still produces the error.
var fonty = new FontFace('0Test', 'url(fonts/0Test.woff)');
console.log('This will only show if the Font name does not begin with a number');
Checking the Safari(11.1 is the version I'm using) console, you'll see the error: 'SyntaxError: The string did not match the expected pattern.', and when actual valid fonts that begin with numbers are used, it simply won't load.
Here's a jsfiddle that demonstrates the issue https://jsfiddle.net/0oknd7eL/1/
Is there a workaround to this situation, that still uses the FontFace interface?
Edit - To clarify, the issue is with the names of the fonts, and not the names of the files. For example FontFace('012-This-Beginning-With-Numbers-Is-The-Issue', 'url(fonts/012-This-Seems-Fine.woff)');
来源:https://stackoverflow.com/questions/56639922/how-do-i-load-fonts-with-filenames-which-begin-with-numbers-via-the-fontface-in