From: fred Date: Wed, 27 Mar 2002 02:04:00 +0000 (+0000) Subject: lilypond-1.5.20 X-Git-Tag: release/1.5.59~411 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=1524971c25f7079bf57466b131273ea671d7cb36;p=lilypond.git lilypond-1.5.20 --- diff --git a/CHANGES b/CHANGES index e9710f65b3..1ef6a0d758 100644 --- 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 =========== diff --git a/GNUmakefile.in b/GNUmakefile.in index c6d7264a0c..8f23ce20a6 100644 --- a/GNUmakefile.in +++ b/GNUmakefile.in @@ -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 index 0000000000..a660e4ce7e --- /dev/null +++ b/input/regression/lyric-align.ly @@ -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' + } + > +} diff --git a/lily/syllable-group.cc b/lily/syllable-group.cc index 84a3f7fa48..65aa936a37 100644 --- a/lily/syllable-group.cc +++ b/lily/syllable-group.cc @@ -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 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 +% * 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" diff --git a/mf/feta-schrift.mf b/mf/feta-schrift.mf index b0481341a7..b9bc92b634 100644 --- a/mf/feta-schrift.mf +++ b/mf/feta-schrift.mf @@ -177,6 +177,42 @@ fet_beginchar("portato/single tenuto", "tenuto", "tenuto") fet_endchar; +% +% Portato by Heikki Junes +% + +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#); diff --git a/scm/grob-description.scm b/scm/grob-description.scm index c47c7c9d82..51b78e8f12 100644 --- a/scm/grob-description.scm +++ b/scm/grob-description.scm @@ -317,7 +317,9 @@ (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 )) diff --git a/scm/grob-property-description.scm b/scm/grob-property-description.scm index 1546486b5e..d16013e6c3 100644 --- a/scm/grob-property-description.scm +++ b/scm/grob-property-description.scm @@ -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.") diff --git a/scm/interface-description.scm b/scm/interface-description.scm index 8f64d30c3a..42129c4b39 100644 --- a/scm/interface-description.scm +++ b/scm/interface-description.scm @@ -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 )) diff --git a/scm/sketch.scm b/scm/sketch.scm index ab2e8751ca..58fe938749 100644 --- a/scm/sketch.scm +++ b/scm/sketch.scm @@ -1,66 +1,100 @@ + +(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)) @@ -70,8 +104,23 @@ (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)) ) ) + +