emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Pixel table alignment (was: [BUG] [ox-odt] ODT export Chinese/Han script


From: Ihor Radchenko
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

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>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]