summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/mkxl/typo-fln.mkxl
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkxl/typo-fln.mkxl')
-rw-r--r--Master/texmf-dist/tex/context/base/mkxl/typo-fln.mkxl109
1 files changed, 109 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkxl/typo-fln.mkxl b/Master/texmf-dist/tex/context/base/mkxl/typo-fln.mkxl
new file mode 100644
index 00000000000..3ef688bb55a
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/mkxl/typo-fln.mkxl
@@ -0,0 +1,109 @@
+%D \module
+%D [ file=typo-fln,
+%D version=2013.08.22, % comes from the few years older m-newstuff
+%D title=\CONTEXT\ Typesetting Macros,
+%D subtitle=First Lines,
+%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 / First Lines}
+
+%D I had this code laying around for a while \unknown\ probably as a side effect
+%D of cleaning up the supp-fun modules. There is probably room for improvement
+%D and more features.
+
+% \setupbodyfont[pagella]
+%
+% \starttext
+%
+% \setupindenting[medium,yes]
+%
+% \definefirstline
+% [smallcaps]
+% [alternative=line,
+% color=darkred,
+% style=\setfontfeature{smallcaps}]
+%
+% \setfirstline[smallcaps] \input tufte \par
+% \setfirstline[smallcaps] \input ward \par
+% \setfirstline[smallcaps] \input knuth \par
+% \setfirstline[smallcaps] \input bryson \par
+%
+% \definefirstline
+% [smallcaps]
+% [alternative=word,
+% color=darkblue,
+% style=bold,
+% n=2]
+%
+% \setfirstline[smallcaps] \input tufte \par
+% \setfirstline[smallcaps] \input ward \par
+% \setfirstline[smallcaps] \input knuth \par
+% \setfirstline[smallcaps] \input bryson \par
+%
+% \stoptext
+
+\unprotect
+
+\registerctxluafile{typo-fln}{autosuffix}
+
+\definesystemattribute[firstline][public]
+
+\appendtoks
+ \c_attr_firstline\attributeunsetvalue
+\to \everyforgetall
+
+\installcorenamespace {firstline}
+
+\installcommandhandler \??firstline {firstline} \??firstline
+
+\setupfirstline
+ [\c!alternative=\v!line,
+ %\c!style=,
+ %\c!color=,
+ \c!n=1]
+
+\permanent\tolerant\protected\def\setfirstline[#1]%
+ {\edef\typo_firstline_handle{\typo_firstline_handle_indeed{#1}}}
+
+\protected\def\typo_firstline_handle_indeed#1%
+ {\dontleavehmode
+ \begingroup
+ \edef\currentfirstline{#1}%
+ \usefirstlinestyleandcolor\c!style\c!color
+ \clf_setfirstline
+ alternative {\firstlineparameter\c!alternative}%
+ ma \c_attr_colormodel
+ ca \c_attr_color
+ ta \c_attr_transparency
+ n \numexpr\firstlineparameter\c!n\relax
+ font \fontid\font
+ dynamic \font_dynamic_value
+ \relax
+% \kern\zeropoint % we need a node
+% \hskip\zeropoint\s!plus\emwidth\relax % can be an option
+ \endgroup
+ \glet\typo_firstline_handle\relax}
+
+\let\typo_firstline_handle\relax
+
+% goodie, question on list
+%
+% \defineframed[ChapterFramed][location=low,background=color,backgroundcolor=red,frame=off]
+%
+% \setuphead[chapter][deeptextcommand=\applytofirstcharacter\ChapterFramed]
+
+\permanent\protected\def\applytofirstcharacter#1%
+ {\begingroup
+ \dowithnextbox
+ {\clf_applytofirstcharacter\nextbox{\csstring#1}%
+ \unhbox\nextbox
+ \endgroup}%
+ \hbox}
+
+\protect \endinput