]> git.donarmstrong.com Git - lilypond.git/commitdiff
patch::: 0.1.15.jcn2: leesvoer
authorJan Nieuwenhuizen <janneke@gnu.org>
Thu, 18 Sep 1997 14:48:13 +0000 (16:48 +0200)
committerJan Nieuwenhuizen <janneke@gnu.org>
Thu, 18 Sep 1997 14:48:13 +0000 (16:48 +0200)
pl 15.jcn2
- mf-to-table.in: generate mozarella metric info tables
- autometric.mf: write metric info to mf logfile

NEWS
VERSION
bin/mf-to-table.in [new file with mode: 0644]
init/table16.ly
init/table20.ly
mf/Makefile
mf/autometric.mf
mf/bolletjes.mf
mf/dyn10.mf
mf/font-en-tja16.mf
mf/font-en-tja20.mf

diff --git a/NEWS b/NEWS
index 811d918554d015eb30cb486b2fca6825f47ca564..7f22d8a840ad3b56e96612909ae6981a02a8dd0d 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,7 @@
+pl 15.jcn2
+       - mf-to-table.in: generate mozarella metric info tables
+       - autometric.mf: write metric info to mf logfile
+
 pl 15.jcn1
        - bf: typos whole and half notehead
        - de-uglyfied bolletjes.mf
diff --git a/VERSION b/VERSION
index 9c1970c8a29ca07b837c9fcaa60772e1d3cbeb07..b85f15066ac34a27cbca569b4378de1512874cee 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -3,4 +3,4 @@ TOPLEVEL_MINOR_VERSION = 1
 TOPLEVEL_PATCH_LEVEL = 15
 
 # use to send patches, always empty for released version:
-TOPLEVEL_MY_PATCH_LEVEL = .jcn1
+TOPLEVEL_MY_PATCH_LEVEL = .jcn2
diff --git a/bin/mf-to-table.in b/bin/mf-to-table.in
new file mode 100644 (file)
index 0000000..17a7c2f
--- /dev/null
@@ -0,0 +1,127 @@
+#!@PERL@ -w
+# -*-perl-*-
+
+=head1 TODO
+
+rename me!
+
+Ugh . Perl sux. Anybody for Python?
+    
+=cut    
+
+$mf_to_table_version = 0.1;
+
+use Getopt::Long;
+
+sub last_conversion
+{
+    my @v = &versions;
+    return pop @v;
+}
+sub identify
+{
+    
+    print STDERR "This is mf-to-table " . $mf_to_table_version . "\n";
+}
+  
+sub usage
+{
+    print STDERR "Usage: mf-to-table [options] LOG..\n"
+    . "Generate mozarella metrics table from preparated metafont log\n\n"
+    . "Options:\n"
+    . "  -h, --help             print this help\n"
+    . "  -o, --output=FILE      name output file\n"
+}
+
+sub make_table
+{
+    my $line;
+    my $indent = 0;
+    while ($line = <IN>) {
+       if ($line =~ /^@@/) {
+           $line =~ s/^@@(.*)@@/$1/;
+           chop ($line);
+           my @fields = split (/:/,$line);
+           my $label = $fields [0];
+           my $name = $fields [1];
+           print OUT "\t" x $indent;
+           if ($label eq "font") {
+               print OUT "% $name=\\symboltables {\n";
+               $indent++;
+           } elsif ($label eq "group") {
+               print OUT "\"$name\" = \\table {\n";
+               $indent++;
+           } elsif ($label eq "puorg") {
+               print OUT "}\n";
+               $indent--;
+           } elsif ($label eq "tnof") {
+               print OUT "%  } % $name\n";
+               $indent--;
+           } elsif ($label eq "char") {
+               my $c = $fields [2];
+               my $w = $fields [3];
+               my $h = $fields [4];
+               my $d = $fields [5];
+               my $id = $fields [6];
+               my $texstr = $fields [7];
+               print OUT sprintf( "\"%s\"\t\"\\%s\"\t%.2f\\pt\t%.2f\\pt\t%.2f\\pt\t%.2f\\pt\n", $id, $texstr, 0, $w, $h, $d );
+           } else {
+               print STDERR "mf-to-table: unknown label: \`$label\'\n";
+           }
+       }
+    }
+}
+      
+sub  set_files 
+{
+    $infile = "-";
+    $outfile = "-";
+    $outfile = $opt_output if (defined($opt_output));
+
+    if ($ARGV [0])  {
+       $infile = $ARGV[0];
+    } 
+    if (( ! -f $infile) && (! $infile =~ /\\.log$/s ) ){
+       $infile .= ".log";
+    }
+    print STDERR "Input ", (($infile eq "-") ?"STDIN" : $infile), " .. \n";
+}
+
+sub do_one_arg
+{
+    set_files;
+
+    die "can't open \`$infile\'" unless open IN,$infile ;
+    die "can't open \`$outfile\'" unless open OUT, ">$outfile";
+    print OUT "% generated at " . localtime() . " from $infile\n";
+    print OUT "% changes will be lost\n";
+    
+    make_table;
+
+    close IN;
+    close OUT;
+}
+
+## "main"
+
+identify;
+
+#GetOptions ("help", "output=s", "from=i", "to=i", "minor=i", "edit", "show-rules");
+GetOptions ("help", "output=s");
+
+if ($opt_help) {
+    usage();
+    $opt_help = 0;     # to extinguish typo check.
+    exit 0;
+}
+
+local ($infile,$outfile);
+my $processed_one=0;
+
+while (defined($ARGV[0])) {
+    do_one_arg;
+    shift @ARGV;
+    $processed_one = 1;
+}
+do_one_arg unless ($processed_one);
+
index 5097530ac834f83e2c120c3bc17dd9798e2c17ed..3869d070ad57b0b6512f2ab760a710340f539772 100644 (file)
@@ -75,18 +75,14 @@ table_sixteen=
        "tenor_change"  "\caltoclef"    0.0\pt  11.2\pt 0.0\pt  16.0\pt
      }
 
