Thanks for such a detailed response.

Start by reading the large commentary at the beginning of xdisp.c,
which providers a general overview of the display engine and its basic
structure and algorithms.  After you digest that, we'd need to talk
about the details, because they are non-trivial.  Let me show you the
tip of the iceberg (and it could be that what I say below won't make
sense until you read that commentary).

I have read the full commentary and have understood it somewhat, but at least I can understand what you have written later.
Maybe while writing the implementation it will make more sense.

Then there will be issues with scrolling: do we swap horizontal and
vertical scrolling for vertical-layout text, or do we keep the scroll
direction (in which case we need to decide what it means to scroll up
or down)?

I think we should swap horizontal and vertical scrolling.
For a reference see this website: wikibilig.mn/

AFAIU, some vertical scripts are written in rows left-to-right and
some right-to-left, so you actually have 2 different layouts on your
hands.

Scripts like Mongolian are written only in one direction: ltr, but CJK characters are bidirectional i.e.
they can either be written from ltr or from rtl .How should we support that?

This is an even tougher issue.  Is support for such mixed scripts a
necessity without which the entire feature won't make sense?  If not,
I'd suggest to limit yourself to either vertical or horizontal layout,
leaving the mix of the two unsupported for starters.  If mixing them
is a must, everything I said above needs to be rethought, and it could
even be that the current design of the display engine simply cannot be
extended to support that.

Yeah, I should not mix them.

Do vertical-layout scripts require complex text shaping
(a.k.a. "character composition")?  If so, does HarfBuzz support such
scripts and their corresponding fonts?  I don't know.  We may need a
different shaping engine (if one exists).

Yes they require complex text shaping and Harfbuzz supports it.
I even had a Mongolian patch ready but accidently deleted my emacs source directory. :(

Also how would I test the new changes I would make in xdisp.c?

Thanks.

On Fri, Jun 17, 2022 at 4:18 AM Richard Stallman <rms@gnu.org> wrote:
[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > Wouldn't it be better to support vertical text in Emacs,

In a world in which we had an infinite supply of very good programmers
working on Emacs, it would be better to support vertical text.

But in the actual world, we need to ask whether it is worth the cost,
and whether some other feature would be more worth while.

--
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)