On 2020-04-23, Silvan Jegen <[email protected]> wrote: > I had a quick look and currently it looks like it's mostly useful for > rendering of fonts in X. I wonder how an interface would look like that > could also be used for text rendering for a Wayland client. I assume the > library would instead just render to some graphics memory to be rendered > by the compositor, but I am not completely sure.
I think the interface would look the same for Wayland, but the missing piece is something to composite the glyphs into the application's window buffer, which is handled by XRender in the demo. If you are rendering to shared memory, pixman (which is essentially XRender in a library) can be used similarly. You can create a glyph cache, load the glyph images produced by libschrift into it, and then use pixman_composite_glyphs to render them onto your frame. For OpenGL/Vulkan, it's the same on X11 and Wayland, since the client is doing direct rendering in both cases. I believe it's generally done by creating an "atlas" texture containing a bunch of glyphs at different positions, and then rendering subregions of it onto your frame. Most code using freetype directly could probably be adapted to libschrift fairly easily.
