piet-wgpu
piet-wgpu copied to clipboard
could you describe your general approach?
I'm curious :)
I've got a 2D wgpu renderer that might be useful to look at and borrow from: https://github.com/audulus/vger-rs
cheers
For shapes, I’m using Lyon to tress the paths into triangles. For text, I use font kit to draw to pixel map, and quad it.
I checked out your repo the other day and SDF certainly looks really interesting. How does the font rendering looks comparing to “native”?
Ah cool. Well for the font rendering I'm using fontdue, not the SDF path rendering. I'm using the same atlas texture technique as in nanovg (glyphs are rendered into the atlas as needed, as opposed to making a single atlas for an entire font). Perhaps this is the same as your approach. I think it looks quite good except there are potentially some layout issues with fontdue, and it lacks subpixel AA. I tried using my path renderer for glyphs and it's just too inefficient.
Well for the font rendering I'm using fontdue
How do you render stroked glyphs with fontdue?
How do you render stroked glyphs with fontdue?
See here: https://github.com/audulus/vger-rs/blob/abe8274f8cc155a9018f339354ed5ee836c05861/src/glyphs.rs#L35
I tried using my path renderer for glyphs and it's just too inefficient.
I tried that before. Just too many triangles that need to send to GPU.
I'm recently trying swash to do the text rendering which supports subpixel AA and text shaping. The end result seems very good.
How do you render stroked glyphs with fontdue?
See here: https://github.com/audulus/vger-rs/blob/abe8274f8cc155a9018f339354ed5ee836c05861/src/glyphs.rs#L35
The rasterize function outputs filled text, not stroked text. When I say stroked text, I mean something like this: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/strokeText