(faces: FontFace[])
| 55 | // One resolved face can feed multiple published CSS files, for example a static |
| 56 | // italic face contributes to both `400-italic.css` and `latin-italic.css`. |
| 57 | const groupFacesByCSSFile = (faces: FontFace[]): Map<string, FontFace[]> => { |
| 58 | const facesByCSSFile = new Map<string, FontFace[]>(); |
| 59 | |
| 60 | // Iterate over each face and assign it to the appropriate CSS files based on its properties. |
| 61 | for (const face of faces) { |
| 62 | for (const cssFile of getCSSFiles(face)) { |
| 63 | const cssFaces = facesByCSSFile.get(cssFile); |
| 64 | |
| 65 | if (cssFaces) { |
| 66 | cssFaces.push(face); |
| 67 | } else { |
| 68 | facesByCSSFile.set(cssFile, [face]); |
| 69 | } |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | return facesByCSSFile; |
| 74 | }; |
| 75 | |
| 76 | const getCSSFiles = (face: FontFace): string[] => { |
| 77 | const style = formatStyle(face.style); |
no test coverage detected