daa84 / neovim-gtk

gtk ui for neovim
GNU General Public License v3.0
716 stars 57 forks source link

Handle CJK rendering #263

Open medicalwei opened 3 years ago

medicalwei commented 3 years ago

This changeset addresses two problems:

  1. When language is set to zh_TW (LANG=zh_TW), the metrics would be incorrect.
  2. When rendering CJK characters, the width of each consecutive CJK characters would be off.

This changeset addresses the above problems by making a break in itemizer for every non-ascii characters, as well as forcing the metrics information to be in en_US. This assumes that monospace fonts have all ASCII glyphs. Also, this would cause ligatures in non-ASCII fail.

Closes #256

medicalwei commented 3 years ago

Note that this commit would cause slowdowns when editing lines containing too many non-ASCII glyphs, which would imply that performance rendering documents like Cyrillic would be heavily affected.