From: hanwen Date: Mon, 5 Sep 2005 13:52:40 +0000 (+0000) Subject: (dump-stencils-as-EPSes): cleanup. X-Git-Tag: release/2.7.16^2~183 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=c443150ee9e9fa372f2e447f03dbafc9447bdce1;p=lilypond.git (dump-stencils-as-EPSes): cleanup. (widen-left-stencil-edges): new function. --- diff --git a/ChangeLog b/ChangeLog index ba14d5869c..b218673084 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2005-09-05 Han-Wen Nienhuys + * 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 diff --git a/lily/accidental.cc b/lily/accidental.cc index 6df7e5116d..2ce795ef0c 100644 --- a/lily/accidental.cc +++ b/lily/accidental.cc @@ -23,8 +23,12 @@ 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); diff --git a/lily/include/stencil.hh b/lily/include/stencil.hh index 8e0d1bcf91..3349cbdd35 100644 --- a/lily/include/stencil.hh +++ b/lily/include/stencil.hh @@ -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); diff --git a/scm/framework-eps.scm b/scm/framework-eps.scm index efc269e83b..658f2cd47f 100644 --- a/scm/framework-eps.scm +++ b/scm/framework-eps.scm @@ -20,6 +20,28 @@ (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)) @@ -45,21 +69,24 @@ (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)