]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-1.5.20
authorfred <fred>
Wed, 27 Mar 2002 02:04:00 +0000 (02:04 +0000)
committerfred <fred>
Wed, 27 Mar 2002 02:04:00 +0000 (02:04 +0000)
CHANGES
GNUmakefile.in
input/regression/lyric-align.ly [new file with mode: 0644]
lily/syllable-group.cc
ly/script-init.ly
mf/feta-schrift.mf
scm/grob-description.scm
scm/grob-property-description.scm
scm/interface-description.scm
scm/sketch.scm

diff --git a/CHANGES b/CHANGES
index e9710f65b3b4888993fb32ade25a5fda461dbdaf..1ef6a0d7585984d672656fd895500fa5bbf08994 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,55 @@
+1.5.19.jcn3
+===========
+
+* Sketch output:
+
+  - Sketch uses feta font.
+  - Fix to linewidth and feta fontsize.
+   - mf-to-table: write dummy values in afm to make sketch happy.
+  - Fixes to glyphs: rectangles beziers work now.
+   - Bugfix: sketch.scm: use primitive-eval.
+
+* Sketch and feta Type1 fonts:
+   - textrace:
+      wget http://www.inf.bme.hu/~pts/textrace-latest.tar.gz
+      tar xzf textrace-latest.tar.gz
+@@ -15,18 +17,23 @@
+      (cd autotrace-0.27ap; ./configure; make)
+      ./traceall.sh feta20 feta20.pfb $HOME/usr/src/lilypond/mf/out
+
+  - copy mf/out/feta20.* to sketch/Resources/Fontmetrics
+
+   - append to sketch/Resources/Fontmetrics/std.sfd:
+      echo 'TeX-feta20,feta20,Roman,-gnu-feta20-medium-r-normal,adobe-fontspec\ific,feta20' > $HOME/usr/src/sketch/sketch/Resources/Fontmetrics/std.sfd
+
+   - Hmm, then find that
+
+     + Sketch accesses characters by name, ie, the
+      name characters have in default text fonts.  Luckily, textrace
+      mangles the feta names too.  Sadly, textrace chooses different names
+      for characters > 128.
+
+    + Textrace mangles font name by prepending `TeX-'.  Doesn't seem to
+      pose a big problem; we'll have to pefix `TeX-' to feta fonts.
+
+    + Sadly, only the sketch-0.7.x is happy with the feta type1 font, but
+      printing is not yet implemented?
+
+ * Remove modules directory (again?).
+
+
+1.5.18.moh1
+===========
+
+* Further work on more flexible control of lyric alignment.
+   - new properties "alignment", "ignore-length-mismatch", "begin-alignment" a\nd "end-alignment" to control non-centered lyric alignment
+
+
+1.5.19.hjj1
+===========
+
+* Added \portato.
+
 1.5.18.jcn1
 ===========
 
index c6d7264a0cd8d4ecdec809991b487451aa096054..8f23ce20a6af9df1e60ec0009b1e46b3e7d16399 100644 (file)
@@ -10,7 +10,7 @@ depth = .
 # 
 SUBDIRS = buildscripts scripts flower lily \
        mf ly tex ps scm \
-       modules python po make intl \
+       python po make intl \
        debian $(builddir)/stepmake \
        Documentation input \
        mutopia ports
