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

Background color #153

Closed
MarcAntoine-Arnaud opened this issue Jul 18, 2022 · 4 comments
Closed

Background color #153

MarcAntoine-Arnaud opened this issue Jul 18, 2022 · 4 comments

Comments

@MarcAntoine-Arnaud
Copy link

Do you have any started work on background color support ?
It can be great to have in on Text and Section.

Do you have any advice to start to implement it ?

Thanks,
Marc-Antoine

@alexheretic
Copy link
Owner

I think rendering not-text is generally out of scope for this lib, though it should provide the all glyph-info you need to render backgrounds & text selection. For example GlyphBrush::glyphs returns info on the position of each rendered glyph on the screen so could be used to calculate rect coords for a selection / background.

GlyphBrush::glyph_bounds may be enough info on it's own to render a rect background for tooltips etc.

@MarcAntoine-Arnaud
Copy link
Author

Hello @alexheretic
Thank you for pointing me a great feedback.
Do you think it can be also possible to retrieve the position of a Text and not only a Section ?
Our requirement is also to underline word(s) in a section, not only a background of a Section.

Thank you for your advices.
Marc-Antoine

@alexheretic
Copy link
Owner

GlyphBrush::glyphs returns the position of every glyph along with it's section & str-byte indexes & font_id.

So if you wanted to underline str byte-index 4 to 14 you can lookup all the glyph positions related this way (and perhaps use the font to provide vertical metrics).

@MarcAntoine-Arnaud
Copy link
Author

Thank you for details. I will look to implement that.

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