chiark / gitweb /
commitid: Use polygon simplification rather than overlap fudge factor
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 14 Feb 2016 23:29:17 +0000 (23:29 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 14 Feb 2016 23:29:17 +0000 (23:29 +0000)
Previously we adjusted each polygon's vertices by a fudge factor to
make them overlap.  This produces small wrinkles at the corners of the
glyphs, which are undesriable and slow to render.

This new version is about 30% faster on anarres.

commitid.scad.pl

index ca365a3..62ae510 100755 (executable)
@@ -571,8 +571,8 @@ sub parsefont () {
                    } elsif (s{^\S}{}) {
                        my $f = $cellmap{$&};
                        die unless $f;
-                       $f =~ s/\b\d/ sprintf '%05d', $col*2000 + $&*1025 /ge;
-                       $f =~ s/\d\b/ sprintf '%05d', $row*2000 + $&*1025 /ge;
+                       $f =~ s/\b\d/ sprintf '%05d', $col*2000 + $&*1000 /ge;
+                       $f =~ s/\d\b/ sprintf '%05d', $row*2000 + $&*1000 /ge;
                        push @{ $chrpolys{$chr} }, { E => [ split / /, $f ] };
                    } else {
                        die "$_ ?";
@@ -590,6 +590,8 @@ sub parsefont () {
        my $polys = $chrpolys{$chr};
        $_->{Holes} = [] foreach @$polys;
 
+       simplify($chr,$polys);
+
        my $mod = chrmodname $chr;
        p "module $mod () {\n";
        foreach my $poly (@$polys) {