home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2011 November
/
CHIP_2011_11.iso
/
Programy
/
Narzedzia
/
Inkscape
/
Inkscape-0.48.2-1-win32.exe
/
share
/
extensions
/
txt2svg.pl
< prev
next >
Wrap
Perl Script
|
2011-07-08
|
649b
|
34 lines
#!/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();