From df56feefa28914b45532b0a31b24c304c162b497 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Sat, 1 Jan 2005 19:46:55 +0000 Subject: [PATCH] * input/regression/new-markup-scheme.ly: oops. font-family=music -> font-encoding fetaMusic. * lily/main.cc: put default to PS. * lily/tfm.cc: idem. * lily/afm.cc: idem. * lily/include/modified-font-metric.hh (struct Modified_font_metric): remove coding_scheme() method. * input/mutopia/F.Schubert/morgenlied.ly: convert to utf8 * scripts/convert-ly.py (conv): crash on encountering \encoding. * input/les-nereides.ly: convert to utf8 * lily/modified-font-metric.cc (text_dimension): idem. * lily/parser.yy (TODO): idem. * lily/include/lily-lexer.hh (class Lily_lexer): idem. * lily/lexer.ll: remove encoding * lily/font-metric.cc (design_size): design_size returns a dimension now as well. --- ChangeLog | 26 +++ Documentation/user/changing-defaults.itely | 3 + Documentation/user/music-glossary.tely | 1 - input/les-nereides.ly | 3 +- input/mutopia/F.Schubert/morgenlied.ly | 16 +- input/regression/font-name.ly | 6 +- input/regression/new-markup-scheme.ly | 11 +- input/regression/new-markup-syntax.ly | 3 +- input/test/ancient-font.ly | 2 +- input/test/title-markup.ly | 3 +- lily/afm.cc | 6 +- lily/font-metric.cc | 18 -- lily/font-select.cc | 25 +-- lily/include/afm.hh | 1 - lily/include/font-metric.hh | 1 - lily/include/lily-lexer.hh | 3 - lily/include/output-def.hh | 5 +- lily/include/text-item.hh | 2 +- lily/include/tfm.hh | 1 - lily/lexer.ll | 14 -- lily/lily-lexer.cc | 19 +-- lily/main.cc | 2 +- lily/modified-font-metric.cc | 182 +++------------------ lily/pango-select.cc | 4 +- lily/paper-def.cc | 13 +- lily/parser.yy | 11 +- lily/text-item.cc | 22 +-- lily/tfm.cc | 29 +--- mf/GNUmakefile | 2 +- mf/parmesan-heads.mf | 16 +- scm/framework-tex.scm | 31 +--- scm/output-tex.scm | 25 +-- scm/safe-lily.scm | 1 - scripts/convert-ly.py | 14 ++ 34 files changed, 137 insertions(+), 384 deletions(-) diff --git a/ChangeLog b/ChangeLog index 111a47c507..f19dcf21e7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,31 @@ 2005-01-01 Han-Wen Nienhuys + * input/regression/new-markup-scheme.ly: oops. font-family=music + -> font-encoding fetaMusic. + + * lily/main.cc: put default to PS. + + * lily/tfm.cc: idem. + + * lily/afm.cc: idem. + + * lily/include/modified-font-metric.hh (struct + Modified_font_metric): remove coding_scheme() method. + + * input/mutopia/F.Schubert/morgenlied.ly: convert to utf8 + + * scripts/convert-ly.py (conv): crash on encountering \encoding. + + * input/les-nereides.ly: convert to utf8 + + * lily/modified-font-metric.cc (text_dimension): idem. + + * lily/parser.yy (TODO): idem. + + * lily/include/lily-lexer.hh (class Lily_lexer): idem. + + * lily/lexer.ll: remove encoding + * scm/framework-ps.scm (output-variables): separately scale the page to mm diff --git a/Documentation/user/changing-defaults.itely b/Documentation/user/changing-defaults.itely index e9f1e8ed5a..1f275d1032 100644 --- a/Documentation/user/changing-defaults.itely +++ b/Documentation/user/changing-defaults.itely @@ -1537,6 +1537,9 @@ Syntax errors for markup mode are confusing. @node Text encoding @subsection Text encoding +[FIXME: OBSOLETE, use UTF8 for input files.] + + Texts can be entered in different encodings. The encoding of the file can be set with @code{\encoding}. diff --git a/Documentation/user/music-glossary.tely b/Documentation/user/music-glossary.tely index 51e371af4f..2a562f63db 100644 --- a/Documentation/user/music-glossary.tely +++ b/Documentation/user/music-glossary.tely @@ -1898,7 +1898,6 @@ variants of the base chords. %\override Score.LyricText #'font-style = #'large %\override Score.TextScript #'font-style = #'large \oldaddlyrics -\encoding "TeX" \context Voice \relative c'' { 1 < a f d > < b g e > < d b g > < e c a > < f d b > } diff --git a/input/les-nereides.ly b/input/les-nereides.ly index 72e2f8d087..93debb6c31 100644 --- a/input/les-nereides.ly +++ b/input/les-nereides.ly @@ -1,8 +1,7 @@ \version "2.4.0" -\encoding "latin1" \header { composer = "ARTHUR GRAY" - title = "LES NÉRÉIDES" + title = "LES NÉRÉIDES" subtitle = "THE NEREIDS" enteredby = "JCN" piece = "Allegretto scherzando" diff --git a/input/mutopia/F.Schubert/morgenlied.ly b/input/mutopia/F.Schubert/morgenlied.ly index 2c9e8ebc82..58d36fe65b 100644 --- a/input/mutopia/F.Schubert/morgenlied.ly +++ b/input/mutopia/F.Schubert/morgenlied.ly @@ -1,5 +1,5 @@ \header { - title = "Sängers Morgenlied" + title = "Sängers Morgenlied" composer = "Franz Schubert (1797-1828)" date = "27. Februar 1815" source = "Edition Peters" @@ -85,25 +85,25 @@ ignoreMelismaOff = \unset ignoreMelismata firstVerse = \lyricmode { \set stanza = "1." - Sü -- ßes Licht! Aus + Sü -- ßes Licht! Aus \ignoreMelisma gol -- \ignoreMelismaOff de -- nen Pfor -- ten brichst du __ \manuscriptBreak | - sie -- gend durch __ die Nacht. Schö -- ner Tag, du __ bist er -- wacht. __ Mit ge -- | + sie -- gend durch __ die Nacht. Schö -- ner Tag, du __ bist er -- wacht. __ Mit ge -- | \manuscriptBreak - heim -- nis -- vol -- len Wor -- ten, in me -- lo -- di -- schen Ak -- kor -- den, grüß __ ich __ \manuscriptBreak | - dei -- ne Ro -- sen -- pracht, grüß __ ich __ dei -- ne Ro -- sen -- pracht. + heim -- nis -- vol -- len Wor -- ten, in me -- lo -- di -- schen Ak -- kor -- den, grüß __ ich __ \manuscriptBreak | + dei -- ne Ro -- sen -- pracht, grüß __ ich __ dei -- ne Ro -- sen -- pracht. } secondVerse = \lyricmode { \set stanza = "2." Ach, der Lie -- be sanf -- tes We -- hen schwellt mir | - das be -- weg -- te __ Herz, sanft, wie ein ge -- lieb -- ter Schmerz. __ Dürft ich | - nur auf gold -- nen Hö -- hen mich im Mor -- gen -- duft er -- ge -- hen! Sehn -- sucht | - zieht mich him -- mel -- wärts, Sehn -- sucht zieht mich him -- mel -- wärts. + das be -- weg -- te __ Herz, sanft, wie ein ge -- lieb -- ter Schmerz. __ Dürft ich | + nur auf gold -- nen Hö -- hen mich im Mor -- gen -- duft er -- ge -- hen! Sehn -- sucht | + zieht mich him -- mel -- wärts, Sehn -- sucht zieht mich him -- mel -- wärts. } pianoRH = \relative c''' \repeat volta 2 { diff --git a/input/regression/font-name.ly b/input/regression/font-name.ly index 657b5148f6..7783ec5366 100644 --- a/input/regression/font-name.ly +++ b/input/regression/font-name.ly @@ -6,6 +6,8 @@ the appropriate object. This may include Postscript fonts that are available through (La)TeX. + +BROKEN by pango/fontconfig " @@ -20,7 +22,9 @@ available through (La)TeX. \score { { - \override Staff.TimeSignature #'font-name = #"cmr17" + + %% FIXME. +% \override Staff.TimeSignature #'font-name = #"cmr17" \set Score.skipBars = ##t % use font-name putri8r for Utopia Italic : diff --git a/input/regression/new-markup-scheme.ly b/input/regression/new-markup-scheme.ly index 814018e17c..6a6dea24aa 100644 --- a/input/regression/new-markup-scheme.ly +++ b/input/regression/new-markup-scheme.ly @@ -2,7 +2,9 @@ \header { texidoc = "There is a Scheme macro @code{markup} to produce markup - texts using a similar syntax as @code{\\markup}." + texts using a similar syntax as @code{\\markup}. + +" } \version "2.5.2" @@ -16,9 +18,8 @@ \bracket \column { baz bazr bla } \hspace #2.0 - \override #'(font-family . music) { + \override #'(font-encoding . fetaMusic) { \lookup #"noteheads-0" - \char #53 } \musicglyph #"accidentals.-1" \combine "X" "+" @@ -39,8 +40,8 @@ #:override '(baseline-skip . 4) #:bracket #:column ( "baz" "bazr" "bla" ) #:hspace 2.0 - #:override '(font-family . music) #:line (#:lookup "noteheads-0" - #:char 53) + #:override '(font-encoding . fetaMusic) #:line (#:lookup "noteheads-0" + ) #:musicglyph "accidentals.-1" #:combine "X" "+" #:combine "o" "/" diff --git a/input/regression/new-markup-syntax.ly b/input/regression/new-markup-syntax.ly index 3c1dace162..f393603030 100644 --- a/input/regression/new-markup-syntax.ly +++ b/input/regression/new-markup-syntax.ly @@ -15,9 +15,8 @@ texidoc = "With the new markup syntax, text may be written in various manners." \bracket \column { baz bazr bla } \hspace #2.0 - \override #'(font-family . music) { + \override #'(font-encoding . fetaMusic) { \lookup #"noteheads-0" - \char #53 } \semiflat diff --git a/input/test/ancient-font.ly b/input/test/ancient-font.ly index 16aae2dad2..5960389186 100644 --- a/input/test/ancient-font.ly +++ b/input/test/ancient-font.ly @@ -100,7 +100,7 @@ upperStaff = \context GregorianStaff = "upperStaff" << % \break % 7 (8*1) ges! fes! - \clef "hufnagel.do.fa" + \clef "hufnagel-do-fa" \override NoteHead #'style = #'hufnagel.punctum es! des! ces! des! es! fes! \bar "||" diff --git a/input/test/title-markup.ly b/input/test/title-markup.ly index 0be842162e..bbfc6447df 100644 --- a/input/test/title-markup.ly +++ b/input/test/title-markup.ly @@ -58,7 +58,6 @@ sizeTest = \markup { } } -\encoding "latin1" spaceTest = \markup { "two space chars" } \header { @@ -70,7 +69,7 @@ spaceTest = \markup { "two space chars" } % ugh: encoding char-size %dedication = "For my öòóôõø so dear Lily" dedication = \markup { "For my " - "öòóôõø" +% "öòóôõø" " so dear Lily" } title = "Title" subtitle = "(and (the) subtitle)" diff --git a/lily/afm.cc b/lily/afm.cc index 3c2d84f105..da4493b5a8 100644 --- a/lily/afm.cc +++ b/lily/afm.cc @@ -178,11 +178,7 @@ Adobe_font_metric::design_size () const return design_size_; } -String -Adobe_font_metric::coding_scheme () const -{ - return font_info_->gfi->encodingScheme; -} + String Adobe_font_metric::font_name () const diff --git a/lily/font-metric.cc b/lily/font-metric.cc index 415e2db6de..4e7b908537 100644 --- a/lily/font-metric.cc +++ b/lily/font-metric.cc @@ -28,11 +28,6 @@ Font_metric::design_size () const return 1.0 * point_constant; } -String -Font_metric::coding_scheme () const -{ - return "FontSpecific"; -} Stencil Font_metric::find_by_name (String s) const @@ -310,19 +305,6 @@ Font_metric::get_indexed_char_stencil (int code) const return Stencil (b, at); } -int -/*Font_metric::*/ -get_encoded_index (Font_metric *m, String input_coding, int code) -{ - String font_coding = m->coding_scheme (); - if (font_coding == input_coding) - return code; - SCM s = scm_call_3 (ly_lily_module_constant ("encoded-index"), - scm_makfrom0str (input_coding.to_str0 ()), - scm_makfrom0str (font_coding.to_str0 ()), - scm_int2num (code)); - return scm_to_int (s); -} Offset Font_metric::attachment_point (String) const diff --git a/lily/font-select.cc b/lily/font-select.cc index 348544e3e4..a92bf773d4 100644 --- a/lily/font-select.cc +++ b/lily/font-select.cc @@ -50,8 +50,7 @@ wild_compare (SCM field_val, SCM val) Font_metric * get_font_by_design_size (Output_def *layout, Real requested, - SCM font_vector, - SCM font_encoding, SCM input_encoding) + SCM font_vector) { int n = SCM_VECTOR_LENGTH (font_vector); Real size = 1e6; @@ -82,18 +81,16 @@ get_font_by_design_size (Output_def *layout, Real requested, Font_metric *fm = unsmob_metrics (scm_force (SCM_VECTOR_REF (font_vector, i))); - return find_scaled_font (layout, fm, requested / size, - font_encoding, input_encoding); + return find_scaled_font (layout, fm, requested / size); } Font_metric * get_font_by_mag_step (Output_def *layout, Real requested_step, - SCM font_vector, Real default_size, - SCM font_encoding, SCM input_encoding) + SCM font_vector, Real default_size) { return get_font_by_design_size (layout, default_size * pow (2.0, requested_step / 6.0), - font_vector, font_encoding, input_encoding); + font_vector); } SCM @@ -103,7 +100,7 @@ properties_to_font_size_family (SCM fonts, SCM alist_chain) } Font_metric * -select_encoded_font (Output_def *layout, SCM chain, SCM input_encoding) +select_encoded_font (Output_def *layout, SCM chain) { SCM name = ly_chain_assoc (ly_symbol2scm ("font-name"), chain); @@ -123,9 +120,7 @@ select_encoded_font (Output_def *layout, SCM chain, SCM input_encoding) : 1); Font_metric *fm = all_fonts_global->find_font (ly_scm2string (name)); - SCM font_encoding - = scm_cdr (ly_chain_assoc (ly_symbol2scm ("font-encoding"), chain)); - return find_scaled_font (layout, fm, rmag, font_encoding, input_encoding); + return find_scaled_font (layout, fm, rmag); } else if (scm_instance_p (name)) { @@ -137,12 +132,8 @@ select_encoded_font (Output_def *layout, SCM chain, SCM input_encoding) if (scm_is_pair (font_size)) req = scm_to_double (scm_cdr (font_size)); - SCM font_encoding - = scm_cdr (ly_chain_assoc (ly_symbol2scm ("font-encoding"), chain)); - return get_font_by_mag_step (layout, req, vec, - scm_to_double (base_size) * point_constant, - font_encoding, input_encoding); + scm_to_double (base_size) * point_constant); } assert (0); @@ -152,5 +143,5 @@ select_encoded_font (Output_def *layout, SCM chain, SCM input_encoding) Font_metric * select_font (Output_def *layout, SCM chain) { - return select_encoded_font (layout, chain, SCM_EOL); + return select_encoded_font (layout, chain); } diff --git a/lily/include/afm.hh b/lily/include/afm.hh index 2c94f98aa3..21305c2ad7 100644 --- a/lily/include/afm.hh +++ b/lily/include/afm.hh @@ -32,7 +32,6 @@ public: virtual Box get_ascii_char (int) const; virtual Box get_indexed_char (int) const; virtual Offset get_indexed_wxwy (int) const; - virtual String coding_scheme () const; static SCM make_afm (AFM_Font_info*, unsigned, Real); virtual Real design_size () const; virtual String font_name () const; diff --git a/lily/include/font-metric.hh b/lily/include/font-metric.hh index 73a03daa72..8a8139e2c4 100644 --- a/lily/include/font-metric.hh +++ b/lily/include/font-metric.hh @@ -36,7 +36,6 @@ public: virtual Stencil find_by_name (String) const; virtual Stencil get_indexed_char_stencil (int k) const; virtual Stencil get_ascii_char_stencil (int k) const; - virtual String coding_scheme () const; virtual SCM sub_fonts () const; virtual SCM font_file_name () const; DECLARE_SMOBS (Font_metric,); diff --git a/lily/include/lily-lexer.hh b/lily/include/lily-lexer.hh index cfdb891033..e9f2d6d914 100644 --- a/lily/include/lily-lexer.hh +++ b/lily/include/lily-lexer.hh @@ -24,7 +24,6 @@ class Lily_lexer : public Includable_lexer DECLARE_SMOBS(Lily_lexer,); public: SCM scopes_; - SCM encoding_; private: int lookup_keyword (String); @@ -72,8 +71,6 @@ public: void push_note_state (SCM tab); void pop_state (); void LexerError (char const *); - void set_encoding (String); - SCM encoding () const; void set_identifier (SCM name_string, SCM); bool is_note_state () const; bool is_chord_state () const; diff --git a/lily/include/output-def.hh b/lily/include/output-def.hh index 92a5f13996..a3110eda51 100644 --- a/lily/include/output-def.hh +++ b/lily/include/output-def.hh @@ -68,15 +68,14 @@ void set_tempo (Output_def*def, Moment moment, int count_per_minute_i); Interval line_dimensions_int (Output_def*def, int); -Font_metric *select_encoded_font (Output_def *layout, SCM input_encoding, SCM chain); +Font_metric *select_encoded_font (Output_def *layout, SCM chain); Font_metric *select_font (Output_def *layout, SCM chain); DECLARE_UNSMOB (Output_def, output_def); Font_metric *find_scaled_font (Output_def *od, - Font_metric *f, Real magnification, - SCM font_encoding, SCM input_encoding); + Font_metric *f, Real magnification); Output_def *scale_output_def (Output_def *def, Real scale); Real output_scale (Output_def*); diff --git a/lily/include/text-item.hh b/lily/include/text-item.hh index 97d91cf14e..48207f9e65 100644 --- a/lily/include/text-item.hh +++ b/lily/include/text-item.hh @@ -18,7 +18,7 @@ class Text_interface public: DECLARE_SCHEME_CALLBACK (print, (SCM)); DECLARE_SCHEME_CALLBACK (interpret_markup, (SCM, SCM, SCM)); - DECLARE_SCHEME_CALLBACK (interpret_string, (SCM, SCM, SCM, SCM)); + DECLARE_SCHEME_CALLBACK (interpret_string, (SCM, SCM, SCM)); static bool has_interface (Grob*); static bool markup_p (SCM) ; }; diff --git a/lily/include/tfm.hh b/lily/include/tfm.hh index 95d2dfa913..7c37eb5326 100644 --- a/lily/include/tfm.hh +++ b/lily/include/tfm.hh @@ -150,7 +150,6 @@ public: virtual int count () const; virtual Box get_ascii_char (int) const; virtual Real design_size () const; - virtual String coding_scheme () const; virtual void derived_mark () const; virtual int name_to_index (String) const; diff --git a/lily/lexer.ll b/lily/lexer.ll index d0a2dc50f0..b4049350e1 100644 --- a/lily/lexer.ll +++ b/lily/lexer.ll @@ -101,7 +101,6 @@ SCM (* scm_parse_error_handler) (void *); %option warn %x chords -%x encoding %x figures %x incl %x lyrics @@ -164,21 +163,12 @@ HYPHEN -- } } -\\encoding{WHITE}* { - yy_push_state (encoding); -} \\version{WHITE}* { yy_push_state (version); } \\renameinput{WHITE}* { yy_push_state (renameinput); } -\"[^"]*\" { - String s (YYText () + 1); - s = s.left_string (s.index_last ('\"')); - set_encoding (s); - yy_pop_state (); -} \"[^"]*\" { /* got the version number */ String s (YYText () + 1); s = s.left_string (s.index_last ('\"')); @@ -204,10 +194,6 @@ HYPHEN -- scm_makfrom0str (s.to_str0 ())); } -. { - LexerError (_ ("No quoted string found after \\encoding").to_str0 ()); - yy_pop_state (); -} . { LexerError (_ ("No quoted string found after \\version").to_str0 ()); yy_pop_state (); diff --git a/lily/lily-lexer.cc b/lily/lily-lexer.cc index df238ef784..e7570dff80 100644 --- a/lily/lily-lexer.cc +++ b/lily/lily-lexer.cc @@ -87,7 +87,6 @@ static Keyword_ent the_key_tab[] = { Lily_lexer::Lily_lexer (Sources *sources) { keytable_ = new Keyword_table (the_key_tab); - encoding_ = SCM_EOL; chordmodifier_tab_ = SCM_EOL; pitchname_tab_stack_ = SCM_EOL; sources_ = sources; @@ -106,7 +105,6 @@ Lily_lexer::Lily_lexer (Lily_lexer const &src) : Includable_lexer () { keytable_ = (src.keytable_) ? new Keyword_table (*src.keytable_) : 0; - encoding_ = src.encoding_; chordmodifier_tab_ = src.chordmodifier_tab_; pitchname_tab_stack_ = src.pitchname_tab_stack_; sources_ = src.sources_; @@ -137,11 +135,6 @@ Lily_lexer::~Lily_lexer () delete keytable_; } -SCM -Lily_lexer::encoding () const -{ - return encoding_ ; -} void @@ -274,15 +267,6 @@ Lily_lexer::prepare_for_next_token () last_input_ = here_input (); } -void -Lily_lexer::set_encoding (String s) -{ - if (s.length ()) - encoding_ = ly_symbol2scm (s.to_str0 ()); - else - encoding_ = SCM_EOL; -} - #include "ly-smobs.icc" IMPLEMENT_SMOBS (Lily_lexer); @@ -296,8 +280,7 @@ Lily_lexer::mark_smob (SCM s) scm_gc_mark (lexer->chordmodifier_tab_); scm_gc_mark (lexer->pitchname_tab_stack_); - scm_gc_mark (lexer->scopes_); - return lexer->encoding_; + return lexer->scopes_; } int diff --git a/lily/main.cc b/lily/main.cc index 8cca9aa0e3..c75826be29 100644 --- a/lily/main.cc +++ b/lily/main.cc @@ -46,7 +46,7 @@ bool no_layout_global_b = false; /* Selected output format. One of tex, ps, scm, as. */ -String output_format_global = "tex"; +String output_format_global = "ps"; /* Current output name. */ String output_name_global; diff --git a/lily/modified-font-metric.cc b/lily/modified-font-metric.cc index 1c854147fd..67f30b3f4f 100644 --- a/lily/modified-font-metric.cc +++ b/lily/modified-font-metric.cc @@ -13,17 +13,11 @@ #include "warn.hh" #include "stencil.hh" #include "lookup.hh" +#include "main.hh" Modified_font_metric::Modified_font_metric (Font_metric *fm, - Real magnification, - String font_encoding, - String input_encoding) + Real magnification) { - input_encoding_ = input_encoding; - coding_vector_ = SCM_EOL; - coding_mapping_ = SCM_EOL; - coding_table_ = SCM_EOL; - coding_description_ = SCM_EOL; magnification_ = magnification; SCM desc = fm->description_; @@ -33,76 +27,12 @@ Modified_font_metric::Modified_font_metric (Font_metric *fm, description_ = scm_cons (scm_car (desc), scm_make_real (total_mag)); orig_ = fm; - - String metric_coding = orig_->coding_scheme (); - if (metric_coding != "FontSpecific" - && metric_coding != font_encoding) - warning (_f ("conflicting metric coding (%s) and font_encoding (%s)", - metric_coding, font_encoding)); - - if (input_encoding_ != "" - && input_encoding_ != "TeX" - && input_encoding_ != "ASCII" - && input_encoding_ != font_encoding) - { - coding_vector_ = scm_call_1 (ly_lily_module_constant ("get-coding-vector"), - scm_makfrom0str (font_encoding.to_str0 ())); - - if (!ly_c_vector_p (coding_vector_)) - { - programming_error ("get-coding-vector should return vector"); - coding_vector_ = scm_c_make_vector (256, ly_symbol2scm (".notdef")); - } - - coding_table_ = scm_call_1 (ly_lily_module_constant ("get-coding-table"), - scm_makfrom0str (font_encoding.to_str0 ())); - - coding_mapping_ - = scm_call_2 (ly_lily_module_constant ("make-encoding-mapping"), - coding_vector_, - coding_table_); - - coding_description_ = SCM_EOL; - coding_description_ - = scm_acons (ly_symbol2scm ("input-name"), - scm_makfrom0str (input_encoding_.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_); - } } SCM -Modified_font_metric::make_scaled_font_metric (Font_metric *fm, Real scaling, - SCM font_encoding, - SCM input_encoding) +Modified_font_metric::make_scaled_font_metric (Font_metric *fm, Real scaling) { - /* - UGH. - */ - if (scm_is_symbol (input_encoding)) - input_encoding = scm_symbol_to_string (input_encoding); - - String font_encoding_str = ly_symbol2string (font_encoding); - String input_encoding_str - = scm_is_string (input_encoding) ? ly_scm2string (input_encoding) : ""; - - Modified_font_metric *sfm = new Modified_font_metric (fm, scaling, - font_encoding_str, - input_encoding_str); + Modified_font_metric *sfm = new Modified_font_metric (fm, scaling); return sfm->self_scm (); } @@ -167,19 +97,9 @@ Modified_font_metric::index_to_ascii (int k) const return orig_->index_to_ascii (k); } -String -Modified_font_metric::coding_scheme () const -{ - return input_encoding_; -} - void Modified_font_metric::derived_mark () const { - scm_gc_mark (coding_vector_); - scm_gc_mark (coding_description_); - scm_gc_mark (coding_table_); - scm_gc_mark (coding_mapping_); } /* TODO: put this klutchness behind ly:option switch. */ @@ -266,64 +186,28 @@ Modified_font_metric::text_dimension (String text) const b.scale (magnification_); return b; } - - if (input_encoding_ == "TeX") - b = tex_kludge (text); - else if (input_encoding_ == "ASCII" - || input_encoding_ == "" - || input_encoding_ == orig_->coding_scheme ()) - { - Interval ydims; - Real w = 0.0; - - for (int i = 0; i < text.length (); i++) - { - Box b = get_ascii_char ((unsigned char)text[i]); - - w += b[X_AXIS].length (); - ydims.unite (b[Y_AXIS]); - } - if (ydims.is_empty ()) - ydims = Interval (0, 0); - - b = Box(Interval(0,w), ydims); - } - else + if (output_format_global == "tex") { - Interval ydims; - Real w = 0.0; - - for (int i = 0; i < text.length (); i++) - { - SCM sym = scm_vector_ref (coding_vector_, - scm_from_int((unsigned char) text[i])); - - Box char_box; - - if (!scm_is_symbol (sym)) - continue; - - char const *chars = scm_i_string_chars (scm_symbol_to_string (sym)); - - int idx = orig_->name_to_index (chars); - if (idx >= 0) - char_box = orig_->get_indexed_char (idx); - - if (!char_box[X_AXIS].is_empty ()) - /* length ? */ - w += char_box[X_AXIS][RIGHT]; + b = tex_kludge (text); + return b; + } - ydims.unite (char_box[Y_AXIS]); - } + Interval ydims; - if (ydims.is_empty ()) - ydims = Interval (0, 0); + Real w = 0.0; - b = Box (Interval (0, w), ydims); - b.scale (magnification_); + for (int i = 0; i < text.length (); i++) + { + Box b = get_ascii_char ((unsigned char)text[i]); + + w += b[X_AXIS].length (); + ydims.unite (b[Y_AXIS]); } - + if (ydims.is_empty ()) + ydims = Interval (0, 0); + + b = Box(Interval(0,w), ydims); return b; } @@ -333,32 +217,6 @@ Modified_font_metric::original_font () const return orig_; } - -LY_DEFINE (ly_font_encoding_alist, "ly:font-encoding-alist", - 1, 0, 0, - (SCM font), - "Given the Modified_font_metric @var{font}, return an " - "alist. Keys are input-name, input-vector, " - "output-name, output-table, mapping.") -{ - Modified_font_metric *fm - = dynamic_cast (unsmob_metrics (font)); - - SCM_ASSERT_TYPE (fm, font, SCM_ARG1, __FUNCTION__, "Modified_font_metric"); - return fm->coding_description_; -} - -LY_DEFINE (ly_font_encoding, "ly:font-encoding", - 1, 0, 0, - (SCM font), - "Return encoding of @var{font}.") -{ - Modified_font_metric *fm - = dynamic_cast (unsmob_metrics (font)); - SCM_ASSERT_TYPE (fm, font, SCM_ARG1, __FUNCTION__, "Modified_font_metric"); - return ly_symbol2scm (fm->original_font ()->coding_scheme ().to_str0 ()); -} - SCM Modified_font_metric::sub_fonts () const { diff --git a/lily/pango-select.cc b/lily/pango-select.cc index 402f788146..c49c63cf37 100644 --- a/lily/pango-select.cc +++ b/lily/pango-select.cc @@ -49,9 +49,7 @@ select_pango_font (Output_def *layout, SCM chain) Font_metric * fm = all_fonts_global->find_pango_font (description); - return find_scaled_font (layout, fm, 1.0, - ly_symbol2scm ("latin1"), - ly_symbol2scm ("latin1")); + return find_scaled_font (layout, fm, 1.0); } diff --git a/lily/paper-def.cc b/lily/paper-def.cc index 83b3491da8..7b55761d84 100644 --- a/lily/paper-def.cc +++ b/lily/paper-def.cc @@ -35,11 +35,10 @@ get_font_table (Output_def *def) /* TODO: should add nesting for Output_def here too. */ Font_metric * -find_scaled_font (Output_def *mod, Font_metric *f, Real m, - SCM font_encoding, SCM input_encoding) +find_scaled_font (Output_def *mod, Font_metric *f, Real m) { if (mod->parent_) - return find_scaled_font (mod->parent_, f, m, font_encoding, input_encoding); + return find_scaled_font (mod->parent_, f, m); Real lookup_mag = m / output_scale (mod); @@ -56,10 +55,8 @@ find_scaled_font (Output_def *mod, Font_metric *f, Real m, else sizes = SCM_EOL; - SCM val = Modified_font_metric::make_scaled_font_metric (f, lookup_mag, - font_encoding, - input_encoding); - + SCM val = Modified_font_metric::make_scaled_font_metric (f, lookup_mag); + sizes = scm_acons (scm_make_real (lookup_mag), val, sizes); scm_gc_unprotect_object (val); scm_hashq_set_x (font_table, f->self_scm (), sizes); @@ -82,7 +79,7 @@ scale_output_def (Output_def *o, Real amount) LY_DEFINE (ly_paper_fonts, "ly:paper-fonts", 1, 0, 0, (SCM bp), - "Return fonts scaled up BP") + "Return fonts from the @code{\\paper} block @var{bp}.") { Output_def *b = unsmob_output_def (bp); diff --git a/lily/parser.yy b/lily/parser.yy index d9fa443eb7..8df52ae600 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -116,12 +116,9 @@ get_first_context_id (SCM type, Music *m) } SCM -make_simple_markup (SCM encoding, SCM a) +make_simple_markup (SCM a) { SCM simple = ly_lily_module_constant ("simple-markup"); - if (scm_is_symbol (encoding)) - return scm_list_3 (ly_lily_module_constant ("encoded-simple-markup"), - encoding, a); return scm_list_2 (simple, a); } @@ -1968,7 +1965,7 @@ gen_text_def: | string { Music *t = MY_MAKE_MUSIC ("TextScriptEvent"); t->set_property ("text", - make_simple_markup (THIS->lexer_->encoding (), $1)); + make_simple_markup ($1)); t->set_spot (THIS->here_input ()); $$ = t; @@ -2304,7 +2301,7 @@ lyric_element: $$ = $1; } | LYRICS_STRING { - $$ = make_simple_markup (THIS->lexer_->encoding (), $1); + $$ = make_simple_markup ($1); } ; @@ -2547,7 +2544,7 @@ markup_head_1_list: simple_markup: STRING { - $$ = make_simple_markup (THIS->lexer_->encoding (), $1); + $$ = make_simple_markup ($1); } | MARKUP_IDENTIFIER { $$ = $1; diff --git a/lily/text-item.cc b/lily/text-item.cc index 31274c804a..9e32dba959 100644 --- a/lily/text-item.cc +++ b/lily/text-item.cc @@ -22,10 +22,11 @@ #include "ly-module.hh" -MAKE_SCHEME_CALLBACK (Text_interface, interpret_string, 4) +MAKE_SCHEME_CALLBACK (Text_interface, interpret_string, 3) SCM Text_interface::interpret_string (SCM layout_smob, - SCM props, SCM input_encoding, SCM markup) + SCM props, + SCM markup) { Output_def *layout = unsmob_output_def (layout_smob); @@ -45,20 +46,7 @@ Text_interface::interpret_string (SCM layout_smob, } #endif - SCM_ASSERT_TYPE (input_encoding == SCM_EOL || scm_is_symbol (input_encoding), - input_encoding, SCM_ARG2, __FUNCTION__, "symbol"); - - if (!scm_is_symbol (input_encoding)) - { - SCM enc = layout->lookup_variable (ly_symbol2scm ("inputencoding")); - if (scm_is_string (enc)) - input_encoding = scm_string_to_symbol (enc); - else if (scm_is_symbol (enc)) - input_encoding = enc; - } - - Font_metric *fm = select_encoded_font (layout, props, input_encoding); - + Font_metric *fm = select_encoded_font (layout, props); return fm->text_stencil (str).smobbed_copy(); } @@ -67,7 +55,7 @@ SCM Text_interface::interpret_markup (SCM layout_smob, SCM props, SCM markup) { if (scm_is_string (markup)) - return interpret_string (layout_smob, props, SCM_EOL, markup); + return interpret_string (layout_smob, props, markup); else if (scm_is_pair (markup)) { SCM func = scm_car (markup); diff --git a/lily/tfm.cc b/lily/tfm.cc index 815edd3ca1..29c16cd210 100644 --- a/lily/tfm.cc +++ b/lily/tfm.cc @@ -9,7 +9,6 @@ */ #include "tfm.hh" - #include "tfm-reader.hh" #include "string-convert.hh" #include "warn.hh" @@ -17,8 +16,6 @@ static Tex_font_char_metric dummy_static_char_metric; - - Tex_font_char_metric::Tex_font_char_metric () { exists_ = false; @@ -44,7 +41,6 @@ Tex_font_char_metric::dimensions () const } Real d = -depth_; - Real point_constant = 1 PT; return Box (Interval (0, width_* point_constant ), @@ -101,9 +97,6 @@ Tex_font_metric::make_tfm (String file_name) tfm->header_ = reader.header_; tfm->char_metrics_ = reader.char_metrics_; tfm->ascii_to_metric_idx_ = reader.ascii_to_metric_idx_; - tfm->encoding_table_ - = scm_call_1 (ly_lily_module_constant ("get-coding-table"), - scm_makfrom0str (tfm->coding_scheme ().to_str0 ())); return tfm->self_scm (); } @@ -114,28 +107,8 @@ Tex_font_metric::design_size () const return info_.design_size * point_constant; } -String -Tex_font_metric::coding_scheme () const -{ - String scm = info_.coding_scheme; - - for(int i = 0; i < scm.length (); i++) - if (scm[i] == ' ') - scm[i] = '-'; - - return scm; -} - int Tex_font_metric::name_to_index (String s) const { - SCM sym = ly_symbol2scm (s.to_str0 ()); - - SCM idx = scm_hash_ref (encoding_table_, sym, SCM_BOOL_F); - if (ly_c_char_p (idx)) - { - return (unsigned char) ly_scm2char (idx); - } - else - return -1; + assert (false); } diff --git a/mf/GNUmakefile b/mf/GNUmakefile index fafc83cae7..584c2de680 100644 --- a/mf/GNUmakefile +++ b/mf/GNUmakefile @@ -59,7 +59,7 @@ foe: $(outdir)/%.otf $(outdir)/%.svg: $(outdir)/%.pe (cd $(outdir) && fontforge -script $(notdir $<)) -$(outdir)/%.otf-table: $(outdir)/%.lisp +$(outdir)/%.otf-table: $(outdir)/%.lisp $(if $(findstring brace,$<),,$(subst feta,parmesan,$<)) cat $< \ $(if $(findstring brace,$<),,$(subst feta,parmesan,$<)) \ $(if $(findstring brace,$<),,$(subst feta,feta-alphabet,$<)) > $@ diff --git a/mf/parmesan-heads.mf b/mf/parmesan-heads.mf index b8bc59c407..65eb451602 100644 --- a/mf/parmesan-heads.mf +++ b/mf/parmesan-heads.mf @@ -314,7 +314,7 @@ def punctum_char (expr verbose_name, internal_name, left_stem, right_stem, linea, cavum, straight, auctum, direction_up, excentric, up_shift, down_shift, mag) = - fet_beginchar(verbose_name, internal_name) + fet_beginchar(verbose_name, "s" & internal_name) save b_h, a_w; a_b := 1.54; % b_h*a_b/a_w = wd/ht b_h := 0.85; @@ -471,7 +471,7 @@ enddef; def inclinatum_char(expr verbose_name, internal_name, small, stropha, auctum) = - fet_beginchar(verbose_name, internal_name) + fet_beginchar(verbose_name, "s"&internal_name) save ht, alpha; alpha# = 35; if small: @@ -593,7 +593,7 @@ punctum_char("Ed. Vat. cephalicus", "vaticana.cephalicus", false, false, true, false, false, 1.0); % quilisma -fet_beginchar("Ed. Vat. quilisma", "vaticana.quilisma") +fet_beginchar("Ed. Vat. quilisma", "svaticana.quilisma") save b_h,a_w; a_b:=1.54; % b_h*a_b/a_w = wd/ht b_h:=0.85; @@ -646,7 +646,7 @@ inclinatum_char("Solesmes stropha aucta", "solesmes.stropha.aucta", false, true, true); % solesmes oriscus -fet_beginchar("Solesmes oriscus", "solesmes.oriscus") +fet_beginchar("Solesmes oriscus", "ssolesmes.oriscus") save b_h, a_w; a_b := 1.54; % b_h*a_b/a_w = wd/ht b_h := 0.85; @@ -683,7 +683,7 @@ fet_endchar; % % inclinatum -fet_beginchar("Ed. Med. inclinatum", "medicaea.inclinatum") +fet_beginchar("Ed. Med. inclinatum", "smedicaea.inclinatum") draw_diamond_head (1.2staff_space#, 0, 0, 35, false); fet_endchar; @@ -691,7 +691,7 @@ fet_endchar; def punctum_char (expr verbose_name, internal_name, left_up_stem, left_down_stem) = - fet_beginchar(verbose_name, internal_name) + fet_beginchar(verbose_name, "s"&internal_name) save a, beta, ht, wd; ht# = 2 staff_space#; @@ -752,7 +752,7 @@ punctum_char("Ed. Med. virga", "medicaea.virga", % parametrized punctum def punctum_char (expr verbose_name, internal_name, down_stem) = - fet_beginchar(verbose_name, internal_name) + fet_beginchar(verbose_name, "s" & internal_name) save alpha; alpha# = 55; draw_diamond_head (staff_space#, 0, 0, alpha#, false); @@ -778,7 +778,7 @@ punctum_char("Hufnagel punctum", "hufnagel.punctum", false) punctum_char("Hufnagel virga", "hufnagel.virga", true) % pes lower punctum -fet_beginchar("Hufnagel pes lower punctum", "hufnagel.lpes") +fet_beginchar("Hufnagel pes lower punctum", "shufnagel.lpes") save width, height, alpha; width# = 2*staff_space#; height# = 0.7*staff_space#; diff --git a/scm/framework-tex.scm b/scm/framework-tex.scm index b5d91fe99c..cc1b4eaa3b 100644 --- a/scm/framework-tex.scm +++ b/scm/framework-tex.scm @@ -80,29 +80,14 @@ sub-fonts))))) (define (simple-font-load-command paper font) - (let* ((coding-alist (ly:font-encoding-alist font)) - (font-encoding (assoc-get 'output-name coding-alist))) - (string-append - "\\font\\lilypond" (tex-font-command font) "=" - (if (or (equal? (ly:font-encoding font) "cork-lm") - ;; FIXME: encoding: FontSpecific for cork-lm - (string-prefix? "lm" (ly:font-file-name font))) - "cork-" "") - (ly:font-file-name font) - " scaled " - (ly:number->string (inexact->exact - (round (* 1000 - (ly:font-magnification font) - (ly:paper-outputscale paper))))) - "\n" - "\\def\\" (tex-font-command font) "{%\n" - ;; UGH. Should be handled via alist. - (if (or (equal? "Extended-TeX-Font-Encoding---Latin" font-encoding) - (not font-encoding)) - " \\lilypondfontencoding{T1}" - " ") - "\\lilypond" (tex-font-command font) - "}%\n"))) + (format + "\\font\\~a=~a scaled ~a%\n" + (tex-font-command font) + (ly:font-file-name font) + (inexact->exact + (round (* 1000 + (ly:font-magnification font) + (ly:paper-outputscale paper)))))) (define (font-load-command paper font) (if (pair? (ly:font-sub-fonts font)) diff --git a/scm/output-tex.scm b/scm/output-tex.scm index b0fc77e8d4..6bc3f50a06 100644 --- a/scm/output-tex.scm +++ b/scm/output-tex.scm @@ -159,26 +159,9 @@ (embedded-ps (list 'round-filled-box x y width height blotdiam))) (define (text font s) - ;; (assoc-get 'char-mapping (ly:font-encoding-alist font)))) - (let* ((mapping #f) - - ;; TODO: we'd better do this for PS only - ;; LaTeX gets in the way, and we need to remap - ;; nonprintable chars. - - ;; (assoc-get 'input-name (ly:font-encoding-alist font))) - - (input-enc-name #f)) - - (string-append "\\hbox{\\" (tex-font-command font) - (if (string? input-enc-name) - (string-append "\\inputencoding{" input-enc-name "}") - "{}") - (sanitize-tex-string - (if (vector? mapping) - (reencode-string mapping s) - s)) - "}"))) + (format + "\\hbox{\\~a{}~a}" (tex-font-command font) + (sanitize-tex-string s))) (define (white-text scale s) (embedded-ps (list 'white-text scale s))) @@ -204,4 +187,4 @@ (string-append "\\special{src:" (apply point-and-click location) "}") "")) - "")) \ No newline at end of file + "")) diff --git a/scm/safe-lily.scm b/scm/safe-lily.scm index 3ec1c8024f..98a7c38504 100644 --- a/scm/safe-lily.scm +++ b/scm/safe-lily.scm @@ -35,7 +35,6 @@ ly:export ly:font-get-glyph ly:font-design-size - ly:font-encoding-alist ly:font-file-name ly:font-magnification ly:font-metric? diff --git a/scripts/convert-ly.py b/scripts/convert-ly.py index b7cc7b51f0..2384587e6f 100644 --- a/scripts/convert-ly.py +++ b/scripts/convert-ly.py @@ -2292,6 +2292,20 @@ def conv (str): str = re.sub ("'(vaticana|hufnagel|medicaea|petrucci|neomensural|mensural)-", r"'\1.", str) return str +conversions.append (((2, 5, 3), + conv, + 'ly:find-glyph-by-name -> ly:font-get-glyph, remove - from glyphnames.')) + + + +def conv (str): + if re.search (r"\\encoding", str): + sys.stderr.write ("Sorry, input files should be UTF8.\n" + + "Please convert by hand.") + raise FatalConversionError() + + return str + conversions.append (((2, 5, 2), conv, 'ly:find-glyph-by-name -> ly:font-get-glyph, remove - from glyphnames.')) -- 2.39.2