Hans Hagen
9. Juli 2018 um 15:01

how about this (a bit like languages and bodyfonts)

\unprotect

\newconstant\c_scripts_injection \c_scripts_injection\attributeunsetvalue
\newconstant\c_scripts_splitting \c_scripts_splitting\attributeunsetvalue
\newconstant\c_scripts_status    \c_scripts_status   \attributeunsetvalue

\unexpanded\def\setglobalscript[#1]%
  {\edef\currentscript{#1}%
   \scripts_basics_set
   \c_scripts_injection\attribute\scriptinjectionattribute
   \c_scripts_splitting\attribute\scriptsplittingattribute
   \c_scripts_status   \attribute\scriptstatusattribute}

\unexpanded\def\setlocalscript[#1]%
  {\edef\currentscript{#1}%
   \scripts_basics_set}

\let\setscript\setlocalscript

\appendtoks
   \attribute\scriptinjectionattribute\c_scripts_injection
   \attribute\scriptsplittingattribute\c_scripts_splitting
   \attribute\scriptstatusattribute   \c_scripts_status
\to \everypagebody

\protect

It works only when I use a different token list, e.g.

\appendtoks
   ...
\to \t_attr_list_local

Here is the missing example.

\definefontfamily [meiryo] [rm] [Meiryo]

\setupbodyfont[meiryo]

\setlocalscript[nihongo]
%\setglobalscript[nihongo]

\setuplayout[leftmargin=6cm,backspace=7cm,width=middle]

\starttext

\startbuffer[udhr]
All human beings are born free and equal in dignity and rights. They are endowed with reason and conscience and should act towards one another in a spirit of brotherhood.

すべての人間は、生まれながらにして自由であり、かつ、尊厳と権利とについて平等である。人間は、理性と良心とを授けられており、互いに同胞の精神をもっ て行動しなければならない。
\stopbuffer

\getbuffer[udhr]

Footnote
\startfootnote
\getbuffer[udhr]
\stopfootnote

Margintext\inmargin[style=smallbodyfont]{\getbuffer[udhr]}

\stoptext

Wolfgang