From ba9f8c7b737b63c29e1a7f6956c7cec69d1180bb Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Fri, 7 Jan 2005 14:29:58 +0000 Subject: [PATCH] * lily/include/main.hh: lose _b hungarian suffixes for global variables. * lily/font-select.cc (get_font_by_design_size): retrieve PangoFont for (designsize . "pango-descr") entries. * lily/lily-parser-scheme.cc: new file. * scm/font.scm (add-cmr-fonts): use real dimens in font selection. --- ChangeLog | 3 ++ lily/all-font-metrics.cc | 16 +++++------ lily/context-property.cc | 2 +- lily/context.cc | 2 +- lily/font-select.cc | 4 ++- lily/global-context-scheme.cc | 2 +- lily/gourlay-breaking.cc | 2 +- lily/grob-property.cc | 4 +-- lily/grob.cc | 6 ++-- lily/includable-lexer.cc | 6 ++-- lily/include/main.hh | 11 ++++---- lily/kpath.cc | 4 +-- lily/lexer.ll | 2 +- lily/lily-guile.cc | 8 +++--- lily/lily-lexer.cc | 2 +- lily/lily-parser-scheme.cc | 4 +-- lily/main.cc | 19 +++++++------ lily/music.cc | 2 +- lily/pango-select.cc | 16 ++++++----- lily/paper-score.cc | 2 +- lily/parser.yy | 8 +++--- lily/performance.cc | 4 +-- lily/scm-option.cc | 8 +++--- lily/spacing-spanner.cc | 2 +- lily/system.cc | 8 +++--- lily/text-item.cc | 9 ------ ly/paper-defaults.ly | 10 +++---- scm/font.scm | 52 ++++++++++++++++------------------- scm/lily.scm | 3 ++ scm/paper.scm | 6 +++- 30 files changed, 115 insertions(+), 112 deletions(-) diff --git a/ChangeLog b/ChangeLog index b15e4d8321..87c4d1b333 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2005-01-07 Han-Wen Nienhuys + * lily/include/main.hh: lose _b hungarian suffixes for global + variables. + * lily/include/lily-guile-macros.hh: new file. * lily/pango-select-scheme.cc (LY_DEFINE): new file. diff --git a/lily/all-font-metrics.cc b/lily/all-font-metrics.cc index 5425542816..11c799e397 100644 --- a/lily/all-font-metrics.cc +++ b/lily/all-font-metrics.cc @@ -68,7 +68,7 @@ All_font_metrics::find_pango_font (PangoFontDescription*description) SCM val; if (!pango_dict_->try_retrieve (key, &val)) { - if (verbose_global_b) + if (be_verbose_global) progress_indication ("[" + String (fn)); Pango_font *pf = new Pango_font (pango_ft2_fontmap_, RIGHT, @@ -77,7 +77,7 @@ All_font_metrics::find_pango_font (PangoFontDescription*description) pango_dict_->set (key, val); scm_gc_unprotect_object (val); - if (verbose_global_b) + if (be_verbose_global) progress_indication ("]"); pf->description_ = scm_cons (SCM_BOOL_F, @@ -118,7 +118,7 @@ All_font_metrics::find_afm (String name) if (file_name.is_empty ()) return 0; - if (verbose_global_b) + if (be_verbose_global) progress_indication ("[" + file_name); val = read_afm_file (file_name); unsmob_metrics (val)->file_name_ = file_name; @@ -126,7 +126,7 @@ All_font_metrics::find_afm (String name) unsmob_metrics (val)->description_ = scm_cons (name_string, scm_make_real (1.0)); - if (verbose_global_b) + if (be_verbose_global) progress_indication ("]"); afm_dict_->set (sname, val); @@ -184,12 +184,12 @@ All_font_metrics::find_otf (String name) if (file_name.is_empty ()) return 0; - if (verbose_global_b) + if (be_verbose_global) progress_indication ("[" + file_name); val = Open_type_font::make_otf (file_name); - if (verbose_global_b) + if (be_verbose_global) progress_indication ("]"); unsmob_metrics (val)->file_name_ = file_name; @@ -226,12 +226,12 @@ All_font_metrics::find_tfm (String name) if (file_name.is_empty ()) return 0; - if (verbose_global_b) + if (be_verbose_global) progress_indication ("[" + file_name); val = Tex_font_metric::make_tfm (file_name); - if (verbose_global_b) + if (be_verbose_global) progress_indication ("]"); unsmob_metrics (val)->file_name_ = file_name; diff --git a/lily/context-property.cc b/lily/context-property.cc index 496b9b120b..b5bff1664c 100644 --- a/lily/context-property.cc +++ b/lily/context-property.cc @@ -112,7 +112,7 @@ execute_pushpop_property (Context * trg, else { warning ("Need symbol arguments for \\override and \\revert"); - if (internal_type_checking_global_b) + if (do_internal_type_checking_global) assert (false); } } diff --git a/lily/context.cc b/lily/context.cc index 4cad8ea641..56cad82dc5 100644 --- a/lily/context.cc +++ b/lily/context.cc @@ -379,7 +379,7 @@ void Context::internal_set_property (SCM sym, SCM val) { #ifndef NDEBUG - if (internal_type_checking_global_b) + if (do_internal_type_checking_global) assert (type_check_assignment (sym, val, ly_symbol2scm ("translation-type?"))); #endif diff --git a/lily/font-select.cc b/lily/font-select.cc index 5f8ca95b2f..9e55cd2c50 100644 --- a/lily/font-select.cc +++ b/lily/font-select.cc @@ -14,6 +14,7 @@ #include "font-interface.hh" #include "warn.hh" #include "pango-font.hh" +#include "main.hh" bool @@ -117,7 +118,8 @@ select_encoded_font (Output_def *layout, SCM chain) else name = scm_cdr (name); - if (scm_is_string (name)) + if (scm_is_string (name) + && is_pango_format_global) { SCM mag = ly_chain_assoc (ly_symbol2scm ("font-magnification"), chain); Real rmag = (scm_is_pair (mag) diff --git a/lily/global-context-scheme.cc b/lily/global-context-scheme.cc index c0f919f2e7..375af3645e 100644 --- a/lily/global-context-scheme.cc +++ b/lily/global-context-scheme.cc @@ -87,7 +87,7 @@ LY_DEFINE (ly_run_translator, "ly:run-translator", scm_remember_upto_here_1 (protected_iter); trans->finish (); - if (verbose_global_b) + if (be_verbose_global) progress_indication (_f ("elapsed time: %.2f seconds", timer.read ())); return scm_gc_unprotect_object (trans->self_scm ()); diff --git a/lily/gourlay-breaking.cc b/lily/gourlay-breaking.cc index 6632d06bfe..713ffa823c 100644 --- a/lily/gourlay-breaking.cc +++ b/lily/gourlay-breaking.cc @@ -195,7 +195,7 @@ Gourlay_breaking::do_solve () const i = prev; } - if (verbose_global_b) + if (be_verbose_global) { progress_indication (_f ("Optimal demerits: %f", optimal_paths.top ().demerits_) + "\n"); diff --git a/lily/grob-property.cc b/lily/grob-property.cc index ddba069a2e..bfe2eb5aa4 100644 --- a/lily/grob-property.cc +++ b/lily/grob-property.cc @@ -71,7 +71,7 @@ Grob::internal_set_property (SCM s, SCM v) if (!is_live ()) return; - if (internal_type_checking_global_b) + if (do_internal_type_checking_global) { if (!type_check_assignment (s, v, ly_symbol2scm ("backend-type?"))) abort (); @@ -91,7 +91,7 @@ Grob::internal_get_property (SCM sym) const s = scm_sloppy_assq (sym, immutable_property_alist_); - if (internal_type_checking_global_b && scm_is_pair (s)) + if (do_internal_type_checking_global && scm_is_pair (s)) { if (!type_check_assignment (sym, scm_cdr (s), ly_symbol2scm ("backend-type?"))) diff --git a/lily/grob.cc b/lily/grob.cc index 888e6836db..de24181a43 100644 --- a/lily/grob.cc +++ b/lily/grob.cc @@ -69,10 +69,10 @@ Grob::Grob (SCM basicprops, SCM ifs = scm_assoc (ly_symbol2scm ("interfaces"), meta); /* Switch off interface checks for the moment. */ - bool itc = internal_type_checking_global_b; - internal_type_checking_global_b = false; + bool itc = do_internal_type_checking_global; + do_internal_type_checking_global = false; internal_set_property (ly_symbol2scm ("interfaces"), scm_cdr (ifs)); - internal_type_checking_global_b = itc; + do_internal_type_checking_global = itc; } /* TODO: diff --git a/lily/includable-lexer.cc b/lily/includable-lexer.cc index d58b31ced3..a87da4a2ed 100644 --- a/lily/includable-lexer.cc +++ b/lily/includable-lexer.cc @@ -68,7 +68,7 @@ Includable_lexer::new_input (String name, Sources *sources) if (yy_current_buffer) state_stack_.push (yy_current_buffer); - if (verbose_global_b) + if (be_verbose_global) progress_indication (String ("[") + name); include_stack_.push (file); @@ -91,7 +91,7 @@ Includable_lexer::new_input (String name, String data, Sources *sources) if (yy_current_buffer) state_stack_.push (yy_current_buffer); - if (verbose_global_b) + if (be_verbose_global) progress_indication (String ("[") + name); include_stack_.push (file); @@ -106,7 +106,7 @@ Includable_lexer::close_input () { include_stack_.pop (); char_count_stack_.pop (); - if (verbose_global_b) + if (be_verbose_global) progress_indication ("]"); yy_delete_buffer (yy_current_buffer); #if HAVE_FLEXLEXER_YY_CURRENT_BUFFER diff --git a/lily/include/main.hh b/lily/include/main.hh index 23fad33030..e5553eb40f 100644 --- a/lily/include/main.hh +++ b/lily/include/main.hh @@ -27,13 +27,14 @@ extern String init_name_global; /* options */ extern Array dump_header_fieldnames_global; -extern bool no_layout_global_b; +extern bool skip_layout_global; extern String output_backend_global; extern String output_name_global; -extern bool safe_global_b; -extern bool verbose_global_b; -extern bool store_locations_global_b; -extern bool internal_type_checking_global_b; +extern bool be_safe_global; +extern bool be_verbose_global; +extern bool store_locations_global; +extern bool do_internal_type_checking_global; +extern bool is_pango_format_global; /* todo: collect in Output_option struct? diff --git a/lily/kpath.cc b/lily/kpath.cc index 2757cf3508..ca73ae052f 100644 --- a/lily/kpath.cc +++ b/lily/kpath.cc @@ -128,7 +128,7 @@ kpathsea_gulp_file_to_string (String name) if (file_name.is_empty ()) error (_f ("can't find file: `%s'", name)); - if (verbose_global_b) + if (be_verbose_global) progress_indication ("[" + file_name); int filesize; @@ -136,7 +136,7 @@ kpathsea_gulp_file_to_string (String name) String string (str); delete[] str; - if (verbose_global_b) + if (be_verbose_global) progress_indication ("]"); return string; diff --git a/lily/lexer.ll b/lily/lexer.ll index b4049350e1..0a209abf20 100644 --- a/lily/lexer.ll +++ b/lily/lexer.ll @@ -276,7 +276,7 @@ HYPHEN -- char const* s = here_str0 (); int n = 0; SCM sval = ly_parse_scm (s, &n, here_input (), - safe_global_b && main_input_b_); + be_safe_global && main_input_b_); if (sval == SCM_UNDEFINED) { diff --git a/lily/lily-guile.cc b/lily/lily-guile.cc index b39b566007..3b21744973 100644 --- a/lily/lily-guile.cc +++ b/lily/lily-guile.cc @@ -96,7 +96,7 @@ gulp_file_to_string (String fn, bool must_exist) return s; } - if (verbose_global_b) + if (be_verbose_global) progress_indication ("[" + s); int n; @@ -104,7 +104,7 @@ gulp_file_to_string (String fn, bool must_exist) String result ((Byte*) str, n); delete[] str; - if (verbose_global_b) + if (be_verbose_global) progress_indication ("]"); return result; @@ -191,7 +191,7 @@ ly_init_ly_module (void *) for (int i = scm_init_funcs_->size () ; i--;) (scm_init_funcs_->elem (i)) (); - if (verbose_global_b) + if (be_verbose_global) progress_indication ("\n"); scm_primitive_load_path (scm_makfrom0str ("lily.scm")); @@ -481,7 +481,7 @@ type_check_assignment (SCM sym, SCM val, SCM type_symbol) + " " + _ ("Perhaps you made a typing error?")); /* Be strict when being anal :) */ - if (internal_type_checking_global_b) + if (do_internal_type_checking_global) abort (); warning (_ ("Doing assignment anyway.")); diff --git a/lily/lily-lexer.cc b/lily/lily-lexer.cc index 446600c805..4fdfcd5088 100644 --- a/lily/lily-lexer.cc +++ b/lily/lily-lexer.cc @@ -191,7 +191,7 @@ Lily_lexer::start_main_input () new_input (main_input_name_, sources_); /* Do not allow \include in --safe-mode */ - allow_includes_b_ = allow_includes_b_ && !safe_global_b; + allow_includes_b_ = allow_includes_b_ && !be_safe_global; scm_module_define (scm_car (scopes_), ly_symbol2scm ("input-file-name"), diff --git a/lily/lily-parser-scheme.cc b/lily/lily-parser-scheme.cc index 1195294023..cc328a1225 100644 --- a/lily/lily-parser-scheme.cc +++ b/lily/lily-parser-scheme.cc @@ -24,7 +24,7 @@ /* junkme? */ -bool store_locations_global_b; +bool store_locations_global; /* Do not append `!' suffix, since 1st argument is not modified. */ LY_DEFINE (ly_set_point_and_click, "ly:set-point-and-click", @@ -42,7 +42,7 @@ LY_DEFINE (ly_set_point_and_click, "ly:set-point-and-click", scm_module_define (global_lily_module, ly_symbol2scm ("point-and-click"), val); - store_locations_global_b = ly_c_procedure_p (val); + store_locations_global = ly_c_procedure_p (val); return SCM_UNSPECIFIED; } diff --git a/lily/main.cc b/lily/main.cc index c8f0b12d64..225779a68b 100644 --- a/lily/main.cc +++ b/lily/main.cc @@ -41,22 +41,23 @@ Array dump_header_fieldnames_global; String init_name_global; /* Do not calculate and write layout output? */ -bool no_layout_global_b = false; +bool skip_layout_global = false; /* Selected output format. One of tex, ps, scm, as. */ String output_backend_global = "ps"; String output_format_global = "pdf"; +bool is_pango_format_global; /* Current output name. */ String output_name_global; /* Run in safe mode? */ -bool safe_global_b = false; +bool be_safe_global = false; /* Verbose progress indication? */ -bool verbose_global_b = false; +bool be_verbose_global = false; /* Scheme code to execute before parsing, after .scm init This is where -e arguments are appended to. @@ -263,7 +264,7 @@ main_with_guile (void *, int, char **) prepend_load_path (String (prefix_directory[i]) + "/scm"); } - if (verbose_global_b) + if (be_verbose_global) dir_info (stderr); ly_c_init_guile (); @@ -377,6 +378,8 @@ parse_argv (int argc, char **argv) break; case 'b': output_backend_global = option_parser->optional_argument_str0_; + is_pango_format_global = (output_backend_global != "tex" + &&output_backend_global != "texstr"); break; case 'f': @@ -397,13 +400,13 @@ parse_argv (int argc, char **argv) help_b = true; break; case 'V': - verbose_global_b = true; + be_verbose_global = true; break; case 's': - safe_global_b = true; + be_safe_global = true; break; case 'm': - no_layout_global_b = true; + skip_layout_global = true; break; case 'p': make_preview = true; @@ -420,7 +423,7 @@ parse_argv (int argc, char **argv) { identify (stdout); usage (); - if (verbose_global_b) + if (be_verbose_global) dir_info (stdout); exit (0); } diff --git a/lily/music.cc b/lily/music.cc index 5889b8e46e..5183763f8d 100644 --- a/lily/music.cc +++ b/lily/music.cc @@ -214,7 +214,7 @@ Music::internal_get_property (SCM sym) const void Music::internal_set_property (SCM s, SCM v) { - if (internal_type_checking_global_b) + if (do_internal_type_checking_global) if (!type_check_assignment (s, v, ly_symbol2scm ("music-type?"))) abort (); diff --git a/lily/pango-select.cc b/lily/pango-select.cc index 3fa18f2de9..10a7b182cb 100644 --- a/lily/pango-select.cc +++ b/lily/pango-select.cc @@ -43,8 +43,7 @@ properties_to_pango_description (SCM chain, Real text_size) } Real step = robust_scm2double (ly_symbol2scm ("font-size"), 0.0); - Real size = text_size - * pow (2.0, step / 6.0) * point_constant; + Real size = text_size * pow (2.0, step / 6.0); pango_font_description_set_size (description, gint (size * PANGO_SCALE)); @@ -55,8 +54,8 @@ Font_metric * select_pango_font (Output_def *layout, SCM chain) { PangoFontDescription *pfd =properties_to_pango_description (chain, - layout->get_dimension (ly_symbol2scm ("text-font-size"))); - + point_constant * layout->get_dimension (ly_symbol2scm ("text-font-size"))); + Font_metric * fm = all_fonts_global->find_pango_font (pfd); return find_scaled_font (layout, fm, 1.0); @@ -152,9 +151,12 @@ symbols_to_pango_font_description(SCM family, { PangoFontDescription * description = pango_font_description_new (); - String family_str = scm_is_symbol (family) - ? ly_symbol2string (family) - : String("roman"); + String family_str = "roman"; + if (scm_is_symbol (family)) + family_str = ly_symbol2string (family); + else if (scm_is_string (family)) + family_str = ly_scm2string (family); + pango_font_description_set_family (description, family_str.to_str0 ()); pango_font_description_set_style (description, diff --git a/lily/paper-score.cc b/lily/paper-score.cc index 366dba50cc..cab9e14445 100644 --- a/lily/paper-score.cc +++ b/lily/paper-score.cc @@ -62,7 +62,7 @@ Paper_score::calc_breaking () SCM Paper_score::process (String) { - if (verbose_global_b) + if (be_verbose_global) progress_indication (_f ("Element count %d (spanners %d) ", system_->element_count (), system_->spanner_count ())); diff --git a/lily/parser.yy b/lily/parser.yy index 10f2108283..82ff06d3b8 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -530,7 +530,7 @@ embedded_scm: lilypond_header_body: { - $$ = ly_make_anonymous_module (safe_global_b); + $$ = ly_make_anonymous_module (be_safe_global); THIS->lexer_->add_scope ($$); } | lilypond_header_body assignment { @@ -2716,15 +2716,15 @@ property_op_to_music (SCM op) if (grob_sym != SCM_UNDEFINED) { - bool itc = internal_type_checking_global_b; + bool itc = do_internal_type_checking_global; /* UGH. */ bool autobeam = ly_c_equal_p (symbol, ly_symbol2scm ("autoBeamSettings")); if (autobeam) - internal_type_checking_global_b = false; + do_internal_type_checking_global = false; m->set_property ("grob-property", grob_sym); if (autobeam) - internal_type_checking_global_b = itc; + do_internal_type_checking_global = itc; } if (tag == ly_symbol2scm ("poppush")) diff --git a/lily/performance.cc b/lily/performance.cc index 0fde4b3e52..c8052dc0b7 100644 --- a/lily/performance.cc +++ b/lily/performance.cc @@ -51,7 +51,7 @@ Performance::output (Midi_stream& midi_stream) for (int i = 0; i < audio_staffs_.size (); i++) { Audio_staff *s = audio_staffs_[i]; - if (verbose_global_b) + if (be_verbose_global) progress_indication ("[" + to_string (i)) ; /* @@ -74,7 +74,7 @@ Performance::output (Midi_stream& midi_stream) } s->output (midi_stream, channel++); - if (verbose_global_b) + if (be_verbose_global) progress_indication ("]"); } } diff --git a/lily/scm-option.cc b/lily/scm-option.cc index dac63fde44..a316b886e6 100644 --- a/lily/scm-option.cc +++ b/lily/scm-option.cc @@ -47,7 +47,7 @@ bool lily_1_8_compatibility_used = false; /* crash if internally the wrong type is used for a grob property. */ -bool internal_type_checking_global_b; +bool do_internal_type_checking_global; /* @@ -118,7 +118,7 @@ LY_DEFINE (ly_set_option, "ly:set-option", 1, 1, 0, (SCM var, SCM val), else if (var == ly_symbol2scm ("parse-protect" )) parse_protect_global = to_boolean (val); else if (var == ly_symbol2scm ("internal-type-checking")) - internal_type_checking_global_b = to_boolean (val); + do_internal_type_checking_global = to_boolean (val); else if (var == ly_symbol2scm ("old-relative")) { lily_1_8_relative = true; @@ -156,13 +156,13 @@ LY_DEFINE (ly_get_option, "ly:get-option", 1, 0, 0, (SCM var), SCM o = SCM_UNSPECIFIED; if (var == ly_symbol2scm ("safe")) // heavily used; put in front. - o = ly_bool2scm (safe_global_b); + o = ly_bool2scm (be_safe_global); else if (var == ly_symbol2scm ("old-relative-used")) o = ly_bool2scm (lily_1_8_compatibility_used); else if (var == ly_symbol2scm ("old-relative")) o = ly_bool2scm (lily_1_8_relative); else if (var == ly_symbol2scm ("verbose")) - o = ly_bool2scm (verbose_global_b); + o = ly_bool2scm (be_verbose_global); else if ( var == ly_symbol2scm ("resolution")) o = scm_from_int (preview_resolution_global); else diff --git a/lily/spacing-spanner.cc b/lily/spacing-spanner.cc index 505a87ede2..52bcd81032 100644 --- a/lily/spacing-spanner.cc +++ b/lily/spacing-spanner.cc @@ -382,7 +382,7 @@ Spacing_spanner::set_springs (SCM smob) else { global_shortest = find_shortest (me, all); - if (verbose_global_b) + if (be_verbose_global) progress_indication (_f ("Global shortest duration is %s", global_shortest.to_string ()) + "\n"); } prune_loose_columns (me, &all, global_shortest); diff --git a/lily/system.cc b/lily/system.cc index d2b33e8369..6203abff70 100644 --- a/lily/system.cc +++ b/lily/system.cc @@ -145,7 +145,7 @@ System::get_lines () } #endif - if (verbose_global_b) + if (be_verbose_global) progress_indication (_f ("Element count %d.", count + element_count ())); int line_count = broken_intos_.size (); @@ -153,14 +153,14 @@ System::get_lines () for (int i = 0; i < line_count; i++) { - if (verbose_global_b) + if (be_verbose_global) progress_indication ("["); System *system = dynamic_cast (broken_intos_[i]); system->post_processing (); scm_vector_set_x (lines, scm_int2num (i), system->get_line ()); - if (verbose_global_b) + if (be_verbose_global) progress_indication (to_string (i) + "]"); } return lines; @@ -298,7 +298,7 @@ System::pre_processing () for (SCM s = get_property ("all-elements"); scm_is_pair (s); s = scm_cdr (s)) unsmob_grob (scm_car (s))->discretionary_processing (); - if (verbose_global_b) + if (be_verbose_global) progress_indication (_f ("Grob count %d", element_count ())); for (SCM s = get_property ("all-elements"); scm_is_pair (s); s = scm_cdr (s)) diff --git a/lily/text-item.cc b/lily/text-item.cc index 78aecd437f..3bcab30fc9 100644 --- a/lily/text-item.cc +++ b/lily/text-item.cc @@ -36,15 +36,6 @@ Text_interface::interpret_string (SCM layout_smob, String str = ly_scm2string (markup); -#if HAVE_PANGO_FT2 - if (output_backend_global != "tex" - && output_backend_global != "texstr") - { - Font_metric *fm = select_pango_font (layout, props); - return fm->text_stencil (str).smobbed_copy (); - } -#endif - Font_metric *fm = select_encoded_font (layout, props); return fm->text_stencil (str).smobbed_copy(); } diff --git a/ly/paper-defaults.ly b/ly/paper-defaults.ly index 95d6b039fd..e64ef6c8aa 100644 --- a/ly/paper-defaults.ly +++ b/ly/paper-defaults.ly @@ -67,11 +67,11 @@ %% use lmodern in latin1 (cork) flavour if EC is not available. #(define text-font-defaults `((font-encoding . -; cork-lm - Extended-TeX-Font-Encoding---Latin -; ,(if (and (not (ly:kpathsea-find-file "ecrm10.pfa")) -; (ly:kpathsea-find-file "cork-lm.enc")) 'cork-lm 'Extended-TeX-Font-Encoding---Latin) - ) + ,(cond + (tex-backend? 'Extended-TeX-Font-Encoding---Latin) + (else 'latin1))) + ;; add to taste here. + (baseline-skip . 2) (word-space . 0.6))) diff --git a/scm/font.scm b/scm/font.scm index 64a3e37f8f..b6a533dba6 100644 --- a/scm/font.scm +++ b/scm/font.scm @@ -310,34 +310,28 @@ ,(delay (ly:font-load "ectt10")) ,(delay (ly:font-load "ectt12")))))))) -;; (display (make-font-tree 1.0)) - -;; Century Schoolbook fonts file names on Debian/Sid -(define-public (add-century-schoolbook-fonts node factor) - (add-font node - '((font-family . roman) - (font-shape . upright) - (font-series . medium) - (font-encoding . latin1)) - `(,(ly:pt 10.0) . #(,(delay (ly:font-load "uncr8a"))))) - (add-font node - '((font-family . roman) - (font-shape . italic) - (font-series . medium) - (font-encoding . latin1)) - `(,(ly:pt 10.0) . #(,(delay (ly:font-load "uncri8a"))))) - (add-font node - '((font-family . roman) - (font-shape . upright) - (font-series . bold) - (font-encoding . latin1)) - `(,(ly:pt 10.0) . #(,(delay (ly:font-load "uncb8a"))))) - (add-font node - '((font-family . roman) - (font-shape . italic) - (font-series . bold) - (font-encoding . latin1)) - `(,(ly:pt 10.0) . #(,(delay (ly:font-load "uncbi8a")))))) +(define-public (add-pango-fonts node family factor) + (define (add-node shape series) + (add-font node + `((font-family . ,family) + (font-shape . ,shape) + (font-series . ,series) + (font-encoding . latin1) ;; ugh. + ) + + `(,(ly:pt (* factor 12.0)) + . #(,(cons + (ly:pt 12) + (ly:make-pango-description-string + `(((font-family . ,family) + (font-series . ,series) + (font-shape . ,shape))) + (ly:pt 12))))))) + + (add-node 'upright 'medium) + (add-node 'upright 'bold) + (add-node 'italic 'bold) + (add-node 'italic 'medium)) (define-public (make-cmr-tree factor) (let ((n (make-font-tree-node 'font-encoding 'fetaMusic))) @@ -352,7 +346,7 @@ (define-public (make-century-schoolbook-tree factor) (let ((n (make-font-tree-node 'font-encoding 'fetaMusic))) (add-music-fonts n factor) - (add-century-schoolbook-fonts n factor) + (add-pango-fonts n "Century Schoolbook L" factor) n)) (define-public (magstep x) diff --git a/scm/lily.scm b/scm/lily.scm index f763340f34..5b431730e1 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -46,6 +46,9 @@ (define-public point-and-click #f) +(define-public tex-backend? + (memq (ly:output-backend) '("texstr" "tex"))) + (define-public parser #f) (define-public (lilypond-version) diff --git a/scm/paper.scm b/scm/paper.scm index 3f997b0885..cdcebe6908 100644 --- a/scm/paper.scm +++ b/scm/paper.scm @@ -35,7 +35,11 @@ (module-define! m 'text-font-size (* 12 (/ sz (* 20 pt)))) (module-define! m 'outputscale ss) - (module-define! m 'fonts (make-cmr-tree (/ sz (* 20 pt)))) + (module-define! m 'fonts + (if tex-backend? + (make-cmr-tree (/ sz (* 20 pt))) + (make-century-schoolbook-tree + (/ sz (* 20 pt))))) (module-define! m 'staffheight sz) (module-define! m 'staff-space ss) (module-define! m 'staffspace ss) -- 2.39.5