Chinese character can not align with latin character


#1

I have a problem in atom editor(v1.11.7): Chinese characters can not align with latin characters. And i change the monospaced Font: Source Han Code and Courier New,but it didn’t work.I got the result I expected when I copy the content to notepad++ editor. Inproper settings?

view in two editors: notepad++(below) and atom(above)


#2

Can you paste the text that you’re showing there into a message here so that we can try to reproduce the problem?


#3

sorry,i forgot it.Here is the text:

---------------------------------------------------------------------------------------
|      KEY       |                     Description                     |解绑|查询|绑定|
---------------------------------------------------------------------------------------
  merchorder_no    商户订单号 CurrentRequestData.getOrderid()            Y    Y    Y  
  pmerchorder_no   原商户订单号 CurrentRequestData.getOrigorder()             Y
  transtype        0014-交易状态查询 0015-解绑 0016-绑定代收             Y    Y    Y
  submerid         子商户号                                              Y
  submername       子商户名称                                            Y
  merabbr          商户简称                                              Y

Thank you for helping.:grinning:


#4

I don’t think this has as much to do with the fonts you selected as that the characters are simply of different widths. Here are some things I noticed when looking at the text in the editor:

If you place the cursor directly before the first Y on the first line of the table, the cursor is at line 4, column 69. If you place the cursor directly before the first Y on the third line, the cursor is at line 6, column 62. The following lines are line 7, column 70, line 8, column 69, and line 9, column 70. So even if the characters were all the exact same width, they still wouldn’t line up as the text is typed.

Here’s what it looks like on my screen when I put the Y’s at the same column:

It looks like the more Han characters there are on a line, the more the line is thrown off. I was able to find this in the repository for the Source Han Sans font:

It appears that Source Han Sans isn’t designed to be a true monospaced font. Source Han Code JP however is. You mention you’re using Source Han Code? A font by that name doesn’t seem to exist from what I can find.

Additionally, I wouldn’t necessarily expect two different fonts (you mention Source Han Code and Courier New) to align perfectly. That’s why fonts like Source Han Code JP exist, to ensure that all of the glyphs in the font are working from the same set of measurements.


#5

Sorry,I made a mistake, the font name is “Source Han Sans”. And Many thanks for the reply.