-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Implemented drawing of CJK characters with ImGui screens #72579
Conversation
80dff06
to
0318297
Compare
0318297
to
9e430e1
Compare
Just noticed something... On text entered into an input field, the cursor position doesn't match the space between glyphs Edit: with CJK characters I mean |
this should be good now |
This is a good catch. The fault for the original issue likely lies in the ImTui backend. I definitely wouldn't expect this PR to fix it unfortunately, since this has everything to do with graphical textures that curses builds know nothing about. I would go ahead and make a separate issue for that, we will need to track that as a blocker for moving the UI completely to ImGui. |
683c787
to
74cf75f
Compare
74cf75f
to
2aeeab5
Compare
…an render the fonts using its own functions
bf3fbe2
to
84b2a8d
Compare
Summary
Bugfixes "Implemented drawing of non-English characters in ImGui screens"
Purpose of change
Fixes: #72162
Describe the solution
Implemented a font "fallback" system in ImGui to allow CDDA to interrupt ImGui's drawing flow to draw glyphs using CDDA's Font::OutputChar method.
Describe alternatives you've considered
There are open PRs in the ImGui repo that implement dynamic font atlases which could potentially solve this problem, but they seem far from being viable enough to be a better solution than this.
Testing
Changed the language to Chinese, opened up the keybindings screen, and verified that the screen displays properly
Additional context
The 'x' and 'y' position that ImGui tries to draw at doesn't quite work for Cataclysm. I needed to modify those by magic numbers to make the font align properly. I'm still not sure why it's needed.