summaryrefslogtreecommitdiff
path: root/tex/context/base/typo-drp.mkiv
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2013-08-24 02:40:26 +0300
committerMarius <mariausol@gmail.com>2013-08-24 02:40:26 +0300
commitd2f353840917bc4f4036db4ca5028165d46b98b0 (patch)
tree6936ad689a2c89d50f6388b373db44200e44cf73 /tex/context/base/typo-drp.mkiv
parent42b2755bce4c8ddfd6dc40ca11b11b3fa2e2f0b4 (diff)
downloadcontext-d2f353840917bc4f4036db4ca5028165d46b98b0.tar.gz
beta 2013.08.24 01:32
Diffstat (limited to 'tex/context/base/typo-drp.mkiv')
-rw-r--r--tex/context/base/typo-drp.mkiv112
1 files changed, 112 insertions, 0 deletions
diff --git a/tex/context/base/typo-drp.mkiv b/tex/context/base/typo-drp.mkiv
new file mode 100644
index 000000000..c78ed8d61
--- /dev/null
+++ b/tex/context/base/typo-drp.mkiv
@@ -0,0 +1,112 @@
+%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
+%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.
+
+\unprotect
+
+\registerctxluafile{typo-drp}{1.001}
+
+\definesystemattribute[initial][public]
+
+\appendtoks
+ \attribute\initialattribute\attributeunsetvalue
+\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
+%D \starttyping
+%D \placeinitial \input ward \par \input ward \par \placeinitial \input tufte
+%D
+%D \setupinitial
+%D [location=text,
+%D n=2,
+%D color=darkred,
+%D distance=-1em,
+%D hoffset=1em,
+%D voffset=-3ex,
+%D before=\blank]
+%D
+%D \placeinitial \input ward \par \input ward \placeinitial \input tufte
+%D \stoptyping
+
+% todo: angle (once we can set parshape at the Lua end)
+
+\installcorenamespace{initial}
+
+\installcommandhandler \??initial {initial} \??initial
+
+\def\v_typo_initials_auto_scale % magic
+ {\the\dimexpr\lineheight*\initialparameter\c!n-\initialparameter\c!voffset\relax}
+
+\setupinitial
+ [\c!location=\v!text,
+ \c!n=3,
+ % \s!font=Bold sa 4,
+ \s!font=Bold at \v_typo_initials_auto_scale,
+ \c!distance=.125em,
+ \c!hoffset=\zeropoint,
+ \c!voffset=-1ex,
+ \c!style=,
+ \c!color=,
+ \c!before=\blank]
+
+\unexpanded\def\placeinitial
+ {\dosingleempty\typo_initials_place}
+
+\def\typo_initials_place[#1]% old command
+ {\par
+ \namedinitialparameter{#1}\c!before
+ \setinitial[#1]}
+
+\unexpanded\def\setinitial
+ {\dosingleempty\typo_initials_set}
+
+\unexpanded\def\typo_initials_set[#1]%
+ {\edef\typo_initial_handle{\typo_initial_handle_indeed{#1}}}
+
+\unexpanded\def\typo_initial_handle_indeed#1%
+ {\dontleavehmode
+ \begingroup
+ \edef\currentinitial{#1}%
+ \doifelsenothing{\initialparameter\c!style}
+ {\definedfont[\initialparameter\s!font]}
+ {\useinitialstyleparameter\c!style}%
+ \useinitialcolorparameter\c!color
+ \ctxcommand{setinitial{
+ location = "\initialparameter\c!location",
+ enabled = true,
+ n = \number\initialparameter\c!n,
+ distance = \number\dimexpr\initialparameter\c!distance,
+ hoffset = \number\dimexpr\initialparameter\c!hoffset,
+ voffset = \number\dimexpr\initialparameter\c!voffset,
+ ma = \the\attribute\colormodelattribute ,
+ ca = \the\attribute\colorattribute ,
+ ta = \the\attribute\transparencyattribute,
+ font = \fontid\font,
+ dynamic = \number\attribute\zerocount,
+ }}%
+ \stopluacode
+ \kern\zeropoint % we need a node
+ \endgroup
+ \globallet\typo_initial_handle\relax}
+
+\let\typo_initial_handle\relax
+
+\protect \endinput