From 81309fa6b68c361e2d163b8571bd9ae9934c4555 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Tue, 9 May 2006 07:55:57 +0000 Subject: [PATCH] * stepmake/aclocal.m4: use python-config for x-compile flags. Backport. * scripts/lilypond-book.py (do_process_cmd): backport: create .png for html files. Backport. * scm/framework-ps.scm (write-preamble): use mac-font? even if gs-font-load is set. Backport. * mf/feta-bolletjes.mf: fix attachment of triangle head. backport. * mf/GNUmakefile ($(NCSB_OTFS)): backport: gen and install OTF files, new NCSB dir handling. backport. * lily/music-sequence.cc (maximum_length): backport robustness fix. * input/tutorial/GNUmakefile (EXTRA_DIST_FILES): dist html file too. * configure.in (LINK_GXX_STATICALLY): new --with-ncsb-dir. (backport) * config.make.in: NCSB_SOURCE_FILES * flower/include/std-vector.hh: (default_compare): backport: use only 1 compare optor. --- ChangeLog | 26 ++++++++++++++++ config.make.in | 3 +- configure.in | 54 +++++++++++++++++++++------------- flower/include/std-vector.hh | 2 +- input/tutorial/GNUmakefile | 2 +- lily/music-sequence.cc | 9 ++++-- mf/GNUmakefile | 11 ++++--- mf/feta-autometric.mf | 3 +- mf/feta-bolletjes.mf | 17 +++++++---- scm/define-grob-properties.scm | 1 - scm/framework-ps.scm | 42 ++++++++++++++------------ scm/lily-library.scm | 16 ++++++++++ scm/lily.scm | 6 ++++ scm/output-texstr.scm | 2 -- scripts/lilypond-book.py | 12 +++++--- stepmake/aclocal.m4 | 7 +++++ 16 files changed, 149 insertions(+), 64 deletions(-) diff --git a/ChangeLog b/ChangeLog index 51ba5bca3c..421d57eb7b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,29 @@ +2006-05-09 Han-Wen Nienhuys + + * stepmake/aclocal.m4: use python-config for x-compile flags. Backport. + + * scripts/lilypond-book.py (do_process_cmd): backport: create .png + for html files. Backport. + + * scm/framework-ps.scm (write-preamble): use mac-font? even if + gs-font-load is set. Backport. + + * mf/feta-bolletjes.mf: fix attachment of triangle head. backport. + + * mf/GNUmakefile ($(NCSB_OTFS)): backport: gen and install OTF + files, new NCSB dir handling. backport. + + * lily/music-sequence.cc (maximum_length): backport robustness fix. + + * input/tutorial/GNUmakefile (EXTRA_DIST_FILES): dist html file too. + + * configure.in (LINK_GXX_STATICALLY): new --with-ncsb-dir. (backport) + + * config.make.in: NCSB_SOURCE_FILES + + * flower/include/std-vector.hh: + (default_compare): backport: use only 1 compare optor. + 2006-05-07 Graham Percival * Documentation/user/ all: backport everything from 2.9 docs. diff --git a/config.make.in b/config.make.in index 9da7a9d1ef..8ecbc70b98 100644 --- a/config.make.in +++ b/config.make.in @@ -89,7 +89,7 @@ webdir = $(lilypond_docdir)/html vimdir = $(lilypond_datadir)/vim -NCSB_DIR = @NCSB_DIR@ +NCSB_SOURCE_FILES = @NCSB_SOURCE_FILES@ ################################################################ ## PROGRAMS @@ -107,6 +107,7 @@ DEFS = @DEFS@ DOCUMENTATION = @DOCUMENTATION@ DOTEXE = @DOTEXE@ FIND = @FIND@ +FCMATCH = @FCMATCH@ FLEX = @FLEX@ FLEXLEXER_FILE = @FLEXLEXER_FILE@ FONTFORGE = @FONTFORGE@ diff --git a/configure.in b/configure.in index 92e53a0515..f577f24ac1 100644 --- a/configure.in +++ b/configure.in @@ -37,7 +37,7 @@ AC_ARG_ENABLE(gui, NCSB_DIR=unknown AC_ARG_WITH(ncsb-dir, [ --with-ncsb-dir=DIR location of Century Schoolbook fonts - Default: detect with locate(1)], + Default: detect with fc-match(1)], [NCSB_DIR=$withval]) reloc_b=no @@ -54,6 +54,38 @@ AC_SUBST(LINK_GXX_STATICALLY) # must come before any header checks STEPMAKE_COMPILE + + + +AC_CHECK_PROG(FCMATCH, fc-match, fc-match) +AC_MSG_CHECKING([New Century Schoolbook PFB files]) +AC_SUBST(NCSB_SOURCE_FILES) +if test "$NCSB_DIR" != "" ; then + NCSB_SOURCE_FILES="" + for f in c059013l c059016l c059033l c059036l; do + if test ! -f "$NCSB_DIR/$f.pfb"; then + AC_MSG_WARN($NCSB_DIR does not contain $f.pfb.) + else + NCSB_SOURCE_FILES="$NCSB_DIR/$f.pfb $NCSB_SOURCE_FILES" + fi + done +else + if test "$FCMATCH" != ""; then + for style in Roman Italic "Bold Italic" Bold; do + NCSB_FILE=`$FCMATCH --verbose 'Century Schoolbook L:style=$style' | grep 'file:'` + + NCSB_FILE=`echo $NCSB_FILE | sed 's/^.*"\(.*\)".*$/\1/g'` + NCSB_SOURCE_FILES="$NCSB_FILE $NCSB_SOURCE_FILES" + done + else + AC_MSG_RESULT(not found) + echo "Can't find Century Schoolbook files. Install FontConfig's fc-match," + echo "or use --with-ncsb-dir" + fi +fi +AC_MSG_RESULT($NCSB_SOURCE_FILES) + + STEPMAKE_PYTHON(REQUIRED, 2.2) STEPMAKE_GCC(REQUIRED, 2.8) STEPMAKE_CXX(REQUIRED) @@ -104,27 +136,7 @@ if test "$reloc_b" = "yes"; then AC_DEFINE(ARGV0_RELOCATION) fi -AC_MSG_CHECKING([New Century Schoolbook PFB files]) -if test "$NCSB_DIR" = "unknown"; then - # use `type' command rather than external program `which' - type locate >& /dev/null - if test "$?" = "0"; then - for d in `locate c059033l.pfb `; do - if test -f `dirname "$d"`/c059033l.afm ; then - NCSB_DIR=`dirname "$d"` - break - fi - done - if test "$NCSB_DIR" = "unknown"; then - AC_MSG_WARN(Could not find c059033l.pfb. Use --enable-ncsb-path to set path) - fi - else - AC_MSG_WARN(Could not find locate(1). Use --enable-ncsb-path to set path to c059033l.pfb) - fi -fi -AC_MSG_RESULT($NCSB_DIR) -AC_SUBST(NCSB_DIR) HOST_ARCH=`$CC -dumpmachine` AC_SUBST(HOST_ARCH) diff --git a/flower/include/std-vector.hh b/flower/include/std-vector.hh index fd7f963dba..83e58d299c 100644 --- a/flower/include/std-vector.hh +++ b/flower/include/std-vector.hh @@ -24,7 +24,7 @@ int default_compare (T const &a, T const &b) { if (a < b) return -1; - else if (a > b) + else if (b < a) return 1; else return 0; diff --git a/input/tutorial/GNUmakefile b/input/tutorial/GNUmakefile index a17e462bf5..0213aefb4f 100644 --- a/input/tutorial/GNUmakefile +++ b/input/tutorial/GNUmakefile @@ -2,7 +2,7 @@ depth = ../.. LOCALSTEPMAKE_TEMPLATES=ly mutopia -EXTRA_DIST_FILES= lbook-texi-test.texi lbook-latex-test.tex +EXTRA_DIST_FILES= lbook-texi-test.texi lbook-latex-test.tex lbook-html-test.html include $(depth)/make/stepmake.make diff --git a/lily/music-sequence.cc b/lily/music-sequence.cc index 69b9343650..8a2915ad10 100644 --- a/lily/music-sequence.cc +++ b/lily/music-sequence.cc @@ -47,8 +47,13 @@ Music_sequence::maximum_length (SCM l) for (SCM s = l; scm_is_pair (s); s = scm_cdr (s)) { Music *m = unsmob_music (scm_car (s)); - Moment l = m->get_length (); - dur = max (dur, l); + if (!m) + programming_error ("Music sequence should have music elements"); + else + { + Moment l = m->get_length (); + dur = max (dur, l); + } } return dur; diff --git a/mf/GNUmakefile b/mf/GNUmakefile index b19b3400d1..3ac9576bb5 100644 --- a/mf/GNUmakefile +++ b/mf/GNUmakefile @@ -31,8 +31,7 @@ FETA_FONTS = $(FETA_MF_FILES:.mf=) SVG_FILES = $(OTF_FILES:%.otf=%.svg) $(ALL_FONTS:%=$(outdir)/%.svg) -NCSB_SOURCE_FILES=c059013l c059016l c059033l c059036l -NCSB_TTFS=$(addprefix $(outdir)/,CenturySchL-Ital.ttf CenturySchL-BoldItal.ttf CenturySchL-Roma.ttf CenturySchL-Bold.ttf) +NCSB_OTFS=$(addprefix $(outdir)/,CenturySchL-Ital.ttf CenturySchL-BoldItal.ttf CenturySchL-Roma.ttf CenturySchL-Bold.ttf) NCSB_INSTALL_DIR=$(local_lilypond_datadir)/fonts/otf LOG_FILES = $(FETA_MF_FILES:%.mf=$(outdir)/%.log) @@ -101,7 +100,7 @@ PFA_FILES = $(ALL_FONTS:%=$(outdir)/%.pfa) # Make tfm files first, log files last, # so that normally log files aren't made twice -ALL_GEN_FILES= $(TFM_FILES) $(TEXTABLES) $(TFM_FILES) $(LOG_FILES) $(ENC_FILES) $(LISP_FILES) $(FETA_LIST_FILES) $(OTF_TABLES) $(NCSB_TTFS) $(PFA_FILES) $(OTF_FILES) $(SVG_FILES) $(outdir)/fonts.cache-1 +ALL_GEN_FILES= $(TFM_FILES) $(TEXTABLES) $(TFM_FILES) $(LOG_FILES) $(ENC_FILES) $(LISP_FILES) $(FETA_LIST_FILES) $(OTF_TABLES) $(NCSB_OTFS) $(PFA_FILES) $(OTF_FILES) $(SVG_FILES) $(outdir)/fonts.cache-1 #PRE_INSTALL=$(MAKE) "$(ALL_GEN_FILES)" @@ -114,7 +113,7 @@ INSTALLATION_OUT_DIR1=$(local_lilypond_datadir)/tex INSTALLATION_OUT_FILES1=$(TEXTABLES) INSTALLATION_OUT_DIR2=$(local_lilypond_datadir)/fonts/otf -INSTALLATION_OUT_FILES2=$(OTF_FILES) $(NCSB_TTFS) +INSTALLATION_OUT_FILES2=$(OTF_FILES) $(NCSB_OTFS) INSTALLATION_OUT_DIR3=$(local_lilypond_datadir)/fonts/tfm INSTALLATION_OUT_FILES3=$(TFM_FILES) @@ -197,7 +196,7 @@ $(outdir)/%.enc.in: %.enc cp $< $@ -$(NCSB_TTFS): $(addsuffix .pfb,$(addprefix $(NCSB_DIR)/,$(NCSB_SOURCE_FILES))) $(buildscript-dir)/pfx2ttf.fontforge +$(NCSB_OTFS): $(NCSB_SOURCE_FILES) $(buildscript-dir)/pfx2ttf.fontforge $(foreach i,$(NCSB_SOURCE_FILES), \ $(FONTFORGE) -script $(buildscript-dir)/pfx2ttf.fontforge \ - $(NCSB_DIR)/$(i).pfb $(NCSB_DIR)/$(i).afm $(outdir)/ && ) true + $(i).pfb $(i).afm $(outdir)/ && ) true diff --git a/mf/feta-autometric.mf b/mf/feta-autometric.mf index e500999ec4..50648f13c0 100644 --- a/mf/feta-autometric.mf +++ b/mf/feta-autometric.mf @@ -14,7 +14,8 @@ message "******************************************************"; message "Using feta Autometric macros."; -message "Do not worry about the @ signs in the output, they are not errors."; +message "order of messages: "; +message " NAME/CODE/BP/WD/DP/HT/WX/WY"; message "******************************************************"; message ""; diff --git a/mf/feta-bolletjes.mf b/mf/feta-bolletjes.mf index 1483af4d9f..c09c3d2df9 100644 --- a/mf/feta-bolletjes.mf +++ b/mf/feta-bolletjes.mf @@ -336,6 +336,10 @@ endgroup enddef; +% +% +% UGH : xs not declared as argument. +% def define_triangle_shape (expr stemdir) = save triangle_a, triangle_b, triangle_c; save triangle_out_a, triangle_out_b, triangle_out_c; @@ -439,16 +443,17 @@ def define_triangle_shape (expr stemdir) = & {direction infinity of triangle_out_c}z1'l .. cycle; + labels (0, 10, 20, 30); penlabels (1, 1', 2, 2', 3, 3', 12, 23, 31); % attachment Y if stemdir = 1: charwy := ypart exact_right_point; - charwx := xpart exact_right_point; + charwx := xpart exact_right_point + .5 pen_thick# * xs; else: charwy := -ypart exact_down_point; - charwx := (width# - xpart exact_down_point); + charwx := (width# - (xpart exact_down_point - 0.5 * xs * pen_thick#)); fi enddef; @@ -503,14 +508,14 @@ def draw_small_triangle_head (expr dir) = enddef; -fet_beginchar ("Half trianglehead", "d1triangle"); +fet_beginchar ("Half trianglehead (downstem)", "d1triangle"); draw_small_triangle_head (-1); draw_staff (-2, 2, 0); fet_endchar; -fet_beginchar ("Half trianglehead", "u1triangle"); +fet_beginchar ("Half trianglehead (upstem)", "u1triangle"); draw_small_triangle_head (1); draw_staff (-2, 2, 0.5); @@ -531,14 +536,14 @@ def draw_closed_triangle_head (expr dir) = enddef; -fet_beginchar ("Quart trianglehead", "u2triangle"); +fet_beginchar ("Quart trianglehead (upstem)", "u2triangle"); draw_closed_triangle_head (1); draw_staff (-2, 2, 0); fet_endchar; -fet_beginchar ("Quart trianglehead", "d2triangle"); +fet_beginchar ("Quart trianglehead (downstem)", "d2triangle"); draw_closed_triangle_head (-1); draw_staff (-2, 2, 0.5); diff --git a/scm/define-grob-properties.scm b/scm/define-grob-properties.scm index 7e69fdd360..037c1fdd72 100644 --- a/scm/define-grob-properties.scm +++ b/scm/define-grob-properties.scm @@ -552,7 +552,6 @@ entries @code{name} and @code{interfaces}.") ;; TODO: use interface for this! (quantized-positions ,number-pair? "Beam positions after quanting.") - (chord-tremolo ,boolean? "if set, this beam is a tremolo. ") (begin-of-line-visible ,boolean? "Used for marking ChordNames that should only show changes.") (quantize-position ,boolean? "If set, a vertical alignment is aligned to be within staff spaces.") diff --git a/scm/framework-ps.scm b/scm/framework-ps.scm index 0e68240bd3..69c1e4617d 100644 --- a/scm/framework-ps.scm +++ b/scm/framework-ps.scm @@ -265,15 +265,20 @@ (cons name - (cond - ((string-match "^([eE]mmentaler|[Aa]ybabtu)" file-name) - (ps-load-file (ly:find-file - (format "~a.otf" file-name)))) - ((string? bare-file-name) - (ps-load-file file-name)) - (else - (ly:warning (_ "can't embed ~S=~S") name file-name) - ""))))) + + (if (mac-font? bare-file-name) + (handle-mac-font name bare-file-name) + (cond + ((string-match "^([eE]mmentaler|[Aa]ybabtu)" file-name) + (ps-load-file (ly:find-file + (format "~a.otf" file-name)))) + ((string? bare-file-name) + (ps-load-file file-name)) + (else + (ly:warning (_ "can't embed ~S=~S") name file-name) + ""))) + + ))) (define (dir-join a b) (if (equal? a "") @@ -342,7 +347,15 @@ (else (ly:warning (_ "don't know how to embed ~S=~S") name file-name) "")))) - + + (define (mac-font? bare-file-name) + (and + (eq? PLATFORM 'darwin) + bare-file-name + (or + (string-match "\\.dfont" bare-file-name) + (= (stat:size (stat bare-file-name)) 0)))) + (define (load-font font-name-filename) (let* ((font (car font-name-filename)) (name (cadr font-name-filename)) @@ -353,14 +366,7 @@ name (cond - ((and - (eq? PLATFORM 'darwin) - bare-file-name (string-match "\\.dfont" bare-file-name)) - (handle-mac-font name bare-file-name)) - - ((and - (eq? PLATFORM 'darwin) - bare-file-name (= (stat:size (stat bare-file-name)) 0)) + ((mac-font? bare-file-name) (handle-mac-font name bare-file-name)) ((and font (cff-font? font)) diff --git a/scm/lily-library.scm b/scm/lily-library.scm index 2e7fde2763..c4c2863ff1 100644 --- a/scm/lily-library.scm +++ b/scm/lily-library.scm @@ -310,6 +310,10 @@ found." (define-public (offset-flip-y o) (cons (car o) (- (cdr o)))) +(define-public (offset-scale o scale) + (cons (* (car o) scale) + (* (cdr o) scale))) + (define-public (ly:list->offsets accum coords) (if (null? coords) accum @@ -333,8 +337,19 @@ found." (max 0 (- (cdr x) (car x)))) (define-public interval-start car) +(define-public (ordered-cons a b) + (cons (min a b) + (max a b))) + (define-public interval-end cdr) +(define-public (interval-index interval dir) + "Interpolate INTERVAL between between left (DIR=-1) and right (DIR=+1)" + + (* (+ (interval-start interval) (interval-end interval) + (* dir (- (interval-end interval) (interval-start interval)))) + 0.5)) + (define-public (interval-center x) "Center the number-pair X, when an interval" (if (interval-empty? x) @@ -368,6 +383,7 @@ found." (nan? (cdr i)) (inf? (cdr i))))) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; diff --git a/scm/lily.scm b/scm/lily.scm index db729e6567..3c05c97dfa 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -95,6 +95,9 @@ similar to chord syntax") ".")) +;; TeX C++ code actually hooks into TEX_STRING_HASHLIMIT +(define-public TEX_STRING_HASHLIMIT 10000000) + ;; gettext wrapper for guile < 1.7.2 @@ -106,6 +109,8 @@ similar to chord syntax") (let* ((file-name (%search-load-path x))) (if (ly:get-option 'verbose) (ly:progress "[~A" file-name)) + (if (not file-name) + (ly:error (_ "Can't find ~A" x))) (primitive-load file-name) (if (ly:get-option 'verbose) (ly:progress "]")))) @@ -221,6 +226,7 @@ The syntax is the same as `define*-public'." ;; load-from-path '("lily-library.scm" "file-cache.scm" +; "define-event-classes.scm" "define-music-types.scm" "output-lib.scm" "c++.scm" diff --git a/scm/output-texstr.scm b/scm/output-texstr.scm index 6d82d6ec05..35ed35e3b3 100644 --- a/scm/output-texstr.scm +++ b/scm/output-texstr.scm @@ -28,8 +28,6 @@ "")) -;; TeX C++ code actually hooks into TEX_STRING_HASHLIMIT -(define-public TEX_STRING_HASHLIMIT 10000000) (define-public (text font str) (call-with-output-string (lambda (port) diff --git a/scripts/lilypond-book.py b/scripts/lilypond-book.py index 05ba307543..24b5d0384a 100644 --- a/scripts/lilypond-book.py +++ b/scripts/lilypond-book.py @@ -1068,7 +1068,7 @@ class Lilypond_snippet (Snippet): def png_is_outdated (self): base = self.basename () - ok = self.ly_is_outdated () + ok = not self.ly_is_outdated () if global_options.format in (HTML, TEXINFO): ok = ok and os.path.exists (base + '.eps') @@ -1076,7 +1076,7 @@ class Lilypond_snippet (Snippet): if ok: page_count = ps_page_count (base + '.eps') - if page_count == 1: + if page_count <= 1: ok = ok and os.path.exists (base + '.png') elif page_count > 1: for a in range (1, page_count + 1): @@ -1375,7 +1375,7 @@ def process_snippets (cmd, ly_snippets, texstr_snippets, png_snippets): ly_names = filter (lambda x: x, map (Lilypond_snippet.basename, ly_snippets)) texstr_names = filter (lambda x: x, - map (Lilypond_snippet.basename, texstr_snippets)) + map (Lilypond_snippet.basename, texstr_snippets)) png_names = filter (lambda x: x, map (Lilypond_snippet.basename, png_snippets)) @@ -1385,6 +1385,9 @@ def process_snippets (cmd, ly_snippets, texstr_snippets, png_snippets): be_verbose=global_options.verbose, progress_p= 1) + if global_options.format in (HTML, TEXINFO): + cmd += ' --format png ' + # UGH # the --process=CMD switch is a bad idea # it is too generic for lilypond-book. @@ -1521,7 +1524,8 @@ def do_process_cmd (chunks, input_name): map (Lilypond_snippet.write_ly, ly_outdated) progress ('\n') - if ly_outdated: + outdated = png_outdated + texstr_outdated + ly_outdated + if outdated: progress (_ ("Processing...")) progress ('\n') process_snippets (global_options.process_cmd, ly_outdated, texstr_outdated, png_outdated) diff --git a/stepmake/aclocal.m4 b/stepmake/aclocal.m4 index 3718904ceb..3ae4f92df6 100644 --- a/stepmake/aclocal.m4 +++ b/stepmake/aclocal.m4 @@ -1027,6 +1027,11 @@ AC_DEFUN(STEPMAKE_PYTHON_DEVEL, [ changequote([, ])#dnl fi + if test "$cross_compiling" = "yes" -a -z "$PYTHON_CFLAGS"; then + PYTHON_CFLAGS=`python-config --cflags` + PYTHON_LDFLAGS=`python-config --ldflags` + fi + if test -z "$PYTHON_HEADER"; then CPPFLAGS="$PYTHON_CFLAGS $CPPFLAGS" AC_CHECK_HEADERS([Python.h],[PYTHON_HEADER=yes]) @@ -1038,6 +1043,8 @@ AC_DEFUN(STEPMAKE_PYTHON_DEVEL, [ fi ]) + + AC_DEFUN(STEPMAKE_STL_DATA_METHOD, [ AC_LANG_PUSH(C++) AC_CACHE_CHECK([for stl.data () method], -- 2.39.5