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

embed fonts or use system fonts #2

Open
gabrielalexandrelopes opened this issue May 31, 2024 · 4 comments
Open

embed fonts or use system fonts #2

gabrielalexandrelopes opened this issue May 31, 2024 · 4 comments

Comments

@gabrielalexandrelopes
Copy link

This is very cool, thank you!

Is there a way to either embed the fonts or to use the system fonts?

@tfachmann
Copy link
Owner

Sorry for the late reply.
This repo was more of a proof of concept and guide how one could use typst as a library.

As far as I can tell, system fonts are something the typst devs always tried to avoid.
Why? Because their main target is WebAssembly, abstracting everything related to the system.

I haven't really used this boilerplate myself as it was more of a case-study, but I'm to contributions or whatsoever

@flxzt
Copy link

flxzt commented Jun 20, 2024

In the latest version the typst-cli does use fontdb to search for system fonts (see here ). typst-as-library could adapt and do something similar I think

@Cubik65536
Copy link

Cubik65536 commented Jul 27, 2024

You can use std::include_bytes to embed fonts like this (it's my own modification to the code of this repo).

I am also trying to find a way to be able to add other font externally (from whatever program that is calling the library) so other fonts (system one, or what user adds to the "project") can also be added and used.

@tfachmann
Copy link
Owner

Thanks for the resource! I would love to get a working proof of concept to compile it to web assembly, where ureq must be replaced by reqwasm or any other wasm-friendly fetching library (#6).
Once this is sorted + fonts are properly handled for both system and web, this reference repository is pretty much complete.

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

4 participants