Skip to content

Commit 5d2eaec

Browse files
authored
including comma in all cases.
1 parent beb11b5 commit 5d2eaec

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/type/p5.Font.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -983,9 +983,10 @@ async function create(pInst, name, path, descriptors, rawFont) {
983983

984984
function createFontFace(name, path, descriptors, rawFont) {
985985

986-
if (!/^[A-Za-z_][\w-]*$/.test(name)) {
987-
name = "'" + name.replace(/'/g, "\\'") + "'"; // single quotes
988-
}
986+
if (!((name.startsWith("'") && name.endsWith("'")) ||
987+
(name.startsWith('"') && name.endsWith('"')))) {
988+
name = "'" + name.replace(/'/g, "\\'") + "'";
989+
}
989990

990991
let fontArg = rawFont?._compressedData ?? rawFont?._data;
991992
if (!fontArg) {

0 commit comments

Comments
 (0)