From 5856b3f565bfa6ef87d53b9fa9db7ec961ecf452 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Fri, 13 Aug 2004 15:53:22 +0000 Subject: [PATCH] *** empty log message *** --- ChangeLog | 25 ++++ lily/book-paper-def.cc | 2 +- lily/dynamic-engraver.cc | 7 ++ lily/font-metric.cc | 4 +- lily/font-select.cc | 85 +++++++------ ...font-metric.hh => modified-font-metric.hh} | 11 +- lily/lily-parser.cc | 5 +- lily/modified-font-metric.cc | 116 ++++++++++-------- lily/paper-book.cc | 3 +- lily/parser.yy | 2 +- lily/script-engraver.cc | 12 ++ lily/text-item.cc | 63 ++++++---- ly/book-paper-defaults.ly | 13 +- ly/declarations-init.ly | 63 +++++----- scm/encoding.scm | 12 +- scm/framework-ps.scm | 58 ++++++--- scm/lily.scm | 34 ++--- scripts/ps2png.py | 7 +- tex/latin1.enc | 10 +- 19 files changed, 312 insertions(+), 220 deletions(-) rename lily/include/{scaled-font-metric.hh => modified-font-metric.hh} (87%) diff --git a/ChangeLog b/ChangeLog index 097dd6d9d7..488fa46b0e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,28 @@ +2004-08-13 Jan Nieuwenhuizen + + * lily.scm: Mark un-internationlised user messages (with FIXME). + + * lily/include/modified-font-metric.hh (struct + Modified_font_metric): New file. (WAS: incorrectly named + scaled-font-metric.hh ?) + + * lily/include/scaled-font-metric.hh: Remove. + + * lily/text-item.cc (interpret_string): Identify and document + input-encoding problem. + + * lily/paper-book.cc (pages): Do not use `paper' as variable name + for a Bookpaper. + + * tex/latin1.enc: Replace /minus with /hyphen. WL says that's the + latin1 name. + + * scm/encoding.scm: For latin1 (input-)encoding, use + latin1. (Cork.enc is NOT latin1 -- see man latin1). + + * ly/book-paper-defaults.ly: Add a comment about suspicious TeX + inputencoding. + 2004-08-12 Heikki Junes * Documentation/topdocs/INSTALL.html: fixes. diff --git a/lily/book-paper-def.cc b/lily/book-paper-def.cc index 0dfe5fb151..d2ca7103f0 100644 --- a/lily/book-paper-def.cc +++ b/lily/book-paper-def.cc @@ -10,7 +10,7 @@ #include "font-metric.hh" #include "ly-module.hh" #include "output-def.hh" -#include "scaled-font-metric.hh" +#include "modified-font-metric.hh" #include "virtual-font-metric.hh" Real diff --git a/lily/dynamic-engraver.cc b/lily/dynamic-engraver.cc index 16a0a75f56..95e2c7df29 100644 --- a/lily/dynamic-engraver.cc +++ b/lily/dynamic-engraver.cc @@ -313,6 +313,13 @@ Dynamic_engraver::finalize () void Dynamic_engraver::typeset_all () { + /* Simplistic slur collision handling. This fixes simple collisions + like + + a\p( b) + + which are unacceptable, but it most probably breaks for more + interesting cases. Maybe make a new colission engraver. */ if (finished_line_spanner_ && slur_ && get_slur_dir (slur_) == get_grob_direction (finished_line_spanner_)) { diff --git a/lily/font-metric.cc b/lily/font-metric.cc index 9af80e5738..6c61e77fb3 100644 --- a/lily/font-metric.cc +++ b/lily/font-metric.cc @@ -6,12 +6,12 @@ (c) 1999--2004 Han-Wen Nienhuys Mats Bengtsson (the ugly TeX parsing in text_dimension) - */ +*/ #include #include -#include "scaled-font-metric.hh" +#include "modified-font-metric.hh" #include "virtual-methods.hh" #include "warn.hh" #include "stencil.hh" diff --git a/lily/font-select.cc b/lily/font-select.cc index ef6ab87107..f04da901b3 100644 --- a/lily/font-select.cc +++ b/lily/font-select.cc @@ -16,43 +16,47 @@ #include "warn.hh" LY_DEFINE (ly_paper_get_font, "ly:paper-get-font", 2, 0, 0, - (SCM paper, SCM chain), + (SCM paper_smob, SCM chain), "Return a font metric satisfying the font-qualifiers " "in the alist chain @var{chain}.\n" - "(An alist chain is a list of alists, containing grob properties).\n") + "(An alist chain is a list of alists, " + "containing grob properties).\n") { - Output_def *pap = unsmob_output_def (paper); - SCM_ASSERT_TYPE (pap, paper, SCM_ARG1, __FUNCTION__, "paper definition"); + Output_def *paper = unsmob_output_def (paper_smob); + SCM_ASSERT_TYPE (paper, paper_smob, SCM_ARG1, + __FUNCTION__, "paper definition"); - Font_metric *fm = select_font (pap, chain); + Font_metric *fm = select_font (paper, chain); return fm->self_scm (); } LY_DEFINE (ly_paper_get_number, "ly:paper-get-number", 2, 0, 0, - (SCM paper, SCM name), + (SCM paper_smob, SCM name), "Return the paper variable @var{name}.") { - Output_def *pap = unsmob_output_def (paper); - SCM_ASSERT_TYPE (pap, paper, SCM_ARG1, __FUNCTION__, "paper definition"); - return scm_make_real (pap->get_dimension (name)); + Output_def *paper = unsmob_output_def (paper_smob); + SCM_ASSERT_TYPE (paper, paper_smob, SCM_ARG1, + __FUNCTION__, "paper definition"); + return scm_make_real (paper->get_dimension (name)); } bool wild_compare (SCM field_val, SCM val) { - return (val == SCM_BOOL_F || field_val == ly_symbol2scm ("*") || field_val == val); + return (val == SCM_BOOL_F + || field_val == ly_symbol2scm ("*") + || field_val == val); } - /* TODO: this triggers a great number of font-loads (feta11 upto parmesan23). We could make a Delayed_load_font_metric for which the design size is specced in advance. */ -Font_metric* -get_font_by_design_size (Output_def* paper, Real requested, - SCM font_vector, SCM input_encoding_name) +Font_metric * +get_font_by_design_size (Output_def *paper, Real requested, + SCM font_vector, SCM input_encoding) { int n = SCM_VECTOR_LENGTH (font_vector); Real size = 1e6; @@ -66,50 +70,45 @@ get_font_by_design_size (Output_def* paper, Real requested, size = fm->design_size (); if (size > requested) - break ; + break; last_size = size; } if (i == n) - { - i = n-1; - } + i = n - 1; else if (i > 0) { if ((requested / last_size) < (size / requested)) { - i -- ; + i--; size = last_size; } } - Font_metric *fm = unsmob_metrics (scm_force (SCM_VECTOR_REF (font_vector, i))); - return - find_scaled_font (paper, fm, requested / size, input_encoding_name); + Font_metric *fm = unsmob_metrics (scm_force (SCM_VECTOR_REF (font_vector, + i))); + return find_scaled_font (paper, fm, requested / size, input_encoding); } - Font_metric* -get_font_by_mag_step (Output_def* paper, Real requested_step, - SCM font_vector, Real default_size, SCM input_encoding_name) +get_font_by_mag_step (Output_def *paper, Real requested_step, + SCM font_vector, Real default_size, + SCM input_encoding) { - return get_font_by_design_size (paper, - default_size * pow (2.0, requested_step / 6.0), - font_vector, input_encoding_name); + return get_font_by_design_size (paper, default_size + * pow (2.0, requested_step / 6.0), + font_vector, input_encoding); } - - SCM properties_to_font_size_family (SCM fonts, SCM alist_chain) { return scm_call_2 (ly_scheme_function ("lookup-font"), fonts, alist_chain); } - Font_metric * -select_encoded_font (Output_def *paper, SCM chain, SCM encoding_name) +select_encoded_font (Output_def *paper, SCM chain, SCM input_encoding) { SCM name = ly_assoc_chain (ly_symbol2scm ("font-name"), chain); @@ -119,18 +118,17 @@ select_encoded_font (Output_def *paper, SCM chain, SCM encoding_name) name = properties_to_font_size_family (fonts, chain); } else - name = ly_cdr (name); + name = ly_cdr (name); if (ly_c_string_p (name)) { SCM mag = ly_assoc_chain (ly_symbol2scm ("font-magnification"), chain); - - Real rmag = ly_c_pair_p (mag) ? robust_scm2double (ly_cdr (mag), 1.0) : 1; - - Font_metric * fm = all_fonts_global->find_font (ly_scm2string (name)); - - - return find_scaled_font (paper, fm, rmag, encoding_name); + Real rmag = (ly_c_pair_p (mag) + ? robust_scm2double (ly_cdr (mag), 1.0) + : 1); + Font_metric *fm = all_fonts_global->find_font (ly_scm2string (name)); + + return find_scaled_font (paper, fm, rmag, input_encoding); } else if (scm_instance_p (name)) { @@ -138,16 +136,15 @@ select_encoded_font (Output_def *paper, SCM chain, SCM encoding_name) SCM vec = scm_slot_ref (name, ly_symbol2scm ("size-vector")); SCM font_size = ly_assoc_chain (ly_symbol2scm ("font-size"), chain); - Real req = 0.0; + Real req = 0; if (ly_c_pair_p (font_size)) req = ly_scm2double (ly_cdr (font_size)); - return get_font_by_mag_step (paper, req, - vec, ly_scm2double (base_size), encoding_name); + return get_font_by_mag_step (paper, req, vec, ly_scm2double (base_size), + input_encoding); } assert (0); - return 0; } diff --git a/lily/include/scaled-font-metric.hh b/lily/include/modified-font-metric.hh similarity index 87% rename from lily/include/scaled-font-metric.hh rename to lily/include/modified-font-metric.hh index 5c9a04818b..9f264e744d 100644 --- a/lily/include/scaled-font-metric.hh +++ b/lily/include/modified-font-metric.hh @@ -1,14 +1,13 @@ /* - scaled-font-metric.hh -- declare Font_metric + modified-font-metric.hh -- declare Font_metric source file of the GNU LilyPond music typesetter (c) 1999--2004 Han-Wen Nienhuys - - */ +*/ -#ifndef SCALED_FONT_METRIC_HH -#define SCALED_FONT_METRIC_HH +#ifndef MODIFIED_FONT_METRIC_HH +#define MODIFIED_FONT_METRIC_HH #include "font-metric.hh" @@ -49,4 +48,4 @@ protected: Box tex_kludge (String) const; }; -#endif /* SCALED_FONT_METRIC_HH */ +#endif /* MODIFIED_FONT_METRIC_HH */ diff --git a/lily/lily-parser.cc b/lily/lily-parser.cc index 3b106602b1..c489c356f2 100644 --- a/lily/lily-parser.cc +++ b/lily/lily-parser.cc @@ -29,7 +29,7 @@ Lily_parser::Lily_parser (Sources *sources) score_count_ = 0; lexer_ = 0; sources_ = sources; - default_duration_ = Duration (2,0); + default_duration_ = Duration (2, 0); error_level_ = 0; last_beam_start_ = SCM_EOL; @@ -118,7 +118,10 @@ Lily_parser::parse_file (String init, String name, String out_name) void Lily_parser::parse_string (String ly_code) { +#if 0 SCM parent_prot = lexer_ ? lexer_->self_scm () : SCM_EOL; +#endif + Lily_lexer * parent = lexer_; lexer_ = (parent == 0 ? new Lily_lexer (sources_) : new Lily_lexer (*parent)); diff --git a/lily/modified-font-metric.cc b/lily/modified-font-metric.cc index 547756b1f4..875c87ef0c 100644 --- a/lily/modified-font-metric.cc +++ b/lily/modified-font-metric.cc @@ -1,27 +1,35 @@ /* - scaled-font-metric.cc -- declare Modified_font_metric + modified-font-metric.cc -- declare Modified_font_metric source file of the GNU LilyPond music typesetter (c) 1999--2004 Han-Wen Nienhuys - - */ +*/ #include #include "warn.hh" -#include "scaled-font-metric.hh" +#include "modified-font-metric.hh" #include "string.hh" #include "stencil.hh" -Modified_font_metric::Modified_font_metric (String coding, Font_metric* m, Real magn) +Modified_font_metric::Modified_font_metric (String input_encoding, + Font_metric *m, Real magn) { + /* UGR, FIXME: + + THIS.coding_scheme == input encoding. + ORIG.coding_scheme () == font_encoding. + + encoding is hairy enough by itself, should fix treacherous naming. */ + + coding_scheme_ = input_encoding; + coding_vector_ = SCM_EOL; coding_mapping_ = SCM_EOL; coding_table_ = SCM_EOL; coding_description_ = SCM_EOL; - coding_scheme_ = coding; magnification_ = magn; SCM desc = m->description_; @@ -37,8 +45,9 @@ Modified_font_metric::Modified_font_metric (String coding, Font_metric* m, Real && coding_scheme_ != "ASCII" && coding_scheme_ != orig_->coding_scheme ()) { - coding_vector_ = scm_call_1 (ly_scheme_function ("get-coding-vector"), - scm_makfrom0str (coding_scheme_.to_str0 ())); + coding_vector_ + = scm_call_1 (ly_scheme_function ("get-coding-vector"), + scm_makfrom0str (coding_scheme_.to_str0 ())); if (!ly_c_vector_p (coding_vector_)) { @@ -46,29 +55,35 @@ Modified_font_metric::Modified_font_metric (String coding, Font_metric* m, Real coding_vector_ = scm_c_make_vector (256, ly_symbol2scm (".notdef")); } - - coding_table_ = scm_call_1 (ly_scheme_function ("get-coding-table"), - scm_makfrom0str (orig_->coding_scheme ().to_str0 ())); - - coding_mapping_ = scm_call_2 (ly_scheme_function ("make-encoding-mapping"), - coding_vector_, - coding_table_); - - coding_description_= SCM_EOL; - coding_description_ = scm_acons (ly_symbol2scm ("input-name"), - scm_makfrom0str (coding_scheme_.to_str0 ()), - coding_description_); - coding_description_ = scm_acons (ly_symbol2scm ("input-vector"), - coding_vector_, coding_description_); - coding_description_ = scm_acons (ly_symbol2scm ("output-name"), - scm_makfrom0str (orig_->coding_scheme ().to_str0 ()), - coding_description_); - coding_description_ = scm_acons (ly_symbol2scm ("output-table"), - coding_table_, - coding_description_); - coding_description_ = scm_acons (ly_symbol2scm ("char-mapping"), - coding_mapping_, - coding_description_); + coding_table_ + = scm_call_1 (ly_scheme_function ("get-coding-table"), + scm_makfrom0str (orig_->coding_scheme ().to_str0 ())); + + coding_mapping_ + = scm_call_2 (ly_scheme_function ("make-encoding-mapping"), + coding_vector_, + coding_table_); + + coding_description_ = SCM_EOL; + coding_description_ + = scm_acons (ly_symbol2scm ("input-name"), + scm_makfrom0str (coding_scheme_.to_str0 ()), + coding_description_); + coding_description_ + = scm_acons (ly_symbol2scm ("input-vector"), + coding_vector_, coding_description_); + coding_description_ + = scm_acons (ly_symbol2scm ("output-name"), + scm_makfrom0str (orig_->coding_scheme ().to_str0 ()), + coding_description_); + coding_description_ + = scm_acons (ly_symbol2scm ("output-table"), + coding_table_, + coding_description_); + coding_description_ + = scm_acons (ly_symbol2scm ("char-mapping"), + coding_mapping_, + coding_description_); } } @@ -89,7 +104,8 @@ LY_DEFINE (ly_font_encoding_alist, "ly:font-encoding-alist", } SCM -Modified_font_metric::make_scaled_font_metric (SCM coding, Font_metric *m, Real s) +Modified_font_metric::make_scaled_font_metric (SCM coding, + Font_metric *m, Real s) { /* UGH. @@ -167,43 +183,39 @@ Modified_font_metric::derived_mark () const scm_gc_mark (coding_mapping_); } +/* TODO: put this klutchness behind ly:option switch. */ Box Modified_font_metric::tex_kludge (String text) const { Interval ydims; - Real w=0.0; - - /* - TODO: put this klutchness behind ly:option switch. - */ + Real w = 0; for (int i = 0; i < text.length (); i++) { switch (text[i]) { case '\\': - // accent marks use width of base letter + /* Accent marks use width of base letter */ if (i +1 < text.length ()) { - if (text[i+1]=='\'' || text[i+1]=='`' || text[i+1]=='"' || - text[i+1]=='^') + if (text[i+1]=='\'' || text[i+1]=='`' || text[i+1]=='"' + || text[i+1]=='^') { i++; break; } - // for string width \\ is a \ and \_ is a _. + /* For string width \\ is a \ and \_ is a _. */ if (text[i+1]=='\\' || text[i+1]=='_') - { break; - } } for (i++; (i < text.length ()) && !isspace (text[i]) && text[i]!='{' && text[i]!='}'; i++) ; - // ugh. - i--; // Compensate for the increment in the outer loop! + /* Compensate for the auto-increment in the outer loop. */ + i--; break; + case '{': // Skip '{' and '}' case '}': break; @@ -211,7 +223,7 @@ Modified_font_metric::tex_kludge (String text) const default: Box b = get_ascii_char ((unsigned char)text[i]); - // Ugh, use the width of 'x' for unknown characters + /* Use the width of 'x' for unknown characters */ if (b[X_AXIS].length () == 0) b = get_ascii_char ((unsigned char)'x'); @@ -232,9 +244,7 @@ Modified_font_metric::text_dimension (String text) { Box b; if (coding_scheme_ == "TeX") - { - b = tex_kludge (text); - } + b = tex_kludge (text); else if (coding_scheme_ == "ASCII" || coding_scheme_ == "" || coding_scheme_ == orig_->coding_scheme ()) @@ -274,13 +284,12 @@ Modified_font_metric::text_dimension (String text) int idx = orig_->name_to_index (chars); if (idx >= 0) - { - char_box = orig_->get_indexed_char (idx); - } + char_box = orig_->get_indexed_char (idx); char_box.scale (magnification_); if (!char_box[X_AXIS].is_empty ()) - w += char_box[X_AXIS][RIGHT]; // length ? + /* length ? */ + w += char_box[X_AXIS][RIGHT]; ydims.unite (char_box[Y_AXIS]); } @@ -288,7 +297,6 @@ Modified_font_metric::text_dimension (String text) if (ydims.is_empty ()) ydims = Interval (0, 0); - b = Box (Interval (0, w), ydims); } diff --git a/lily/paper-book.cc b/lily/paper-book.cc index 6121bf8946..2f4ba4d821 100644 --- a/lily/paper-book.cc +++ b/lily/paper-book.cc @@ -401,8 +401,7 @@ Paper_book::pages () return pages_; pages_ = SCM_EOL; - Output_def *paper = bookpaper_; - SCM proc = paper->c_variable ("page-breaking"); + SCM proc = bookpaper_->c_variable ("page-breaking"); pages_ = scm_apply_0 (proc, scm_list_2 (lines (), self_scm ())); return pages_; } diff --git a/lily/parser.yy b/lily/parser.yy index 0c9f9e5440..085aca71c6 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -753,7 +753,7 @@ output_def_head: THIS->lexer_->add_scope (p->scope_); } | PAPER { - Output_def* p = get_paper (THIS); + Output_def *p = get_paper (THIS); if (p->parent_) THIS->lexer_->add_scope (p->parent_->scope_); diff --git a/lily/script-engraver.cc b/lily/script-engraver.cc index 4550fc7a3b..45fbb9d71c 100644 --- a/lily/script-engraver.cc +++ b/lily/script-engraver.cc @@ -214,6 +214,18 @@ Script_engraver::stop_translation_timestep () ::quantised_position_proc, Y_AXIS); sc->set_property ("staff-padding", SCM_EOL); } + + /* Simplistic slur collision handling. This fixes simple collisions + like + + a_\upbow( b) + + but it most probably breaks for more interesting cases. + Maybe make a new colission engraver. + + + Assume that a SCRIPT that should collide with SLUR does not + have a negative priority. */ SCM priority = sc->get_property ("script-priority"); if (robust_scm2int (priority, 0) >= 0 && slur_ diff --git a/lily/text-item.cc b/lily/text-item.cc index 10fdc67ec0..b88ad73280 100644 --- a/lily/text-item.cc +++ b/lily/text-item.cc @@ -4,8 +4,9 @@ source file of the GNU LilyPond music typesetter (c) 1998--2004 Han-Wen Nienhuys - Jan Nieuwenhuizen - */ + Jan Nieuwenhuizen +*/ + #include #include "warn.hh" @@ -14,31 +15,43 @@ #include "font-interface.hh" #include "virtual-font-metric.hh" #include "output-def.hh" -#include "scaled-font-metric.hh" +#include "modified-font-metric.hh" #include "ly-module.hh" MAKE_SCHEME_CALLBACK (Text_item, interpret_string, 4) SCM -Text_item::interpret_string (SCM paper, SCM props, SCM encoding, SCM markup) +Text_item::interpret_string (SCM paper_smob, + SCM props, SCM input_encoding, SCM markup) { - Output_def *pap = unsmob_output_def (paper); + Output_def *paper = unsmob_output_def (paper_smob); - SCM_ASSERT_TYPE(pap, paper, SCM_ARG1, __FUNCTION__, "Paper definition"); - SCM_ASSERT_TYPE(ly_c_string_p (markup), markup, SCM_ARG3, __FUNCTION__, "string"); - SCM_ASSERT_TYPE(encoding == SCM_EOL - || ly_c_symbol_p (encoding), encoding, SCM_ARG2, __FUNCTION__, "symbol"); + SCM_ASSERT_TYPE (paper, paper_smob, SCM_ARG1, + __FUNCTION__, "Paper definition"); + SCM_ASSERT_TYPE (ly_c_string_p (markup), markup, SCM_ARG3, + __FUNCTION__, "string"); + SCM_ASSERT_TYPE (input_encoding == SCM_EOL || ly_c_symbol_p (input_encoding), + input_encoding, SCM_ARG2, __FUNCTION__, "symbol"); String str = ly_scm2string (markup); - if (!ly_c_symbol_p (encoding)) + if (!ly_c_symbol_p (input_encoding)) { - SCM var = ly_module_lookup (pap->scope_, + /* FIXME: input_encoding is set in *book*_paper + + Options include: + + 1. produce a bookpaper from a paper. + 2. add BOOKPAPER parameter to all callers, ie, all MARKUPs. */ + + programming_error ("FIXME: looking up input_encoding in paper"); + programming_error ("as a workaround, set inputencoding in your \\paper block"); + SCM var = ly_module_lookup (paper->scope_, ly_symbol2scm ("inputencoding")); if (var != SCM_BOOL_F) - encoding = scm_variable_ref (var); + input_encoding = scm_variable_ref (var); } - Font_metric *fm = select_encoded_font (pap, props, encoding); + Font_metric *fm = select_encoded_font (paper, props, input_encoding); SCM lst = SCM_EOL; Box b; @@ -63,10 +76,10 @@ Text_item::interpret_string (SCM paper, SCM props, SCM encoding, SCM markup) MAKE_SCHEME_CALLBACK (Text_item, interpret_markup, 3) SCM -Text_item::interpret_markup (SCM paper, SCM props, SCM markup) +Text_item::interpret_markup (SCM paper_smob, SCM props, SCM markup) { if (ly_c_string_p (markup)) - return interpret_string (paper, props, SCM_EOL, markup); + return interpret_string (paper_smob, props, SCM_EOL, markup); else if (ly_c_pair_p (markup)) { SCM func = ly_car (markup); @@ -74,7 +87,7 @@ Text_item::interpret_markup (SCM paper, SCM props, SCM markup) if (!markup_p (markup)) programming_error ("Markup head has no markup signature."); - return scm_apply_2 (func, paper, props, args); + return scm_apply_2 (func, paper_smob, props, args); } return SCM_EOL; } @@ -90,22 +103,20 @@ Text_item::print (SCM grob) return interpret_markup (me->get_paper ()->self_scm (), chain, t); } - -/* - Ugh. Duplicated from Scheme. - */ +/* Ugh. Duplicated from Scheme. */ bool Text_item::markup_p (SCM x) { - return - ly_c_string_p (x) || - (ly_c_pair_p (x) - && SCM_BOOL_F != scm_object_property (ly_car (x), ly_symbol2scm ("markup-signature"))); + return (ly_c_string_p (x) + || (ly_c_pair_p (x) + && SCM_BOOL_F + != scm_object_property (ly_car (x), + ly_symbol2scm ("markup-signature")))); } ADD_INTERFACE (Text_item,"text-interface", - "A scheme markup text, see @usermanref{Text-markup}.", - "text baseline-skip word-space"); + "A scheme markup text, see @usermanref{Text-markup}.", + "text baseline-skip word-space"); diff --git a/ly/book-paper-defaults.ly b/ly/book-paper-defaults.ly index 6a415e5b11..a3d1ced8bd 100644 --- a/ly/book-paper-defaults.ly +++ b/ly/book-paper-defaults.ly @@ -7,11 +7,16 @@ pt = #(/ in 72.27) cm = #(* 10 mm) - inputencoding = #"TeX" + %% This is weird; `everyone' uses LATIN1? How does I select TeX + %% input encoding in EMACS? -- jcn + %%%%inputencoding = #"TeX" + inputencoding = #"latin1" + printpagenumber = ##t - % - % 20pt staff, 5 pt = 1.75 mm - % + + %% + %% 20pt staff, 5 pt = 1.75 mm + %% outputscale = #1.7573 diff --git a/ly/declarations-init.ly b/ly/declarations-init.ly index 1ffa23fe45..ab2785d6c5 100644 --- a/ly/declarations-init.ly +++ b/ly/declarations-init.ly @@ -1,12 +1,18 @@ +\version "2.3.8" + +%% < 1.8 compatibility switch #(ly:set-option 'old-relative) -\version "2.3.8" +%% named durations breve = #(ly:make-duration -1 0) longa = #(ly:make-duration -2 0 ) maxima = #(ly:make-duration -3 0) \include "music-functions-init.ly" -\include "nederlands.ly" % dutch + +%% default note names are dutch +\include "nederlands.ly" + \include "drumpitch-init.ly" \include "chord-modifiers-init.ly" \include "script-init.ly" @@ -20,46 +26,41 @@ start = -1 stop = 1 smaller = -1 bigger = 1 -center=0 - -%{ - -should also set allowBeamBreak, but how to do it "portably"? (ie. also -working with lyric sections) +center = 0 -try \once \set Score.allowBeamBreak = ##t - -%} +%% FIXME +%% should also set allowBeamBreak, but how to do it "portably"? (ie. also +%% working with lyric sections) +%% +%% try \once \set Score.allowBeamBreak = ##t %% rather name \newline, \newpage ? break = #(make-event-chord (list (make-penalty-music -10001 0))) noBreak = #(make-event-chord (list (make-penalty-music 10001 0))) pageBreak = #(make-event-chord (list (make-penalty-music -10001 -10001))) -pagebreak = \pageBreak % ugh. noPageBreak = #(make-event-chord (list (make-penalty-music 0 10001))) -noPagebreak = \noPageBreak % ugh + +%% why these defines? +pagebreak = \pageBreak +noPagebreak = \noPageBreak noBeam = #(make-music 'BeamForbidEvent) pipeSymbol = #(make-music 'BarCheck) -foo = { \pageBreak } +foo = { \pageBreak } \include "scale-definitions-init.ly" - melisma = #(make-span-event 'ManualMelismaEvent START) melismaEnd = #(make-span-event 'ManualMelismaEvent STOP) \include "grace-init.ly" - -% ugh \include "midi-init.ly" - \include "book-paper-defaults.ly" \paper { - mm = #(ly:output-def-lookup $defaultbookpaper 'mm) - unit = #(ly:output-def-lookup $defaultbookpaper 'unit) + mm = #(ly:output-def-lookup $defaultbookpaper 'mm) + unit = #(ly:output-def-lookup $defaultbookpaper 'unit) in = #(* 25.4 mm) pt = #(/ in 72.27) @@ -73,27 +74,25 @@ melismaEnd = #(make-span-event 'ManualMelismaEvent STOP) partCombineListener = \paper { - \context { - \Voice - \consists Note_heads_engraver - \consists Rest_engraver - \type "Recording_group_engraver" - recordEventSequence = #notice-the-events-for-pc - } - \context { \Score skipTypesetting = ##t } + \context { + \Voice + \consists Note_heads_engraver + \consists Rest_engraver + \type "Recording_group_engraver" + recordEventSequence = #notice-the-events-for-pc + } + \context { \Score skipTypesetting = ##t } } #(set-part-combine-listener partCombineListener) \include "dynamic-scripts-init.ly" \include "spanners-init.ly" - \include "property-init.ly" -%% reset default duration -unusedEntry = { c4 } +setDefaultDurationToQuarter = { c4 } -%% must have size argument for GUILE 1.6 compat. +%% MAKE-HASH-TABLE in GUILE 1.6 takes mandatory size parameter. #(define musicQuotes (make-hash-table 29)) #(define toplevel-book-handler ly:parser-print-book) diff --git a/scm/encoding.scm b/scm/encoding.scm index 6332a06884..9c2b9906f3 100644 --- a/scm/encoding.scm +++ b/scm/encoding.scm @@ -74,7 +74,7 @@ vector of symbols." (cons (cdr x) (delay (get-coding-from-file (cdr x)))))) '( - ;; teTeX + ;; teTeX font (output) encodings ("TeX-typewriter-text" . "09fbbfac.enc") ;; cmtt10 ("TeX-math-symbols" . "10037936.enc") ;; cmbsy ("ASCII-caps-and-digits" . "1b6d048e.enc") ;; cminch @@ -84,15 +84,15 @@ vector of symbols." ("TeX-text-without-f-ligatures" . "0ef0afca.enc") ("Extended-TeX-Font-Encoding---Latin" . "tex256.enc") ("AdobeStandardEncoding" . "8a.enc") - - ;; aliases ("T1" . "tex256.enc") ("adobe" . "8a.enc") - ;;("latin1" . "latin1.enc") - ("latin1" . "cork.enc") ("ec" . "EC.enc") - ;; LilyPond. + ;; input encodings + ("latin1" . "latin1.enc") + ("cork" . "cork.enc") + + ;; LilyPond FETA music font ("fetaBraces" . "feta-braces-a.enc") ("fetaNumber" . "feta-nummer10.enc") ("fetaMusic" . "feta20.enc") diff --git a/scm/framework-ps.scm b/scm/framework-ps.scm index 9d7045fd79..5edbb4be20 100644 --- a/scm/framework-ps.scm +++ b/scm/framework-ps.scm @@ -14,6 +14,13 @@ (srfi srfi-13) (lily)) +(define (stderr string . rest) + (apply format (cons (current-error-port) (cons string rest))) + (force-output (current-error-port))) + +;;(define pdebug stderr) +(define (pdebug . rest) #f) + (define mm-to-bigpoint (/ 72 25.4)) @@ -44,21 +51,19 @@ (pfas (map (lambda (x) - (let* - ((aname (string-append x ".pfa")) - (apath (ly:kpathsea-expand-path aname)) - - (bpath (if (not apath) - (ly:kpathsea-expand-path (string-append x ".pfb")) - #f))) - - - (cond - (apath (ly:gulp-file apath)) - (bpath (ly:pfb->pfa bpath)) - (else - (ly:warn "Can't find PFA font ~S" x) - "")))) + (let* ((aname (string-append x ".pfa")) + (apath (ly:kpathsea-expand-path aname)) + + (bpath (if (not apath) + (ly:kpathsea-expand-path + (string-append x ".pfb")) + #f))) + (cond + (apath (ly:gulp-file apath)) + (bpath (ly:pfb->pfa bpath)) + (else + (ly:warn "Can't find PFA font ~S" x) + "")))) (filter string? font-names)))) (string-join pfas "\n"))) @@ -95,6 +100,15 @@ (ops (ly:output-def-lookup bookpaper 'outputscale)) (scaling (* ops magnification designsize))) + ;; debugging: [output]encoding is broken + ;; found so far: coding-alist is empty! + (pdebug "font: ~S\n" font) + (pdebug "fontname: ~S\n" fontname) + (pdebug "input-encoding:~S\n" input-encoding) + (pdebug "font-encoding:~S\n" font-encoding) + + (pdebug "coding-alist:~S\n" coding-alist) + (string-append (define-font plain fontname scaling) (if (equal? input-encoding font-encoding) @@ -112,6 +126,7 @@ (encodings (uniq-list (sort-list (filter string? encoding-list) stringstring (ly:output-def-lookup paper ly-key)) " def \n")) (string-append - "/lily-output-units " (number->string mm-to-bigpoint) " def %% milimeter \n" + "/lily-output-units " (number->string mm-to-bigpoint) " def %% milimeter \n" (output-entry "staff-line-thickness" 'linethickness) (output-entry "line-width" 'linewidth) (output-entry "paper-size" 'papersize) @@ -157,7 +172,8 @@ (define (eps-header bookpaper bbox) (string-append "%!PS-Adobe-2.0 EPSF-2.0\n" "%%Creator: creator time-stamp\n" - "%%BoundingBox: " (string-join (map number->string bbox) " ") "\n" + "%%BoundingBox: " + (string-join (map number->string bbox) " ") "\n" "%%EndComments\n")) (define (page-header bookpaper page-count) @@ -165,7 +181,8 @@ "%%Creator: creator time-stamp\n" "%%Pages: " (number->string page-count) "\n" "%%PageOrder: Ascend\n" - "%%DocumentPaperSizes: " (ly:output-def-lookup bookpaper 'papersize) "\n")) + "%%DocumentPaperSizes: " + (ly:output-def-lookup bookpaper 'papersize) "\n")) (define (preamble bookpaper) (list @@ -199,7 +216,8 @@ (systems (ly:paper-book-lines book)) (scale (ly:output-def-lookup bookpaper 'outputscale )) (titles (take-while ly:paper-system-title? systems)) - (non-title (find (lambda (x) (not (ly:paper-system-title? x))) systems)) + (non-title (find (lambda (x) + (not (ly:paper-system-title? x))) systems)) (dump-me (stack-stencils Y DOWN 0.0 (map ly:paper-system-stencil @@ -225,6 +243,7 @@ (string-append "0 0 start-system { " "set-ps-scale-to-lily-scale " "\n")) + (ly:outputter-dump-stencil outputter dump-me) (ly:outputter-dump-string outputter "} stop-system\n%%Trailer\n%%EOF\n"))) @@ -252,4 +271,3 @@ (define-public (convert-to-ps book name) #t) - diff --git a/scm/lily.scm b/scm/lily.scm index 07d1146b9f..ac1f05c374 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -333,7 +333,8 @@ L1 is copied, L2 not. (define-public (write-me message x) - "Return X. Display MESSAGE and write X. Handy for debugging, possibly turned off." + "Return X. Display MESSAGE and write X. Handy for debugging, +possibly turned off." (display message) (write x) (newline) x) ;; x) @@ -554,24 +555,21 @@ L1 is copied, L2 not. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define-public (postscript->pdf papersize name) - (let* - ((cmd (string-append "ps2pdf -sPAPERSIZE=" papersize - " " - name)) - (output-name (regexp-substitute/global #f "\\.ps" name 'pre ".pdf" 'post))) + (let* ((cmd (string-append "ps2pdf -sPAPERSIZE=" papersize " " name)) + (output-name + (regexp-substitute/global #f "\\.ps" name 'pre ".pdf" 'post))) + + (newline) + ;; FIXME: user message: should be translated + (display (format "Converting to ~s..." output-name)) + (newline) + (if (ly:get-option 'verbose) + ;; FIXME: user message: should be translated + (display (format "Invoking ~s..." cmd))) - (display - (string-append - "Converting to " output-name "\n")) - - (if (ly:get-option 'verbose) - (display (format "Invoking ~S" cmd))) - (system cmd))) - - (define-public (postscript->png resolution name) (let ((cmd (string-append @@ -584,7 +582,10 @@ L1 is copied, L2 not. " ") name))) (if (ly:get-option 'verbose) - (display (format "Invoking `~S'\n" cmd))) + ;; FIXME: user message: should be translated + (begin + (display (format "Invoking ~s..." cmd)) + (newline))) (system cmd))) (define-public (lilypond-main files) @@ -601,6 +602,7 @@ L1 is copied, L2 not. (if (pair? failed) (begin (display + ;; FIXME: user message: should be translated (string-append "\n *** Failed files: " (string-join failed) "\n")) (exit 1)) (exit 0)))) diff --git a/scripts/ps2png.py b/scripts/ps2png.py index eb1ccedc5b..5a1a969183 100644 --- a/scripts/ps2png.py +++ b/scripts/ps2png.py @@ -66,6 +66,7 @@ for opt in options: verbose_p = 1 for f in files: - out = ly.make_ps_images (f, - resolution = preview_resolution) - sys.stderr.write (_("Written `%s'\n" % out )) + out = ly.make_ps_images (f, resolution = preview_resolution) + ## FIXME: silly message containing %d + sys.stderr.write (_ ("Wrote `%s'" % out)) + sys.stderr.write ('\n') diff --git a/tex/latin1.enc b/tex/latin1.enc index 5776d009cc..01da1acc01 100644 --- a/tex/latin1.enc +++ b/tex/latin1.enc @@ -1,6 +1,12 @@ %! % Automatically generated by the Ogonkify package -% Do not modify +% apt-cache says that software does not exist. +% +% WL says: 055 45 2D - ==> /hyphen (NOT: /minus) +% +% Changed /minus to /hyphen, but I'm afraid that this will break +% everything except for the EC* fonts --jcn +% % -- code follows this line -- %%BeginResource: encoding ISOLatin1Encoding /ISOLatin1Encoding [ @@ -9,7 +15,7 @@ /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quoteright -/parenleft /parenright /asterisk /plus /comma /minus /period /slash +/parenleft /parenright /asterisk /plus /comma /hyphen /period /slash /zero /one /two /three /four /five /six /seven /eight /nine /colon /semicolon /less /equal /greater /question % 100 -- 2.39.2