Skip to content

Conversation

xdoer
Copy link

@xdoer xdoer commented May 10, 2025

Jimp supports loading fonts from URLs, but on the browser, I found that it performs abnormally under non localhost domains.

Then I found that there was a problem with the following line of code,

CharacterJimp.read(path.join(path.dirname(file), page))

and it will eventually construct a similar one https:/raw.githubusercontent.com/jimp-dev/jimp/main/plugins/plugin-print/fonts/open-sans/open-sans-16-black/open-sans-16-black.png

The link clearly shows that there is a missing '/' after 'https'.

@xdoer
Copy link
Author

xdoer commented May 10, 2025

I found it is interesting, I used the following code to test it separately in Node environment, browser environment under localhost URL, and https URL.

fetch("https:/raw.githubusercontent.com/jimp-dev/jimp/main/plugins/plugin-print/fonts/open-sans/open-sans-16-black/open-sans-16-black.png")

It can take effect in both Node environment and browser localhost address.
But it does not take effect in HTTPS address.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant