chiark / gitweb /
copy txt2ps from gdr talk
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 15 May 2019 23:51:57 +0000 (00:51 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 15 May 2019 23:51:57 +0000 (00:51 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
txt2ps [new file with mode: 0755]

diff --git a/txt2ps b/txt2ps
new file mode 100755 (executable)
index 0000000..b8d9738
--- /dev/null
+++ b/txt2ps
@@ -0,0 +1,23 @@
+#!/usr/bin/perl -w
+
+use strict;
+
+my $fs=11;
+
+print "
+\%!
+ /Courier findfont $fs scalefont setfont
+ 0 800 moveto
+" or die;
+
+print "gsave 1 setgray 0 $fs rlineto stroke grestore\n" or die $!;
+
+while (<STDIN>) {
+    chomp or die;
+    print "gsave (" or die;
+    s/[\\()]/\\$&/g;
+    print or die $!;
+    print ") show grestore 0 -$fs rmoveto\n" or die $!;
+}
+
+print "1 setgray 0 $fs rmoveto 1 1 rlineto stroke showpage\n" or die $!;