Closed Dvad closed 7 months ago
Good idea! But I wonder if we should make the create-fonts function a bit more flexible by passing some data in.
For instance, it would be nice if I could replace this code block in the imgui-highdpi-sapp.c sample which sets up a TTF font texture with the new function:
...but as you can see here I'm also using a different sampler with LINEAR filtering:
Maybe simgui_create_fonts_texture()
should allow to pass in optional parameters (like either a sampler object, or maybe better just a minimal set of sampler params, like min+mag filter?
Or do you solve this same problem currently in some other way? (since you are writing: "...when testing different fonts raterization config...").
This is good suggestion!
I have not played with the sampler in my testing so far, the tool I linked allow to switch from freetype to stb_truetype with different parameters but the texture sampler was not one.
I gave it a shot and submitted the sister PR: https://github.com/floooh/sokol-samples/pull/135
Ok, looking into this PR now.
And merged, many thanks! (also updated the changelog)
As a happy sokol_imgui user, I am humbling proposing this PR. It splits the font texture creation in a API function and add a function for the font texture destruction. Those functions are considered optional function of the imgui backends.
For instance they are implemented for opengl3 on the main imgui repo:
https://github.com/ocornut/imgui/blob/659fb41d0a23efbb9ea6cf74f51ecae0a51575b5/backends/imgui_impl_opengl3.h#L39C1-L42C3
I find those functions are useful in two cases:
Does this proposal make sense?