Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

could you describe your general approach? #1

Open
wtholliday opened this issue Mar 17, 2022 · 6 comments
Open

could you describe your general approach? #1

wtholliday opened this issue Mar 17, 2022 · 6 comments

Comments

@wtholliday
Copy link

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

@dzhou121
Copy link
Collaborator

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”?

@wtholliday
Copy link
Author

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.

@UE2020
Copy link

UE2020 commented Mar 23, 2022

Well for the font rendering I'm using fontdue

How do you render stroked glyphs with fontdue?

@wtholliday
Copy link
Author

How do you render stroked glyphs with fontdue?

See here: https://github.com/audulus/vger-rs/blob/abe8274f8cc155a9018f339354ed5ee836c05861/src/glyphs.rs#L35

@dzhou121
Copy link
Collaborator

dzhou121 commented Apr 8, 2022

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.

@UE2020
Copy link

UE2020 commented Apr 13, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants