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);
*/
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,
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);
(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)
(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)