chiark / gitweb /
commitid: introduce $polys local in parsefont() (nfc)
[reprap-play.git] / commitid.scad.pl
index d646c32762bfca62f3ce9fe61f57a0d53f986701..e75143b46ca91b49697670d54a1ddbd2620d1cd8 100755 (executable)
@@ -371,6 +371,8 @@ sub parsefont () {
        $cellmap{$1} = $_;
     }
     my %chrpolys;
+    # $chrs{$chr}[$poly] = $poly
+    # $poly->{E} = [ "012345012345", ... ]
     while (<DATA>) {
        next unless m/\S/;
        chomp;
@@ -397,7 +399,7 @@ sub parsefont () {
                        die unless $f;
                        $f =~ s/\b\d/ sprintf '%05d', $col*2000 + $&*1025 /ge;
                        $f =~ s/\d\b/ sprintf '%05d', $row*2000 + $&*1025 /ge;
-                       push @{ $chrpolys{$chr} }, [ split / /, $f ];
+                       push @{ $chrpolys{$chr} }, { E => [ split / /, $f ] };
                    } else {
                        die "$_ ?";
                    }
@@ -410,12 +412,13 @@ sub parsefont () {
     my $demo = '';
     my $democols = 6;
     foreach my $chr (sort keys %chrpolys) {
+       my $polys = $chrpolys{$chr};
        my $mod = chrmodname $chr;
        p "module $mod () {\n";
-       foreach my $poly (@{ $chrpolys{$chr} }) {
+       foreach my $poly (@$polys) {
            p " polygon([";
            my $delim = "";
-           foreach my $pt (@$poly) {
+           foreach my $pt (@{ $poly->{E} }) {
                p $delim;
                $pt =~ s{\d{5}}{$&,};
                $pt =~ s{\b\d}{$&.}g;