From 92ddbc870e74571a0b442c75b8982f997bc2f876 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Sun, 22 Oct 2000 21:24:11 +0200 Subject: [PATCH] patch::: 1.3.97.jcn1 1.3.97.jcn1 =========== * Added some interface documentation. * Added raise and kern to markup. This should make Chord names usable. --- CHANGES | 8 +++++ VERSION | 2 +- input/test/jazz-chords.ly | 4 +-- input/test/markup.ly | 4 +-- lily/text-item.cc | 21 +++++++++++-- scm/chord-names.scm | 11 ++++--- scm/font.scm | 42 +++++++++++--------------- scm/interface.scm | 63 +++++++++++++++++++++++---------------- scm/slur.scm | 2 +- 9 files changed, 95 insertions(+), 62 deletions(-) diff --git a/CHANGES b/CHANGES index 8c6ace17ad..27c4ba3001 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,11 @@ +1.3.97.jcn1 +=========== + +* Added some interface documentation. + +* Added raise and kern to markup. This should make Chord names usable. + + 1.3.96.jcn10 ============ diff --git a/VERSION b/VERSION index 23c4d59326..cb9848fbc4 100644 --- a/VERSION +++ b/VERSION @@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=3 PATCH_LEVEL=97 -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/input/test/jazz-chords.ly b/input/test/jazz-chords.ly index 44d35bc008..8bcafc2aea 100644 --- a/input/test/jazz-chords.ly +++ b/input/test/jazz-chords.ly @@ -16,11 +16,11 @@ ;(((0 . 0) (2 . -1) (4 . -1) (6 . -2)) . (super "o7")) ;jazz: the delta, see jazz-chords.ly - (((0 . 0) (2 . -1) (4 . -1) (6 . -2)) . (super ((family . "math") "N"))) + (((0 . 0) (2 . -1) (4 . -1) (6 . -2)) . (super ((font-family . "math") "N"))) + (((0 . 0) (2 . -1) (4 . -1) (6 . -1)) . (rows ((raise . 1) "o") ((raise . 0.5) ((kern . -0.5) ((font-size . "-3") "/"))) "7")) ; slashed o ;(((0 . 0) (2 . -1) (4 . -1) (6 . -1)) . (super "x7")) ; slashed o - (((0 . 0) (2 . -1) (4 . -1) (6 . -1)) . (rows (super "o") ((kern . -0.5) ((size . "-3") "/")) "7")) ) chord::names-alist-american)) diff --git a/input/test/markup.ly b/input/test/markup.ly index ccd03f18a9..9d7703fdf0 100644 --- a/input/test/markup.ly +++ b/input/test/markup.ly @@ -11,7 +11,7 @@ d-\textscript #'(lines "one" "two" "three") e-\textscript #'(lines (bold "one") - (rows "and" "there" "is" ((family . "number") "2")) + (rows "and" "there" "is" ((font-family . "number") "2")) (italic "three")) f-\textscript #'(finger "3") g-\textscript #'(music (named "noteheads-2")) @@ -20,7 +20,7 @@ linewidth = -1.\mm; \translator{ \ScoreContext - TextScript \push #'font-family = #'roman + TextScript \push #'font-family = #"roman" TextScript \pop #'no-spacing-rods TextScript \push #'direction = #1 } diff --git a/lily/text-item.cc b/lily/text-item.cc index 2d8f9bbe22..420e2b17a6 100644 --- a/lily/text-item.cc +++ b/lily/text-item.cc @@ -157,19 +157,36 @@ Text_item::markup_sentence2molecule (Score_element *me, SCM markup_sentence, SCM markup = gh_car (markup_sentence); SCM sentence = gh_cdr (markup_sentence); SCM f = get_elt_property (me, "markup-to-properties"); - SCM p = gh_cons (gh_call1 (f, markup), properties); + SCM p = gh_append2 (gh_call1 (f, markup), properties); Axis align = X_AXIS; SCM a = scm_assoc (ly_symbol2scm ("align"), p); if (gh_pair_p (a) && gh_number_p (gh_cdr (a))) align = (Axis)gh_scm2int (gh_cdr (a)); + Real staff_space = Staff_symbol_referencer::staff_space (me); + Real kern = 0; + SCM k = scm_assoc (ly_symbol2scm ("kern"), p); + if (gh_pair_p (k) && gh_number_p (gh_cdr (k))) + kern = gh_scm2double (gh_cdr (k)) * staff_space; + + Real raise = 0; + SCM r = scm_assoc (ly_symbol2scm ("raise"), p); + if (gh_pair_p (r) && gh_number_p (gh_cdr (r))) + raise = gh_scm2double (gh_cdr (r)) * staff_space; + + Offset o (align == X_AXIS ? kern : 0, + (align == Y_AXIS ? - kern : 0) + raise); + Molecule mol; while (gh_pair_p (sentence)) { Molecule m = text2molecule (me, gh_car (sentence), p); if (!m.empty_b ()) - mol.add_at_edge (align, align == X_AXIS ? RIGHT : DOWN, m, 0); + { + m.translate (o); + mol.add_at_edge (align, align == X_AXIS ? RIGHT : DOWN, m, 0); + } sentence = gh_cdr (sentence); } return mol; diff --git a/scm/chord-names.scm b/scm/chord-names.scm index 99400b03ab..a0cd520bf9 100644 --- a/scm/chord-names.scm +++ b/scm/chord-names.scm @@ -87,8 +87,9 @@ (((0 . 0) (2 . 0) (4 . 0) (6 . -1)) . ("7")) (((0 . 0) (2 . -1) (4 . 0) (6 . 0)) . ("m(maj7)")) ;jazz: the delta, see jazz-chords.ly - ;(((0 . 0) (2 . -1) (4 . -1) (6 . -2)) . (super ((family . "math") "N")) - (((0 . 0) (2 . -1) (4 . -1) (6 . -1)) . (rows (super "o") ((kern . -0.5) ((size . "-3") "/")) "7")) ; slashed o + ;;(((0 . 0) (2 . -1) (4 . -1) (6 . -2)) . (super ((font-family . "math") "N")) + ;; slashed o + (((0 . 0) (2 . -1) (4 . -1) (6 . -1)) . (rows ((raise . 1) "o") ((raise . 0.5) ((kern . -0.5) ((font-size . "-3") "/"))) "7")) ; slashed o (((0 . 0) (2 . 0) (4 . 1) (6 . -1)) . ("aug7")) (((0 . 0) (2 . 0) (4 . -1) (6 . 0)) . (rows "maj7" (music (named ("accidentals--1"))) "5")) (((0 . 0) (3 . 0) (4 . 0) (6 . -1)) . ("7sus4")) @@ -120,8 +121,10 @@ (list (append '(named) (list - (string-append "accidentals-" - (number->string (caddr pitch))))))))))) + (append '((font-size . "-2")) + (list + (string-append "accidentals-" + (number->string (caddr pitch))))))))))))) (define (step->text pitch) diff --git a/scm/font.scm b/scm/font.scm index 1c641c854e..2f9a88fb45 100644 --- a/scm/font.scm +++ b/scm/font.scm @@ -98,38 +98,32 @@ '(font-series font-shape font-family font-name font-point font-size))))) (font-regexp-to-font-name paper font-regexp))) -(define markup-to-properties-alist - '( - (style . font-style) - (series . font-series) - (shape . font-shape) - (family . font-family) - (name . font-name) - (size . font-size) - (point . font-point) - (kern . kern) - )) - (define markup-abbrev-to-properties-alist (append '( - (rows . (align . 0)) - (lines . (align . 1)) - (roman . (font-family . "roman")) - (music . (font-family . "music")) - (bold . (font-series . "bold")) - (italic . (font-shape . "italic")) - (named . (lookup . name)) - (text . (lookup . value)) - ;; super needs some work - (super . (font-size . "-1"))) + (rows . ((align . 0))) + (lines . ((align . 1))) + (roman . ((font-family . "roman"))) + (music . ((font-family . "music"))) + (bold . ((font-series . "bold"))) + (italic . ((font-shape . "italic"))) + (named . ((lookup . name))) + (super . ((raise . 1) (font-size . "-1"))) + (sub . ((raise . -1) (font-size . "-1"))) + (text . ((lookup . value))) + ) (map (lambda (x) (cons (car x) (cons 'font-style (car x)))) style-to-font-alist))) (define (markup-to-properties markup) + ;; (display "markup: `") + ;;(display markup) + ;;(display "'\n") (if (pair? markup) - (cons (cdr (assoc (car markup) markup-to-properties-alist)) (cdr markup)) - (cdr (assoc markup markup-abbrev-to-properties-alist)))) + (list markup) + (let ((entry (assoc markup markup-abbrev-to-properties-alist))) + (if entry (cdr entry) + (list (cons markup #t)))))) (define (style-to-font-name paper style) (let* ((entry (assoc style style-to-font-alist)) diff --git a/scm/interface.scm b/scm/interface.scm index d44e4cc729..fa95a24068 100644 --- a/scm/interface.scm +++ b/scm/interface.scm @@ -145,13 +145,15 @@ more than this (in staffspace)") (property-description 'de-uglify-parameters list? "list of 3 real constants. They define the valid areas for the middle control points. Used in de_uglyfy. They are a bit empirical.") (property-description 'details list? "alist containing contaning a few magic constants.") (property-description 'attachment pair? "cons of symbols, '(LEFT-TYPE . RIGHT-TYPE), where both types may be alongside-stem, stem, head or loose-end") + (property-description 'attachment-offset pair? "cons of offsets, '(LEFT-offset . RIGHT-offset). This offset is added to the attachments to prevent ugly slurs.") (property-description 'direction dir? "up or down?") - (property-description 'y-free number? "? ") - (property-description 'control-points list? "") - (property-description 'extremity-rules list? "") - (property-description 'extremity-offset-alist list? "") - (property-description 'thickness list? "") - (property-description 'dash number? "number representing the length of the dashes.") + (property-description 'beautiful number? "number that dictates when a slur should be de-uglyfied. It correlates with the enclosed area between noteheads and slurs. A value of 0.1 yields only undisturbed slurs, a value of 5 will tolerate quite high blown slurs.") + (property-description 'y-free number? "minimal vertical gap between slur and noteheads or stems") + (property-description 'control-points list? "[internal] control points of bezier curve") + (property-description 'extremity-rules list? "an alist (procedure slur dir) -> attachment to determine the attachment (see above). If procedure returns #t, attachment is used. Otherwise, the next procedure is tried.") + (property-description 'extremity-offset-alist list? "an alist (attachment stem-dir*dir slur-dir*dir) -> offset. The offset adds to the centre of the notehead, or stem.") + (property-description 'thickness list? "The thickness[stafflinethickness] of slur in the centre.") + (property-description 'dashed number? "[FIXME: use dash-period/dash length; see text-spanner] number representing the length of the dashes.") ) ) ) @@ -299,22 +301,6 @@ this object as a reference point.") - -(define text-spanner-interface - (lily-interface - 'text-spanner-interface - "generic text spanner" - (list - (property-description 'dash-period number? "") - (property-description 'dash-length number? "") - (property-description 'line-thickness number? "") - (property-description 'edge-height pair? "(leftheight . rightheight)") - (property-description 'edge-text pair? "(lefttext . righttext)") - (property-description 'text-style string? "") ; SYMBOL!!? - (property-description 'type string? "line, dashed-line or dotted-line") ; SYMBOL!!? - ) -)) - (define hairpin-interface (lily-interface 'hairpin-interface @@ -355,10 +341,21 @@ this object as a reference point.") (define text-interface (lily-interface 'text-interface - "A text" - (list - (property-description 'text string? "") - (property-description 'style string? "") + "A scheme markup text" + (list + (property-description 'text (lambda (x) (or (string? x) (list? x))) "the scheme markup text. Either a string, or a list of which the CAR is a markup '(MARKUP text text ...). MARKUP is either a CONS: an element property '(key . value) or a symbol: an abbreviation for a list of element properties. These abbreviations are currently defined: rows lines roman music bold italic named super sub text, as well as all font-style's.") + (property-description 'font-style string? "font definition for a special purpose, one of: finger volta timesig mark script large Large dynamic") + (property-description 'font-series string? "partial font definition: medium, bold") + (property-description 'font-shape string? "partial font definition: upright or italic") + (property-description 'font-family string? "partial font definition: music roman braces dynamic math ...") + (property-description 'font-name string? "partial font definition: base name of font file FIXME: should override other partials") + (property-description 'font-point string? "partial font definition: exact font size in points FIXME: should override font-size") + (property-description 'font-size string? "partial font definition: the relative size, 0 is style-sheet's normal size, -1 is smaller, +1 is bigger") + (property-description 'align number? "the alignment of the text, 0 is horizontal, 1 is vertical") + (property-description 'lookup symbol? "lookup method: 'value for plain text, 'name for character-name") + (property-description 'raise number? "height for text to be raised (a negative value lowers the text") + (property-description 'kern number? "amount of extra white space to add before text. This is `relative'(?) to the current alignment.") + (property-description 'magnify number? "the magnification factor. FIXME: doesn't work for feta fonts") ))) @@ -589,6 +586,20 @@ position 0." ))) +(define text-spanner-interface + (lily-interface + 'text-spanner-interface + "generic text spanner" + (list + (property-description 'dash-period number? "the length of one dash + white space") + (property-description 'dash-length number? "the length of a dash") + (property-description 'line-thickness number? "the thickness[stafflinethickness] of the line") + (property-description 'edge-height pair? "a cons that specifies the heights of the vertical egdes '(LEFT-height . RIGHT-height)") + (property-description 'edge-text pair? "a cons that specifies the texts to be set at the edges '(LEFT-text . RIGHT-text)") + (property-description 'type string? "one of: line, dashed-line or dotted-line") ; SYMBOL!!? + ) +)) + (define tie-interface (lily-interface 'tie-interface diff --git a/scm/slur.scm b/scm/slur.scm index 2c10991f07..630dc82cc9 100644 --- a/scm/slur.scm +++ b/scm/slur.scm @@ -77,7 +77,7 @@ ;; This list defines the offsets for each type of attachment. ;; The format of each element is -;; (stem-dir * dir . slur-dir * dir) +;; (attachment stem-dir*dir slur-dir*dir) ;; Different attachments have different default points: ;; ;; head: Default position is centered in X, on outer side of head Y -- 2.39.5