From 2f467257892528849ef8b6c6f0c018b49ca2068d Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Tue, 28 Oct 1997 11:16:02 +0100 Subject: [PATCH] patch::: 0.1.26: embedded (mf) slurs pl 26.jcn1 - bf: numerals - sleur.ly - embedded slur testing (mf is default) - bf + patch: make-patch release.py / VERSION --- NEWS | 6 ++ VERSION | 5 +- bin/lilypython.py | 5 +- bin/make-patch.py | 153 ++++++++++++++++++++++++++++++++++++++++++ bin/makepatch.py | 144 --------------------------------------- bin/release.py | 8 ++- init/font-en-tja16.ly | 2 +- init/font-en-tja20.ly | 2 +- input/sleur.ly | 21 ++++++ lily/tex-slur.cc | 51 ++++++++++++-- mf/feta-nummer.mf | 24 ++++--- mf/feta-sleur.mf | 33 +++++++++ tex/fetdefs.tex | 46 +++++++++++++ tex/font-en-tja16.tex | 2 +- tex/font-en-tja20.tex | 2 +- 15 files changed, 335 insertions(+), 169 deletions(-) create mode 100644 bin/make-patch.py create mode 100644 input/sleur.ly create mode 100644 mf/feta-sleur.mf diff --git a/NEWS b/NEWS index 8a29bc9b09..62469267cd 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,9 @@ +pl 26.jcn1 + - bf: numerals + - sleur.ly + - embedded slur testing (mf is default) + - bf + patch: make-patch release.py / VERSION + pl 26 - bf: \transpose - feta: numerals 0 - 9, rewrote flags. diff --git a/VERSION b/VERSION index 7fb5e2e952..f588daa2f8 100644 --- a/VERSION +++ b/VERSION @@ -1,6 +1,7 @@ TOPLEVEL_MAJOR_VERSION = 0 TOPLEVEL_MINOR_VERSION = 1 TOPLEVEL_PATCH_LEVEL = 26 -TOPLEVEL_MY_PATCH_LEVEL = - # use the above to send patches, always empty for released version: +# must not include leading . anymore! (why has convention changed?) +TOPLEVEL_MY_PATCH_LEVEL = jcn1 + diff --git a/bin/lilypython.py b/bin/lilypython.py index 7b063437a1..547e66187f 100644 --- a/bin/lilypython.py +++ b/bin/lilypython.py @@ -39,8 +39,9 @@ def version_tuple(file): mi = atoi(val) elif nm == 'TOPLEVEL_PATCH_LEVEL': pa = atoi(val) - elif nm == 'TOPLEVEL_MY_PATCH_LEVEL': - mp = val + # why has convention changed? + elif nm == 'TOPLEVEL_MY_PATCH_LEVEL' and nm != '': + mp = '.' + val return (mj,mi,pa,mp) def next_version(tup): diff --git a/bin/make-patch.py b/bin/make-patch.py new file mode 100644 index 0000000000..32ae99ae3b --- /dev/null +++ b/bin/make-patch.py @@ -0,0 +1,153 @@ +#!@PYTHON@ +from lilypython import * +import getopt +import pipes + + +mp_version = '2' + +class Options: + def __init__(self): + self.to_version = lilydirs.version_tuple() + self.from_version = prev_version(self.to_version) + +options = Options() + + +def help(): + sys.stdout.write( + 'Generate a patch to go to this version.\n' + ' --from=FROM, -f FROM old is FROM\n' + ' --to=TO, -t TO to version TO\n' + + ) + + + +def untar(fn): + # os.system('pwd'); + sys.stderr.write('untarring ' + fn) +# can't seem to fix errors: +# gzip: stdout: Broken pipe +# tar: Child returned status 1 +# os.system ('tar xzf ' + fn) +# sys.stderr.write('\n') +# ugh, even this does not work, but one error message less :-) + os.system ('gzip -dc ' + fn + '| tar xf - ') +# so print soothing message: + sys.stderr.write('make-patch:ugh: Please ignore error: gzip: stdout: Broken pipe\n'); + sys.stderr.flush() + + +header = 'Generated by make-patch, old = %s, new = %s\n\ +\n\ +usage \n\ +\n\ + cd lilypond-source-dir; patch -E -p0 < %s\n\ +\n\ +Patches do not contain automatically generated files, \n\ +i.e. you should rerun configure\n\n' + +import fnmatch +import os + +_debug = 0 + +_prune = ['(*)'] + + +def my_find(patterns, dir = os.curdir): + list = [] + names = os.listdir(dir) + names.sort() + for name in names: + if name in (os.curdir, os.pardir): + continue + fullname = os.path.join(dir, name) + for pat in patterns: + if fnmatch.fnmatch(name, pat): + list.append(fullname) + if os.path.isdir(fullname) and not os.path.islink(fullname): + for p in _prune: + if fnmatch.fnmatch(name, p): + if _debug: print "skip", `fullname` + break + else: + if _debug: print "descend into", `fullname` + found = my_find(patterns, fullname) + if found: + list = list + found + return list + +def multiple_find(pats, dirnames): + from find import find + l = [] + for d in dirnames: + l = l + my_find(pats, d) + return l + +pats = ['*.lsm', 'configure', '*.text', 'lilypond.spec'] +def remove_automatic(dirnames): + files = [] + files = files + multiple_find(pats, dirnames) + + for f in files: + os.remove(f) + +def makepatch(fv, tv, patfile_nm): + import tempfile + prev_cwd = os.getcwd(); + os.chdir ('/tmp') + untar(released_tarball(fv)) + untar(released_tarball(tv)) + remove_automatic([dirname(fv), dirname(tv)]) + + os.chdir(dirname(tv)) + + if not patfile_nm: + patfile_nm = '../patch-%s' % version_tuple_to_str(tv) + + f = open(patfile_nm, 'w') + f.write(header %\ + (version_tuple_to_str(fv), version_tuple_to_str(tv), \ + os.path.basename(patfile_nm))) + f.close() + + sys.stderr.write('diffing to %s... ' % patfile_nm) + os.system('diff -urN ../%s . >> %s' % (dirname(fv), patfile_nm)) + #os.system('gzip -9f %s' % patfile_nm) + os.chdir('/tmp') + + sys.stderr.write('cleaning ... ') + os.system('rm -fr %s %s' % (dirname(tv), dirname(fv))) + sys.stderr.write('\n') + os.chdir(prev_cwd) + +def main(): + sys.stderr.write('This is make-patch version %s\n' % mp_version) + (cl_options, files) = getopt.getopt(sys.argv[1:], + 'hf:o:t:', ['output=', 'help', 'from=', 'to=']) + outfn = '' + for opt in cl_options: + o = opt[0] + a = opt[1] + if o == '--from' or o == '-f': + options.from_version = version_str_to_tuple(a) + elif o == '--to' or o == '-t': + options.to_version = version_str_to_tuple(a) + elif o== '--help' or o == '-h': + help() + return 0; + elif o == '--output' or o == '-o': + outfn = os.path.join(os.getcwd(), a) + else: + raise getopt.error + + if not outfn: + pn = 'patch-%s' % version_tuple_to_str(options.to_version) + outfn = os.path.join(os.getcwd(), pn) + + makepatch(options.from_version, options.to_version, outfn) + +if __name__ == '__main__': + main() diff --git a/bin/makepatch.py b/bin/makepatch.py index 48a6c56bff..e69de29bb2 100644 --- a/bin/makepatch.py +++ b/bin/makepatch.py @@ -1,144 +0,0 @@ -#!@PYTHON@ -from lilypython import * -import getopt -import pipes - - -mp_version = '2' - -class Options: - def __init__(self): - self.to_version = lilydirs.version_tuple() - self.from_version = prev_version(self.to_version) - -options = Options() - - -def help(): - sys.stdout.write( - 'Generate a patch to go to this version.\n' - ' --from=FROM, -f FROM old is FROM\n' - ' --to=TO, -t TO to version TO\n' - - ) - - - -def untar(fn): - sys.stderr.write('untarring ' + fn) - os.system ('tar xzf ' + fn) - sys.stderr.write('\n') - sys.stderr.flush() - - -header = 'Generated by make-patch, old = %s, new = %s\n\ -\n\ -usage \n\ -\n\ - cd lilypond-source-dir; patch -E -p0 < %s\n\ -\n\ -Patches do not contain automatically generated files, \n\ -i.e. you should rerun configure\n\n' - -import fnmatch -import os - -_debug = 0 - -_prune = ['(*)'] - - -def my_find(patterns, dir = os.curdir): - list = [] - names = os.listdir(dir) - names.sort() - for name in names: - if name in (os.curdir, os.pardir): - continue - fullname = os.path.join(dir, name) - for pat in patterns: - if fnmatch.fnmatch(name, pat): - list.append(fullname) - if os.path.isdir(fullname) and not os.path.islink(fullname): - for p in _prune: - if fnmatch.fnmatch(name, p): - if _debug: print "skip", `fullname` - break - else: - if _debug: print "descend into", `fullname` - found = my_find(patterns, fullname) - if found: - list = list + found - return list - -def multiple_find(pats, dirnames): - from find import find - l = [] - for d in dirnames: - l = l + my_find(pats, d) - return l - -pats = ['*.lsm', 'configure', '*.text', 'lilypond.spec'] -def remove_automatic(dirnames): - files = [] - files = files + multiple_find(pats, dirnames) - - for f in files: - os.remove(f) - -def makepatch(fv, tv, patfile_nm): - import tempfile - prev_cwd = os.getcwd(); - os.chdir ('/tmp') - untar(released_tarball(fv)) - untar(released_tarball(tv)) - remove_automatic([dirname(fv), dirname(tv)]) - - os.chdir(dirname(tv)) - - if not patfile_nm: - patfile_nm = '../patch-%s' % version_tuple_to_str(tv) - - f = open(patfile_nm, 'w') - f.write(header %\ - (version_tuple_to_str(fv), version_tuple_to_str(tv), \ - os.path.basename(patfile_nm))) - f.close() - - sys.stderr.write('diffing to %s... ' % patfile_nm) - os.system('diff -urN ../%s . >> %s' % (dirname(fv), patfile_nm)) - #os.system('gzip -9f %s' % patfile_nm) - os.chdir('/tmp') - - sys.stderr.write('cleaning ... ') - os.system('rm -fr %s %s' % (dirname(tv), dirname(fv))) - sys.stderr.write('\n') - os.chdir(prev_cwd) - -def main(): - sys.stderr.write('This is make-patch version %s\n' % mp_version) - (cl_options, files) = getopt.getopt(sys.argv[1:], - 'hf:o:t:', ['output=', 'help', 'from=', 'to=']) - outfn = '' - for opt in cl_options: - o = opt[0] - a = opt[1] - if o == '--from' or o == '-f': - options.from_version = version_str_to_tuple(a) - elif o == '--to' or o == '-t': - options.to_version = version_str_to_tuple(a) - elif o== '--help' or o == '-h': - help() - elif o == '--output' or o == '-o': - outfn = os.path.join(os.getcwd(), a) - else: - raise getopt.error - - if not outfn: - pn = 'patch-%s' % version_tuple_to_str(options.to_version) - outfn = os.path.join(os.getcwd(), pn) - - makepatch(options.from_version, options.to_version, outfn) - -if __name__ == '__main__': - main() diff --git a/bin/release.py b/bin/release.py index 3e6026969f..7eefee88c8 100644 --- a/bin/release.py +++ b/bin/release.py @@ -1,8 +1,6 @@ #!@PYTHON@ from lilypython import * -import makepatch - os.chdir(lilydirs.topdir) os.system('make dist') @@ -10,10 +8,14 @@ cur_ver = lilydirs.version_tuple() os.rename('out/' + tarball(cur_ver), released_tarball(cur_ver)) os.chdir('../test') +os.system('pwd') os.system('rm ../test/*gz') os.link(released_tarball(cur_ver), tarball(cur_ver)) -makepatch.main() +# not a module, but a script: +# makepatch.main() +os.system('python ' + lilydirs.topdir + '/bin/make-patch.py'); + os.system('gzip -9 patch*') os.system('tar cf updeet *gz') diff --git a/init/font-en-tja16.ly b/init/font-en-tja16.ly index 8c5488ed2a..8f64017ecc 100644 --- a/init/font-en-tja16.ly +++ b/init/font-en-tja16.ly @@ -1,5 +1,5 @@ % generated automatically by mf-to-table.py version 0.4 -% on Mon Oct 27 02:45:17 1997 +% on Tue Oct 28 10:54:24 1997 % Do not edit % input from out/font-en-tja16.log % name=\symboltables { diff --git a/init/font-en-tja20.ly b/init/font-en-tja20.ly index 14c637a328..4819e80321 100644 --- a/init/font-en-tja20.ly +++ b/init/font-en-tja20.ly @@ -1,5 +1,5 @@ % generated automatically by mf-to-table.py version 0.4 -% on Mon Oct 27 02:45:24 1997 +% on Tue Oct 28 10:54:27 1997 % Do not edit % input from out/font-en-tja20.log % name=\symboltables { diff --git a/input/sleur.ly b/input/sleur.ly new file mode 100644 index 0000000000..c712abda2c --- /dev/null +++ b/input/sleur.ly @@ -0,0 +1,21 @@ +\header{ +enteredby = "jcn"; +copyright = "PD"; +TestedFeatures = "This file tests Feta embedded slurs" + "(Feta definitively is not an abbreviation of Font-En-TjA)"; +} + +%{ remember to: +rm `find /var/lib/texmf -name "feta-sleur-*"` +%} + +\version "0.1.7"; + +\score{ + \melodic{ + \octave c' + ;c'1() g' () c () g () c + } + \paper{ } +} + diff --git a/lily/tex-slur.cc b/lily/tex-slur.cc index 34cd12d5ef..2c36291514 100644 --- a/lily/tex-slur.cc +++ b/lily/tex-slur.cc @@ -13,6 +13,7 @@ #include "dimen.hh" #include "debug.hh" #include "paper-def.hh" +#include "string-convert.hh" static char @@ -134,13 +135,56 @@ Lookup::half_slur (int dy, Real &dx, Direction dir, int xpart) const Atom Lookup::slur (int dy , Real &dx, Direction dir) const { - assert (abs (dir) <= 1); if (dx < 0) { warning (_("Negative slur/tie length: ") + print_dimen (dx)); dx = 4.0 PT; } + + Atom s; + s.dim_[X_AXIS] = Interval (0, dx); + s.dim_[Y_AXIS] = Interval (min (0, dy), max (0, dy)); + + // duh + // let's try the embedded stuff + bool embedded_b = true; + if (embedded_b) + { + // huh, factor 8? + Real fdy = dy*paper_l_->interline_f (); + Real fdx = dx; + String ps = "\\embeddedps{\n"; + // ugh, how bout " /draw_slur { ... } def " + ps += "0 0 moveto\n"; + ps += String_convert::int_str (fdx/2) + " " + + String_convert::int_str (fdy/2) + " " + + String_convert::int_str (fdx) + " " + + String_convert::int_str (fdy) + " curveto\n"; + ps += "closepath\n"; + ps += "fill\n"; + ps += "}\n"; + + String mf = "\\embeddedmf{\n"; + mf += "input feta-sleur;\n"; + mf += "draw_slur((0,0),"; + mf += "(" + String_convert::int_str (fdx) + "," + + String_convert::int_str (fdy) + "),"; + mf += String_convert::int_str (dir) + ");\n"; + mf += "end.\n"; + ps += "}\n"; + + s.tex_ = ps + mf; + s.translate_axis (dx/2, X_AXIS); + // huh, extra translate? + + s.translate_axis (-1.5*paper_l_->note_width (), X_AXIS); + // mmm, does embedded slur always start at y = 0? +// s.translate_axis (-1.5*paper_l_->note_width (), Y_AXIS); + + return s; + } + Direction y_sign = (Direction) sign (dy); bool large = abs (dy) > 8; @@ -175,10 +219,6 @@ Lookup::slur (int dy , Real &dx, Direction dir) const WARN<<_("slur to steep: ") << dy << _(" shrinking (ugh)\n"); } - Atom s; - s.dim_[X_AXIS] = Interval (0, dx); - s.dim_[Y_AXIS] = Interval (min (0, dy), max (0, dy)); - String f = String ("\\slurchar") + String (direction_char (y_sign)); int idx=-1; @@ -205,7 +245,6 @@ Lookup::slur (int dy , Real &dx, Direction dir) const f+=String ("{") + String (idx) + "}"; s.tex_ = f; - s.translate_axis (dx/2, X_AXIS); return s; } diff --git a/mf/feta-nummer.mf b/mf/feta-nummer.mf index 8e816ab043..cd24109d02 100644 --- a/mf/feta-nummer.mf +++ b/mf/feta-nummer.mf @@ -77,7 +77,7 @@ def draw_six = penpos5(norm-hair,180); z5r=(0,y1); penpos6(hair,90); - z6r=(w-norm,h); + z6r=(w-norm-hair,h); penpos7(norm-hair,180); z7r=(0,h/2); penpos10(norm-hair,180); @@ -161,9 +161,10 @@ fet_beginchar("Numeral 2", "2", "two") penpos5(norm,0); z5r=(w-thin,.72h); penpos6(thin,90); - z6r=(w/2-thin-hair,h); + z6r=(w/2-thin,h); penlabels(4,5,6); - fill z1l{dir(beta)}..z4l{dir(15)}..z5r{up}..z6r{left} + save t; t=0.90; + fill z1l{dir(beta)}..z4l{dir(15)}..z5r{up}..tension t..z6r{left} ..z6l{right}..z5l{down}..z4r{dir(180+15)} ..{dir(180+beta)}z1r..cycle; draw_flare(z6r,180,90,thin,thick); @@ -339,8 +340,9 @@ fet_beginchar("Numeral 8", "8", "eight") save beta; beta=alpha-15; z1=(w/2,h/2+hair); penpos2(hair,90+180+beta); - z2=(w/4,h/2+thin); - z3=(0,h/4+thin/2); + z2=(w/3,h/2+thin); + penpos3(thin+hair,0); + z3l=(0,h/4+thin/2); penpos4(hair,90); z4l=(x1,0); penpos5(norm,90+90+alpha); @@ -349,12 +351,18 @@ fet_beginchar("Numeral 8", "8", "eight") z6=z1+w/4*dir(90+alpha); penpos7(hair,90); z7r=(x1,h); - z8=(w-hair,3/4h+thin/2); + penpos8(thin+hair,0); + z8r=(w-hair,3/4h+thin/2); penpos9(hair,90+180+beta); - z9=(3/4w,h/2); + z9=(2/3w,h/2); penlabels(1,2,3,4,5,6,7,8,9); save t; t=0.85; - fill z2r{dir(180+beta)}..tension t..z4r{right}..z5r{dir(90+alpha)}..z6r{dir(90+alpha)}..tension t..z7r{right}..z8{down}..z9r{dir(180+beta)}..z9l{dir(beta)}..tension t..z7l{left}..z6l{dir(alpha-90)}..z5l{dir(alpha-90)}..tension t..z4l{left}..z3{up}..z2l{dir(beta)}..cycle; + fill z2r{dir(180+beta)}..z3r{down}..z4r{right} + ..z5r{dir(90+alpha)}..z6r{dir(90+alpha)} + ..tension t..z7r{right}..z8r{down}..z9r{dir(180+beta)} + ..z9l{dir(beta)}..z8l{up}..z7l{left}..z6l{dir(alpha-90)} + ..z5l{dir(alpha-90)}..tension t..z4l{left}..z3l{up} + ..z2l{dir(beta)}..cycle; fet_endchar; fet_beginchar("Numeral 9", "9", "nine") diff --git a/mf/feta-sleur.mf b/mf/feta-sleur.mf new file mode 100644 index 0000000000..1eba2a6ce4 --- /dev/null +++ b/mf/feta-sleur.mf @@ -0,0 +1,33 @@ +% feta-sleur.mf + +mode_setup; +thin:=.2pt; +thick:=5thin; +bow:=.2; + +def sign(expr a) = + ((abs(a))/(a)) + enddef; + +def draw_slur(expr a,b,d) = + beginchar(0,0,0,0) "Embedded mf"; + % huh, factor 8? + z1=8a; + z3=8b; + save alpha; alpha=angle(z3-z1); + z2=(1/2[x1,x3],1/2[y1,y3])+d*bow*(x3-x1)*dir(alpha+90); + save beta; beta=d*sign(y3-y1)*1.5angle(z2-z1)-alpha; +% message "d: "&decimal d; +% message "dy: "& decimal sign(y3-y1); +% message "alpha: "&decimal alpha; +% message "beta: "&decimal beta; + penpos1(thin,alpha+beta+90); + penpos2(thick,alpha+90); + penpos3(thin,alpha-beta+90); + pickup pencircle; + fill z1l{dir(alpha+beta)}..z2l{dir(alpha)}..z3l{dir(alpha-beta)} + ..z3r{dir(180+alpha-beta)}..z2r{dir(180+alpha)}..z1r{dir(180+alpha+beta)} + ..cycle; + penlabels(1,2,3); + endchar; + enddef; diff --git a/tex/fetdefs.tex b/tex/fetdefs.tex index 56000c435e..3445dcece0 100644 --- a/tex/fetdefs.tex +++ b/tex/fetdefs.tex @@ -32,3 +32,49 @@ \nointerlineskip% \hbox to0.42\balkheight{\hss\fetanummer\char#2\hss}% \vss}} + +\newcount\embedcount\embedcount=0 +\newwrite\checkexists +\newwrite\embedfile + +\def\inputifexists#1{% + \openin\checkexists #1 + \ifeof\checkexists + \closein\checkexists + \relax + \else + \closein\checkexists + \input #1 + \fi +} +\def\embedcountid{feta-embed} +\inputifexists{\embedcountid.aux} +% let's not overwrite -- and be sure to create new +\def\storeembedcount{% + \immediate\openout\embedfile=\embedcountid.aux + \immediate\write\embedfile{\embedcount=\the\embedcount} + \immediate\closeout\embedfile +} +\def\EndLilyPondOutput{ + \storeembedcount + \csname bye\endcsname +} +\def\embeddedps#1{ + \edef\embedid{feta-sleur-\number\embedcount} + \immediate\openout\embedfile=\embedid.eps + \advance\embedcount by 1 + \immediate\write\embedfile{#1} + \immediate\closeout\embedfile + \special{psfile=\embedid.eps} +} +\def\embeddedmf#1{ + \edef\embedid{feta-sleur-\number\embedcount} + \immediate\openout\embedfile=\embedid.mf + \global\advance\embedcount by 1 + \immediate\write\embedfile{#1} + \immediate\closeout\embedfile + \font\expandafter\embedid\expandafter=\embedid + \hbox{\embedid\char0} +} +\def\embeddedps#1{} +%\def\embeddedmf#1{} diff --git a/tex/font-en-tja16.tex b/tex/font-en-tja16.tex index 03eaa36e9f..a1b3140a33 100644 --- a/tex/font-en-tja16.tex +++ b/tex/font-en-tja16.tex @@ -1,5 +1,5 @@ % generated automatically by mf-to-table.py version 0.4 -% on Mon Oct 27 02:45:17 1997 +% on Tue Oct 28 10:54:24 1997 % Do not edit % input from out/font-en-tja16.log % name diff --git a/tex/font-en-tja20.tex b/tex/font-en-tja20.tex index efc3fd3a76..66435feb38 100644 --- a/tex/font-en-tja20.tex +++ b/tex/font-en-tja20.tex @@ -1,5 +1,5 @@ % generated automatically by mf-to-table.py version 0.4 -% on Mon Oct 27 02:45:24 1997 +% on Tue Oct 28 10:54:27 1997 % Do not edit % input from out/font-en-tja20.log % name -- 2.39.5