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

Provide an API for allowing to specify memory locations for fonts (and possibly images) #394

Open
Flole998 opened this issue May 1, 2024 · 2 comments

Comments

@Flole998
Copy link
Contributor

Flole998 commented May 1, 2024

There are some use-cases, for example single-file executables, where it would be a great benefit to allow specifying a vector of font-names and the binary data for those fonts or a pointer to that data. This way app-developers can grab fonts from whichever place they prefer to store them and whichever way of storing them fits their needs best.

Something similar could be done for images, for the same use-case.

@djowel
Copy link
Collaborator

djowel commented May 1, 2024

I think you'll need to be precise in what the API would look like.

@Flole998
Copy link
Contributor Author

Flole998 commented May 1, 2024

I'm not sure "where" to add it, but it could look like this:

addMemoryFont(std::string name, void* fontdata, size_t fontlength)

The fontdata pointer could also be made a shared char pointer I guess.

As for what happens when it's called: The font data can be loaded from memory as in the patch I posted on Discord, the difficult part is adding this to the font map and extracting the font information out of it, as the fontconfig helpers apparently only accept directories to scan.

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