Commit e062c79
authored
fix: iterate all weight matches in getFontPathByWeight (#645)
* fix: iterate all weight matches in getFontPathByWeight
When fontData has multiple entries for the same weight with different format sets, Array.find() stops at the first match even if that entry does not contain the requested format. The fix uses a for...of loop that returns only when both weight AND format match.
* fix: add fallback to first src entry and trailing newline
- Use `?? font.src[0]` as fallback when no src entry matches the
requested format, as suggested in code review
- Add missing trailing newline at end of file
Fixes #6441 parent ca42b6b commit e062c79
1 file changed
Lines changed: 8 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
16 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
17 | 22 | | |
0 commit comments