5 # code as grid. only the grid saves!
6 # there may already be a little groff markup in this file
7 my $textFile = "sections_7,_9" unless $ARGV[0];
8 $textFile = $ARGV[0] unless not $ARGV[0];
10 # this returns the text as an array of arrays, alllinesAllleters ;)
11 my @textAoA = &parseText
($textFile);
12 &verticalMotionMarkUp
(\
@textAoA, 10);
14 # takes as an argument the file to be parsed, so &parseText("file")
16 my @alllinesAllletters;
17 my @currentLineLetters;
18 open(TEXT
, "<", $_[0]) || die "can't open $_[0] : $!";
22 @currentLineLetters = split //, $_;
23 push @alllinesAllletters, [@currentLineLetters];
28 sub verticalMotionMarkUp
{
29 my @textLetters = @
{$_[0]};
30 my $localMotionRange = $_[1];
36 # this is the file that we will build
37 my $newFile = $textFile . "Typeset";
38 open(TYPESET
, ">", $newFile) || die "can't open $newFile : $!";
41 foreach $aLineRef (@textLetters) {
42 if (@
$aLineRef == 0) {}
43 # the script recognizes lines that begin with a `.' or a `\'
44 elsif (@
$aLineRef[0] eq "." || @
$aLineRef[0] eq "\\") {
45 foreach $aLetter (@
{$aLineRef}) {
46 print TYPESET
$aLetter;
49 foreach $aLetter (@
{$aLineRef}) {
50 $anAmount = int(rand($localMotionRange));
51 $markedUpLetter = "\\v'" . $anAmount . "M'$aLetter\\v'-" . $anAmount . "M'";
52 print TYPESET
$markedUpLetter;