diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkxl/spac-prf.mklx')
-rw-r--r-- | Master/texmf-dist/tex/context/base/mkxl/spac-prf.mklx | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkxl/spac-prf.mklx b/Master/texmf-dist/tex/context/base/mkxl/spac-prf.mklx new file mode 100644 index 00000000000..6b4a966f2af --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mkxl/spac-prf.mklx @@ -0,0 +1,113 @@ +%D \module +%D [ file=spac-prf, +%D version=2015.11.16, % moved from test module mathplus +%D title=\CONTEXT\ Spacing Macros, +%D subtitle=Profiling, +%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 Spacing Macros / Profiling} + +%D This is experimental code that we need for a project. The interface and details +%D can change. I moved it into the core because that way we can use it on servers. + +% framed: first reflow then profile + +\unprotect + +\registerctxluafile{spac-prf}{autosuffix} + +\definesystemattribute[profilemethod][public] + +\installcorenamespace {profile} +\installcorenamespace {profiles} + +\installcommandhandler \??profile {profile} \??profile + +\setupprofile + [\c!height=\strutht, + \c!depth=\strutdp, + \c!distance=\normallineskip, + \c!lines=\zerocount, + \c!factor=\plusone] + +\defineprofile + [\v!strict] + [\c!method=\v!strict] + +\defineprofile + [\v!fixed] + [\c!method=\v!fixed] + +\defineprofile + [\v!none] + [\c!method=\v!none, + \c!height=\zeropoint, + \c!depth=\zeropoint, + \c!distance=\zeropoint, + \c!factor=\plusone] + +\defineprofile[halffixed] [\v!fixed][\c!factor=\plustwo] +\defineprofile[quarterfixed][\v!fixed][\c!factor=\plusfour] +\defineprofile[eightsfixed] [\v!fixed][\c!factor=\pluseight] + +\permanent\protected\def\setprofile[#profile]% + {\edef\currentprofile{#profile}% + \clf_setprofile + name {\currentprofile}% + height \dimexpr\profileparameter\c!height\relax + depth \dimexpr\profileparameter\c!depth\relax + distance \dimexpr\profileparameter\c!distance\relax + factor \numexpr\profileparameter\c!factor\relax + lines \numexpr\profileparameter\c!lines\relax + method {\profileparameter\c!method}% + \relax} + +\permanent\protected\def\resetprofile + {\c_attr_profilemethod\attributeunsetvalue} + +\permanent\protected\def\useprofileparameter#getparameter% + {\edef\m_spac_profile_asked{#getparameter\c!profile}% + \ifempty\m_spac_profile_asked + \resetprofile + \else + \setprofile[\m_spac_profile_asked]% + \fi} + +\permanent\tolerant\protected\def\profiledbox[#profile]#spacer[#settings]% + {\vbox\bgroup + \ifparameter#settings\or + \edef\currentprofile{#profile}% + \setupcurrentprofile[#settings]% + \orelse\ifhastok={#profile}% + \let\currentprofile\v!none + \setupcurrentprofile[#profile]% + \else + \edef\currentprofile{#profile}% + \fi + \dowithnextbox + {\profilegivenbox\currentprofile\nextbox + \unvbox\nextbox + \egroup}% + \vbox} + +\permanent\protected\def\profilegivenbox#profile#box% + {\begingroup + \edef\currentprofile{#profile}% + \clf_profilebox + box \numexpr#box\relax + height \dimexpr\profileparameter\c!height\relax + depth \dimexpr\profileparameter\c!depth\relax + distance \dimexpr\profileparameter\c!distance\relax + factor \numexpr\profileparameter\c!factor\relax + lines \numexpr\profileparameter\c!lines\relax + method {\profileparameter\c!method}% + \relax + \endgroup} + +\protect \endinput |