From: Ihor Radchenko <yantar92@posteo.net>
To: Cantoraz Chou <cantoraz@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Pixel table alignment (was: [BUG] [ox-odt] ODT export Chinese/Han script inserts unexpected spaces in each consecutive line)
Date: Sat, 14 Jan 2023 14:00:13 +0000 [thread overview]
Message-ID: <87h6wtz05u.fsf@localhost> (raw)
In-Reply-To: <CAJg5Zf04PPHdkSiXx9x9dOBAFE3dL0Ge8YANDz==cwde_H-uoQ@mail.gmail.com>
Cantoraz Chou <cantoraz@gmail.com> writes:
> With `pangu-spacing' package installed, set
> `pangu-spacing-real-insert-separtor' to nil. A well-chosen monospaced
> font are also used to ensure one CJK character is alignment with two
> Alphanumerics.
>
> Think of following table:
>
> #+begin_src org
> | Alphanumeric | Ideograph | Symbol | Mixed |
> |--------------+-----------+----------------------+--------------------------|
> | ABC αβγ 123 | 一二三四 | ,。、?!;:“”/‘’ | 1一B二c三α四 |
> | ABC αβγ 123 | 一二三四 | ,。、?!;:“”/‘’ | A一/二“三”四 |
> | ABC αβγ 123 | 一二三四 | ◉○🞛◇✿❀⚛✸ | ◉一○二🞛三◇四✿❀⚛✸ |
> | ABC αβγ 123 | 一二三四 | ▶▷✶⬢⬡☀☼ | ▶▷✶⬢⬡☀☼ |
> #+end_src
>
> The right border of `Mixed' column isn't aligned, because
> `pangu-spacing' insert a space between Chinese and English in an
> overlay. (Actual display result as follows)
>
> #+begin_example
> | Alphanumeric | Ideograph | Symbol | Mixed |
> |--------------+-----------+----------------------+--------------------------|
> | ABC αβγ 123 | 一二三四 | ,。、?!;:“”/‘’ | 1 一 B 二 c 三α四 |
> | ABC αβγ 123 | 一二三四 | ,。、?!;:“”/‘’ | A 一/二“三”四 |
> | ABC αβγ 123 | 一二三四 | ◉○🞛◇✿❀⚛✸ | ◉一○二🞛三◇四✿❀⚛✸ |
> | ABC αβγ 123 | 一二三四 | ▶▷✶⬢⬡☀☼ | ▶▷✶⬢⬡☀☼ |
> #+end_example
>
> And, if I move the point vertically by Up/Down key in `Symbol' or
> `Mixed' column, the point shifts left or right. This has nothing to do
> with `pangu-spacing', but probably because some symbols have variable
> width in a font.
>
> Usually, I'm not sure if these problems can be called bugs, or which
> extensions are responsible of them. Fortunately, these problems are
> non-fatal and tolerable generally.
This is not a bug, rather deficiency of Org's table alignment code.
The current code only takes into account the number of symbols, but not
their actual width in pixels.
The current approach reasonably good for actual plain text alignment,
but we can indeed do better wrt how tables are displayed in Emacs.
There is an existing package that implements this feature:
https://github.com/casouri/valign
Nobody proposed an equivalent patch for Org so far.
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
prev parent reply other threads:[~2023-01-14 14:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-12 3:49 [BUG] [ox-odt] ODT export Chinese/Han script inserts unexpected spaces in each consecutive line Cantoraz Chou
2023-01-13 8:20 ` Ihor Radchenko
2023-01-14 13:44 ` Cantoraz Chou
2023-01-14 13:54 ` Timestamp format during export (was: [BUG] [ox-odt] ODT export Chinese/Han script inserts unexpected spaces in each consecutive line) Ihor Radchenko
2023-01-14 14:00 ` Ihor Radchenko [this message]
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=87h6wtz05u.fsf@localhost \
--to=yantar92@posteo.net \
--cc=cantoraz@gmail.com \
--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).