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

Pixel write with drawoptions #174

Open
l4l opened this issue Jun 6, 2021 · 1 comment
Open

Pixel write with drawoptions #174

l4l opened this issue Jun 6, 2021 · 1 comment

Comments

@l4l
Copy link
Contributor

l4l commented Jun 6, 2021

I'd like to use rusttype for font-rendering instead of font-kit. Its API provides a set of points for the specified font render, for now I made it work via dt.fill_rect(x, y, 1., 1., color, &opts), but I guess there is a better way of achieving this. I don't want to manually edit the pixel buffer, because there will be no anti-aliasing.

@jrmuizel
Copy link
Owner

A possible better way to do this is with DrawTarget::mask(). i.e. you construct a mask with the glyph like https://github.com/redox-os/rusttype/blob/057f2d1d521667a90d082a34913ed7743754bf02/src/gpu_cache.rs#L972 does and then use DrawTarget::mask() to draw it at the correct location.

That being said, this is still going to be awkward. Overall, the text rendering in raqote needs a rework. My grand plan is to move the font rendering code in https://github.com/servo/webrender/tree/master/webrender/src/platform to a separate crate and use that for caching a drawing glyphs. As part of this, it should be possible to add support for a pure rust text backend as well.

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

2 participants