From: Zelphir Kaltstahl <zelphirkaltstahl@posteo.de>
To: emacs-orgmode@gnu.org
Subject: Re: org mode table alignment issue with CJK characters
Date: Sat, 25 Mar 2023 12:56:43 +0000 [thread overview]
Message-ID: <a9dec179-6981-7252-73b1-0abaaf4d25f3@posteo.de> (raw)
In-Reply-To: <66e9f2d3-5f7c-e925-a0e3-832d081b4365@posteo.de>
[-- Attachment #1.1: Type: text/plain, Size: 2857 bytes --]
On 3/23/23 15:44, Zelphir Kaltstahl wrote:
>
> 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
>
I have tried something else today:
I looked at how the font is rendered in Libre Office. There it seems, that the
characters align perfectly (see attached screenshot). So maybe this is an Emacs
in general issue of font rendering, which adds a pixel to ASCII characters or
takes one away from CJK characters?
--
repositories:https://notabug.org/ZelphirKaltstahl
[-- Attachment #1.2: Type: text/html, Size: 3987 bytes --]
[-- Attachment #2: libre-office-font-rendering.png --]
[-- Type: image/png, Size: 13183 bytes --]
[-- Attachment #3: emacs-font-rendering-2.png --]
[-- Type: image/png, Size: 24394 bytes --]
next prev parent reply other threads:[~2023-03-25 12:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-23 14:44 org mode table alignment issue with CJK characters Zelphir Kaltstahl
2023-03-25 12:56 ` Zelphir Kaltstahl [this message]
2023-03-25 17:55 ` Ihor Radchenko
2023-03-25 18:27 ` Zelphir Kaltstahl
2023-03-25 19:01 ` Ihor Radchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a9dec179-6981-7252-73b1-0abaaf4d25f3@posteo.de \
--to=zelphirkaltstahl@posteo.de \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).