From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/18530 Path: main.gmane.org!not-for-mail From: h h extern Newsgroups: gmane.comp.tex.context Subject: Re: lettrine.sty, but not LaTeX Date: Sun, 27 Feb 2005 11:13:53 +0100 Message-ID: <42219D61.5050608@wxs.nl> References: <000501c51b6e$e7790df0$cbddd850@DJCPX90J> <421F87B9.2000600@wxs.nl> <421F92CB.3010706@elvenkind.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------090904030404030803000509" X-Trace: sea.gmane.org 1109498991 6799 80.91.229.2 (27 Feb 2005 10:09:51 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 27 Feb 2005 10:09:51 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Sun Feb 27 11:09:51 2005 Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by ciao.gmane.org with esmtp (Exim 4.43) id 1D5LMt-0001XO-JG for gctc-ntg-context-518@m.gmane.org; Sun, 27 Feb 2005 11:09:43 +0100 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id D1D1C1287B; Sun, 27 Feb 2005 11:14:03 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (ronja.vet.uu.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 24208-01; Sun, 27 Feb 2005 11:14:01 +0100 (CET) Original-Received: from ronja.vet.uu.nl (localhost.localdomain [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 531A51286B; Sun, 27 Feb 2005 11:14:01 +0100 (CET) Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 4936D1286B for ; Sun, 27 Feb 2005 11:14:00 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (ronja.vet.uu.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 24082-05-2 for ; Sun, 27 Feb 2005 11:13:59 +0100 (CET) Original-Received: from mailrelay02.solcon.nl (maillb.solcon.nl [212.45.32.200]) by ronja.ntg.nl (Postfix) with ESMTP id 548BD127A5 for ; Sun, 27 Feb 2005 11:13:59 +0100 (CET) Original-Received: from server-1.pragma-net.nl (dsl-212-84-128-085.solcon.nl [212.84.128.85]) by mailrelay02.solcon.nl (8.12.11/SQL-8.12.11-5/8.12.11) with ESMTP id j1RADvlS005311 for ; Sun, 27 Feb 2005 11:13:57 +0100 Original-Received: by server-1.pragma-net.nl (Postfix, from userid 65534) id CBFD91803F; Sun, 27 Feb 2005 11:00:58 +0100 (CET) Original-Received: from [127.0.0.1] (unknown [10.100.1.1]) by server-1.pragma-net.nl (Postfix) with ESMTP id 12FAB17B63 for ; Sun, 27 Feb 2005 10:00:55 +0000 (UTC) User-Agent: Mozilla Thunderbird 0.8 (Windows/20040913) X-Accept-Language: en-us, en Original-To: mailing list for ConTeXt users In-Reply-To: <421F92CB.3010706@elvenkind.com> X-Virus-Scanned: ClamAV 0.80/705/Fri Feb 11 17:51:32 2005 clamav-milter version 0.80j on mailrelay02 X-Virus-Status: Clean X-Virus-Scanned: by amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.5 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl X-Virus-Scanned: by amavisd-new at ntg.nl X-MailScanner-From: ntg-context-bounces@ntg.nl X-MailScanner-To: gctc-ntg-context-518@m.gmane.org Xref: main.gmane.org gmane.comp.tex.context:18530 X-Report-Spam: http://spam.gmane.org/gmane.comp.tex.context:18530 This is a multi-part message in MIME format. --------------090904030404030803000509 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Taco Hoekwater wrote: >> basically you want to follow a shape; this is not that hard to >> implement so i can have a look at it; lettrines is then an instance of it > > Lettrine is easier than that, actually. I thought this would be quite > funny, so here is a brand new module called t-lettri.tex, and an example. ah, nice, so, lettrines only does a slanted shape? i played a bit with shapes last night and will probably add something to the drop macros, and probably also move the code to core-fnt; but it will be a bit more complex and take some more time; it's a good testbed for playing with things like glyph shape similarity and such; also, proper alignment is an issue. (i attached supp-fu3.tex, no production code, just for fun) concerning your module, maybe we should introduce a new category of modules, e.g. c-lettrines.tex with x meaning 'converted'; we can then collect them in another zip; remark 1: \sbox is already definined and in use, i remember someone telling me that this \hbox{{#1}} stuff is needed to satisfy latex's color mechanism, but that's not needed in context, so a simple \setbox\Lettrinetbox{} is not only even more efficient in terms of tokens and performance (unnoticable) but also does not clash with the core macro. remark 2: auto-lettrines (dropcaps etc) are kind of complex in the sense that it's not trivial to pick up the first 'something' in a paragraph in a robust way [we may want some extension to tex for that (so we have something to discuss during our trip to eurotex -) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl ----------------------------------------------------------------- --------------090904030404030803000509 Content-Type: application/x-tex; name="supp-fu3.tex" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="supp-fu3.tex" % todo : compensate for first shape offset \def\DroppedString{ABCDEFGHIJKLMNOPQRSTUVWXYZ \Eacute} \unprotect \def\InstallDropSymbol#1#2#3#4#5% tag method offset values {\convertargument#1\to\ascii \setevalue{dropsymbol:\ascii}{{#2}{#3}{#4}{#5}}} \InstallDropSymbol {W} {fixed} {0} {0,-.50,+.50} {W} % fixed per line \InstallDropSymbol {W} {line} {0} {0,-.25,+.45} {W} % increasing per line \InstallDropSymbol {W} {slanted} {0} {-.075} {W} % step per line \InstallDropSymbol {W} {auto} {0} {-.15} {W} % max slant \InstallDropSymbol {O} {fixed} {0} {-.1,0,-.1} {O} \InstallDropSymbol {\Eacute} {fixed} {0} {0,-.15} {\Eacute} \InstallDropSymbol {xxx} {slanted} {0} {+.3} {OEPS} \InstallDropSymbol {yyy} {slanted} {0} {+.3} {\externalfigure[cow]} \def\CloneDropSymbol#1#2#3#4% {\convertargument#1\to\asciia \convertargument#3\to\asciib \setevalue{dropsymbol:\asciia}% {{#2}{\filterfromvalue{dropsymbol:\asciib}42}% {\filterfromvalue{dropsymbol:\asciib}43}{#4}}} \CloneDropSymbol {V} {auto} {W} {V} \def\GetDropOffset#1#2#3% tag line noflines {\convertargument#1\to\ascii \scratchdimen\DroppedIndent\relax \ifundefined{dropsymbol:\ascii}\else \edef\DropSymMethod{\filterfromvalue{dropsymbol:\ascii}41}% \dimen0=\DroppedIndent \ifx\DropSymMethod\v!fixed \scratchcounter\zerocount \def\docommand##1% {\advance\scratchcounter\plusone \ifnum\scratchcounter=#2\relax \advance\scratchdimen##1\dimen0\relax \fi}% \processcommacommand[\filterfromvalue{dropsymbol:\ascii}43]\docommand \else\ifx\DropSymMethod\v!line \scratchcounter\zerocount \def\docommand##1% {\advance\scratchcounter\plusone \ifnum\scratchcounter>#2\relax \advance\scratchdimen##1\dimen0\relax \fi}% \processcommacommand[\filterfromvalue{dropsymbol:\ascii}43]\docommand \else\ifx\DropSymMethod\v!slanted \dimen2=\filterfromvalue{dropsymbol:#1}43\dimen0 \advance\scratchdimen#2\dimen2 \advance\scratchdimen-\dimen2 \else\ifx\DropSymMethod\v!auto \ifnum#2>\plusone \dimen2=\filterfromvalue{dropsymbol:\ascii}43\dimen0 \scratchcounter#3% \advance\scratchcounter\minusone \divide\dimen2 \scratchcounter \advance\scratchdimen#2\dimen2 \fi \fi\fi\fi\fi \fi \edef\DroppedOffset{\the\scratchdimen}} \def\GetDropGap#1% tag {\convertargument#1\to\ascii \edef\DroppedGap{\ifundefined{dropsymbol:\ascii}0\else}\filterfromvalue{dropsymbol:\ascii}42\fi} \let\DroppedGap\!!zerocounter \chardef\DropMethod=2 \let\DroppedShift\!!zeropoint \def\DropSymbol#1% tag {\ifundefined{dropsymbol:#1}#1\else\filterfromvalue{dropsymbol:#1}44\fi} \def\DroppedCaps#1#2#3#4#5#6#7% {\convertargument #7\to\asciia \convertcommand \DroppedString\to\asciib \ExpandBothAfter\doifinstringelse\asciia\asciib {\doDroppedCaps{#1}{#4}{#5}{#6}{#7}{\definedfont[#2 at #3]#7}} {\noDroppedCaps{#1}{#4}{#5}{#6}{#7}{#7}}} \def\DroppedSymbol#1#2#3#4#5#6#7% {\doDroppedCaps{#1}{#4}{#5}{#6}{#7}{\definedfont[#2 at #3]\DropSymbol{#7}}} \def\DroppedBox#1#2#3#4#5#6% {\doDroppedCaps{#2}{#3}{#4}{#5}{#6}{\lower#1\hbox{\scale[\c!lines=#5]{\DropSymbol{#6}}}}} \def\doDroppedCaps#1#2#3#4#5#6% does not yet handle accented chars {\dontleavehmode \ifhmode\hskip-\parindent\fi \keeplinestogether{#4}% \setbox0\hbox{#1{#6}\hskip#2}% \ifdim\dp0>\strutdp % one of those Q's, will be option \setbox2\hbox{\raise\dp0\hbox{\lower\strutdp\copy0}}% \ht2\ht0 \dp0\strutdp \setbox0\box2 \fi \setbox0\hbox {\ifnum\DropMode=\plusone\hskip-\wd0\wd0\zeropoint\fi \lower#3\box0}% % sould be at least one line \ht0\strutht \dp0\strutdp \ifnum\DropMode=\plusone \globaldropcaps\let\DroppedIndent\!!zeropoint \globaldropcaps\edef\DroppedLines{\number\maxdimen}% \globaldropcaps\chardef\DroppedStatus\plusthree \vbox{\forgetall\hbox{\box0}}% \else \noindent % redundant \globaldropcaps\edef\DroppedIndent{\the\wd0}% \globaldropcaps\edef\DroppedLines {\number#4}% \globaldropcaps\chardef\DroppedStatus\plustwo \ifcase\DropMethod\or \globaldropcaps\hangindent\DroppedIndent \globaldropcaps\hangafter-\DroppedLines \vbox{\forgetall\hbox{\box0}}% \or \scratchtoks\emptytoks \setlocalhsize \dorecurse\DroppedLines {\GetDropOffset{#5}\recurselevel\DroppedLines \scratchdimen\localhsize \advance\scratchdimen-\DroppedOffset \advance\scratchdimen-\DroppedShift \dimen0=\DroppedOffset \advance\dimen0 \DroppedShift \appendetoks \the\dimen0 \the\scratchdimen \to \scratchtoks}% \scratchcounter\DroppedLines \advance\scratchcounter \plusone \parshape \scratchcounter \space \the\scratchtoks \zeropoint \localhsize\relax \hskip-\DroppedIndent \hbox to \DroppedIndent {% compensate for first offset \GetDropOffset{#5}\plusone\DroppedLines \hskip\DroppedIndent \hskip-\DroppedOffset\box0}% \fi \fi \let\globaldropcaps\global \nobreak \ignorespaces} \def\noDroppedCaps#1#2#3#4#5#6% does not yet handle accented chars {\globaldropcaps\let\DroppedIndent\!!zeropoint \globaldropcaps\edef\DroppedLines{\number\maxdimen}% \globaldropcaps\chardef\DroppedStatus\plusthree \let\globaldropcaps\global #6} \def\DoLineDroppedCaps#1#2#3#4#5% compensation command font offset lines {\scratchcounter#5\advance\scratchcounter\minusone \scratchdimen\scratchcounter\baselineskip\advance\scratchdimen #1% \NormalizeFontHeight\DummyFont{W}\scratchdimen{#3}% \DroppedCaps{#2}{#3}\TheNormalizedFontSize{#4}{\scratchcounter\baselineskip}{#5}} \def\DoLineDroppedSymbol#1#2#3#4#5% compensation command font offset lines {\scratchcounter#5\advance\scratchcounter\minusone \scratchdimen\scratchcounter\baselineskip\advance\scratchdimen#1% \NormalizeFontHeight\DummyFont{W}\scratchdimen{#3}% \DroppedSymbol{#2}{#3}\TheNormalizedFontSize{#4}{\scratchcounter\baselineskip}{#5}} \def\DoLineDroppedBox#1#2#3#4#5% compensation command font offset lines {\scratchcounter#5\advance\scratchcounter\minusone \DroppedBox{#1}{#2}{#4}{\scratchcounter\baselineskip}{#5}} % command font offset lines \def\LineDroppedCaps {\DoLineDroppedCaps \strutht} \def\LineDroppedSymbol{\DoLineDroppedSymbol\strutht} \def\LineDroppedBox {\DoLineDroppedBox \strutht} \def\NiceDroppedCaps {\DoLineDroppedCaps {.5\baselineskip}} \def\NiceDroppedSymbol{\DoLineDroppedSymbol{.5\baselineskip}} \def\NiceDroppedBox {\DoLineDroppedBox {.5\baselineskip}} \showframe \setupcolors[state=start] \starttext % \EveryPar{\NiceDroppedCaps{}{Serif}{0pt}{3}} \noindent \Eacute \input tufte \endgraf \NiceDroppedCaps {\red}{Serif}{0pt}{3}{W} \input tufte \endgraf \NiceDroppedCaps {\red}{Serif}{0pt}{3}{V} \input tufte \endgraf \NiceDroppedCaps {\red}{Serif}{0pt}{3}{O} \input tufte \endgraf \NiceDroppedSymbol{\red}{Serif}{0pt}{3}{xxx} \input tufte \endgraf \NiceDroppedBox {\red}{Serif}{0pt}{3}{yyy} \input tufte \endgraf \NiceDroppedBox {\red}{Serif}{0pt}{3}{zzz} \input tufte \endgraf \def\DroppedShift{-\margindistance} \NiceDroppedCaps {\red}{Serif}{0pt}{3}{W} \input tufte \endgraf \stoptext \endinput \def\setupinitial {\dodoubleempty\getparameters[\??dc]} \definefontsynonym[Initial][Regular] % prefered initial identifier \definefontsynonym[initial][Initial] % internal but accepted too \setupinitial [\c!state=\v!stop, \c!location=\v!text, \c!n=3, \c!distance=.125em, \c!margindistance=0pt, \c!command=, \s!font=initial] \def\AutoDroppedCapsCommand{\NiceDroppedCaps\@@dccommand\@@dcfont\@@dcdistance\@@dcn}% \def\placeinitial {\def\DroppedShift{\@@dcmargindistance}% \doifelse\@@dclocation\v!margin{\chardef\DropMode\plusone}{\chardef\DropMode\zerocount}% \doif \@@dcstate\v!start{\ifcase\@@dcn\else\AutoDroppedCaps\fi}} \let\checkinitial\CheckDroppedCaps \def\defineinitial {\doquintupleempty\dodefineinitial} \def\dodefineinitial[#1][#2][#3][#4][#5]% {\iffifthargument \InstallDropSymbol{#1}{#2}{#3}{#4}{#5}% \else \def\docommand##1{\InstallDropSymbol{##1}{#2}{#3}{#4}{##1}}% \processcommalist[#1]\docommand \fi} \def\inheritinitial {\doquadrupleempty\doinheritinitial} \def\doinheritinitial[#1][#2][#3][#4]% {\CloneDropSymbol{#1}{#2}{#3}{#4}} \defineinitial [V,W] [fixed] [0] [0,-.50,+.50] \defineinitial [V,W] [line] [0] [0,-.25,+.45] \defineinitial [V,W] [slanted] [0] [-.075] \defineinitial [V,W] [auto] [0] [-.15] \defineinitial [O] [fixed] [0] [-.1,0,-.1] \defineinitial [\Eacute] [fixed] [0] [0,-.15] [\Eacute] \defineinitial [xxx] [slanted] [0] [+.3] [OEPS] \defineinitial [yyy] [slanted] [0] [+.3] [{\externalfigure[cow]}] % \inheritinitial [V] [auto] [W] [V] \stoptext --------------090904030404030803000509 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context --------------090904030404030803000509--