X-Git-Url: http://git.rot13.org/?p=Printer-Zebra.git;a=blobdiff_plain;f=ZPL2pbm.pl;h=692fb66344499c05126ce8524fc96c998728e403;hp=860f28b0ca6a05d158fda873853ba3597e63bc35;hb=10b7a0774d32e9f960c1262db94d7eece16fd393;hpb=e699b31cd967ccc99fb88d987250eb44a85cbb4f diff --git a/ZPL2pbm.pl b/ZPL2pbm.pl index 860f28b..692fb66 100755 --- a/ZPL2pbm.pl +++ b/ZPL2pbm.pl @@ -31,12 +31,11 @@ while( $line ) { warn "# ~DG$1 => [$name] t=$t w=$w\n"; - my $data; - read $in, $data, $t; + my $data = <$in>; my $out; # ZPL decompress - my $repeat = 1; + my $repeat = 0; foreach my $p ( 0 .. length($data) - 1 ) { my $c = substr($data,$p,1); if ( $c eq ',' ) { @@ -44,9 +43,14 @@ while( $line ) { $l = $w * 2 if $l == 0; warn "# $p ZERO-to-EOL $c [$l]\n"; $out .= "0" x $l; + } elsif ( $c eq '!' ) { + my $l = ( $w * 2 ) - length($out) % ( $w * 2 ); + $l = $w * 2 if $l == 0; + warn "# $p ONE-to-EOL $c [$l]\n"; + $out .= "F" x $l; } elsif ( $c eq ':' ) { $out .= length($out) > $w ? substr($out,-$w*2) : "00" x $w; - warn "# $p :\n"; + warn "# $p repeat last line\n"; } elsif ( $c eq 'z' ) { $repeat += 400; } elsif ( $c ge 'g' && $c le 'y' ) {