From f1bd91bbfa5bec20c65757cbc85caa968cc9bc41 Mon Sep 17 00:00:00 2001 From: Martin Mares <mj@ucw.cz> Date: Wed, 29 Jun 2016 18:49:44 +0200 Subject: [PATCH] PPD: Custom page sizes work --- ppd/PPD.pm | 2 +- ppd/PPD/Paper.pm | 3 ++- ppd/gen-nessie-xcpt | 11 +++++++---- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/ppd/PPD.pm b/ppd/PPD.pm index 569bdac..986b41c 100644 --- a/ppd/PPD.pm +++ b/ppd/PPD.pm @@ -369,7 +369,7 @@ sub emit_option($) { my $i = 0; for my $p (@{$c->{Params}}) { $i++; - print "*Param$key ", $p->{Key}; + print "*ParamCustom$key ", $p->{Key}; print '/', $p->{Name} if defined($p->{Name}) && $p->{Name} ne $p->{Key}; printf ": %d %s %d %d\n", $i, $p->{Unit}, $p->{Min}, $p->{Max}; } diff --git a/ppd/PPD/Paper.pm b/ppd/PPD/Paper.pm index ee8e84f..46c9696 100644 --- a/ppd/PPD/Paper.pm +++ b/ppd/PPD/Paper.pm @@ -50,6 +50,7 @@ my %media = ( # JCL => 1, # Paper should be handled via JCL (default: 0) # PSPageSize => PS, # PS code for setting PageSize (subroutine called with ref to media object) # PSPageRegion => PS, # The same for PageRegion (default: use PSPageSize) +# PSCustomPageSize => PS, # PS code for setting custom PageSize (default: use setpagedevice) # }) sub add_papers($) { # Scan available paper formats @@ -89,7 +90,7 @@ sub add_papers($) { } sort keys %real_media ], Default => $o->{DefPaper}, Custom => { - PS => 'pop pop pop << /PageSize [5 -2 roll] >> setpagedevice', + PS => $o->{PSCustomPageSize} // 'pop pop pop << /PageSize [5 -2 roll] >> setpagedevice', Params => [ { Key => 'Width', Unit => 'points', Min => $minw, Max => $maxw }, { Key => 'Height', Unit => 'points', Min => $minh, Max => $maxh }, diff --git a/ppd/gen-nessie-xcpt b/ppd/gen-nessie-xcpt index b325930..afeb2cf 100755 --- a/ppd/gen-nessie-xcpt +++ b/ppd/gen-nessie-xcpt @@ -1,9 +1,9 @@ #!/usr/bin/perl -# FIXME: Custom paper sizes # FIXME: Precision of paper sizes (and mismatch with paperconf) -# FIXME: Paper orientation # FIXME: Color adjustments +# FIXME: cupsIPPFinishings +# FIXME: cupsSingleFile? use strict; use warnings; @@ -75,7 +75,7 @@ option({ JCL => 1, Values => [ { Key => 'False', Name => 'Print normally', PS => jopt('PRIVATE', "") }, - { Key => 'True', Name => 'Private print-out (wait for the user to log in)', PS => jopt('PRIVATE', 'YES') }, + { Key => 'True', Name => 'Private print-out', PS => jopt('PRIVATE', 'YES') }, ], }); @@ -87,8 +87,9 @@ PPD::Paper::add_papers({ MarginH => 11.34, MarginV => 11.34, # FIXME: show as floats JCL => 1, PSPageSize => sub { my ($m) = @_; return jopt('MEDIAXSIZE', $m->{W}, 'MEDIAYSIZE', $m->{H}); }, - # FIXME: LeadingEdge + PSCustomPageSize => jopt('MEDIAXSIZE', '\1', 'MEDIAYSIZE', '\2'), }); + switch_group('Media'); option({ @@ -270,6 +271,8 @@ option({ ], }); +# This is very similar to *LeadingEdge, but the semantics are subtly different, +# so we prefer to use a different name. option({ Key => 'XRFeed', Name => 'Feed Orientation', -- GitLab