Skip to content

Commit 53c9cf8

Browse files
authored
Merge pull request #7882 from sophyphile/add-font-readiness
Add font readiness wait to create() function in p5.Font.js
2 parents 7896bea + 6591658 commit 53c9cf8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/type/p5.Font.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -950,6 +950,9 @@ async function create(pInst, name, path, descriptors, rawFont) {
950950
// add it to the document
951951
document.fonts.add(face);
952952

953+
// ensure the font is ready to be rendered
954+
await document.fonts.ready;
955+
953956
// return a new p5.Font
954957
return new Font(pInst, face, name, path, rawFont);
955958
}

0 commit comments

Comments
 (0)