vkocubinsky / SublimeTableEditor

This package is no more supported. I moved to vim.
Other
494 stars 67 forks source link

chinese character (utf-8) width calculate bug #36

Open guoxiangyang opened 10 years ago

guoxiangyang commented 10 years ago

Table contain chinese character (utf-8) massed up.

english is ok:

1.1 1.2 1.3 1.4
2.1 2.2 2.3 2.4
----- ----- ----- -----
3.1 3.2 3.3 3.4

chinese massed up:

1.1汉字 1.2中文 1.3 中文 1.4
2.1 中文2.2 2.3 2.4
--------- --------- ---------- -----
3.1 3.2 3.3中文 3.4
guoxiangyang commented 10 years ago

gitup make the massed up table look good with html table. but in text mode it's doen't.

vkocubinsky commented 10 years ago

Thanks for feedback. Which font, operation system, version sublime did you use? By default on windows and mac os (did not check linux) sublime use not monospaced font for chinese. Please try NSimSun,FangSong,SimHei. Some users said me that table editor works with these fonts. I tested table editor with CJK characters some time ago, it worked correct. I will check a bit later your example.

guoxiangyang commented 10 years ago

thankx for response.

I've got this problem done. It's the font settings problem. everything goes fine after I change the font to a fixed width font.

I've hack the code, it's works fine.

But another problem still there. If I put the table into an markdown document and enable the markdown mode. table goes massed up. It seem markdown change the font.

guoxiangyang commented 10 years ago

BTW, my enviroment is MAC OSX & ST3

guoxiangyang commented 10 years ago
original text: a中文 b中文 c d aa bb c中文c dd

markdown mode image

plan text mode image

vkocubinsky commented 10 years ago

Markdown change the font if you have syntax specific settings. For check this click Preferences -> Settings - More -> Syntax Specific - User.

Also I found character(it looks as space in sublime, but it is not space) from your first example which handled incorrect by sublime table editor. I know the reason and I guess I know the fix. I will fix this only for ST3, because unicodedata python module doesn't exists under windows platform on ST2.

ZelphirKaltstahl commented 8 years ago

Really looking forward to this issue getting solved. I know there is an Atom package doing this properly. Let me check which one I have installed, so that it might help you in implementing it ... markdown-table-formattter it is called. Maybe you can find anything useful in their code?

vkocubinsky commented 8 years ago

Hi, actually I don't support SublimeTableEditor package, I have not even installed Sublime Editor. But you can fork repository if you need.

Thanks!