-     "balls" = \table {
-       "-2"    "\longaball"    0.0\pt  6.0\pt  -2.0\pt 2.0\pt
-       "-1"    "\breveball"    0.0\pt  6.0\pt  -2.0\pt 2.0\pt
-       "0"     "\wholeball"    0.0\pt  8.0\pt  0.0\pt  4.4\pt
-       "1"     "\halfball"     0.0\pt  5.4\pt  0.0\pt  4.4\pt
-       "2"     "\quartball"    0.0\pt  5.5\pt  0.0\pt  4.4\pt
-     }
+     % ugh what's our outdir called?
+     \include "mf/out/font-en-tja16.ly"
 
      "slur" = \table {
        "whole" "\slurchar%{%}"
        "half"  "\hslurchar%{%}"
      }
+
      "accidentals" = \table {
        "-2"    "\flatflat"     0.0\pt  8.16\pt -2.5\pt 7.5\pt
        "-1"    "\flat"         0.0\pt  4.8\pt  -2.5\pt 7.5\pt
index bc20a550ff0bfb29ef8099a3091264c0a4eaf4da..0abf1ac4b95d7482d52578f380f908707e0bc794 100644 (file)
@@ -78,12 +78,8 @@ table_twenty =
        "tenor_change"  "\caltoclef"    0.0\pt  16.0\pt 0.0\pt  20.0\pt
     }
 
