CVSROOT: /cvsroot/lilypond
Module name: lilypond
Branch:
Changes by: Han-Wen Nienhuys <[EMAIL PROTECTED]> 05/06/01 13:16:27
Modified files:
. : ChangeLog
Documentation/user: lilypond-book.itely
input/tutorial : lbook-latex-test.tex
make : ly-rules.make ly-vars.make
python : fontextract.py
scripts : lilypond-book.py
Log message:
* scripts/lilypond-book.py (do_options): --psfonts doesn't take
argument anymore.
* make/ly-vars.make (DVIPS_FLAGS): use .psfonts as extension.
* input/tutorial/lbook-latex-test.tex: add line length test.
* scripts/lilypond-book.py (set_default_options): new
function. Call this before dissecting snippets, so linewidth
settings reach the snippets.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/ChangeLog.diff?tr1=1.3702&tr2=1.3703&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/Documentation/user/lilypond-book.itely.diff?tr1=1.114&tr2=1.115&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/input/tutorial/lbook-latex-test.tex.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/make/ly-rules.make.diff?tr1=1.44&tr2=1.45&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/make/ly-vars.make.diff?tr1=1.15&tr2=1.16&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/python/fontextract.py.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scripts/lilypond-book.py.diff?tr1=1.259&tr2=1.260&r1=text&r2=text
Patches:
Index: lilypond/ChangeLog
diff -u lilypond/ChangeLog:1.3702 lilypond/ChangeLog:1.3703
--- lilypond/ChangeLog:1.3702 Wed Jun 1 07:56:41 2005
+++ lilypond/ChangeLog Wed Jun 1 13:16:26 2005
@@ -1,3 +1,16 @@
+2005-06-01 Han-Wen Nienhuys <[EMAIL PROTECTED]>
+
+ * scripts/lilypond-book.py (do_options): --psfonts doesn't take
+ argument anymore.
+
+ * make/ly-vars.make (DVIPS_FLAGS): use .psfonts as extension.
+
+ * input/tutorial/lbook-latex-test.tex: add line length test.
+
+ * scripts/lilypond-book.py (set_default_options): new
+ function. Call this before dissecting snippets, so linewidth
+ settings reach the snippets.
+
2005-06-01 Jan Nieuwenhuizen <[EMAIL PROTECTED]>
* scm/lily.scm (PLATFORM, slashify): Remove double slashes.
Index: lilypond/Documentation/user/lilypond-book.itely
diff -u lilypond/Documentation/user/lilypond-book.itely:1.114
lilypond/Documentation/user/lilypond-book.itely:1.115
--- lilypond/Documentation/user/lilypond-book.itely:1.114 Mon May 30
21:20:14 2005
+++ lilypond/Documentation/user/lilypond-book.itely Wed Jun 1 13:16:26 2005
@@ -93,7 +93,7 @@
@example
cd input/tutorial
mkdir -p out/
-lilypond-book --output=out --psfonts=psfonts lilybook.tex
+lilypond-book --output=out --psfonts lilybook.tex
@emph{lilypond-book (GNU LilyPond) 2.6.0}
@emph{Reading lilybook.tex...}
@emph{..lots of stuff deleted..}
@@ -107,7 +107,7 @@
To convert the file into a PDF document, run the following commands
@example
-dvips -Ppdf -h psfonts lilybook
+dvips -Ppdf -h lilybook.psfonts lilybook
ps2pdf lilybook.ps
@end example
@@ -285,13 +285,13 @@
command line:
@example
--Ppdf -h psfonts
+-Ppdf -h @var{file}.psfonts
@end example
@noindent
-where the @command{psfonts} file is obtained from
+where the @[EMAIL PROTECTED] file is obtained from
@command{lilypond-book}, @xref{Invoking lilypond-book} for details. PDF
-can then be produced with a PostScript to PDF translator like
+can then be produced with a PostScript to PDF translator like
@code{ps2pdf} (which is part of GhostScript).
@cindex international characters
@@ -567,7 +567,7 @@
@code{yourfile.lytex}), you should do
@example
-lilypond-book --psfonts=tempfonts.ps yourfile.lytex
+lilypond-book --psfonts yourfile.lytex
latex yourfile.tex
dvips -h tempfonts.ps -Ppdf yourfile.dvi
ps2pdf yourfile.ps
@@ -639,9 +639,9 @@
@code{lilypond}. @code{lilypond-book} will not --filter and --process
at the same time.
[EMAIL PROTECTED] --psfonts=FILE
-extract all PostScript fonts into FILE for LaTeX. This is necessary
-for @command{dvips -h FILE}.
[EMAIL PROTECTED] --psfonts
+extract all PostScript fonts into @[EMAIL PROTECTED] for dvips.
+This is necessary for @command{dvips -h @var{file}.psfonts}.
@item -V
@itemx --verbose
Index: lilypond/input/tutorial/lbook-latex-test.tex
diff -u lilypond/input/tutorial/lbook-latex-test.tex:1.1
lilypond/input/tutorial/lbook-latex-test.tex:1.2
--- lilypond/input/tutorial/lbook-latex-test.tex:1.1 Sun Jan 30 22:06:06 2005
+++ lilypond/input/tutorial/lbook-latex-test.tex Wed Jun 1 13:16:26 2005
@@ -22,4 +22,27 @@
%\lilypondfile[quote,noindent]{screech-boink.ly}
+
+
+The line length of a \LaTeX{} document matches the length of music
+fragment: bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla
+bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla
+bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla
+bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla
+bla bla bla bla bla bla
+
+\begin{lilypond}
+{
+c''4 c'' c'' c'' c''4 c'' c'' c'' c''4 c'' c'' c'' c''4 c'' c'' c'' c''4 c''
c'' c''
+c''4 c'' c'' c'' c''4 c'' c'' c'' c''4 c'' c'' c'' c''4 c'' c'' c'' c''4 c''
c'' c''
+c''4 c'' c'' c'' c''4 c'' c'' c'' c''4 c'' c'' c'' c''4 c'' c'' c'' c''4 c''
c'' c''
+c''4 c'' c'' c'' c''4 c'' c'' c'' c''4 c'' c'' c'' c''4 c'' c'' c'' c''4 c''
c'' c''
+c''4 c'' c'' c'' c''4 c'' c'' c'' c''4 c'' c'' c'' c''4 c'' c'' c'' c''4 c''
c'' c''
+c''4 c'' c'' c'' c''4 c'' c'' c'' c''4 c'' c'' c'' c''4 c'' c'' c'' c''4 c''
c'' c''
+c''4 c'' c'' c'' c''4 c'' c'' c'' c''4 c'' c'' c'' c''4 c'' c'' c'' c''4 c''
c'' c''
+c''4 c'' c'' c'' c''4 c'' c'' c'' c''4 c'' c'' c'' c''4 c'' c'' c'' c''4 c''
c'' c''
+}
+\end{lilypond}
+
+
\end{document}
Index: lilypond/make/ly-rules.make
diff -u lilypond/make/ly-rules.make:1.44 lilypond/make/ly-rules.make:1.45
--- lilypond/make/ly-rules.make:1.44 Thu Apr 14 00:04:36 2005
+++ lilypond/make/ly-rules.make Wed Jun 1 13:16:26 2005
@@ -1,18 +1,19 @@
.SUFFIXES: .doc .dvi .tely .texi .ly
-$(outdir)/%.latex $(outdir)/%.fonts.ps: %.doc
+$(outdir)/%.latex $(outdir)/%.psfonts: %.doc
$(PYTHON) $(LILYPOND_BOOK) $(LILYPOND_BOOK_INCLUDES)
--process='$(LILYPOND) $(LILYPOND_BOOK_INCLUDES)' --output=$(outdir) --verbose
$(LILYPOND_BOOK_FLAGS) $<
# don't do ``cd $(outdir)'', and assume that $(outdir)/.. is the src dir.
# it is not, for --srcdir builds
$(outdir)/%.texi: %.tely
rm -f $$(grep -LF '% eof' $(outdir)/lily-*systems.tex 2>/dev/null)
- $(PYTHON) $(LILYPOND_BOOK) --psfonts=$(basename $<).fonts.ps
$(LILYPOND_BOOK_INCLUDES) --process='$(LILYPOND) $(LILYPOND_BOOK_INCLUDES)'
--output=$(outdir) --format=$(LILYPOND_BOOK_FORMAT) --verbose
$(LILYPOND_BOOK_FLAGS) $<
+ $(PYTHON) $(LILYPOND_BOOK) --psfonts $(LILYPOND_BOOK_INCLUDES)
--process='$(LILYPOND) $(LILYPOND_BOOK_INCLUDES)' --output=$(outdir)
--format=$(LILYPOND_BOOK_FORMAT) --verbose $(LILYPOND_BOOK_FLAGS) $<
+
$(outdir)/%.texi: $(outdir)/%.tely
rm -f $$(grep -LF '% eof' $(outdir)/lily-*systems.tex 2>/dev/null)
- $(PYTHON) $(LILYPOND_BOOK) --psfonts=$(notdir $(basename $<)).fonts.ps
$(LILYPOND_BOOK_INCLUDES) --process='$(LILYPOND) $(LILYPOND_BOOK_INCLUDES)'
--output=$(outdir) --format=$(LILYPOND_BOOK_FORMAT) --verbose
$(LILYPOND_BOOK_FLAGS) $<
+ $(PYTHON) $(LILYPOND_BOOK) --psfonts $(LILYPOND_BOOK_INCLUDES)
--process='$(LILYPOND) $(LILYPOND_BOOK_INCLUDES)' --output=$(outdir)
--format=$(LILYPOND_BOOK_FORMAT) --verbose $(LILYPOND_BOOK_FLAGS) $<
#
# DON'T REMOVE SOURCE FILES, otherwise the .TEXI ALWAYS OUT OF DATE.
# rm -f $<
Index: lilypond/make/ly-vars.make
diff -u lilypond/make/ly-vars.make:1.15 lilypond/make/ly-vars.make:1.16
--- lilypond/make/ly-vars.make:1.15 Wed Apr 13 15:29:00 2005
+++ lilypond/make/ly-vars.make Wed Jun 1 13:16:26 2005
@@ -17,4 +17,4 @@
EXTRA_DIST_FILES +=$(TELY_FILES) $(LY_FILES) $(ITEXI_FILES) $(ITELY_FILES)
$(ILY_FILES)
-DVIPS_FLAGS= -h $(subst pdf,fonts.ps,$(subst .ps,.fonts.ps, $(notdir $@ )))
+DVIPS_FLAGS= -h $(subst .pdf,.psfonts,$(subst .ps,.psfonts, $(notdir $@ )))
Index: lilypond/python/fontextract.py
diff -u lilypond/python/fontextract.py:1.5 lilypond/python/fontextract.py:1.6
--- lilypond/python/fontextract.py:1.5 Wed Apr 20 12:45:17 2005
+++ lilypond/python/fontextract.py Wed Jun 1 13:16:26 2005
@@ -81,7 +81,6 @@
% (string.join (extract_from_this, ',
'), filename))
def write_extracted_fonts (output_file_name, font_dict):
-
if verbose:
sys.stderr.write( _('Writing fonts to %s') % output_file_name +
'\n')
output = open (output_file_name, 'w')
Index: lilypond/scripts/lilypond-book.py
diff -u lilypond/scripts/lilypond-book.py:1.259
lilypond/scripts/lilypond-book.py:1.260
--- lilypond/scripts/lilypond-book.py:1.259 Fri May 27 11:03:20 2005
+++ lilypond/scripts/lilypond-book.py Wed Jun 1 13:16:26 2005
@@ -13,6 +13,9 @@
lilypond-book --process="lilypond" BOOK.tely
TODO:
+
+ * this script is too complex. Modularize.
+
* ly-options: intertext?
* --linewidth?
* eps in latex / eps by lilypond -b ps?
@@ -93,9 +96,9 @@
_ ("write output to DIR")),
(_ ("COMMAND"), 'P', 'process',
_ ("process ly_files using COMMAND FILE...")),
- (_('FILE'), '', 'psfonts',
- _ ('''extract all PostScript fonts into FILE for LaTeX
- must use this with dvips -h FILE''')),
+ (_(''), '', 'psfonts',
+ _ ('''extract all PostScript fonts into INPUT.psfonts for LaTeX
+ must use this with dvips -h INPUT.psfonts''')),
('', 'V', 'verbose',
_ ("be verbose")),
('', 'v', 'version',
@@ -111,7 +114,7 @@
if '@bindir@' == ('@' + 'bindir@') or not os.path.exists (lilypond_binary):
lilypond_binary = 'lilypond'
-psfonts_file = ''
+psfonts_p = 0
use_hash_p = 1
format = 0
output_name = ''
@@ -650,6 +653,27 @@
def invokes_lilypond ():
return re.search ('^[\'\"0-9A-Za-z/]*lilypond', process_cmd)
+def set_default_options (source):
+ global default_ly_options
+ if not default_ly_options.has_key (LINEWIDTH):
+ if format == LATEX:
+ textwidth = get_latex_textwidth (source)
+ default_ly_options[LINEWIDTH] = \
+ '''%.0f\\pt''' % textwidth
+ elif format == TEXINFO:
+ for (k, v) in texinfo_linewidths.items ():
+ # FIXME: @layout is usually not in
+ # chunk #0:
+ #
+ # \input texinfo @c -*-texinfo-*-
+ #
+ # Bluntly search first K items of
+ # source.
+ # s = chunks[0].replacement_text ()
+ if re.search (k, source[:1024]):
+ default_ly_options[LINEWIDTH] = v
+ break
+
class Chunk:
def replacement_text (self):
return ''
@@ -1417,6 +1441,9 @@
source = in_handle.read ()
ly.progress ('\n')
+ set_default_options (source)
+
+
# FIXME: Containing blocks must be first, see
# find_toplevel_snippets.
snippet_types = (
@@ -1433,27 +1460,6 @@
chunks = find_toplevel_snippets (source, snippet_types)
ly.progress ('\n')
- global default_ly_options
- textwidth = 0
- if not default_ly_options.has_key (LINEWIDTH):
- if format == LATEX:
- textwidth = get_latex_textwidth (source)
- default_ly_options[LINEWIDTH] = \
- '''%.0f\\pt''' % textwidth
- elif format == TEXINFO:
- for (k, v) in texinfo_linewidths.items ():
- # FIXME: @layout is usually not in
- # chunk #0:
- #
- # \input texinfo @c -*-texinfo-*-
- #
- # Bluntly search first K items of
- # source.
- # s = chunks[0].replacement_text ()
- if re.search (k, source[:1024]):
- default_ly_options[LINEWIDTH] =
v
- break
-
if filter_cmd:
write_if_updated (output_filename,
[c.filter_text () for c in chunks])
@@ -1487,7 +1493,7 @@
raise Compile_error
def do_options ():
- global format, output_name, psfonts_file
+ global format, output_name, psfonts_p
global filter_cmd, process_cmd, verbose_p
(sh, long) = ly.getopt_args (option_definitions)
@@ -1532,7 +1538,7 @@
elif o == '--verbose' or o == '-V':
verbose_p = 1
elif o == '--psfonts':
- psfonts_file = a
+ psfonts_p = 1
elif o == '--warranty' or o == '-w':
if 1 or status:
ly.warranty ()
@@ -1546,6 +1552,9 @@
ly.exit (2)
file = files[0]
+
+ basename = os.path.splitext (file)[0]
+
global process_cmd, format
if not format:
format = guess_format (files[0])
@@ -1566,11 +1575,13 @@
try:
chunks = do_file (file)
- if psfonts_file and invokes_lilypond ():
+ if psfonts_p and invokes_lilypond ():
fontextract.verbose = verbose_p
snippet_chunks = filter (lambda x: is_derived_class
(x.__class__,
Lilypond_snippet),
chunks)
+
+ psfonts_file = basename + '.psfonts'
if not verbose_p:
ly.progress (_ ("Writing fonts to %s...") %
psfonts_file)
fontextract.extract_fonts (psfonts_file,
@@ -1583,20 +1594,17 @@
ly.exit (1)
if format == TEXINFO or format == LATEX:
- psfonts = 'PSFONTS-FILE'
- if not psfonts_file:
- ly.warning (_ ("option --psfonts=FILE not used"))
+ if not psfonts_p:
+ ly.warning (_ ("option --psfonts not used"))
ly.warning (_ ("processing with dvips will have no
fonts"))
- else:
- psfonts = os.path.join (output_name, psfonts_file)
-
- output = os.path.join (output_name,
- os.path.splitext (os.path.basename
- (file))[0]) + '.dvi'
+
+ psfonts_file = os.path.join (output_name, basename + '.psfonts')
+ output = os.path.join (output_name, basename + '.dvi' )
+
ly.progress ('\n')
ly.progress (_ ("DVIPS usage:"))
ly.progress ('\n')
- ly.progress (" dvips -h %(psfonts)s %(output)s" % vars ())
+ ly.progress (" dvips -h %(psfonts_file)s %(output)s" % vars
())
ly.progress ('\n')
if __name__ == '__main__':
_______________________________________________
Lilypond-cvs mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-cvs