]> git.donarmstrong.com Git - lilypond.git/commitdiff
* Documentation/user/instrument-notation.itely (String number
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 28 Mar 2005 15:33:01 +0000 (15:33 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 28 Mar 2005 15:33:01 +0000 (15:33 +0000)
indications): new node.

* input/regression/new-markup-syntax.ly (texidoc): add circle.

* lily/new-fingering-engraver.cc (add_string): new function.
(acknowledge_grob): accept string-number-event as well.

* scm/define-markup-commands.scm (circle): new markup command.

* scm/output-lib.scm (print-circled-text-callback): new function.

* lily/GNUmakefile: move ifeq after include stepmake.make.

18 files changed:
ChangeLog
Documentation/topdocs/NEWS.tely
Documentation/user/instrument-notation.itely
input/regression/new-markup-syntax.ly
input/regression/string-number.ly [new file with mode: 0644]
kpath-guile/GNUmakefile
lily/GNUmakefile
lily/grob-scheme.cc
lily/new-fingering-engraver.cc
lily/text-item.cc
make/lilypond.fedora.spec.in
ps/music-drawing-routines.ps
scm/define-grobs.scm
scm/define-markup-commands.scm
scm/lily.scm
scm/output-lib.scm
scm/output-ps.scm
scm/output-tex.scm

index 39615eae012042e2ddb8fa7b9c2234598d74c499..839a4b0bfcec0c6b0aa70a8cfd54efcf8972958b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2005-03-28  Han-Wen Nienhuys  <hanwen@xs4all.nl>
+
+       * Documentation/user/instrument-notation.itely (String number
+       indications): new node.
+
+       * input/regression/new-markup-syntax.ly (texidoc): add circle.
+
+       * lily/new-fingering-engraver.cc (add_string): new function. 
+       (acknowledge_grob): accept string-number-event as well.
+
+       * scm/define-markup-commands.scm (circle): new markup command.
+
+       * scm/output-lib.scm (print-circled-text-callback): new function.
+
+       * lily/GNUmakefile: move ifeq after include stepmake.make.
+
 2005-03-28  Jan Nieuwenhuizen  <janneke@gnu.org>
 
        * config.make.in (HAVE_LIBKPATHSEA_SO): 
index 961498f7d3f884165373e6842ca89648e0a4a593..a517cbdb3e392bbeb0e0fe9e9d57c83c410833d9 100644 (file)
@@ -28,6 +28,15 @@ See user manual, \NAME\
 
 
 @itemize @bullet
+@item
+String numbers are now printed on chords as well,
+
+@lilypond[relative,relative=1,raggedright]
+<c\1 e\2 g\3>
+@end lilypond
+
+See also @inputfileref{input/regression,string-number.ly}.
+
 @item
 Notes with ledger lines will be kept at a distance, so they never
 disappear.
index 0e2f2af152b1b23ee23066c524c72b85d0d982fd..46c91ab35a76c42585d2e2097025ffb0a56ca416 100644 (file)
@@ -1657,27 +1657,55 @@ for this purpose instead.
 
 
 
-@node Tablatures
-@section Tablatures
+@node Guitar 
+@section Guitar
 
 @cindex tablature
 @cindex guitar tablature
 
-Tablature notation is used for notating music for plucked string
-instruments.  Pitches are not denoted with note heads, but by
-indicating on which string and fret a note must be played.  LilyPond
-offers limited support for tablature.
-
 @menu
 * Tablatures basic::            
 * Non-guitar tablatures::       
 * Fret diagrams::               
 @end menu
 
+@node String number indications
+@subsection String number indications
+
+@cindex String numbers
+
+String numbers can be added to chords, by indicating the string number
+with @code{\}@var{number}, 
+
+@lilypond[relative,relative=1,raggedright]
+<c\1 e\2 g\3>
+@end lilypond
+
+See also @inputfileref{input/regression,string-number.ly}.
+
+
+@seealso
+
+Program reference: @internalsref{StringNumber},
+@internalsref{StringNumberEvent}
+
+@refbugs
+
+Fingering shares the positioning code with the fingering
+(@ref{Fingering instructions}) and articulation on chords.  This means
+that it is not possible to have string numbers on the right and
+fingering instructions on the left of the same chord.
+
+
 @node Tablatures basic
 @subsection Tablatures basic
 @cindex Tablatures basic
 
+Tablature notation is used for notating music for plucked string
+instruments.  Pitches are not denoted with note heads, but by
+numbers indicating on which string and fret a note must be played.  LilyPond
+offers limited support for tablature.
+
 The string number associated to a note is given as a backslash
 followed by a number, e.g., @code{c4\3} for a C quarter on the third
 string.  By default, string 1 is the highest one, and the tuning
index f3936030308bcf7520bdc958f9b68b3175bb940e..d35606a59a114eb4f49be47dd774323dc3789675 100644 (file)
@@ -27,6 +27,7 @@ texidoc = "With the new markup syntax, text may be written in various manners."
 %              \char-number #"abc1234abc"
                \box \column { \line { "string 1" } \line { "string 2" } }
                "$\\emptyset$"
+               \circle #4 #0.2
                \italic Norsk
                \super "2"
                \dynamic sfzp
diff --git a/input/regression/string-number.ly b/input/regression/string-number.ly
new file mode 100644 (file)
index 0000000..06386fc
--- /dev/null
@@ -0,0 +1,16 @@
+\header {
+  texidoc = "String numbers can be added to chords. They use the same
+positioning mechanism as finger instructions."
+
+}
+
+\version "2.5.17"
+\paper {
+  raggedright = ##t
+}
+
+\relative {
+  <c\1 e\2 g\3>
+  \set fingeringOrientations = #'(down right up)
+  <c\1 e\2 g\3>
+}
index b10a6dc6a0f6bb12effeb57437564bed443b76d7..e7e92d6f7e201467f1798a52e52a0e81bf89c794 100644 (file)
@@ -2,7 +2,7 @@ depth = ..
 
 NAME = kpath-guile
 MODULE_NAME = kpath-guile
-
+MODULE_LDFLAGS= = -lkpathsea
 SCRIPTS = 
 STEPMAKE_TEMPLATES = library c po
 
index 9569aa5023d13a85383c8fd226663811c88a2211..fc3002589e0529c35a4ad4e3055d6984827544e8 100644 (file)
@@ -8,15 +8,16 @@ MODULE_LIBS= $(depth)/flower  $(depth)/ttftool $(depth)/kpath-guile
 MODULE_INCLUDES= $(depth)/flower/include $(depth)/ttftool/include 
 MODULE_CXXFLAGS=
 
-ifeq ($(HAVE_LIBKPATHSEA_SO),no)
-MODULE_LDFLAGS= $(KPATHSEA_LIBS)
-endif
-
 HELP2MAN_EXECS = lilypond
 STEPMAKE_TEMPLATES= c++ executable po help2man
 
 include $(depth)/make/stepmake.make 
 
+ifeq ($(HAVE_LIBKPATHSEA_SO),no)
+MODULE_LDFLAGS+= $(KPATHSEA_LIBS)
+endif
+
+
 # for profiling, link guile statically:
 #
 # USER_LDFLAGS += -static -lltdl -ldl
index d892e6c443f82899a963c481ab3b78af9d3f7698..60e5f05fe653d36ec8983450a8ccbf9e1aae487c 100644 (file)
@@ -65,13 +65,13 @@ LY_DEFINE (ly_grob_layout, "ly:grob-layout",
 }
 
 LY_DEFINE (ly_grob_alist_chain, "ly:grob-alist-chain",
-          1, 1, 0, (SCM g, SCM global),
-          "Get an alist chain for grob @var{g}, with @var{global} as the "
+          1, 1, 0, (SCM grob, SCM global),
+          "Get an alist chain for grob @var{grob}, with @var{global} as the "
           "global default. If unspecified, @code{font-defaults} "
           "from the layout block is taken. ")
 {
-  Grob *sc = unsmob_grob (g);
-  SCM_ASSERT_TYPE (sc, g, SCM_ARG1, __FUNCTION__, "grob");
+  Grob *sc = unsmob_grob (grob);
+  SCM_ASSERT_TYPE (sc, grob, SCM_ARG1, __FUNCTION__, "grob");
 
   if (global == SCM_UNDEFINED)
     global
index 2a6930bec394e969548dcb8b938a161a49622375..4909ebe88e6c787aa107a47e7eecb150c379f2fa 100644 (file)
@@ -51,6 +51,7 @@ protected:
   virtual void acknowledge_grob (Grob_info);
   void add_fingering (Grob *, Music *, Music *);
   void add_script (Grob *, Music *, Music *);
+  void add_string (Grob *, Music *, Music *);
   void position_scripts ();
 };
 
@@ -84,6 +85,10 @@ New_fingering_engraver::acknowledge_grob (Grob_info inf)
            {
              add_script (inf.grob_, m, note_ev);
            }
+         else if (m->is_mus_type ("string-number-event"))
+           {
+             add_string (inf.grob_, m, note_ev);
+           }
          else if (m->is_mus_type ("harmonic-event"))
            {
              inf.grob_->set_property ("style", ly_symbol2scm ("harmonic"));
@@ -104,8 +109,10 @@ New_fingering_engraver::acknowledge_grob (Grob_info inf)
 void
 New_fingering_engraver::add_script (Grob *head,
                                    Music *event,
-                                   Music *)
+                                   Music *note)
 {
+  (void) note;
+
   Finger_tuple ft;
 
   Grob *g = make_item ("Script", event->self_scm ());
@@ -158,6 +165,30 @@ New_fingering_engraver::add_fingering (Grob *head,
   fingerings_.push (ft);
 }
 
+
+void
+New_fingering_engraver::add_string (Grob *head,
+                                   Music *event,
+                                   Music *hevent)
+{
+  Finger_tuple ft;
+
+  ft.script_ = make_item ("StringNumber", event->self_scm ());
+
+  Side_position_interface::add_support (ft.script_, head);
+
+  int d = scm_to_int (event->get_property ("string-number"));
+
+  SCM sstr = scm_number_to_string (scm_int2num (d), scm_int2num (10));
+  ft.script_->set_property ("text", sstr);
+
+  ft.finger_event_ = event;
+  ft.note_event_ = hevent;
+  ft.head_ = head;
+
+  fingerings_.push (ft);
+}
+
 void
 New_fingering_engraver::position_scripts ()
 {
index 10500ceba148121507d1a7a12a2380d31ed38882..a45a3c84b873699ec3e1056750e4c3c379cd499c 100644 (file)
@@ -20,8 +20,8 @@
 #include "output-def.hh"
 #include "modified-font-metric.hh"
 
-MAKE_SCHEME_CALLBACK (Text_interface, interpret_string, 3)
-  SCM
+MAKE_SCHEME_CALLBACK (Text_interface, interpret_string, 3);
+SCM
 Text_interface::interpret_string (SCM layout_smob,
                                  SCM props,
                                  SCM markup)
@@ -39,8 +39,8 @@ Text_interface::interpret_string (SCM layout_smob,
   return fm->text_stencil (str).smobbed_copy ();
 }
 
-MAKE_SCHEME_CALLBACK (Text_interface, interpret_markup, 3)
-  SCM
+MAKE_SCHEME_CALLBACK (Text_interface, interpret_markup, 3);
+SCM
 Text_interface::interpret_markup (SCM layout_smob, SCM props, SCM markup)
 {
   if (scm_is_string (markup))
index f77d79a2d1d2f0dd193499663046ef773a5cdb06..52c9cebd210eb1b68413ed1c7eb06fb50464b3da 100644 (file)
@@ -18,9 +18,13 @@ Buildrequires: t1utils bison flex mftrace ImageMagick
 Buildrequires: texinfo >= 4.7
 Buildrequires: guile-devel >= 1.6.4-8 
 Buildrequires: freetype-devel >= 2.1
+
 Buildrequires: fontforge
 #fontforge must be >= 20041211 urg. 0.0.0-fdr.1.20041211
 
+Buildrequires: pango-devel >= 1.6.0
+Buildrequires: fontconfig-devel
+
 Requires: libstdc++ python 
 Requires: guile >= 1.6.4-8 ghostscript >= 8.15
 
index 35e8b3bb1f27476d889efde75e2f5e1d86b97ab0..3bcfa3a45f2bf8746448c5e67730024be06c7ea5 100644 (file)
@@ -3,6 +3,8 @@
 % Functions for direct and embedded PostScript
 
 
+%% TODO: use dicts or prefixes to prevent namespace pollution.
+
 /pdfmark where
 {pop} {userdict /pdfmark /cleartomark load put} ifelse
 
@@ -259,6 +261,14 @@ bind def
        0 360 arc closepath fill stroke
 } bind def
 
+/draw_circle % R T
+{
+       setlinewidth
+       dup 0 moveto
+       0 exch 0 exch
+       0 360 arc closepath stroke
+} bind def
+
 /draw_white_dot % x1 y2 R
 {
 %      0 360 arc fill stroke
index 724281b723d9aba5107d4df87bb59ec0aa9f3031..f568348d6e0af4562c213eddd474cd39f982916e 100644 (file)
                                side-position-interface self-alignment-interface
                                item-interface))))
        ))
