 %%%%% CaesarCK.tex (brother to CaesarCM.tex)
   %%% April 1992 -- Jan 1994; (version 2)
   %%% L. Siebenmann, Orsay <siebenmann@matups.matups.fr>
   %%% Master Posting: ftp matups.matups.fr
   %%% Documentation after \endinput
 
  \chardef\JDCatAt=\the\catcode`\@
  \catcode`\@=11

 \def\Space{ }%
 \def\W@{\immediate\write16}%
  \W@{ ************************************************** }
  \W@{ CaesarCK FONT-DEPENDANT ACCENTUATION MECHANISM}
  \W@{ for Cork norm TeX fonts, POSSIBLY INCOMPLETE }
  \W@{ --- assures correct hyphenation and kerning.}
  \W@{ For installation and operation see after
                            \string\endinput.}
  \W@{ Version 2, Sept 1992 -- Jan 1994.}
  \W@{ Updates: ftp matups.matups.fr  [192.54.146.4]. }
  \W@{ ************************************************** }
  
  %% Alpha version with classes AK: KTimes ..., and default
  %% class CK: dcr10....
  %% Cork ascii Class IK for test not fully implemented.
  %% Best declare font classes at loading time if not DC.
  %% But see \ReadFontCls@ below.


  %% Prevent this sort of file being loaded twice!
  \let\temp\relax
  \ifx\JDaccents\undefined\relax
  \else\W@{}%
      \W@{ *** \string\JDaccents\space already defined.}%
      \def\temp{\errmessage{}}
  \fi
  \temp

  \global\let\CaesarLoaded\relax
 
   \newbox\hy@accbox
   \def\empty{}
   \let\EX@\expandafter

  %%%% WORD-PROCESSING MACRO
  %%
  %%% \IN@0#1@#2@ : Is 1st exp of #1 in 1st exp of #2 ??
   %% Answer in \ifIN@
 \newif\ifIN@\def\IN@{\expandafter\INN@\expandafter}
  \long\def\INN@0#1@#2@{\long\def\NI@##1#1##2##3\ENDNI@
    {\ifx\m@rker##2\IN@false\else\IN@true\fi}%
     \expandafter\NI@#2@@#1\m@rker\ENDNI@}
  \def\m@rker{\m@@rker}
  
   \def\hyaccent#1#2{{\accent#1 #2}\@Allowhyphens{#2}\empty}

   %%% double-strike accent character trick (DSaccents)
   \def\@@@Allowhyphens#1{\setbox\hy@accbox\hbox{#1}%
     \penalty\@M\hskip-\wd\hy@accbox #1}

   %%% Next an ad hoc alternative to avoid double-strikes
   %%% in emergencies when these cause trouble at
   %%% low resolution <300 dpi.
   \let\@dodo\empty
   %% \font\@dodo=dodo %% not yet! see \noDSaccents
   %%% dodo.tfm is a .tfm  having null definition
   %%% for "9F and nothing else.
   %%% It must be installed for this alternative to work.
   \def\@@@allowhyphens#1{\penalty\@M\hskip\z@{\@dodo ^^9f}}
   %% Possible problem: if \lccode"9F is >0 (which is abnormal),
   %% you should add \lccode"9F=0 just before \@dodo.
   %% For printing, dodo .pk files may have to be installed
   %% at suitable resolutions.  A dodo.pk is provided.
   %% A copy of any 128 char cm .pk font at all would do as well.

   %% \def\@Allowhyphens{\@@Allowhyphens}
      %% default, see \JDaccents
   %% \def\@Allowhyphens{\empty}
      %% not default, see \noJDaccents
   %% \let\@@Allowhyphens\@@@Allowhyphens
      %% default  see \DSAccents
   %% \let\@@Allowhyphens\@@@allowhyphens
      %% not default, see \noDSAccents

 %% temporary catcode changes
 \catcode`\/=13
 \catcode`\~=12
 \catcode`\*=11
 
 %%% Composite accents for CK fonts
 %% TeXbook p. 52

 \def\DoCKAccents{%% cf \dospecials in Plain.tex
  /`'0..%% grave
  /''1..%% acute
  /^'2..%% hat
  /"'04..%% umlaut
  /~'176..%% tilde
  /='11..%% macron (bar over)
  /.'12..%% dot over
  /u'08..%% breve
  /v'07..%% check
  /H'05..%% long umlaut
   %%\t tie absent, see below
  }



 \def\CheckPeriod#1{\if#1.\else
        \errmessage{ !!! Error in character data}\fi}

 \def\Do@Accent@#1#2.#3{\CheckPeriod{#3}%
    \expandafter
    \def\csname @#1@\endcsname##1{%
        \empty\hyaccent{#2}{##1}\empty}%
    }
 %%eg. '"13.. gives ##1 ---> \empty\hyaccent{"13}{##1}\empty
 
 %%  And an alternative syntax
 \def\DoAccent#1#2.#3{\CheckPeriod{#3}% 
    \expandafter
    \def\csname #1\endcsname##1{%
        \empty\hyaccent{#2}{##1}\empty}%
    }

  \def\Safe@Acc#1#2{%
       \if i#2%
            \csname @#1@\endcsname \i
       \else
            \csname @#1@\endcsname #2\empty%
       \fi
       }
 
 \let\Smart@@Acc\Safe@Acc
  %% some initialisation necessary in \halign

  %%% Residual cases:\c,\aa,\AA,\l,\L

  \def\oldCedilla#1#2{\setbox0\hbox{#2}%
    \ifdim .98\ht0<1ex\accent#1#2%
    \else{\ooalign{\hidewidth
    \char#1\hidewidth\crcr\unhbox0}}\fi}

 \def\oldOgonek#1{\setbox\hy@accbox=\hbox{`}\ooalign{\hidewidth
                  \lower\ht\hy@accbox\copy\hy@accbox%\hidewidth
                  \crcr#1\crcr}}
 \def\ogonek#1{{\oldOgonek#1}\@Allowhyphens{#1}}% ogonek

  \def\oldL{\setbox0\hbox{L}\hbox to\wd0{\hss\char32L}}%
  \def\oldl{\char32l}

  \def\CrossBar#1#2{%
      \if#2L\empty
         \oldL
      \else
        \if#2l\empty
           \oldl
        \else#1#2%
        \fi
      \fi}
  
  \def\oldAA{\leavevmode\setbox0\hbox{h}%
     \dimen@\ht0\advance\dimen@-1ex%
     \rlap{\raise.67\dimen@\hbox{\char'06}}A}

  \def\OverCircle#1#2{%
      \if#2A\empty
         \oldAA
      \else
         {\accent#1#2}%
      \fi}%

  \def\oldUnderBar#1#2{\oalign{#2\crcr\hidewidth%
    \vbox to.2ex{\hbox{\char#1}\vss}\hidewidth}}%

  \def\d#1{%
    \oalign{#1\crcr\hidewidth.\hidewidth}\@Allowhyphens{#1}}%
    %%\d pure ASCII ascii, and no such in 128-255
    %% hence totally invariant

  
\def\oldt#1{{\edef\next{\the\font}\the\textfont1\accent'177\next#1}}
    %% not in Cork norm 128-255
    %% hence invariant provided \textfont1=cmmi

   \let/\Do@Accent@ \DoCKAccents %% the \@?@ are reguluar
   %%%\let/\DoAccent \DoCKAccents %% the \? are reguluar
   \def\=#1{\\@=@#1}%
   \def\t#1{\oldt#1\@Allowhyphens{#1}}%% uses "7F from cmmi
   \def\b#1{\oldUnderBar{'11}#1\@Allowhyphens{#1}\empty}%
        %% underbar
   
 \def\@c@#1{\oldCedilla{'13}#1\@Allowhyphens{#1}\empty}%%%relax!
   \def\@g@#1{\oldOgonek#1\@Allowhyphens{#1}\empty}%%%relax!
   \def\@*@#1{\OverCircle{'06}#1\@Allowhyphens{#1}\empty}%
            %% overcircle; \aa,\AA
   \def\@**@#1{\CrossBar{'40}#1}% \l,\L
       %% macron substitutes!!

    %%\=,\t,\b appear already since not in Cork 128-255
    %%\@c@,\@*@,\@**@ opposite case
    %% \c,\*,\**,\b contain \empty since tailor made
    
  \edef\ss{\string ^^ff}%
  \edef\SS{\string ^^df}%
  \edef\ae{\string ^^e6}%
  \edef\AE{\string ^^c6}%
  \edef\oe{\string ^^f7}%
  \edef\OE{\string ^^d7}%
  \edef\o{\string ^^f8}%
  \edef\O{\string ^^d8}%
  \edef\i{\string ^^19}%
  \edef\j{\string ^^1a}%
  \edef\l{\string ^^aa}%
  \edef\L{\string ^^8a}%
  \edef\th{\string ^^fe}%
  \edef\TH{\string ^^de}%
  \edef\dh{\string ^^f0}%
  \edef\DH{\string ^^d0}%
  \edef\dj{\string ^^9e}%
  \edef\DJ{\string ^^d0}%
  \edef\ng{\string ^^ad}%
  \edef\NG{\string ^^8d}%

  %%% Set lc et uc codes
  %%% following Cork norm 128-255.
  %%% lccode >0 for each letter is a necessary
  %%% condition for hyphenation

 \newcount\Ct@
 \newcount\Ct@@
 \newcount\Ct@@@
 \toks0={%
 \loop
 \Ct@=\count@\advance\Ct@ by 32
   %% \count@ is Plain scratch counter \count255
 \uccode\the\count@=\the\count@
 \lccode\the\count@=\the\Ct@
 \uccode\the\Ct@=\the\count@
 \lccode\the\Ct@=\the\Ct@
 \ifnum\count@<\Ct@@
 \relax\advance\count@ by 1
 \repeat
 }

 %%%%% Pound, Section
  \count@="80 \Ct@@="9E \the\toks0 %% segment "80 to "BF
  %%  Cork "9F is \S and "BF  is pound sign lc/uc codes 0
  \count@="C0 \Ct@@="DF \the\toks0 %% segment "C0 to "FF
  \global\let\S=^^9f
  \global\let\pound=^^bf

 \toks0={} %% clean up

 %%%%% Guillemets (Double left Guillemets etc)
 {\catcode`\_=11
 \gdef\_DLG{\kern.1 em\string^^13%
   \kern.25\fontdimen2\font
   \kern.1 em\ignorespaces}
 %
 \gdef\_DRG{\unskip \kern.1 em
   \kern.25\fontdimen2\font \string^^14%
   \kern.1 em{}}
 }
  
  %%%% SmartDiacritics
  \gdef\Diac@#1{\SmartTest@ 
    \EX@ \ifx \csname \FontClsTag@
                                @#1\endcsname\relax
             ^^58%% Print X is nothing better
       \else
             \csname \FontClsTag@ @#1\endcsname
       \fi}

  %%% Exotic lc uc codes
    \catcode"19=11\lccode"19="19\uccode"19=`I
     %dotless i

    \catcode"9E=11\lccode"9E="9E\uccode"9E="D0
     %D with bar

    \catcode"9D=11\lccode"9D="69\uccode"9D="9D
     %Turkish I with dot

 %%% CK Cork accented character octets

 \def\DoAccChars{%% Non-CK commented out!
 %%acute                 %^^19 is \i
 /'a^^e1./'e^^e9./'i^^ed./'^^19^^ed./'o^^f3./'u^^fa.
 /'A^^c1./'E^^c9./'I^^cd./'O^^d3./'U^^da.
 /'y^^fd./'Y^^dd.
  /'l^^a8./'L^^88./'n^^ab./'N^^8b./'r^^af./'R^^8f.
  /'s^^b1./'S^^91./'z^^b9./'Z^^99.
 %%grave
 /`a^^e0./`e^^e8./`i^^ec./`^^19^^ec./`o^^f2./`u^^f9.
 /`A^^c0./`E^^c8./`I^^cc./`O^^d2./`U^^d9.
 %%hat
 /^a^^e2./^e^^ea./^i^^ee./^{^^19}^^ee./^o^^f4./^u^^fb.
 /^A^^c2./^E^^ca./^I^^ce./^O^^d4./^U^^db.
 %%cedilla
 /cc^^e7./cC^^c7.
  /cs^^b3./cS^^93.
  /ct^^b5./cT^^95.
 %%tilde
 /~a^^e3./~n^^f1./~o^^f5./~A^^c3./~N^^d1./~O^^d5.
 %%umlaut (diaise)
 /"a^^e4./"e^^eb./"i^^ef./"^^19^^ef./"o^^f6./"u^^fc.
 /"A^^c4./"E^^cb./"I^^cf./"O^^d6./"U^^dc.
 /"Y^^98./"y^^b8.%% these two isolated in TM
 %%hungarian umlaut
 /Ho^^ae./HO^^8e./Hu^^b6./HU^^96.
 %%breve
 /ua^^a0./uA^^80./ug^^a7./uG^^87.
 %%cech (caron)
 /vC^^83./vD^^84./vE^^85./vN^^8c.
 /vc^^a3./vd^^a4./ve^^a5./vn^^ac.
 /vR^^90./vS^^92./vT^^94./vZ^^9a.
 /vr^^b0./vs^^b2./vt^^b4./vz^^ba.
 %%ogonek (Polish)
 /gA^^81./gE^^86./gS^^93./gT^^95.
 /ga^^a1./ge^^a6./gs^^b3./gt^^b5.
 %%dot over
 /.i^^bd./.^^19^^bd./.I^^9d./.z^^bb./.Z^^9b.%
 %%circle over
 /*a^^e5./*A^^c5./*u^^b7./*U^^97.
 %%cross bar
 /{**}l^^aa./{**}L^^8a.
 }

  \def\SetAccCharOctet#1#2#3#4{\CheckPeriod{#4}%
   \EX@\xdef\csname CKO#1@#2\endcsname {\string#3}%
   }

 \let/\SetAccCharOctet
 \DoAccChars %% once and for all
 \let\DoAccChars\relax %% save space

 %%% AK Adobe Cork accented character octets

 \def\DoAccChars{%% Non-AK commented out!
 %%acute                 %^^19 is \i
 /'a^^e1./'e^^e9./'i^^ed./'^^19^^ed./'o^^f3./'u^^fa.
 /'A^^c1./'E^^c9./'I^^cd./'O^^d3./'U^^da.
 /'y^^fd./'Y^^dd.
  %/'l^^a8./'L^^88./'n^^ab./'N^^8b./'r^^af./'R^^8f.
  %/'s^^b1./'S^^91./'z^^b9./'Z^^99.
 %%grave
 /`a^^e0./`e^^e8./`i^^ec./`^^19^^ec./`o^^f2./`u^^f9.
 /`A^^c0./`E^^c8./`I^^cc./`O^^d2./`U^^d9.
 %%hat
 /^a^^e2./^e^^ea./^i^^ee./^{^^19}^^ee./^o^^f4./^u^^fb.
 /^A^^c2./^E^^ca./^I^^ce./^O^^d4./^U^^db.
 %%cedilla
 /cc^^e7./cC^^c7.
  %/cs^^b3./cS^^93.
  %/ct^^b5./cT^^95.
 %%tilde
 /~a^^e3./~n^^f1./~o^^f5./~A^^c3./~N^^d1./~O^^d5.
 %%umlaut (diaise)
 /"a^^e4./"e^^eb./"i^^ef./"^^19^^ef./"o^^f6./"u^^fc.
 /"A^^c4./"E^^cb./"I^^cf./"O^^d6./"U^^dc.
 /"Y^^98./"y^^b8.%% these two isolated in TM
 %%hungarian umlaut
 %/Ho^^ae./HO^^8e./Hu^^b6./HU^^96.
 %%breve
 %/ua^^a0./uA^^80./ug^^a7./uG^^87.
 %%cech (caron)
 %/vC^^83./vD^^84./vE^^85./vN^^8c.
 %/vR^^8c.
 /vS^^92./vs^^b2.%% Latin2
 %/vT^^94.
 /vZ^^9a./vz^^ba.%% Latin2
 %%ogonek (Polish)
 %/gA^^83./gE^^84./gS^^85./gT^^8c.%% and lc
 %%dot over
 %/.i^^bd./.^^19^^bd./.I^^9d./.z^^bb./.Z^^9b.%
 %%circle over
 /*a^^e5./*A^^c5.%/*u^^b7./*U^^97.
 %%cross bar
  /{**}l^^aa./{**}L^^8a. %% Latin2
 }

  \def\SetAccCharOctet#1#2#3#4{\CheckPeriod{#4}%
   \EX@\xdef\csname AKO#1@#2\endcsname {\string#3}%
   }

 \let/\SetAccCharOctet
 \DoAccChars %% once and for all
 \let\DoAccChars\relax %% save space


 %%% IK ASCII CorK accented character octets
  %% none defined of course, so become \relax if csnamed


 %%%%%%%%% Master accent formula
 \def\Smart@Acc{\SmartTest@\Smart@@Acc}
 %%% where \Smart@@Acc#1#2 with eg #1=' and #2=e
 %%% varies for different font classes:
 %%% -60 (presumed) CK; -50 IK ascii cork; -70 AK Adobe cork
     
 \newcount\FontCls@
 \FontCls@=-60  % initialize
 \def\ShowCurrentFontClass{%
       \ufcr\immediate\write16{}%
       \immediate\write16{ *** Current font \fontname\font}%
       \immediate\write16{ *** is in class \FontClsTag@}}
         
 \let\protectSwitchFontCls@\empty %  for LaTeX
 \def\SmartTest@{%
            \ifnum\skewchar\font=\FontCls@\empty
            \else\protectSwitchFontCls@\SwitchFontCls@\fi}

 \def\SwitchFontCls@{%
    \ifnum\skewchar\font=\defaultskewchar\empty %% "new" font
       \ReadFontCls@
    \fi
    \FontCls@=\skewchar\font
    \EX@\let\EX@\Smart@@Acc
              \csname\the\FontCls@ Acc\endcsname
    \edef\FontClsTag@{\csname\the\FontCls@ Tag@\endcsname}%
    }

 %%% Macro-access for user
 \let\UpdateFontClassRegister\SmartTest@
 \let\ufcr\SmartTest@

 %% Stronger version of above needed
 %% at point when unmarked fonts are introduced
 \let\UpdateFontClass\SwitchFontCls@ %
 \let\ufc\SwitchFontCls@

 %\newbox\Smartbox@

 \def\ReadFontCls@{% error conditions
      \ifmmode%\show\mathoops %%diagnostic
      \else
         \ifnum\skewchar\font>-1\empty
           \show\mathfontoops
         \else\ReadFontCls@@
         \fi
      \fi}

  \edef\IKPrefix@{\relax\string I\string K-}
        %%IK- is of cat 12

 %%% String a seq of nonspace chars
  %% \csname plus \string is better?
\def\stringer@#1{% \Temp is string recipient
    \ifx#1\endstringer@
      \let\temp\relax
    \else
      \edef\Temp{\Temp\string#1}
      \let\temp\stringer@
    \fi
    \temp}

 \def\SetAKPrefix#1{\def\Temp{}%
   \stringer@ #1\endstringer@
   \let\AKPrefix@\Temp}
 
 \SetAKPrefix{K}

 \def\ReadFontCls@@{%%\relax is beginning marker
    \edef\temp{\relax\fontname\font}%
    %\show\AKPrefix@\show\temp
    \IN@0\AKPrefix@ @\temp @%
    \ifIN@
      \count255=-70 %% AK
    \else
      \IN@0\IKPrefix@ @\temp @%
      \ifIN@
        \count255=-50 %% IK
      \else
        \count255=-60 %% CK is residial
      \fi
    \fi
   \global\skewchar\font=\count255
    %% bring skewchar into effect
   }

 \def\SetCaesarClass#1#2{% #1 is font, #2 is font class tag
     \edef\temp{\global\skewchar#1=\csname
         CaesarClass#2\endcsname\ufc}\temp}
    
 %%% CK Cork acented characters (all)
 \def\CaesarClassCK{-60\empty}
 \EX@\def\csname-60Tag@\endcsname{CK}% try
 %% define "\-60Acc"
 \EX@\def\csname -60Acc\endcsname#1#2{%
  \expandafter
  \ifx\csname CKO#1@#2\endcsname\relax
     \Safe@Acc{#1}{#2}%
  \else\SmartMsg@
     \csname CKO#1@#2\endcsname
  \fi
  }

 %%% AK Adobe accented chars with CorK encoding
 \def\CaesarClassAK{-70\empty}
 \EX@\def\csname-70Tag@\endcsname{AK}% try
 %% define "\-70Acc"
 \EX@\def\csname -70Acc\endcsname#1#2{%
  \expandafter
  \ifx\csname AKO#1@#2\endcsname\relax
     \Safe@Acc{#1}{#2}%
  \else\SmartMsg@
     \csname AKO#1@#2\endcsname
  \fi
  }

 %%% IK ASCIICork
 \def\CaesarClassIK{-50\empty}
 \EX@\def\csname-50Tag@\endcsname{IK}% try
 %% define "\-50Acc"
 \EX@\let\csname-50Acc\endcsname\Safe@Acc


 \def\ShowCaesar{\def\SmartMsg@{%% spoils kerning when on
     \W@{}\W@{ *** Caesar has used ready-made accent ***
              %%\csname TO##1@##2\endcsname
              }}%
     }
     
     
 \def\HideCaesar{\def\SmartMsg@{}}
 \HideCaesar

  \def\'#1{\@Acc'{#1}} %acute
  \def\`#1{\@Acc`{#1}} %grave
  \def\^#1{\@Acc^{#1}} %hat
  \def\"#1{\@Acc"{#1}} %umlaut
  \def\c#1{\@Acc c{#1}} %cedilla
  \def\g#1{\@Acc g{#1}} %ogonek
  \def\~#1{\@Acc ~{#1}} %tilde
  \def\.#1{\@Acc.{#1}} %dot over
  \def\u#1{\@Acc u{#1}} %breve
  \def\v#1{\@Acc v{#1}} %check=caron
  \def\H#1{\@Acc H{#1}} %Hungarian long umlaut
  \def\r#1{\@Acc *{#1}} %circle over (for \aa,\AA)
  \def\*#1{\@Acc *{#1}} %circle over (for \aa,\AA)
  \def\**#1{\@Acc {**}{#1}} %crossed (for \l,\L)
  %% \=,\t,\b,\d  already defined; not in Cork norm

   \def\aa{\* a}\def\AA{\* A}% always valid
   \def\l{\** l}\def\L{\** L}% always valid

 %% return to Plain codes
 \catcode`\/=12
 \catcode`\~=13
 \catcode`\*=12
 
 %% JD for Jacques Desarmenien
 \def\JDaccents{\def\@Allowhyphens{\@@Allowhyphens}}
 \def\noJDaccents{\def\@Allowhyphens##1{\empty}}

 %% DS for Double Strike; relevant only while JD option on
 %% otherwise action delayed
 \def\DSaccents{\let\@@Allowhyphens\@@@Allowhyphens}
 \def\noDSaccents{\font\@dodo=dodo
           \let\@@Allowhyphens\@@@allowhyphens}

 \newif\ifCaesar

 \def\Caesar{\let\@Acc\Smart@Acc\Caesartrue}

 \def\noCaesar{\let\@Acc\Safe@Acc\Caesarfalse}

 \JDaccents %% default;  JD for J. Desarmenien
 \DSaccents %% default; DS for Double Strike
 \Caesar %% default
 %\noCaesar
 \ufc

  %%%%% Switching uppercase accents off and on
 %%
\def\noucAccents{\def\Smart@Acc{\SmartTest@\Smart@@@Acc}%
 \def\Smart@@@Acc##1##2{%
     \ifnum\uccode`##2=`##2 
       ##2%
     \else
       \Smart@@Acc{##1}{##2}%
     \fi
     }
 \def\Safe@Acc##1##2{%
     \ifnum\uccode`##2=`##2 
       ##2%
     \else
       \if i##2%
            \csname @##1@\endcsname \i
       \else
            \csname @##1@\endcsname ##2\empty%
       \fi
     \fi
     }
  \ifCaesar\Caesar\else\noCaesar\fi
  %%initialization necessary
  }

\def\ucAccents{\def\Smart@Acc{\SmartTest@\Smart@@Acc}%
  \def\Safe@Acc##1##2{%
       \if i##2%
            \csname @##1@\endcsname \i
       \else
            \csname @##1@\endcsname ##2\empty%
       \fi
     }
  \ifCaesar\Caesar\else\noCaesar\fi
  %%initialization necessary
  }

 \let\UCAccents\ucAccents
 \let\noUCAccents\noucAccents

 %%% Alternative to \uppercase, \lowercase
   \global\let\primuppercase\uppercase
   \global\let\primlowercase\lowercase

 \gdef\CasePrep@{%
     \let\c\relax \let\g\relax \let\H\relax \let\*\relax
     \let\v\relax\let\^\relax %% nec up to here, rest for speed
     \let\'\relax \let\`\relax \let\"\relax 
     }

 \global\let\Ctemp@\relax

 \gdef\Lowercase#1{\ufcr
      \bgroup\CasePrep@
      \xdef\Ctemp@{\primlowercase{#1}}%
      \egroup\Ctemp@
      \global\let\Ctemp@\relax
      }

 \gdef\Uppercase#1{\ufcr
      \bgroup\CasePrep@
      \xdef\Ctemp@{\primuppercase{#1}}%
      \egroup\Ctemp@
      \global\let\Ctemp@\relax
      }

 \catcode`\@=\JDCatAt

 \endinput

 %%% test for case change
  \font\ft=dcr10  \ft %\ShowCaesar
  \let\e\expandafter
  \def\xuppercase{\e\uppercase\e}
  \def\xlowercase{\e\lowercase\e}
  \long\def\tst{Aa  \`A\`a \^A\^a \"A\"a \'E\'e \`E\`e \^I\^i\^\i{}
   \"I\"i\"\i{} \^O\^o \"O\"o \^U\^u \"U\"u \c C\c c
   \OE\oe{} \AE\ae{} \O\o{}
   \H O\H o \v S\v s \g E\g e \*E\*e %% Eastern Europe
   \par}

  \tst \Uppercase{\tst} \Lowercase{\tst} \Lowercase{\Uppercase{\tst}}
  \smallskip
  \tst \xuppercase{\tst} \xlowercase{\tst} \xlowercase{\xuppercase{\tst}}
  \end




 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%%%
 %%%%% CaesarCK.doc, Dec 1992



                    === CAESAR-CK ===

   **** SMART HYPHENATION AND ACCENTUATION ****
   **** FOR POSSIBLY INCOMPLETE CORK NORM FONTS ****

               --- documentation ---

                  Laurent Siebenmann



       This is brief documentation for the macro file
CaesarCK.tex, a non-identical twin brother to CaesarCM.tex,
which is fully documented in CaesarCM.doc.   Each brother
serves to make at least two prose font classes mutually
compatible. And these font classes are intended to serve
European (latin based) languages by providing more ready-made
accented characters and diacritics than did the Knuth CM fonts.
It will suffice to indicate the differences between the two
brothers, and defer for other details to CaesarCM.doc.

        CaesarCK.tex is autonomous in the sense that it can be
\input on top of Knuth's standard Plain.  This lets one quickly
check out its features using, say dcr10 (from ftp
rusinfo.rus.uni-stuttgart.de); cf. the test file CsCKTest.tex. But
see fe-format-dumper-ck for means to make CaesarCK.tex
serve correctly in the European environments for which it was
designed.


 (A)  THE MAIN DIFFERENCE IS THAT QUITE DISTINCT CLASSES OF
FONT ARE SERVED.


 (1)   The class of PostScript fonts with Adobe "standard" encoding
(for English) is NOT supported.  

 (2)   The CM font class is NOT supported.  A fortiori neither is
the TM class of Taupin nor any other "extended CM classes" that
are currently in use. 

    Here are the two classes CaesarCK.tex currently does serve.

    CK = the fonts adhering strictly to the Cork norm 1989 for
256 character latin text fonts.

    AK = fonts with a certain subset of the Cork norm characters
defined and encoded according to the Cork norm.  The subset is
roughly the intersection, of the Adobe defined characters for
the series of type 1 fonts that Adode distributes, with the set
of characters in the Cork norm; it includes the ISOLatin1 
accented characters 192-255, but few of the ISOLatin2
128-191.

    The AK class is in practice used mostly by TeX installations that
do not have adequate virtual font support for dealing with Adobe
distributed fonts.  The K-PS distribution provides tools for the
necessary physical setup for OzTeX and Textures on Macintosh
micros.  Other setups are surely possible but none are announced
as yet.

    It is a convenient fact that any metric font that includes a
superset of the AK characters and extends the encoding for AK can
be mounted as an AK font. (In particular, one can mount any full
Cork norm .tfm as an AK font.)  Only the characters in the
designated AK class will be used; the other Cork characters
will be ignored and replaced if possible by composites as best
this program knows how.

     The important example of .tfm's that the K-PS distribution 
mounts as AK are the "NK" (Near Cork) .tfm's produced from Adobe
".afm" metric fonts. Just a handful of Cork characters are
missing from  these .tfm's: zeroforpermil, ng, NG, thorn,
Thorn, dh (crossed round d), ffi, ffl at last count. There are
several sources to try:

  --- atmtotfm of Rokicki
  --- aftovp of ArborText
  --- Vulcano of  Y. Haralambous ftp spi.ens.fr
  --- atmtotfm of Jungers ftp matups.matups.fr,
            and K-PS ibid.

CaesarCK requires that such metric fonts  be suitably declared as
AK fonts (see below); by default a font is treated as adhering to
the full cork norm.


  (B)  FONT NAMES

A metric font (.tfm) to be used in the class AK usually does not
bear its conventional name, e.g. Times. Rather it usually bears a
name that identifies the font as belonging to AK, for example
AK-Times or KTimes. This is because the most standard name
Times will probably be reserved for something different,
for example the complete Cork character set or something
close to it.

  (C)  FONT CLASS ASSIGNMENTS

      For both CaesarCM and CaesarCK, it is possible at any time
to declare a font, say Myfont, to be in any supported class, say
AK, as follows:

    \font\ft=Myfont
    \skewchar\ft=\CaesarClassAK

    However, there is additionally, a procedure (macro)
\ReadFontClass@, that attempts to make a reasonable class
assignment to the current font \font.  It is called if an accent
is to be set when \skewchar\font=\defaultskewchar. Just what
this procedure should be is sure to vary with time and place.
Thus a texpert should not hesitate to change this procedure.  He
should not modify CaesarCK.tex but instead redefine
\ReadFontClass@ via his private macro files after CaesarCK.tex
has been input.

    Some comments now on the default definition of
\ReadFontClass@. Firstly, it may vary with version, at least
initially.  But if upward compatibility is violated trace of the
earlier definition will remain so that it can be restored if
necessary.

    The current default definition of \ReadFontClass@ deviates
from an earlier one in CaesarCM in that it does not use internal
marking of .tfm files to recognize fonts in a given class.
Instead font names are used, an approach develloped by Norbert
Schwartz and first widely recommended by Daniel Taupin (see
GUT list proceedings of June 1992, and Taupin's Cahiers
Gutenberg article 1993). The firstborn CaesarCM used standard
CM names for upward compatibility with the nearly universal
CM standard; Taupin's recommendation was thus not an option.
A mixed approach is sure to be helpful at times.

    [Historically the Xerox Park group that invented the .tfm
format intended the .tfm header to be used for this sort of
purpose, but Knuth blocked access to the header by TeX; but in
in return he provided the \fontname primitive:
\fontname\myfont yields the filename of the metric font.]

    For a suitable prefix, CaesarCK will conclude that the font
belongs to AK.  Currently, the prefix is K, but this may
change. And the user can quickly change it to (say) "ak-" by
the command:

               \SetAKPrefix{ak-}

All other fonts are put in class CK.


  (D)  FORMAT COMPILATION.

    It was expected before the appearance of TeX version 3 that
hyphenation and accentuation tools would be loaded on top of
standard formats.  However TeX version 3 turned out to require
hyphenationation pattern files to be loaded during the creation
of the base format.  Since such formats are expected to be of
immediate use, one can expect that any pre-compiled
non-english format will have its own macros for accent
administration, and these could well conflict with
CaesarCK.tex. Thus, naive \input of CaesarCK.tex on top of a
precompiled format is not recommendable.

   Instead, CaesarCK.tex should be assimilated as part of a
well organised format building procedure. Use of 
fe-format-dumper-ck (ck NOT cm!!) on ftp matups.matups.fr
for semi-automatic format compilation is strongly
recommended for all but the hardiest texperts.  It can
serve as a prototype for texperts building other
multilingual formats (fe indicates french-english).

   This version of CaesarCK.tex is alpha.  Bugs reports and
comments, please!
   
       Laurent Siebenmann, Orsay 
        <siebenmann@diamant.matups.fr>


