On 7/9/2018 8:57 AM, Wolfgang Schuster wrote:

Hans Hagen <mailto:j.ha...@xs4all.nl>
8. Juli 2018 um 23:02

it needs a bit of thinking (even bidi) ... it compares to global and local bodyfonts

what if a page break occurs in the middle of japanese local text while the global script is chinese

I can understand your concerns.

Another way is to add additional commands which let you set the script for all environments (body text + footnotes).


1. Add "global" to the attribute definition (or add another keyword which doesn’t add the reset to the local token list but using "global" should be enough).

%%%%%% attr-ini.mkiv
\def\attr_basics_define_indeed#1[#2][#3]%
   {\ifcsname\??attributecount#2\endcsname\else
      \scratchcounter\clf_defineattribute{#2}{#1}\relax
    %\writestatus\m!system{defining #1 attribute #2 with number \number\scratchcounter}%
\expandafter\attributedef\csname\??attributecount#2\endcsname\scratchcounter
      \expandafter\newconstant \csname\??attributeid#2\endcsname
      \csname\??attributeid#2\endcsname\scratchcounter
      % some attributes are always global
      \doifelseinset\s!global{#3}%
{\etoksapp\t_attr_list_global{\csname\??attributecount#2\endcsname\attributeunsetvalue}}%
-      {\etoksapp\t_attr_list_local {\csname\??attributecount#2\endcsname\attributeunsetvalue}}%
+      {\doifnotinset\s!none{#3}
+         {\etoksapp\t_attr_list_local {\csname\??attributecount#2\endcsname\attributeunsetvalue}}}%
      \doifinset\s!nomath{#3}%
{\etoksapp\t_attr_list_nomath{\csname\??attributecount#2\endcsname\attributeunsetvalue}}%
     % here public means 'visible' so it's not to be confused with 'public' at the lua end
      \doifinset\s!public{#3}%
{\expandafter\let\csname#2\s!attribute\expandafter\endcsname\csname\??attributeid#2\endcsname}%
    \fi}
%%%%%%



2. Create a flag which can be used to prevent the reset of the attributes when you use the global-commands. The old \setscript command will be a synonym for the local settings while you can use the global command when the document contains only one language.

%%%%%% scrp-ini.mkiv
\newconditional\c_scripts_reset \settrue\c_scripts_reset

\appendtoks
     \ifconditional\c_scripts_reset
         \doresetattribute{scriptinjection}%
         \doresetattribute{scriptsplitting}%
         \doresetattribute{scriptstatus}%
     \fi
\to \t_attr_list_local

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

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

\let\setscript\setlocalscript

\unexpanded\def\setglobalscript[#1]%
   {\setfalse\c_scripts_reset
    \edef\currentscript{#1}%
    \scripts_basics_set}
%%%%%%
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




-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
       tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
_______________________________________________
dev-context mailing list
dev-context@ntg.nl
https://mailman.ntg.nl/mailman/listinfo/dev-context

Reply via email to