summaryrefslogtreecommitdiff
path: root/tex/context/base/mkxl/spac-prf.mklx
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2023-01-15 14:50:04 +0100
committerContext Git Mirror Bot <phg@phi-gamma.net>2023-01-15 14:50:04 +0100
commit0caec226a633182402b349c3ac5b3bf9e0bc76c2 (patch)
tree30524574e0b41eb771f5f9af8cadc60354652aa3 /tex/context/base/mkxl/spac-prf.mklx
parent659b8f28e591006b6d0669c05d809d6ccf60cec0 (diff)
downloadcontext-0caec226a633182402b349c3ac5b3bf9e0bc76c2.tar.gz
2023-01-15 13:55:00
Diffstat (limited to 'tex/context/base/mkxl/spac-prf.mklx')
-rw-r--r--tex/context/base/mkxl/spac-prf.mklx54
1 files changed, 47 insertions, 7 deletions
diff --git a/tex/context/base/mkxl/spac-prf.mklx b/tex/context/base/mkxl/spac-prf.mklx
index 6b4a966f2..824b14ca7 100644
--- a/tex/context/base/mkxl/spac-prf.mklx
+++ b/tex/context/base/mkxl/spac-prf.mklx
@@ -20,7 +20,11 @@
\unprotect
-\registerctxluafile{spac-prf}{autosuffix}
+\doiffileelse{spac-prf-new.lmt}{
+ \registerctxluafile{spac-prf-new}{autosuffix}
+} {
+ \registerctxluafile{spac-prf}{autosuffix}
+}
\definesystemattribute[profilemethod][public]
@@ -52,13 +56,15 @@
\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]
+\appendtoks
+ \ifcstok{\profileparameter\c!define}\v!yes
+ \frozen\protected\edefcsname\e!start\currentprofile\endcsname{\spac_profile_start{\currentprofile}}%
+ \frozen\protected\defcsname \e!stop \currentprofile\endcsname{\spac_profile_stop}%
+ \fi
+\to \everydefineprofile
-\permanent\protected\def\setprofile[#profile]%
- {\edef\currentprofile{#profile}%
- \clf_setprofile
+\def\spac_profile_set
+ {\clf_setprofile
name {\currentprofile}%
height \dimexpr\profileparameter\c!height\relax
depth \dimexpr\profileparameter\c!depth\relax
@@ -68,6 +74,36 @@
method {\profileparameter\c!method}%
\relax}
+\tolerant\protected\def\spac_profile_start#profile#spacer[#settings]%
+ {\begingroup
+ \ifparameter#settings\or
+ \edef\currentprofile{#profile}%
+ \setupcurrentprofile[#settings]%
+ \orelse\ifhastok={#profile}%
+ \let\currentprofile\v!none
+ \setupcurrentprofile[#profile]%
+ \else
+ \edef\currentprofile{#profile}%
+ \fi
+ \spac_profile_set
+ \par
+ \profileparameter\c!before}
+
+\protected\def\spac_profile_stop
+ {\par % otherwise not applied
+ \profileparameter\c!after
+ \endgroup}
+
+\permanent\protected\def\startprofile[#profile]%
+ {\spac_profile_start{#profile}}
+
+\permanent\protected\def\stopprofile
+ {\spac_profile_stop}
+
+\permanent\protected\def\setprofile[#profile]%
+ {\edef\currentprofile{#profile}%
+ \spac_profile_set}
+
\permanent\protected\def\resetprofile
{\c_attr_profilemethod\attributeunsetvalue}
@@ -110,4 +146,8 @@
\relax
\endgroup}
+\defineprofile[halffixed] [\v!fixed][\c!factor=\plustwo]
+\defineprofile[quarterfixed][\v!fixed][\c!factor=\plusfour]
+\defineprofile[eightsfixed] [\v!fixed][\c!factor=\pluseight]
+
\protect \endinput