* followtokens
@ 2006-01-13 17:39 Alexandre Billon
2006-01-13 18:09 ` followtokens Hans Hagen
0 siblings, 1 reply; 2+ messages in thread
From: Alexandre Billon @ 2006-01-13 17:39 UTC (permalink / raw)
[-- Attachment #1.1: Type: text/plain, Size: 811 bytes --]
Dear all,
I am quite new to context (but love it) and i am trying tind a way to
typeset texts "properly kerned" in such a way that the characters be all
rotated with tiny randomized angle (strange project indeed). I tried to do
it by writing a macro inspired by \followtokens. I have two questions :
1. It works but just for text within a single line : I have no clue how to
manage the line breaking, and I have to admit that I don't know eanough TeX
ConTeXt to find out.
2. In playing with the macro followtoken I happened to write two files with
no apparent significant difference (I mean for me) but which give quite
different results : one properly kerned, and another that is not. Could
someone explain me what's happening here ? (files attached)
Thanks a lot,
Alexandre Billon
[-- Attachment #1.2: Type: text/html, Size: 880 bytes --]
[-- Attachment #2: dontwork.tex --]
[-- Type: application/x-tex, Size: 982 bytes --]
[-- Attachment #3: work.tex --]
[-- Type: application/x-tex, Size: 1007 bytes --]
[-- Attachment #4: Type: text/plain, Size: 139 bytes --]
_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: followtokens
2006-01-13 17:39 followtokens Alexandre Billon
@ 2006-01-13 18:09 ` Hans Hagen
0 siblings, 0 replies; 2+ messages in thread
From: Hans Hagen @ 2006-01-13 18:09 UTC (permalink / raw)
Alexandre Billon wrote:
> Dear all,
>
> I am quite new to context (but love it) and i am trying tind a way to
> typeset texts "properly kerned" in such a way that the characters be
> all rotated with tiny randomized angle (strange project indeed). I
> tried to do it by writing a macro inspired by \followtokens. I have
> two questions :
>
> 1. It works but just for text within a single line : I have no clue
> how to manage the line breaking, and I have to admit that I don't
> know eanough TeX ConTeXt to find out.
>
> 2. In playing with the macro followtoken I happened to write two files
> with no apparent significant difference (I mean for me) but which give
> quite different results : one properly kerned, and another that is
> not. Could someone explain me what's happening here ? (files attached)
>
\startMPenvironment[global]
\definefont[RotFont][RegularBold]
\stopMPenvironment
\def\whatever#1%
{\appendtoks#1\to\MPtoks
\setbox\MPbox=\hbox{\RotFont\setstrut\strut\the\MPtoks}%
\startMPdrawing
n := n + 1 ; len[n] := \the\wd\MPbox ;
\stopMPdrawing
\startMPdrawing[-]
pic[n] := btex \RotFont\setstrut\strut#1 etex ;
\stopMPdrawing}
\def\funnywriting#1%
{\bgroup
\resetMPdrawing
\startMPdrawing
picture pic[] ;
numeric wid[], len[], pos[], n ;
wid[0] := len[0] := pos[0] := n := 0 ;
\stopMPdrawing
\handletokens#1\with\whatever
\startMPdrawing
for i=1 upto n :
wid[i] := abs(xpart lrcorner pic[i] - xpart llcorner pic[i]) ;
pos[i] := len[i]-wid[i] ;
pic[i] := pic[i] rotatedaround(origin, -10 randomized 20) ;
pic[i] := pic[i] shifted (pos[i],0) ;
draw pic[i];
endfor ;
\stopMPdrawing
\MPdrawingdonetrue
\getMPdrawing
\resetMPdrawing
\egroup}
\starttext
\funnywriting{La vie est belle}
\stoptext
watch the rotatedaround: you have to provide a pair as first argument
(so both your files failed)
Hans
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-01-13 18:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-13 17:39 followtokens Alexandre Billon
2006-01-13 18:09 ` followtokens Hans Hagen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).