- gentextmodule("Full$sz",
- rjustt($sz, $git_count.$git_dirty),
- ljustt($sz, $git_object, ''))
- if defined $git_count && defined $git_object;
+ if (defined $git_count && defined $git_object) {
+ genform("Full".($sz*2),
+ ljustt($sz, $git_object),
+ rjustt($sz, $git_count, $git_dirty));
+
+ my $e = $sz;
+ genform("Full".($e*3)."T",
+ ljustt($e*2, $git_object, $git_dirty)
+ =~ m/.{$e}/g,
+ rjustt($e, $git_count));
+ }
+ }
+}
+
+sub do_some_best ($$) {
+ my ($modname, $formre) = @_;
+ my $fullmodname = "Commitid_${modname}_2D";
+ my @argl = qw(max_sz margin=Commitid_pixelsz());
+ p "module $fullmodname(".(join ', ', @argl).") {\n";
+ my $mbs = '$Commitid_max_best_scale';
+ p " sc_max = $mbs ? $mbs : 2;\n";
+ p " sz = max_sz - 2*[margin,margin];\n";
+ my @do;
+ foreach my $f (
+ sort {
+ $b->{Chars} <=> $a->{Chars} or
+ $a->{Lines} <=> $b->{Chars}
+ }
+ grep {
+ $_->{Form} =~ m/$formre/ &&
+ !$_->{Ambiguous}
+ }
+ @forms
+ ) {
+ my $form = $f->{Form};
+ p " sz_$form = Commitid_${form}_sz();\n";
+ foreach my $rot (qw(0 1)) {
+ my $id = "${form}_r${rot}";
+ p " sc_$id = min(sc_max";
+ foreach my $xy (qw(0 1)) {
+ p ",sz[$xy]/sz_$form","[",(($xy xor $rot)+0),"]";
+ }
+ p ");\n";
+ push @do, " if (sc_$id >= 1.0";
+ push @do, " && sc_$id >= sc_${form}_r1" if !$rot;
+ push @do, ") {\n";
+ push @do, " translate([margin,margin]) scale(sc_$id)\n";
+ push @do, " rotate(90) translate([0,-sz_$form"."[1]])\n" if $rot;
+ push @do, " Commitid_${form}_2D();\n";
+ push @do, " } else";
+ }