Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions src/utils/getFontPathByWeight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ export function getFontPathByWeight(
const style = options?.style ?? "normal";
const format = options?.format ?? "truetype";

return fonts
.find(font => font.weight === String(weight) && font.style === style)
?.src.find(file => file.format === format)?.url;
}
for (const font of fonts) {
if (font.weight === String(weight) && font.style === style) {
const src = font.src.find(file => file.format === format);
Comment thread
satnaing marked this conversation as resolved.
Outdated
if (src) return src.url;
}
}

return undefined;
}
Comment thread
satnaing marked this conversation as resolved.
Outdated
Loading