From: Han-Wen Nienhuys Date: Sat, 3 Feb 2007 17:24:08 +0000 (+0100) Subject: use -dbackend=eps iso. --backend=eps for setting backend. X-Git-Tag: release/2.11.16-1~8 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=76b9a727b454dc2c7d30212f787913b71d756b4c;p=lilypond.git use -dbackend=eps iso. --backend=eps for setting backend. --- diff --git a/lily/general-scheme.cc b/lily/general-scheme.cc index 7723bd477b..cc46b631a3 100644 --- a/lily/general-scheme.cc +++ b/lily/general-scheme.cc @@ -230,13 +230,6 @@ LY_DEFINE (ly_gettext, "ly:gettext", return ly_string2scm (_ (scm_i_string_chars (string))); } -LY_DEFINE (ly_output_backend, "ly:output-backend", - 0, 0, 0, (), - "Return name of output backend.") -{ - return ly_string2scm (output_backend_global); -} - LY_DEFINE (ly_output_formats, "ly:output-formats", 0, 0, 0, (), "Formats passed to --format as a list of strings, " diff --git a/lily/include/program-option.hh b/lily/include/program-option.hh index 66babd51a9..7192ea7c46 100644 --- a/lily/include/program-option.hh +++ b/lily/include/program-option.hh @@ -11,8 +11,6 @@ #include "lily-guile.hh" /* options */ -extern bool do_midi_debugging_global; -extern int testing_level_global; extern bool lily_1_8_relative; extern bool lily_1_8_compatibility_used; @@ -20,5 +18,6 @@ SCM ly_get_option (SCM); SCM ly_set_option (SCM, SCM); bool get_program_option (const char *); +string get_output_backend_name (); #endif /* SCM_OPTION_HH */ diff --git a/lily/lily-parser.cc b/lily/lily-parser.cc index 456acd1a9e..05412ad05a 100644 --- a/lily/lily-parser.cc +++ b/lily/lily-parser.cc @@ -23,6 +23,7 @@ #include "sources.hh" #include "text-metrics.hh" #include "warn.hh" +#include "program-option.hh" #include "ly-smobs.icc" @@ -85,7 +86,7 @@ Lily_parser::print_smob (SCM s, SCM port, scm_print_state*) void Lily_parser::parse_file (string init, string name, string out_name) { - if (output_backend_global == "tex") + if (get_output_backend_name () == "tex") try_load_text_metrics (out_name); // TODO: use $parser diff --git a/lily/main.cc b/lily/main.cc index 4232f17e2e..28f3587f3f 100644 --- a/lily/main.cc +++ b/lily/main.cc @@ -53,9 +53,6 @@ vector dump_header_fieldnames_global; /* Name of initialisation file. */ string init_name_global; -/* Selected output backend - One of (gnome, ps [default], eps, scm, svg, tex, texstr)") */ -string output_backend_global = "ps"; /* Output formats to generate. */ string output_format_global = ""; @@ -150,8 +147,6 @@ static Getopt_long *option_parser = 0; static Long_option_init options_static[] = { - {_i ("BACK"), "backend", 'b', _i ("use backend BACK (eps, gnome, ps [default],\nscm, svg, tex, texstr)")}, - {_i ("SYM[=VAL]"), "define-default", 'd', _i ("set Scheme option SYM to VAL (default: #t).\n" "Use -dhelp for help.")}, @@ -383,8 +378,6 @@ main_with_guile (void *, int, char **) if (be_verbose_global) dir_info (stderr); - is_TeX_format_global = (output_backend_global == "tex" - || output_backend_global == "texstr"); is_pango_format_global = !is_TeX_format_global; init_scheme_variables_global = "(list " + init_scheme_variables_global + ")"; @@ -397,6 +390,9 @@ main_with_guile (void *, int, char **) init_freetype (); ly_reset_all_fonts (); + is_TeX_format_global = (get_output_backend_name () == "tex" + || get_output_backend_name () == "texstr"); + /* We accept multiple independent music files on the command line to reduce compile time when processing lots of small files. @@ -492,7 +488,7 @@ parse_argv (int argc, char **argv) } init_scheme_variables_global - += "(cons \'" + key + " " + val + ")\n"; + += "(cons \'" + key + " '" + val + ")\n"; } break; @@ -519,10 +515,6 @@ parse_argv (int argc, char **argv) exit (0); break; - case 'b': - output_backend_global = option_parser->optional_argument_str0_; - break; - case 'f': { vector components diff --git a/lily/modified-font-metric.cc b/lily/modified-font-metric.cc index 9a5488f1cc..ad43d756bc 100644 --- a/lily/modified-font-metric.cc +++ b/lily/modified-font-metric.cc @@ -14,6 +14,7 @@ using namespace std; #include "warn.hh" #include "stencil.hh" #include "main.hh" +#include "program-option.hh" Modified_font_metric::Modified_font_metric (Font_metric *fm, Real magnification) @@ -181,7 +182,7 @@ Modified_font_metric::text_dimension (string text) const SCM stext = ly_string2scm (text); Box b; - if (output_backend_global == "tex") + if (get_output_backend_name () == "tex") { b = lookup_tex_text_dimension (orig_, stext); diff --git a/lily/pango-font.cc b/lily/pango-font.cc index f1fb20e6c5..43766881c2 100644 --- a/lily/pango-font.cc +++ b/lily/pango-font.cc @@ -23,6 +23,7 @@ #include "string-convert.hh" #include "warn.hh" #include "all-font-metrics.hh" +#include "program-option.hh" #if HAVE_PANGO_FT2 #include "stencil.hh" @@ -351,8 +352,8 @@ Pango_font::text_stencil (string str, bool tight) const UGH. Should have flags per output format signifying supported options. */ - if (output_backend_global != "ps" - && output_backend_global != "eps") + string name = get_output_backend_name (); + if (name != "ps" && name != "eps") { /* For Pango based backends, we take a shortcut. diff --git a/lily/paper-book.cc b/lily/paper-book.cc index bf6a98e536..195e978f65 100644 --- a/lily/paper-book.cc +++ b/lily/paper-book.cc @@ -16,6 +16,7 @@ #include "paper-system.hh" #include "text-interface.hh" #include "warn.hh" +#include "program-option.hh" #include "ly-smobs.icc" @@ -106,7 +107,7 @@ Paper_book::output (SCM output_channel) if (ly_is_module (header_)) scopes = scm_cons (header_, scopes); - string mod_nm = "scm framework-" + output_backend_global; + string mod_nm = "scm framework-" + get_output_backend_name (); SCM mod = scm_c_resolve_module (mod_nm.c_str ()); if (make_print) @@ -153,7 +154,7 @@ Paper_book::classic_output (SCM output) if (ly_is_module (header_0_)) scopes = scm_cons (header_0_, scopes); - string format = output_backend_global; + string format = get_output_backend_name (); string mod_nm = "scm framework-" + format; SCM mod = scm_c_resolve_module (mod_nm.c_str ()); diff --git a/lily/program-option-scheme.cc b/lily/program-option-scheme.cc index fe0f290c27..1efcc75a29 100644 --- a/lily/program-option-scheme.cc +++ b/lily/program-option-scheme.cc @@ -92,16 +92,6 @@ void internal_set_option (SCM var, SCM val) - -bool -get_program_option (const char *s) -{ - SCM sym = ly_symbol2scm (s); - - return to_boolean (ly_get_option (sym)); -} - - ssize const HELP_INDENT = 30; ssize const INDENT = 2; ssize const SEPARATION = 5; @@ -242,3 +232,5 @@ LY_DEFINE (ly_get_option, "ly:get-option", 1, 0, 0, (SCM var), LY_ASSERT_TYPE (ly_is_symbol, var, 1); return scm_hashq_ref (option_hash, var, SCM_BOOL_F); } + + diff --git a/lily/program-option.cc b/lily/program-option.cc index e69de29bb2..ebc2c92ba1 100644 --- a/lily/program-option.cc +++ b/lily/program-option.cc @@ -0,0 +1,25 @@ +/* + program-option.cc -- program options, non-scheme. + + source file of the GNU LilyPond music typesetter + + (c) 2007 Han-Wen Nienhuys + +*/ + +#include "program-option.hh" + +string +get_output_backend_name () +{ + return ly_symbol2string (ly_get_option (ly_symbol2scm ("backend"))); +} + +bool +get_program_option (const char *s) +{ + SCM sym = ly_symbol2scm (s); + + return to_boolean (ly_get_option (sym)); +} + diff --git a/make/lilypond-vars.make b/make/lilypond-vars.make index 6c15832981..fd821eddcb 100644 --- a/make/lilypond-vars.make +++ b/make/lilypond-vars.make @@ -27,7 +27,7 @@ LILYPOND_BOOK_INCLUDES = -I $(src-dir)/ -I $(outdir) -I $(input-dir) -I $(input- ## override from cmd line to speed up. ANTI_ALIAS_FACTOR=2 LILYPOND_JOBS=$(if $(CPU_COUNT),-djob-count=$(CPU_COUNT),) -LILYPOND_BOOK_LILYPOND_FLAGS=--backend=eps --formats=ps,png,pdf $(LILYPOND_JOBS) -dinclude-eps-fonts -dgs-load-fonts --header=texidoc -I $(top-src-dir)/input/manual -dcheck-internal-types -ddump-signatures -danti-alias-factor=$(ANTI_ALIAS_FACTOR) +LILYPOND_BOOK_LILYPOND_FLAGS=-dbackend=eps --formats=ps,png,pdf $(LILYPOND_JOBS) -dinclude-eps-fonts -dgs-load-fonts --header=texidoc -I $(top-src-dir)/input/manual -dcheck-internal-types -ddump-signatures -danti-alias-factor=$(ANTI_ALIAS_FACTOR) LILYPOND_BOOK_VERBOSE = --verbose LILYPOND_BOOK_FLAGS = --process="$(LILYPOND_BINARY) $(LILYPOND_BOOK_LILYPOND_FLAGS)" $(LILYPOND_BOOK_VERBOSE) TEXINPUTS=$(top-src-dir)/tex/:: diff --git a/scm/framework-svg.scm b/scm/framework-svg.scm index 2e40558e64..6abb3438b8 100644 --- a/scm/framework-svg.scm +++ b/scm/framework-svg.scm @@ -20,7 +20,7 @@ (define-public (output-framework basename book scopes fields) (let* ((filename (format "~a.svg" basename)) (outputter (ly:make-paper-outputter (open-file filename "wb") - (ly:output-backend))) + (ly:get-option 'backend))) (dump (lambda (str) (display str (ly:outputter-port outputter)))) (paper (ly:paper-book-paper book)) (unit-length (ly:output-def-lookup paper 'output-scale)) diff --git a/scm/framework-texstr.scm b/scm/framework-texstr.scm index 5078b35b9d..6bde0616bd 100644 --- a/scm/framework-texstr.scm +++ b/scm/framework-texstr.scm @@ -35,7 +35,7 @@ (let* ((filename (format "~a.texstr" basename)) (outputter (ly:make-paper-outputter (open-file filename "wb") - (ly:output-backend))) + (ly:get-option 'backend))) (paper (ly:paper-book-paper book)) (lines (ly:paper-book-systems book))) (ly:outputter-dump-string outputter (header basename)) @@ -50,7 +50,7 @@ (outputter (ly:make-paper-outputter (open-file filename "wb") - (ly:output-backend))) + (ly:get-option 'backend))) (paper (ly:paper-book-paper book)) (pages (ly:paper-book-pages book))) (ly:outputter-dump-string outputter (header basename)) diff --git a/scm/lily.scm b/scm/lily.scm index 893cc59243..b366507f5d 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -28,6 +28,7 @@ ;; - [subject-]-verb-object-object (anti-alias-factor 1 "render at higher resolution and scale down result\nto prevent jaggies in PNG") + (backend ps "which backend to use by default; Options: eps, ps [default], scm, svg, tex, texstr)") (check-internal-types #f "check every property assignment for types") (clip-systems #f "Generate cut-out snippets of a score") (debug-gc #f "dump memory debugging statistics") @@ -137,7 +138,7 @@ on errors, and print a stack trace.") (coverage:enable)) (define-public tex-backend? - (member (ly:output-backend) '("texstr" "tex"))) + (member (ly:get-option 'backend) '(texstr tex))) (define-public parser #f) diff --git a/scripts/lilypond-book.py b/scripts/lilypond-book.py index 09eefff340..2ff452fdf9 100644 --- a/scripts/lilypond-book.py +++ b/scripts/lilypond-book.py @@ -140,7 +140,7 @@ def get_option_parser (): p.add_option ('-P', '--process', metavar=_ ("COMMAND"), help = _ ("process ly_files using COMMAND FILE..."), action='store', - dest='process_cmd', default='lilypond -b eps') + dest='process_cmd', default='lilypond -dbackend=eps') p.add_option ('--pdf', action="store_true", dest="create_pdf",