]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/general-scheme.cc (LY_DEFINE): elucidate docstring.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 11 Oct 2006 23:20:07 +0000 (23:20 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 11 Oct 2006 23:20:07 +0000 (23:20 +0000)
* scm/define-markup-commands.scm (tied-lyric): new function: split
string along ~ and reattach with U+203F (tie character) and
negative space.

* scm/output-lib.scm (lyric-text::calc-text): new function.

* lily/lyric-engraver.cc (process_music): don't set 'text.

* scm/output-lib.scm (string-finger::calc-text): new function
(lyric-text::print): new function.

* scm/define-grobs.scm (all-grob-descriptions): add StringFinger

ChangeLog
lily/general-scheme.cc
lily/lyric-engraver.cc
scm/define-grobs.scm
scm/define-markup-commands.scm
scm/output-lib.scm

index 680ceb6ac9e7d96370304c62d8b571c3afca8d6d..cc035348b868bcb2e016174b1ed7a5cbfa06d9aa 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,17 @@
 2006-10-12  Han-Wen Nienhuys  <hanwen@lilypond.org>
 
+       * lily/general-scheme.cc (LY_DEFINE): elucidate docstring.
+
+       * scm/define-markup-commands.scm (tied-lyric): new function: split
+       string along ~ and reattach with U+203F (tie character) and
+       negative space.
+
+       * scm/output-lib.scm (lyric-text::calc-text): new function.
+
+       * lily/lyric-engraver.cc (process_music): don't set 'text.
+
        * scm/output-lib.scm (string-finger::calc-text): new function
+       (lyric-text::print): new function.
 
        * lily/new-fingering-engraver.cc (add_fingering): refactor; make
        generic for fingering & string number. Use for string-finger. 
index 5beda8355e9f5ec2940e8cbd0e5ecdc59b68bca4..6b96729d42e695fa23243a996e20be3aa1b8646d 100644 (file)
@@ -236,7 +236,7 @@ LY_DEFINE (ly_output_formats, "ly:output-formats",
 
 LY_DEFINE (ly_wchar_to_utf_8, "ly:wide-char->utf-8",
           1, 0, 0, (SCM wc),
-          "Encode the Unicode codepoint @var{wc} as UTF-8")
+          "Encode the Unicode codepoint @var{wc}, an integer, as UTF-8")
 {
   char buf[5];
 
index e11f4ec222156d18672805fa1338aabbf36d97c6..7ef5dde889a737dc0e5e50695baa7111339bcee7 100644 (file)
@@ -69,7 +69,6 @@ Lyric_engraver::process_music ()
       else
        {
          text_ = make_item ("LyricText", event_->self_scm ());
-         text_->set_property ("text", text);
        }
     }
 }
index 5dc860bd275f6ba5586b0eaf2ed9b315a256b5b6..84078d3888760260fb3aaaa5d0036e938de59cc8 100644 (file)
                                lyric-hyphen-interface spacing-interface))
                 ))
        ))
+    
     (LyricText
      . (
-       (stencil . ,ly:text-interface::print)
+       (stencil . ,lyric-text::print)
+       (text . ,lyric-text::calc-text)
        (X-offset . ,ly:self-alignment-interface::aligned-on-x-parent)
        (self-alignment-X . 0)
        (word-space . 0.6)
index e6d16ce5583aa88b318d69a1b47061c4407e4a35..960b78031d7fb3acf393987c2dfb7dd7d52a46b5 100644 (file)
@@ -274,11 +274,38 @@ grestore
 ;; basic formatting.
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
+(define (list-join lst intermediate)
+  (reduce (lambda (elt prev)
+           (if (pair? prev) (cons  elt (cons intermediate prev))
+               (list elt intermediate prev))) '() lst))
+
+
 (define-markup-command (simple layout props str) (string?)
   "A simple text string; @code{\\markup @{ foo @}} is equivalent with
 @code{\\markup @{ \\simple #\"foo\" @}}."
   (interpret-markup layout props str))
 
+(define-markup-command (tied-lyric layout props str) (string?)
+  
+  "Like simple-markup, but use tie characters for ~ tilde symbols."
+
+  (if (string-contains str "~")
+      (let*
+         ((parts (string-split str #\~))
+          (tie-str (ly:wide-char->utf-8 #x203f))
+          (joined  (list-join parts tie-str))
+          (join-stencil (interpret-markup layout props tie-str))
+          )
+
+       (interpret-markup layout 
+                         (prepend-alist-chain
+                          'word-space
+                          (/ (interval-length (ly:stencil-extent join-stencil X)) -4)
+                          props)
+                         (make-line-markup joined)))
+                          ;(map (lambda (s) (interpret-markup layout props s)) parts))
+      (interpret-markup layout props str)))
+
 
 ;; TODO: use font recoding.
 ;;                   (make-line-markup
index 1558e761180eb61f4920ffcc731f40ddf876e4c5..413d99b540e62dc0ba800b1b66d074423a52e947 100644 (file)
@@ -431,3 +431,24 @@ centered, X==1 is at the right, X == -1 is at the left."
       START
       STOP
       ))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; lyrics
+
+(define-public (lyric-text::print grob)
+  "Allow interpretation of tildes as lyric tieing marks."
+  
+  (let*
+      ((text (ly:grob-property grob 'text))
+       (layout (ly:grob-layout grob))
+       (defs (ly:output-def-lookup layout 'text-font-defaults))
+       (props (ly:grob-alist-chain grob defs)))
+
+    (ly:text-interface::interpret-markup layout
+                                        props
+                                        (if (string? text)
+                                            (make-tied-lyric-markup text)
+                                            text))))
+
+(define-public (lyric-text::calc-text grob)
+   (ly:event-property (event-cause grob) 'text))