Gerben Wierda via ntg-context schrieb am 30.04.2023 um 10:48:
On 30 Apr 2023, at 10:04, Wolfgang Schuster via ntg-context <ntg-context@ntg.nl> wrote:

%%%% begin example
\definefontfamily [noto-jp] [rm] [Noto Serif CJK JP]
\definefontfamily [noto-jp] [ss] [Noto Sans CJK JP]
\definetypeface   [noto-jp] [mm] [math] [pagella] [default]

\setupbodyfont [noto-jp]

\mainlanguage [ja]

\setscript [nihongo]

Thank you.

How do I change that in my setup?

My setup is creating the same stuff in different languages from XML input (LMTX using lua and METAPOST), which means I need to adapt the following setup (cyrillic and greek shown as the other languages with different character sets I use)

\startmode[JA]
\setuplanguage[ja][patterns={ja}]\mainlanguage[ja]
\stopmode

When your document prints only text in a single language change the setup above to

    \startmode [JA]
        \setscript [nihongo]
        \mainlanguage [ja]
    \stopmode

but for documents which use multiple script/languages at the same time replace the previous setup with

    \startsetups [japanese]
        \setscript [nihongo]
    \stopsetups

    \setuplanguage [ja] [setups=japanese]

and add \language[ja] before japanese text to ensure linebreaking is enabled.

Wolfgang