elements icon indicating copy to clipboard operation
elements copied to clipboard

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

Open Flole998 opened this issue 9 months ago • 2 comments

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.

Flole998 avatar May 01 '24 01:05 Flole998

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

djowel avatar May 01 '24 04:05 djowel

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.

Flole998 avatar May 01 '24 22:05 Flole998