diegomura / diegomura/react-pdf
Valid fonts render as black dots
- Dominant language
- TypeScript
- Stars
- 16.8k
- Forks
- 1.3k
- Avg merge
- 5h 6m
- Merged PRs (30d)
- 52
Description
**Describe the bug**
When registering a valid custom font via URL, they render as black dots. It doesn't seem to matter whether `.ttf` or `.woff` fonts are used. Have tried various different fonts from various different sources. The fonts preview just fine in macOS (ie not using react-pdf, just the OS's own font previewer) when downloaded from the same source URL.
**To Reproduce**
```
Font.register({
family: "Open Sans",
src: "http://fonts.gstatic.com/s/opensans/v13/IgZJs4-7SA1XX_edsoXWog.ttf",
});
const styles = StyleSheet.create({
wrapper: {
fontFamily: "Open Sans",
},
});
ReactPDF.render(
Test
,
`${__dirname}/test.pdf`,
);
```
Font source: https://gist.github.com/karimnaaji/b6c9c9e819204113e9cabf290d580551
**Expected behavior**
Fonts render normally
**Screenshots**
**Desktop (please complete the following information):**
- OS: macOS
- Browser: N/A (node `v22.6.0`)
- React-pdf version: `4.1.6` (latest version as of today)
Contributor guide
Assessment
This issue has not been assessed yet.