From e6741732dfd0124979c7683ca6c360f6678d6d09 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 3 Nov 2013 23:48:39 +0000 Subject: [PATCH] numbered-alias-sheet: new -P option --- numbered-alias-sheet | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/numbered-alias-sheet b/numbered-alias-sheet index ac581c8..be3297e 100755 --- a/numbered-alias-sheet +++ b/numbered-alias-sheet @@ -6,6 +6,7 @@ use POSIX; use Data::Dumper; our @paperpts = ('creditcard'); +our @bigpaperpts = (); our $fontname_num = 'Helvetica'; our $fontscale_num = 0.8; our $fontname = 'Courier'; @@ -24,6 +25,7 @@ our $usage = <] ... options: -p for libpaper, or "creditcard", default is $paperpts[0] + -P center in this; default is not to center -f set both to same font name -f[[*]],[] default is $fontname_num*$fontscale_num,$fontname -b|-bx all in mm @@ -72,8 +74,12 @@ for (;;) { while (m/^-./) { if (s/^-p(\w+)$//) { @paperpts = ($1); + } elsif (s/^-P(\w+)$//) { + @bigpaperpts = ($1); } elsif (s/^-p($dbl_re)x($dbl_re)$//o) { @paperpts = mm2pt($1,$2); + } elsif (s/^-P($dbl_re)x($dbl_re)$//o) { + @bigpaperpts = mm2pt($1,$2); } elsif (s/^-f($fontname_re)$//o) { $fontname = $fontname_num = $1; } elsif (s/^-f(?:($fontname_re)(?:\*($dbl_re))?)?,($fontname_re)?$//o) { @@ -133,6 +139,7 @@ sub canonpaper ($) { } canonpaper(\@paperpts); +canonpaper(\@bigpaperpts); @borders = mm2pt @borders; @@ -457,6 +464,14 @@ sub write_output () { for ($tile[1]=0; $tile[1]<$tiles[1]; $tile[1]++) { prf "%% tile @tile\n"; prf "gsave\n"; + if (@bigpaperpts) { + foreach (qw(0 1)) { + my $spare = $bigpaperpts[$_] - $tiles[$_] * $paperpts[$_]; + $spare >= 0 or die "too many tiles: will not fit!\n"; + prf "%s ", $spare*0.5; + } + prf "translate\n"; + } prf "%s ", $tile[$_] * $paperpts[$_] foreach qw(0 1); prf "translate\n"; write_output_tile($tile[0] * $pertile + -- 2.30.2