(pInst, name, path, descriptors, rawFont)
| 1019 | } |
| 1020 | |
| 1021 | async function create(pInst, name, path, descriptors, rawFont) { |
| 1022 | |
| 1023 | let face = createFontFace(name, path, descriptors, rawFont); |
| 1024 | |
| 1025 | // load if we need to |
| 1026 | if (face.status !== 'loaded') await face.load(); |
| 1027 | |
| 1028 | // add it to the document |
| 1029 | document.fonts.add(face); |
| 1030 | |
| 1031 | // ensure the font is ready to be rendered |
| 1032 | await document.fonts.ready; |
| 1033 | |
| 1034 | // return a new p5.Font |
| 1035 | return new Font(pInst, face, name, path, rawFont); |
| 1036 | } |
| 1037 | |
| 1038 | |
| 1039 | function sanitizeFontName(name) { |
no test coverage detected