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

fontique: Loading fonts from fs #101

Open
waywardmonkeys opened this issue Aug 9, 2024 · 2 comments
Open

fontique: Loading fonts from fs #101

waywardmonkeys opened this issue Aug 9, 2024 · 2 comments

Comments

@waywardmonkeys
Copy link
Contributor

We should be able to load a font from the file system or scan a directory for fonts, rather than only having FS access via system. (We should be able to let the text stack memory map arbitrary font files without having to load them into a blob.)

In fontdb, this is easy to do by using Database::load_font_file or Database::load_font_dir.

In font-kit, this can be done with the sources::fs::FsSource.

@waywardmonkeys
Copy link
Contributor Author

I was wrong about part of the above. Blob works with memmap2 so that you aren't loading the whole thing. But the other stuff is still true, I think.

@dfrg
Copy link
Collaborator

dfrg commented Aug 12, 2024

Having register_fonts take a Blob instead of Vec<u8> would be one step in this direction. We could add register_fonts_from_path to solve the rest, but we’d want to consider whether these should be fully loaded or just parsed and added to a source path map to be lazily loaded later.

Also, since memory mapping is considered generally unsafe in Rust, we should offer the option to disable it, even for system collections.

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