Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to use registered font with SvelteKit app on Node server #2361

Open
Divocaak opened this issue Mar 5, 2024 · 1 comment
Open

Failed to use registered font with SvelteKit app on Node server #2361

Divocaak opened this issue Mar 5, 2024 · 1 comment

Comments

@Divocaak
Copy link

Divocaak commented Mar 5, 2024

Hi, I have a trouble with getting the fonts to work on production server. Everything works locally (MacOS, 2020 M1 running on Sonoma 14.1.1), but not on Node server.

This is the registerFont section of the code:

registerFont(path.resolve("./vidGenAssets/neue.otf"), { family: 'Neue Machina Regular' });
registerFont(path.resolve("./vidGenAssets/karla.ttf"), { family: 'Karla Regular' });
const canvas = new Canvas(w, h);

This is how I use them: context.font = "40px 'Neue Machina Regular'"; or context.font = "40px 'Karla Regular'";

I am pretty sure the code can access the fonts on the server, because I've tried to delete them and run the script again. This ended up throwing a 404 error, as it could not find the files.

local and server npm list looks exactly the same

├── @playwright/test@1.42.1
├── @sveltejs/adapter-node@1.3.1
├── @sveltejs/kit@1.30.4
├── @zerodevx/svelte-img@2.1.0
├── canvas@2.11.2
├── eslint-config-prettier@8.10.0
├── eslint-plugin-svelte3@4.0.0
├── eslint@8.57.0
├── ffmpeg-static@5.2.0
├── fluent-ffmpeg@2.1.2
├── mysql2@3.9.2
├── prettier-plugin-svelte@2.10.1
├── prettier@2.8.8
├── sass@1.71.1
├── svelte-markdown@0.4.1
├── svelte@4.2.12
└── vite@4.5.2

servers node -v output is v18.17.1, local is v18.14.2

any help appreciated!

@breadcrumbsonthefloor
Copy link

registerFont is broken, some said this don't occur on 2.10.2, in case downgrading didn't work, try deleting node_modules and reinstall with downgraded version #2285

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

No branches or pull requests

2 participants