summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/mkxl/scrp-ini.mkxl
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkxl/scrp-ini.mkxl')
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/scrp-ini.mkxl111
1 files changed, 111 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkxl/scrp-ini.mkxl b/Master/texmf-dist/tex/context/base/mkxl/scrp-ini.mkxl
new file mode 100644
index 00000000000..77412738b4d
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/mkxl/scrp-ini.mkxl
@@ -0,0 +1,111 @@
+%D \module
+%D [ file=scrp-ini,
+%D version=2009.02.06,
+%D title=\CONTEXT\ Script Macros,
+%D subtitle=Initialization,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D The script handler has been upgraded mid June 2020 so there might be issues as I
+%D didn't test everything (yet). It should all be a bit more efficient now in
+%D \LUAMETATEX, although not spectacular. We use no attributes in \LUAMETATEX\ and
+%D only one in \LUATEX\ now.
+%D
+%D A glyph can have (an dget) all kind of properties. Except from the state, these
+%D are assigned within \TEX's grouping model!
+%D
+%D \startitemize
+%D \startitem font \stopitem
+%D \startitem character \stopitem
+%D \startitem language (4 properties packed in an unsigned integer) \stopitem
+%D \startitem data (used for dynamics) \stopitem
+%D \startitem script (used for special script processing) \stopitem
+%D \startitem state (used for analyzing, related to font features) \stopitem
+%D \stopitemize
+%D
+%D Additional properties are set via node list handlers. The state is stored in the
+%D glyph, but additional properties are stored in a node's property table. In the
+%D future the state might get used for something else, in which case we will stire
+%D the state in the property table too. On the other hand, we can now (if we want)
+%D influence the state at the\TEX\ end (not that we do that yet).
+
+%D Todo: as in bidi mode we need a way to globally keep the setting.
+
+\registerctxluafile{scrp-ini}{}
+\registerctxluafile{scrp-cjk}{}
+\registerctxluafile{scrp-eth}{}
+\registerctxluafile{scrp-tha}{}
+\registerctxluafile{scrp-tib}{}
+
+\definesystemattribute[script][public,pickup]
+
+%D Since scripts need specific \LUA\ code we use hard coded attribute values, but we
+%D might have more tricks at some time, so we use a proper define macro too.
+
+\unprotect
+
+\installcorenamespace{script}
+
+\installcommandhandler \??script {script} \??script
+
+\aliased\let\setupscripts\setupscript % be nice
+
+% presets are global and are currently defined in lua
+
+% \appendtoks
+% \setuevalue\currentscript{\setscript[\currentscript]}%
+% \to \everydefinescript
+
+\permanent\protected\def\setlocalscript[#1]%
+ {\edef\currentscript{#1}%
+ \clf_setscript{\currentscript}{\scriptparameter\c!method}{\scriptparameter\c!preset}}
+
+\permanent\protected\def\setglobalscript[#1]%
+ {\setlocalscript[#1]%
+ \pickupscriptattribute} % pagebuilder
+
+\aliased\let\setscript\setlocalscript
+
+\permanent\protected\def\resetscript
+ {\clf_resetscript}
+
+\permanent\protected\def\startscript[#1]%
+ {\begingroup
+ \setlocalscript[#1]}
+
+\permanent\protected\def\stopscript
+ {\endgroup}
+
+% \setscript[hangul] \startscript[hangul]
+
+\definescript [hangul] [\c!method=hangul]
+\definescript [hanzi] [\c!method=hanzi]
+\definescript [nihongo] [\c!method=nihongo]
+\definescript [ethiopic] [\c!method=ethiopic]
+\definescript [thai] [\c!method=thai]
+\definescript [tibetan] [\c!method=tibetan]
+
+\definescript [latin] [\c!method=] % resets the attribute (also currentscript)
+
+\definescript [test] [\c!method=test]
+
+% a new trick (at some point we will predefine more scripts and consider a link with the above)
+
+\appendtoks
+ \ifempty\currentscript
+ \doifelse{\scriptparameter\s!features}\v!auto\enableautofontscript\disableautofontscript
+ \fi
+\to \everysetupscript
+
+\permanent\protected\def\enableautofontscript {\clf_enableautofontscript } % can be public implementor
+\permanent\protected\def\disableautofontscript{\clf_disableautofontscript} % can be public implementor
+
+\definefontfeature[latn][script=latn]
+\definefontfeature[grek][script=grek]
+
+\protect \endinput