Dear Wolfgang,

thank you for your valuable remarks. I integrated them, see corrected attached example.

Yes, correct layout examples exist. They're all showing vertical writing, but the rules and principles are exactly the same for horizontal writing.

In my previous mail, I wrote wrong amounts of lines. They should be 46 lines on one page, while the actual example doesn't show the 46th line.

It would be important to identify the reason why only 24 characters are used to create a line when 25 could be used. Then we can develop a method to turn that mechanism off or circumvent it.
Quotation from https://www.w3.org/TR/jlreq:
In principle, when composing a line with ideographic (cl-19), hiragana (cl-15) and katakana (cl-16) characters, no extra spacing appears between their character frame. This is called solid setting (see Figure 5).

I made manual corrections to scrp-cjk.lua, but with no effect to the ConTeXt output of my example. Do I have to recompile ConTeXt first?

Emanuel

On März 1 2024, at 2:59 pm, Wolfgang Schuster <wolfgang.schuster.lists@gmail.com> wrote:
Emanuel Han via ntg-context schrieb am 01.03.2024 um 13:08:
> Dear all, thanks for your contributions.
>
> Sure I'll update the
> https://wiki.contextgarden.net/Chinese_Japanese_and_Korean hopefully
> with the help of Jeong Dal and others as soon as things are sorted out.
>
> In attached example, the opening Brackets (I marked them with
> \color[red]{【} and \color[red]{{}) are taking the previous character
> with them to the next line. Please remove these to see that the
> previous character would stay on the previous line. Thanks Wolfgang
> for checking wether this is a bug.

Can you stick to fonts which are available for all systems (e.g. Noto
CJK) because system fonts are a pain when you're on a different system.

The missing line break before 【 is caused by a wrong table entry in
scrp-cjk.lua and I guess the following change is necessary

local japanese_2 = {
    jamo_initial     = korean_break,
    korean           = stretch_break,
    chinese          = stretch_break,
    hiragana         = stretch_break,
    katakana         = stretch_break,
    half_width_open  = nobreak_stretch_break_autoshrink,
    half_width_close = nobreak_stretch,
-   full_width_open  = nobreak_stretch_break_shrink,
+   full_width_open  = stretch_break,
    full_width_close = nobreak_stretch,
    full_width_punct = japanese_before_full_width_punct, --
nobreak_stretch,
    hyphen           = nobreak_stretch,
    non_starter      = nobreak_stretch,
    other            = stretch_break,
}

but there can be more wrong entries.

> I was not successful in figuring out how the protrusion mechanism can
> be set in order to keep full stops and commas on the previous line
> (protruding the column box). Could you please give me a hint,
> Wolfgang? Thanks. There's a \color[red]{。} in my example which should
> not jump to the next line.

Adding the first and last line to your example document worked for me.

\definefontfeature [default] [default] [protrusion=pure]

\definefontfamily [...] [...] [...]

\setupbodyfont [...]

\setupalign [hanging]

> My example follows the Kihon-hanmen dimensioning as described in
> https://www.w3.org/TR/jlreq . What could be the reason that lines
> which could hold 25 characters are having only 24 characters, for
> example lines 2, 3 or 13 in column 1? I would expect them to have 25
> characters, the same as for example lines 7, 9 or 16 in column 1.

I guess the par builder is responsible for this when it arranges the
paragraph but this is just a guess.

> How can I change alignment of the lines so that the highest character
> boxes align with the top border of the layout boxes for text and
> header and with the bottom border of the layout box for footer? I hope
> that when this is achieved for the layout box for text, then this box
> would hold the expected 45 lines, and not 44 lines as it is doing now.
> Ruby characters in the first line should protrude the box, what they
> already do.
> I tried to implement the 1em hskip of the header and footer away from
> the page border. While it works for left aligned headers and footers,
> it doesn't for the right aligned headers and footers (negative hskip
> has no effect). How to solve this problem?

Do you a proper example of the layout?

Setting a few values is not enough because TeX doesn't work the way you
need for your layout. Things can be improved but in cases like header
and footer you have to tell ConTeXt there are no characters with depth.

> Also how to get rid of the first empty page?

To load a math font from a typescript you have to use the
\definetypeface command, replace the line

    \definefontfamily [JapaneseFont] [mm] [math] [lucidaot] [default]

with

    \definetypeface [JapaneseFont] [mm] [math] [lucidaot] [default]

and the page disappears.

Wolfgang