Hello org mode users!
I recently looked into getting org mode tables to properly align cell borders
and table border, when using Chinese characters in them.
I found out, that there is valign mode [1] and was happy with it for a few days.
But then I opened a document with lots of tables and some of those tables bigger
than what I had before in other documents. Scrolling inside that document became
quite laggy. So teeth-gnashingly I deactivated valign mode, already suspecting
it to be the culprit. And I was right. After deactivating it, I could scroll
perfectly fine again.
So I returned to the second alternative I had found out about, when searching
for a solution: Finding a font, which renders Chinese characters at exactly
double the width of latin/ASCII characters. I found a font named "Sarasa" [2]
and experimented a bit with setting the font globally, then setting it only when
opening an org mode buffer. Now it looks like that font does character widths
almost correctly (see attached screenshot, see slightly wider 4 ASCII characters
than 2 Chinese characters).
My settings for org mode regarding fonts/faces are:
~~~~
(add-hook 'org-mode-hook
(function
(lambda ()
;; Only do the following in graphical mode, as it will
;; break when using emacs in terminal mode.
(when (display-graphic-p)
;; Sarasa font is fromhttps://github.com/be5invis/Sarasa-Gothic.
(setq buffer-face-mode-face
'(:family "Sarasa Mono CL"
:weight normal
:height 110))
(buffer-face-mode)))))
~~~~
However, it seems, that now org mode does not align tables correctly, even
though an ASCII character is half the width of a Chinese character in the
tables. Org mode seems to add too few or too many spaces, which are displayed as
spaces of various width.—Is that because of the 1 pixel width difference?
Do I need to look for another font, which does things truly exactly, no 1 pixel
too wide funny business? Maybe someone knows a more exact font?
Ultimately: How can I make tables align correctly?
My Emacs version is: GNU Emacs 28.2
My org mode version is: 9.6.1
[1]: https://github.com/casouri/valign
[2]: https://github.com/be5invis/Sarasa-Gothic
--
repositories:https://notabug.org/ZelphirKaltstahl