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

Implement no_std compatible ab_glyph glyph rendering backend #185

Closed
wants to merge 3 commits into from

Conversation

EHfive
Copy link
Contributor

@EHfive EHfive commented Sep 17, 2023

Note

This PR depends on #183 and #184 . Please review & merge those first. Merged or have alternative #188 .

Implement no_std compatible ab_glyph glyph rendering backend

This uses ab_glyph to scale & rasterize glyph outline and load glyph image, it
can be served as an alternative to swash.

For glyph image(e.g. color emoji) rendering, only support for images in PNG
format are currently implemented due to upstream limitation.

Screenshot of demo targeting no_std x86_64-unknown-uefi

Qemu UEFI


Add ab_glyph feature to examples and use the new draw_with method

Run examples with cargo run --features ab_glyph to test ab_glyph rendering.

@EHfive EHfive force-pushed the ab_glyph branch 4 times, most recently from 79e9960 to 7ac6d7b Compare September 18, 2023 15:38
@EHfive
Copy link
Contributor Author

EHfive commented Sep 18, 2023

@jackpot51 Seems "BSD-3-Clause" used by tiny-skia and "BSD-2-Clause" used by arrayref are explicitly disallowed by this project? Should I drop the dependency on tiny-skia?

There is not much no_std resizing library on crates.io though.

@jackpot51
Copy link
Member

@EHfive the deny.toml does not explicitely disallow those licenses, they just aren't explicitely allowed. You can add them to the allow list.

@EHfive
Copy link
Contributor Author

EHfive commented Sep 19, 2023

Separated the first commit into #189 for easier discussion.

And I decided to use resize for resizing glyph images as tiny-skia appears to have poor quality on image down-sampling, see https://github.com/RazrFalcon/tiny-skia#notable-changes . The crate resize is not no_std but there is a PR going away to make it no_std, PistonDevelopers/resize#35 .

Also marked this as draft to avoid creating noises in your message boxes.

The trait contains only one method, draw_line, which is going to be
implemented by glyph rendering backend like swash to scale & rasterize
inputed glyphs and draw pixels of them.

This make it easier to implement other rendering backend, and allows
switching rendering backend at runtime.

The original code of glyph rendering for swash is moved into Draw.

And add draw_with method to Buffer and Edit interfaces to draw with
glyph rendering backend that implemented Draw trait. The original
glyph drawing part using swash in buffer and editor is also migrated
to using Draw.
This uses ab_glyph to scale & rasterize glyph outline and load glyph image, it
can be served as an alternative to swash.

For glyph image(e.g. color emoji) rendering, only support for images in PNG
format are currently implemented due to upstream limitation.
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

Successfully merging this pull request may close these issues.

2 participants