From: Ian Jackson Date: Sun, 7 Nov 2010 16:02:56 +0000 (+0000) Subject: layout: make loc labels and track distances have a scaling limit X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ijackson/git?a=commitdiff_plain;h=f57cdb33b8286315c01d6064cb6d933ed3f9bd67;p=trains.git layout: make loc labels and track distances have a scaling limit --- diff --git a/layout/layout b/layout/layout index e0cdb8f..bf06fa5 100755 --- a/layout/layout +++ b/layout/layout @@ -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".