From 9b6c7a52eb6c4d4658fed509d5c2e20b325b1620 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Fri, 28 Jan 2005 16:28:39 +0000 Subject: [PATCH] * ly/generate-embedded-cff.ly: write .cff.ps files. * mf/GNUmakefile ($(outdir)/lilypond.map): add .cff.ps to .map file. * stepmake/stepmake/metafont-rules.make ($(outdir)/%.pfb $(outdir)/%.svg $(outdir)/%.pfa): remove --simplify --- ChangeLog | 9 +++++++++ lily/box.cc | 2 +- lily/stencil-scheme.cc | 2 ++ ly/generate-embedded-cff.ly | 21 +++++++++++++++++++++ make/lilypond-vars.make | 2 +- mf/GNUmakefile | 9 ++++++++- scm/framework-ps.scm | 36 ++++-------------------------------- scm/lily-library.scm | 34 ++++++++++++++++++++++++++++++++++ scripts/lilypond-book.py | 6 ++++++ 9 files changed, 86 insertions(+), 35 deletions(-) create mode 100644 ly/generate-embedded-cff.ly diff --git a/ChangeLog b/ChangeLog index 65f026242d..f306e3ba6c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2005-01-28 Han-Wen Nienhuys + + * ly/generate-embedded-cff.ly: write .cff.ps files. + + * mf/GNUmakefile ($(outdir)/lilypond.map): add .cff.ps to .map file. + + * stepmake/stepmake/metafont-rules.make ($(outdir)/%.pfb + $(outdir)/%.svg $(outdir)/%.pfa): remove --simplify + 2005-01-28 Jan Nieuwenhuizen * lily/include/guile-compatibility.hh (SCM_VECTOR_P): Compile fix. diff --git a/lily/box.cc b/lily/box.cc index 5463abef86..03bc5bc86e 100644 --- a/lily/box.cc +++ b/lily/box.cc @@ -7,7 +7,6 @@ */ #include "box.hh" - #include "array.hh" void @@ -76,6 +75,7 @@ Box::center () const return Offset (interval_a_[X_AXIS].center (), interval_a_[Y_AXIS].center ()); } + void Box::widen (Real x, Real y) { diff --git a/lily/stencil-scheme.cc b/lily/stencil-scheme.cc index 0bffa6edb3..ee6ea6e7ba 100644 --- a/lily/stencil-scheme.cc +++ b/lily/stencil-scheme.cc @@ -47,8 +47,10 @@ LY_DEFINE (ly_translate_stencil_axis, "ly:stencil-translate-axis", SCM_ASSERT_TYPE (scm_is_number (amount), amount, SCM_ARG2, __FUNCTION__, "number"); Real real_amount = scm_to_double (amount); +#if 0 SCM_ASSERT_TYPE (!isinf (real_amount) && !isnan (real_amount), amount, SCM_ARG2, __FUNCTION__, "finite number"); +#endif SCM_ASSERT_TYPE (is_axis (axis), axis, SCM_ARG3, __FUNCTION__, "axis"); diff --git a/ly/generate-embedded-cff.ly b/ly/generate-embedded-cff.ly new file mode 100644 index 0000000000..780280f20b --- /dev/null +++ b/ly/generate-embedded-cff.ly @@ -0,0 +1,21 @@ +#(define (write-cff name filename) + (let* + ((body (ly:gulp-file filename)) + (outname (format "~a.ps" filename)) + (out-port (open-output-file outname)) + ) + + + (display (ps-embed-cff body name 0) + out-port) + )) + +#(write-cff "emmentaler-26" "emmentaler26.cff") +#(write-cff "emmentaler-23" "emmentaler23.cff") +#(write-cff "emmentaler-20" "emmentaler20.cff") +#(write-cff "emmentaler-18" "emmentaler18.cff") +#(write-cff "emmentaler-16" "emmentaler16.cff") +#(write-cff "emmentaler-14" "emmentaler14.cff") +#(write-cff "emmentaler-13" "emmentaler13.cff") +#(write-cff "emmentaler-11" "emmentaler11.cff") +#(write-cff "aybabtu" "aybabtu.cff") diff --git a/make/lilypond-vars.make b/make/lilypond-vars.make index 3b3b95b5d1..521017bd54 100644 --- a/make/lilypond-vars.make +++ b/make/lilypond-vars.make @@ -38,7 +38,7 @@ CONVERT_LY = $(script-dir)/convert-ly.py LILYPOND = $(builddir)/lily/$(outconfbase)/lilypond LILYPOND_BOOK = $(script-dir)/lilypond-book.py LILYPOND_BOOK_INCLUDES = -I $(pwd) -I $(outdir) -I$(input-dir) -I $(input-dir)/regression/ -I $(input-dir)/test/ -I $(input-dir)/tutorial/ -I $(builddir)/mf/$(outconfbase)/ -I $(builddir)/mf/out/ -LILYPOND_BOOK_FLAGS = --process="lilypond --backend tex --formats=tex --header=texidoc -I $(srcdir)/input/test -e '(ly:set-option (quote internal-type-checking) \#t)'" +LILYPOND_BOOK_FLAGS = --process="lilypond --backend ps --formats=ps --header=texidoc -I $(srcdir)/input/test -e '(ly:set-option (quote internal-type-checking) \#t)'" #texi-html for www only: LILYPOND_BOOK_FORMAT=$(if $(subst out-www,,$(notdir $(outdir))),texi,texi-html) diff --git a/mf/GNUmakefile b/mf/GNUmakefile index 35d96e90ee..810180b45d 100644 --- a/mf/GNUmakefile +++ b/mf/GNUmakefile @@ -26,6 +26,7 @@ OTF_TABLES = $(addsuffix .otf-table, $(addprefix $(outdir)/feta, $(STAFF_SIZES)) FETA_FONTS = $(FETA_MF_FILES:.mf=) SVG_FILES = $(OTF_FILES:%.otf=%.svg) $(ALL_FONTS:%=$(outdir)/%.svg) CFF_FILES = $(OTF_FILES:%.otf=%.cff) +CFF_PS_FILES = $(OTF_FILES:%.otf=%.cff.ps) $(outdir)/aybabtu.otf-table: $(BRACES:%=$(outdir)/feta-braces-%.otf-table) @@ -60,6 +61,9 @@ foe: $(outdir)/%.cff $(outdir)/%.otf $(outdir)/%.svg: $(outdir)/%.pe (cd $(outdir) && fontforge -script $(notdir $<)) +$(CFF_PS_FILES): $(CFF_FILES) + cd $(outdir) && $(builddir)/lily/$(outconfbase)/lilypond --verbose $(abs-srcdir)/ly/generate-embedded-cff + $(outdir)/%.otf-table: $(outdir)/%.lisp $(if $(findstring brace,$<),,$(subst feta,parmesan,$<)) cat $< \ $(if $(findstring brace,$<),,$(subst feta,parmesan,$<)) \ @@ -79,7 +83,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) $(PFA_FILES) $(outdir)/lilypond.map $(OTF_FILES) $(SVG_FILES) +ALL_GEN_FILES= $(TFM_FILES) $(TEXTABLES) $(TFM_FILES) $(LOG_FILES) $(ENC_FILES) $(LISP_FILES) $(FETA_LIST_FILES) $(OTF_TABLES) $(PFA_FILES) $(outdir)/lilypond.map $(OTF_FILES) $(SVG_FILES) $(CFF_PS_FILES) #PRE_INSTALL=$(MAKE) "$(ALL_GEN_FILES)" INSTALLATION_DIR=$(local_lilypond_datadir)/fonts/source @@ -171,6 +175,9 @@ fontdir: $(addprefix $(outdir)/, lilypond.map lilypond.sfd private-fonts fonts.s $(outdir)/lilypond.map: $(AFM_FILES) for i in $(FETA_FONTS); do echo $$i $$i '<'$$i.pfa; done > $@ + for i in $(STAFF_SIZES); \ + do echo "emmentaler$$i emmentaler-$$i > $@ local-clean: diff --git a/scm/framework-ps.scm b/scm/framework-ps.scm index 0c743dfeea..7063fa5d53 100644 --- a/scm/framework-ps.scm +++ b/scm/framework-ps.scm @@ -49,33 +49,6 @@ %%EndResource" font-name body))) -(define (ps-embed-cff body font-set-name version) - (let* ((binary-data - (string-append - (format "/~a ~s StartData " font-set-name (string-length body)) - body))) - - (string-append - (format - "%%BeginResource: font ~a -%!PS-Adobe-3.0 Resource-FontSet -%%DocumentNeededResources: ProcSet (FontSetInit) -%%Title: (FontSet/~a) -%%Version: ~s -%%EndComments -%%IncludeResource: ProcSet (FontSetInit) -%%BeginResource: FontSet (~a) -/FontSetInit /ProcSet findresource begin -%%BeginData: ~s Binary Bytes -" - font-set-name font-set-name version font-set-name - (string-length binary-data)) - binary-data - "\n%%EndData -%%EndResource -%%EOF -%%EndResource -"))) (define (define-fonts paper) (define font-list (ly:paper-fonts paper)) @@ -265,7 +238,6 @@ (setup paper))) (define-public (output-framework basename book scopes fields) -; (display (gc-live-object-stats)) (let* ((filename (format "~a.ps" basename)) (outputter (ly:make-paper-outputter filename (ly:output-backend))) @@ -399,13 +371,13 @@ ))) (let* ((lines (ly:paper-book-systems book)) - (tex-port (open-output-file (format "~a.tex" basename))) - (last-line (car (last-pair lines)))) + (tex-system-port (open-output-file (format "~a-systems.tex" basename))) +g (last-line (car (last-pair lines)))) (dump-lines lines 1) (for-each (lambda (c) - (display (format "\\includegraphics{~a-~a.eps}%\n" - basename (1+ c)) tex-port)) + (display (format "\\lilypondEpsGraphics{~a-~a.eps}%\n" + basename (1+ c)) tex-system-port)) (iota (length lines)) ))) diff --git a/scm/lily-library.scm b/scm/lily-library.scm index 44b2fd3f15..195196e732 100644 --- a/scm/lily-library.scm +++ b/scm/lily-library.scm @@ -312,3 +312,37 @@ possibly turned off." (if (not (null? (cdr name-style))) name-style (append name-style '("Regular")))))) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(define-public (ps-embed-cff body font-set-name version) + (let* ((binary-data + (string-append + (format "/~a ~s StartData " font-set-name (string-length body)) + body)) + + (header + (format + "%%BeginResource: font ~a +%!PS-Adobe-3.0 Resource-FontSet +%%DocumentNeededResources: ProcSet (FontSetInit) +%%Title: (FontSet/~a) +%%Version: ~s +%%EndComments +%%IncludeResource: ProcSet (FontSetInit) +%%BeginResource: FontSet (~a) +/FontSetInit /ProcSet findresource begin +%%BeginData: ~s Binary Bytes +" + font-set-name font-set-name version font-set-name + (string-length binary-data))) + (footer "\n%%EndData +%%EndResource +%%EOF +%%EndResource")) + + (string-append + header + binary-data + footer))) diff --git a/scripts/lilypond-book.py b/scripts/lilypond-book.py index 9fd3ffba08..2edce7156b 100644 --- a/scripts/lilypond-book.py +++ b/scripts/lilypond-book.py @@ -64,6 +64,7 @@ program_name = sys.argv[0] verbose_p = 0 pseudo_filter_p = 0 original_dir = os.getcwd () +backend = 'ps' help_summary = _ ( '''Process LilyPond snippets in hybrid HTML, LaTeX, or texinfo document. @@ -892,6 +893,9 @@ class Lilypond_snippet (Snippet): or glob.glob (base + '-page*.png')) return not ok def texstr_is_outdated (self): + if backend == 'ps': + return 0 + base = self.basename () ok = self.ly_is_outdated () ok = ok and (os.path.exists (base + '.texstr')) @@ -1410,6 +1414,8 @@ def do_options (): format = a if a == 'texi-html' or a == 'texi': format = TEXINFO + elif o == '--tex-backend ': + backend = 'tex' elif o == '--help' or o == '-h': ly.help () sys.exit (0) -- 2.39.2