texstudio-org / texstudio

TeXstudio is a fully featured LaTeX editor. Our goal is to make writing LaTeX documents as easy and comfortable as possible.
http://www.texstudio.org/
GNU General Public License v3.0
2.79k stars 344 forks source link

Misplacement of mixed CJK and English text in editor #455

Open sumbrez opened 5 years ago

sumbrez commented 5 years ago

Environment

Expected behavior

Every English letter and Chinese char can be displayed correctly when they are mixed.

Actual behavior

There are several kinds of misplacement or overlap of letters or chars, and I don't know them clearly.

How to reproduce

I made a gif of the misplacement of the following text.

一二三(one tow three)four five six
一(一)
一二三(一二三)

This is the gif. txs

This is when all text are selected. txs-all

This is the displacement in Windows notepad as a comparison. notepad

In the above case, the misplacement occurs near (Chinese) brackets "(" and ")" and number of chars before brackets matters. Generally when displaying Chinese chars, all chars, including Chinese punctuations have the same width. But in TXS editor widths may differ. Besides, widths of blanks differ as well like four five six in the above text.

The misplacement is just the editor behavior, having no influence on other functions.

timhoffm commented 5 years ago

I copy-pasted the above code snippet into the editor, but cannot reproduce the behavior. Everything works as expected. Can you please provide an example file so that I can exclude any copy-paste/encoding/conversion errors.

sumbrez commented 5 years ago

Here is the file containing text above and saved by my TXS. (extension is changed to txt for uploading) document.txt But I think there should be no copy-paste error. Moreover, after pasting the text above, there is a change as the following gif. txs-pasting The font is Consolas and my editor settings is txs-editor-settings CJK chars are displayed in 宋体 as the result of fallback font.

Moreover, I tried changing font from Consolas to 宋体 which contains letters as well, and the issue disappeared. txs-change-font

timhoffm commented 5 years ago

Sorry, not reproducible here. Seems to be font-dependent. I don't know how to proceed with this.

I assume that this has something to do with the CJK fallback font for fonts that do not have CJK glyphs like Consolas. Further investigation would probably need somebody with more knowledge on these.