summaryrefslogtreecommitdiff
path: root/tex/context/base/core-fnt.tex
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/core-fnt.tex')
-rw-r--r--tex/context/base/core-fnt.tex301
1 files changed, 301 insertions, 0 deletions
diff --git a/tex/context/base/core-fnt.tex b/tex/context/base/core-fnt.tex
new file mode 100644
index 000000000..6db6a6de1
--- /dev/null
+++ b/tex/context/base/core-fnt.tex
@@ -0,0 +1,301 @@
+%D \module
+%D [ file=core-fnt,
+%D version=1995.10.10,
+%D title=\CONTEXT\ Core Macros,
+%D subtitle=Font Support,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. Non||commercial use is
+%C granted.
+
+\writestatus{loading}{Context Core Macros / Font Support}
+
+\unprotect
+
+%D \macros
+%D {kap,KAP,Kap,Kaps,nokap}
+%D
+%D We already introduced \type{\kap} as way to capitalize
+%D words. This command comes in several versions:
+%D
+%D \startbuffer
+%D \kap {let's put on a \kap{cap}}
+%D \kap {let's put on a \nokap{cap}}
+%D \KAP {let's put on a \\{cap}}
+%D \Kap {let's put on a \\{cap}}
+%D \Kaps{let's put on a cap}
+%D \stopbuffer
+%D
+%D \typebuffer
+%D
+%D Note the use of \type{\nokap}, \type{\\} and the nested
+%D \type{\kap}.
+%D
+%D \startvoorbeeld
+%D \startregels
+%D \haalbuffer
+%D \stopregels
+%D \stopvoorbeeld
+%D
+%D These macros show te main reason why we introduced the
+%D smaller \type{\tx} and \type{\txx}.
+%D
+%D \starttypen
+%D \kap\romeins{1995}
+%D \stoptypen
+%D
+%D This at first sight unusual capitilization is completely
+%D legal.
+%D
+%D \showsetup{\y!kap}
+%D \showsetup{\y!Kap}
+%D \showsetup{\y!KAP}
+%D \showsetup{\y!Kaps}
+%D \showsetup{\y!nokap}
+
+\unexpanded\def\kap%
+ {\futurelet\next\dokap}
+
+\def\dokap%
+ {\ifx\next\bgroup
+ \def\next{\dodokap\relax}%
+ \else
+ \def\next{\dodokap}%
+ \fi
+ \next}
+
+\def\dodokap#1#2%
+ {\ifmmode\hbox\fi
+ \bgroup
+ \tx
+ \the\everyuppercase
+ \uppercase{#1{#2}}%
+ \egroup}
+
+\unexpanded\def\KAP#1%
+ {{\def\\##1{\kap{##1}}#1}}
+
+\unexpanded\def\Kap#1%
+ {\KAP{\\#1}}
+
+\def\nokap#1%
+ {\lowercase{#1}}
+
+\def\Kaps%
+ {\let\processword=\Kap
+ \processwords}
+
+%D \macros
+%D {Word, Words, WORD, WORDS, doprocesswords}
+%D
+%D This is probably not the right place to present the next set
+%D of macros.
+%D
+%D \starttypen
+%D \Word {far too many words}
+%D \Words{far too many words}
+%D \WORD {far too many words}
+%D \WORDS{far too many words}
+%D \stoptypen
+%D
+%D \typebuffer
+%D
+%D This calls result in:
+%D
+%D \startvoorbeeld
+%D \startregels
+%D \haalbuffer
+%D \stopregels
+%D \stopvoorbeeld
+%D
+%D \showsetup{\y!Word}
+%D \showsetup{\y!Words}
+%D \showsetup{\y!WORD}
+%D \showsetup{\y!WORDS}
+
+\def\doWord#1%
+ {\bgroup
+ \the\everyuppercase
+ \uppercase{#1}%
+ \egroup}
+
+\def\Word#1%
+ {\doWord#1}
+
+\def\doprocesswords#1 #2\od%
+ {\ConvertToConstant\doifnot{#1}{}
+ {\processword{#1} %
+ \doprocesswords#2 \od}}
+
+\def\processwords#1%
+ {\doprocesswords#1 \od\unskip}
+
+\def\Words%
+ {\let\processwords=\Word
+ \processwords}
+
+\def\WORD#1%
+ {\bgroup
+ \def\kap#1{#1}%
+ \edef\next{#1}%
+ \the\everyuppercase
+ \uppercase\expandafter{\next}%
+ \egroup}
+
+\def\WORDS#1%
+ {\WORD{#1}}
+
+%D \macros
+%D {stretched}
+%D
+%D Stretching characters in a word is a sort of typographical
+%D murder. Nevertheless we support this manipulation for use in
+%D for instance titles.
+%D
+%D \starttypen
+%D \hbox to 5cm{\stretched{murder}}
+%D \stoptypen
+%D
+%D \typebuffer
+%D
+%D or
+%D
+%D \startvoorbeeld
+%D \haalbuffer
+%D \stopvoorbeeld
+%D
+%D \showsetup{\y!stretched}
+
+\def\stretched%
+ {\ifvmode\hbox to \hsize\else\ifinner\else\hbox\fi\fi
+ \processtokens\relax\hss\relax\normalspace}
+
+%D \startbuffer
+%D \stretched{Unknown Box}
+%D \hbox to .5\hsize{\stretched{A Horizontal Box}}
+%D \vbox to 2cm{\stretched{A Vertical Box}}
+%D \hbox to 3cm{\stretched{sp{\'e}c{\`\i}{\"a}l}}
+%D \stopbuffer
+%D
+%D \haalbuffer
+%D
+%D The first line of this macros takes care of boxing. Normally
+%D one will use an \type{\hbox} specification. The last line
+%D shows how special characters should be passed.
+%D
+%D \typebuffer
+
+%D \macros
+%D {underbar,underbars,overstrike,overstrikes,setupunderbar}
+%D
+%D In the rare case that we need undelined words, for instance
+%D because all font alternatives are already in use, one can
+%D use \type{\underbar} and \type{\overstrike} and their plural
+%D forms.
+%D
+%D \startbuffer
+%D \underbars{drawing \underbar{bars} under words is a typewriter leftover}
+%D \overstrikes{striking words makes them \overstrike{unreadable}}
+%D \stopbuffer
+%D
+%D \typebuffer
+%D
+%D \startvoorbeeld
+%D \startregels
+%D \haalbuffer
+%D \stopregels
+%D \stopvoorbeeld
+%D
+%D The next macros are derived from the \PLAIN\ \TEX\ one, but
+%D also supports nesting. The \type{$} keeps us in horizontal
+%D mode and at the same time applies grouping.
+%D
+%D \showsetup{\y!underbar}
+%D \showsetup{\y!underbars}
+%D \showsetup{\y!overstrike}
+%D \showsetup{\y!overstrikes}
+%D
+%D Although underlining is ill advised, we permit some
+%D alternatives, that can be set up by:
+%D
+%D \showsetup{\y!setupunderbar}
+%D
+%D The alternatives show up as
+%D {\setupunderbar [variant=a]{alternative a},
+%D {\setupunderbar [variant=b]{alternative b},
+%D {\setupunderbar [variant=c]{alternative c}
+%D and
+%D {\setupunderbar [lijndikte=1pt]{1pt width},
+%D {\setupunderbar [lijndikte=2pt]{2pt width},
+%D or whatever. Because \type{\overstrike} uses the same
+%D method, the settings also apply to that macro.
+
+\newcounter\underbarlevel
+
+\def\underbarmethoda#1#2#3% RULE
+ {\hbox to #1{\vrule\!!width#1\!!height#2\!!depth#3}}
+
+\def\underbarmethodb#1#2#3% DASH
+ {\hbox to #1
+ {\hskip-.25em
+ \xleaders
+ \hbox{\hskip.25em\vrule\!!width.25em\!!height#2\!!depth#3}
+ \hfil}}
+
+\def\underbarmethodc#1#2#3% PERIOD
+ {\hbox to #1
+ {\dimen0=#3
+ \advance\dimen0 by .2ex
+ \hskip-.25em
+ \xleaders
+ \hbox{\hskip.25em\lower\dimen0\hbox{.}}
+ \hfil}}
+
+\def\dounderbar#1#2#3%
+ {\bmath
+ \setbox0=\hbox{#3}%
+ \setbox2=\getvalue{underbarmethod\@@onvariant}{\wd0}{#1}{#2}%
+ \wd0=\!!zeropoint
+ \box0\box2
+ \emath}
+
+\def\underbar#1%
+ {\bgroup
+ \increment\underbarlevel
+ \dimen0=1.5\normallineskip % was \dimen0=1.5\lineskip
+ \dimen0=\underbarlevel\dimen0
+ \dimen2=\dimen0
+ \advance\dimen2 by \@@onlijndikte
+ \dounderbar{-\dimen0}{\dimen2}{#1}%
+ \egroup}
+
+\def\underbars%
+ {\let\processword=\underbar\processwords}
+
+\def\overstrike#1%
+ {\bgroup
+ \dimen0=2.5\lineskip
+ \dimen2=\dimen0
+ \advance\dimen2 by \@@onlijndikte
+ \dounderbar{\dimen2}{-\dimen0}{#1}%
+ \egroup}
+
+\def\overstrikes%
+ {\let\processword=\overstrike\processwords}
+
+\def\setupunderbar%
+ {\dodoubleargument\getparameters[\??on]}
+
+%D This module has only a few setups:
+
+\setupunderbar
+ [\c!variant=a,
+ \c!lijndikte=\linewidth]
+
+\protect
+
+\endinput
+ \ No newline at end of file