Dear Otared,

when you read the lua code in the first \directlua{}, you should realize that the dimensions of almost all layout elements are depending on the value of my lua variable "paperSize".
Thanks to defining the paper size first in lua, I can apply calculations of numeric values.

The value of paperSize is later passed on to \setuppapersize via \setuppapersize[\directlua{tex.print(paperSize)}]

Emanuel
On März 13 2024, at 3:55 pm, Otared Kavian <otared@gmail.com> wrote:
Hi Emmanuel,

Thank you so much for the new setup for writing Japanese: I tested with both files, and noticed that with the new version the output looks great.

I have a question about the code in the \directlua{} part of your setup: why, for instance, the
paperSize = « B5"
is defined « by hand » there, instead of being retrieved from the command
\setuppapersize[B5]
issued by the user?

Actually I am using your setup for learning Japanese, and at my beginner’s level I do separate words I am learning with spaces. While with the previous version of your setup the lines were breaking womewhat strangely, but now the spaces between words in the output are as I intended them to be (I should also Thank Wolfgang Schuster for his insight with the \script[nihongo], and indeed Hans for fixing so quickly the slightest bug).

It is really a great pleasure to be in this community where help comes from everyone and features are given on demand !

Best regards: Otared

> On 10 Mar 2024, at 17:43, Emanuel Han via ntg-context <ntg-context@ntg.nl> wrote:
>
> Hi all,
>
> I added https://wiki.contextgarden.net/Chinese_Japanese_and_Korean#Meeting_the_JIS_X_4051_Requirements_for_Japanese_Text_Layout
> with attached working example code and to-do list.
>
> Thanks for any contributions!
>
> The working example code is still a work in progress. Its text layout output meets already some of the requirements (see comments in the code). Among the ones to still be implemented are:
>
> • solid setting (no extra spacing between characters) https://www.w3.org/TR/jlreq/#fig1_8 if no requirement for line-adjustment https://www.w3.org/TR/jlreq/#term.line-adjustment
> • aligning of the lines to the Kihon-hanmen (optimizing the code below in this regard)
> • positioning and realm of headings https://www.w3.org/TR/jlreq/#fig3_1_9 https://www.w3.org/TR/jlreq/#fig3_1_15 et al, and https://www.w3.org/TR/jlreq/#fig3_1_4
> • positioning of yokugo-ruby https://www.w3.org/TR/jlreq/#fig2_3_24
> • inline cutting note (warichu) https://www.w3.org/TR/jlreq/#fig2_4_1
> • emphasis with sesame dot or bullet
> • itemization https://www.w3.org/TR/jlreq/#fig2_5_6
> • indenting of quotation paragraphs https://www.w3.org/TR/jlreq/#fig2_5_7
> • tab setting https://www.w3.org/TR/jlreq/#fig2_6_1
> • furiwake https://www.w3.org/TR/jlreq/#fig2_7_2
> • jidori https://www.w3.org/TR/jlreq/#fig2_7_4
> • math https://www.w3.org/TR/jlreq/#fig2_7_6 and https://www.w3.org/TR/jlreq/#fig2_7_62
> • tategaki (writing vertically)
> Best regards
>
> Emanuel
> On März 2 2024, at 7:00 pm, Wolfgang Schuster <wolfgang.schuster.lists@gmail.com> wrote:
> Emanuel Han schrieb am 01.03.2024 um 16:23:
>
> 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.
>
> • position of the headers and footers: https://www.w3.org/TR/jlreq/#fig1_30
>
> See my attached gongitsune.tex example how you can squeeze text in a very narrow header/footer.
>
> • aligning lines to the text box: https://www.w3.org/TR/jlreq/#fig1_3
>
> You can use the lines key for \setuplayout to let ConTeXt calculate the necessary value for the text height.
>
> • protrusion of ruby: https://www.w3.org/TR/jlreq/#fig_ad1_6
>
> You're getting this for free because ruby text doesn't take up vertical space, in case vertical text is working it would now stick into the margins as expected.
>
> \starttext
> \ruledhbox{a \ruby{x}{y} b}
> \stoptext
>
>
>
> 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).
>
> 1. ConTeXt has a mechanism to typeset Japanese texts.
>
> 2. There are flaws in the output it produces but this nothing which can't be fixed.
>
> 3. To fix the problems someone has to be passionate to fix them and we're willing to help here.
>
> As you can see in my second example file japanese.tex there is a font feature to create half sized parentheses etc. which isn't supported yet by ConTeXt's mechanism for japanese and in case your willing to improve it this should be taken care of as well.
>
> Wolfgang
> <japanese_mwe.tex>___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
>
> maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive : https://github.com/contextgarden/context
> wiki : https://wiki.contextgarden.net
> ___________________________________________________________________________________

Otared Kavian
e-mail: otared@gmail.com
Phone: +33 6 88 26 70 95




___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________