From: Han-Wen Nienhuys Date: Mon, 31 May 2004 22:40:54 +0000 (+0000) Subject: * lily/lexer.ll: lex \score separately. X-Git-Tag: release/2.3.4~40 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=8c3399e17f40e56df3ae41b155899263ec6919bf;p=lilypond.git * lily/lexer.ll: lex \score separately. * lily/paper-book.cc: junk stencil2line. * lily/paper-line.cc (Paper_line): construct from Stencil directly. No futzing with the dimensions. * lily/include/paper-line.hh (class Paper_line): * lily/stencil.cc (interpret_stencil_expression): combine-stencil takes arbitrary number of arguments. * input/test/markup-score.ly (tuning): simplify example. --- diff --git a/ChangeLog b/ChangeLog index d2b79b84e2..c9dc7b6529 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,29 @@ - +2004-06-01 Han-Wen Nienhuys + + * lily/lexer.ll: lex \score separately. + + * lily/paper-book.cc: junk stencil2line. + + * lily/paper-line.cc (Paper_line): construct from Stencil + directly. No futzing with the dimensions. + + * lily/include/paper-line.hh (class Paper_line): + + * lily/stencil.cc (interpret_stencil_expression): combine-stencil + takes arbitrary number of arguments. + + * input/test/markup-score.ly (tuning): simplify example. + +2004-05-31 Han-Wen Nienhuys + + * lily/score.cc (LY_DEFINE): ly:score-embedded-format, new function. + + * scm/define-markup-commands.scm (score): define score-markup + + * lily/parser.yy (markup): use score-markup. + + * lily/score.cc: add ly:score? + 2004-05-30 Carl Sorensen * scm/fret-diagrams.scm: add fret-diagram-verbose markup; modified diff --git a/input/test/markup-score.ly b/input/test/markup-score.ly index 12de723acf..3fb864c62f 100644 --- a/input/test/markup-score.ly +++ b/input/test/markup-score.ly @@ -1,102 +1,21 @@ -\header { - - %% When vertical dimension and stacking works properly, this - %% should be broken up into a few regression tests. - %% Too bad that '{' is overloaded, we need something (the bit arbitrary - %% `\score' now, to introduce to-markup-stencil-rendered music. - +\header { texidoc = "Use \\score block as markup command." - } \version "2.3.2" -%%;; Hmm - why is stencil so tall? -#(define (page-stack-lines page) - (stack-stencils Y 1 0 - (map ly:paper-line-stencil (ly:page-paper-lines page)))) - -#(define (page-stack-lines page) - (let* ((urg-stencil (ly:stencil-align-to! (stack-stencils Y DOWN 0 - (map ly:paper-line-stencil (ly:page-paper-lines page))) - Y DOWN)) - (expr (ly:stencil-expr urg-stencil)) - (xext (ly:stencil-extent urg-stencil X)) - (yext (ly:stencil-extent urg-stencil Y))) - (ly:stencil-align-to! - ;; urgr - (ly:make-stencil expr xext (cons (* -0.25 (cdr yext)) 0)) - Y CENTER))) - -inBed = \paper { - %% can't do this, this paper('s fonts) must be notified to the - %% main/current book, and e output in the header. - %% #(paper-set-staff-size (* 11.0 pt)) - - raggedright = ##t - linewidth = 0\mm - indent = 0 \mm - - #(define page-to-stencil page-stack-lines) - %%#(define (page-to-stencil page) - %% (box-stencil (page-stack-lines page) 0.1 0.5)) - - \context { - \Staff - minimumVerticalExtent = ##f - } -} - -noCruft = \paper { - \context { - \Staff - %% Hmm, no effect ? - %% \override StaffSymbol #'print-function = ##f - %% Clef = \turnOff - %% StaffSymbol = \turnOff - %% TimeSignature = \turnOff - \override Clef #'print-function = ##f - \override StaffSymbol #'line-count = #0 - \override TimeSignature #'print-function = ##f - } -} - -noCruftInBed = \paper { - \inBed - - %%\noCruft - %%URGHSr - \context { - \Staff - %% Hmm, no effect ? - %% \override StaffSymbol #'print-function = ##f - %% Clef = \turnOff - %% StaffSymbol = \turnOff - %% TimeSignature = \turnOff - \override Clef #'print-function = ##f - \override StaffSymbol #'line-count = #0 - \override TimeSignature #'print-function = ##f - } -} - tuning = \markup { - \score { { \clef bass 1 } \paper{ \inBed }} + \score { + \new Staff \with { + \remove Time_signature_engraver + } { + \clef bass 1 + } + \paper { raggedright = ##t } + } } -#(define-public (my-footer paper page-number) - (let ((props (page-properties paper))) - (interpret-markup paper props - (markup #:fill-line ( #:line ( "Tuning: " tuning) ""))))) - -tempoChange = \markup { - %% wtf, no horizontal shift? - "" %%\kern #-10 - \translate #'(-15 . 0) - \score { \times 2/3 { c'8 c' c' } \paper { \noCruftInBed }} - " =" - \score { { c'8[ c'] } \paper { \noCruftInBed } } -} \header { title = "Solo Cello Suites" @@ -104,14 +23,13 @@ tempoChange = \markup { subsubtitle = \markup { \fill-line < { "Originalstimmung: " \tuning } > } } -\paper { - #(define make-footer my-footer) -} - \relative { \time 4/8 \times 2/3 { c'8 d e } \times 2/3 {c d e} \time 4/8 - g8^\tempoChange a8 g8 a \break + + % todo: tempo change example. + + g8 a8 g8 a \break } diff --git a/lily/lexer.ll b/lily/lexer.ll index 70d6a8ba57..377e9f1e9b 100644 --- a/lily/lexer.ll +++ b/lily/lexer.ll @@ -233,6 +233,11 @@ HYPHEN -- { start_main_input (); main_input_b_ = true; +/* +This is broken - we should switch to \notes when the pitchnames are loaded. +Then we get spanish etc. correct. --hwn. + +*/ SCM nn = lookup_identifier ("pitchnames"); push_note_state (alist_to_hashq (nn)); } diff --git a/scm/define-markup-commands.scm b/scm/define-markup-commands.scm index f5114886c8..15b0a71a54 100644 --- a/scm/define-markup-commands.scm +++ b/scm/define-markup-commands.scm @@ -15,6 +15,20 @@ "Stencil as markup" stil) + +(def-markup-command (score paper props score) (ly:score?) + (let* + ((systems (ly:score-embedded-format score paper)) + (1st (vector-ref systems 0)) + (stencil (ly:paper-line-stencil 1st)) ) + + (ly:stencil-align-to! stencil Y CENTER) + (display (ly:stencil-extent stencil X)) + (display (ly:stencil-extent stencil Y)) +; (set! stencil (ly:stencil-translate-axis stencil -20 X)) +; (set! stencil (ly:stencil-translate-axis stencil 20 Y)) + stencil)) + (def-markup-command (simple paper props str) (string?) "A simple text string; @code{\\markup @{ foo @}} is equivalent with @code{\\markup @{ \\simple #\"foo\" @}}." @@ -56,7 +70,7 @@ (line-stencils (if (= word-count 1) (map (lambda (x) (interpret-markup paper props x)) (list (make-simple-markup "") - (car markups) + (make-stencil-markup (car stencils)) (make-simple-markup ""))) stencils))) (stack-stencil-line fill-space line-stencils))) @@ -76,9 +90,11 @@ determines the space between each markup in @var{args}." (def-markup-command (combine paper props m1 m2) (markup? markup?) "Print two markups on top of each other." - (ly:stencil-add - (interpret-markup paper props m1) - (interpret-markup paper props m2))) + (let* + ((s1 (interpret-markup paper props m1)) + (s2 (interpret-markup paper props m2))) + + (ly:stencil-add s1 s2))) (def-markup-command (finger paper props arg) (markup?) "Set the argument as small numbers." diff --git a/scm/framework-tex.scm b/scm/framework-tex.scm index f19d0f2d83..22330b5f79 100644 --- a/scm/framework-tex.scm +++ b/scm/framework-tex.scm @@ -1,5 +1,3 @@ - - (define-module (scm framework-tex)) (use-modules (ice-9 regex) @@ -119,20 +117,6 @@ "}\\vss\n}\n\\vfill\\lilypondpagebreak\n"))) -(define (dump-line putter line last?) - (ly:outputter-dump-string - putter - (string-append "\\leavevmode\n\\lybox{0}{0}{0}{" - (ly:number->string (ly:paper-line-extent line Y)) - "}{")) - - (ly:outputter-dump-stencil putter (ly:paper-line-stencil line)) - (ly:outputter-dump-string - putter - (if last? - "}%\n" - "}\\interscoreline\n" - )) ) (define-public (output-framework-tex outputter book scopes fields basename) (let* @@ -160,6 +144,21 @@ (ly:outputter-dump-string outputter "\\lilypondend\n") )) +(define (dump-line putter line last?) + (ly:outputter-dump-string + putter + (string-append "\\leavevmode\n\\lybox{0}{0}{0}{" + (ly:number->string (ly:paper-line-extent line Y)) + "}{")) + + (ly:outputter-dump-stencil putter (ly:paper-line-stencil line)) + (ly:outputter-dump-string + putter + (if last? + "}%\n" + "}\\interscoreline\n" + )) ) + (define-public (output-classic-framework-tex outputter book scopes fields basename) (let* ((bookpaper (ly:paper-book-book-paper book)) diff --git a/scm/new-markup.scm b/scm/new-markup.scm index 7dcf129684..44067bae69 100644 --- a/scm/new-markup.scm +++ b/scm/new-markup.scm @@ -415,6 +415,7 @@ Also set markup-signature and markup-keyword object properties." (define-public (stack-stencil-line space stencils) + "DOCME" (if (and (pair? stencils) (ly:stencil? (car stencils))) diff --git a/scm/page-layout.scm b/scm/page-layout.scm index c8168c138d..f3cb9ff895 100644 --- a/scm/page-layout.scm +++ b/scm/page-layout.scm @@ -253,8 +253,8 @@ (make-column-markup (list (markup #:fill-line - (#:large #:bigger #:bigger #:bold (get 'subtitle)) - #:fill-line (#:bigger #:bigger #:bold (get 'subsubtitle))) + (#:large #:bigger #:bigger #:bold (get 'subtitle))) + (markup #:fill-line (#:bigger #:bigger #:bold (get 'subsubtitle))) (markup #:override '(baseline-skip . 5) #:column (""))) diff --git a/scm/stencil.scm b/scm/stencil.scm index 8f60fa0bec..b77a3c8344 100644 --- a/scm/stencil.scm +++ b/scm/stencil.scm @@ -5,7 +5,7 @@ ;;;; (c) 2003--2004 Han-Wen Nienhuys (define-public (stack-stencils axis dir padding stils) - "Stack stencils STILS in direction AXIS,DIR, using PADDING." + "Stack stencils STILS in direction AXIS, DIR, using PADDING." (if (null? stils) '() (if (pair? stils)