]> git.donarmstrong.com Git - lilypond.git/commitdiff
* scm/output-ps.scm (make-title, output-scopes): Further
authorJan Nieuwenhuizen <janneke@gnu.org>
Tue, 2 Mar 2004 10:42:40 +0000 (10:42 +0000)
committerJan Nieuwenhuizen <janneke@gnu.org>
Tue, 2 Mar 2004 10:42:40 +0000 (10:42 +0000)
development.

* input/test/title-markup.ly: New file.

* ps/lilyponddefs.ps: Disable PostScript titling.

* lily/paper-score.cc (process): Qoute PORT argument to make-title.

ChangeLog
input/test/title-markup.ly [new file with mode: 0644]
lily/paper-score.cc
ps/lilyponddefs.ps
scm/output-ps.scm
scm/output-tex.scm

index e76d28de15ba88aa36cec1474f19aac930a83f40..32368fc3000ba936ad463aa62b45e97e935a88bb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2004-03-02  Jan Nieuwenhuizen  <janneke@gnu.org>
+
+       * scm/output-ps.scm (make-title, output-scopes): Further
+       development.
+
+       * input/test/title-markup.ly: New file.
+
+       * ps/lilyponddefs.ps: Disable PostScript titling.
+
+       * lily/paper-score.cc (process): Qoute PORT argument to make-title.
+
 2004-03-01  Han-Wen Nienhuys   <hanwen@xs4all.nl>
 
        * lily/arpeggio.cc (width_callback): remove padding.
diff --git a/input/test/title-markup.ly b/input/test/title-markup.ly
new file mode 100644 (file)
index 0000000..65ae2da
--- /dev/null
@@ -0,0 +1,60 @@
+\version "2.1.28"
+%{
+   \markup in titles is WIP, only available in direct PostScript output
+   process and view this file doing:
+
+     lilypond-bin -fps title-markup.ly
+     export GS_LIB=$(pwd)/mf/out:/usr/share/texmf/fonts/type1/bluesky/cm
+     gs title-markup.ps
+
+
+FIXME: use conditionals in  \makeTitle:
+
+#(define (my-ly-version)
+    (list-head (ly:version) 3))
+
+#(if (not (defined? 'pieceTagLine))
+    (define pieceTagLine (string-append "Jeremie " (numbers->string (my-ly-version)) " was here")))
+
+\header{
+tagline = \pieceTagLine
+texidoc = "
+
+%}
+
+\header {
+    texidoc = "Make titles using markup (WIP)."
+
+
+    % FIXME
+    fonts = #'((font-family . roman)
+                 (word-space . 1)
+                 (baseline-skip . 2)
+                 (font-series . medium)
+                 (font-style . roman)
+                 (font-shape . upright)
+                 (font-size . 0))
+    
+    title = "Title String"
+    subtitle = "and the subtitle"
+    poet = "poetstring"
+    composer = "compozeur"
+    instrument = "instrum"
+    piece = "stukkie"
+    
+    makeTitle = \markup {
+       \column <
+           { \large \bold \title } " " { \large \bold \subtitle }
+           { " " }
+            % FIXME: 60: linewidth / flushleft/flushright (hfill?))
+           { { \smaller \upright \instrument } \hspace #60 \upright \composer }
+           { { \smaller \caps \piece } \hspace #60 \upright \poet }
+        >
+    }
+}
+
+\score {
+    \context Staff \notes \relative c' {
+       c-\markup { \center < \roman \caps "foe" > }
+    }
+}
index 8e24ecd5ecaade3599ddba26ac749edb53c185fe..4c2e2b68e8caedeb3e58b4f82bf55da0dee79bda 100644 (file)
@@ -115,19 +115,8 @@ Paper_score::process (String outname)
     ->output_scheme (scm_list_2 (ly_symbol2scm ("define-fonts"),
                                 ly_quote_scm (paper_->font_descriptions ())));
 
-#if 0
-  // huh? does not work, stack overflow
   outputter_->output_scheme (scm_list_2 (ly_symbol2scm ("make-title"),
-                                        outputter_->file_));
-#else
-#if 0
-  // uhuh?? does not work, stack overflow
-  outputter_->output_scheme (scm_list_2 (ly_symbol2scm ("set-port"),
-                                        outputter_->file_));
-#endif
-  outputter_->output_scheme (scm_list_1 (ly_symbol2scm ("make-title")));
-#endif
-
+                                        ly_quote_scm (outputter_->file_)));
   system_->output_lines ();
   outputter_->output_scheme (scm_list_1 (ly_symbol2scm ("end-output")));
 
index 6c903a5290874cc1f29b16e3e8ccfe5637ae0710..c11a7390f5959b0da73f87ce353e30457e5411b5 100644 (file)
@@ -6,7 +6,7 @@
 % /setgray { 1 add } bind def
 
 % To let gs load fonts from builddir, do:
-% export GS_LIB=$(pwd)/mf/out:
+% export GS_LIB=$(pwd)/mf/out:/usr/share/texmf/fonts/type1/bluesky/cm
 
 /staff-line-thickness lilypondpaperlinethickness def
 /staff-height lilypondpaperstaffheight def
@@ -220,7 +220,8 @@ staff-height init-paper
 /line-x left-margin output-scale div def
 /line-y vsize top-margin sub def
 