+    (StringNumber
+     . (
+       (print-function . ,print-circled-text-callback)
+       (padding . 0.5)
+       (staff-padding . 0.5)
+       (self-alignment-X . 0)
+       (self-alignment-Y . 0)
+       (script-priority . 100)
+       (font-encoding . fetaNumber)
+       (font-size . -5)                ; don't overlap when next to heads.
+       (meta . ((interfaces . (string-number-interface
+                               font-interface text-script-interface text-interface
+                               side-position-interface self-alignment-interface
+                               item-interface))))
+       ))
 
     (Glissando
      . (
index e975b35acff004b150996132d95b5b1fa144894b..bd8d08c5875d78130892252e99032ebc83546fab 100644 (file)
   "Stencil as markup"
   stil)
 
+(def-markup-command (circle layout props radius thickness)
+  (number? number?)
+  "A circle of radius @var{radius} and thickness @var{thickness}"
+
+  (ly:make-stencil
+   (list 'circle radius thickness)
+   (cons (- radius) radius)
+   (cons (- radius) radius)))
 
 (def-markup-command (with-url layout props url arg) (string? markup?)
   "Add a link to URL @var{url} around @var{arg}. This only works in
index 0fe8fbfb22512e515f7d5fbcb89aa48be4c03188..0ce3c55ef34771bdd7416cd2558a8f8afc8125a0 100644 (file)
@@ -126,6 +126,7 @@ predicates. Print a message at LOCATION if any predicate failed."
     blank
     bracket
     char
+    circle
     dashed-line
     dashed-slur
     dot
index 6180d86454eb55d0b1fffba1275ddc41bb4d9854..759727bb06962b5c76f1680d5020e1844cba7aff 100644 (file)
        ((string? arg) (string-append "\"" arg "\""))
        ((symbol? arg) (string-append "\"" (symbol->string arg) "\""))))
 
-(define-public (func name . args)
-  (string-append
-   "(" name
-   (if (null? args)
-       ""
-       (apply string-append
-             (map (lambda (x) (string-append " " (arg->string x))) args)))
-   ")\n"))
+(define-public (print-circled-text-callback grob)
+  (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))
+       (circle (Text_interface::interpret_markup layout props 
+                                                (make-circle-markup
+                                                 1.0 0.1)))
+       (text-stencil
+       (Text_interface::interpret_markup layout props text)))
+
+    (ly:stencil-align-to! text-stencil X CENTER)
+    (ly:stencil-align-to! text-stencil Y CENTER)
+    (ly:stencil-add text-stencil circle)
+  ))
+
 
 ;;(define (mm-to-pt x)
 ;;  (* (/ 72.27 25.40) x))
   (string-append (ly:number->string (car c)) " "
                 (ly:number->string (cdr c))))
 
