Use fetch to load fonts in load Font, but it fails in the node environment
Open
- Dominant language
- TypeScript
- Stars
- 14.7k
- Forks
- 777
- PR merge metrics
- No merged PRs in 30d
Description
# Expected Behavior
Normal loading font
# Current Behavior
When I was writing a Raycast extension, I used Jimp to draw text onto an image. I encountered an error: fetch is undefined, because loadFont uses the fetch function, which does not exist in the Node environment
# Failure Information (for bugs)
```js
const SANS_32_BLACK = await fs.readFile(path.join(environment.assetsPath, 'fonts/open-sans-16-black.fnt'), {
encoding: 'utf-8'
})
const font = await loadFont(SANS_32_BLACK)
```
and get an error
```shell
ReferenceError: fetch is not defined
```
- Jimp Version: 1.4.0
- Operating System: mac OS
- Node version: 20
Contributor guide
Assessment
This issue has not been assessed yet.