summaryrefslogtreecommitdiff
path: root/tex/context/base/typo-dir.mkiv
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2012-05-29 00:12:00 +0200
committerHans Hagen <pragma@wxs.nl>2012-05-29 00:12:00 +0200
commitc99d2bf28d96648c7d1852c9f5705d58655baeab (patch)
treea47017352408734b8e51883a475fd41c00956978 /tex/context/base/typo-dir.mkiv
parent64fa8007415f14472d59bdeaa4745815f13318f3 (diff)
downloadcontext-c99d2bf28d96648c7d1852c9f5705d58655baeab.tar.gz
beta 2012.05.29 00:12
Diffstat (limited to 'tex/context/base/typo-dir.mkiv')
-rw-r--r--tex/context/base/typo-dir.mkiv45
1 files changed, 25 insertions, 20 deletions
diff --git a/tex/context/base/typo-dir.mkiv b/tex/context/base/typo-dir.mkiv
index 33f11d9c8..b46be4763 100644
--- a/tex/context/base/typo-dir.mkiv
+++ b/tex/context/base/typo-dir.mkiv
@@ -19,37 +19,42 @@
\definesystemattribute[directions][public]
-% experimental directions
+\installcorenamespace{directions}
+\installcorenamespace{directionsbidimode}
+
+% plural as we can have a combination but maybe better singular
+
+\installsimplecommandhandler \??directions {directions} \??directions % no \define... yet
\unexpanded\def\setdirection[#1]% todo: symbolic names
- {\ctxlua{typesetters.directions.set(#1)}}
+ {\ctxcommand{setdirection(\number#1)}}
\unexpanded\def\resetdirection
- %{\ctxlua{typesetters.directions.set(0)}}
+ %{\ctxcommand{setdirection(0)}}
{\attribute\directionsattribute\attributeunsetvalue}
-\newtoks\everysetupdirections
-
-\unexpanded\def\setupdirections[#1]% there will be more like setting up directions themselves
- {\getparameters[\??di][#1]%
- \the\everysetupdirections}
-
-\newconstant\directionsbidimode
+\newconstant\directionsbidimode % this one might become pivate
-\letvalue{\??di:bidi:\v!off }\zerocount
-\letvalue{\??di:bidi:\v!global}\plusone
-\letvalue{\??di:bidi:\v!local }\plustwo
-\letvalue{\??di:bidi:\v!on }\plustwo
+\letvalue{\??directionsbidimode\v!off }\zerocount
+\letvalue{\??directionsbidimode\v!global}\plusone
+\letvalue{\??directionsbidimode\v!local }\plustwo
+\letvalue{\??directionsbidimode\v!on }\plustwo
\appendtoks
- \directionsbidimode\executeifdefined{\??di:bidi:\@@dibidi}\zerocount\relax
+ \directionsbidimode
+ \ifcsname\??directionsbidimode\directionsparameter\c!bidi\endcsname
+ \csname\??directionsbidimode\directionsparameter\c!bidi\endcsname
+ \else
+ \zerocount
+ \fi
+ \relax
\ifcase\directionsbidimode
\resetdirection
- \or
+ \or % 1
\setdirection[1]% global, chars
- \or
+ \or % 2
\setdirection[2]% local, attributes
- \or
+ \or % else
\setdirection[1]% default
\fi
\to \everysetupdirections
@@ -57,9 +62,9 @@
% bidi: local=obey grouping, global=ignore grouping (unicode has no grouping)
\setupdirections % maybe start/stop
- [bidi=\v!off]
+ [\c!bidi=\v!off]
-\unexpanded\def\bidilre{\utfchar{"0x202A}}
+\unexpanded\def\bidilre{\utfchar{"0x202A}} % maybe \edef's
\unexpanded\def\bidirle{\utfchar{"0x202B}}
\unexpanded\def\bidipop{\utfchar{"0x202C}}
\unexpanded\def\bidilro{\utfchar{"0x202D}}