summaryrefslogtreecommitdiff
path: root/tex/context/base/hand-ini.tex
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/hand-ini.tex')
-rw-r--r--tex/context/base/hand-ini.tex253
1 files changed, 253 insertions, 0 deletions
diff --git a/tex/context/base/hand-ini.tex b/tex/context/base/hand-ini.tex
new file mode 100644
index 000000000..248ec401e
--- /dev/null
+++ b/tex/context/base/hand-ini.tex
@@ -0,0 +1,253 @@
+%D \module
+%D [ file=hand-ini, % moved from enco-ini / pro
+%D version=2000.12.27, % 1998.12.03,
+%D title=\CONTEXT\ Handling Macros,
+%D subtitle=Initialization,
+%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. See mreadme.pdf for
+%C details.
+
+\writestatus{loading}{Context Handling Macros (ini)}
+
+%D {\em This module is experimental and implements font
+%D specific features, like hanging punctuation.}
+
+\unprotect
+
+\startmessages dutch library: handlings
+ title: handling
+ 1: font afhandeling --
+ 2: font afhandeling -- wordt geladen
+ 3: onbekende font afhandeling --
+\stopmessages
+
+\startmessages english library: handlings
+ title: handling
+ 1: font handling --
+ 2: font handling -- is loaded
+ 3: unknown font handling --
+\stopmessages
+
+\startmessages german library: handlings % to do
+ title: handling
+ 1: font handling --
+ 2: font handling -- is loaded
+ 3: unknown font handling --
+\stopmessages
+
+\startmessages czech library: handlings % to do
+ title: handling
+ 1: font handling --
+ 2: font handling -- is loaded
+ 3: unknown font handling --
+\stopmessages
+
+\startmessages italian library: handlings % to do
+ title: handling
+ 1: font handling --
+ 2: font handling -- is loaded
+ 3: unknown font handling --
+\stopmessages
+
+\startmessages norwegian library: handlings % to do
+ title: handling
+ 1: font handling --
+ 2: font handling -- is loaded
+ 3: unknown font handling --
+\stopmessages
+
+\startmessages romanian library: handlings % to do
+ title: handling
+ 1: font handling --
+ 2: font handling -- is loaded
+ 3: unknown font handling --
+\stopmessages
+
+\newif\ifembasedprotruding \embasedprotrudingfalse
+\newif\ifskipprotrudingdef \skipprotrudingdeffalse
+
+\newdimen\lproddimen \newdimen\rproddimen \let\prodfont\font
+
+\ifx\undefined\pdfprotrudechars % we don't use pdftex
+
+ \let\enableprotruding \relax
+ \let\disableprotruding \relax
+ \let\setprotrudingfactor \gobbletwoarguments
+
+ \def\defineprotrudefactor #1 #2 #3 {}
+ \def\inheritprotrudefactor #1 #2 {}
+
+\else
+
+ \def\enableprotruding {\pdfprotrudechars=2 }
+ \def\disableprotruding{\pdfprotrudechars=0 }
+
+ \appendtoks \disableprotruding \to \everyforgetall % Here or not here?
+
+ \def\setprotrudingfactor#1#2%
+ {\lproddimen=#1pt\multiply\lproddimen\!!thousand\divide\lproddimen \!!maxcard\relax
+ \rproddimen=#2pt\multiply\rproddimen\!!thousand\divide\rproddimen \!!maxcard\relax}
+
+ \def\dodefineprotrudefactor#1#2 #3 #4 %
+ {\ifskipprotrudingdef \else
+ \doifelsenothing{#2}
+ {\doifnumberelse{\string#1}
+ {\dododefineprotrudefactor{#1}{#3}{#4}}
+ {\dododefineprotrudefactor{`#1}{#3}{#4}}}
+ {\pushmacro\char \let\char\empty
+ \doifnumberelse{\csname#1#2\endcsname}
+ {\dododefineprotrudefactor{\csname#1#2\endcsname}{#3}{#4}}
+ {}%
+ \popmacro\char}%
+ \fi}
+
+ \def\doinheritprotrudefactor#1 #2 %
+ {\ifskipprotrudingdef \else
+ \pushmacro\char \let\char\empty
+ \doifnumberelse{\csname#1\endcsname}
+ {\dodoinheritprotrudefactor{\csname#1\endcsname}{`#2}}
+ {}%
+ \popmacro\char
+ \fi}
+
+ \beginETEX \fontcharwd
+
+ \def\dododefineprotrudefactor#1#2#3%
+ {\scratchdimen#2\lproddimen
+ \ifembasedprotruding \else
+ \multiply\scratchdimen\fontcharwd\prodfont#1\relax
+ \divide\scratchdimen\fontdimen6\font
+ \fi
+ \lpcode\prodfont#1\scratchdimen
+ \scratchdimen#3\rproddimen
+ \ifembasedprotruding \else
+ \multiply\scratchdimen\fontcharwd\prodfont#1\relax
+ \divide\scratchdimen\fontdimen6\font
+ \fi
+ \rpcode\prodfont#1\scratchdimen}
+
+ \endETEX
+
+ \beginTEX
+
+ \ifx\undefined\charbox \newbox\charbox \fi
+
+ \def\dododefineprotrudefactor#1#2#3%
+ {\setbox\charbox{\prodfont\char#1}% ! yet untested !
+ \scratchdimen#2\lproddimen
+ \ifembasedprotruding \else
+ \multiply\scratchdimen\wd\charbox
+ \divide\scratchdimen\fontdimen6\font
+ \fi
+ \lpcode\prodfont#1\scratchdimen
+ \scratchdimen#3\rproddimen
+ \ifembasedprotruding \else
+ \multiply\scratchdimen\wd\charbox
+ \divide\scratchdimen\fontdimen6\font
+ \fi
+ \rpcode\prodfont#1\scratchdimen}
+
+ \endTEX
+
+ \def\dodoinheritprotrudefactor#1#2%
+ {\lpcode\prodfont#1\lpcode\prodfont#2\relax
+ \rpcode\prodfont#1\rpcode\prodfont#2\relax}
+
+ \def\dodefinefonthandling[#1][#2][#3]%
+ {\setvalue{\@fha@\@fha@#1}{#2}%
+ \getparameters[\@fha@\@fha@#1][\c!links=1,\c!rechts=1,#3]}
+
+ \def\defineprotrudefactor#1 #2 #3 %
+ {\setfonttoks
+ \appendtoks\dodefineprotrudefactor#1 #2 #3 \to\fonttoks}
+
+ \def\inheritprotrudefactor#1 #2 %
+ {\setfonttoks
+ \appendtoks\doinheritprotrudefactor#1 #2 \to\fonttoks}
+
+\fi
+
+\setprotrudingfactor{1}{1}
+
+\let\fonthandling\empty
+
+\def\startfonthandling[#1]%
+ {\def\fonthandling{#1}%
+ \doifundefined{\@fha@\fonthandling}
+ {\expanded{\newtoks\csname\@fha@\fonthandling\endcsname}}}
+
+\def\stopfonthandling%
+ {\let\fonthandling\empty}
+
+\def\setfonttoks%
+ {\@EA\let\@EA\fonttoks\csname\@fha@\fonthandling\endcsname}
+
+\def\definefonthandling%
+ {\dotripleempty\dodefinefonthandling}
+
+\def\dodefinefonthandling[#1][#2][#3]%
+ {\setvalue{\@fha@\@fha@#1}{#2}%
+ \getparameters[\@fha@\@fha@#1][\c!links=1,\c!rechts=1,#3]}
+
+\def\setupfonthandling%
+ {\dodoubleempty\dosetupfonthandling}
+
+\def\dosetupfonthandling[#1][#2]%
+ {\getparameters[\@fha@\@fha@#1][#2]}
+
+\def\enablehandling%
+ {\dodoubleempty\doenablehandling}
+
+\def\doenablehandling[#1][#2]% handling / symbolic fontname
+ {\doifdefinedelse{\@fha@\@fha@#1}%
+ {\setprotrudingfactor
+ {\getvalue{\@fha@\@fha@#1\c!links}}
+ {\getvalue{\@fha@\@fha@#1\c!rechts}}%
+ \edef\fonthandling{\getvalue{\@fha@\@fha@#1}}%
+ \checkfonthandling{#2}%
+ \@EA\rawprocesscommalist\@EA[\fonthandling]\dodoenablehandling
+ \registerfonthandling{#2}}
+ {\edef\fonthandling{#1}% new
+ \dodoenablehandling{#1}}}
+
+\def\dodoenablehandling#1%
+ {\doifdefined{\@fha@#1}{\@EA\the\csname\@fha@#1\endcsname}}
+
+\def\checkfonthandling#1%
+ {\doifelsevalue{#1\s!handling\c!file}{\purefontname\font}
+ \skipprotrudingdeftrue\skipprotrudingdeffalse}
+
+\def\registerfonthandling#1%
+ {%\ifskipprotrudingdef\else\message{#1->#2->\purefontname\font}\wait\fi
+ \setxvalue{#1\s!handling\c!file}{\purefontname\font}}
+
+%D \macros
+%D {usehandling}
+%D
+%D Handling definitions are collected in dedicated files and
+%D loaded only once:
+%D
+%D % \showsetup{\y!usehandling}
+
+\def\dousehandling#1% is the same as encoding
+ {\doifundefined{\c!file\f!handlingprefix#1}%
+ {\setvalue{\c!file\f!handlingprefix#1}{}%
+ \makeshortfilename[\f!handlingprefix#1]%
+ \startreadingfile
+ \readsysfile{\shortfilename}
+ {\showmessage{\m!handlings}{2}{#1}}
+ {\showmessage{\m!handlings}{3}{#1}}%
+ \stopreadingfile}}
+
+\def\usehandling[#1]%
+ {\processcommalist[#1]\dousehandling}
+
+%D Let's now see if this macro works:
+
+\usehandling [def]
+
+\protect \endinput