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
Passing character info to renderer #25
Labels
enhancement
New feature or request
Comments
Ok, that is pretty clever. I'll let you know if I get some ideas about this, but at the moment your concept seems much better than the existing one. |
Any progress on this? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently, imtui uses a modified
ImFont::RenderText
function where it inserts the ascii value of the character to be rendered in the alpha channel of the color (ImDrawVert.col
). While this makes imtui possible, it requires a modification to imgui itself achieve, which makes long term maintenance an issue.Here is a proposed way to pass the character values by using the coordinates in the font texture instead. Proof of concept code below.
Then, in the render function, once it's determined this is a textured 1x1 glyph, read the position in the texture to get the character index:
I've tested this and it works without issue, with some error handling, etc. Posting here for input and ideas before making a PR.
I believe many of the other changes in the local fork of imgui can be resolved when the work on "style V2" commences. (See, for example, ocornut/imgui#2017)
The text was updated successfully, but these errors were encountered: