diff options
Diffstat (limited to 'tex')
54 files changed, 1817 insertions, 681 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index f0f145664..2af36d356 100644 --- a/tex/context/base/mkii/cont-new.mkii +++ b/tex/context/base/mkii/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2021.01.24 16:02} +\newcontextversion{2021.01.26 18:02} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/mkii/context.mkii b/tex/context/base/mkii/context.mkii index 9c05fd446..dbdc83d4c 100644 --- a/tex/context/base/mkii/context.mkii +++ b/tex/context/base/mkii/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2021.01.24 16:02} +\edef\contextversion{2021.01.26 18:02} %D For those who want to use this: diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 27b0a995e..eb9380033 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2021.01.24 16:02} +\newcontextversion{2021.01.26 18:02} %D This file is loaded at runtime, thereby providing an excellent place for hacks, %D patches, extensions and new features. There can be local overloads in cont-loc diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index c6ba8b009..372a1c29b 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -45,7 +45,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2021.01.24 16:02} +\edef\contextversion{2021.01.26 18:02} %D Kind of special: diff --git a/tex/context/base/mkiv/font-run.mkiv b/tex/context/base/mkiv/font-run.mkiv index 2f6cd32df..6bfa7ee72 100644 --- a/tex/context/base/mkiv/font-run.mkiv +++ b/tex/context/base/mkiv/font-run.mkiv @@ -350,7 +350,7 @@ \ifdefined\databox \else \newbox\databox \fi -\unexpanded\gdef\testminimalbaseline#1% to be used in a 10 column tabulate +\unexpanded\gdef\font_show_minimal_baseline#1% to be used in a 10 column tabulate {\setbox\databox\ruledhbox{#1}% \scratchdimen\htdp\databox \normalexpanded { @@ -374,18 +374,14 @@ \font_show_only_english\showminimalbaseline \else \starttabulate[|l|T|T|T|T|T|T|T|T|T|] - \testminimalbaseline{\hbox to \emwidth{\hss\showstruts\strut\hss}}% - \testminimalbaseline{(/)}% - \testminimalbaseline{\normalstartimath\frac{1}{2}x\normalsuperscript2\normalsubscript3\normalstopimath} + \font_show_minimal_baseline{\hbox to \emwidth{\hss\showstruts\strut\hss}}% + \font_show_minimal_baseline{(/)}% + \font_show_minimal_baseline{\normalstartimath\frac{1}{2}x\normalsuperscript2\normalsubscript3\normalstopimath} \stoptabulate \fi} -\unexpanded\gdef\showkerning#1% - {\bgroup - \let\MPfshowcommand\ruledhbox - \setMPtext\s!dummy{#1}% - \startMPcode draw textext(\MPstring\s!dummy);\stopMPcode - \egroup} +\unexpanded\gdef\showkerning + {\groupedcommandcs\showfontkerns\relax} \unexpanded\gdef\showcharratio {\dowithnextboxcontent diff --git a/tex/context/base/mkiv/page-otr.lua b/tex/context/base/mkiv/page-otr.lua index 307158684..c87f419b4 100644 --- a/tex/context/base/mkiv/page-otr.lua +++ b/tex/context/base/mkiv/page-otr.lua @@ -7,6 +7,6 @@ if not modules then modules = { } end modules ['page-otr'] = { } interfaces.implement { - name = "triggerpagebuilder", - actions = tex.triggerbuildpage, + name = "triggerpagebuilder", + actions = tex.triggerbuildpage, } diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex 43ce46887..fa71c74b4 100644 --- a/tex/context/base/mkiv/status-files.pdf +++ b/tex/context/base/mkiv/status-files.pdf diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf Binary files differindex 24aadd25d..7bae75b95 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkiv/tabl-tbl.mkiv b/tex/context/base/mkiv/tabl-tbl.mkiv index ce8d67b63..2ed104adf 100644 --- a/tex/context/base/mkiv/tabl-tbl.mkiv +++ b/tex/context/base/mkiv/tabl-tbl.mkiv @@ -224,6 +224,9 @@ \newconstant \c_tabl_tabulate_localcolorspan \newconstant \c_tabl_tabulate_modus +%newconditional \c_tabl_pre_is_set +\newconditional \c_tabl_post_is_set + \let\tabulatesplitlinemode\c_tabl_tabulate_splitlinemode % temp hack, we need an interface \let \m_tabl_tabulate_separator_factor \empty % fraction @@ -424,9 +427,9 @@ \fi\fi} % \unexpanded % we can expand this one -\def\tabl_tabulate_inject_post_skip#1% +\def\tabl_tabulate_inject_post_skip#1#2% {\ifdim#1>\zeropoint - \kern#1\relax % was \hskip + \kern\ifnum\c_tabl_tabulate_columns=\c_tabl_tabulate_nofcolumns#2\else#1\fi\relax \else\ifnum\c_tabl_tabulate_columns=\c_tabl_tabulate_nofcolumns \ifconditional\c_tabl_tabulate_autorulespacing \ifcase\c_tabl_tabulate_has_rule_spec_last\else @@ -516,7 +519,9 @@ \egroup \aligntab \noexpand\dostoptagged - \tabl_tabulate_inject_post_skip{\the\dimexpr\s_tabl_tabulate_post}% get rid of plus + \tabl_tabulate_inject_post_skip + {\the\ifconditional\c_tabl_post_is_set\s_tabl_tabulate_post\else\s_tabl_tabulate_last\fi}% + {\the\s_tabl_tabulate_post}% \alignmark\alignmark }% \toksapp\t_tabl_tabulate_dummy{\NC}% @@ -527,7 +532,9 @@ \s_tabl_tabulate_post\zeropoint \fi %\let\gettabulateexit\dogettabulateexit % still needed ? - \d_tabl_tabulate_width\zeropoint} + \d_tabl_tabulate_width\zeropoint + %setfalse\c_tabl_pre_is_set + \setfalse\c_tabl_post_is_set} \unexpanded\def\installtabulatepreambleoption#1#2% {\setvalue{\??tabulatepreamble\string#1}{#2}}% @@ -622,17 +629,21 @@ \tabl_tabulate_set_preamble} \def\tabl_tabulate_set_preskip#1% - {\doifelsenumber{#1}% + {%settrue\c_tabl_pre_is_set + \doifelsenumber{#1}% {\s_tabl_tabulate_pre#1\d_tabl_tabulate_unit\tabl_tabulate_set_preamble }% {\s_tabl_tabulate_pre.5\d_tabl_tabulate_unit\tabl_tabulate_set_preamble#1}} \def\tabl_tabulate_set_posskip#1% - {\doifelsenumber{#1}% + {\settrue\c_tabl_post_is_set + \doifelsenumber{#1}% {\s_tabl_tabulate_post#1\d_tabl_tabulate_unit\tabl_tabulate_set_preamble }% {\s_tabl_tabulate_post.5\d_tabl_tabulate_unit\tabl_tabulate_set_preamble#1}} \def\tabl_tabulate_set_preposskip#1% - {\doifelsenumber{#1}% + {%settrue\c_tabl_pre_is_set + \settrue\c_tabl_post_is_set + \doifelsenumber{#1}% {\s_tabl_tabulate_pre#1\d_tabl_tabulate_unit\s_tabl_tabulate_post\s_tabl_tabulate_pre\tabl_tabulate_set_preamble }% {\s_tabl_tabulate_pre.5\d_tabl_tabulate_unit\s_tabl_tabulate_post\s_tabl_tabulate_pre\tabl_tabulate_set_preamble#1}} @@ -803,6 +814,8 @@ \c_tabl_tabulate_modus\zerocount \setfalse\c_tabl_tabulate_pwidth_set \setfalse\c_tabl_tabulate_reshape + %setfalse\c_tabl_pre_is_set + \setfalse\c_tabl_post_is_set \t_tabl_tabulate_before\emptytoks \t_tabl_tabulate_after\emptytoks \t_tabl_tabulate_bmath\emptytoks diff --git a/tex/context/base/mkiv/trac-deb.lua b/tex/context/base/mkiv/trac-deb.lua index a6154e5dc..07865e4bf 100644 --- a/tex/context/base/mkiv/trac-deb.lua +++ b/tex/context/base/mkiv/trac-deb.lua @@ -326,8 +326,6 @@ directives.register("system.showerror", lmx.overloaderror) -- end -- end) -local implement = interfaces.implement - implement { name = "showtrackers", actions = trackers.show } implement { name = "enabletrackers", actions = trackers.enable, arguments = "string" } implement { name = "disabletrackers", actions = trackers.disable, arguments = "string" } diff --git a/tex/context/base/mkiv/trac-deb.mkiv b/tex/context/base/mkiv/trac-deb.mkiv index fefd55142..fcbacfb9e 100644 --- a/tex/context/base/mkiv/trac-deb.mkiv +++ b/tex/context/base/mkiv/trac-deb.mkiv @@ -18,8 +18,6 @@ \unprotect -\unexpanded\def\breakpoint {\showdebuginfo\wait} - \unexpanded\def\showtrackers {\clf_showtrackers} \unexpanded\def\enabletrackers [#1]{\clf_enabletrackers{#1}} \unexpanded\def\disabletrackers [#1]{\clf_disabletrackers{#1}} @@ -33,7 +31,6 @@ \unexpanded\def\enableexperiments [#1]{\clf_enableexperiments{#1}} \unexpanded\def\disableexperiments[#1]{\clf_disableexperiments{#1}} -\unexpanded\def\showdebuginfo {\clf_showdebuginfo} \unexpanded\def\overloaderror {\clf_overloaderror} \unexpanded\def\showlogcategories {\clf_showlogcategories} diff --git a/tex/context/base/mkxl/catc-ini.mkxl b/tex/context/base/mkxl/catc-ini.mkxl index 7d23c37d8..186e6f820 100644 --- a/tex/context/base/mkxl/catc-ini.mkxl +++ b/tex/context/base/mkxl/catc-ini.mkxl @@ -39,13 +39,13 @@ %D We predefine some prefixes ahead of syst-aux and mult-sys. We reserve 8 slots for %D catcodes. (This active mess probably needs an update some day.) -\installsystemnamespace {catcodelet} % let : \let -\installsystemnamespace {catcodedef} % def : \def -\installsystemnamespace {catcodeued} % ued : \protected\def -\installsystemnamespace {catcodeget} % \meaning +\installsystemnamespace{catcodelet} % let : \let +\installsystemnamespace{catcodedef} % def : \def +\installsystemnamespace{catcodeued} % ued : \protected\def +\installsystemnamespace{catcodeget} % \meaning -\installsystemnamespace {catcodetablet} -\installsystemnamespace {catcodetablen} +\installsystemnamespace{catcodetablet} +\installsystemnamespace{catcodetablen} \newcount\c_syst_catcodes_n \c_syst_catcodes_n\zerocount % 0 = signal, so advance before allocate \newcount\c_syst_catcodes_a diff --git a/tex/context/base/mkxl/colo-grp.mkxl b/tex/context/base/mkxl/colo-grp.mkxl index 82dd67959..9237952d7 100644 --- a/tex/context/base/mkxl/colo-grp.mkxl +++ b/tex/context/base/mkxl/colo-grp.mkxl @@ -102,7 +102,7 @@ %D %D \showsetup{showcolorgroup} -\fetchruntimecommand \showcolorgroup \f!colo_run +\fetchmodulecommand \showcolorgroup \f!colo_run %D There are ten predefined color groups, like \color [green] {\em groen}, \color %D [red] {\em rood}, \color [blue] {\em blauw}, \color [cyan] {\em cyaan}, \color @@ -158,6 +158,6 @@ %D %D \showsetup{comparecolorgroup} -\fetchruntimecommand \comparecolorgroup \f!colo_run +\fetchmodulecommand \comparecolorgroup \f!colo_run \protect \endinput diff --git a/tex/context/base/mkxl/colo-ini.mkxl b/tex/context/base/mkxl/colo-ini.mkxl index cad33514b..7d2e419bc 100644 --- a/tex/context/base/mkxl/colo-ini.mkxl +++ b/tex/context/base/mkxl/colo-ini.mkxl @@ -581,7 +581,7 @@ %D %D \showsetup{showpalet} -\fetchruntimecommand \showpalet \f!colo_run +\fetchmodulecommand \showpalet \f!colo_run %D \macros %D {showcolorcomponents} @@ -590,7 +590,7 @@ %D \showcolorcomponents[color-1,color-2] %D \stoptyping -\fetchruntimecommand \showcolorcomponents \f!colo_run +\fetchmodulecommand \showcolorcomponents \f!colo_run %D \macros %D {comparepalet} @@ -613,7 +613,7 @@ %D %D \showsetup{comparepalet} -\fetchruntimecommand \comparepalet \f!colo_run +\fetchmodulecommand \comparepalet \f!colo_run %D \macros %D {showcolor} @@ -629,7 +629,7 @@ %D %D \showsetup{showcolor} -\fetchruntimecommand \showcolor \f!colo_run +\fetchmodulecommand \showcolor \f!colo_run %D It would make sense to put the following code in \type {colo-mps}, but it it %D rather low level. @@ -727,16 +727,16 @@ \letvalue{\??colorsetter -}\empty % used? \letvalue{\??transparencysetter-}\empty % used? -% new: expandable (see tbl) +% new: expandable (see tbl preamble) -\def\colo_helpers_fast_activate +\def\colo_helpers_direct_activate {\ifempty\currentcolorprefix - \expandafter\colo_helpers_fast_activate_nop + \expandafter\colo_helpers_direct_activate_nop \else - \expandafter\colo_helpers_fast_activate_yes + \expandafter\colo_helpers_direct_activate_yes \fi} -\def\colo_helpers_fast_activate_yes#1% +\def\colo_helpers_direct_activate_yes#1% {\ifcsname\??colorsetter\currentcolorprefix#1\endcsname \lastnamedcs \begincsname\??transparencysetter\currentcolorprefix#1\endcsname @@ -745,7 +745,7 @@ \begincsname\??transparencysetter#1\endcsname \fi} -\def\colo_helpers_fast_activate_nop#1% +\def\colo_helpers_direct_activate_nop#1% {\ifcsname\??colorsetter#1\endcsname \lastnamedcs \begincsname\??transparencysetter#1\endcsname @@ -755,17 +755,13 @@ {\begincsname\??colorsetter \v_colo_dummy_name\endcsname \begincsname\??transparencysetter\v_colo_dummy_name\endcsname} -\let\dofastcoloractivation\colo_helpers_fast_activate - % so far \permanent\protected\def\colo_helpers_activate#1% two-step is not that much faster but less tracing {\edef\currentcolorname{#1}% \ifempty\currentcolorprefix - %\expandafter \colo_helpers_activate_nop \else - %\expandafter \colo_helpers_activate_yes \fi} @@ -1010,11 +1006,17 @@ %D \stoptyping %D %D \stopmode +%D +%D All this will move to m-tikz.mkxl as it doesn't belong in the core. They are +%D mutable because \quote {who knows what gets redefined}. + +\mutable\let\color@ \relax +\mutable\let\xcolor@\relax -\protected\def\pgf@context@registercolor#1{\setevalue{\string\color@#1}{\noexpand\xcolor@{}{}\clf_pgfxcolorspec\zerocount\thecolorattribute{#1}}} -\protected\def\pgf@context@registergray #1{\setevalue{\string\color@#1}{\noexpand\xcolor@{}{}\clf_pgfxcolorspec\plustwo \thecolorattribute{#1}}} -\protected\def\pgf@context@registerrgb #1{\setevalue{\string\color@#1}{\noexpand\xcolor@{}{}\clf_pgfxcolorspec\plusthree\thecolorattribute{#1}}} -\protected\def\pgf@context@registercmyk #1{\setevalue{\string\color@#1}{\noexpand\xcolor@{}{}\clf_pgfxcolorspec\plusfour \thecolorattribute{#1}}} +\mutable\protected\def\pgf@context@registercolor#1{\edefcsname\string\color@#1\endcsname{\noexpand\xcolor@{}{}\clf_pgfxcolorspec\zerocount\thecolorattribute{#1}}} +\mutable\protected\def\pgf@context@registergray #1{\edefcsname\string\color@#1\endcsname{\noexpand\xcolor@{}{}\clf_pgfxcolorspec\plustwo \thecolorattribute{#1}}} +\mutable\protected\def\pgf@context@registerrgb #1{\edefcsname\string\color@#1\endcsname{\noexpand\xcolor@{}{}\clf_pgfxcolorspec\plusthree\thecolorattribute{#1}}} +\mutable\protected\def\pgf@context@registercmyk #1{\edefcsname\string\color@#1\endcsname{\noexpand\xcolor@{}{}\clf_pgfxcolorspec\plusfour \thecolorattribute{#1}}} %D \starttyping %D \ifdefined\pgf@context@registercolor diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl index ce21a1b79..9bcddeee0 100644 --- a/tex/context/base/mkxl/cont-new.mkxl +++ b/tex/context/base/mkxl/cont-new.mkxl @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2021.01.24 16:02} +\newcontextversion{2021.01.26 18:02} %D This file is loaded at runtime, thereby providing an excellent place for hacks, %D patches, extensions and new features. There can be local overloads in cont-loc diff --git a/tex/context/base/mkxl/context.mkxl b/tex/context/base/mkxl/context.mkxl index 6ca3eca99..f576a1ad8 100644 --- a/tex/context/base/mkxl/context.mkxl +++ b/tex/context/base/mkxl/context.mkxl @@ -29,7 +29,7 @@ %D {YYYY.MM.DD HH:MM} format. \immutable\edef\contextformat {\jobname} -\immutable\edef\contextversion{2021.01.24 16:02} +\immutable\edef\contextversion{2021.01.26 18:02} %overloadmode 1 % check frozen / warning %overloadmode 2 % check frozen / error @@ -539,7 +539,7 @@ % new bibtex support: \loadmkxlfile{publ-ini} -\loadmkxlfile{publ-tra} +%loadmkxlfile{publ-tra} \loadmkxlfile{publ-xml} \loadmkxlfile{publ-old} diff --git a/tex/context/base/mkxl/core-sys.mkxl b/tex/context/base/mkxl/core-sys.mkxl index 302cdaa99..e27e0734d 100644 --- a/tex/context/base/mkxl/core-sys.mkxl +++ b/tex/context/base/mkxl/core-sys.mkxl @@ -106,9 +106,9 @@ %D \NC \type{\operatingsystem} \NC \operatingsystem \NC \NR %D \stoptabulate -\appendtoks - \edef\outputresolution{\directsystemparameter\c!resolution}% -\to \everysetupsystem +% \appendtoks +% \edef\outputresolution{\directsystemparameter\c!resolution}% +% \to \everysetupsystem %D The system modes set by the setup command can be used in situations like: %D @@ -142,7 +142,7 @@ \setupsystem [\c!directory=, \c!n=0, % 0:unknown 1: one run 2: first 3: successive 4: final run - \c!resolution=600,% in dpi, no unit in mkiv + % \c!resolution=600,% in dpi, no unit in mkiv, not used in lmtx % \c!random=, % obsolete here % \c!file=\jobname, % \c!inputfile=\outputfilename, diff --git a/tex/context/base/mkxl/file-ini.mklx b/tex/context/base/mkxl/file-ini.mklx index 66d03b2f9..35a49c72d 100644 --- a/tex/context/base/mkxl/file-ini.mklx +++ b/tex/context/base/mkxl/file-ini.mklx @@ -207,7 +207,7 @@ %D This command obeys the standard method for locating files. We could move this %D function to the \LUA\ end. -\installsystemnamespace {fileonce} +\installsystemnamespace{fileonce} \permanent\protected\def\doonlyonce#whatever% {\ifcsname\??fileonce#whatever\endcsname diff --git a/tex/context/base/mkxl/file-mod.mklx b/tex/context/base/mkxl/file-mod.mklx index 2f9f13f1c..c353b8c61 100644 --- a/tex/context/base/mkxl/file-mod.mklx +++ b/tex/context/base/mkxl/file-mod.mklx @@ -177,37 +177,6 @@ % will become file-run -%D To save memory, we implement some seldomly used commands in a lazy way. Nota -%D bene: such runtime definitions are to be defined global. -%D -%D \starttyping -%D \fetchruntimecommand \showaccents \f!file_run % last is a file name -%D \stoptyping - -\installcorenamespace{runtimeloaded} - -\permanent\protected\def\fetchruntimecommand#1#2% - {\protected\def#1{\dofetchruntimecommand#1{#2}}} - -\def\dofetchruntimecommand#1#2% actually a test on #1 being define would be ok as well - {\ifcsname\??runtimeloaded#2\endcsname - % already loaded - \else - \glet#1\undefined - \startreadingfile - \startnointerference % \bgroup - \cleanupfeatures % better \setnormalcatcodes / test first - \readfile{#2.\mksuffix}\donothing\donothing - \stopnointerference % \egroup - \stopreadingfile - \letgvalue{\??runtimeloaded#2}\empty - \fi - \ifdefined#1\else - \writestatus\m!system{command \string#1 not found in file #2}% - \protected\gdef#1{{\infofont[unknown command \string#1]}}% - \fi - #1} - %D \macros %D {doifolderversionelse} %D @@ -274,4 +243,20 @@ \permanent\protected\def\installmodulecommandluaone#1#2{\enforced\permanent\protected\def#1{\normalexpanded{\syst_modules_one_lua{\csstring#1}{#2}}}} \permanent\protected\def\installmodulecommandluatwo#1#2{\enforced\permanent\protected\def#1{\normalexpanded{\syst_modules_two_lua{\csstring#1}{#2}}}} +%D This replaces \type {\fetchruntimecommand}: +%D +%D \starttyping +%D \fetchmodulecommand \csname {module} +%D \stoptyping + +\permanent\protected\def\fetchmodulecommand#1#2% + {\mutable\protected\def#1{\syst_fetch_module_command#1{#2}}} + +\def\syst_fetch_module_command#1#2% actually a test on #1 being define would be ok as well + {%writestatus\m!systems{fetching \string#1}% + \usemodule[#2]% + #1} + +\aliased\let\fetchruntimecommand\fetchmodulecommand % obsolete + \protect \endinput diff --git a/tex/context/base/mkxl/font-fil.mklx b/tex/context/base/mkxl/font-fil.mklx index 08c9241aa..dcbe568b1 100644 --- a/tex/context/base/mkxl/font-fil.mklx +++ b/tex/context/base/mkxl/font-fil.mklx @@ -69,7 +69,7 @@ \let\m_font_file\empty \def \defaultfontfile{\truefontname{Normal}} % was cmtt10, but that one is gone -\edef\nullfontname {\fontname\nullfont} +%edef\nullfontname {\fontname\nullfont} \permanent\protected\def\definefontsynonym[#name]#spacer[#file]% {\edef\m_font_name{#name}% diff --git a/tex/context/base/mkxl/font-ini.mklx b/tex/context/base/mkxl/font-ini.mklx index c52fb7f4b..daa551487 100644 --- a/tex/context/base/mkxl/font-ini.mklx +++ b/tex/context/base/mkxl/font-ini.mklx @@ -1880,12 +1880,12 @@ \orelse\ifcsname\??fontclassnop#class\endcsname % already tried \else % too messy: \ifcase\currentgrouplevel % (unpredictable) - \trycurrentfontclass{#class}% + \fonts_helpers_try_currentfontclass{#class}% \fi} -\ifdefined\trycurrentfontclass \else +\ifdefined\fonts_helpers_try_currentfontclass \else - \protected\def\trycurrentfontclass#typeface% + \protected\def\fonts_helpers_try_currentfontclass#typeface% {\letcsname\??fontclassnop#typeface\endcsname\empty} \fi @@ -2428,15 +2428,7 @@ \fullrestoreglobalbodyfont \fi} -\permanent\protected\def\showbodyfontstate - {\dontleavehmode - \start - \infofont - [fontclass: \fontclass,\space - fontbody: \fontbody ,\space - fontface: \fontface ,\space - fontsize: \fontsize ]% - \stop} +\fetchmodulecommand \showbodyfontstate \f!font_run %D Handy for manuals: diff --git a/tex/context/base/mkxl/font-tex.lmt b/tex/context/base/mkxl/font-tex.lmt index ba356bc29..c960953a7 100644 --- a/tex/context/base/mkxl/font-tex.lmt +++ b/tex/context/base/mkxl/font-tex.lmt @@ -63,17 +63,21 @@ end local function setboxglyph(specification) if specification then - local name = specification.name - if name then - local private = newprivateslot(name) - local font = currentfont() + local name = specification.name + local unicode = specification.unicode + local font = currentfont() + if not unicode and name then + unicode = newprivateslot(name) + specification.unicode = unicode + end + if unicode then if not specification.setups then specification.setups = name end -- we can actually delay font if needed - register(font,private,function(font,private) - makeglyphbox(private,specification) - return setboxglyphs(category,font,private,specification) + register(font,unicode,function(font,private) + makeglyphbox(unicode,specification) + return setboxglyphs(category,font,unicode,specification) end) checkenabled() end @@ -133,7 +137,12 @@ interfaces.implement { public = true, protected = true, actions = setboxglyph, - arguments = { { "*" } }, + arguments = { { + { "category" }, + { "unicode", "integer" }, + { "name" }, + { "*" } + } }, } fonts.handlers.otf.features.register { diff --git a/tex/context/base/mkxl/font-tex.mkxl b/tex/context/base/mkxl/font-tex.mkxl index 957b28916..ae936be31 100644 --- a/tex/context/base/mkxl/font-tex.mkxl +++ b/tex/context/base/mkxl/font-tex.mkxl @@ -116,5 +116,6 @@ \permanent\protected\def\makeglyphbox#1% {\begingroup \global\setbox\glyphbox\hbox{\directsetup{#1}}% + \finalizeobjectbox\glyphbox % \writestatus{glyphbox}{#1 => (\the\wd\glyphbox,\the\ht\glyphbox,\the\dp\glyphbox)}% \endgroup} diff --git a/tex/context/base/mkxl/font-tra.mkxl b/tex/context/base/mkxl/font-tra.mkxl index b24eab865..1452244af 100644 --- a/tex/context/base/mkxl/font-tra.mkxl +++ b/tex/context/base/mkxl/font-tra.mkxl @@ -31,19 +31,18 @@ %D %D The implementation is rather straightforward in using \type {\halign}. -\fetchruntimecommand \showbodyfont \f!font_run +\fetchmodulecommand \showbodyfont \f!font_run %D \macros -%D {showfontstrip, testminimalbaseline, showminimalbaseline} +%D {showfontstrip, showminimalbaseline} %D %D The next command can come in handy when combining different fonts into a %D collection (typeface) and determining optimal baseline distances. %D %D \showfontstrip \blank \showminimalbaseline -\fetchruntimecommand \showfontstrip \f!font_run -\fetchruntimecommand \testminimalbaseline \f!font_run -\fetchruntimecommand \showminimalbaseline \f!font_run +\fetchmodulecommand \showfontstrip \f!font_run +\fetchmodulecommand \showminimalbaseline \f!font_run %D \macros %D {showkerning} @@ -52,7 +51,7 @@ %D %D \showkerning{Can you guess what kerning is?} -\fetchruntimecommand \showkerning \f!font_run +\fetchmodulecommand \showkerning \f!s_fonts_show %D \macros %D {showbodyfontenvironment,showfont,showfontstyle,showligatures} @@ -65,7 +64,7 @@ %D %D \showsetup{showbodyfontenvironment} -\fetchruntimecommand \showbodyfontenvironment \f!font_run +\fetchmodulecommand \showbodyfontenvironment \f!font_run %D The following command generates a fontmap: %D @@ -76,12 +75,12 @@ %D \typebuffer %D \getbuffer -\fetchruntimecommand \showfont \f!font_run -\fetchruntimecommand \showfontstyle \f!font_run -\fetchruntimecommand \showligature \f!font_run -\fetchruntimecommand \showligatures \f!font_run -\fetchruntimecommand \showcharratio \f!font_run -\fetchruntimecommand \showfontparameters \f!font_run +\fetchmodulecommand \showfont \f!font_run +\fetchmodulecommand \showfontstyle \f!font_run +\fetchmodulecommand \showligature \f!font_run +\fetchmodulecommand \showligatures \f!font_run +\fetchmodulecommand \showcharratio \f!font_run +\fetchmodulecommand \showfontparameters \f!font_run \permanent\protected\def\showchardata#1{\ctxcommand{showchardata("#1")}} % todo: direct implementor \permanent\protected\def\showfontdata {\ctxcommand{showfontparameters()}} % todo: direct implementor @@ -98,237 +97,13 @@ \aliased\let\doiffontpresentelse\doifelsefontpresent -% experimental, maybe this becomes a module +%D The otf tracer code is now moved. If the individual commands are needed +%D one can just load the module. -\newbox\otfcollector - -\permanent\protected\def\startotfcollecting{\ctxlua{nodes.tracers.steppers.start()}} -\permanent\protected\def\stopotfcollecting {\ctxlua{nodes.tracers.steppers.stop()}} -\permanent\protected\def\resetotfcollecting{\ctxlua{nodes.tracers.steppers.reset()}} - -% \page \showotfcomposition{arabtype*arab-default at 48pt}{-1}{الضَّرَّ} \page -% \page \showotfcomposition{arabtype*arab-default at 48pt}{-1}{لِلّٰهِ} \page - -\permanent\protected\def\showotfstepglyphs#1% - {\ctxlua{nodes.tracers.steppers.glyphs(\number\otfcollector,#1)}% - \unhbox\otfcollector} - -\permanent\protected\def\otfstepspace - {\removeunwantedspaces - \hskip.5\emwidth \s!plus .125\emwidth \s!minus .125\emwidth\relax} - -\permanent\protected\def\otfstepcharcommand#1#2#3% font char class - {\otfstepspace - \doif{#3}{mark}{\underbar}{U+\hexnumber{#2}}:% - \setbox\scratchbox\hbox{\ctxlua{nodes.tracers.fontchar(#1,#2)}}% - \ifzeropt\wd\scratchbox - \scratchwidth.125\onepoint - \scratchdistance\dimexpr(\emwidth/2-\scratchwidth)\relax - \kern\scratchdistance - \ruledhbox to \scratchwidth{\hss\box\scratchbox\hss}% - \kern-\scratchwidth - \hskip\scratchdistance - \else - \ruledhbox{\box\scratchbox}% - \fi - \otfstepspace} - -\permanent\protected\def\otfstepfontcommand#1#2#3% id font size - {\begingroup - \tttf #1: #2 @ \the\dimexpr#3\scaledpoint\relax - \endgroup} - -\permanent\protected\def\otfstepmessagecommand#1#2% - {\begingroup - \tttf\language\minusone - \veryraggedright - \forgetparindent - \forgeteverypar - \hangindent\emwidth - \hangafter\plusone - \dontleavehmode\detokenize{#1}\removeunwantedspaces - \doifsomething{#2}{,\space\detokenize{#2}}\endgraf - \endgroup - \blank} - -\permanent\protected\def\showotfstepfont - {\ctxlua{nodes.tracers.steppers.font("otfstepfontcommand")}} - -\permanent\protected\def\showotfstepchars#1% - {\ctxlua{nodes.tracers.steppers.codes(#1,"otfstepcharcommand","otfstepspace")}} - -\permanent\protected\def\showotfstepmessages#1% - {\ctxlua{nodes.tracers.steppers.messages(#1,"otfstepmessagecommand",true)}} - -\permanent\protected\def\showotfstepfeatures - {\ctxlua{nodes.tracers.steppers.features()}} - -\permanent\protected\def\otfnoffeaturesteps - {\ctxlua{nodes.tracers.steppers.nofsteps()}} - -\newconstant\showotfstepsmode \showotfstepsmode\plusfour - -\protected\def\showotfsteps_n - {\blank - \begingroup - \advance\leftskip6\emwidth - \showotfstepmessages\recurselevel - \par - \endgroup - \blank - \dontleavehmode - \hbox to \hsize \bgroup - \hbox to 6\emwidth \bgroup - \bf - \ifnum\recurselevel=\scratchcounter result\else step \recurselevel\fi - \hss - \egroup - \vtop \bgroup - \hsize\dimexpr\hsize-6\emwidth\relax - \resetallattributes - \lefttoright - \dontleavehmode - \ifnum\recurselevel=\scratchcounter - \ruledhbox{\box\otfcompositionbox}% - \else - \ruledhbox{\showotfstepglyphs\recurselevel}% - \fi - \quad - \showotfstepchars\recurselevel - \hfill - \par - \egroup - \egroup - \blank} - -\permanent\protected\def\showotfsteps - {\begingroup - \veryraggedright - \forgetparindent - \forgeteverypar - \tt - \lefttoright - \hbox to \hsize \bgroup - \hbox to 6\emwidth{\bf font\hss}% - \vtop \bgroup - \hsize\dimexpr\hsize-6\emwidth\relax - \language\minusone - \bf - \showotfstepfont - \egroup - \egroup - \blank - \hbox to \hsize \bgroup - \hbox to 6\emwidth{\bf features\hss}% - \vtop \bgroup - \hsize\dimexpr\hsize-6\emwidth\relax - \language\minusone - \showotfstepfeatures - \egroup - \egroup - \blank - \scratchcounter\otfnoffeaturesteps\relax - \dorecurse\scratchcounter - {\ifcase\showotfstepsmode - \or % 1 = only first - \ifnum\recurselevel=\plusone - \showotfsteps_n - \fi - \or % 2 = only last - \ifnum\recurselevel=\scratchcounter - \showotfsteps_n - \fi - \or % 3 = first and last - \ifnum\recurselevel=\plusone - \showotfsteps_n - \orelse\ifnum\recurselevel=\scratchcounter - \showotfsteps_n - \fi - \else % everything - \showotfsteps_n - \fi}% - \endgroup} - -\permanent\protected\def\startotfsample - {\enabletrackers[otf.sample.silent]% beware, kind of global - \startotfcollecting - \begingroup - \veryraggedright - \forgetparindent - \forgeteverypar} - -\permanent\protected\def\stopotfsample - {\endgroup - \stopotfcollecting - \disabletrackers[otf.sample]% beware, kind of global: otf.sample - \showotfsteps - \resetotfcollecting} - -\newbox\otfcompositionbox - -% this should go in spac-ali: - -\installcorenamespace{otfcompositiondir} - -\letvalue{\??otfcompositiondir -1}\righttoleft -\letvalue{\??otfcompositiondir r2l}\righttoleft -\letvalue{\??otfcompositiondir l2r}\lefttoright -\letvalue{\??otfcompositiondir +1}\lefttoright -\letvalue{\??otfcompositiondir 1}\lefttoright - -\permanent\protected\def\setotfcompositiondirection#1% - {\begincsname\??otfcompositiondir#1\endcsname} - -\permanent\protected\def\showotfcomposition#1#2#3% {font*features at size}, rl=-1, text - {\begingroup - \forgetparindent - \forgeteverypar - % \setupcolors[\c!state=\v!start]% - \setupalign[\v!verytolerant,\v!flushleft]% - \startotfsample - \nohyphens - \global\setbox\otfcompositionbox\hbox{\definedfont[#1]\relax\setotfcompositiondirection{#2}\relax#3}% - \stopotfsample - \endgroup} - -%D \startbuffer -%D \startotfcompositionlist{Serif*default @ 11pt}{l2r}% -%D \showotfcompositionsample{effe} -%D \stopotfcompositionlist -%D \stopbuffer -%D -%D \typebuffer \getbuffer - -\permanent\protected\def\showotfcompositionlist#1#2#3% - {\begingroup - \definedfont[#1]% - \setbox\scratchbox\hbox\bgroup - \setotfcompositiondirection{#2}% - #3% - \egroup - \strut - \def|##1|{\kern\onepoint\string|\kern\onepoint##1\kern\onepoint\string|\kern\onepoint}% - \cldcontext{nodes.listtoutf(tex.box[\number\scratchbox].list,"{\\kern\\onepoint}",true)}% - \endgroup} - -\aliased\let\showotfcompositionsample\gobbleoneargument - -\permanent\protected\def\startotfcompositionlist#1#2#3\stopotfcompositionlist - {\begingroup - \enforced\protected\def\showotfcompositionsample##1% - {\NC\type{##1}% - \NC\showotfcompositionlist{Mono}{#2}{##1}% - \NC\showotfcompositionlist{#1}{#2}{##1}% - \NC\definedfont[#1]##1% - \NC\NR}% - \starttabulate[|||||]% - #3% - \stoptabulate - \endgroup} - -\aliased\let\stopotfcompositionlist\relax - -% new +\fetchmodulecommand \showotfcomposition \f!font_run +\fetchmodulecommand \showotfcompositionlist \f!font_run +\fetchmodulecommand \startotfsample \f!font_run +\fetchmodulecommand \startotfcompositionlist \f!font_run % \permanent\protected\def\savefontdata[#1]% not yet in i-*.xml % {\begingroup diff --git a/tex/context/base/mkxl/lpdf-emb.lmt b/tex/context/base/mkxl/lpdf-emb.lmt index a4fcb1b6b..5517d8051 100644 --- a/tex/context/base/mkxl/lpdf-emb.lmt +++ b/tex/context/base/mkxl/lpdf-emb.lmt @@ -1504,7 +1504,7 @@ do local f_stream = formatters["%.6N 0 d0 %s"] local f_stream_c = formatters["%.6N 0 0 0 0 0 d1 %s"] local f_stream_d = formatters["%.6N 0 d0 1 0 0 1 0 %.6N cm %s"] - local f_stream_s = formatters["%N 0 0 %N 0 0 cm /%s Do"] + -- local f_stream_s = formatters["%.6N 0 0 %.6N 0 0 cm /%s Do"] -- A type 3 font has at most 256 characters and Acrobat also wants a zero slot -- to be filled. We can share a mandate zero slot character. We also need to @@ -1546,11 +1546,11 @@ do local used = setmetatableindex("table") - function lpdf.registerfontmethod(name,f) - if f and not methods[name] then - methods[name] = f - end - end + -- function lpdf.registerfontmethod(name,f) + -- if f and not methods[name] then + -- methods[name] = f + -- end + -- end function methods.pdf(filename,details) local properties = details.properties @@ -1614,7 +1614,7 @@ do -- box inclusion (todo: we can share identical glyphs if needed but the gain -- is minimal especially when we use compact font mode) - lpdf.registerfontmethod("box",function(filename,details) + function methods.box(filename,details) local properties = details.properties local boxes = properties.indexdata[1] local xforms = pdfdictionary() @@ -1625,8 +1625,9 @@ do nofglyphs = nofglyphs + 1 local scale = units / scale -- e.g. 1000 / 12 local width = (data.width or 0) * bpfactor * scale + local depth = - (data.depth or 0) * bpfactor * scale local name = f_glyph(nofglyphs) - local stream = f_stream_s(scale,scale,name) + local stream = f_image_c_xy(scale,scale,0,depth,name) image.embedded_name = name image.embedded_stream = stream image.embedded_reference = pdfreference(image.objnum) @@ -1639,7 +1640,7 @@ do return pdfdictionary { XObject = xforms } end return boxes, 1/units, boxtopdf, wrapup, getresources - end) + end -- mps inclusion diff --git a/tex/context/base/mkxl/lpdf-lmt.lmt b/tex/context/base/mkxl/lpdf-lmt.lmt index a0c730b71..fbc002a93 100644 --- a/tex/context/base/mkxl/lpdf-lmt.lmt +++ b/tex/context/base/mkxl/lpdf-lmt.lmt @@ -416,23 +416,54 @@ do local hshift = false local vshift = false + -- local naturalwidths = setmetatableindex(function(t,font) + -- local d = descriptions[font] + -- local c = characters[font] + -- local f = parameters[font].hfactor or parameters[font].factor + -- local v = setmetatableindex(function(t,char) + -- local w + -- local e = d and d[char] + -- if e then + -- w = e.width + -- if w then + -- w = w * f + -- end + -- end + -- if not w then + -- e = c and c[char] + -- if e then + -- w = e.width or 0 + -- end + -- end + -- if not w then + -- w = 0 + -- end + -- t[char] = w + -- return w + -- end) + -- t[font] = v + -- return v + -- end) + + -- when changing this, check math: compact-001.tex (rule width) + local naturalwidths = setmetatableindex(function(t,font) local d = descriptions[font] local c = characters[font] local f = parameters[font].hfactor or parameters[font].factor local v = setmetatableindex(function(t,char) local w - local e = d and d[char] + local e = c and c[char] if e then - w = e.width - if w then - w = w * f - end + w = e.width or 0 end if not w then - e = c[char] + e = d and d[char] if e then - w = e.width or 0 + w = e.width + if w then + w = w * f + end end end if not w then diff --git a/tex/context/base/mkxl/luat-ini.mkxl b/tex/context/base/mkxl/luat-ini.mkxl index 472e8326e..4373131e1 100644 --- a/tex/context/base/mkxl/luat-ini.mkxl +++ b/tex/context/base/mkxl/luat-ini.mkxl @@ -30,8 +30,8 @@ \aliased\let\stoplua \relax % tex catcodes \aliased\let\stopluacode\relax % lua catcodes -%D It might makes sense to have a \type {\directelua} so that we can avoid the \type -%D {\normalexpanded} around \type {\directlua}. Something to discuss in the team. +%D In the meantime the \LUATEX\ interface has become stable but we still +%D see traces of old here (needs checking). \permanent\protected\def\startlua % \stoplua {\begingroup @@ -39,7 +39,7 @@ \luat_start_lua_indeed} \def\luat_start_lua_indeed#1\stoplua - {\normalexpanded{\endgroup\noexpand\directlua{#1}}} % \zerocount is default + {\normalexpanded{\endgroup\noexpand\directlua{#1}}} \permanent\protected\def\startluacode % \stopluacode {\begingroup @@ -48,7 +48,8 @@ \luat_start_lua_code_indeed} \def\luat_start_lua_code_indeed#1\stopluacode - {\normalexpanded{\endgroup\noexpand\directlua{#1}}} % \zerocount is default + %{\normalexpanded{\endgroup\noexpand\directlua{#1}}} + {\directlua{#1\beginlocalcontrol\endgroup\endlocalcontrol}} %D Some delayed definitions: @@ -57,12 +58,16 @@ \ifdefined\obeyspaces \else \let\obeyspaces \relax \fi \ifdefined\obeyedspace \else \let\obeyedspace \relax \fi -\let\obeylualines\relax +\aliased\let\obeylualines\relax % not used, will go away \newtoks\everyluacode %D It is nicer for checking with \type {s-system-macros} if we have some meaning: +\pushoverloadmode + \let\-\explicitdiscretionary +\popoverloadmode + \ifdefined\n \else \def\n{n} \fi \ifdefined\r \else \def\r{r} \fi \ifdefined\f \else \def\f{f} \fi \ifdefined\t \else \def\t{t} \fi \ifdefined\a \else \def\a{a} \fi \ifdefined\b \else \def\b{b} \fi @@ -91,10 +96,6 @@ \immutable\edef\lua_letter_seven {\string\7} \immutable\edef\lua_letter_eight {\string\8} \immutable\edef\lua_letter_nine {\string\9} \immutable\edef\lua_letter_zero {\string\0} -\pushoverloadmode - \let\-\explicitdiscretionary -\popoverloadmode - \everyluacode {% \appendtoks \enforced\let\\\lua_letter_backslash \enforced\let\|\lua_letter_bar \enforced\let\-\lua_letter_dash @@ -127,9 +128,9 @@ %D \ctxlua {something([\luastringsep[anything tricky can go here]\luastringsep])} %D \stoptyping -\def\luastringsep{===} % this permits \typefile{self} otherwise nested b/e sep problems +\def\luastringsep{===} % this permits \typefile{self} otherwise nested b/e sep problems -\edef\!!bs{[\luastringsep[} +\edef\!!bs{[\luastringsep[} % later redefined as mutable \edef\!!es{]\luastringsep]} %D We have a the following available as primitive so there is no need for it: diff --git a/tex/context/base/mkxl/math-ini.mkxl b/tex/context/base/mkxl/math-ini.mkxl index 01ecd63a2..b568ef126 100644 --- a/tex/context/base/mkxl/math-ini.mkxl +++ b/tex/context/base/mkxl/math-ini.mkxl @@ -704,9 +704,15 @@ \chardef\c_math_strut"28 -\protected\def\math_strut_htdp#1% - {\s!height\fontcharht#1\c_math_strut - \s!depth \fontchardp#1\c_math_strut} +% \protected\def\math_strut_htdp#1% +% {\s!height\fontcharht#1\c_math_strut +% \s!depth \fontchardp#1\c_math_strut} +% +% now we need this (kind of inefficient): + +\protected\def\math_strut_htdp#1% nasty! + {\s!height\dimexpr\mathscale#1\fontcharht#1\c_math_strut/\glyphscale\relax + \s!depth \dimexpr\mathscale#1\fontchardp#1\c_math_strut/\glyphscale\relax} \protected\def\math_strut_normal {\vrule @@ -2675,7 +2681,7 @@ \scratchdepth \dimexpr\scratchbottomoffset+\m_math_inline_openup_dp\relax \vrule\s!width\zeropoint\s!height\scratchheight\s!depth\scratchdepth\relax \begingroup - \dofastcoloractivation{darkred}% + \dousecolorparameter{darkred}% \vrule\s!width\emwidth\s!height\scratchheight\s!depth-\scratchtopoffset\relax \endgroup \kern-\emwidth @@ -2686,7 +2692,7 @@ {\endgroup \kern-\emwidth \begingroup - \dofastcoloractivation{darkblue}% + \dousecolorparameter{darkblue}% \vrule\s!width\emwidth\s!height-\scratchbottomoffset\s!depth\scratchdepth\relax \endgroup \vrule\s!width\zeropoint\s!height\scratchheight\s!depth\scratchdepth\relax} diff --git a/tex/context/base/mkxl/meta-ini.mkxl b/tex/context/base/mkxl/meta-ini.mkxl index d9b8eeff8..9d32e2dbf 100644 --- a/tex/context/base/mkxl/meta-ini.mkxl +++ b/tex/context/base/mkxl/meta-ini.mkxl @@ -754,6 +754,8 @@ \protected\def\meta_start_reusable_graphic_indeed#1#2#3\stopreusableMPgraphic {\gdefcsname\??mpgraphic#1\endcsname{\meta_handle_reusable_graphic{#1}{#2}{#3}}} +\mutable\let\usedMPgraphicname\empty + \permanent\tolerant\protected\def\useMPgraphic#=#*#=% {\meta_begin_graphic_group{#1}% \ifcsname\??mpgraphic#1\endcsname diff --git a/tex/context/base/mkxl/mult-sys.mkxl b/tex/context/base/mkxl/mult-sys.mkxl index 38355f4cb..efd39a4a5 100644 --- a/tex/context/base/mkxl/mult-sys.mkxl +++ b/tex/context/base/mkxl/mult-sys.mkxl @@ -566,11 +566,11 @@ %D The setup files for the language, font, color and special subsystems have a common %D prefix. This means that we have at most three characters for unique filenames. -\definefileconstant {colo_run} {colo-run} -\definefileconstant {font_run} {font-run} -\definefileconstant {page_run} {page-run} -\definefileconstant {symb_run} {symb-run} -\definefileconstant {publ_tra} {publ-tra} +\definefileconstant {colo_run} {s-colors-run} +\definefileconstant {font_run} {s-fonts-show} +\definefileconstant {page_run} {s-layout-show} +\definefileconstant {symb_run} {s-symbols-show} +\definefileconstant {publ_tra} {s-publications-show} %D For figure inclusion we need(ed): diff --git a/tex/context/base/mkxl/page-box.mklx b/tex/context/base/mkxl/page-box.mklx index 9b6868b04..b34de6de0 100644 --- a/tex/context/base/mkxl/page-box.mklx +++ b/tex/context/base/mkxl/page-box.mklx @@ -110,8 +110,8 @@ \def\page_boxes_apply_orientate_indeed#odd#even#box% {\setbox#box\vpack - {\edef\somerotation{\number\ifdoublesided\ifodd\realpageno#odd\else#even\fi\else#odd\fi}% - \dorotatebox\somerotation\hpack{\box#box}}} + {\edef\p_rotation{\number\ifdoublesided\ifodd\realpageno#odd\else#even\fi\else#odd\fi}% + \dorotatebox\p_rotation\hpack{\box#box}}} \def\page_boxes_apply_mirror#box% {\setbox#box\vpack{\mirror{\box#box}}} diff --git a/tex/context/base/mkxl/page-lay.mkxl b/tex/context/base/mkxl/page-lay.mkxl index dbdcfc323..29698cb67 100644 --- a/tex/context/base/mkxl/page-lay.mkxl +++ b/tex/context/base/mkxl/page-lay.mkxl @@ -1320,12 +1320,12 @@ %D %showsetup{showgrid} %D %showsetup{showusage} -\fetchruntimecommand \showprint \f!page_run -\fetchruntimecommand \showframe \f!page_run -\fetchruntimecommand \showlayout \f!page_run -\fetchruntimecommand \showsetups \f!page_run -\fetchruntimecommand \showmargins \f!page_run -\fetchruntimecommand \showgrid \f!page_run +\fetchmodulecommand \showprint \f!page_run +\fetchmodulecommand \showframe \f!page_run +\fetchmodulecommand \showlayout \f!page_run +\fetchmodulecommand \showsetups \f!page_run +\fetchmodulecommand \showmargins \f!page_run +\fetchmodulecommand \showgrid \f!page_run \glet\page_grids_add_to_box\gobbleoneargument \glet\page_grids_add_to_one\gobbleoneargument diff --git a/tex/context/base/mkxl/page-otr.lmt b/tex/context/base/mkxl/page-otr.lmt new file mode 100644 index 000000000..5c0bc96a9 --- /dev/null +++ b/tex/context/base/mkxl/page-otr.lmt @@ -0,0 +1,14 @@ +if not modules then modules = { } end modules ['page-otr'] = { + version = 1.001, + comment = "companion to page-otr.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +interfaces.implement { + name = "triggerpagebuilder", + public = true, + protected = true, + actions = tex.triggerbuildpage, +} diff --git a/tex/context/base/mkxl/page-otr.mklx b/tex/context/base/mkxl/page-otr.mklx index e93590bf6..2cc8f4809 100644 --- a/tex/context/base/mkxl/page-otr.mklx +++ b/tex/context/base/mkxl/page-otr.mklx @@ -19,11 +19,11 @@ % When issuing two \par\penalty-\plustenthousand's, only the first triggers the % otr. Is this an obscure feature or an optimization? -\registerctxluafile{page-otr}{} +\registerctxluafile{page-otr}{autosuffix} \unprotect -\let\triggerpagebuilder\clf_triggerpagebuilder +% triggerpagebuilder % defined at the lua end \def\m!otr{otr} % todo diff --git a/tex/context/base/mkxl/publ-ini.mkxl b/tex/context/base/mkxl/publ-ini.mkxl index c2d421e4c..b550fef39 100644 --- a/tex/context/base/mkxl/publ-ini.mkxl +++ b/tex/context/base/mkxl/publ-ini.mkxl @@ -56,6 +56,7 @@ \registerctxluafile{publ-fnd}{} % new method (for the moment only local) \registerctxluafile{publ-jrn}{} \registerctxluafile{publ-reg}{} +\registerctxluafile{publ-tra}{} % has more general helpers too \unprotect @@ -2009,12 +2010,12 @@ %D Delayed loading: -\fetchruntimecommand \showbtxdatasetfields \f!publ_tra -\fetchruntimecommand \showbtxdatasetcompleteness \f!publ_tra -\fetchruntimecommand \showbtxdatasetauthors \f!publ_tra -\fetchruntimecommand \showbtxhashedauthors \f!publ_tra -\fetchruntimecommand \showbtxfields \f!publ_tra -\fetchruntimecommand \showbtxtables \f!publ_tra +\fetchmodulecommand \showbtxdatasetfields \f!publ_tra +\fetchmodulecommand \showbtxdatasetcompleteness \f!publ_tra +\fetchmodulecommand \showbtxdatasetauthors \f!publ_tra +\fetchmodulecommand \showbtxhashedauthors \f!publ_tra +\fetchmodulecommand \showbtxfields \f!publ_tra +\fetchmodulecommand \showbtxtables \f!publ_tra %D Some potential crap: %D diff --git a/tex/context/base/mkxl/spac-hor.mkxl b/tex/context/base/mkxl/spac-hor.mkxl index 13d1f9021..1e7781026 100644 --- a/tex/context/base/mkxl/spac-hor.mkxl +++ b/tex/context/base/mkxl/spac-hor.mkxl @@ -105,7 +105,7 @@ % case two \else \edef\v_spac_indentation_current{#1}% single entry in list - \let\normalindentation\v_spac_indentation_current + \let\v_spac_indentation_normal\v_spac_indentation_current \spac_indentation_setup_size \fi} @@ -143,8 +143,8 @@ \installindentingmethod \v!odd {\c_spac_indentation_toggle_state\plusone} \installindentingmethod \v!even {\c_spac_indentation_toggle_state\plustwo} -\installindentingmethod \v!normal{\ifempty\normalindentation\else - \let\v_spac_indentation_current\normalindentation +\installindentingmethod \v!normal{\ifempty\v_spac_indentation_normal\else + \let\v_spac_indentation_current\v_spac_indentation_normal \spac_indentation_setup_size \fi} @@ -1192,14 +1192,14 @@ \newsignal\d_spac_ignore_spaces_signal \newcount \c_spac_ignore_spaces -\protected\def\startignorespaces +\permanent\protected\def\startignorespaces {\advance\c_spac_ignore_spaces\plusone \ifcase\c_spac_ignore_spaces\or \ifhmode \hskip\d_spac_ignore_spaces_signal \fi \fi \ignorespaces} -\protected\def\stopignorespaces +\permanent\protected\def\stopignorespaces {\ifcase\c_spac_ignore_spaces \or \ifhmode \doloop\spac_ignore_spaces_body diff --git a/tex/context/base/mkxl/strc-con.mklx b/tex/context/base/mkxl/strc-con.mklx index d64be35f0..db1b84654 100644 --- a/tex/context/base/mkxl/strc-con.mklx +++ b/tex/context/base/mkxl/strc-con.mklx @@ -979,8 +979,8 @@ \installcorenamespace{constructionclosesymbol} -\let\placeclosesymbol\donothing -\let\qed \donothing +\mutable\let\placeclosesymbol\donothing +\mutable\let\qed \donothing \def\strc_constructions_close_symbol_reset % no need for global {\global\expandafter\settrue\csname\??constructionclosesymbol\currentconstruction\endcsname diff --git a/tex/context/base/mkxl/strc-itm.mklx b/tex/context/base/mkxl/strc-itm.mklx index 01155fa10..be663edc8 100644 --- a/tex/context/base/mkxl/strc-itm.mklx +++ b/tex/context/base/mkxl/strc-itm.mklx @@ -1588,7 +1588,7 @@ \ifdefined\noitem \else \aliased\let\noitem \relax \fi \ifdefined\itm \else \aliased\let\itm \relax \fi \ifdefined\but \else \aliased\let\but \relax \fi -\ifdefined\nop \else \aliased\let\nop \relax \fi +\ifdefined\nop \else \let\nop \relax \fi % used often by myself \ifdefined\txt \else \aliased\let\txt \relax \fi \ifdefined\head \else \let\head \relax \fi % defined later \ifdefined\headsym \else \aliased\let\headsym \relax \fi diff --git a/tex/context/base/mkxl/strc-sec.mkxl b/tex/context/base/mkxl/strc-sec.mkxl index acc7e494e..0ede2f153 100644 --- a/tex/context/base/mkxl/strc-sec.mkxl +++ b/tex/context/base/mkxl/strc-sec.mkxl @@ -522,16 +522,16 @@ % structure sections (the parents of chapter etc) -\let\firstsectionname\empty -\let\lastsectionname \empty +\permanent\let\firstsectionname\empty +\permanent\let\lastsectionname \empty -\let\resetallstructuremarks \relax -\let\resetcurrentstructuremarks \relax -\let\resetcurrentstructuremarkswithpage\relax +%aliased\let\resetallstructuremarks \relax +%aliased\let\resetcurrentstructuremarks \relax +\aliased\let\resetcurrentstructuremarkswithpage\relax -\def\resetallstructuremarks {\resetmarking[\firstsectionname]} % will become option (was \v!section-1) -\def\resetcurrentstructuremarks {\resetmarking[\lastsectionname]} % will become option -%def\resetcurrentstructuremarkswithpage{\resetmarking[\lastsectionname]} % will become option +\permanent\protected\def\resetallstructuremarks {\resetmarking[\firstsectionname]} % will become option (was \v!section-1) +\permanent\protected\def\resetcurrentstructuremarks {\resetmarking[\lastsectionname]} % will become option +%permanent\protected\def\resetcurrentstructuremarkswithpage{\resetmarking[\lastsectionname]} % will become option % We could use a commandhandler here but sections are somewhat special in the % sense that we have two ways of chaining: the main section (levels) as well @@ -582,9 +582,9 @@ \ifnum\maxstructuredepth>\plusone \normalexpanded{\relatemarking[#1][\lastsectionname]}% so, the parent will reset the child \fi - \xdef\lastsectionname{#1}% + \enforced\xdef\lastsectionname{#1}% \ifempty\firstsectionname - \glet\firstsectionname\lastsectionname + \enforced\glet\firstsectionname\lastsectionname \fi \fi} @@ -1304,8 +1304,8 @@ % list references, will be redone in lua when we need it -\let\startlistreferences\relax -\let\stoplistreferences \relax +% \let\startlistreferences\relax +% \let\stoplistreferences \relax % experimental diff --git a/tex/context/base/mkxl/symb-ini.mkxl b/tex/context/base/mkxl/symb-ini.mkxl index 0346e39bb..458e212aa 100644 --- a/tex/context/base/mkxl/symb-ini.mkxl +++ b/tex/context/base/mkxl/symb-ini.mkxl @@ -324,7 +324,7 @@ %D %D \showsetup{showsymbolset} -\fetchruntimecommand \showsymbolset \f!symb_run +\fetchmodulecommand \showsymbolset \f!symb_run %D \macros %D {usesymbols} diff --git a/tex/context/base/mkxl/syst-aux.mkxl b/tex/context/base/mkxl/syst-aux.mkxl index ce6177b3b..c116e9d46 100644 --- a/tex/context/base/mkxl/syst-aux.mkxl +++ b/tex/context/base/mkxl/syst-aux.mkxl @@ -87,7 +87,7 @@ \writestatus\m!system{duplicate system namespace '#1'}\wait \else \global\advance\c_syst_helpers_n_of_namespaces\plusone - \edefcsname ??#1\endcsname{\v_interfaces_prefix_template_system}% + \immutable\edefcsname ??#1\endcsname{\v_interfaces_prefix_template_system}% \fi} %D \macros diff --git a/tex/context/base/mkxl/syst-ini.mkxl b/tex/context/base/mkxl/syst-ini.mkxl index 50b61231f..dbd82c166 100644 --- a/tex/context/base/mkxl/syst-ini.mkxl +++ b/tex/context/base/mkxl/syst-ini.mkxl @@ -266,18 +266,18 @@ %D The allocators share a common helper macro. -\protected\permanent\def\newcount {\syst_basics_allocate\c_syst_last_allocated_count \count \countdef \c_syst_max_allocated_register} -\protected\permanent\def\newdimen {\syst_basics_allocate\c_syst_last_allocated_dimen \dimen \dimendef \c_syst_max_allocated_register} -\protected\permanent\def\newskip {\syst_basics_allocate\c_syst_last_allocated_skip \skip \skipdef \c_syst_max_allocated_register} -\protected\permanent\def\newmuskip {\syst_basics_allocate\c_syst_last_allocated_muskip \muskip \muskipdef \c_syst_max_allocated_register} -\protected\permanent\def\newbox {\syst_basics_allocate\c_syst_last_allocated_box \box \integerdef\c_syst_max_allocated_register} -\protected\permanent\def\newtoks {\syst_basics_allocate\c_syst_last_allocated_toks \toks \toksdef \c_syst_max_allocated_register} -\protected\permanent\def\newread {\syst_basics_allocate\c_syst_last_allocated_read \read \integerdef\c_syst_max_allocated_read} -\protected\permanent\def\newwrite {\syst_basics_allocate\c_syst_last_allocated_write \write \integerdef\c_syst_max_allocated_write} -\protected\permanent\def\newmarks {\syst_basics_allocate\c_syst_last_allocated_marks \marks \integerdef\c_syst_max_allocated_register} -\protected\permanent\def\newinsert {\syst_basics_allocate\c_syst_last_allocated_insertion\insert \chardef \c_syst_max_allocated_insert} -\protected\permanent\def\newlanguage{\syst_basics_allocate\c_syst_last_allocated_language \language\integerdef\c_syst_max_allocated_language} % not needed in context -\protected\permanent\def\newfamily {\syst_basics_allocate\c_syst_last_allocated_family \fam \integerdef\c_syst_max_allocated_family} % not needed in context +\permanent\protected\def\newcount {\syst_basics_allocate\c_syst_last_allocated_count \count \countdef \c_syst_max_allocated_register} +\permanent\protected\def\newdimen {\syst_basics_allocate\c_syst_last_allocated_dimen \dimen \dimendef \c_syst_max_allocated_register} +\permanent\protected\def\newskip {\syst_basics_allocate\c_syst_last_allocated_skip \skip \skipdef \c_syst_max_allocated_register} +\permanent\protected\def\newmuskip {\syst_basics_allocate\c_syst_last_allocated_muskip \muskip \muskipdef \c_syst_max_allocated_register} +\permanent\protected\def\newbox {\syst_basics_allocate\c_syst_last_allocated_box \box \integerdef\c_syst_max_allocated_register} +\permanent\protected\def\newtoks {\syst_basics_allocate\c_syst_last_allocated_toks \toks \toksdef \c_syst_max_allocated_register} +\permanent\protected\def\newread {\syst_basics_allocate\c_syst_last_allocated_read \read \integerdef\c_syst_max_allocated_read} +\permanent\protected\def\newwrite {\syst_basics_allocate\c_syst_last_allocated_write \write \integerdef\c_syst_max_allocated_write} +\permanent\protected\def\newmarks {\syst_basics_allocate\c_syst_last_allocated_marks \marks \integerdef\c_syst_max_allocated_register} +\permanent\protected\def\newinsert {\syst_basics_allocate\c_syst_last_allocated_insertion\insert \chardef \c_syst_max_allocated_insert} +\permanent\protected\def\newlanguage{\syst_basics_allocate\c_syst_last_allocated_language \language\integerdef\c_syst_max_allocated_language} % not needed in context +\permanent\protected\def\newfamily {\syst_basics_allocate\c_syst_last_allocated_family \fam \integerdef\c_syst_max_allocated_family} % not needed in context \aliased\let\newfam\newfamily @@ -286,10 +286,10 @@ % Watch out, for the moment we disable the check for already being defined % later we will revert this but first all chardefs must be replaced. -\protected\def\setconstant {} -\protected\def\setconstantvalue#1#2{\csname#1\endcsname\numexpr#2\relax} +\permanent\protected\def\setconstant {} +\permanent\protected\def\setconstantvalue#1#2{\csname#1\endcsname\numexpr#2\relax} -\protected\def\newconstant#1% +\permanent\protected\def\newconstant#1% {\ifrelax#1% %\writestatus{!!!!!!!!!!}{\string #1 => RELAX}% \unletfrozen#1% @@ -300,7 +300,7 @@ \newcount#1% \fi} -\protected\def\setnewconstant#1{\newconstant#1#1} +\permanent\protected\def\setnewconstant#1{\newconstant#1#1} % %D The next definitions are really needed (in \CONTEXT): diff --git a/tex/context/base/mkxl/tabl-tbl.mkxl b/tex/context/base/mkxl/tabl-tbl.mkxl index f29389f15..64a865a2a 100644 --- a/tex/context/base/mkxl/tabl-tbl.mkxl +++ b/tex/context/base/mkxl/tabl-tbl.mkxl @@ -224,6 +224,9 @@ \newconstant \c_tabl_tabulate_localcolorspan \newconstant \c_tabl_tabulate_modus +%newconditional \c_tabl_pre_is_set +\newconditional \c_tabl_post_is_set + \let \m_tabl_tabulate_separator_factor \empty % fraction \aliased\let\tabulatesplitlinemode\c_tabl_tabulate_splitlinemode % temp hack, we need an interface @@ -409,9 +412,9 @@ \fi} % \protected % we can expand this one -\def\tabl_tabulate_inject_post_skip#1% +\def\tabl_tabulate_inject_post_skip#1#2% {\ifdim#1>\zeropoint - \kern#1\relax % was \hskip + \kern\ifnum\c_tabl_tabulate_columns=\c_tabl_tabulate_nofcolumns#2\else#1\fi\relax \orelse\ifnum\c_tabl_tabulate_columns=\c_tabl_tabulate_nofcolumns \ifconditional\c_tabl_tabulate_autorulespacing \ifcase\c_tabl_tabulate_has_rule_spec_last\else @@ -478,7 +481,7 @@ \ifempty\m_tabl_tabulate_text_color \expandafter\gobbleoneargument \else - \expandafter\dofastcoloractivation + \expandafter\colo_helpers_direct_activate \fi\m_tabl_tabulate_text_color \noexpand\fi % grouping needs to be outside macros (or expandable), nice test @@ -501,7 +504,9 @@ \egroup \aligntab \noexpand\dostoptagged - \tabl_tabulate_inject_post_skip{\the\dimexpr\s_tabl_tabulate_post}% get rid of plus + \tabl_tabulate_inject_post_skip + {\the\ifconditional\c_tabl_post_is_set\s_tabl_tabulate_post\else\s_tabl_tabulate_last\fi}% + {\the\s_tabl_tabulate_post}% \alignmark\alignmark }% \toksapp\t_tabl_tabulate_dummy{\NC}% @@ -512,7 +517,9 @@ \s_tabl_tabulate_post\zeropoint \fi %\let\gettabulateexit\dogettabulateexit % still needed ? - \d_tabl_tabulate_width\zeropoint} + \d_tabl_tabulate_width\zeropoint + %setfalse\c_tabl_pre_is_set + \setfalse\c_tabl_post_is_set} \permanent\protected\def\installtabulatepreambleoption#1#2% {\defcsname\??tabulatepreamble\string#1\endcsname{#2}}% @@ -592,17 +599,21 @@ \tabl_tabulate_set_preamble} \def\tabl_tabulate_set_preskip#1% - {\doifelsenumber{#1}% + {%settrue\c_tabl_pre_is_set + \doifelsenumber{#1}% {\s_tabl_tabulate_pre#1\d_tabl_tabulate_unit\tabl_tabulate_set_preamble }% {\s_tabl_tabulate_pre.5\d_tabl_tabulate_unit\tabl_tabulate_set_preamble#1}} \def\tabl_tabulate_set_posskip#1% - {\doifelsenumber{#1}% + {\settrue\c_tabl_post_is_set + \doifelsenumber{#1}% {\s_tabl_tabulate_post#1\d_tabl_tabulate_unit\tabl_tabulate_set_preamble }% {\s_tabl_tabulate_post.5\d_tabl_tabulate_unit\tabl_tabulate_set_preamble#1}} \def\tabl_tabulate_set_preposskip#1% - {\doifelsenumber{#1}% + {%settrue\c_tabl_pre_is_set + \settrue\c_tabl_post_is_set + \doifelsenumber{#1}% {\s_tabl_tabulate_pre#1\d_tabl_tabulate_unit\s_tabl_tabulate_post\s_tabl_tabulate_pre\tabl_tabulate_set_preamble }% {\s_tabl_tabulate_pre.5\d_tabl_tabulate_unit\s_tabl_tabulate_post\s_tabl_tabulate_pre\tabl_tabulate_set_preamble#1}} @@ -773,6 +784,8 @@ \c_tabl_tabulate_modus\zerocount \setfalse\c_tabl_tabulate_pwidth_set \setfalse\c_tabl_tabulate_reshape + %setfalse\c_tabl_pre_is_set + \setfalse\c_tabl_post_is_set \t_tabl_tabulate_before\emptytoks \t_tabl_tabulate_after\emptytoks \t_tabl_tabulate_bmath\emptytoks @@ -1175,9 +1188,9 @@ \fi \tabl_tabulate_start_building} -\letvalue{\e!stop\v!tabulate }\relax -\letvalue{\e!stop\v!tabulatehead}\relax -\letvalue{\e!stop\v!tabulatetail}\relax +\permanent\letcsname\e!stop\v!tabulate \endcsname\relax +\permanent\letcsname\e!stop\v!tabulatehead\endcsname\relax +\permanent\letcsname\e!stop\v!tabulatetail\endcsname\relax \permanent\protected\def\tabl_tabulate_start_ignore % todo when we go frozen {\em Nested tabulate is not (yet) supported.\relax @@ -1290,7 +1303,7 @@ \edef\p_line {\tabulationparameter\c!rule}% \edef\p_rulecolor {\tabulationparameter\c!rulecolor}% \edef\p_rulethickness{\tabulationparameter\c!rulethickness}% - \edef\p_bodyfont {\tabulationparameter\c!bodyfont} + \edef\p_bodyfont {\tabulationparameter\c!bodyfont}% \edef\p_indenting {\tabulationparameter\c!indenting}% \edef\p_keeptogether {\tabulationparameter\c!keeptogether}% \edef\p_blank {\tabulationparameter\c!blank}% @@ -1468,7 +1481,7 @@ \tabl_tabulate_column_normal} \def\tabl_tabulate_column_vruled_step#1% - {\doifelsenumber{#1} + {\doifelsenumber{#1}% {\global\d_tabl_tabulate_vrulethickness_local#1\d_tabl_tabulate_vrulethickness_default} {\xdef\m_tabl_tabulate_vrule_color_local{#1}}} @@ -1572,7 +1585,7 @@ \egroup} \def\tabl_tabulate_hrule_preset_step#1% - {\doifelsenumber{#1} + {\doifelsenumber{#1}% {\global\d_tabl_tabulate_hrulethickness_local#1\d_tabl_tabulate_hrulethickness_default} {\xdef\currenttabulationlocalhrulecolor{#1}}} @@ -2161,6 +2174,8 @@ \s_tabl_tabulate_last\s_tabl_tabulate_first \s_tabl_tabulate_pre\zeropoint \s_tabl_tabulate_post\zeropoint + %setfalse\s_tabl_pre_is_set + \setfalse\s_tabl_post_is_set \global\c_tabl_tabulate_columns\zerocount \global\c_tabl_tabulate_nofauto\zerocount \global\c_tabl_tabulate_noflines\zerocount diff --git a/tex/context/base/mkxl/trac-deb.lmt b/tex/context/base/mkxl/trac-deb.lmt index b9827c3a9..8ff124105 100644 --- a/tex/context/base/mkxl/trac-deb.lmt +++ b/tex/context/base/mkxl/trac-deb.lmt @@ -31,7 +31,7 @@ local runlocal = tex.runlocal local terminaldata = false local context = context -interfaces.implement { +implement { name = "fetchterminaldata", actions = function() context(terminaldata) @@ -53,7 +53,7 @@ function texio.terminal() end end -interfaces.implement { +implement { name = "readfromterminal", public = true, protected = true, @@ -386,8 +386,6 @@ directives.register("system.showerror", lmx.overloaderror) -- end -- end) -local implement = interfaces.implement - implement { name = "showtrackers", public = true, protected = true, actions = trackers.show } implement { name = "enabletrackers", public = true, protected = true, actions = trackers.enable, arguments = "optional" } implement { name = "disabletrackers", public = true, protected = true, actions = trackers.disable, arguments = "optional" } diff --git a/tex/context/base/mkxl/trac-deb.mkxl b/tex/context/base/mkxl/trac-deb.mkxl index 37a901aa3..0eab24d29 100644 --- a/tex/context/base/mkxl/trac-deb.mkxl +++ b/tex/context/base/mkxl/trac-deb.mkxl @@ -18,8 +18,6 @@ \unprotect -\permanent\protected\def\breakpoint{\showdebuginfo\wait} - % \showtrackers % defined at the lua end % \enabletrackers [#1] % defined at the lua end % \disabletrackers [#1] % defined at the lua end @@ -33,7 +31,6 @@ % \enableexperiments [#1] % defined at the lua end % \disableexperiments[#1] % defined at the lua end % -% \showdebuginfo % defined at the lua end % \overloaderror % defined at the lua end % % \showlogcategories % defined at the lua end diff --git a/tex/context/base/mkxl/type-ini.mklx b/tex/context/base/mkxl/type-ini.mklx index 0e1c4340e..167ea3d33 100644 --- a/tex/context/base/mkxl/type-ini.mklx +++ b/tex/context/base/mkxl/type-ini.mklx @@ -417,7 +417,7 @@ \settrue\autotypescripts -\protected\def\trycurrentfontclass#typeface% +\protected\def\fonts_helpers_try_currentfontclass#typeface% {\ifconditional\autotypescripts \usetypescript[#typeface]% \ifcsname\??fontclassyes#typeface\endcsname diff --git a/tex/context/base/mkxl/typo-dir.mkxl b/tex/context/base/mkxl/typo-dir.mkxl index 1d696d8c5..78c0b8e44 100644 --- a/tex/context/base/mkxl/typo-dir.mkxl +++ b/tex/context/base/mkxl/typo-dir.mkxl @@ -51,6 +51,9 @@ % maybe use chardefs +\mutable\let\currentbidimode\empty +\mutable\let\currentbidistamp\empty + \def\typo_dir_get_mode {\def\currentbidimode{\clf_getbidimode % test edef scope {\directionsparameter\c!bidi}% diff --git a/tex/context/modules/mkiv/s-system-macros.mkxl b/tex/context/modules/mkiv/s-system-macros.mkxl index c6251319d..f9d7c5fb8 100644 --- a/tex/context/modules/mkiv/s-system-macros.mkxl +++ b/tex/context/modules/mkiv/s-system-macros.mkxl @@ -27,6 +27,10 @@ % todo: and how about metapost ... i need a mp.hashtokens in order to do that and I also % need to think about protection there (tricky as we use an avl hash there) +\enablemode[texmacros] +% \enablemode[metapostmacros] +\enablemode[notmarked] + \startmodule[system-macros] \continueifinputfile{s-system-macros.mkxl} @@ -43,248 +47,257 @@ \starttext \startluacode - local context = context - local ctx_NC = context.NC - local ctx_NR = context.NR - local ctx_bold = context.bold - local find = string.find - local gsub = string.gsub - local create = token.create + if tex.modes.texmacros then - local crap = "[$>%|%&%#" .. string.char(0xEF) .. "]" + local context = context + local ctx_NC = context.NC + local ctx_NR = context.NR + local ctx_bold = context.bold - local basefile = resolvers.findfile("context.mkxl") - local swapnames = { } + local find = string.find + local gsub = string.gsub + local create = token.create - local pattern = file.join(file.pathpart(basefile),"/*.mk*") - local filenames = dir.glob(pattern) - for i=1,#filenames do - swapnames[file.basename(filenames[i])] = true - end + local crap = "[$>%|%&%#" .. string.char(0xEF) .. "]" - local pattern = file.join(file.pathpart(basefile),"/*.l**") - local filenames = dir.glob(pattern) - for i=1,#filenames do - swapnames[file.basename(filenames[i])] = true - end + local basefile = resolvers.findfile("context.mkxl") + local swapnames = { } - local hashnames = table.setmetatableindex(function(t,k) - local s = file.suffix(k) - local v = k - if s == "mkiv" then - local n = file.replacesuffix(k,"mkxl") - if swapnames[n] then - v = n - end - elseif s == "mkvi" then - local n = file.replacesuffix(k,"mklx") - if swapnames[n] then - v = n - end - elseif s == "lua" then - local n = file.replacesuffix(k,"lmt") - if swapnames[n] then - v = n - end + local pattern = file.join(file.pathpart(basefile),"/*.mk*") + local filenames = dir.glob(pattern) + for i=1,#filenames do + swapnames[file.basename(filenames[i])] = true end - t[k] = v - return v - end) - - require("mtx-interface") - - local data = scripts.interface.editor("data") - local files = data and data.common and data.common.filenames or { } - local flagged = 0 - local total = 0 - local list = tex.hashtokens() - - table.sort(list) - - local function show(visible, check) - -- context.starttabulate { "|l|l|l|lj2|l|l|l|l|l|l|l|l|" } - context.starttabulate { "|l|l|l|lj2|l|l|l|l|l|l|l|l|" } - for i=1,#list do - local k = list[i] - if check(k) then - local v = create(k) - local mutable = v.mutable and "mutable" - local immutable = v.immutable and "immutable" - local frozen = v.frozen and "frozen" - local permanent = v.permanent and "permanent" - local primitive = v.primitive and "primitive" - local instance = v.instance and "instance" - local dealtwith = mutable or immutable or mutable or frozen or permanent or primitive -- beware: we can have combinations - local whatever = find(k,"^[a-z][a-z][a-z]+_") - local cscommand = gsub(v.cmdname or "","_"," ") - local undefined = cscommand == "undefined cs" - local marked = (dealtwith and "+") or (whatever and "-") or (instance and "!") ---if not marked then -if not marked and not find(k,"^[pvm]_") and not find(k,"^![tT]") then - local parameters = v.parameters - local noaligned = v.noaligned and "noaligned" - local filename = files[k] - local csname = context.escape(k) - if undefined then - marked = "?" + + local pattern = file.join(file.pathpart(basefile),"/*.l**") + local filenames = dir.glob(pattern) + for i=1,#filenames do + swapnames[file.basename(filenames[i])] = true + end + + local hashnames = table.setmetatableindex(function(t,k) + local s = file.suffix(k) + local v = k + if s == "mkiv" then + local n = file.replacesuffix(k,"mkxl") + if swapnames[n] then + v = n + end + elseif s == "mkvi" then + local n = file.replacesuffix(k,"mklx") + if swapnames[n] then + v = n end - ctx_NC() if marked then context(marked) end - ctx_NC() if primitive then ctx_bold(csname) else - context(csname) end - ctx_NC() if parameters then context(parameters > 0 and parameters or "-") end - ctx_NC() context(cscommand) - ctx_NC() if primitive then context(primitive) end - ctx_NC() if permanent then context(permanent) end - ctx_NC() if frozen then context(frozen) end - ctx_NC() if immutable then context(immutable) end - ctx_NC() if mutable then context(mutable) end - ctx_NC() if instance then context(instance) end - ctx_NC() if noaligned then context(noaligned) end - ctx_NC() if filename then context(hashnames[filename]) end - ctx_NC() ctx_NR() -end - if visible then - total = total + 1 - if dealtwith then - flagged = flagged + 1 + elseif s == "lua" then + local n = file.replacesuffix(k,"lmt") + if swapnames[n] then + v = n + end + end + t[k] = v + return v + end) + + require("mtx-interface") + + local data = scripts.interface.editor("data") + local files = data and data.common and data.common.filenames or { } + local flagged = 0 + local total = 0 + local list = tex.hashtokens() + local all = not tex.modes.notmarked + + table.sort(list) + + local function show(visible, check) + -- context.starttabulate { "|l|l|l|lj2|l|l|l|l|l|l|l|l|" } + context.starttabulate { "|l|l|l|lj2|l|l|l|l|l|l|l|l|" } + for i=1,#list do + local k = list[i] + if check(k) then + local v = create(k) + local mutable = v.mutable and "mutable" + local immutable = v.immutable and "immutable" + local frozen = v.frozen and "frozen" + local permanent = v.permanent and "permanent" + local primitive = v.primitive and "primitive" + local instance = v.instance and "instance" + local dealtwith = mutable or immutable or mutable or frozen or permanent or primitive -- beware: we can have combinations + local whatever = find(k,"^[a-z][a-z][a-z]+_") + local cscommand = gsub(v.cmdname or "","_"," ") + local undefined = cscommand == "undefined cs" + local marked = (dealtwith and "+") or (whatever and "-") or (instance and "!") + if (all or not marked) and not find(k,"^[pvm]_") and not find(k,"^![tT]") then + local parameters = v.parameters + local noaligned = v.noaligned and "noaligned" + local filename = files[k] + local csname = context.escape(k) + if undefined then + marked = "?" + end + ctx_NC() if marked then context(marked) end + ctx_NC() if primitive then ctx_bold(csname) else + context(csname) end + ctx_NC() if parameters then context(parameters > 0 and parameters or "-") end + ctx_NC() context(cscommand) + ctx_NC() if primitive then context(primitive) end + ctx_NC() if permanent then context(permanent) end + ctx_NC() if frozen then context(frozen) end + ctx_NC() if immutable then context(immutable) end + ctx_NC() if mutable then context(mutable) end + ctx_NC() if instance then context(instance) end + ctx_NC() if noaligned then context(noaligned) end + ctx_NC() if filename then context(hashnames[filename]) end + ctx_NC() ctx_NR() + end + if visible then + total = total + 1 + if dealtwith then + flagged = flagged + 1 + end end end end + context.stoptabulate() end - context.stoptabulate() - end - context.starttitle { title = "Public \\TEX\\ commands" } + context.starttitle { title = "Public \\TEX\\ commands" } show(true, function(k) return find(k,"^[a-zA-Z]+$") end) - context.stoptitle() + context.stoptitle() - context.starttitle { title = "Private \\TEX\\ commands" } - show(false, function(k) return not find(k,"^[a-zA-Z]+$") and not find(k,crap) end) - context.stoptitle() + context.starttitle { title = "Private \\TEX\\ commands" } + show(false, function(k) return not find(k,"^[a-zA-Z]+$") and not find(k,crap) end) + context.stoptitle() - tokens.setters.macro("NumberOfVisible", total) - tokens.setters.macro("NumberOfFlagged", flagged) + tokens.setters.macro("NumberOfVisible", total) + tokens.setters.macro("NumberOfFlagged", flagged) + + end \stopluacode -\page +\startmode[texmacros] -\starttabulate[|c|l|] -\HL -\NC \type {+} \NC mutable, immutable, frozen, permanent, primitive \NC \NR -\NC \type {-} \NC protected by obscurity (underscores) \NC \NR -\NC \type {!} \NC instance (can be frozen) \NC \NR -\NC \type {0-9} \NC the number of arguments (argument grabbing can be delegated) \NC \NR -\HL -\stoptabulate - -\start \hsize 15cm \veryraggedright -Often frozen commands are redefined on demand and they can be overloaded. Mutable -doesn't mean that a user can change it without consequences, for instance the -\type {\current...} ones. Primitives come with the engine, permanent macros are -the core of \CONTEXT. Noaligned macros are special and dealt deep down when -scanning for alignment specific primitives. -\par \stop - -\starttabulate[||r|] -\BC number of visible macros \NC \NumberOfVisible \NC \NR -\BC number of flagged macros \NC \NumberOfFlagged \NC \NR -\stoptabulate - -\stoptext + \page -\page + \starttabulate[|c|l|] + \HL + \NC \type {+} \NC mutable, immutable, frozen, permanent, primitive \NC \NR + \NC \type {-} \NC protected by obscurity (underscores) \NC \NR + \NC \type {!} \NC instance (can be frozen) \NC \NR + \NC \type {0-9} \NC the number of arguments (argument grabbing can be delegated) \NC \NR + \HL + \stoptabulate + + \start \hsize 15cm \veryraggedright + Often frozen commands are redefined on demand and they can be overloaded. Mutable + doesn't mean that a user can change it without consequences, for instance the + \type {\current...} ones. Primitives come with the engine, permanent macros are + the core of \CONTEXT. Noaligned macros are special and dealt deep down when + scanning for alignment specific primitives. + \par \stop -% \startMPcalculation -% % force a format -% \stopMPcalculation + \starttabulate[||r|] + \BC number of visible macros \NC \NumberOfVisible \NC \NR + \BC number of flagged macros \NC \NumberOfFlagged \NC \NR + \stoptabulate + +\stopmode + +\page \startluacode - local context = context - -- local ctx_NC = context.NC - -- local ctx_NR = context.NR - -- local ctx_bold = context.bold - - local find = string.find - local gsub = string.gsub - local create = token.create - - context.starttitle { title = "\\METAFUN\\ commands" } - - metapost.simple("prestine") - - local mptotal = 0 - local codes = metapost.codes - local types = metapost.types - local parameters = metapost.knownparameters - local procodes = mplib.propertycodes - - context.startcolumns { n = 5, distance = "1em" } - context.nohyphens(false) - context.obeyspaces(false) - local t = metapost.gethashentries("prestine",true) -- prestine:1 - if t then - table.sort(t,function(a,b) return a[3] < b[3] end) - mptotal = #t - for i=1,mptotal do - local ti = t[i] - local code = codes[ti[1]] - local property = procodes[ti[2]] - local name = ti[3] - local vtype = ti[4] - local vardef = vtype and types[vtype] == "unsuffixedmacro" - context.bgroup() - -- context("%-15s\\quad",vardef and "(vardef) tag" or code) - context("%s %-15s\\quad",parameters[name] and "+" or "\\nbsp",vardef and "(vardef) tag" or code) - if property == "primitive" then - context.bf(false) - context.blue(false) - elseif property == "permanent" then - context.bf(false) - context.lightgreen(false) - elseif property == "immutable" then - context.bf(false) - context.lightcyan(false) - elseif property == "mutable" then - context.bf(false) - context.lightmagenta(false) - elseif not find(name,"^%a+_") then - -- todo: - if vardef then + if tex.modes.metapostmacros then + + local context = context + -- local ctx_NC = context.NC + -- local ctx_NR = context.NR + -- local ctx_bold = context.bold + + local find = string.find + local gsub = string.gsub + local create = token.create + + context.starttitle { title = "\\METAFUN\\ commands" } + + metapost.simple("prestine") + + local mptotal = 0 + local codes = metapost.codes + local types = metapost.types + local parameters = metapost.knownparameters + local procodes = mplib.propertycodes + + context.startcolumns { n = 5, distance = "1em" } + context.nohyphens(false) + context.obeyspaces(false) + local t = metapost.gethashentries("prestine",true) -- prestine:1 + if t then + table.sort(t,function(a,b) return a[3] < b[3] end) + mptotal = #t + for i=1,mptotal do + local ti = t[i] + local code = codes[ti[1]] + local property = procodes[ti[2]] + local name = ti[3] + local vtype = ti[4] + local vardef = vtype and types[vtype] == "unsuffixedmacro" + context.bgroup() + -- context("%-15s\\quad",vardef and "(vardef) tag" or code) + context("%s %-15s\\quad",parameters[name] and "+" or "\\nbsp",vardef and "(vardef) tag" or code) + if property == "primitive" then + context.bf(false) + context.blue(false) + elseif property == "permanent" then context.bf(false) - context.lightred(false) + context.lightgreen(false) + elseif property == "immutable" then + context.bf(false) + context.lightcyan(false) + elseif property == "mutable" then + context.bf(false) + context.lightmagenta(false) + elseif not find(name,"^%a+_") then + -- todo: + if vardef then + context.bf(false) + context.lightred(false) + end end + context.verbatim(name) + context.egroup() + context.par() end - context.verbatim(name) - context.egroup() - context.par() end - end - context.stopcolumns() + context.stopcolumns() - context.stoptitle() + context.stoptitle() - tokens.setters.macro("NumberOfMetafun", mptotal) + tokens.setters.macro("NumberOfMetafun", mptotal) + + end \stopluacode -\page +\startmode [metapostmacros] + + \page + + \starttabulate[|c|l|] + \HL + \NC \type {-3} \NC \bf \lightmagenta mutable \NC \NR + \NC \type {1} \NC \bf \blue primitive \NC \NR + \NC \type {2} \NC \bf \lightgreen permanent \NC \NR + \NC \type {3} \NC \bf \lightcyan immutable \NC \NR + \NC \type {+} \NC \bf (also) used as key \NC \NR + \HL + \stoptabulate + + \starttabulate[||r|] + \BC number of metafun entries \NC \NumberOfMetafun \NC \NR + \stoptabulate -\starttabulate[|c|l|] -\HL -\NC \type {-3} \NC \bf \lightmagenta mutable \NC \NR -\NC \type {1} \NC \bf \blue primitive \NC \NR -\NC \type {2} \NC \bf \lightgreen permanent \NC \NR -\NC \type {3} \NC \bf \lightcyan immutable \NC \NR -\NC \type {+} \NC \bf (also) used as key \NC \NR -\HL -\stoptabulate - -\starttabulate[||r|] -\BC number of metafun entries \NC \NumberOfMetafun \NC \NR -\stoptabulate - -\stoptext +\stopmode \stopmodule diff --git a/tex/context/modules/mkxl/s-colors-show.mkxl b/tex/context/modules/mkxl/s-colors-show.mkxl new file mode 100644 index 000000000..7467acd4c --- /dev/null +++ b/tex/context/modules/mkxl/s-colors-show.mkxl @@ -0,0 +1,276 @@ +%D \module +%D [ file=colo-run, +%D version=1997.04.01, +%D title=\CONTEXT\ Color Macros, +%D subtitle=Runtime loaded commands, +%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. + +\registerctxluafile{colo-run}{} + +\unprotect + +%D Colors + +%D These are nicer in \LUA\ code than in \TEX\ code but not more efficient. + +\permanent\protected\gdef\showcolorbar[#1]% + {\backgroundline[#1]{\strut\enspace\color[white]{white}\enspace\color[black]{black}\enspace}} + +\permanent\protected\tolerant\gdef\showcolorset[#1]% + {\ctxcommand{showcolorset("#1")}} + +\permanent\protected\tolerant\gdef\showcolorcomponents[#1]% + {\ctxcommand{showcolorcomponents("#1")}} + +\permanent\protected\tolerant\gdef\showcolor[#1]% + {\ifparameter#1\or + \usecolors [#1]% delayed and we can only ask for the set if + \showcolorset[#1]% loading has happened + \fi} + +%D The rest might also be done in \LUA\ although there is not much beauty to gain +%D here (too much typesetting specific). Also, these macros are pretty old and +%D hardly used so best keep them as they are. But we keep them because they always +%D worked and it doesn't hurt to see some \MKII|-|code every now and then. + +%D Palets + +permanent\protected\tolerant\gdef\showpalet[#1]#*[#2]% + {\doifelsecolorpalet{#1} + {\doifelseinset\v!vertical{#2}\colo_palets_show_vertical\colo_palets_show_horizontal{#1}{#2}}% + {}} + +\gdef\colo_palets_show_vertical#1#2% + {\begingroup + \forgetall + \setlocalhsize + \hsize\localhsize + \offinterlineskip + \setuppalet[#1] + \tabskip\zeropoint + \def\colo_palets_show_palet##1% + {\doifelseinset\v!number{#2}{##1\hskip.5\emwidth}{}% + \aligntab + \color [##1]{\vrule\s!width3\emwidth\s!height\strutht\s!depth\strutdp}% + \graycolor[##1]{\vrule\s!width3\emwidth\s!height\strutht\s!depth\strutdp}% + \aligntab + \doifinset\v!value{#2}{\hskip.5\emwidth\colorvalue{##1}}% + \crcr} + \halign + {\hss\alignmark\alignmark\aligntab\hss\alignmark\alignmark\hss\aligntab\alignmark\alignmark\cr + \aligntab\doifinset\v!name{#2}{\strut#1}\aligntab\cr + \colo_palets_process[#1]\colo_palets_show_palet\crcr}% + \endgroup} + +\gdef\colo_palets_show_horizontal#1#2% todo: bTABLE etc + {\vbox + {\forgetall + \setlocalhsize + \hsize\localhsize + \offinterlineskip + \setuppalet[#1] + \tabskip\zeropoint + \scratchwidth\zeropoint + \doifinset\v!number{#2} + {\def\colo_palets_show_palet##1% + {\setbox\scratchbox\hbox{##1}% + \ifdim\scratchwidth<\wd\scratchbox + \scratchwidth\wd\scratchbox + \fi}% + \colo_palets_process[#1]\colo_palets_show_palet}% + \advance\scratchwidth\emwidth + \ifdim\scratchwidth<5\emwidth + \scratchwidth5\emwidth + \fi + \halign + {\alignmark\alignmark\aligntab\aligntab\hbox to \scratchwidth{\hss\alignmark\alignmark\hss}\cr + \doifinset\v!number{#2} + {\def\colo_palets_show_palet##1{\aligntab\strut##1}% + \colo_palets_process[#1]\colo_palets_show_palet}\cr + \doifinset\v!name{#2}{#1\hskip.5\emwidth}% + \def\colo_palets_show_palet##1% + {\aligntab\strut\color[##1]{\vrule\s!width\scratchwidth\s!height\strutht\s!depth\zeropoint}}% + \colo_palets_process[#1]\colo_palets_show_palet\crcr + \noalign{\vskip-\strutdepth}% + \def\colo_palets_show_palet##1% + {\aligntab\graycolor[##1]{\vrule\s!width\scratchwidth\s!height\zeropoint\s!depth\strutdp}}% + \colo_palets_process[#1]\colo_palets_show_palet\crcr + \doifinset\v!value{#2} + {\def\colo_palets_show_palet##1% + {\aligntab\vbox + {\hsize\scratchwidth + \vskip.25\exheight + \everypar{\strut} + \veryraggedcenter + \let\colorformatseparator\endgraf + \colorvalue{##1}}}% + \colo_palets_process[#1]\colo_palets_show_palet}% + \crcr}}} + +\gdef\colo_palets_process[#1]% + {\getpaletlist[#1]% + \normalexpanded{\globalprocesscommalist[\paletlist]}} + +\permanent\protected\tolerant\gdef\comparepalet[#1]% + {\doifelsecolorpalet{#1}% + {\hbox + {\colo_palets_compare_indeed\color{#1}% + \quad + \colo_palets_compare_indeed\graycolor{#1}}}% + {}} + +\gdef\colo_palets_compare_indeed#1#2% + {\vbox + {\forgetall + \setlocalhsize + \hsize\localhsize + \offinterlineskip + \setuppalet[#2] + \getpaletsize[#2]% + \getpaletlist[#2]% + \scratchwidth2\emwidth\relax + \hsize\paletsize\scratchwidth + \def\colo_palets_compare##1% + {\hbox + {\setbox0\hbox + {#1[##1]{\vrule\s!width\hsize\s!height3ex}}% + \wd0\zeropoint + \box0 + \hbox to \hsize + {\def\colo_palets_compare####1% + {\hbox to \scratchwidth + {\hss#1[####1]{\vrule\s!width.5\scratchwidth\s!height2.25\exheight\s!depth-.75\exheight}\hss}}% + \processcommacommand[\paletlist]\colo_palets_compare}} + \endgraf} + \processcommacommand[\paletlist]\colo_palets_compare}} + +%D Groups + +permanent\protected\tolerant\gdef\showcolorgroup[#1]#*[#2]% + {\doifcolor{#1:1} + {\doifelseinset\v!vertical{#2}\colo_groups_show_vertical\colo_groups_show_horizontal{#1}{#2}}} + +\gdef\colo_groups_show_horizontal#1#2% + {\vbox + {\forgetall + \setlocalhsize + \hsize\localhsize + \offinterlineskip + \setuppalet + \tabskip\zeropoint + \def\colorformatseparator{\strut\cr} + \def\colo_groups_show_group##1% + {\doifcolor{#1:##1}{\vbox + {\halign + {\hss\alignmark\alignmark\alignmark\alignmark\hss\cr + \doifinset\v!number{#2}{\strut##1}\cr + \color [#1:##1]{\vrule\s!width4\emwidth\s!height\strutht \s!depth\zeropoint}\cr + \graycolor[#1:##1]{\vrule\s!width4\emwidth\s!height\zeropoint\s!depth\strutdp }\cr + \doifinset\v!value{#2}{\colorvalue{#1:##1}\strut}\crcr}}}}% + \hbox + {\doifinset\v!name{#2} + {\strut + \doifelseinset\v!value{#2} + {\raise3\lineheight\hbox{#1\hskip.5\emwidth}} + {#1}% + \hskip.5\emwidth}% + \colo_groups_show_group1\colo_groups_show_group2\colo_groups_show_group3\colo_groups_show_group4% + \colo_groups_show_group5\colo_groups_show_group6\colo_groups_show_group7\colo_groups_show_group8}}} + +\gdef\colo_groups_show_vertical#1#2% + {\vbox + {\forgetall + \setlocalhsize + \hsize\localhsize + \offinterlineskip + \setuppalet + \tabskip\zeropoint + \def\colo_groups_show_group##1% + {\doifcolor{#1:##1} + {\doifinset\v!number{#2} + {##1\hskip.5\emwidth}% + \aligntab + \color [#1:##1]{\vrule\s!width2.5\emwidth\s!height\strutht\s!depth\strutdp}% + \graycolor[#1:##1]{\vrule\s!width2.5\emwidth\s!height\strutht\s!depth\strutdp} + \aligntab + \doifinset\v!value{#2}{\hskip.5\emwidth\colorvalue{#1:##1}}% + \crcr}}% + \halign + {\hss\alignmark\alignmark\aligntab\hss\alignmark\alignmark\hss\aligntab\alignmark\alignmark\hss\cr + \aligntab\doifinset\v!name{#2}{\strut#1}\aligntab\crcr + \colo_groups_show_group1\colo_groups_show_group2\colo_groups_show_group3\colo_groups_show_group4% + \colo_groups_show_group5\colo_groups_show_group6\colo_groups_show_group7\colo_groups_show_group8}}} + +\permanent\protected\tolerant\gdef\comparecolorgroup[#1]% + {\doifcolor{#1:1} + {\hbox + {\colo_groups_compare_indeed\color {#1}\quad + \colo_groups_compare_indeed\graycolor{#1}}}} + +\gdef\colo_groups_compare_indeed#1#2% + {\vbox + {\forgetall + \setlocalhsize + \hsize\localhsize + \scratchcounter\zerocount + \dorecurse{15}{\doifcolor{#2:\recurselevel}{\advance\scratchcounter\plusone}} + \scratchwidth2\emwidth\relax + \hsize\scratchcounter\scratchwidth + \dorecurse\scratchcounter{\colo_groups_compare_step{#1}{#2}\recurselevel}}} + +\def\colo_groups_compare_step#1#2#3% + {\hbox to \hsize + {\setbox\scratchbox\hbox + {#1[#2:#3]{\vrule\s!width\hsize\s!height3\exheight}}% + \wd\scratchbox\zeropoint + \box\scratchbox + \hbox to \hsize + {\hss + \dorecurse\scratchcounter + {#1[#2:\recurselevel]{\vrule\s!width.5\scratchwidth\s!height2.25\exheight\s!depth-.75\exheight}% + \hss}}} + \endgraf} + +\protect + +\continueifinputfile{s-colors-show.mkxl} + +\setupwhitespace[big] + +\usecolors[dem] + +\starttext + +\startsubject[title=\type{\showpalet}] + \showpalet [alfa] [horizontal,name,number,value] +\stopsubject + +\startsubject[title=\type{\showcolorcomponents}] + \showcolorcomponents[red,green,blue] +\stopsubject + +\startsubject[title=\type{\comparepalet}] + \comparepalet[alfa] +\stopsubject + +\startsubject[title=\type{\showcolor}] + \showcolor[rgb] +\stopsubject + +\startsubject[title=\type{\showcolorgroup}] + \showcolorgroup[magenta] + \showcolorgroup[cyan] + \showcolorgroup[yellow] +\stopsubject + +\startsubject[title=\type{\comparecolorgroup}] + \comparecolorgroup[magenta] +\stopsubject + +\stoptext diff --git a/tex/context/modules/mkxl/s-fonts-show.mkxl b/tex/context/modules/mkxl/s-fonts-show.mkxl new file mode 100644 index 000000000..4b6fbf998 --- /dev/null +++ b/tex/context/modules/mkxl/s-fonts-show.mkxl @@ -0,0 +1,661 @@ +%D \module +%D [ file=font-run, +%D version=1998.09.11, % (second) +%D version=2001.02.20, % (third) +%D title=\CONTEXT\ Font Macros, +%D subtitle=Runtime Macros, +%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 [This code is hooked into the core macros and saves some format +%D space. It needs a cleanup as it's real old derioved \MKII\ code] +%D +%D Better use \type{\bTABLE...\eTABLE}. + +\unprotect + +\gdef\module_fonts_show_prepare#1% + {\iftok{#1}\emptytoks + \edef\m_module_fonts_show_title{\the\bodyfontsize}% + \else + \switchtobodyfont[#1]% + \edef\m_module_fonts_show_title{#1}% + \fi + \ifempty\fontclass + \edef\m_module_fonts_show_title{[\m_module_fonts_show_title]}% + \orelse\ifx\fontclass\m_module_fonts_show_title + \edef\m_module_fonts_show_title{[\m_module_fonts_show_title]}% + \else + \edef\m_module_fonts_show_title{[\fontclass]\space[\m_module_fonts_show_title]}% + \fi} + +\permanent\protected\tolerant\gdef\showbodyfont[#1]% + {\ifinsidefloat\else\startbaselinecorrection\fi + \vbox + {\module_fonts_show_prepare{#1}% + \def\next##1##2##3##4% + {\bTR + \bTD{##4}\type{##1}\eTD + \bTD{##4}##1##3{\tf ##2}\eTD + \bTD{##4}##1##3{\tf ##2}\eTD + \bTD{##4}##1##3{\bf ##2}\eTD + \bTD{##4}##1##3{\sl ##2}\eTD + \bTD{##4}##1##3{\it ##2}\eTD + \bTD{##4}##1##3{\bs ##2}\eTD + \bTD{##4}##1##3{\bi ##2}\eTD + \bTD{##4}##1##3{\tfx ##2}\eTD + \bTD{##4}##1##3{\tfxx ##2}\eTD + \bTD{##4}##1##3{\tfa ##2}\eTD + \bTD{##4}##1##3{\tfb ##2}\eTD + \bTD{##4}##1##3{\tfc ##2}\eTD + \bTD{##4}##1##3{\tfd ##2}\eTD + \eTR}% + \bTABLE[\c!align=\v!middle,\c!loffset=.5ex,\c!roffset=.5ex] + \bTR\bTD[\c!nx=14,\c!offset=1ex]\tttf{\m_module_fonts_show_title}\eTD\eTR + \next{}{}\type{}% + \next\rm{\languageparameter\c!text}\relax{\tfd\setstrut\strut}% + \next\ss{\languageparameter\c!text}\relax{\tfd\setstrut\strut}% + \next\tt{\languageparameter\c!text}\relax{\tfd\setstrut\strut}% + \next\mr{\languageparameter\c!text}\mathematics{\tfd\setstrut\strut}% + \eTABLE}% + \ifinsidefloat\else\stopbaselinecorrection\fi} + +\permanent\protected\tolerant\gdef\showbodyfontenvironment[#1]% + {\ifinsidefloat\else\startbaselinecorrection\fi + \vbox + {\module_fonts_show_prepare{#1}% + \def\next##1##2% + {\bTR + \bTD##1\bodyfontsizevariable{##2}\s!text\eTD + \bTD##1\bodyfontsizevariable{##2}\s!script\eTD + \bTD##1\bodyfontsizevariable{##2}\s!scriptscript\eTD + \bTD##1\bodyfontsizevariable{##2}\s!x\eTD + \bTD##1\bodyfontsizevariable{##2}\s!xx\eTD + \bTD##1\bodyfontsizevariable{##2}\v!small\eTD + \bTD##1\bodyfontsizevariable{##2}\v!big\eTD + %\bTD##1\bodyfontsizevariable{##2}\c!interlinespace\eTD + \eTR}% + \def\nextone{\next\relax}% + \bTABLE[\c!align=\v!middle,\c!loffset=.5ex,\c!roffset=.5ex] + \bTR\bTD[\c!nx=7,\c!offset=1ex]\tttf{\m_module_fonts_show_title}\eTD\eTR + \next{\tttf\thirdofthreearguments}\relax + \processbodyfontenvironmentlist{nextone} + \eTABLE}% + \ifinsidefloat\else\stopbaselinecorrection\fi} + +\permanent\protected\tolerant\gdef\showfont[#1]#*[#2]% + {\bgroup + \iftok{#1}\emptytoks\else + \definedfont[#1]% + \ifdim2.5\emwidth>.05\hsize + \tx + \ifdim2.5\emwidth>.05\hsize + \txx + \fi + \fi + \fi + \integerdef\c_module_fonts_font_id\fontid\font + \doifelsenothing{#2} + {\module_fonts_show_font_indeed{#1}\zerocount} + {\doifelse{#2}\v!all + {\dostepwiserecurse\zerocount{255}\plusone + {\scratchcounterone \recurselevel + \scratchcountertwo \numexpr\scratchcounterone*256\relax + \scratchcounterthree\numexpr\scratchcountertwo+255\relax + \doloop + {\iffontchar\font\scratchcountertwo + \module_fonts_show_font_indeed{#1}\scratchcounterone + \exitloop + \orelse\ifnum\scratchcountertwo=\scratchcounterthree + \exitloop + \else + \advance\scratchcountertwo\plusone + \fi}}} + {\processcommalist[#2]{\module_fonts_show_font_indeed{#1}}}}% + \egroup} + +\gdef\module_fonts_show_font_indeed#1#2% made some 50% faster but still slow + {\bgroup + \ifinsidefloat\else\startbaselinecorrection\fi + \vbox\bgroup + \scratchdimenone 2.5\emwidth + \scratchdimentwo 2.4\emwidth + \scratchdimenthree2.3\emwidth + \edef\charplane{\number#2}% + \forgetall + \startoverlay % easier in cld + {\vbox + {\tf + \setstrut + \setfontid\c_module_fonts_font_id + \offinterlineskip + \unexpanded\def\wrapbox##1% + {\vpack to \scratchdimenone + {\vss + \hpack to \scratchdimenone + {\setfontid\c_module_fonts_font_id + \ifzeropt\interwordspace + \setbox##1\hpack{\raise.5\dp##1\hpack{\lower.5\ht##1\copy##1}}% + \ht##1\zeropoint + \dp##1\zeropoint + \else + \ht##1\strutht + \dp##1\strutdp + \strut + \fi + \hss\copy##1\hss} + \vss}}% + \unexpanded\def\textbox##1% + {\vpack to \scratchdimentwo + {\hsize\scratchdimenthree + ##1% + \par}}% + \unexpanded\def\scratchnum + {\blue + \tinyfont + \hfill + \number\scratchcounter + \vfill + \octnumber\scratchcounter + \hfill + \lchexnumbers\scratchcounter}% + \setbox\scratchboxone\hpack{\tf\textbox{}}% + \setbox\scratchboxtwo\hpack{\tf\gray\vrule\s!width\exheight\s!height.5\exheight\s!depth.5\exheight}% + \setbox\scratchboxtwo\wrapbox\scratchboxtwo + \setbox\scratchboxthree\hpack + {\startoverlay + {\box\scratchboxtwo} + {\box\scratchboxone} + \stopoverlay}% + \dostepwiserecurse\zerocount{15}\plusone + {\scratchcounterone\recurselevel + \hpack + {\dostepwiserecurse\zerocount{15}\plusone + {\scratchcountertwo \recurselevel + \scratchcounter \numexpr\scratchcounterone*16+\scratchcountertwo\relax + \scratchcounterthree\numexpr\charplane*256+\scratchcounter\relax + \iffontchar\font\scratchcounterthree + \setbox\scratchbox\ruledhpack{\char\scratchcounterthree}% + \bgroup + \tf + \startoverlay + {\wrapbox\scratchbox} + {\textbox\scratchnum} + \stopoverlay + \egroup + \else + \copy\scratchboxthree + \fi}}}% + \par}} + {\tf\basegrid[\c!nx=16,\c!ny=16,\c!dx=2.5,\c!dy=2.5,\c!unit=em]} + \stopoverlay + \nointerlineskip + \vskip2\points + % the \noexpand before \blank is needed for non etex + \edef\theshowfontspecs{name: {\noexpand\black\fontname\font}\quad plane: \charplane\enspace"\hexnumber\charplane}% + \tf % also sets em + \hbox to 40\emwidth{\blue\hfill\tinyfont\setstrut\strut\theshowfontspecs} + \egroup + \ifinsidefloat\else\stopbaselinecorrection\fi + \egroup} + +% \showfontstyle[modern][rm][tf][all] % #2, #3 and #4 can be 'all' +% +% no lists any more, so no 'all' any longer +% no need to clean this up + +\permanent\protected\tolerant\gdef\showfontstyle[#1]#*[#2]#*[#3]#*[#4] + {\bgroup + \edef\m_module_fonts_show_styles {\iftok{#2}\emptytoks\s!rm,\s!ss,\s!tt,\s!mm\else#2\fi}% + \edef\m_module_fonts_show_alternatives{\iftok{#3}\emptytoks\s!tf,\s!bf,\s!it,\s!sl,\s!bs,\s!bi\else#3\fi}% + \iftok{#1}\emptytoks\else + \switchtobodyfont[#1] + \fi + \raggedright + \protected\def\dododocommand##1% + {\dostepwiserecurse\zerocount{255}\plusone + {\scratchcounter\numexpr##1*256+\recurselevel\relax + \iffontchar\font\scratchcounter\relax + \char\scratchcounter + \space + \fi}}% + \protected\def\dodocommand##1##2% + {\starttextrule{\tttf #1 ##1 ##2} + \nobreak\getvalue{##2}% + \doifelsenothing{#4} + {\dododocommand\zerocount} + {\doifelse{#4}\v!all + {\dostepwiserecurse\zerocount{255}\plusone{\normalexpanded{\dododocommand{\recurselevel}}}} + {\processcommalist[#4]{\dododocommand}}}% + \par \nobreak + \stoptextrule} + \protected\def\docommand##1% + {\getvalue{##1}% + \processcommacommand[\m_module_fonts_show_alternatives]{\dodocommand{##1}}} + \processcommacommand[\m_module_fonts_show_styles]\docommand + \egroup} + +\permanent\protected\gdef\showligature#1% + {\hbox{\type{#1}\enspace\showglyphs#1}} + +\permanent\protected\tolerant\gdef\showligatures[#1]% we keep it around for compatibility reasons + {\bgroup + \def\module_fonts_show_ligature##1{\hbox{\showglyphs##1}}% + \doifsomething{#1}{\definedfont[#1*default]}% + \starttabulate[|*{7}{c|}] + \NC\type{ff} + \NC\type{fi} + \NC\type{fl} + \NC\type{ffi} + \NC\type{ffl} + \NC\type{--} + \NC\type{---} + \NC\NR + \NC\module_fonts_show_ligature{ff} + \NC\module_fonts_show_ligature{fi} + \NC\module_fonts_show_ligature{fl} + \NC\module_fonts_show_ligature{ffi} + \NC\module_fonts_show_ligature{ffl} + \NC\module_fonts_show_ligature{--} + \NC\module_fonts_show_ligature{---} + \NC\NR + \stoptabulate + \egroup} + +\permanent\protected\gdef\showkerning + {\groupedcommandcs\showfontkerns\relax} + +\permanent\gdef\module_fonts_char_ratio#1#2% + {\ifzeropt\nextboxhtdp\else + \cldcontext{\number#1/\number\nextboxhtdp}% + \fi} + +\permanent\protected\gdef\showcharratio + {\dowithnextboxcontent + {\switchtobodyfont[10pt]}% + {\starttabulate[|l|l|l|] + \NC height \NC \the\nextboxht \NC \module_fonts_char_ratio\nextboxht \NC \NR + \NC depth \NC \the\nextboxdp \NC \module_fonts_char_ratio\nextboxdp \NC \NR + \stoptabulate} + \hbox} + +\permanent\protected\gdef\showfontparameters + {\starttabulate[|tl|l|] + \NC \type {\slantperpoint} \NC \the\fontslantperpoint \font \NC\NR + \NC \type {\interwordspace} \NC \the\fontinterwordspace \font \NC\NR + \NC \type {\interwordstretch} \NC \the\fontinterwordstretch\font \NC\NR + \NC \type {\interwordshrink} \NC \the\fontinterwordshrink \font \NC\NR + \NC \type {\exheight} \NC \the\fontexheight \font \NC\NR + \NC \type {\emwidth} \NC \the\fontemwidth \font \NC\NR + \NC \type {\extraspace} \NC \the\fontextraspace \font \NC\NR + \stoptabulate} + +\unexpanded\gdef\module_fonts_show_minimal_baseline#1% to be used in a 10 column tabulate + {\setbox\scratchbox\ruledhbox{#1}% + \normalexpanded { + \NC \ruledhbox{#1}% + \NC -> + \NC \the\htdp\scratchbox + \NC = + \NC \the\ht\scratchbox + \NC + + \NC \the\dp\scratchbox + \NC \ifcmpdim\htdp\scratchbox\baselineskip <\or=\or>\fi + \NC \the\baselineskip + \NC (\ifdim\htdp\scratchbox>\baselineskip not \fi ok) + \NC \NR}} + +\permanent\protected\gdef\showminimalbaseline + {\starttabulate[|l|T|T|T|T|T|T|T|T|T|] + \module_fonts_show_minimal_baseline{\hbox to \emwidth{\hss\showstruts\strut\hss}}% + \module_fonts_show_minimal_baseline{(/)}% + \module_fonts_show_minimal_baseline{\normalstartimath\frac{1}{2}x\normalsuperscript2\normalsubscript3\normalstopimath} + \stoptabulate} + +\permanent\protected\tolerant\gdef\showfontstrip[#1]% + {\bgroup + \def\module_fonts_show_strip_a##1##2% + {\tttf\string##1} + \def\module_fonts_show_strip_b##1##2% + {\ruledhbox{\switchtobodyfont[#1]##1{##2}}} + \def\module_fonts_show_strip_c##1##2% + {\setbox\scratchbox\hbox{\switchtobodyfont[#1]##1{##2}}% + \tt\tfx\the\ht\scratchbox}% + \def\module_fonts_show_strip_d##1##2% + {\setbox\scratchbox\hbox{\switchtobodyfont[#1]##1{##2}}% + \tt\tfx\the\wd\scratchbox}% + \def\module_fonts_show_strip_indeed##1##2##3% + {\NC##2\rm{##3}\NC + ##2\ss{##3}\NC + ##2\tt{##3}\NC + ##2\mathematics{##3}\NC + \tttf##1\NR} + \starttabulate[|c|c|c|c|c|] + \module_fonts_show_strip_indeed\relax\module_fonts_show_strip_a\empty + \TB + \module_fonts_show_strip_indeed\relax\module_fonts_show_strip_b{xxxx} + \module_fonts_show_strip_indeed\relax\module_fonts_show_strip_b{12345} + \module_fonts_show_strip_indeed\relax\module_fonts_show_strip_b{(Agw)} + \TB + \module_fonts_show_strip_indeed{(x height)}\module_fonts_show_strip_c{x} + \module_fonts_show_strip_indeed{(m width)}\module_fonts_show_strip_d{m} + \stoptabulate + \egroup} + +%D This is now moved here as there is no reason to have it in the core. Some of +%D the helpers might move to a more protected namespace. + +\newbox\otfcollector + +\permanent\protected\gdef\startotfcollecting{\ctxlua{nodes.tracers.steppers.start()}} +\permanent\protected\gdef\stopotfcollecting {\ctxlua{nodes.tracers.steppers.stop()}} +\permanent\protected\gdef\resetotfcollecting{\ctxlua{nodes.tracers.steppers.reset()}} + +% \page \showotfcomposition{arabtype*arab-default at 48pt}{-1}{الضَّرَّ} \page +% \page \showotfcomposition{arabtype*arab-default at 48pt}{-1}{لِلّٰهِ} \page + +\permanent\protected\gdef\showotfstepglyphs#1% + {\ctxlua{nodes.tracers.steppers.glyphs(\number\otfcollector,#1)}% + \unhbox\otfcollector} + +\permanent\protected\gdef\otfstepspace + {\removeunwantedspaces + \hskip.5\emwidth \s!plus .125\emwidth \s!minus .125\emwidth\relax} + +\permanent\protected\gdef\otfstepcharcommand#1#2#3% font char class + {\otfstepspace + \doif{#3}{mark}{\underbar}{U+\hexnumber{#2}}:% + \setbox\scratchbox\hbox{\ctxlua{nodes.tracers.fontchar(#1,#2)}}% + \ifzeropt\wd\scratchbox + \scratchwidth.125\onepoint + \scratchdistance\dimexpr(\emwidth/2-\scratchwidth)\relax + \kern\scratchdistance + \ruledhbox to \scratchwidth{\hss\box\scratchbox\hss}% + \kern-\scratchwidth + \hskip\scratchdistance + \else + \ruledhbox{\box\scratchbox}% + \fi + \otfstepspace} + +\permanent\protected\gdef\otfstepfontcommand#1#2#3% id font size + {\begingroup + \tttf #1: #2 @ \the\dimexpr#3\scaledpoint\relax + \endgroup} + +\permanent\protected\gdef\otfstepmessagecommand#1#2% + {\begingroup + \tttf\language\minusone + \veryraggedright + \forgetparindent + \forgeteverypar + \hangindent\emwidth + \hangafter\plusone + \dontleavehmode\detokenize{#1}\removeunwantedspaces + \doifsomething{#2}{,\space\detokenize{#2}}\endgraf + \endgroup + \blank} + +\permanent\protected\gdef\showotfstepfont + {\ctxlua{nodes.tracers.steppers.font("otfstepfontcommand")}} + +\permanent\protected\gdef\showotfstepchars#1% + {\ctxlua{nodes.tracers.steppers.codes(#1,"otfstepcharcommand","otfstepspace")}} + +\permanent\protected\gdef\showotfstepmessages#1% + {\ctxlua{nodes.tracers.steppers.messages(#1,"otfstepmessagecommand",true)}} + +\permanent\protected\gdef\showotfstepfeatures + {\ctxlua{nodes.tracers.steppers.features()}} + +\permanent\protected\gdef\otfnoffeaturesteps + {\ctxlua{nodes.tracers.steppers.nofsteps()}} + +\newconstant\showotfstepsmode \showotfstepsmode\plusfour + +\protected\gdef\showotfsteps_n + {\blank + \begingroup + \advance\leftskip6\emwidth + \showotfstepmessages\recurselevel + \par + \endgroup + \blank + \dontleavehmode + \hbox to \hsize \bgroup + \hbox to 6\emwidth \bgroup + \bf + \ifnum\recurselevel=\scratchcounter result\else step \recurselevel\fi + \hss + \egroup + \vtop \bgroup + \hsize\dimexpr\hsize-6\emwidth\relax + \resetallattributes + \lefttoright + \dontleavehmode + \ifnum\recurselevel=\scratchcounter + \ruledhbox{\box\otfcompositionbox}% + \else + \ruledhbox{\showotfstepglyphs\recurselevel}% + \fi + \quad + \showotfstepchars\recurselevel + \hfill + \par + \egroup + \egroup + \blank} + +\permanent\protected\gdef\showotfsteps + {\begingroup + \veryraggedright + \forgetparindent + \forgeteverypar + \tt + \lefttoright + \hbox to \hsize \bgroup + \hbox to 6\emwidth{\bf font\hss}% + \vtop \bgroup + \hsize\dimexpr\hsize-6\emwidth\relax + \language\minusone + \bf + \showotfstepfont + \egroup + \egroup + \blank + \hbox to \hsize \bgroup + \hbox to 6\emwidth{\bf features\hss}% + \vtop \bgroup + \hsize\dimexpr\hsize-6\emwidth\relax + \language\minusone + \showotfstepfeatures + \egroup + \egroup + \blank + \scratchcounter\otfnoffeaturesteps\relax + \dorecurse\scratchcounter + {\ifcase\showotfstepsmode + \or % 1 = only first + \ifnum\recurselevel=\plusone + \showotfsteps_n + \fi + \or % 2 = only last + \ifnum\recurselevel=\scratchcounter + \showotfsteps_n + \fi + \or % 3 = first and last + \ifnum\recurselevel=\plusone + \showotfsteps_n + \orelse\ifnum\recurselevel=\scratchcounter + \showotfsteps_n + \fi + \else % everything + \showotfsteps_n + \fi}% + \endgroup} + +\permanent\protected\gdef\startotfsample + {\enabletrackers[otf.sample.silent]% beware, kind of global + \startotfcollecting + \begingroup + \veryraggedright + \forgetparindent + \forgeteverypar} + +\permanent\protected\gdef\stopotfsample + {\endgroup + \stopotfcollecting + \disabletrackers[otf.sample]% beware, kind of global: otf.sample + \showotfsteps + \resetotfcollecting} + +\newbox\otfcompositionbox + +% this should go in spac-ali: + +\installcorenamespace{otfcompositiondir} + +\gletcsname\??otfcompositiondir -1\endcsname\righttoleft +\gletcsname\??otfcompositiondir r2l\endcsname\righttoleft +\gletcsname\??otfcompositiondir l2r\endcsname\lefttoright +\gletcsname\??otfcompositiondir +1\endcsname\lefttoright +\gletcsname\??otfcompositiondir 1\endcsname\lefttoright + +\permanent\protected\gdef\setotfcompositiondirection#1% + {\begincsname\??otfcompositiondir#1\endcsname} + +\permanent\protected\gdef\showotfcomposition#1#2#3% {font*features at size}, rl=-1, text + {\begingroup + \forgetparindent + \forgeteverypar + % \setupcolors[\c!state=\v!start]% + \setupalign[\v!verytolerant,\v!flushleft]% + \startotfsample + \nohyphens + \global\setbox\otfcompositionbox\hbox{\definedfont[#1]\relax\setotfcompositiondirection{#2}\relax#3}% + \stopotfsample + \endgroup} + +%D \startbuffer +%D \startotfcompositionlist{Serif*default @ 11pt}{l2r}% +%D \showotfcompositionsample{effe} +%D \stopotfcompositionlist +%D \stopbuffer +%D +%D \typebuffer \getbuffer + +\permanent\protected\gdef\showotfcompositionlist#1#2#3% + {\begingroup + \definedfont[#1]% + \setbox\scratchbox\hbox\bgroup + \setotfcompositiondirection{#2}% + #3% + \egroup + \strut + \def|##1|{\kern\onepoint\string|\kern\onepoint##1\kern\onepoint\string|\kern\onepoint}% + \cldcontext{nodes.listtoutf(tex.box[\number\scratchbox].list,"{\\kern\\onepoint}",true)}% + \endgroup} + +\mutable\glet\showotfcompositionsample\gobbleoneargument + +\permanent\protected\gdef\startotfcompositionlist#1#2#3\stopotfcompositionlist + {\begingroup + \protected\def\showotfcompositionsample##1% + {\NC\type{##1}% + \NC\showotfcompositionlist{Mono}{#2}{##1}% + \NC\showotfcompositionlist{#1}{#2}{##1}% + \NC\definedfont[#1]##1% + \NC\NR}% + \starttabulate[|||||]% + #3% + \stoptabulate + \endgroup} + +\aliased\glet\stopotfcompositionlist\relax + +%D Till here. + +\permanent\protected\def\showbodyfontstate + {\dontleavehmode + \start + \infofont + [fontclass: \fontclass,\space + fontbody: \fontbody ,\space + fontface: \fontface ,\space + fontsize: \fontsize ]% + \stop} + +\protect + +\continueifinputfile{s-fonts-show.mkxl} + +\setupwhitespace[big] + +\dontcomplain + +\starttext + +\startsubject[title=\type{\showkerning}] + \showkerning{Just a small sentence with hopefully some kerns.} +\stopsubject + +\startsubject[title=\type{\showcharratio}] + \showcharratio{testg} +\stopsubject + +\startsubject[title=\type{\showfontparameters}] + \showfontparameters +\stopsubject + +\startsubject[title=\type{\showminimalbaseline}] + \showminimalbaseline +\stopsubject + +\startsubject[title=\type{\showfontstrip}] + \showfontstrip +\stopsubject + +\startsubject[title=\type{\showbodyfont}] + \showbodyfont +\stopsubject + +\startsubject[title=\type{\showbodyfontenvironment}] + \showbodyfontenvironment +\stopsubject + +\startsubject[title=\type{\showligature}] + \showligature{fi} + \showligature{fx} +\stopsubject + +\startsubject[title=\type{\showligatures}] + \showligatures +\stopsubject + +\startsubject[title=\type{\showfontstyle}] + \showfontstyle[][rm][tf][all] +\stopsubject + +\startsubject[title=\type{\showfont}] + \showfont +\stopsubject + +\startsubject[title=\type{\showbodyfontstate}] + \showbodyfontstate +\stopsubject + +\page + +\startsubject[title=\type{\showotfcomposition}] + \showotfcomposition{arabtype*arabic at 48pt}{-1}{الضَّرَّ} + \page + \showotfcomposition{arabtype*arabic at 48pt}{-1}{لِلّٰهِ} + \page +\stopsubject + +\stoptext diff --git a/tex/context/modules/mkxl/s-layout-show.mkxl b/tex/context/modules/mkxl/s-layout-show.mkxl new file mode 100644 index 000000000..95a6d3371 --- /dev/null +++ b/tex/context/modules/mkxl/s-layout-show.mkxl @@ -0,0 +1,243 @@ +%D \module +%D [ file=page-run, +%D version=2000.10.20, +%D title=\CONTEXT\ Page Macros, +%D subtitle=Runtime Macros, +%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. + +\writestatus{loading}{ConTeXt Page Macros / Runtime Macros} + +\registerctxluafile{page-run}{} % maybe rename this one + +\unprotect + +\permanent\protected\tolerant\gdef\showprint[#1]#*[#2]#*[#3]% only english + {\setbuffer[crap]% + \unprotect + \definepapersize[X][\c!width=4em, \c!height=6em] + \definepapersize[Y][\c!width=12em,\c!height=14em] + \setuppapersize[X,#1][Y,#2] + \setuplayout[#3] + \setuplayout[\v!page] + \framed + [\c!offset=\v!overlay,\c!strut=\v!no, + \c!width=\paperwidth,\c!height=\paperheight] + {\ss ABC\par DEF}% + \protect + \endbuffer + \framed[\c!offset=\v!overlay,\c!strut=\v!no]{\typesetbuffer[crap]}} + +% \switchtobodyfont[8pt] +% +% \startcombination[4*4] +% {\showprint} {\strut} +% {\showprint[][][location=middle]} {\type{location=middle}} +% {\showprint[][][location=middle,marking=on]} {\type{markering=aan}\break\type{location=middle}} +% {\showprint[][][location=middle,marking=on,nx=2]} {\type{markering=aan}\break\type{location=middle}\break\type{nx=2}} +% {\showprint[][][location=left]} {\type{location=left}} +% {\showprint[][][location=right]} {\type{location=right}} +% {\showprint[][][location={left,bottom}]} {\type{location={left,bottom}}} +% {\showprint[][][location={right,bottom}]} {\type{location={right,bottom}}} +% {\showprint[][][nx=2,ny=1]} {\type{nx=2,ny=1}} +% {\showprint[][][nx=1,ny=2]} {\type{nx=1,ny=2}} +% {\showprint[][][nx=2,ny=2]} {\type{nx=2,ny=2}} +% {\showprint[][][nx=2,ny=2,location=middle]} {\type{nx=2,ny=2}\break\type{location=middle}} +% {\showprint[][][backoffset=3pt]} {\type{rugoffset=.5cm}} +% {\showprint[][][topoffset=3pt]} {\type{kopoffset=.5cm}} +% {\showprint[][][scale=1.5]} {\type{schaal=1.5}} +% {\showprint[][][scale=0.8]} {\type{schaal=0.8}} +% \stopcombination +% +% \startcombination[3*4] +% {\showprint[landscape][] [location=middle]} {\type{landscape}} +% {\showprint[] [landscape][location=middle]} {\strut\break\type{landscape}} +% {\showprint[landscape][landscape][location=middle]} {\type{landscape}\break\type{landscape}} +% {\showprint[90] [] [location=middle]} {\type{90}} +% {\showprint[] [90] [location=middle]} {\strut\break\type{90}} +% {\showprint[90] [90] [location=middle]} {\type{90}\break\type{90}} +% {\showprint[180] [] [location=middle]} {\type{180}} +% {\showprint[] [180] [location=middle]} {\strut\break\type{180}} +% {\showprint[180] [180] [location=middle]} {\type{180}\break\type{180}} +% {\showprint[mirrored] [] [location=middle]} {\type{mirrored}} +% {\showprint[] [mirrored] [location=middle]} {\strut\break\type{mirrored}} +% {\showprint[mirrored] [mirrored] [location=middle]} {\type{mirrored}\break\type{mirrored}} +% \stopcombination + +\permanent\protected\tolerant\gdef\showframe[#1]#*[#2]% + {\ifarguments + \showframe + [\v!top,\v!header, + \v!text, + \v!footer,\v!bottom] + [\v!leftedge,\v!leftmargin, + \v!text, + \v!rightmargin,\v!rightedge] + \or + \showframe + [\v!header,\v!text,\v!footer] + [#1] + \or + \setupbackgrounds + [\v!page] + [\c!frame=\v!on, + \c!corner=\v!rectangular, + \c!frameoffset=\zeropoint, + \c!framedepth=\zeropoint, + \c!framecolor=layout:page] + \setupbackgrounds + [#1][#2] + [\c!background=, + \c!frame=\v!on, + \c!corner=\v!rectangular, + \c!frameoffset=\zeropoint, + \c!framedepth=\zeropoint, + \c!framecolor=] + \fi + \setupbackgrounds + [\c!state=\v!repeat]} + +\permanent\protected\tolerant\gdef\showsetups[#1]% + {\ctxcommand{showlayoutvariables("#1")}} + +\permanent\protected\tolerant\gdef\showlayout[#1]% + {\ctxcommand{showlayout("#1")}} + +\permanent\protected\gdef\showmargins + {\starttabulate + \NC asynchrone \NC \doifelseoddpage {odd} {even} \NC \NR + \NC synchrone \NC \doifelserightpage {right} {left} \NC \NR + \NC right margin \NC \the\rightmarginwidth \NC \NR + \NC left margin \NC \the\leftmarginwidth \NC \NR + \NC outer margin \NC \the\outermarginwidth \NC \NR + \NC inner margin \NC \the\innermarginwidth \NC \NR + \stoptabulate} + +%D Page grids: + +\newconstant\c_page_grids_location +\newconstant\c_page_grids_line_mode +\newconstant\c_page_grids_lineno_mode +\newconstant\c_page_grids_columns_mode + +\permanent\protected\tolerant\gdef\showgrid[#1]% + {\c_page_grids_location \plusone % downward compatible default + \c_page_grids_line_mode \plusone + \c_page_grids_lineno_mode \plusone + \c_page_grids_columns_mode\plusone + \processallactionsinset + [#1]% + [ \v!reset=>\c_page_grids_location \zerocount + \c_page_grids_columns_mode\zerocount, + \v!bottom=>\c_page_grids_location \plusone, + \v!top=>\c_page_grids_location \plustwo, + \v!none=>\c_page_grids_line_mode \zerocount, + \v!all=>\c_page_grids_line_mode \plusone, + \v!lines=>\c_page_grids_line_mode \plustwo, + \v!frame=>\c_page_grids_line_mode \plusthree, + \v!nonumber=>\c_page_grids_lineno_mode \zerocount, + \v!right=>\c_page_grids_lineno_mode \plusone, + \v!left=>\c_page_grids_lineno_mode \plustwo, + \v!outer=>\c_page_grids_lineno_mode \plusthree, + \v!inner=>\c_page_grids_lineno_mode \plusfour, + \v!columns=>\c_page_grids_columns_mode\plusone]% new option + \ifcase\c_page_grids_location + \let\page_grids_add_to_box\gobbleoneargument + \else % 1=bottom 2=top + \let\page_grids_add_to_box\page_grids_add_to_box_indeed + \fi + \ifcase\c_page_grids_columns_mode + \let\page_grids_add_to_one\gobbleoneargument + \let\page_grids_add_to_mix\gobbleoneargument + \else + \let\page_grids_add_to_one\page_grids_add_to_one_indeed + \let\page_grids_add_to_mix\page_grids_add_to_mix_indeed + \fi} + +% if really needed for speed we can cache the grid + +\glet\page_grids_add_to_box\gobbleoneargument +\glet\page_grids_add_to_one\gobbleoneargument +\glet\page_grids_add_to_mix\gobbleoneargument + +\gdef\page_grids_add_to_box_indeed#1% to be checked for color and layer ..... use mp + {\startcolor[layout:grid]% + \resetvisualizers + \gridboxlinemode \c_page_grids_line_mode + \gridboxlinenomode\c_page_grids_lineno_mode + \setgridbox\scratchbox\makeupwidth\textheight % todo: check color + \global\setbox#1\hpack % global ? + {\ifcase\c_page_grids_location\or\or\box#1\hskip-\makeupwidth\fi + \begingroup % color + \ifcase\layoutcolumns\else + \gray + \setlayoutcomponentattribute{\v!grid:\v!columns}% + \hpack \layoutcomponentboxattribute to \makeupwidth + {\dorecurse\layoutcolumns + {\hskip\layoutcolumnwidth + \ifnum\recurselevel<\layoutcolumns + \vrule + \s!height\ht\scratchbox + \s!depth \dp\scratchbox + \s!width \layoutcolumndistance + \fi}}% + \hskip-\makeupwidth + \fi + \setlayoutcomponentattribute{\v!grid:\v!lines}% + \hpack \layoutcomponentboxattribute{\box\scratchbox}% + \endgroup + \ifcase\c_page_grids_location\or\hskip-\makeupwidth\box#1\fi}% + \stopcolor} + +\gdef\page_grids_add_to_one_indeed#1% + {\begingroup + \resetvisualizers + \global\setbox#1\vpack{\noindent\backgroundline[layout:one]{\box#1}}% + \endgroup} + +\gdef\page_grids_add_to_mix_indeed#1% + {\begingroup + \resetvisualizers + \global\setbox#1\vpack{\noindent\backgroundline[layout:mix]{\box#1}}% + \endgroup} + +\protect + +\continueifinputfile{s-layout-show.mkxl} + +\setupwhitespace[big] + +\setuphead[section][page=yes] + +\starttext + +\startsubject[title=\type{\showprint}] + \showprint +\stopsubject + +\startsubject[title=\type{\showframe}] + \showframe +\stopsubject + +\startsubject[title=\type{\showlayout}] + \showlayout +\stopsubject + +\startsubject[title=\type{\showsetups}] + \showsetups +\stopsubject + +\startsubject[title=\type{\showmargins}] + \showmargins +\stopsubject + +\startsubject[title=\type{\showgrid}] + \showgrid +\stopsubject + +\stoptext diff --git a/tex/context/base/mkxl/publ-tra.mkxl b/tex/context/modules/mkxl/s-publications-show.mkxl index ccad4c22a..9f4098489 100644 --- a/tex/context/base/mkxl/publ-tra.mkxl +++ b/tex/context/modules/mkxl/s-publications-show.mkxl @@ -72,7 +72,7 @@ \protect -\continueifinputfile{publ-tra.mkiv} +\continueifinputfile{s-publications-show.mkxl} \starttext diff --git a/tex/context/modules/mkxl/s-symbols-show.mkxl b/tex/context/modules/mkxl/s-symbols-show.mkxl new file mode 100644 index 000000000..a2cda24d1 --- /dev/null +++ b/tex/context/modules/mkxl/s-symbols-show.mkxl @@ -0,0 +1,106 @@ +%D \module +%D [ file=symb-run, +%D version=2010.12.08, % 1998.07.20, +%D title=\CONTEXT\ Symbol Libraries, +%D subtitle=Runtime Macros, +%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. + +\startluacode + function commands.showsymbolset(collection,symbols,fontid) + if type(symbols) == "string" then + symbols = utilities.parsers.settings_to_array(symbols) + end + local options = { framecolor = "orange", rulethickness = ".8pt", offset = interfaces.variables.overlay } + local list = table.tohash(symbols) + local alsofont = fontid > 0 + local defined = #symbols > 0 + local byname = false + if alsofont then + local is_symbol = characters.is_symbol + local chardata = characters.data + local resources = fonts.hashes.resources [fontid] + local characters = fonts.hashes.characters[fontid] + if resources and characters then + local unicodes = resources.unicodes + if unicodes then + for name, unicode in next, unicodes do + if not list[name] and name ~= ".notdef" then + local c = rawget(chardata,unicode) + if not c or is_symbol[c.category] then + list[name] = false + byname = true + end + end + end + end + end + end + local detail = defined and byname + context.start() + context.forcesymbolset { collection } + context.starttabulate { detail and "|lT|l|l|lT|" or "|lT|l|l|"} + for symbol, how in table.sortedhash(list) do + context.NC() + if detail and how then + context.bold(symbol) + else + context(symbol) + end + context.NC() + context.symbol(symbol) + context.NC() + context.framed(options,context.nested.symbol(symbol)) + context.NC() + if detail and how then + context.bold("defined") + context.NC() + end + context.NR() + end + context.stoptabulate() + context.stop() + end +\stopluacode + +\unprotect + +\permanent\protected\tolerant\gdef\showsymbolset[#1]% + {\begingroup + \edef\p_font{\begincsname\??symboldefault#1\endcsname}% + \begingroup + \ifx\p_font\empty + \global\globalscratchcounter\zerocount + \else + \definedfont[\p_font]% + \global\globalscratchcounter\fontid\font\relax + \fi + \endgroup + \ctxcommand { + showsymbolset ( + "#1", + "\symbolset{#1}", + \the\globalscratchcounter + ) }% + \endgroup} + +\protect + +\continueifinputfile{s-symbols-show.mkxl} + +\usesymbols[cc] + +\starttext + + \showsymbolset[cc] + + \symbol[cc][cc-by-sa-nc] + +\stoptext + + diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 70c8a7ecc..8c50f4025 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/sources/luatex-fonts.lua --- merge date : 2021-01-24 16:02 +-- merge date : 2021-01-26 18:02 do -- begin closure to overcome local limits and interference |