-(define (font i)
-  (string-append
-   "font"
-   (make-string 1 (integer->char (+ (char->integer #\A) i)))))
-
-(define (scm-scm action-name)
-  1)
 
 ;; silly, use alist? 
 (define-public (find-notehead-symbol duration style)
index defeb0c2cf7c9b0eb4ea93dd86a7709805e8ec99..1d969d056d54ed2332d23078d843bf17b049a109 100644 (file)
@@ -21,6 +21,7 @@
   ;; JUNK this -- see lily.scm: ly:all-output-backend-commands
   #:export (unknown
            blank
+           circle
            dot
            white-dot
            beam
    (ly:number->string off)
    " ] 0 draw_dashed_slur"))
 
+(define (circle radius thick)
+  (format
+   "~a ~a draw_circle" radius thick))
+
+
 (define (dot x y radius)
   (string-append
    " "
index 8e77e50ece6931f44695619ad5cdc5c8b2be05fa..d04e83d8d044f96fb63b8416ee6a5ac87834a5a4 100644 (file)
@@ -79,6 +79,9 @@
 (define (dot x y radius)
   (embedded-ps (list 'dot x y radius)))
 
+(define (circle radius thick)
+  (embedded-ps (list 'circle radius thick)))
+
 
 (define (embedded-ps string)
   (embedded-ps (list 'embedded-ps string)))