For the helluvit I wrote a script to convert plain text into SVG <text> elements, using the Perl SVG module:
http://www.bryceharrington.com/txt2svg/
Bryce
#!/usr/bin/perl
# This is a script to render a plain text file into SVG, line by line.
use strict; use SVG; use vars qw($VERSION); $VERSION = '1.00';
my $svg = new SVG;
$svg->comment('Generated by txt2svg');
my $i=0; while (<>) { chomp($_); s/\t/ /g; # Convert tabs into spaces, otherwise we get errors about invalid char
my $text = $svg->text(id => "text_line_$i", x => 10, y => 12*(1+$i), 'xml:space' => 'preserve', style => { 'font' => 'Courier', 'font-family' => 'Courier 10 pitch', 'font-size' => 10, } ) ->cdata($_); $i++; }
print $svg->xmlify();
On Sat, 2004-02-21 at 15:37, Bryce Harrington wrote:
For the helluvit I wrote a script to convert plain text into SVG <text> elements, using the Perl SVG module:
Very cool! I went ahead and put this in CVS with a module definition file so that you can open .txt files with Inkscape they'll work.
--Ted
PS - I don't know about others, but I didn't have the Perl SVG module, so I had to install it. You might make sure you have it before trying this out.
Using SVG and Pod::Parser I rigged up a pod2svg script, that'll convert man input pages in POD format into SVG. I figured if we want to do help docs in SVG, why not put the manpage in SVG? ;-)
http://www.bryceharrington.com/pod2svg/
Bryce
On Sun, 22 Feb 2004, Ted Gould wrote:
On Sat, 2004-02-21 at 15:37, Bryce Harrington wrote:
For the helluvit I wrote a script to convert plain text into SVG <text> elements, using the Perl SVG module:
Very cool! I went ahead and put this in CVS with a module definition file so that you can open .txt files with Inkscape they'll work.
--Ted
PS - I don't know about others, but I didn't have the Perl SVG module, so I had to install it. You might make sure you have it before trying this out.
participants (2)
-
Bryce Harrington
-
Ted Gould