Hi Michael
Thanks for your input!
Michael Forney <mforney_AT_mforney.org> wrote:
> On 2020-04-23, Silvan Jegen <s.jegen_AT_gmail.com> 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.
Yeah, that's where my missing understanding of graphics programming
becomes apparent. I assumed a font rendering library will just take a
pointer to some memory as an argument to its rendering function to which
it will then write the bitmapped glyph. Surely you will have to take the
different buffer formats into account there though so I am not sure how
that would work.
I'm also stomped by how the shared memory (like wl_shm) differs in Wayland
from a buffer you would get from EGL (like dmabuf-based wl_buffers) or
another graphics library. I thought I could just use pixman to render
into both but I don't think that's actually true... This example[0]
definitely looks relevant to this topic.
These are the questions I will have to answer for myself before I will
be able to contribute much there, I am afraid.
Cheers,
Silvan
[0]
https://github.com/wayland-project/weston/blob/master/clients/simple-dmabuf-egl.c
Received on Fri Apr 24 2020 - 16:44:14 CEST