diegomura / diegomura/react-pdf

Valid fonts render as black dots

Open
#3,027 1 comment 0 reactions 0 assignees View on GitHub
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**
image

**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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.