-make-lilypond-title
+% FIXME: testing \markup titles
+% make-lilypond-title
 
 % see if we're there...
 % 10 setlinewidth 0 0 moveto 400 800 lineto stroke
index 84cbe3fe86b43fe79f9ce0ad0b3277c8f8ce0998..9a578246a63e682949e622ee769faa9baf62b7a9 100644 (file)
@@ -5,6 +5,11 @@
 ;;;; (c)  1998--2004 Jan Nieuwenhuizen <janneke@gnu.org>
 ;;;; Han-Wen Nienhuys <hanwen@cs.uu.nl>
 
+;; TODO:
+;;   * testbed for titles with markup
+;;   * font size and designsize
+;;   * FIXME: breaks when outputting strings with parentheses.
+
 
 (debug-enable 'backtrace)
 
  (lily))
 
 
-
-;;; Lily output interface --- cleanup and docme
-
-;; TODO: fucks up if outputting strings with parentheses.
+;;; Lily output interface, PostScript implementation --- cleanup and docme
 
 ;; Module entry
 (define-public (ps-output-expression expr port)
   (display (expression->string expr) port))
 
+
 (define (expression->string expr)
   (eval expr this-module))
 
@@ -34,6 +37,8 @@
 ;; alist containing fontname -> fontcommand assoc (both strings)
 (define font-name-alist '())
 
+;; WIP -- stencils from markup? values of output-scopes
+(define header-stencil #f)
 
 ;; Interface functions
 (define (beam width slope thick blot)
                  (font-series . medium)
                  (font-style . roman)
                  (font-shape . upright)
-                 (font-size . 0)))))
-  
+                 (font-size . 0))))
+       (stencils '())
+       (baseline-skip 2))
+
+    (define (output-scope-entry sym var)
+      (let ((val (variable-ref var))
+           (tex-key (symbol->string sym)))
+       
+       (if (memq sym fields)
+           (header-to-file basename sym val))
+       
+       (cond
+        ((eq? sym 'font)
+         BARF
+         (format (current-error-port) "PROPS:~S\n" val)
+         (set! props (cons val props))
+         "")
+        
+        ;; define strings, for /make-lilypond-title to pick up
+        ((string? val) (ps-string-def "lilypond" sym val))
+        
+        ;; generate stencil from markup
+        ((markup? val) (set! stencils
+                             (append
+                              stencils
+                              (list
+                               (interpret-markup paper props val))))
+         "")
+        ((number? val) (ps-number-def
+                        "lilypond" sym (if (integer? val)
+                                           (number->string val)
+                                           (number->string
+                                            (exact->inexact val)))))
+        (else ""))))
+    
     (define (output-scope scope)
-      (apply
-       string-append
-       (module-map
-       (lambda (sym var)
-         (let ((val (variable-ref var))
-               (tex-key (symbol->string sym)))
-           
-           (if (memq sym fields)
-               (header-to-file basename sym val))
-           
-           (cond
-            ((eq? sym 'font)
-             BARF
-             (format (current-error-port) "PROPS:~S\n" val)
-             (set! props (cons val props))
-             "")
-            
-            ;; define strings, for /make-lilypond-title to pick up
-            ((string? val) (ps-string-def "lilypond" sym val))
-
-            ;; generate stencil from markup
-            ((markup? val) (set! header-stencils
-                                 (append header-stencils
-                                    (list
-                                     (ly:stencil-get-expr
-                                      (interpret-markup paper props val)))))
-             
-             "")
-            ((number? val) (ps-number-def
-                            "lilypond" sym (if (integer? val)
-                                               (number->string val)
-                                               (number->string
-                                                (exact->inexact val)))))
-            (else ""))))
-       scope)))
+      (apply string-append (module-map output-scope-entry scope)))
 
-    (string-append
-     (apply string-append (map output-scope scopes)))))
+    (let ((s (string-append (apply string-append (map output-scope scopes)))))
+      (set! header-stencil (stack-lines DOWN 0 baseline-skip stencils))
+      
+      ;; trigger font load
+      (ly:stencil-get-expr header-stencil)
+      s)))
 
 (define (offset-add a b)
   (cons (+ (car a) (car b))
        (+ (cdr a) (cdr b))))
 
-(define header-stencils '())
-
-(define output-port (current-error-port))
-
-;; just calling this from paper-score gives Stack overflow.
-(define (set-port p)
-  (set! output-port p)
-  "")
-
-(define (make-title)
-  (if (pair? header-stencils)
-      (map (lambda (x) (output-stencil output-port x '(10 . -10)))
-          header-stencils))
+(define (make-title port)
+  (if header-stencil
+      (let ((x-ext (ly:stencil-get-extent header-stencil Y))
+           (y-ext (ly:stencil-get-extent header-stencil X)))
+       (display (start-system (interval-length x-ext) (interval-length y-ext))
+                port)
+       (output-stencil port (ly:stencil-get-expr header-stencil) '(0 . 0))
+       (display (stop-system) port)))
   "")
 
 ;; hmm, looks like recursing call is always last statement, does guile
index 6661e4e61b389682071ffa9c57784a1995cb4d62..4698e8ee4108abce3490acea5594ca6dd9b5f392 100644 (file)
 (define-public (tex-output-expression expr port)
   (display (eval expr this-module) port ))
 
-(define (make-title) "")
+(define (make-title port) "")