Loading fonts from filesystem #2334
-
So in my app I'd like to load a font/fonts from the user's system (e.g. from In Electron, I think this happens automatically; a quick I tried/am trying to use font-kit on the Rust side to load a font and get the corresponding binary data from it, then return it to JS via a command. From there using Ideally perhaps I could load the font from a css Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
I know its been a while since you got a response but you can use url() with whatever you are using to bundle your webpage. |
Beta Was this translation helpful? Give feedback.
-
Is there a way to use the users local fonts within dynamic css? I have a presentation application that allows the user to create slides and edit the 'theme' which creates a css file that is dynamically injected into the application, but Im not sure if its possible to use the system fonts in this way. Any insight would be greatly appreciated. |
Beta Was this translation helpful? Give feedback.
I know its been a while since you got a response but you can use url() with whatever you are using to bundle your webpage.
something like vite would allow you to copy those assets to the build directory. Tauri will include those files too.
Something like this -> https://github.com/Blakeinstein/Bloop/blob/a0d4ec73a5b0938f2c4a01ff7e96a5bf39a8081e/src/web/index.html#L40