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

CJK character is not rendered correctly #140

Closed
SilverRainZ opened this issue Feb 19, 2021 · 2 comments · Fixed by #255
Closed

CJK character is not rendered correctly #140

SilverRainZ opened this issue Feb 19, 2021 · 2 comments · Fixed by #255
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@SilverRainZ
Copy link

Here is the file content:

$ cat test                            
中文测试

Open it with uivonim:

2021-02-19_13:14:04

Enviornment:

  • Arch Linux
  • Uivonim v0.28.0.24.gd23b6ea
  • Neovim 0.4.4
@smolck
Copy link
Owner

smolck commented Feb 19, 2021

See #107; my plan for fixing this is to swap out the current webgl renderer with an HTML canvas renderer, which should render these sorts of characters properly. I’m going to try and get #137 finished and merged first though.

@smolck smolck added enhancement New feature or request help wanted Extra attention is needed labels Mar 6, 2021
@smolck
Copy link
Owner

smolck commented Mar 6, 2021

So, in trying to fix this, I've learned that (1) a WebGL renderer is a major reason why uivonim is as fast as it is, and removing that would make it much slower, especially considering my optimization skills (or lack thereof), and (2) that I have no idea how to fix this with WebGL. The ideas I've come up with/tried just aren't ideal, or don't work, or both.

Trying to render double-width chars in a single pass of the current renderer is really difficult, if not impossible (and if it is possible I don't know enough about WebGL to make it work), and even if it did work I'm guessing it would add a lot of if statements and such to the shaders and thus make the rendering inefficient/slow(er than it could be).

Doing two render passes with separate shaders would be ideal probably, kind of like what Goneovim does, where the CJK chars are rendered separately after non-CJK chars, but I have no idea how to make that work. I can't really have two grid buffers, because (a) that would be inefficient probably and (b) a pain to deal with. I could maybe have a specialChars array that I keep track of, but then I would need some sort of placeholders in the main gridbuffer to keep track of where they should be in the file, specifically on scroll.

Overall this just feels outside my area of understanding, unfortunately, even after having read up on WebGL. I feel like I have a decent grasp on what's happening, but fixing the issue is not trivial, it seems, at least for me.

smolck added a commit that referenced this issue Jun 2, 2021
Adds new font atlas & modifies rendering code to deal with CJK chars. Fix #140.

TODO: Text rendering quality seems to look worse for some reason on my 1080p display but not my MBA? Maybe just me but something to look into.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants