typo-drp.mkiv / last modification: 2020-01-30 14:16
%D \module
%D   [       file=typo-drp, % was typo-par
%D        version=2011.10.27,
%D          title=\CONTEXT\ Typesetting Macros,
%D       subtitle=Initials,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%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 Typesetting Macros / Initials}

%D This will change ... par specific attribute set and such.




\to \everyforgetall

%D For the moment here: dropped caps redone. In addition to the
%D parameters shown in the example you can use the \type {style} and
%D more low level \type {font} keys to set up the font where
%D the first one wins. If you don't like the behaviour you can always
%D roll out your own command.
%D \starttyping
%D \placeinitial \input ward \par \input ward \par \placeinitial \input tufte
%D \setupinitial
%D   [location=text,
%D    n=2,
%D    color=darkred,
%D    distance=-1em,
%D    hoffset=1em,
%D    voffset=-3ex,
%D    before=\blank]
%D \placeinitial \input ward \par \input ward \placeinitial \input tufte
%D \stoptyping

% todo: angle (once we can set parshape at the Lua end)


\installcommandhandler \??initial {initial} \??initial

\definemeasure[initial:n][\lineheight*\initialparameter\c!n - \strutdp]

 % \s!font=Bold sa 4,
 % \s!font=Bold ht \measure{initial:n},
   \s!font=Bold cp \measure{initial:n},
   \c!voffset=\v!line, % \dimexp\lineheight*\initialparameter\c!n-\lineheight\relax]

\unexpanded\def\placeinitial % we cannot group so no settings

\def\typo_initials_place[#1]% old command



   \resetfontfeature % might be needed in more places
   \scratchcounter \initialparameter\c!n\relax
        location  {\initialparameter\c!location}%
        enabled   true\space
        n         \scratchcounter
        m         \numexpr\initialparameter\c!m\relax
        method    {\initialparameter\c!method}%
        distance  \dimexpr\initialparameter\c!distance\relax
        hoffset   \dimexpr\initialparameter\c!hoffset\relax
        voffset   \scratchvoffset
        ma        \attribute\colormodelattribute
        ca        \attribute\colorattribute
        ta        \attribute\transparencyattribute
        font      \fontid\font
        dynamic   \font_dynamic_value % it's a bit over the top to support this here


% \setupbodyfont[dejavu,9pt]
% \startbuffer
% \setinitial[two]            D. E. Knuth   \ignorespaces\input knuth \par
% \setinitial[two]                  Knuth   \ignorespaces\input knuth \par
% \setinitial[two] \quotation{D. E. Knuth}  \ignorespaces\input knuth \par
% \setinitial[two] \quotation      {Knuth}  \ignorespaces\input knuth \par
% \setinitial[two]      [text={D.E. Knuth}] \ignorespaces\input knuth \par
% \setinitial[two]       [m=4] D. E. Knuth  \ignorespaces\input knuth \par
% \stopbuffer
% \type{m=2}                          \start \defineinitial[two][m=2,method=none]              \getbuffer \page \stop
% \type{m=1,method=auto}              \start \defineinitial[two][m=1,method=auto]              \getbuffer \page \stop
% \type{m=1,method={auto,first,last}} \start \defineinitial[two][m=1,method={first,auto,last}] \getbuffer \page \stop

\protect \endinput