chiark / gitweb /
layout: fix largescale_text_reduce
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sun, 7 Nov 2010 17:13:59 +0000 (17:13 +0000)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sun, 7 Nov 2010 17:15:09 +0000 (17:15 +0000)
layout/layout

index bf06fa584f7320604fdf11288381afb4f03d2b2a..59196ddf15fd10787304b6564517d8ad19335739 100755 (executable)
@@ -10,7 +10,8 @@ no strict 'subs';
 our $file_lineno= 0;
 our $file_filename;
 
-our $scale= 7.0;
+our $defscale= 7.0;
+our $scale= $defscale;
 our $page_x= 0;
 our $page_y= 0;
 our $quiet=0;
@@ -241,12 +242,9 @@ while (@ARGV && $ARGV[0] =~ m/^\-/) {
 our $ptscale= 72/25.4 / $scale;
 
 sub largescale_text_reduce ($) {
-    my ($maxmag) = @_;
-    # for maxmag=2
-    # scale 7: abs size 1  rel size 1      = 1
-    # scale 2: abs size 2  rel size 2*1/7  = 1    = 2/$scale
-    # scale 1: abs size 2  rel size 2*1/7  = 2/7  = 2/$scale
-    $scale < $maxmag ? ($maxmag * $scale / 7.0)." dup scale" : '';
+    my ($maxmag) = @_; # bigger means bigger letters at low reductions
+    my $scalethresh= $defscale / $maxmag;
+    $scale < $scalethresh ? ($scale / $scalethresh)." dup scale" : '';
 }
 
 our $psu_ulen= 4.5;