chiark / gitweb /
layout: make loc labels and track distances have a scaling limit
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sun, 7 Nov 2010 16:02:56 +0000 (16:02 +0000)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sun, 7 Nov 2010 16:02:56 +0000 (16:02 +0000)
layout/layout

index e0cdb8f1c9f243a1959665a168330162108f16b6..bf06fa584f7320604fdf11288381afb4f03d2b2a 100755 (executable)
@@ -240,6 +240,15 @@ 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" : '';
+}
+
 our $psu_ulen= 4.5;
 our $psu_edgelw= 0.5;
 our $psu_ticklw= 0.1;
@@ -1041,6 +1050,7 @@ print DEBUG "ps $p0 $p1 $lenperp ($ppu) $allwidth\n";
        o_gsave_transform($pt);
        ol("        lf setfont ".set_black('D')."\n".
           "        0 $off moveto\n".
+          "        ".largescale_text_reduce(4)."\n".
           "        ($len) show\n".
           "      grestore\n");
     }    
@@ -1745,7 +1755,8 @@ dv("cmd__do $ctx @al ",'$ctx',$ctx);
                   "      $lmu_marklw setlinewidth stroke\n");
            }
            if ($draw =~ m/L/) {
-               ol("      ".set_black('L')."\n");
+               ol("      ".set_black('L')."\n".
+                  "      ".largescale_text_reduce(2)."\n");
                ol("      /s ($id) def\n".
                   "      lf setfont\n".
                   "      /sx5  s stringwidth pop\n".