diff --git a/input/regression/lyric-align.ly b/input/regression/lyric-align.ly
new file mode 100644 (file)
index 0000000..a660e4c
--- /dev/null
@@ -0,0 +1,73 @@
+\version "1.3.146"
+\header{
+  texidoc="Lyric alignment
+
+  Lyric alignment is adjustable both interms of alignment between stanzas and on notehead.
+
+  If the property alignment is not set, there is automatic determination of alignment type based on punctuation. (ee lyric-phrasing.ly)
+
+"
+}
+
+%\paper { linewidth = -1. }
+\score {
+  \addlyrics
+    \context Voice = "v" \notes  \relative c'' {
+      \property Staff.automaticMelismata = ##t
+      \cadenzaOn
+      a\breve  \bar "||" a1 \bar "|"  a \bar "|"  a \bar "||" \break a \bar "|" a \bar "|" a  \bar "|" a \bar "||" \break a \bar "|" a \bar "|."
+    }
+    \context Lyrics <
+      \context LyricsVoice = "v-1" \lyrics {
+%        \property LyricsVoice . stanza = "1:"
+       \property Lyrics . LyricText \override #'ignore-length-mismatch = ##t
+       \property Lyrics . LyricText \override #'alignment = #-1
+       \property Lyrics . LyricText \override #'begin-alignment = #8
+
+       "Particularly useful for reciting notes  "
+       left
+
+       \property Lyrics . LyricText \override #'alignment = #0
+
+       centered
+
+       \property Lyrics . LyricText \override #'alignment = #1        
+
+       right
+
+       \property Lyrics . LyricText \override #'alignment = #-1 
+       \property Lyrics . LyricText \override #'begin-alignment = #2 
+
+       left_half_way
+
+       \property Lyrics . LyricText \override #'begin-alignment = #4 
+
+       left_one_quarter
+
+       \property Lyrics . LyricText \override #'begin-alignment = #10
+
+       left_one_tenth
+
+       \property Lyrics . LyricText \override #'begin-alignment = #1
+
+       left_one_whole
+
+       \property Lyrics . LyricText \override #'ignore-length-mismatch = ##f
+       \property Lyrics . LyricText \override #'begin-alignment = #4
+
+       Very_short_lyrics_remain_in_touch_with_their_note
+
+       \property Lyrics . LyricText \override #'alignment = #1
+       \property Lyrics . LyricText \override #'end-alignment = #1.1
+       \property Lyrics . LyricText \override #'ignore-length-mismatch = ##t
+
+
+       Unless_ignore-length-mismatch_is_true
+
+      }
+      \context LyricsVoice = "v-2" \lyrics {
+%        \property LyricsVoice . stanza = "2:"
+        " with many syllables under them." l c r l l l x x x  note' true'
+      }
+   >
+}
index 84a3f7fa485785e51d4f6325aa184d15e3dd1982..65aa936a374bb86281b6906c258e904d51d70c85 100644 (file)
@@ -131,7 +131,7 @@ Syllable_group::set_lyric_align (const char *punc, Grob *default_notehead_l)
 /** determine the distance to translate lyrics to get correct alignment
     Rules: If alignment is centre, translate = 0
            Otherwise,
-             If (length of longest lyric) < property("end-alignment") * (length of shortest lyric),
+             If (length of longest lyric) < (property {begin,end}-alignment) * (length of shortest lyric),
                 - centre longest lyric on notehead
              Otherwise
                 - move so shortest lyric just reaches notehead centre
@@ -141,11 +141,20 @@ Syllable_group::amount_to_translate ()
 {
   Real translate = 0.0;
   if (alignment_i_ != CENTER) {
-    // FIXME: do we really know the lyric extent here? Some font sizing comes later?
-    Real l1 = longest_lyric_l_->extent (longest_lyric_l_, X_AXIS).length () / gh_scm2double (longest_lyric_l_->get_grob_property("end-alignment"));
-    Real l2 = shortest_lyric_l_->extent (shortest_lyric_l_, X_AXIS).length ();
-
-    translate = l1 <? l2;
+    switch (alignment_i_) {
+      // FIXME: do we really know the lyric extent here? Some font sizing comes later?
+    case LEFT: 
+      translate =  longest_lyric_l_->extent (longest_lyric_l_, X_AXIS).length () / gh_scm2double (longest_lyric_l_->get_grob_property("begin-alignment"));
+      break;
+    case RIGHT: 
+      translate =   longest_lyric_l_->extent (longest_lyric_l_, X_AXIS).length () / gh_scm2double (longest_lyric_l_->get_grob_property("end-alignment"));
+      break;
+    }
+    if (!gh_scm2bool(longest_lyric_l_->get_grob_property("ignore-length-mismatch"))) {
+      Real l = shortest_lyric_l_->extent (shortest_lyric_l_, X_AXIS).length ();
+      translate = l <? translate;
+    }
+    
     translate *= alignment_i_ ;
   }
   return translate;
index b0fcedd3dc6c0cacd41839494cfbfd2371e31fde..e81d20d96bc3235600c48d80a4cb8d8c6a1e3a69 100644 (file)
@@ -13,15 +13,10 @@ thumb = \script "thumb"
 accent = \script "accent"
 marcato = \script "marcato"
 staccatissimo = \script "staccatissimo"
-
-% portato is indicated
-% either by
-%   *  slurred & dotted notes. 
-%or by
-%  * slur and dash notes.
-% Neither are  really supported, but c4-.-- should work.
-% portato = \script "portato"
-
+% Changed 27th October 2001 Heikki Junes <heikki.junes@hut.fi>
+%  * portato = tenuto & staccato
+%  * if you use portato = slur & staccato, then apply "c( d )e-."
+portato = \script "portato"
 fermata = \script "fermata"
 stopped = \script "stopped"
 staccato = \script "staccato"
index b0481341a7a4c33c4234264b4a8286d7786ee811..b9bc92b634623dbb2d427cae11edf83e5d4a80b4 100644 (file)
@@ -177,6 +177,42 @@ fet_beginchar("portato/single tenuto", "tenuto", "tenuto")
 fet_endchar;
 
 
+%
+% Portato by Heikki Junes <heikki.junes@hut.fi>
+%
+
+def draw_portato = 
+       save thick, radius;
+       thick# = 1.4 stafflinethickness#;
+       define_pixels(thick);
+       radius# = 1.4 stafflinethickness#;
+       define_pixels(radius);
+       
+       set_char_box(.6 staff_space#, .6 staff_space#, thick#/2,.5 staff_space#+ radius#);
+       pickup pencircle scaled thick;
+       lft x1 = -b;
+       rt x2 = w;
+       y1 = y2 = 0;
+       draw z1 .. z2;
+
+       pickup pencircle scaled 2 radius;
+       draw (0,h);
+enddef;
+
+
+fet_beginchar("portato/tenuto with staccato", "uportato", 
+               "uportato")
+       draw_portato;
+fet_endchar;
+
+
+fet_beginchar("portato/tenuto with staccato", "dportato", 
+               "dportato")
+       draw_portato;
+       y_mirror_char
+fet_endchar;
+
+
 def draw_marcato = 
        save fat_factor, thinness;
        set_char_box(staff_space#/2, staff_space#/2, 0, 1.1 staff_space#);
index c47c7c9d82eb114120c3b2816a1518a898b01f01..51b78e8f12b64a7f5bc40457cb805b2942c5146f 100644 (file)
                (self-alignment-X . 0)
                (non-rhythmic . #t)
                (word-space . 0.6)
-               (end-alignment . 5)
+                (ignore-length-mismatch . #f)
+                (begin-alignment . 4)
+                (end-alignment . 2)
                (font-family . roman)
                (font-shape . upright)
                (meta . ,(grob-description lyric-syllable-interface text-interface font-interface ))
index 1546486b5e75a1a251d05c4beff4f09dc09051cb..d16013e6c31e21790cfd563a8fd13df89d1f8b52 100644 (file)
@@ -382,7 +382,10 @@ function of type (beam multiplicity dy staff-line-thickness) -> real.  Default v
 (grob-property-description 'visibility-lambda procedure? "a function that takes the break direction and returns a  cons of booleans containing (TRANSPARENT . EMPTY).")
 (grob-property-description 'when moment? "when does this column happen?.")
 (grob-property-description 'word-space number? "elongate left by this much (FIXME: cumbersome semantics).")
-(grob-property-description 'end-alignment number? "proportion of lyric length to align with note-head for non-centered lyrics.")
+(grob-property-description 'alignment number? "alignment of lyrics on notehead, -1 is LEFT, 0 is CENTRE, 1 is RIGHT .")
+(grob-property-description 'ignore-length-mismatch boolean? "if #t, stanzas with shorter lyrics can be moved away from their respective note-head by the lyric alignment code.")
+(grob-property-description 'begin-alignment number? "proportion of lyric length from beginning to align with note-head for left-aligned lyrics.")
+(grob-property-description 'end-alignment number? "proportion of lyric length from end to align with note-head for right-aligned lyrics.")
 (grob-property-description 'x-gap number? "horizontal gap between notehead and tie.")
 (grob-property-description 'y-free number? "minimal vertical gap between slur and noteheads or stems.")
 (grob-property-description 'y-offset number? "extra vertical offset for ties away from the center line.")
index 8f64d30c3a6fc8a336bf4be6bc78988c6d38142c..42129c4b399d956c17aee9ea02a08c1ef7f92134 100644 (file)
@@ -535,6 +535,9 @@ that helps show the length of a melissima (tied/slurred note)."
    "a single piece of lyrics"
    '(
     word-space
+    alignment
+    ignore-length-mismatch
+    begin-alignment
     end-alignment
     ))
 
index ab2e8751ca52528e08fd2044c97dda988d709643..58fe938749808fbe75293440d0f2cdccc266ee62 100644 (file)
 
 
+
+(use-modules (ice-9 format))
+
+(define (ascii->string i) (make-string 1 (integer->char i)))
+
+(define (control->list c)
+  (list (+ global-x (car c)) (+ global-y (cdr c))))
+
+(define (control-flip-y c)
+  (cons (car c) (* -1 (cdr c))))
+
 ;;; urg.
 (define (sk-numbers->string l)
   (string-append
    (number->string (car l))
    (if (null? (cdr l))
        ""
-       (string-append ","  (sk-numbers->string (cdr l)))
-       )
-   )
-  )
-
+       (string-append ","  (sk-numbers->string (cdr l))))))
+
+(define global-x 0.0)
+(define global-y 0.0)
+(define global-list '())
+(define global-font "")
+(define global-s "")
+(define global-scale 1.0)
+(define (global-mul-scale  x) (* global-scale x))
+
+;; hmm, global is global
+(define (global-filledbox width dy dx height x y)
+  (string-append
+   "fp((0,0,0))\n"
+   "lw(0.1)\n"
+   "r("
+   (sk-numbers->string
+    (map global-mul-scale (list width dy dx height x y)))
+   ")\n"))
+
+(define (global-bezier l)
+  (let* ((c0 (car (list-tail l 3)))
+        (c123 (list-head l 3))
+        (start (control->list c0))
+        (control (apply append (map control->list c123))))
+    (string-append
+     "bs(" (sk-numbers->string (map global-mul-scale start)) ",0)\n"
+     "bc(" (sk-numbers->string (map global-mul-scale control)) ",2)\n")))
+  
 
+(define (global-beziers l thick)
+  (let* (;;(burp (set! global-y (+ global-y (* 2 (cdar l)))))
+        (first
+         (list-tail l 4))
+        (second
+         (list-head l 4))
+                )
+    (string-append
+     "fp((0,0,0))\n"
+     "lw(0.1)\n"
+     "b()\n"
+     (global-bezier first)
+     (global-bezier second)
+     ;;"b_()\n"
+     )))
+        
+                
 (define (sketch-scm action-name)
-  (define global-x 0.0)
-  (define global-y 0.0)
-  (define output-scale 1.0)
-  (define (mul-scale  x) (* output-scale x))
   
   ;; alist containing fontname -> fontcommand assoc (both strings)
   (define font-alist '())
   (define font-count 0)
   (define current-font "")
 
-  
-  (define (cached-fontname i)
-    (string-append
-     "lilyfont"
-     (make-string 1 (integer->char (+ 65 i)))))
-    
+  (define (font-def x)
+  "")
 
+  (define (cached-fontname i)
+    "")
+  
   (define (select-font name-mag-pair)
-    (let*
-       (
-        (c (assoc name-mag-pair font-name-alist))
-        )
-
-      (if (eq? c #f)
-         (begin
-           (display "FAILED\n")
-           (display (object-type (car name-mag-pair)))
-           (display (object-type (caaar font-name-alist)))
-
-           (ly-warn (string-append
-                     "Programming error: No such font known "
-                     (car name-mag-pair) " "
-                     (ly-number->string (cdr name-mag-pair))
-                     ))
-           
-           "") ; issue no command
-         "")
-;        (string-append " " (cddr c) " "))
-      ))
-
-    (define (font-load-command name-mag command)
-      "")
+    (set! global-font (car name-mag-pair))
+    "")
+  
+  (define (font-load-command name-mag command)
+    "")
     
-;      "Fn(" command ")" )
-
   (define (beam width slope thick)
-    (string-append
-     (sk-numbers->string (list slope width thick)) " draw_beam" ))
+    (let ((s (list
+             'global-filledbox
+             width
+             (* slope width)
+             0
+             thick
+             'global-x
+             'global-y)))
+      (set! global-s s))
+    "\n")
 
   (define (comment s)
     (string-append "% " s))
      (numbers->string (list arch_angle arch_width arch_height height arch_thick thick)) " draw_bracket" ))
 
   (define (char i)
-    (invoke-char " show" i))
-
+    (set! global-s
+;;       `(string-append "txt(" ,(number->string i) ",("
+;;                       (sk-numbers->string (list global-x global-y))
+         `(string-append
+           "fp((0,0,0))\n"
+           "le()\n"
+           "lw(0.1)\n"
+;;         "Fn('" global-font "')\n"
+;;         "Fn('Times-Roman')\n"
+           "Fn('TeX-feta20')\n"
+           "Fs(20)\n"
+           ;; chars > 128 don't work yet
+           "txt('" ,(ascii->string (modulo i 128)) "',("
+;;         "char(" ,(number->string i)  ",("
+           (sk-numbers->string (list (* global-scale global-x)
+                                     (* global-scale global-y)))
+           "))\n")))
 
   (define (hairpin thick width starth endh )
     (string-append 
@@ -112,30 +161,19 @@ grid((0,0,20,20),0,(0,0,1),'Grid')\n")
   
   (define (experimental-on) "")
   
-  ;; obsolete?
-  (define (font-def i s)
-    (string-append
-     "\n/" (font i) " {/" 
-     (substring s 0 (- (string-length s) 4))
-     " findfont 12 scalefont setfont} bind def \n"))
-
   (define (font-switch i)
     "")
-;    (string-append (font i) " "))
 
   (define (header-end)
-    (string-append "")
-     
-    )
-  
+    "")
+    
   (define (lily-def key val)
     (if (equal? key "lilypondpaperoutputscale")
-       (set! output-scale (string->number val))
-)
+       (set! global-scale (string->number val)))
     "")
   
 
-  (define (header creator generate) 
+  (define (header creator generate)
     (string-append
      "##Sketch 1 2
 document()
@@ -150,34 +188,43 @@ layer('Layer 1',1,1,0,0,(0,0,0))
     (string-append
      (ly-number->string (* d  (/ 72.27 72))) " " s ))
 
+  ;;  urg
   (define (placebox x y s)
+;;    (format (current-error-port) "placebox: ~S, ~S, ~S\n" x y s)
     (set! global-x (+ x 0))
     (set! global-y (+ y 100))
-    (eval s)
-    )
+    (let ((s (primitive-eval global-s)))
+      (set! global-s "\n")
+      s))
 
   (define (bezier-sandwich l thick)
-    '(string-append 
-     (apply string-append (map control->string l))
-     (ly-number->string  thick)
-     " draw_bezier_sandwich"))
+    (let ((s (list
+             'global-beziers
+             'global-list
+             thick)))
+      (set! global-s s)
+      (set! global-list l))
+    "\n")
 
 ; TODO: use HEIGHT argument
   (define (start-line height)
      "G()\n"
      )
   
+  ;;  r((520.305,0,0,98.0075,51.8863,10.089))
+  ;;  width, 0, 0, height, x, y
   (define (filledbox breapth width depth height)
-    `(string-append
-      "lw(1)\nr("
-      (sk-numbers->string (quote ,(map  mul-scale (list (+ breapth width)
-                                                0 0 
-                                                (- (+ breapth depth))
-                                                global-x
-                                                (+ global-y height)))))
-                   ")\n")
-    )
-
+    (let ((s (list
+             'global-filledbox
+             (+ breapth width)
+             0 0
+             (+ depth height)
+             `(- global-x ,breapth)
+             `(- global-y ,depth))))
+;;      (format (current-error-port) "filledbox: ~S\n" s)
+      (set! global-s s))
+    "\n")
+  
   (define (stem x y z w) (filledbox x y z w))
 
   
@@ -185,8 +232,10 @@ layer('Layer 1',1,1,0,0,(0,0,0))
       "G_()\n")
 
   (define (text s)
-    "")
-;    (string-append "(" s ") show  "))
+    (set! global-s
+         `(string-append "txt('" ,s "',("
+                         (sk-numbers->string (list global-x global-y))
+                         "))\n")))
 
 
   (define (volta h w thick vert_start vert_end)
@@ -266,3 +315,5 @@ layer('Layer 1',1,1,0,0,(0,0,0))
        (else (error "unknown tag -- SKETCH-SCM " action-name))
        )
   )
+
+