stathissideris / ditaa

ditaa is a small command-line utility that can convert diagrams drawn using ascii art ('drawings' that contain characters that resemble lines like | / - ), into proper bitmap graphics.
GNU Lesser General Public License v3.0
930 stars 87 forks source link

A possible solution to CJK fonts nightmare. #34

Open jerry73204 opened 6 years ago

jerry73204 commented 6 years ago

I got an headache on aligning diagrams with the CJK fonts. For example,

+-------------------+                                +------------+
| {d}               |                                | {d}        |
| /etc/renderd.conf |                                | httpd.conf |
| 區塊快取設定檔           |                                | 伺服器設定檔     |
+-------------------+                                +------------+

Even if the mono fonts, like Noto Sans Mono CJK, is setup in editor, the CJK character width takes 1.5 or 2 times the width of latin character's, depending on the font setting and editor, which breaks the alignments of diagrams.

I consider a solution shown below. By introducing the labels inside the diagram, we can define the text which the label is replaced with. Note this shows only the concept and the syntax needs not to be strictly followed.

+-------------------+                                +------------+
| {d}               |                                | {d}        |
| /etc/renderd.conf |                                | httpd.conf |
| {{aaa}}           |                                | {{bbb}}    |
+-------------------+                                +------------+

aaa=區塊快取設定檔
bbb=伺服器設定檔
dakusui commented 5 years ago

This is not only useful to handle CJK (or any other languages whose characters occupy wider or narrower spaces than conventional ascii's) but also for LaTeX supporting feature.

Please assign this ticket to me. I have designed LaTeX mat feature in a way where this issue can easily be fixed.