chiark / gitweb /
commitid: Make each polygon be a hashref containing E (nfc)
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 14 Feb 2016 23:12:44 +0000 (23:12 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 14 Feb 2016 23:13:43 +0000 (23:13 +0000)
We are going to want to record holes too.

commitid.scad.pl

index d646c32..f6c925a 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 "$_ ?";
                    }
@@ -415,7 +417,7 @@ sub parsefont () {
        foreach my $poly (@{ $chrpolys{$chr} }) {
            p " polygon([";
            my $delim = "";
-           foreach my $pt (@$poly) {
+           foreach my $pt (@{ $poly->{E} }) {
                p $delim;
                $pt =~ s{\d{5}}{$&,};
                $pt =~ s{\b\d}{$&.}g;