From: Han-Wen Nienhuys Date: Wed, 4 Sep 2002 09:49:49 +0000 (+0000) Subject: 2002-09-01 Juergen Reuter X-Git-Tag: release/1.6.2~10 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=5d4c64d117f4fba3ba534eae8fb707649fa593dc;p=lilypond.git 2002-09-01 Juergen Reuter * input/test/ancient-font.ly, input/test/ancient-time.ly, input/test/mensural-ligatures.ly, lily/ligature-head.cc, lily/mensural-ligature-engraver.cc, lily/note-head.cc, lily/time-signature.cc, scm/output-lib.scm: removed obsolete code that sets grob property font-family; also small updates to various input/test files. --- diff --git a/ChangeLog b/ChangeLog index d3108b2795..1af96a0d54 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2002-09-01 Juergen Reuter + + * input/test/ancient-font.ly, input/test/ancient-time.ly, + input/test/mensural-ligatures.ly, lily/ligature-head.cc, + lily/mensural-ligature-engraver.cc, lily/note-head.cc, + lily/time-signature.cc, scm/output-lib.scm: removed obsolete + code that sets grob property font-family; also small updates to + various input/test files. + 2002-09-01 Han-Wen Nienhuys * input/test/tab-staff.ly: removed. diff --git a/input/test/ancient-font.ly b/input/test/ancient-font.ly index ae0a9f6ce9..302000f75f 100644 --- a/input/test/ancient-font.ly +++ b/input/test/ancient-font.ly @@ -17,12 +17,8 @@ upperStaff = \context GregorianStaff = upperStaff < #'line-count = #4 \notes \transpose c' { - \property Staff.Clef \set #'font-family = #'ancient - \property Staff.KeySignature \set #'font-family = #'ancient \property Staff.KeySignature \override #'style = #'vaticana - \property Staff.Accidental \set #'font-family = #'ancient \property Staff.Accidental \override #'style = #'vaticana - \property Voice.NoteHead \set #'font-family = #'ancient \property Voice.NoteHead \override #'style = #'vaticana_punctum \key es \major \clef "vaticana_fa2" @@ -125,12 +121,8 @@ lowerStaff = \context MensuralStaff = lowerStaff < #'line-count = #5 \notes \transpose c' { - \property Staff.Clef \set #'font-family = #'ancient \property Voice.autoBeaming = ##f - \property Voice.NoteHead \set #'font-family = #'ancient \property Voice.NoteHead \override #'style = #'neo_mensural - \property Voice.Stem \set #'font-family = #'ancient % ancient flags - \property Voice.Rest \set #'font-family = #'music \property Voice.Rest \override #'style = #'neo_mensural \key a \major @@ -168,7 +160,6 @@ lowerStaff = \context MensuralStaff = lowerStaff < \property Voice.NoteHead \override #'style = #'mensural \property Voice.Stem \override #'style = #'mensural \property Voice.Stem \override #'thickness = #1.0 - \property Voice.Rest \set #'font-family = #'ancient \property Voice.Rest \override #'style = #'mensural \clef "petrucci_f" c8 b, c16 b, c32 b, c64 b, c64 b, @@ -186,7 +177,7 @@ lowerStaff = \context MensuralStaff = lowerStaff < % segmentation fault on r8/r16/r32. (Strange: what has % Voice.Stem style to do with mensural rests?) \property Voice.Stem \override #'style = #'neo_mensural - r2 r4 r8 r16 r32 r32 + r2 r4 r8 r16 r16 \property Voice.Stem \override #'style = #'mensural \property Staff.forceClef = ##t \clef "mensural_f" @@ -241,12 +232,9 @@ lowerStaff = \context MensuralStaff = lowerStaff < \alias Voice \remove Ligature_bracket_engraver \consists Mensural_ligature_engraver - NoteHead \set #'font-family = #'ancient NoteHead \set #'style = #'mensural - Stem \set #'font-family = #'ancient % Stem \set #'style = #'mensural %%%%%%%% FIXME: this core dumps Stem \set #'thickness = #1.0 - Rest \set #'font-family = #'music Rest \set #'style = #'mensural autoBeaming = ##f } @@ -256,7 +244,6 @@ lowerStaff = \context MensuralStaff = lowerStaff < \alias Voice \remove Ligature_bracket_engraver % \consists Gregorian_ligature_engraver %%%%%%%% TODO: not yet implemented - NoteHead \set #'font-family = #'ancient NoteHead \set #'style = #'vaticana_punctum autoBeaming = ##f } @@ -266,18 +253,13 @@ lowerStaff = \context MensuralStaff = lowerStaff < \alias Staff \accepts MensuralVoice \consists Custos_engraver - TimeSignature \set #'font-family = #'ancient TimeSignature \set #'style = #'mensural - KeySignature \set #'font-family = #'ancient KeySignature \set #'style = #'mensural - Accidental \set #'font-family = #'ancient Accidental \set #'style = #'mensural - Custos \set #'font-family = #'ancient Custos \set #'style = #'mensural Custos \set #'neutral-position = #3 Custos \set #'neutral-direction = #-1 Custos \set #'adjust-if-on-staffline = ##t - Clef \set #'font-family = #'ancient clefGlyph = #"clefs-petrucci_c2" clefPosition = #-2 clefOctavation = #0 @@ -291,16 +273,12 @@ lowerStaff = \context MensuralStaff = lowerStaff < \remove Time_signature_engraver StaffSymbol \set #'thickness = #2.0 StaffSymbol \set #'line-count = #4 - KeySignature \set #'font-family = #'ancient KeySignature \set #'style = #'vaticana - Accidental \set #'font-family = #'ancient Accidental \set #'style = #'vaticana - Custos \set #'font-family = #'ancient Custos \set #'style = #'vaticana Custos \set #'neutral-position = #4 Custos \set #'neutral-direction = #-1 Custos \set #'adjust-if-on-staffline = ##t - Clef \set #'font-family = #'ancient clefGlyph = #"clefs-vaticana_do" clefPosition = #1 clefOctavation = #0 diff --git a/input/test/ancient-time.ly b/input/test/ancient-time.ly index 3a867e63b7..2c83288fc3 100644 --- a/input/test/ancient-time.ly +++ b/input/test/ancient-time.ly @@ -5,8 +5,7 @@ texidoc="Should use old style." \score { \notes { - \property Staff.TimeSignature \override #'style = #'oldC4/4 - \property Staff.TimeSignature \override #'font-family = #'ancient + \property Staff.TimeSignature \override #'style = #'neo_mensural s1 } } diff --git a/input/test/mensural-ligatures.ly b/input/test/mensural-ligatures.ly index 9a063b5c05..39c001d2b7 100644 --- a/input/test/mensural-ligatures.ly +++ b/input/test/mensural-ligatures.ly @@ -6,15 +6,13 @@ \include "paper26.ly" -% Note the horizontal alignment of the fermatas that obeys to the +% Note that the horizontal alignment of the fermatas obeys to the % graphical width of the ligatures rather to the musical moment in time. % This is intended behaviour. voice = \notes \transpose c'' { \property Score.timing = ##f \property Score.defaultBarType = "empty" - \property Voice.NoteHead \set #'font-family = #'ancient - \property Voice.NoteHead \override #'style = #'mensural g\longa c\breve a\breve f\breve d'\longa^\fermata \bar "|" \[ @@ -31,22 +29,18 @@ voice = \notes \transpose c'' { \bar "||" } -upperStaff = \context Staff = upperStaff < - \context MensuralVoice < - \voice - > -> - -lowerStaff = \context Staff = lowerStaff < - \context TranscribedVoice < - \voice - > -> - \score { \context ChoirStaff < - \upperStaff - \lowerStaff + \context MensuralStaff = upperStaff < + \context MensuralVoice < + \voice + > + > + \context Staff = lowerStaff < + \context Voice < + \voice + > + > > \paper { stafflinethickness = \staffspace / 5.0 @@ -56,23 +50,32 @@ lowerStaff = \context Staff = lowerStaff < \alias Voice \remove Ligature_bracket_engraver \consists Mensural_ligature_engraver - } - \translator { - \VoiceContext - \name TranscribedVoice - \alias Voice - \remove Mensural_ligature_engraver - \consists Ligature_bracket_engraver + NoteHead \set #'style = #'mensural } \translator { \StaffContext + \name MensuralStaff + \alias Staff \accepts MensuralVoice - \accepts TranscribedVoice - } + \consists Custos_engraver + TimeSignature \set #'style = #'mensural + KeySignature \set #'style = #'mensural + Accidental \set #'style = #'mensural + Custos \set #'style = #'mensural + Custos \set #'neutral-position = #3 + Custos \set #'neutral-direction = #-1 + Custos \set #'adjust-if-on-staffline = ##t + clefGlyph = #"clefs-petrucci_g" + clefPosition = #-2 + clefOctavation = #-0 + } \translator { \HaraKiriStaffContext \accepts MensuralVoice - \accepts TranscribedVoice } + \translator { + \ScoreContext + \accepts MensuralStaff + } } } diff --git a/lily/ligature-head.cc b/lily/ligature-head.cc index ee1690ac4a..8959988fef 100644 --- a/lily/ligature-head.cc +++ b/lily/ligature-head.cc @@ -16,14 +16,6 @@ * "rhythmic-head-interface" in the interfaces list. Otherwise, text * scripts (such as fermata) are horizontally aligned with the end of * the ligature rather than with the associated head. Why? - * - * TODO: if properties font-family and style are not set properly - * (e.g. by a user erronously setting font-family to #'music), - * lilypond currently crashes with the message: "lilypond: - * ../flower/include/interval.hh:28: Real Interval_t::center() - * const: Assertion `!empty_b ()' failed.". The code of this class - * should be clever enough to foresee a potential crash, print a - * warning, and supply sensible default values that avoid the crash. */ MAKE_SCHEME_CALLBACK (Ligature_head,brew_molecule,1); SCM diff --git a/lily/mensural-ligature-engraver.cc b/lily/mensural-ligature-engraver.cc index 999ea817a4..3c8637f04a 100644 --- a/lily/mensural-ligature-engraver.cc +++ b/lily/mensural-ligature-engraver.cc @@ -426,24 +426,9 @@ Mensural_ligature_engraver::propagate_properties () gh_scm2double (thickness_scm) : 1.4; thickness *= finished_ligature_->get_paper ()->get_var ("linethickness"); - /* - * FIXME: Since character "noteheads--1mensural" is defined in - * parmesan font only, the right-hand expression in the - * following assignment evaluates to a width of 0.0, in case - * font-family of finished_ligature_ is _not_ set to "ancient" - * (by default, it is; see grob properties of MensuralLigature - * in scm/grob-description.scm). This may arise severe problems - * in the future when switching between fonts (e.g. mensural - * versus neo-mensural). - */ Real head_width = Font_interface::get_default_font (finished_ligature_)-> find_by_name ("noteheads--1mensural").extent (X_AXIS).length (); - if (head_width == 0.0) - { - programming_error ("Mensural_ligature_engraver: failed evaluating head_width (most probably a font-family selection problem)"); - } - SCM flexa_width_scm = finished_ligature_->get_grob_property ("flexa-width"); Real flexa_width = (flexa_width_scm != SCM_EOL) ? diff --git a/lily/note-head.cc b/lily/note-head.cc index 662121ad66..16c58ebaea 100644 --- a/lily/note-head.cc +++ b/lily/note-head.cc @@ -103,7 +103,7 @@ Note_head::brew_ledger_lines (Grob *me, } Molecule -internal_brew_molecule (Grob *me, bool ledger_take_space) +internal_brew_molecule (Grob *me, bool ledger_take_space) { SCM style = me->get_grob_property ("style"); if (!gh_symbol_p (style)) @@ -120,20 +120,16 @@ internal_brew_molecule (Grob *me, bool ledger_take_space) SCM exp = scm_list_n (ly_symbol2scm ("find-notehead-symbol"), log, ly_quote_scm (style), SCM_UNDEFINED); - SCM scm_pair = scm_primitive_eval (exp); - SCM scm_font_char = ly_car (scm_pair); - SCM scm_font_family = ly_cdr (scm_pair); + SCM scm_font_char = scm_primitive_eval (exp); String font_char = "noteheads-" + ly_scm2string (scm_font_char); - String font_family = ly_scm2string (scm_font_family); - me->set_grob_property("font-family", ly_symbol2scm (font_family.to_str0 ())); Font_metric * fm = Font_interface::get_default_font (me); Molecule out = fm->find_by_name (font_char); if (out.empty_b()) { - me->warning (_f ("Symbol `%s' not found in family `%s'", - font_char.to_str0 (), font_family.to_str0 ())); + me->warning (_f ("note head `%s' not found", font_char.to_str0 ())); } + int interspaces = Staff_symbol_referencer::line_count (me)-1; int pos = (int)rint (Staff_symbol_referencer::get_position (me)); if (abs (pos) - interspaces > 1) diff --git a/lily/time-signature.cc b/lily/time-signature.cc index d960b647cd..31dbedea5b 100644 --- a/lily/time-signature.cc +++ b/lily/time-signature.cc @@ -57,30 +57,39 @@ Time_signature::brew_molecule (SCM smob) } Molecule -Time_signature::special_time_signature (Grob *me, SCM style, int n, int d) +Time_signature::special_time_signature (Grob *me, SCM scm_style, int n, int d) { - String st = ly_scm2string (scm_symbol_to_string (style)); - SCM scm_n = gh_int2scm (n); - SCM scm_d = gh_int2scm (d); - SCM exp = scm_list_n (ly_symbol2scm ("find-timesig-symbol"), - scm_n, scm_d, ly_quote_scm (style), - SCM_UNDEFINED); - SCM scm_pair = scm_primitive_eval (exp); - SCM scm_font_char = ly_car (scm_pair); - SCM scm_font_family = ly_cdr (scm_pair); - String font_char = ly_scm2string (scm_font_char); - String font_family = ly_scm2string (scm_font_family); - me->set_grob_property("font-family", ly_symbol2scm (font_family.to_str0 ())); - - Molecule m = - Font_interface::get_default_font (me)->find_by_name ("timesig-" + font_char); - if (!m.empty_b ()) - return m; + String style = ly_scm2string (scm_symbol_to_string (scm_style)); + + if (style == "numbered") + return numbered_time_signature (me, n, d); + + if ((style == "default") || (style == "")) + style = to_string ("C"); + + if (style == "C") + { + if /* neither C2/2 nor C4/4 */ + (((n != 2) || (d != 2)) && + ((n != 4) || (d != 4))) + { + return numbered_time_signature (me, n, d); + } + } + + String char_name = style + to_string (n) + "/" + to_string (d); + me->set_grob_property ("font-family", ly_symbol2scm ("music")); + Molecule out = + Font_interface::get_default_font (me)->find_by_name ("timesig-" + char_name); + if (!out.empty_b ()) + return out; /* - If there is no such symbol, we default without warning to the - numbered style. - */ + If there is no such symbol, we default to the numbered style. + (Here really with a warning!) + */ + me->warning (_f ("time signature symbol `%s' not found; " + "reverting to numbered style", char_name)); return numbered_time_signature (me, n, d); } diff --git a/scm/output-lib.scm b/scm/output-lib.scm index 3d167bb6fc..e524cc32ff 100644 --- a/scm/output-lib.scm +++ b/scm/output-lib.scm @@ -127,22 +127,20 @@ ;; silly, use alist? (define (find-notehead-symbol duration style) (case style - ((xcircle) (cons "2xcircle" "music")) - ((harmonic) (cons "0neo_mensural" "music")) + ((xcircle) "2xcircle") + ((harmonic) "0neo_mensural") ((baroque) ;; Oops, I actually would not call this "baroque", but, for ;; backwards compatibility to 1.4, this is supposed to take ;; brevis, longa and maxima from the neo-mensural font and all ;; other note heads from the default font. -- jr (if (< duration 0) - (cons (string-append (number->string duration) "neo_mensural") "music") - (cons (number->string duration) "music"))) + (string-append (number->string duration) "neo_mensural") + (number->string duration))) ((mensural) - (cons (string-append (number->string duration) (symbol->string style)) - "music")) + (string-append (number->string duration) (symbol->string style))) ((neo_mensural) - (cons (string-append (number->string duration) (symbol->string style)) - "music")) + (string-append (number->string duration) (symbol->string style))) ((default) ;; The default font in mf/feta-bolletjes.mf defines a brevis, but ;; neither a longa nor a maxima. Hence let us, for the moment, @@ -151,14 +149,13 @@ ;; should look exactly like the brevis of the default font, but ;; with a stem exactly like that of the quarter note. -- jr (if (< duration -1) - (cons (string-append (number->string duration) "neo_mensural") "music") - (cons (number->string duration) "music"))) + (string-append (number->string duration) "neo_mensural") + (number->string duration))) (else (if (string-match "vaticana*|hufnagel*|medicaea*" (symbol->string style)) - (cons (symbol->string style) "music") - (cons (string-append (number->string (max 0 duration)) - (symbol->string style)) - "music"))))) + (symbol->string style) + (string-append (number->string (max 0 duration)) + (symbol->string style)))))) (define (note-head-style->attachment-coordinates style duration) @@ -191,43 +188,6 @@ centered, X==1 is at the right, X == -1 is at the left." '(1.0 . 0.0) ))) -(define (find-timesig-symbol nom denom style) - (case style - ((mensural) - (cons (string-append - "mensural" - (number->string nom) - "/" - (number->string denom)) - "ancient")) - ((neo_mensural) - (cons (string-append - "neo_mensural" - (number->string nom) - "/" - (number->string denom)) - "ancient")) - ((numbered) - (cons (string-append - (number->string nom) - "/" - (number->string denom)) - "music")) - (else - ;; default: use "C" style when possible, otherwise return "" - (cons - (case nom - ((2) - (case denom - ((2) "C2/2") - (else ""))) - ((4) - (case denom - ((4) "C4/4") - (else ""))) - (else "")) - "music")))) - (define (string-encode-integer i) (cond ((= i 0) "o")