From 41549679c389cb99771b11f55c629a53806c0ee0 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Thu, 17 Feb 2000 19:19:58 +0100 Subject: [PATCH] patch::: 1.3.24.jcn1 1.3.24.jcn1 =========== * First attempt at real silly ascii output --- CHANGES | 5 + VERSION | 2 +- buildscripts/tfmtoafm.sh | 4 +- input/test/GNUmakefile | 2 + input/test/test.musa | 2 + lily/atom.cc | 2 +- lily/include/dimensions.hh | 2 + lily/my-lily-lexer.cc | 1 + lily/paper-outputter.cc | 11 +- lily/parser.yy | 6 +- ly/GNUmakefile | 2 +- ly/declarations-musa.ly | 68 ++++++ ly/init.musa | 36 ++++ ly/paper-musa9.ly | 41 ++++ ly/params-musa.ly | 239 +++++++++++++++++++++ mf/GNUmakefile | 6 +- mf/musa-nummer1.af | 4 + mf/musa-nummer1.afm | 9 + mf/musa9.af | 26 +++ mf/musa9.afm | 123 +++++++++++ mutopia/E.Satie/gnossienne-4-autochange.ly | 11 +- scm/lily.scm | 122 ++++++++++- scripts/musa.py | 232 ++++++++++++++++++++ 23 files changed, 934 insertions(+), 22 deletions(-) create mode 100644 input/test/test.musa create mode 100644 ly/declarations-musa.ly create mode 100644 ly/init.musa create mode 100644 ly/paper-musa9.ly create mode 100644 ly/params-musa.ly create mode 100644 mf/musa-nummer1.af create mode 100644 mf/musa-nummer1.afm create mode 100644 mf/musa9.af create mode 100644 mf/musa9.afm create mode 100644 scripts/musa.py diff --git a/CHANGES b/CHANGES index 0951aa432f..576dab824b 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,8 @@ +1.3.24.jcn1 +=========== + +* First attempt at real silly ascii output + 1.3.23.uu1 ========== diff --git a/VERSION b/VERSION index 3be69d6a1b..26c821eead 100644 --- a/VERSION +++ b/VERSION @@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=3 PATCH_LEVEL=24 -MY_PATCH_LEVEL= +MY_PATCH_LEVEL=jcn1 # use the above to send patches: MY_PATCH_LEVEL is always empty for a # released version. diff --git a/buildscripts/tfmtoafm.sh b/buildscripts/tfmtoafm.sh index f598a8657a..42c0bf6ee2 100755 --- a/buildscripts/tfmtoafm.sh +++ b/buildscripts/tfmtoafm.sh @@ -19,11 +19,11 @@ rm -f $t1 $t2 $font $afm for i in `seq 1 127`; do printf "%d Character-%d\n" $i $i >> $t1; done tfmtodit $fontfile $t1 $font rm $t1 -scaling=`nawk -v OFMT='%.5f' '/designsize/ {print $2/'$size/1000} $font` +scaling=`awk -v OFMT='%.5f' '/designsize/ {print $2/'$size/1000} $font` tail -127 $font | cut -f 1-2 > $t1 cat $t1 | cut -d, -f 1-2 > $t2 rm $t1 -nl -ba $t2 | nawk -F '[ \t,]+' '{print "C "$2";\t"$3";\tB 0.00 0.00 "$4/'"$scaling"'" "$5/'"$scaling"'";"}' > $t1 +nl -ba $t2 | awk -F '[ \t,]+' '{print "C "$2";\t"$3";\tB 0.00 0.00 "$4/'"$scaling"'" "$5/'"$scaling"'";"}' > $t1 cat > $afm < x.tex\n" "(primitive-load-path 'lily.scm)\n" - "(scm-tex-output)\n" + "(scm-musa-output)\n" + ";(scm-tex-output)\n" ";(scm-ps-output)\n" "(map (lambda (x) (display (eval x))) '(\n" ), port); @@ -165,7 +166,7 @@ Paper_outputter::dump_onto (Paper_stream *ps) scm_display (newline, port); scm_flush (port); } - scm_display (gh_str02scm (")))"), port); + scm_display (gh_str02scm ("))"), port); scm_display (newline, port); scm_flush (port); scm_close_port (port); @@ -191,7 +192,7 @@ Paper_outputter::dump_onto (Paper_stream *ps) *ps << ly_scm2string (result); } - *ps << ")))"; + *ps << "))"; } #endif diff --git a/lily/parser.yy b/lily/parser.yy index 6b11c89d04..a3a54d31f9 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -139,7 +139,7 @@ yylex (YYSTYPE *s, void * v_l) %token BREATHE %token CHORDMODIFIERS %token CHORDS -%token HYPHEN +%token CHAR_T %token CLEF %token CM_T %token CONSISTS @@ -151,6 +151,7 @@ yylex (YYSTYPE *s, void * v_l) %token FONT %token GRACE %token HEADER +%token HYPHEN %token IN_T %token INVALID %token KEY @@ -588,6 +589,9 @@ real_with_dimension: | REAL MM_T { $$ = $1 MM; } + | REAL CHAR_T { + $$ = $1 CHAR; + } ; real: diff --git a/ly/GNUmakefile b/ly/GNUmakefile index dda5863d26..a9e1606bef 100644 --- a/ly/GNUmakefile +++ b/ly/GNUmakefile @@ -3,7 +3,7 @@ depth = .. INI_FILES = $(FLY_FILES) $(SLY_FILES) $(LY_FILES) -EXTRA_DIST_FILES = $(SCM_FILES) +EXTRA_DIST_FILES = $(SCM_FILES) init.musa INSTALLATION_DIR=$(datadir)/ly/ INSTALLATION_FILES=$(INI_FILES) diff --git a/ly/declarations-musa.ly b/ly/declarations-musa.ly new file mode 100644 index 0000000000..854e707fbd --- /dev/null +++ b/ly/declarations-musa.ly @@ -0,0 +1,68 @@ + +breve = \duration { -1 0 } +longa = \duration { -2 0 } +maxima = \duration { -3 0 } + +#(eval-string (ly-gulp-file "generic-property.scm")) + +\include "nederlands.ly" % dutch +\include "chord-modifiers.ly" +\include "script.ly" + + +% declarations for standard directions +left = -1 +right = 1 +up = 1 +down = -1 +start = -1 +stop = 1 +smaller = -1 +bigger = 1 + +center=0 + +break = \penalty -1000000; +nobreak = \penalty 1000000; + +major = 0 +minor = 3 + +ionian = 0 +locrian = 1 +aeolian = 3 +mixolydian = 5 +lydian = 7 +phrygian = 8 +dorian = 10 + +melisma = \property Staff.melismaBusy = ##t +melismaEnd = \property Staff.melismaBusy = ##f + +%papersize = "a4" +%\include "generic-paper.ly" + +#(eval-string (ly-gulp-file "paper.scm")) + +\paper { + texsetting = ""; + pssetting = ""; + scmsetting = "(lilyponddefs.ps) findlibfile {exch pop //systemdict /run get exec} { /undefinedfilename signalerror } ifelse;\n";% UGH. +} + +\include "paper-musa9.ly" + +% ugh +\include "midi.ly" + +\include "textscripts.ly" +\include "spanners.ly" + +\include "property.ly" + + + +unusedEntry = \notes { c4 } % reset default duration + +% music = "\melodic\relative c" + diff --git a/ly/init.musa b/ly/init.musa new file mode 100644 index 0000000000..ba94810827 --- /dev/null +++ b/ly/init.musa @@ -0,0 +1,36 @@ +% Toplevel MUSicAscii initialisation file. + +\version "1.3.24"; + +\include "declarations-musa.ly" + +% burp. need to override lily.scm +#(define cmr-alist + '(("bold" . "cmbx") + ("dynamic" . "feta-din") + ("feta" . "feta") + ("feta-1" . "feta") + ("feta-2" . "feta") + ("finger" . "musa-nummer") + ("typewriter" . "cmtt") + ("italic" . "cmti") + ("roman" . "cmr") + ("script" . "cmr") + ("large" . "cmbx") + ("Large" . "cmbx") + ("mark" . "musa-nummer") + ("number" . "musa-nummer") + ("volta" . "musa-nummer")) +) + +\score { + \context Voice \notes\relative c { + \maininput + } + \paper { + \paper_musa_nine + %linewidth=-1.0; + %indent = 0.0; + } + %\midi{ } +} diff --git a/ly/paper-musa9.ly b/ly/paper-musa9.ly new file mode 100644 index 0000000000..d226c5bc3a --- /dev/null +++ b/ly/paper-musa9.ly @@ -0,0 +1,41 @@ +% paper-musa.ly + +\version "1.3.24"; + +paper_musa_nine = \paper { + staffheight = 9.\char; + + font_large = 12.; + font_Large = 12.; + font_normal = 10.; + font_script = 8.; + + font_finger = 1.; + font_volta = 1.; + font_number = 1.; + font_mark = 1.; + + % what about: + "font_number-1" = 8.; + %"font_number" = 10.; + "font_number+1" = 12.; + + % Ugh + magnification_dynamic = 2.; + + % ugh see table20 for sizes + quartwidth = 3.\char; + wholewidth = 3.\char; + + -2 = \font "musa9" + -1 = \font "musa9" + 0 = \font "musa9" + + "font_feta-2" = 9.; + "font_feta-1" = 9.; + "font_feta" = 9.; + + \include "params-musa.ly"; +} + +\paper { \paper_musa_nine } diff --git a/ly/params-musa.ly b/ly/params-musa.ly new file mode 100644 index 0000000000..bd2266d69a --- /dev/null +++ b/ly/params-musa.ly @@ -0,0 +1,239 @@ +% params-musa.ly +% generic paper parameters + +%%paperfile = \papersize + ".ly"; +%%% paperfile = "a4.ly"; +%%\include \paperfile; +%hsize = 60.0\char; +%vsize = 60.0\char; %? + +%%\include "paper.ly"; +linewidth = 60.0\char; +textheight = 60.0\char; +indent = 8.0\char; + +%interline = \staffheight / 4.0; +interline = 2.0\char; + +%stafflinethickness = \interline / 10.0; +stafflinethickness = 1.0\char; + +% urg, need grace_ versions of these too? +beam_thickness = 0.52 * (\interline - \stafflinethickness); + +#'beam-thickness = \beam_thickness; %% UGR + + +interbeam = (2.0 * \interline + \stafflinethickness - \beam_thickness) / 2.0; +interbeam4 = (3.0 * \interline - \beam_thickness) / 3.0; + +%{ +The space taken by a note is determined by the formula + +arithmetic_multiplier * ( c + log2 (time) )) + +where code(time) is the amount of time a note occupies. The value +of code(c) is chosen such that the smallest space within a measure is +arithmetic_basicspace. The smallest space is the one following the +shortest note in the measure. Typically arithmetic_basicspace is set +to the width of a quarter note head. +%} +arithmetic_basicspace = 2.; +arithmetic_multiplier = 0.9 * \quartwidth ; + + +#'Stem_tremolo::beam-width = 1.5 * \quartwidth ; + +#'Clef_item::visibility-lambda = #postbreak-only-visibility +#'Key_item::visibility-lambda = #postbreak-only-visibility +#'Breathing_sign::visibility-lambda = #non-postbreak-visibility + +% catch suspect beam slopes, set slope to zero if +% outer stem is lengthened more than +beam_lengthened = 0.2 * \interline; +% and slope is running away steeper than +beam_steep_slope = 0.2 / 1.0; + +%{ +dit(code(slur_x_gap)) Horizontal space between note and slur. Set to +code(\interline / 5) by default. + +%} +% OSU: suggested gap = ss / 5; +slur_x_gap = \interline / 5.0; +slur_y_gap = 0.25 * \interline; +slur_y_free = 0.75 * \interline; +slur_x_minimum = 1.5 * \interline; + +%{ +Like beams, slurs often aren't as steep as the notes they encompass. +This sets the amount of damping. +%} +% slope damping: keep dy/dx < slur_slope_damping +slur_slope_damping = 0.3; +slur_interstaff_slope_damping = 0.6; +% height damping: keep h/dx < slur_height_damping +slur_height_damping = 0.4; +slur_interstaff_height_damping = 0.5; +% snap to stem if slur ends closer to stem than +slur_snap_to_stem = 1.75 * \interline; +slur_interstaff_snap_to_stem = 2.5 * \interline; +% maximum dy change allowed by snapping +slur_snap_max_slope_change = 0.5; +slur_interstaff_snap_max_slope_change = 0.5; + + + +tie_x_minimum = \interline + \slur_x_minimum; +% OSU: tie gap == slur gap +tie_x_gap = \slur_x_gap; +tie_y_gap = 0.25 * \interline; +% length of a tie that's a staffspace high +tie_staffspace_length = 4.0 * \interline; + +% ugh: rename to bow (in bezier.cc and fonts.doc too...) + +% used to be 1.4 . +slur_thickness = 1.2 * \stafflinethickness; +tie_thickness = 1.2 * \stafflinethickness; + +%{ + Specifies the maximum height of slurs. +%} +slur_height_limit = \staffheight; + + +%{ +Specifes the ratio of slur hight to slur width +to aim for. Default value is 0.3. +%} + +% slur_ratio = 0.3; +% try bit flatter slurs +slur_ratio = 0.25; +slur_clip_ratio = 1.2; +slur_clip_height = 3.0 * \staffheight; +slur_clip_angle = 100.0; +slur_rc_factor = 2.4; + +% ugh +notewidth = 3.0\char; + +gourlay_energybound = 100000.; +%{ +Maximum number of measures per line to try when using Gourlay +method. +%} +gourlay_maxmeasures = 10.; + +bar_kern = 1.0\char; +bar_thinkern = 1.0\char; +barthick_thick = 1.0\char; +barthick_score = 1.0\char; +barthick_thin = 1.0\char; + +bracket_arch_thick = \interline / 3.0; +bracket_width = 2.0 * \interline; +bracket_thick = 2.0 * \stafflinethickness; +bracket_arch_height = 1.5 * \interline; +bracket_arch_width = \bracket_arch_height; +bracket_arch_angle = 50.0; + +tuplet_spanner_gap = 2.0 * \interline; +tuplet_thick = 1.0*\stafflinethickness; +volta_thick = 1.6*\stafflinethickness; +volta_spanner_height = 2.0 *\interline; + +% relative thickness of thin lines 1.6 : 1 : 0.8 +stemthickness = 1.0\char; +rulethickness = 1.0\char; + + +extender_height = 0.8*\stafflinethickness; + +hyphen_thickness = 0.05*\font_normal; +hyphen_height = 0.2*\font_normal; +hyphen_minimum_length = 0.25*\font_normal; + +% Multi-measure rests +multi_measure_rest_x_minimum = 2.5*\staffheight; +multi_measure_rest_padding = 2.0 *\interline; +multi_measure_rest_expand_limit = 10.0; + +% chop off this much when next to pp / ff sign. +crescendo_shorten = 4.0 * \interline; +crescendo_thickness = \stafflinethickness; +crescendo_height = 0.666 * \interline; + +% in internote. +restcollision_minimum_dist = 3.0; +restcollision_minimum_beamdist = 1.5; + + +% unit for note collision resolving +collision_note_width = \notewidth; %ugh. + +% deprecated! +postBreakPadding = 0.0; + +% optical correction amount. +stemSpacingCorrection = 0.5*\interline; + + +%{ + relative strength of space following breakable columns (eg. prefatory matter) + %} +breakable_column_space_strength = 2.0; + +% space after inline clefs and such get this much stretched +decrease_nonmus_spacing_factor = 1.0 ; + +%{ + space before musical columns (eg. taken by accidentals) get this much + stretched when they follow a musical column, in absence of grace notes. + + 0.0 means no extra space (accidentals are ignored) +%} +musical_to_musical_left_spacing_factor = 0.4; + +%{ + stretch space this much if there are grace notes before the column +%} +before_grace_spacing_factor = 1.2; + +%{ +If columns do not have spacing information set, set it to this much +%} +loose_column_distance = 2.0 * \interline; + +%{ +Relative cost of compressing (vs. stretching). Increasing this +will cause scores to be set looser +. +%} + +compression_energy_factor = 0.6; + +% if stem is on middle line, choose this direction. +stem_default_neutral_direction = 1.0; + +% in interline +articulation_script_padding_default = 1.0; + +% Backward compatibility -- has no function; +Gourlay = 0.0; +Wordwrap =0.0; + +\include "engraver.ly"; + + +#'margin-shape = #'() + + +% +#'Local_key_item::left-padding = #'0.2 +#'Local_key_item::right-padding = #'0.4 + +#'Staff_symbol::staff-space = \interline ; +#'Staff_symbol::line-count = #5 + diff --git a/mf/GNUmakefile b/mf/GNUmakefile index 81fd8abf3b..6bc5edb458 100644 --- a/mf/GNUmakefile +++ b/mf/GNUmakefile @@ -4,7 +4,11 @@ depth = .. STEPMAKE_TEMPLATES=metafont metapost install install-out -EXTRA_DIST_FILES += README feta.tex +AF_FILES = $(wildcard *.af) +#AFM_FILES = $(wildcard *.afm) +AF_AFM_FILES = $(wildcard *.afm) + +EXTRA_DIST_FILES += README feta.tex $(AF_FILES) $(AF_AFM_FILES) FET_FILES = $(wildcard feta[0-9]*.mf) FONT_FILES = $(wildcard feta*[0-9].mf) diff --git a/mf/musa-nummer1.af b/mf/musa-nummer1.af new file mode 100644 index 0000000000..2873824bbb --- /dev/null +++ b/mf/musa-nummer1.af @@ -0,0 +1,4 @@ +# musa-nummer1.af -- + + C 52; WX 1; N Numeral-4; B 0 1 0 1; +4 diff --git a/mf/musa-nummer1.afm b/mf/musa-nummer1.afm new file mode 100644 index 0000000000..5037fc3af1 --- /dev/null +++ b/mf/musa-nummer1.afm @@ -0,0 +1,9 @@ +StartFontMetrics 2.0 +Comment musa-nummer1.afm +FontName musa-nummer 1 +FontFamily musa-nummer +StartCharMetrics 1 +Comment 52; WX 1; N Numeral-4; B 0 1000 0 1000; +C 52; WX 1; N Numeral-4; B 0 100 0 100; +EndCharMetrics +EndFontMetrics %d diff --git a/mf/musa9.af b/mf/musa9.af new file mode 100644 index 0000000000..178d640a5f --- /dev/null +++ b/mf/musa9.af @@ -0,0 +1,26 @@ +# musa9.af -- + + C 23; WX 2; N dots-dot; B 0 3 1 0; +. + C 33; WX 9; N noteheads-0; B 0 3 1 0; +(O) + C 34; WX 6; N noteheads-1; B 0 3 1 0; +(O) + C 35; WX 6; N noteheads-2; B 0 3 1 0; +(*) + C 86; WX 7; N flags-d3; B 0 2 1 1; +\ + \ + C 95 ; WX 1 ; N clefs-G ; B 5 0 -3 7; + /\ + | | + |/ + | + /| + / | +| | _ +| (@) ) + \ | / + | + | + (_| diff --git a/mf/musa9.afm b/mf/musa9.afm new file mode 100644 index 0000000000..3c0dcd287d --- /dev/null +++ b/mf/musa9.afm @@ -0,0 +1,123 @@ + +StartFontMetrics 2.0 +Comment Musa9.afm +FontName musa 9 +FontFamily musa +StartCharMetrics 110 +C 0 ; WX 7 ; N rests-0 ; B 0 -3125 7500 0 ; +C 1 ; WX 7 ; N rests-1 ; B 0 0 7500 3125 ; +C 2 ; WX 7 ; N rests-0o ; B 0 -3125 7500 500 ; +C 3 ; WX 7 ; N rests-1o ; B 0 -500 7500 3125 ; +C 4 ; WX 3 ; N rests--1 ; B 0 0 3000 5000 ; +C 5 ; WX 3 ; N rests--2 ; B 0 -5000 3000 5000 ; +C 6 ; WX 40 ; N rests--4 ; B -20000 -5000 20000 5000 ; +C 7 ; WX 5 ; N rests-2 ; B 0 -6250 5400 7812 ; +C 8 ; WX 6 ; N rests-3 ; B 0 -5000 6666 4208 ; +C 9 ; WX 7 ; N rests-4 ; B 0 -10000 7756 4208 ; +C 10 ; WX 8 ; N rests-5 ; B 0 -10000 8752 9208 ; +C 11 ; WX 9 ; N rests-6 ; B 0 -15000 9384 9208 ; +C 12 ; WX 10 ; N rests-7 ; B 0 -15000 10447 14208 ; +C 13 ; WX 4 ; N rests-2mensural ; B 0 0 4000 4000 ; +C 14 ; WX 4 ; N rests-3mensural ; B 0 0 4000 4000 ; +C 15 ; WX 4 ; N rests-4mensural ; B 0 0 4000 5000 ; +C 16 ; WX 5 ; N accidentals-1 ; B 0 -7500 5500 7500 ; +C 17 ; WX 3 ; N accidentals-0 ; B 0 -7500 3333 7500 ; +C 18 ; WX 4 ; N accidentals--1 ; B -600 -2500 4000 10000 ; +C 19 ; WX 7 ; N accidentals--2 ; B -600 -2500 7249 10000 ; +C 20 ; WX 5 ; N accidentals-2 ; B 0 -2500 5000 2500 ; +C 21 ; WX 3 ; N accidentals-) ; B 0 -5000 3000 5000 ; +C 22 ; WX 3 ; N accidentals-( ; B -3000 -5000 0 5000 ; +C 23 ; WX 2 ; N dots-dot ; B 0 -1125 2249 1125 ; +C 24 ; WX 2 ; N dots-repeatcolon ; B 0 -2500 2249 2500 ; +C 25 ; WX 13 ; N noteheads--3mensural ; B 0 -2750 13000 2750 ; +C 26 ; WX 10 ; N noteheads--2mensural ; B 0 -2750 10000 2750 ; +C 27 ; WX 10 ; N noteheads--1mensural ; B 0 -2750 10000 2750 ; +C 28 ; WX 5 ; N noteheads-0mensural ; B 0 -2750 5000 2750 ; +C 29 ; WX 5 ; N noteheads-1mensural ; B 0 -2750 5000 2750 ; +C 30 ; WX 5 ; N noteheads-2mensural ; B 0 -2750 5000 2750 ; +C 31 ; WX 5 ; N noteheads-ledgerending ; B -2500 -500 2500 500 ; +C 32 ; WX 9 ; N noteheads--1 ; B 0 -2750 9900 2750 ; +Comment 33 ; WX 9 ; N noteheads-0 ; B 0 -2750 9900 2750 ; +C 33 ; WX 9 ; N noteheads-0 ; B 0 -1000 500 500 ; +Comment 34 ; WX 6 ; N noteheads-1 ; B 0 -2750 6887 2750 ; +C 34 ; WX 6 ; N noteheads-1 ; B 0 -1000 500 500 ; +Comment 35 ; WX 6 ; N noteheads-2 ; B 0 -2750 6605 2750 ; +C 35 ; WX 6 ; N noteheads-2 ; B 0 -1000 500 500 ; +C 36 ; WX 9 ; N noteheads-0diamond ; B 0 -2750 9900 2750 ; +C 37 ; WX 7 ; N noteheads-1diamond ; B 0 -2750 7081 2750 ; +C 38 ; WX 6 ; N noteheads-2diamond ; B 0 -2750 6605 2750 ; +C 39 ; WX 6 ; N noteheads-2cross ; B 0 -2750 6605 2750 ; +C 40 ; WX 13 ; N scripts-ufermata ; B -6625 -375 6625 7250 ; +C 41 ; WX 13 ; N scripts-dfermata ; B -6625 -7250 6625 375 ; +C 42 ; WX 4 ; N scripts-thumb ; B -2000 -2500 2000 2500 ; +C 43 ; WX 8 ; N scripts-sforzato ; B -4499 -2500 4499 2500 ; +C 44 ; WX 1 ; N scripts-staccato ; B -750 -750 750 750 ; +C 45 ; WX 2 ; N scripts-ustaccatissimo ; B -1000 -200 1000 5000 ; +C 46 ; WX 2 ; N scripts-dstaccatissimo ; B -1000 -5000 1000 200 ; +C 47 ; WX 6 ; N scripts-tenuto ; B -3000 -350 3000 350 ; +C 48 ; WX 5 ; N scripts-umarcato ; B -2500 0 2500 5500 ; +C 49 ; WX 5 ; N scripts-dmarcato ; B -2500 -5500 2500 0 ; +C 50 ; WX 4 ; N scripts-open ; B -2000 -2500 2000 2500 ; +C 51 ; WX 5 ; N scripts-stopped ; B -2750 -2750 2750 2750 ; +C 52 ; WX 6 ; N scripts-upbow ; B -3250 0 3250 10400 ; +C 53 ; WX 7 ; N scripts-downbow ; B -3750 0 3750 6666 ; +C 54 ; WX 10 ; N scripts-reverseturn ; B -5468 -2647 5468 2647 ; +C 55 ; WX 10 ; N scripts-turn ; B -5468 -2647 5468 2647 ; +C 56 ; WX 10 ; N scripts-trill ; B -5000 0 5000 11250 ; +C 57 ; WX 5 ; N scripts-upedalheel ; B -2500 -2500 2500 3333 ; +C 58 ; WX 5 ; N scripts-dpedalheel ; B -2500 -3333 2500 2500 ; +C 59 ; WX 5 ; N scripts-upedaltoe ; B -2500 0 2500 7500 ; +C 60 ; WX 5 ; N scripts-dpedaltoe ; B -2500 -7500 2500 0 ; +C 61 ; WX 5 ; N scripts-flageolet ; B -2666 -2666 2666 2666 ; +C 62 ; WX 10 ; N scripts-repeatsign ; B -5000 -5000 5000 5000 ; +C 63 ; WX 10 ; N scripts-segno ; B -5000 -7500 5000 7500 ; +C 64 ; WX 10 ; N scripts-coda ; B -5083 -6750 5083 6750 ; +C 65 ; WX 4 ; N scripts-trilelement ; B -3333 -2500 1306 2500 ; +C 66 ; WX 11 ; N scripts-prall ; B -5653 -2500 5653 2500 ; +C 67 ; WX 11 ; N scripts-mordent ; B -5653 -2500 5653 2500 ; +C 68 ; WX 15 ; N scripts-prallprall ; B -7973 -2500 7973 2500 ; +C 69 ; WX 15 ; N scripts-prallmordent ; B -7973 -2500 7973 2500 ; +C 70 ; WX 15 ; N scripts-upprall ; B -7973 -2500 7973 2500 ; +C 71 ; WX 15 ; N scripts-downprall ; B -7973 -2500 7973 2500 ; +C 72 ; WX 15 ; N scripts-accDiscant ; B -7500 0 7500 15000 ; +C 73 ; WX 5 ; N scripts-accDot ; B -2500 0 2500 0 ; +C 74 ; WX 10 ; N scripts-accFreebase ; B -5000 0 5000 10000 ; +C 75 ; WX 20 ; N scripts-accStdbase ; B -10000 0 10000 20000 ; +C 76 ; WX 10 ; N scripts-accBayanbase ; B -5000 0 5000 15000 ; +C 77 ; WX 15 ; N scripts-accSB ; B -7999 0 7999 11999 ; +C 78 ; WX 15 ; N scripts-accBB ; B -7999 0 7999 11999 ; +C 79 ; WX 10 ; N scripts-accOldEE ; B -5000 0 5000 10000 ; +C 80 ; WX 10 ; N scripts-accOldEES ; B -5000 0 5000 10000 ; +C 81 ; WX 6 ; N flags-u3 ; B -250 -15325 6169 250 ; +C 82 ; WX 6 ; N flags-u4 ; B -250 -17825 6169 250 ; +C 83 ; WX 6 ; N flags-u5 ; B -250 -21575 6169 250 ; +C 84 ; WX 6 ; N flags-u6 ; B -250 -26575 6169 250 ; +C 85 ; WX 9 ; N flags-ugrace ; B -3512 -10800 6169 -5000 ; +C 86 ; WX 7 ; N flags-d3 ; B -250 -250 6827 14575 ; +C 87 ; WX 7 ; N flags-d4 ; B -250 -250 6827 15325 ; +C 88 ; WX 7 ; N flags-d5 ; B -250 -250 6827 19575 ; +C 89 ; WX 7 ; N flags-d6 ; B -250 -250 6827 22075 ; +C 90 ; WX 10 ; N flags-dgrace ; B -3907 4950 6827 10260 ; +C 91 ; WX 13 ; N clefs-C ; B 0 -10000 13611 10000 ; +C 92 ; WX 10 ; N clefs-C_change ; B 0 -8000 10888 8000 ; +C 93 ; WX 10 ; N clefs-F ; B 2500 -12500 13000 5000 ; +C 94 ; WX 8 ; N clefs-F_change ; B 1999 -10000 10400 4000 ; +Comment 95 ; WX 13 ; N clefs-G ; B 642 -15000 13685 25000 ; +Comment 95 ; WX 13 ; N clefs-G ; B 1000 -1000 1000 1000 ; +C 95 ; WX 1 ; N clefs-G ; B 0 5 -5 10; +C 96 ; WX 10 ; N clefs-G_change ; B 214 -12000 10648 20000 ; +C 97 ; WX 17 ; N timesig-C4/4 ; B -9499 -5000 8499 5000 ; +C 98 ; WX 17 ; N timesig-C2/2 ; B -9499 -6999 8499 6999 ; +C 99 ; WX 17 ; N timesig-old4/4 ; B -8750 -3750 8750 3750 ; +C 100 ; WX 17 ; N timesig-old2/2 ; B -8750 -5000 8750 5000 ; +C 101 ; WX 17 ; N timesig-old3/2 ; B -8750 -3750 8750 3750 ; +C 102 ; WX 17 ; N timesig-old6/4 ; B -8750 -3750 8750 3750 ; +C 103 ; WX 17 ; N timesig-old9/4 ; B -8750 -3750 8750 3750 ; +C 104 ; WX 17 ; N timesig-old3/4 ; B -8750 -5000 8750 5000 ; +C 105 ; WX 17 ; N timesig-old6/8 ; B -8750 -5000 8750 5000 ; +C 106 ; WX 17 ; N timesig-old9/8 ; B -8750 -5000 8750 5000 ; +C 107 ; WX 17 ; N timesig-old4/8 ; B -8750 -3750 8750 3750 ; +C 108 ; WX 17 ; N timesig-old6/8alt ; B -8750 -3750 8750 3750 ; +C 109 ; WX 17 ; N timesig-old2/4 ; B -8750 -5000 8750 5000 ; +EndCharMetrics +EndFontMetrics %d diff --git a/mutopia/E.Satie/gnossienne-4-autochange.ly b/mutopia/E.Satie/gnossienne-4-autochange.ly index 1d3d4ee91a..87da9140e0 100644 --- a/mutopia/E.Satie/gnossienne-4-autochange.ly +++ b/mutopia/E.Satie/gnossienne-4-autochange.ly @@ -25,7 +25,7 @@ global = \notes { melody = \notes\relative c''{ \clef violin; - \property Voice.verticalDirection = 1 + \property Voice.verticalDirection = #1 \property Voice.graceFraction = "1/4" r2 r r r2 r r @@ -111,14 +111,15 @@ accompany = \notes \relative c{ \context Staff=up < \global \context Voice=foo { - \property Voice.verticalDirection = 1 - \property Voice.scriptVerticalDirection = 1 + \property Voice.verticalDirection = #1 + \property Voice.scriptVerticalDirection = #1 \melody } > \context Staff=down < \global \clef bass; + \property Voice.slurVerticalDirection = #1 \accompany > > @@ -139,8 +140,8 @@ accompany = \notes \relative c{ defaultBarType = "empty"; \remove "Time_signature_engraver"; - slurVerticalDirection = 1; - verticalDirection = -1; + slurVerticalDirection = #1 + verticalDirection = #-1 beamAutoEnd = #(make-moment 1 2) } } diff --git a/scm/lily.scm b/scm/lily.scm index 2e218d5b09..0e0a0c3db8 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -309,7 +309,7 @@ (define (header creator generate) (string-append - "%created by: " creator generate)) + "%created by: " creator generate "\n")) (define (invoke-char s i) (string-append @@ -350,9 +350,8 @@ (embedded-ps ((ps-scm 'bezier-sandwich) l thick))) (define (start-line ht) - (begin (string-append"\\vbox to " (number->dim ht) "{\\hbox{%\n")) - ) + (define (stop-line) "}\\vss}\\interscoreline") (define (stop-last-line) @@ -582,8 +581,7 @@ " draw_bezier_sandwich")) (define (start-line height) - (begin - "\nstart_line {\n")) + "\nstart_line {\n") (define (stem breapth width depth height) (string-append (numbers->string (list breapth width depth height)) @@ -658,6 +656,116 @@ ) ) +(define (musa-scm action-name) + + (define (char i) + (string-append "char (" (inexact->string i 10) ")\n")) + + (define (end-output) + "end_output ()\n") + + (define (experimental-on) + "") + + (define (filledbox breapth width depth height) + (let ((dx (+ width breapth)) + (dy (+ depth height))) + (string-append + "move_relative (" + (inexact->string (* -1 breapth) 10) + ", " + (inexact->string (* -1 depth) 10) + ")\n" + (if (< dx dy) + (string-append "vline (" (inexact->string dy 10) ")\n") + (string-append "hline (" (inexact->string dx 10) ")\n"))))) + + (define (font-load-command name-mag command) + (string-append + "load_font (\"" + (symbol->string (car name-mag)) "\", " + (number->string (magstep (cdr name-mag))) + ")\n")) + + (define (header creator generate) + (string-append "header (\"" creator "\", \"" generate "\")\n")) + + (define (header-end) + "header_end ()\n") + + (define (lily-def key val) + "") + + (define (placebox x y s) + (string-append + "move_to (" (inexact->string x 10) ", " (inexact->string y 10) ")\n" s)) + + (define (select-font font-name-symbol) + (let* ((c (assoc font-name-symbol font-name-alist))) + (if (eq? c #f) + (begin + (ly-warn + (string-append + "Programming error: No such font known " + (car font-name-symbol))) + "") ; issue no command + (string-append "select_font (\"" (symbol->string (car font-name-symbol)) "\")\n")))) + + (define (start-line height) + (string-append "start_line (" (inexact->string height 10) ")\n")) + + (define (stop-line) + "stop_line ()\n") + + (define (text s) + (string-append "text (\"" s "\")\n")) + + (cond ((eq? action-name 'all-definitions) + `(begin + ;;(define beam ,beam) + ;;(define tuplet ,tuplet) + ;;(define bracket ,bracket) + (define char ,char) + ;;(define crescendo ,crescendo) + ;;(define volta ,volta) + ;(define bezier-sandwich ,bezier-sandwich) + ;;(define dashed-slur ,dashed-slur) + ;;(define decrescendo ,decrescendo) + (define end-output ,end-output) + (define experimental-on ,experimental-on) + (define filledbox ,filledbox) + ;;(define font-def ,font-def) + (define font-load-command ,font-load-command) + ;;(define font-switch ,font-switch) + (define header ,header) + (define header-end ,header-end) + (define lily-def ,lily-def) + ;;(define invoke-char ,invoke-char) + ;;(define invoke-dim1 ,invoke-dim1) + (define placebox ,placebox) + (define select-font ,select-font) + (define start-line ,start-line) + ;;(define stem ,stem) + (define stop-line ,stop-line) + (define stop-last-line ,stop-line) + (define text ,text) + )) + ;;((eq? action-name 'tuplet) tuplet) + ;;((eq? action-name 'beam) beam) + ;;((eq? action-name 'bezier-sandwich) bezier-sandwich) + ;;((eq? action-name 'bracket) bracket) + ((eq? action-name 'char) char) + ;;((eq? action-name 'crescendo) crescendo) + ;;((eq? action-name 'dashed-slur) dashed-slur) + ;;((eq? action-name 'decrescendo) decrescendo) + ;;((eq? action-name 'experimental-on) experimental-on) + ((eq? action-name 'filledbox) filledbox) + ((eq? action-name 'select-font) select-font) + ;;((eq? action-name 'volta) volta) + (else (error "unknown tag -- MUSA-SCM " action-name)) + ) + ) + (define (gulp-file name) (let* ((port (open-file name "r")) @@ -685,6 +793,10 @@ (define (scm-ps-output) (eval (ps-scm 'all-definitions))) +(define (scm-musa-output) + (display (gulp-file "musa.py")) + (eval (musa-scm 'all-definitions))) + ; Russ McManus, ; diff --git a/scripts/musa.py b/scripts/musa.py new file mode 100644 index 0000000000..2b14ff4212 --- /dev/null +++ b/scripts/musa.py @@ -0,0 +1,232 @@ +#!/usr/bin/python +#!@PYTHON@ + +program_name = 'musa.py' +version = '@TOPLEVEL_VERSION@' +if version == '@' + 'TOPLEVEL_VERSION' + '@': + version = '(unknown version)' # uGUHGUHGHGUGH + +import __main__ +import getopt +import sys +import re +import string +import os + +#names = ["One", "Two", "Three"] +DIGITS='0123456789' + +def dump_score (outf): + outf.write (r"""\score{ + \notes < +""") + +def set_default_len_from_time_sig (s): + m = re.search ('([0-9]+)/([0-9]+)', s) + if m: + n = string.atoi (m.group (1)) + d = string.atoi (m.group (2)) + if (n * 1.0 )/(d * 1.0) < 0.75: + __main__.default_len = 16 + else: + __main__.default_len = 8 + +def gulp_file (f): + try: + i = open (f) + i.seek (0, 2) + n = i.tell () + i.seek (0,0) + except: + sys.stderr.write ("can't open file: %s\n" % f) + return '' + s = i.read (n) + if len (s) <= 0: + sys.stderr.write ("gulped emty file: %s\n" % f) + i.close () + return s + +def identify(): + sys.stderr.write ("%s from LilyPond %s\n" % (program_name, version)) + +def help (): + print r""" +Musa. + +Usage: musa [OPTION]... + +Options: + -h, --help this help + -o, --output=FILE set output filename to FILE + -v, --version version information +""" + +def print_version (): + print r"""musa (GNU lilypond) %s""" % version + + +(options, files) = getopt.getopt (sys.argv[1:], 'vo:h', ['help','version', 'output=']) +out_filename = '' + +for opt in options: + o = opt[0] + a = opt[1] + if o== '--help' or o == '-h': + help () + sys.exit (0) + if o == '--version' or o == '-v': + print_version () + sys.exit(0) + + if o == '--output' or o == '-o': + out_filename = a + else: + print o + raise getopt.error + +identify () + +#header['tagline'] = 'Lily was here %s -- automatically converted from ABC' % version + +#if not out_filename: + #out_filename = os.path.basename (os.path.splitext (f)[0]) + ".ly" +#sys.stderr.write ('Ly output to: %s...' % out_filename) +#outf = open (out_filename, 'w') +#sys.stderr.write ('\n') + +outf = sys.stdout + +# display width +width = 65 + +# font database +fonts = {} + +# cursor +x = 0 +y = 0 + +# current font +font = "" + +def print_font (name): + global fonts + font = fonts[name] + for k in font.keys (): + c = font[k] + print ("Character: %s" % k) + for i in range (len (c)): + print (c[i]) + +def put_char (x, y, c): + global line, width + height = len (line[0]) + y = -y + if x >= 0 and x < width - 2 and y >= 0 and y < height: + try: + line[y] = line[y][:x] + c + line[y][x+1:] + except: + print ("%d, %d: %c" % (x, y, c)) + else: + print ("%d, %d: %c" % (x, y, c)) + +def put_string (x, y, s): + global line, width + height = len (line[0]) + y = -y + if x >= 0 and x < width and y >= 0 and y < height: + try: + line[y] = line[y][:x] + s + line[y][x+len (s):] + except: + print ("%d, %d: %s" % (x, y, s)) + else: + print ("%d, %d: %s" % (x, y, s)) + +def header (creator, generate): + print (creator, generate) + +def header_end (): + return + +def load_font (name, mag): + global fonts + font_str = gulp_file (name + ".af"); + i = 0 + font = {} + for c in string.split (font_str, '\f')[1:]: + id = 0 + code = 0 + char = [] + for line in string.split (c, '\n')[:-1]: + if not id: + id = line + #code = string.atoi (id[string.index (id, + # 'C')+2:string.index (id, ';')]) + code = id[string.index (id, + 'C')+2:string.index (id, ';')] + code = string.strip (code) + bbox = string.split (string.strip (id[string.rindex (id, 'B')+1: string.rindex (id, ';')]), ' ') + char.append (bbox) + else: + char.append (line) + font[code] = char + fonts[name] = font + #print_font (name) + +def start_line (height): + global line + line = [] + # urg + for i in range (height+2): + line.append (" " * width) + +def move_to (new_x, new_y): + global x, y + x = new_x + y = new_y + +def move_relative (dx, dy): + global x, y + x = x + dx + y = y + dy + +def hline (length): + global x, y + for i in range (length): + put_char (x+i, y, '-') + return + +def select_font (name): + global font + font = name + +def char (i): + global x, y, width, fonts, font + height = len (line[0]) + #y = -y + #if x >= 0 and x < width and y >= 0 and y < height: + c = fonts[font][`i`] + bbox = c[0] + #print ("Bbox: %s " % `bbox`) + c = c[1:] + for i in range (len (c)): + put_string (x-string.atoi (bbox[1]), y-i+ string.atoi (bbox[3]), c[i]) + +def text (s): + global x, y + put_string (x, y, s) + +def vline (length): + global x, y + for i in range (length): + put_char (x, y+i, '|') + +def stop_line (): + global line + for i in range (len (line)): + print (line[i]) + print ("=== ===") + +def end_output (): + return + -- 2.39.2