From d56f632abb42f0fd5440cf608bf24b90f96fbd95 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Wed, 26 Jun 2002 14:07:36 +0000 Subject: [PATCH] * scm/chord-name.scm (chord::name->text): Workaround: clean markup text. * lily/text-item.cc (markup_text2molecule): Bugfix: raise only once. --- ChangeLog | 5 +++++ input/test/chord-markup.ly | 23 +++++++++++++++++++++++ input/test/markup.ly | 4 +++- lily/text-item.cc | 12 ++++++++++-- scm/chord-name.scm | 23 +++++++++-------------- 5 files changed, 50 insertions(+), 17 deletions(-) create mode 100644 input/test/chord-markup.ly diff --git a/ChangeLog b/ChangeLog index d5b41c7afe..aded4a000c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2002-06-26 Jan Nieuwenhuizen + * scm/chord-name.scm (chord::name->text): Workaround: clean markup + text. + + * lily/text-item.cc (markup_text2molecule): Bugfix: raise only once. + * input/test/ambitus.ly: * lily/ambitus-engraver.cc: * lily/ambitus.cc: diff --git a/input/test/chord-markup.ly b/input/test/chord-markup.ly new file mode 100644 index 0000000000..4519d16759 --- /dev/null +++ b/input/test/chord-markup.ly @@ -0,0 +1,23 @@ +\header{ + texidoc = "chord/markup test" +} + +\paper{ linewidth = -1.0\mm } + +\score{ + < + \context Staff \notes \relative c'' { + c^#'(columns "foe" ((raise . 3) "bar")) + c + c^#'(columns "foe" (super "12") (sub "3 4")) + c + + %% broken for now + %% c^#`(columns (lines "" ";" "") (lines "1" (bold "2") "3")) + c^#`(columns (lines "" ";" "") (lines "1" (columns (bold "2")) "3")) + } + \context ChordNames \chords { + c:7+.9-^3.5 + } + > +} diff --git a/input/test/markup.ly b/input/test/markup.ly index 01ab852e53..00e1a2deaf 100644 --- a/input/test/markup.ly +++ b/input/test/markup.ly @@ -23,7 +23,7 @@ f-#'(finger "3") g-#'(music (named "noteheads-2" ((kern . -0.1) "flags-stem") - (((kern . -0.1) (raise . 3.5)) "flags-u3")))) + (((kern . -0.1) (raise . 3.5)) "flags-u3"))) b-#'(columns "a" (((kern . 3) (raise . 2)) "b") "c") c-#'(columns "1" (((raise . -2) (kern . -1)) "2") "3") % } @@ -50,6 +50,8 @@ c^#'(columns "foe" ((raise . 3) "bar")) c^#'(columns "foe" (super "12") (sub "3 4")) + %% UGHUGH + c^#'(columns "foe" (super ((raise . 1) "12")) (sub ((raise . -1) "3 4"))) c^#'(columns "foe" (super (overstrike "o") "/") (sub "x")) c^#'(columns "foe" (overstrike "o") "/") c^#'(columns "foe" ((bold roman overstrike) "o") "/") diff --git a/lily/text-item.cc b/lily/text-item.cc index 2ee9cd14c0..19fbf548d2 100644 --- a/lily/text-item.cc +++ b/lily/text-item.cc @@ -145,6 +145,7 @@ Text_item::markup_text2molecule (Grob *me, SCM markup_text, SCM r = ly_assoc_chain (ly_symbol2scm ("raise"), p); if (gh_pair_p (r) && gh_number_p (ly_cdr (r))) raise = gh_scm2double (ly_cdr (r)) * staff_space; + Interval extent; bool extent_b = false; @@ -157,13 +158,19 @@ Text_item::markup_text2molecule (Grob *me, SCM markup_text, } Offset o (kern[X_AXIS], raise - kern[Y_AXIS]); - Molecule mol = Lookup::filledbox (Box (Interval (0,0), Interval (0,0))); + + SCM cp = ly_deep_copy (p); + if (raise) + { + SCM cr = ly_assoc_chain (ly_symbol2scm ("raise"), cp); + scm_set_cdr_x (cr, gh_int2scm (0)); + } while (gh_pair_p (text)) { - Molecule m = text2molecule (me, ly_car (text), p); + Molecule m = text2molecule (me, ly_car (text), cp); if (!m.empty_b ()) { @@ -175,6 +182,7 @@ Text_item::markup_text2molecule (Grob *me, SCM markup_text, text = ly_cdr (text); } + /* Set extend to markup requested value. */ if (extent_b) { diff --git a/scm/chord-name.scm b/scm/chord-name.scm index 004aededa2..c47b803a28 100644 --- a/scm/chord-name.scm +++ b/scm/chord-name.scm @@ -161,6 +161,7 @@ (define (chord::text? text) (not (or (not text) (empty? text) (unspecified? text)))) +;; FIXME: remove need for me, use text-append throughout (define (chord::text-cleanup dirty) " Recursively remove '() #f, and # from markup text tree. @@ -327,14 +328,6 @@ (list (list '((raise . 1) (font-relative-size . -1))) adds-text subs-text) b+i-text))) -(define (chord::name-banter tonic exception-part unmatched-steps - bass-and-inversion steps) - (let ((additions (chord::additions unmatched-steps)) - (subtractions (chord::subtractions unmatched-steps))) - (chord::inner-name-banter tonic exception-part additions subtractions - bass-and-inversion steps))) - - (define (c++-pitch->scm p) (if (pitch? p) (list (pitch-octave p) (pitch-notename p) (pitch-alteration p)) @@ -342,10 +335,11 @@ (define (chord::name-banter tonic exception-part unmatched-steps bass-and-inversion steps) - (let ((additions (chord::additions unmatched-steps)) - (subtractions (chord::subtractions unmatched-steps))) - (chord::inner-name-banter tonic exception-part additions subtractions - bass-and-inversion steps))) + (let ((additions (chord::additions unmatched-steps)) + (subtractions (chord::subtractions unmatched-steps))) + (chord::inner-name-banter tonic exception-part additions subtractions + bass-and-inversion steps))) + (define (chord::restyle name style) (primitive-eval (string->symbol @@ -402,8 +396,9 @@ (let* ((lookup (chord::exceptions-lookup style steps)) (exception-part (car lookup)) (unmatched-steps (cadr lookup))) - ((chord::restyle 'chord::name- style) - tonic exception-part unmatched-steps bass-and-inversion steps))) + (chord::text-cleanup + ((chord::restyle 'chord::name- style) + tonic exception-part unmatched-steps bass-and-inversion steps)))) ;; C++ entry point ;; -- 2.39.5