From 824f7b0903de8ad7f6ee3d7656005e4c59155e06 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 8 Apr 2013 00:43:40 +0000 Subject: context import for TL13, from www.pragma-ade.com/context/beta/cont-tmf.zip git-svn-id: svn://tug.org/texlive/trunk@29731 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/context/base/enco-ini.mkiv | 115 +++++++++++++---------- 1 file changed, 65 insertions(+), 50 deletions(-) (limited to 'Master/texmf-dist/tex/context/base/enco-ini.mkiv') diff --git a/Master/texmf-dist/tex/context/base/enco-ini.mkiv b/Master/texmf-dist/tex/context/base/enco-ini.mkiv index a942d511096..77fcbe4839b 100644 --- a/Master/texmf-dist/tex/context/base/enco-ini.mkiv +++ b/Master/texmf-dist/tex/context/base/enco-ini.mkiv @@ -43,22 +43,32 @@ %D \macros %D {defineaccent, definecharacter, definecommand} -\unexpanded\def\dodefineaccentcommand#1% - {\setevalue{\string#1}{\noexpand\dohandleaccent{\string#1}}} - -\unexpanded\def\dodefineaccent#1#2#3% no spaces, used low level - {\setvalue{\??ac\string#1\string#2\empty}{#3}} +\installcorenamespace{accents} \unexpanded\def\defineaccent#1 #2 #3 % - {\dodefineaccentcommand{#1}% - \dodefineaccent{#1}{#2}{#3}} - -\def\dohandleaccent#1#2% - {\ifcsname\??ac\string#1#2\empty\endcsname - \csname\??ac\string#1#2\empty\endcsname - \else\ifcsname\??ac\string#1\string#2\empty\endcsname - \csname\??ac\string#1\string#2\empty\endcsname - \fi\fi} + {\enco_define_accent_command{#1}% + \enco_define_accent{#1}{#2}{#3}} + +\unexpanded\def\enco_define_accent_command#1% + {\setevalue{\string#1}{\noexpand\enco_handle_accent{\string#1}}} + +\unexpanded\def\enco_define_accent#1#2#3% no spaces, used low level + {\setvalue{\??accents\string#1\string#2\empty}{#3}} + +\def\enco_handle_accent#1#2% expandable because we want them in the tuc file + {\csname\??accents + \ifcsname\??accents\string#1#2\empty\endcsname + \string#1#2\empty + \else\ifcsname\??accents\string#1\string#2\empty\endcsname + \string#1\string#2\empty + \else + \empty + \fi\fi + \endcsname} + +\let\dohandleaccent \enco_handle_accent % maybe useful +\let\dodefineaccent \enco_define_accent % used at the lua end +\let\dodefineaccentcommand\enco_define_accent_command % used at the lua end \unexpanded\def\definecharacter#1 #2 % {\doifnumberelse{\string#2} @@ -77,15 +87,15 @@ %D Accent handling (try to avoid this): -\newbox\accenttestbox % no longer global so we could use \scratchbox +\newbox\b_enco_accent \def\buildmathaccent#1% {\mathaccent#1 } \unexpanded\def\buildtextaccent#1#2% we could do all at the lua end {\begingroup % but that's no fun (yet) - \setbox\accenttestbox\hbox{#1}% - \scratchcounter\cldcontext{nodes.firstcharinbox(\number\accenttestbox)}\relax + \setbox\b_enco_accent\hbox{#1}% + \scratchcounter\cldcontext{nodes.firstcharinbox(\number\b_enco_accent)}\relax \ifcase\scratchcounter\else\accent\scratchcounter\fi \relax#2% \endgroup} @@ -105,7 +115,7 @@ \hidewidth \hskip#2\wd0 \hskip-#3\slantperpoint % in plain 1ex * dimenless value - \vbox to .2ex{\box0\vss}\hidewidth + \vbox to .2\exheight{\box0\vss}\hidewidth \crcr}}} \unexpanded\def\buildtextmacron {\bottomaccent{.25ex}{0}{15}{\textmacron}} @@ -128,7 +138,8 @@ \egroup \egroup} -\def\buildtextgrave{\topaccent{0pt}{0}{15}{\textgrave}} % e.g. +\unexpanded\def\buildtextgrave + {\topaccent{0pt}{0}{15}{\textgrave}} % e.g. \unexpanded\def\definemathaccent#1 #2% {\setvalue{#1}{\mathaccent#2 }} @@ -145,8 +156,8 @@ \definemathaccent hat \mathhat \definemathaccent vec \mathvec \definemathaccent dot \mathdot -\definemathaccent widetilde \mathwidetilde -\definemathaccent widehat \mathwidehat +% \definemathaccent widetilde \mathwidetilde +% \definemathaccent widehat \mathwidehat % from enco-com: @@ -224,7 +235,7 @@ % left-overs (some day in private unicode space, so that we can roundtrip) -\unexpanded\def\textblacksquare {\dontleavehmode\hbox{\vrule\!!width.3\s!em\!!height.4\s!em\!!depth-.1\s!em}} +\unexpanded\def\textblacksquare {\dontleavehmode\hbox{\vrule\s!width.3\s!em\s!height.4\s!em\s!depth-.1\s!em}} \unexpanded\def\schwa {\hbox{\rotate[\c!rotation=180,\c!location=\v!high]{\hbox{e}}}} \unexpanded\def\schwagrave {\buildtextgrave\schwa} @@ -244,28 +255,28 @@ \let\textvisiblespace\normalcontrolspace \unexpanded\def\fastcontrolspace % no glyph resolving after first (use grouped) - {\dofastcontrolspace} + {\enco_fast_control_space} -\def\dofastcontrolspace +\def\enco_fast_control_space {\iffontchar\font\textcontrolspace - \nofastfallbackcontrolspace + \enco_fast_control_space_nop \else - \dofastfallbackcontrolspace + \enco_fast_control_space_yes \fi - \dofastcontrolspace} + \enco_fast_control_space} -\newbox\controlspacebox +\newbox\b_enco_control_space -\def\nofastfallbackcontrolspace - {\let\dofastcontrolspace\textcontrolspace} +\def\enco_fast_control_space_nop + {\let\enco_fast_control_space\textcontrolspace} -\def\dofastfallbackcontrolspace - {\setbox\controlspacebox\hbox{\space}% - \setbox\controlspacebox\hbox to \wd\controlspacebox{\hss\fallbackcontrolspace\hss}% - \let\dofastcontrolspace\flushcontrolspacebox} +\def\enco_fast_control_space_yes + {\setbox\b_enco_control_space\hbox{\space}% + \setbox\b_enco_control_space\hbox to \wd\b_enco_control_space{\hss\fallbackcontrolspace\hss}% + \let\enco_fast_control_space\flushcontrolspacebox} \def\flushcontrolspacebox - {\copy\controlspacebox} + {\copy\b_enco_control_space} % a few defaults (\{}), we really need the verbose \empty as it will be % stringified .. anyhow, we define this at the lua end now but keep it here as a @@ -289,39 +300,39 @@ % from enco-mis: -\def\fakepercent - {\mathematics{\normalsuperscript{\scriptscriptstyle0}\kern-.25em/\kern-.2em\normalsubscript{\scriptscriptstyle0}}} +\unexpanded\def\fakepercent + {\mathematics{\normalsuperscript{\scriptscriptstyle0}\kern-.25\emwidth/\kern-.2\emwidth\normalsubscript{\scriptscriptstyle0}}} -\def\fakeperthousand - {\mathematics{\normalsuperscript{\scriptscriptstyle0}\kern-.25em/\kern-.2em\normalsubscript{\scriptscriptstyle00}}} +\unexpanded\def\fakeperthousand + {\mathematics{\normalsuperscript{\scriptscriptstyle0}\kern-.25\emwidth/\kern-.2\emwidth\normalsubscript{\scriptscriptstyle00}}} -\def\fakepermine +\unexpanded\def\fakepermine {\dontleavehmode \bgroup \setbox\scratchbox\hbox {\mathematics{+}}% \hbox to \wd\scratchbox {\hss - \mathematics{\normalsuperscript{\scriptscriptstyle-}\kern-.4em/\kern-.3em\normalsubscript{\scriptscriptstyle-}}% + \mathematics{\normalsuperscript{\scriptscriptstyle-}\kern-.4\emwidth/\kern-.3\emwidth\normalsubscript{\scriptscriptstyle-}}% \hss}% \egroup} %D A smaller and bolder variant, more like the math and monospaced ones. -\def\fakeunderscore +\unexpanded\def\fakeunderscore {\relax\ifmmode - \vrule\!!depth .12\fontexheight\mathstylefont\normalmathstyle\!!width \fontinterwordspace\mathstylefont\normalmathstyle\!!height\zeropoint\relax + \vrule\s!depth .12\fontexheight\mathstylefont\normalmathstyle\s!width \fontinterwordspace\mathstylefont\normalmathstyle\s!height\zeropoint\relax \else - \dontleavehmode\hbox{\vrule\!!depth .12\fontexheight\font\!!width \fontinterwordspace\font\!!height\zeropoint}% + \dontleavehmode\hbox{\vrule\s!depth .12\fontexheight\font\s!width \fontinterwordspace\font\s!height\zeropoint}% \fi} -\def\fakeunderscores{\let\_\fakeunderscore} -\def\textunderscores{\let\_\textunderscore} +\unexpanded\def\fakeunderscores{\let\_\fakeunderscore} +\unexpanded\def\textunderscores{\let\_\textunderscore} \textunderscores -\ifx\mathunderscore\undefined \let\mathunderscore\fakeunderscore \fi -\ifx\textunderscore\undefined \let\textunderscore\fakeunderscore \fi +\ifdefined\mathunderscore \else \let\mathunderscore\fakeunderscore \fi +\ifdefined\textunderscore \else \let\textunderscore\fakeunderscore \fi \unexpanded\def\normalunderscore{\ifmmode\mathunderscore\else\textunderscore\fi} @@ -349,7 +360,7 @@ \def\periodsdefault{3} % was 5, but now it's like \unknown \unexpanded\def\periods - {\dosingleempty\doperiods} + {\dosingleempty\enco_periods} % \def\doperiods[#1]% todo: also n=,width= or maybe just #1,#2 % {\dontleavehmode @@ -361,7 +372,7 @@ % % better for export: -\unexpanded\def\doperiods[#1]% todo: also n=,width= or maybe just #1,#2 +\unexpanded\def\enco_periods[#1]% todo: also n=,width= or maybe just #1,#2 {\dontleavehmode \hbox\bgroup \setbox\scratchbox\hbox to \periodswidth{\hss.\hss}% @@ -377,4 +388,8 @@ % % Hello\fourdots\ World\fourdots \par Hello\fourdots\ World. +\appendtoks + \let\buildtextaccent\secondoftwoarguments +\to \everysimplifycommands + \protect \endinput -- cgit v1.2.3