2004-04-11 Jan Nieuwenhuizen <janneke@gnu.org>
+ * scm/output-ps.scm (header): Papersize from paper.
+
+ * scripts/lilypond.py (global_latex_preamble): Oldish behaviour
+ for classic output.
+
+ * tex/lilyponddefs.tex (interscoreline): Oldish behaviour if
+ lilypondclassic is defined.
+ (lilypondstart): Oldish behaviour if lilypondclassic is defined.
+
+ * input/regression/between-systems.ly: Remove.
+
+ * python/lilylib.py (get_bbox): Fix regular expression
+ for bounding box.
+
* tex/lilyponddefs.tex (lilypondpagebreak): New overridable macro.
* scm/output-tex.scm (stop-page): Use it.
+++ /dev/null
-
-\version "2.2.0"
-
-\header{
-texidoc="
-By inserting @TeX{} commands between systems, you can force pagebreaks.
-
-In reality, you'd use the LateX command @code{\\newpage} instead of (pagebreak)
-of course.
-"
-}
-
-
-#(define (set-page-break grob grob-c context)
- (let*
- ((meta (ly:grob-property grob 'meta))
- (name (cdr (assoc 'name meta))))
-
- (if (equal? 'NonMusicalPaperColumn name)
- (ly:grob-set-property! grob 'between-system-string "(pagebreak)\n\n"))
-))
-
-\score {
- \notes \relative c' {
- c1
- \context Score \applyoutput #set-page-break
- \break
-
- c1
- }
-}
-
void output_music_output_def (Music_output_def* odef);
void output_scheme (SCM scm);
void output_expr (SCM expr, Offset o);
- void output_header (Paper_def*, SCM, int);
+ void output_header (Paper_def*, SCM, int, bool);
void output_line (SCM, Offset*, bool);
};
Paper_def *paper = papers_[0];
Paper_outputter *out = paper->get_paper_outputter (outname);
- out->output_header (paper, scopes (0), pages->size ());
+ out->output_header (paper, scopes (0), pages->size (), false);
int page_count = pages->size ();
for (int i = 0; i < page_count; i++)
{
int count = scores_.size ();
Paper_outputter *out = papers_.top ()->get_paper_outputter (outname);
- out->output_header (papers_.top (), scopes (count - 1), 0);
+ out->output_header (papers_.top (), scopes (count - 1), 0, true);
Paper_line *first = unsmob_paper_line (scm_vector_ref (scores_.top (),
scm_int2num (0)));
SCM all = lines ();
SCM proc = paper->get_scmvar ("page-breaking");
SCM breaks = scm_apply_0 (proc, scm_list_n (all, scm_make_real (height_),
- scm_make_real (text_height),
- scm_make_real (-copy_height),
- scm_make_real (-tag_height),
- SCM_UNDEFINED));
+ scm_make_real (text_height),
+ scm_make_real (-copy_height),
+ scm_make_real (-tag_height),
+ SCM_UNDEFINED));
/* Copyright on first page. */
if (unsmob_stencil (copyright_))
}
void
-Paper_outputter::output_header (Paper_def *paper, SCM scopes, int page_count)
+Paper_outputter::output_header (Paper_def *paper, SCM scopes, int page_count,
+ bool is_classic)
{
String creator = gnu_lilypond_version_string ();
creator += " (http://lilypond.org)";
String time_stamp = ctime (&t);
time_stamp = time_stamp.left_string (time_stamp.length () - 1)
+ " " + *tzname;
- output_scheme (scm_list_4 (ly_symbol2scm ("header"),
+ output_scheme (scm_list_n (ly_symbol2scm ("header"),
scm_makfrom0str (creator.to_str0 ()),
scm_makfrom0str (time_stamp.to_str0 ()),
- scm_int2num (page_count)));
+ paper->self_scm (),
+ scm_int2num (page_count),
+ ly_bool2scm (is_classic),
+ SCM_UNDEFINED));
output_metadata (paper, scopes);
output_music_output_def (paper);
"Project-Id-Version: lilypond 2.2.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2004-03-31 16:22+0200\n"
-"PO-Revision-Date: 2004-04-10 23:36+0200\n"
+"PO-Revision-Date: 2004-04-11 11:01+0200\n"
"Last-Translator: Jan Nieuwenhuizen <janneke@gnu.org>\n"
"Language-Team: Dutch <vertaling@nl.linux.org>\n"
"MIME-Version: 1.0\n"
#: time-signature.cc:95
#, c-format
msgid "time signature symbol `%s' not found; reverting to numbered style"
-msgstr "maatsoortsymbool `%s' niet gevondend; val terug op numerieke stijl"
+msgstr "maatsoortsymbool `%s' niet gevonden; val terug op numerieke stijl"
#.
#. Todo: should make typecheck?
for (k,v) in os.environ.items ():
sys.stderr.write ("%s=\"%s\"\n" % (k, v))
+BOUNDING_BOX_RE = '^%%BoundingBox: (-?[0-9]+) (-?[0-9]+) (-?[0-9]+) (-?[0-9]+)'
def get_bbox (filename):
bbox = filename + '.bbox'
## -sOutputFile does not work with bbox?
(filename, bbox)
system (cmd, progress_p = 1)
box = open (bbox).read ()
- m = re.match ('^%%BoundingBox: ([0-9]+) ([0-9]+) ([0-9]+) ([0-9]+)',
- box)
+ m = re.match (BOUNDING_BOX_RE, box)
gr = []
if m:
gr = map (string.atoi, m.groups ())
(string-append (ly:numbers->string (list breapth width depth height))
" draw_box"))
-(define (header creator time-stamp page-count-)
+(define (header creator time-stamp paper page-count- classic?)
(set! page-count page-count-)
(set! page-number 0)
(string-append
"%%Creator: " creator " " time-stamp "\n"
"%%Pages: " (number->string page-count) "\n"
"%%PageOrder: Ascend\n"
- ;; FIXME: TODO get from paper
- ;; "%%DocumentPaperSizes: a6\n"
+ "%%DocumentPaperSizes: " (ly:paper-lookup paper 'papersize) "\n"
;;(string-append "GNU LilyPond (" (lilypond-version) "), ")
;; (strftime "%c" (localtime (current-time))))
;; FIXME: duplicated in every backend
"\\lilypondspecial\n"
"\\lilypondpostscript\n"))
-(define (header creator time-stamp page-count)
+(define (header creator time-stamp paper page-count classic?)
(string-append
"% Generated by " creator "\n"
"% at " time-stamp "\n"
+ (if classic?
+ (tex-string-def "lilypond" 'classic "1")
+ "")
;; FIXME: duplicated in every backend
"\\def\\lilypondtagline{Engraved by LilyPond (version "
(lilypond-version)")}\n"))
# lilylib globals
program_name = 'lilypond'
program_version = '@TOPLEVEL_VERSION@'
+# input without \book, use classic latex definitions
+classic_p = 0
verbose_p = 0
pseudo_filter_p = 0
original_dir = os.getcwd ()
'latexheaders' : [],
'latexoptions' : [],
'latexpackages' : [],
+ 'linewidth' : [],
'orientation' : [],
'papersize' : [],
'unit' : ['pt'],
# search only the first 10k
s = s[:10240]
for x in header_fields:
- m = re.search (r'\\def\\lilypondpaper%s{([^}]*)}'%x, s)
+ m = re.search (r'\\def\\lilypondpaper%s{([^}]*)}' % x, s)
if m:
set_setting (extra, x, m.group (1))
+
+ global classic_p
+ if s.find ('\\def\\lilypondclassic{1}') >= 0:
+ classic_p = 1
+
ly.progress ('\n')
def find_tex_files_for_base (base, extra):
s += r'''\let\lilypond%s\relax''' % k
s += '\n'
+ if classic_p and not first:
+ s += '\interscoreline'
+
s += '%%PREVIEW%%\n'
s += '\\input %s\n' % defn[0]
return s
+
+## FIXME: copied from tex/lilyponddefs.tex
+LATEX_PREAMBLE = '''
+%% Nullify [La]TeX page layout settings, page layout by LilyPond.
+\\topmargin-1in
+\\headheight0pt\\headsep0pt
+\\oddsidemargin-1in
+\\evensidemargin\oddsidemargin
+\\parindent 0pt'''
+
+CLASSIC_LATEX_PREAMBLE = '''
+%% FIXME: cannot do this, dimens in header part of lilypond output
+%% Center staves horizontally on page
+\\ifdim\\lypylinewidth\\lypyunit > 0pt
+\\hsize\\lypylinewidth\\lypyunit
+\\newdimen\\lypytempdim
+\\lypytempdim\\paperwidth
+\\advance\\lypytempdim-\\the\\hsize
+\\lypytempdim0.5\\lypytempdim
+\\advance\\lypytempdim -1in
+\\oddsidemargin\\lypytempdim
+\\evensidemargin\\lypytempdim
+\\fi
+\\parindent 0pt'''
+
def global_latex_preamble (extra):
'''construct preamble from EXTRA,'''
if safe_mode_p:
s += '\\nofiles\n'
+ if classic_p:
+ if extra['linewidth']:
+ s += '\\def\\lypylinewidth{%s}\n' \
+ % extra['linewidth'][-1]
+ else:
+ s += '\\let\\lypylinewidth\\texwidth\n'
+ s += '\\def\\lypyunit{%s}\n' % extra['unit'][-1]
+
if extra['language']:
- s += r'\usepackage[%s]{babel}' \
- % extra['language'][-1] + '\n'
+ s += '\\usepackage[%s]{babel}' % extra['language'][-1] + '\n'
s += '\\usepackage{%s}\n' \
% string.join (extra['latexpackages'], ',')
s += r'''
\usepackage[latin1]{inputenc}
\pagestyle{empty}
-%%PREVIEW%%
-%% Nullify [La]TeX page layout settings, page layout by LilyPond.
-\pagestyle{empty}
-\topmargin-1in
-\headheight0pt\headsep0pt
-\oddsidemargin-1in
-\evensidemargin\oddsidemargin
-\parindent 0pt
-'''
+%%PREVIEW%%'''
+
+ if classic_p:
+ s += CLASSIC_LATEX_PREAMBLE
+ else:
+ s += LATEX_PREAMBLE
return s
%% <font setup and note output>
%% \lilypondend
+\newdimen\lytempdim
\newdimen\outputscale
%% Handy macros from the LaTeX manual.
\documentclass[a4paper]{article}
%% safe-mode
\nofiles
- %% Nullify [La]TeX page layout settings, page layout by LilyPond.
\pagestyle{empty}
- \topmargin-1in
- \headheight0pt\headsep0pt
- \oddsidemargin-1in
- \evensidemargin\oddsidemargin
+ \lilypondifundefined{lilypondclassic}
+ {
+ %% Nullify [La]TeX page layout settings, page layout by LilyPond.
+ \topmargin-1in
+ \headheight0pt\headsep0pt
+ \oddsidemargin-1in
+ \evensidemargin\oddsidemargin
+ }
+ {
+ %% Center staves horizontally on page
+ \ifdim\lilypondpaperlinewidth\lilypondpaperunit > 0pt
+ \hsize\lilypondpaperlinewidth\lilypondpaperunit
+ \lytempdim \paperwidth
+ \advance\lytempdim -\the\hsize
+ \lytempdim 0.5\lytempdim
+ \advance\lytempdim -1in
+ \oddsidemargin \lytempdim
+ \evensidemargin \lytempdim
+ \fi
+ }
\parindent 0pt
%% TEXINFO workaround: \begin is defined as \outer, use \csname.
\csname begin\endcsname{document}}}
\gdef\lyitem#1#2#3{
\topalign{\raise#2\outputscale\leftalign{\kern#1\outputscale#3}}}
-\newdimen\lytempdim
\gdef\lybox#1#2#3#4#5{
\lytempdim\baselineskip
\advance\lytempdim-#4\outputscale
%% Allow overriding of interscoreline, e.g. for lilypond.py's --preview
\lilypondifundefined{interscoreline}
-{\gdef\interscoreline{}}{}
+{
+ \lilypondifundefined{lilypondclassic}
+ {\gdef\interscoreline{}}
+ {\gdef\interscoreline{
+ \vskip\lilypondpaperinterscoreline\lilypondpaperunit
+ plus \lilypondpaperinterscorelinefill fill}}
+}
+{}
%% Include postscript definitions unless using PDFTeX,
%% in that case use pdf definitions.