-    "balls" = \table {
-       "-1"    "\breveball"    0.0\pt  7.5\pt  -2.5\pt 2.5\pt
-       "0"     "\wholeball"    0.0\pt  10.2\pt 0.0\pt  5.4\pt
-       "1"     "\halfball"     0.0\pt  6.8\pt  0.0\pt  5.4\pt
-       "2"     "\quartball"    0.0\pt  6.6\pt  0.0\pt  5.4\pt
-    }
+    % ugh what's our outdir called?
+    \include "mf/out/font-en-tja20.ly"
 
     "slur" = \table {
        "whole" "\slurchar%{%}" 0.0\pt  0.0\pt  0.0\pt  0.0\pt
index f3523f04c14d1249bce00ebb9bc1a5ac5b8a6a71..6bca9f001f0b4414c967d2f2189f6cc5f8222f88 100644 (file)
@@ -15,6 +15,23 @@ MFFILES = $(wildcard *.mf)
 EXTRA_DISTFILES = $(MFFILES) $(TEXFILES) TODO
 #
 
+FONT_FILES = $(wildcard *[0-9].mf)
+TABLES = $(addprefix $(outdir)/, $(FONT_FILES:.mf=.ly))
+#
+
+all: $(TABLES)
+
+localclean:
+       rm -f $(TABLES)
+
+$(outdir)/%.log: %.mf
+       mf $<
+       mv $(@F) $@
+       rm $(shell basename $< .mf).*gf
+
+$(outdir)/%.ly: $(outdir)/%.log
+       mf-to-table -o $@ $<
+       
 localinstall:
        $(INSTALL) -d $(MFDIR)/lilypond
        $(INSTALL) -m 644 $(MFFILES) $(MFDIR)/lilypond/
index ae9a8edc85bc5b0a844971118d4e6f4627dc9b81..4bdf68cf9403891082d5df0b349dbf073bf1fcad 100644 (file)
@@ -1,13 +1,30 @@
-% metric.mf
+% autometric.mf
 % part of LilyPond's pretty-but-neat music font
 
+% font or database?
 def fet_beginfont(expr name,size) =
        message "@@font:"&name&":"&decimal size&"@@";
        message "";
        enddef;
+
+def fet_endfont(expr name) =
+       message "@@tnof:"&name&"@@";
+       message "";
+       enddef;
+
+% group or table?
+def fet_begingroup(expr name) =
+       message "@@group:"&name&"@@";
+       message "";
+       enddef;
+
+def fet_endgroup(expr name) =
+       message "@@puorg:"&name&"@@";
+       message "";
+       enddef;
        
-def fet_beginchar(expr code,w,h,d,name) =
-       message "@@char:"&name&":"&decimal code&":"&decimal w&":"&decimal h&":"&decimal d&"@@";
+def fet_beginchar(expr code,w,h,d,name,id,texstr) =
+       message "@@char:"&name&":"&decimal code&":"&decimal w&":"&decimal h&":"&decimal d&":"&id&":"&texstr&"@@";
        beginchar(code,w,h,d) name;
        enddef;
 
index 849c9f9b6f7f68e22db91a8d00d15673b6061884..c5b32625e2c8ef1c76aff2757d502b488a45985a 100644 (file)
@@ -31,7 +31,7 @@ def begin_notehead =
        save b_h,a_w;
        enddef;
 
-def end_notehead(expr code,interline,name) =
+def end_notehead(expr code,interline,name,id,texstr) =
        save a,b,h,w,ai,bi;
        h#=interline;
        2b#=h#*b_h;
@@ -42,7 +42,7 @@ def end_notehead(expr code,interline,name) =
        define_pixels(a,b);
        define_pixels(w,h);
        define_pixels(ai,bi);
-       fet_beginchar(code,w#,h#,0,name);
+       fet_beginchar(code,w#,h#,0,name,id,texstr);
                path black,white;
                black=distorted_ellipse(a,b,a*err_y_a,0,super);
                white=distorted_ellipse(ai,bi,ai*err_y_ai,bi*err_x_bi,superi);
@@ -65,6 +65,8 @@ fi
                endgroup;
        enddef;
                
+% fet_begingroup("noteheads");
+fet_begingroup("balls");
 % whole note
 % Wanske, p.38
 % begin_notehead(incr code,interline#,"Whole notehead");
@@ -83,7 +85,7 @@ begin_notehead;
        superi:=0.69;
        b_h:=1; %no rotate-> no height correction
        a_w:=1; % no rotate-> no width correction
-       end_notehead(incr code,interline#,"Whole notehead");
+       end_notehead(incr code,interline#,"Whole notehead","0","wholeball");
 
 % half note
 % Wanske, p.39
@@ -101,7 +103,7 @@ begin_notehead;
        superi:=0.80;
        b_h:=0.935;
        a_w:=1.12;
-       end_notehead(incr code,interline#,"Half notehead");
+       end_notehead(incr code,interline#,"Half notehead","1","halfball");
 
 % quarter note
 % Wanske p.38
@@ -119,7 +121,13 @@ begin_notehead;
        superi:=0.707;
        b_h:=0.85;
        a_w:=1.09;
-       end_notehead(incr code,interline#,"Quarter notehead");
+       end_notehead(incr code,interline#,"Quarter notehead","2","quartball");
 
-end.
+% silly tableXX.ly fillers, for now
+fet_beginchar(incr code,2interline#,interline#,0,"Longa notehead","-2","longaball");
+endchar;
+fet_beginchar(incr code,2interline#,interline#,0,"Brevis notehead","-1","breveball");
+endchar;
+
+fet_endgroup("noteheads");
 
index 64ea7c7af28b4128489cdfd378d2204634a3aa36..8ff51a1813da4a54b04ee61d526601ab963cb95c 100644 (file)
@@ -112,6 +112,9 @@ flare#:=52/36pt#;    % diameter of bulbs or breadth of terminals
 mode_setup;
 font_setup;
 
+input autometric;
+fet_beginfont("dyn", 10);
+
 num=-1;
 input ital-f;
 
@@ -149,4 +152,6 @@ input ital-s;
 input ital-z;
 
 font_slant slant; font_x_height x_height#;
-bye.
+
+fet_endfont("dyn");
+end.
index 1e15311273efedceb389f30bb904aabb164b5fdd..5fc5cd8bfdf290f14a1e61a631350e074e92149e 100644 (file)
@@ -3,9 +3,6 @@
 
 mode_setup;
 
-font_name:="font-en-tja";
-font_size:=16;
-
 test:=0;
 
 staffsize#:=16pt#;
@@ -14,9 +11,11 @@ stafflinethickness#:=0.4pt#;
 code:=-1;
 
 input autometric;
-fet_beginfont;
+fet_beginfont("font-en-tja", 16);
 
 input bolletjes;
 
+fet_endfont("font-en-tja");
+
 end.
 
index 744133d7fe137417468509aecaf3a247b3640cff..c5f7b39e5d1c86e7ae571ea102b0fa1ee2d0d005 100644 (file)
@@ -12,9 +12,11 @@ stafflinethickness#:=0.4pt#;
 code:=-1;
 
 input autometric;
-fet_beginfont("font-en-tja", 16);
+fet_beginfont("font-en-tja", 20);
 
 input bolletjes;
 
+fet_endfont("font-en-tja");
+
 end.