From: fred Date: Wed, 27 Mar 2002 01:03:24 +0000 (+0000) Subject: lilypond-1.3.152 X-Git-Tag: release/1.5.59~700 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=ce73d93fce0f5742cdbcb3dfd9ecb9e76d27a86f;p=lilypond.git lilypond-1.3.152 --- diff --git a/lily/font-metric.cc b/lily/font-metric.cc index b421075119..930d5f3b2c 100644 --- a/lily/font-metric.cc +++ b/lily/font-metric.cc @@ -90,6 +90,11 @@ Font_metric::Font_metric (Font_metric const &s) { } +int +Font_metric::count () const +{ + return 0; +} Box Font_metric::get_char (int)const diff --git a/lily/hyphen-spanner.cc b/lily/hyphen-spanner.cc index cd676ff44a..1a35efaaed 100644 --- a/lily/hyphen-spanner.cc +++ b/lily/hyphen-spanner.cc @@ -48,7 +48,10 @@ Hyphen_spanner::brew_molecule (SCM smob) Real lt = sp->paper_l ()->get_var ("stafflinethickness"); Real th = gh_scm2double (sp->get_grob_property ("thickness")) * lt ; Real h = gh_scm2double (sp->get_grob_property ("height")); + + // interval? Real l = gh_scm2double (sp->get_grob_property ("minimum-length")); + Real x = gh_scm2double (sp->get_grob_property ("maximum-length")); // The hyphen can exist in the word space of the left lyric ... SCM space = sp->get_bound (LEFT)->get_grob_property ("word-space"); if (gh_number_p (space)) @@ -56,10 +59,16 @@ Hyphen_spanner::brew_molecule (SCM smob) bounds[LEFT] -= gh_scm2double (space); } Real w = bounds.length (); + + /* for length, use a geometric mean of the available space and some minimum - */ + */ if (l < w) - l = sqrt (l*w); + { + l = sqrt (l*w); + if (l > x) + l = x; + } else { /* OK, we have a problem. Usually this means that we're on the diff --git a/lily/include/afm.hh b/lily/include/afm.hh index b62d34fa54..2f8b07ae02 100644 --- a/lily/include/afm.hh +++ b/lily/include/afm.hh @@ -22,6 +22,7 @@ struct Adobe_font_metric : Font_metric { AFM_Font_info * font_inf_; + virtual int count () const; virtual Box get_char (int) const; AFM_CharMetricInfo const *find_char_metric (String name, bool warn=true) const; AFM_CharMetricInfo const *find_ascii_metric (int, bool warn=true) const; diff --git a/lily/include/font-metric.hh b/lily/include/font-metric.hh index 0bea74247e..87137221c3 100644 --- a/lily/include/font-metric.hh +++ b/lily/include/font-metric.hh @@ -21,6 +21,8 @@ struct Font_metric public: SCM description_; String path_; + + virtual int count () const; virtual Box get_char (int ascii) const; virtual Box text_dimension (String) const; virtual Molecule find_by_name (String) const; diff --git a/lily/include/tfm.hh b/lily/include/tfm.hh index 93deefc106..8eb633a9e5 100644 --- a/lily/include/tfm.hh +++ b/lily/include/tfm.hh @@ -150,7 +150,8 @@ class Tex_font_metric : public Font_metric public: static SCM make_tfm (String filename); - Box get_char (int) const; + virtual int count () const; + virtual Box get_char (int) const; Tex_font_char_metric const *find_ascii (int ascii, bool warn=true) const; String str () const; diff --git a/lily/system-start-delimiter.cc b/lily/system-start-delimiter.cc index 72a444a532..22b993ba31 100644 --- a/lily/system-start-delimiter.cc +++ b/lily/system-start-delimiter.cc @@ -138,25 +138,17 @@ System_start_delimiter::brew_molecule (SCM smob) } Molecule -System_start_delimiter::staff_brace (Grob*me,Real y) +System_start_delimiter::staff_brace (Grob*me, Real y) { - - /* - FIXME: - * should look at afm/tfm file for dimensions. - (This breaks ascii-art output: it hasn't got 255 symbols) - - * more glyphs (or maybe just better sized (fixed # of staff-spaces)), - the size mismatches with the staffs are very ugly - - */ - - // ugrhn - int lo = 0; - int hi = 255; - Font_metric *fm = Font_interface::get_default_font (me); Box b; + int lo = 0; + int hi = 255; //arg, urg == 0: fm->count () >? 2; + + int big = 1; + SCM bigger = gh_list (me->mutable_property_alist_, + me->immutable_property_alist_, + SCM_UNDEFINED); /* do a binary search for each Y, not very efficient, but passable? */ do @@ -165,9 +157,35 @@ System_start_delimiter::staff_brace (Grob*me,Real y) b = fm->get_char (cmp); if (b[Y_AXIS].empty_b () || b[Y_AXIS].length () > y) - hi = cmp; + { + hi = cmp; + } else - lo = cmp; + { + /* + ugh: 7 + We have four fonts: feta-braces0-3.mf + + In the style-sheet, all paper relative sizes need to start + looking at the feta-braces0 font. + + The smallest paper size, feta11 or -3, has to make 5 steps + to get to feta26 or +2. Only after that, from +3 to +5 are + the real bigger sizes, so worst case we need 8 steps to get + to the font we need. */ + if (big < 8) + { + bigger = gh_cons (gh_cons (ly_symbol2scm ("font-relative-size"), + gh_int2scm (big++)), + bigger); + me->set_grob_property ("font", bigger); + fm = Font_interface::get_default_font (me); + lo = 0; + hi = 255; //fm->count () >? 2; + } + else + lo = cmp; + } } while (hi - lo > 1); diff --git a/lily/tfm.cc b/lily/tfm.cc index 3bf4f94632..0a3e7362b5 100644 --- a/lily/tfm.cc +++ b/lily/tfm.cc @@ -79,6 +79,12 @@ Tex_font_metric::find_ascii (int ascii, bool warn) const return &dummy_static_char_metric; } +int +Tex_font_metric::count () const +{ + return ascii_to_metric_idx_.size (); +} + Box Tex_font_metric::get_char (int a) const { diff --git a/mf/feta-beugel.mf b/mf/feta-beugel.mf index db3c642752..ca510cebb3 100644 --- a/mf/feta-beugel.mf +++ b/mf/feta-beugel.mf @@ -16,7 +16,7 @@ def draw_brace( expr height_sharp, width_sharp) = define_pixels (height, width); thin = 2 stafflinethickness; - thick = .5 staff_space; + thick = .5 width; z2 = .5 [z1, z3]; y3 = y1 + height/2; @@ -39,9 +39,10 @@ def draw_brace( expr height_sharp, width_sharp) = endchar; enddef; - -for x := 1 step 1 until 160: - % note: define_pixels (x) multiplies x by hppp, - % we must never get bigger than infinity - draw_brace (min (x * pt#, infinity/hppp - 1), staff_space#); +for i := font_count * 256 step 1 until (font_count + 1) * 256 - 1: + % note: define_pixels (x) multiplies x by hppp, + % we must never get bigger than infinity + y := min ((i + 1) * 0.25pt#, infinity/hppp - 1); + x := y / 12; + draw_brace (y, x); endfor diff --git a/mf/feta-braces0.mf b/mf/feta-braces0.mf new file mode 100644 index 0000000000..6afda40f26 --- /dev/null +++ b/mf/feta-braces0.mf @@ -0,0 +1,17 @@ +% +% feta-braces0.mf -- 256 smallest braces +% +% source file of the Feta (Font-En-Tja) music font +% +% (c) 1997--2001 Han-Wen Nienhuys +% + +font_identifier:="feta-braces0"; +font_size 16; +mode_setup; + +staffsize#:=16pt#; +font_count := 0; +input feta-beugel; +end. + diff --git a/mf/feta-braces1.mf b/mf/feta-braces1.mf new file mode 100644 index 0000000000..eb535f0457 --- /dev/null +++ b/mf/feta-braces1.mf @@ -0,0 +1,17 @@ +% +% feta-braces1.mf -- next 256 braces +% +% source file of the Feta (Font-En-Tja) music font +% +% (c) 1997--2001 Han-Wen Nienhuys +% + +font_identifier:="feta-braces1"; +font_size 16; +mode_setup; + +staffsize#:=16pt#; +font_count := 1; +input feta-beugel; +end. + diff --git a/mf/feta-braces2.mf b/mf/feta-braces2.mf new file mode 100644 index 0000000000..3eb180c44c --- /dev/null +++ b/mf/feta-braces2.mf @@ -0,0 +1,17 @@ +% +% feta-braces2.mf -- next 256 braces +% +% source file of the Feta (Font-En-Tja) music font +% +% (c) 1997--2001 Han-Wen Nienhuys +% + +font_identifier:="feta-braces2"; +font_size 16; +mode_setup; + +staffsize#:=16pt#; +font_count := 2; +input feta-beugel; +end. + diff --git a/mf/feta-braces3.mf b/mf/feta-braces3.mf new file mode 100644 index 0000000000..847ac44254 --- /dev/null +++ b/mf/feta-braces3.mf @@ -0,0 +1,17 @@ +% +% feta-braces3.mf -- next 256 braces +% +% source file of the Feta (Font-En-Tja) music font +% +% (c) 1997--2001 Han-Wen Nienhuys +% + +font_identifier:="feta-braces3"; +font_size 16; +mode_setup; + +staffsize#:=16pt#; +font_count := 3; +input feta-beugel; +end. + diff --git a/mutopia/J.S.Bach/wtk1-fugue2.ly b/mutopia/J.S.Bach/wtk1-fugue2.ly index bc8a767dbd..80e6941046 100644 --- a/mutopia/J.S.Bach/wtk1-fugue2.ly +++ b/mutopia/J.S.Bach/wtk1-fugue2.ly @@ -12,8 +12,14 @@ mutopiaopus = "BWV847" style = "baroque" copyright = "Public Domain" - tagline = "\\\\This music is part of the Mutopia project, http://sca.uwaterloo.ca/Mutopia/\\\\It has been typeset and placed in the public domain by Han-Wen Nienhuys.\\\\Unrestricted modification and redistribution is permitted and encouraged - copy this music and share it!" maintainer = "hanwen@cs.uu.nl" + mutopiapublicdomain = "\\parbox{\\hsize}{\\thefooter\\quad\\small + \\\\This music is part of the Mutopia project, + \\texttt{http://www.mutopiaproject.org/}\\\\It has been typeset + and placed in the public domain by " + \maintainer + + ".\\\\Unrestricted modification and redistribution is permitted + and encouraged---copy this music and share it.}" + tagline = \mutopiapublicdomain lastupdated = "2000/Feb/14" } @@ -170,6 +176,7 @@ bassdux = \context Voice=three \notes \relative c' { \score { \notes \context PianoStaff < + \property Score.TimeSignature \override #'style = #'C \context Staff = treble < \key c \minor % \key es \major @@ -185,11 +192,6 @@ bassdux = \context Voice=three \notes \relative c' { \paper { linewidth = 18.0 \cm - \translator{ \OrchestralScoreContext - timeSignatureStyle \override #'style = #"C" - - } - } \header{ opus = "BWV 847" diff --git a/scm/font.scm b/scm/font.scm index 084a5039bf..e6c46e7ba1 100644 --- a/scm/font.scm +++ b/scm/font.scm @@ -102,14 +102,22 @@ ((-2 medium caps roman cmcsc 7) . "cmcsc7") ((-3 medium caps roman cmcsc 7) . "cmcsc7") - - ;; should use the same brace font every where and fix C++ code. - ((2 * * braces feta-braces 26) . "feta-braces26") - ((1 * * braces feta-braces 23) . "feta-braces23") - ((0 * * braces feta-braces 20) . "feta-braces20") - ((-1 * * braces feta-braces 16) . "feta-braces16") - ((-2 * * braces feta-braces 13) . "feta-braces13") - ((-3 * * braces feta-braces 11) . "feta-braces11") + ;; smallest needs 8 steps: -3 to +5, so + ;; biggest also needs 8 available steps: +2 to + 10 + ((10 * * braces feta-braces 3) . "feta-braces3") + ((9 * * braces feta-braces 3) . "feta-braces3") + ((8 * * braces feta-braces 3) . "feta-braces3") + ((7 * * braces feta-braces 3) . "feta-braces3") + ((6 * * braces feta-braces 3) . "feta-braces3") + ((5 * * braces feta-braces 3) . "feta-braces3") + ((4 * * braces feta-braces 2) . "feta-braces2") + ((3 * * braces feta-braces 1) . "feta-braces1") + ((2 * * braces feta-braces 0) . "feta-braces0") + ((1 * * braces feta-braces 0) . "feta-braces0") + ((0 * * braces feta-braces 0) . "feta-braces0") + ((-1 * * braces feta-braces 0) . "feta-braces0") + ((-2 * * braces feta-braces 0) . "feta-braces0") + ((-3 * * braces feta-braces 0) . "feta-braces0") ((3 * * dynamic feta-din 19) . "feta-din19") ((2 * * dynamic feta-din 19) . "feta-din19") diff --git a/scm/grob-description.scm b/scm/grob-description.scm index 90bbb79a0b..fd4a146c8e 100644 --- a/scm/grob-description.scm +++ b/scm/grob-description.scm @@ -275,6 +275,7 @@ (thickness . 1.0) (height . 0.4) (minimum-length . 0.5) + (maximum-length . 100) (molecule-callback . ,Hyphen_spanner::brew_molecule) (Y-extent-callback . ,Grob::point_dimension_callback) (meta . ,(grob-description "LyricHyphen" lyric-hyphen-interface )) diff --git a/scm/grob-property-description.scm b/scm/grob-property-description.scm index 8f22abd649..ef4cec6beb 100644 --- a/scm/grob-property-description.scm +++ b/scm/grob-property-description.scm @@ -203,6 +203,7 @@ For barline, space after a thick line.") (grob-property-description 'lookup symbol? "lookup method: 'value for plain text, 'name for character-name.") (grob-property-description 'magnify number? "the magnification factor. FIXME: doesn't work for feta fonts.") (grob-property-description 'maximum-duration-for-spacing moment? "space as if a duration of this type is available in this measure.") +(grob-property-description 'maximum-length number? "don't make Grob longer than this") (grob-property-description 'maximum-rest-count integer? "kill off rests so we don't more than this number left.") (grob-property-description 'merge-differently-dotted boolean? " Merge noteheads in collisions, even if they have a different number of dots. This normal notation for some types of polyphonic music. The value of this setting is used by @ref{note-collision-interface} .") (grob-property-description 'minimum-distance number? "minimum distance between notes and rests.") diff --git a/scripts/mup2ly.py b/scripts/mup2ly.py index 0bb9cbf01b..c48765b320 100644 --- a/scripts/mup2ly.py +++ b/scripts/mup2ly.py @@ -1184,17 +1184,21 @@ for opt in options: # sys.stdout.flush () # handy emacs testing -if not files: - files = ['template.mup'] +# if not files: +# files = ['template.mup'] +if not files: + files = ['-'] + for f in files: - if f == '-': - f = '' - if f and not os.path.isfile (f): + if f == '-': + h = sys.stdin + elif f and not os.path.isfile (f): f = strip_extension (f, '.mup') + '.mup' + h = open (f) progress ( _("Processing %s..." % f)) - raw_lines = open (f).readlines () + raw_lines = h.readlines () p = Pre_processor (raw_lines) if only_pre_process_p: if not output: @@ -1205,7 +1209,13 @@ for f in files: output = os.path.basename (re.sub ('(?i).mup$', '.ly', f)) if output == f: output = os.path.basename (f + '.ly') - + + if f == '-': + output = '-' + out_h = sys.stdout + else: + out_h = open (output, 'w') + progress (_ ("Writing %s...") % output) tag = '%% Lily was here -- automatically converted by %s from %s' % ( program_name, f) @@ -1215,9 +1225,8 @@ for f in files: else: ly = tag + '\n\n' + e.dump () - o = open (output, 'w') - o.write (ly) - o.close () + out_h.write (ly) + out_h.close () if debug_p: print (ly)