]> git.donarmstrong.com Git - lilypond.git/commitdiff
(dump-stencils-as-EPSes): cleanup.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 5 Sep 2005 13:52:40 +0000 (13:52 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 5 Sep 2005 13:52:40 +0000 (13:52 +0000)
(widen-left-stencil-edges): new function.

ChangeLog
lily/accidental.cc
lily/include/stencil.hh
scm/framework-eps.scm

index ba14d5869c2911ba99150f6cbb6b61aed902bada..b218673084b3fe7bb288919c23fc17d366694b02 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2005-09-05  Han-Wen Nienhuys  <hanwen@xs4all.nl>
 
+       * scm/framework-eps.scm (dump-stencils-as-EPSes): cleanup.
+       (widen-left-stencil-edges): new function.
+
        * lily/text-interface.cc (interpret_markup): use abort().
 
 2005-09-04  Han-Wen Nienhuys  <hanwen@xs4all.nl>
index 6df7e5116d0c308822f08c09b36a9aade550e76f..2ce795ef0ce2aabb79bd706ee1f70f55ceec9081 100644 (file)
 Stencil
 parenthesize (Grob *me, Stencil m)
 {
-  Stencil open = Font_interface::get_default_font (me)->find_by_name ("accidentals.leftparen");
-  Stencil close = Font_interface::get_default_font (me)->find_by_name ("accidentals.rightparen");
+  Font_metric * font
+    = Font_interface::get_default_font (me); 
+  Stencil open
+    = font->find_by_name ("accidentals.leftparen");
+  Stencil close
+    = font->find_by_name ("accidentals.rightparen");
 
   m.add_at_edge (X_AXIS, LEFT, Stencil (open), 0, 0);
   m.add_at_edge (X_AXIS, RIGHT, Stencil (close), 0, 0);
index 8e0d1bcf91d1a0c9278dd77bcbebdac6f25e71af..3349cbdd352c7876f61bd9b9ebd15b4b02c45759 100644 (file)
@@ -45,8 +45,6 @@
 */
 class Stencil
 {
-  friend SCM ly_stencil_set_extent_x (SCM, SCM, SCM);
-
   /*
     This provides the reference point of the symbol, for example with
     characters, it is on the base line of the character. Usually,
@@ -81,10 +79,6 @@ public:
   Box extent_box () const;
   bool is_empty () const;
   Stencil in_color (Real r, Real g, Real b) const;
-
-  static SCM ly_get_stencil_extent (SCM mol, SCM axis);
-  static SCM ly_set_stencil_extent_x (SCM, SCM, SCM);
-  static SCM ly_stencil_combined_at_edge (SCM, SCM, SCM, SCM, SCM);
 };
 
 DECLARE_UNSMOB (Stencil, stencil);
index efc269e83bc18ff492dd365f8f6dce3f275465a4..658f2cd47f51e561a2b5b32fa72c8cb7a710b850 100644 (file)
 
 (define framework-eps-module (current-module))
 
+
+(define (widen-left-stencil-edges stencils)
+  "Change STENCILS to use the union for the left extents in every
+stencil, so LaTeX includegraphics doesn't fuck up the alignment."
+
+  (define left
+    (apply min
+          (map (lambda (stc)
+                 (interval-start (ly:stencil-extent stc X)))
+               stencils)))
+
+  (map (lambda (stil)
+        
+        (ly:make-stencil
+         (ly:stencil-expr stil)
+         (cons
+          left
+          (cdr (ly:stencil-extent stil X)))
+         (ly:stencil-extent stil Y)
+         ))
+       stencils))
+
 (define (dump-stencils-as-EPSes stencils book basename)
   (define paper (ly:paper-book-paper book))
   (define (dump-infinite-stack-EPS stencils)
@@ -37,7 +59,9 @@
           (ly:output-def-lookup paper 'force-eps-font-include))
          
          (dump-stencils-as-separate-EPS rest (1+ count)))))
-  
+
+
+  ;; main body 
   (let* ((tex-system-name (format "~a-systems.tex" basename))
         (texi-system-name (format "~a-systems.texi" basename))
         (tex-system-port (open-output-file tex-system-name))
     
     (ly:message (_ "Writing ~a...") tex-system-name)
     (ly:message (_ "Writing ~a...") texi-system-name)
+
+    (set! stencils (widen-left-stencil-edges stencils))
+    
     (dump-stencils-as-separate-EPS stencils 1)
     (for-each (lambda (c)
                (if (< 0 c)
-                   (begin 
-                     (display "\\ifx\\betweenLilyPondSystem \\undefined\n" tex-system-port)
-                     (display "  \\linebreak\n" tex-system-port)
-                     (display "\\else\n" tex-system-port)
-                     (display (format 
-                               "  \\betweenLilyPondSystem{~a}\n" c) tex-system-port)
-                     (display "\\fi\n" tex-system-port)))
+                   (display (format "\\ifx\\betweenLilyPondSystem \\undefined
+  \\linebreak
+\\else
+  \\betweenLilyPondSystem{~a}
+\\fi
+" c) tex-system-port))
                (display (format "\\includegraphics{~a-~a.eps}\n"
                                 basename (1+ c)) tex-system-port)
                (display (format "@image{~a-~a}\n"
                                 basename (1+ c)) texi-system-port))
              (iota (length stencils)))
+    
     (display "@c eof - 'eof' is a Makefile marker; do not remove. " texi-system-port)
     (display "% eof - 'eof' is Makefile marker; do not remove. " tex-system-port)