From ef6d7bcbf124ee9d91ebae67c802fff74c903a62 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Thu, 29 Jul 2004 22:53:52 +0000 Subject: [PATCH] * Documentation/user/changing-defaults.itely (Text encoding): node on encoding. * lily/lyric-engraver.cc (try_music): remove superfluous check. * lily/book-paper-def.cc (find_scaled_font): remove default encoding. This messes up font loading for feta and parmesan. Encoding should only be specified for running texts. * lily/modified-font-metric.cc (text_dimension): support coding scheme "" --- ChangeLog | 14 ++++++ Documentation/topdocs/INSTALL.texi | 3 ++ Documentation/user/changing-defaults.itely | 50 +++++++++++++++++++--- input/mutopia/F.Schubert/morgenlied.ly | 4 +- lily/book-paper-def.cc | 10 ----- lily/lyric-engraver.cc | 4 +- lily/modified-font-metric.cc | 13 +++--- lily/stem.cc | 6 ++- lily/text-item.cc | 8 ++++ ly/engraver-init.ly | 2 +- scm/define-grobs.scm | 1 - scm/framework-ps.scm | 11 ----- scm/output-ps.scm | 17 ++++---- 13 files changed, 91 insertions(+), 52 deletions(-) diff --git a/ChangeLog b/ChangeLog index 991b89c24e..9431b4a280 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2004-07-30 Han-Wen Nienhuys + + * Documentation/user/changing-defaults.itely (Text encoding): node + on encoding. + + * lily/lyric-engraver.cc (try_music): remove superfluous check. + + * lily/book-paper-def.cc (find_scaled_font): remove default + encoding. This messes up font loading for feta and + parmesan. Encoding should only be specified for running texts. + + * lily/modified-font-metric.cc (text_dimension): support coding + scheme "" + 2004-07-28 Han-Wen Nienhuys * lily/tie-engraver.cc (stop_translation_timestep): remember tie diff --git a/Documentation/topdocs/INSTALL.texi b/Documentation/topdocs/INSTALL.texi index 9257dd8fec..2191ac4fca 100644 --- a/Documentation/topdocs/INSTALL.texi +++ b/Documentation/topdocs/INSTALL.texi @@ -113,6 +113,9 @@ newer). EGCS and 2.x are known to cause crashes. @item @uref{http://www.gnu.org/software/bison/,Bison} (version 1.25 or newer, but not 1.50 or 1.75). + +@item gettext + @end itemize @subsection Running requirements diff --git a/Documentation/user/changing-defaults.itely b/Documentation/user/changing-defaults.itely index e3880d7d62..4668b12057 100644 --- a/Documentation/user/changing-defaults.itely +++ b/Documentation/user/changing-defaults.itely @@ -1512,11 +1512,11 @@ all three mechanisms work for every object that supports @itemize @bullet @item @code{font-encoding} -is a symbol that sets layout of the glyphs. Choices include -@code{text} for normal text, @code{braces} (for piano staff braces), -@code{music} (the standard music font, including ancient glyphs), -@code{dynamic} (for dynamic signs) and @code{number} for the number -font. +is a symbol that sets layout of the glyphs. Choices include @code{ec} +for @TeX{} EC font encoding, @code{fetaBraces} (for piano staff +braces), @code{fetaMusic} (the standard music font, including ancient +glyphs), @code{fetaDynamic} (for dynamic signs) and @code{fetaNumber} +for the number font. @item @code{font-family} @@ -1673,12 +1673,50 @@ for formatting. @menu +* Text encoding:: * Overview of text markup commands:: @end menu +@node Text encoding +@subsection Text encoding + +Texts can be entered in different encodings. The encoding of the +file can be set with @code{\encoding}. + +@example + \encoding "latin1" +@end example + +This command may be placed anywhere in the input file. The current +encoding is passed as an extra argument to @code{\markup} commands. + +If no @code{\encoding} has been specified, then the encoding is taken +from the @code{\paper} block (or @code{\bookpaper}, if @code{\paper} +does not specify encoding). The variable @code{inputencoding} may be +set to a string or symbol specifying the encoding, eg. + +@example + \paper { + inputencoding = "latin1" + } +@end example + +There is a special encoding, called @code{TeX}. This encoding does not +reencode text for the font used. Rather, it tries to guess the width +of @TeX{} commands, such as @code{\"}. Strings encoded with @code{TeX} +are passed to the output back-end verbatim. + +@cindex encoding +@cindex @code{\encoding} +@cindex inputencoding +@cindex @TeX{} commands in strings + + + + @node Overview of text markup commands @subsection Overview of text markup commands - +} @include markup-commands.tely diff --git a/input/mutopia/F.Schubert/morgenlied.ly b/input/mutopia/F.Schubert/morgenlied.ly index 99e4235805..0d6fbd24c8 100644 --- a/input/mutopia/F.Schubert/morgenlied.ly +++ b/input/mutopia/F.Schubert/morgenlied.ly @@ -149,8 +149,7 @@ pianoLH = \relative c'' \repeat volta 2 { r r 8 r r\fermata \clef treble } \book { -\score { - + \score { << \time 6/8 \new Staff << \context Staff #(set-accidental-style 'modern) @@ -185,7 +184,6 @@ pianoLH = \relative c'' \repeat volta 2 { \Staff minimumVerticalExtent = #'(-3. . 6) } - inputencoding = #"latin1" } \midi { \tempo 4 = 70 diff --git a/lily/book-paper-def.cc b/lily/book-paper-def.cc index 95d7114dc2..0dfe5fb151 100644 --- a/lily/book-paper-def.cc +++ b/lily/book-paper-def.cc @@ -78,16 +78,6 @@ find_scaled_font (Output_def *mod, } else { - if (!ly_c_symbol_p (input_enc_name)) - { - SCM var = ly_module_lookup (mod->scope_, - ly_symbol2scm ("inputencoding")); - if (var != SCM_BOOL_F) - input_enc_name = scm_variable_ref (var); - if (!ly_c_symbol_p (input_enc_name)) - input_enc_name = ly_symbol2scm ("latin1"); - } - val = Modified_font_metric::make_scaled_font_metric (input_enc_name, f, lookup_mag); } diff --git a/lily/lyric-engraver.cc b/lily/lyric-engraver.cc index d7f0c3b350..6b4ac2309a 100644 --- a/lily/lyric-engraver.cc +++ b/lily/lyric-engraver.cc @@ -36,8 +36,8 @@ private: Lyric_engraver::Lyric_engraver () { - text_ =0; - event_ =0; + text_ = 0; + event_ = 0; } bool diff --git a/lily/modified-font-metric.cc b/lily/modified-font-metric.cc index 016887b9df..547756b1f4 100644 --- a/lily/modified-font-metric.cc +++ b/lily/modified-font-metric.cc @@ -31,8 +31,9 @@ Modified_font_metric::Modified_font_metric (String coding, Font_metric* m, Real description_ = scm_cons (ly_car (desc), scm_make_real (total_mag)); orig_ = m; - - if (coding_scheme_ != "TeX" + + if (coding_scheme_ != "" + && coding_scheme_ != "TeX" && coding_scheme_ != "ASCII" && coding_scheme_ != orig_->coding_scheme ()) { @@ -54,11 +55,9 @@ Modified_font_metric::Modified_font_metric (String coding, Font_metric* m, Real 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"), @@ -67,7 +66,6 @@ Modified_font_metric::Modified_font_metric (String coding, Font_metric* m, Real coding_description_ = scm_acons (ly_symbol2scm ("output-table"), coding_table_, coding_description_); - coding_description_ = scm_acons (ly_symbol2scm ("char-mapping"), coding_mapping_, coding_description_); @@ -94,12 +92,12 @@ SCM Modified_font_metric::make_scaled_font_metric (SCM coding, Font_metric *m, Real s) { /* - UGOHR. + UGH. */ if (ly_c_symbol_p (coding)) coding = scm_symbol_to_string (coding); - String scheme = ly_scm2string (coding); + String scheme = ly_c_string_p (coding) ? ly_scm2string (coding) : ""; Modified_font_metric *sfm = new Modified_font_metric (scheme, m, s); @@ -238,6 +236,7 @@ Modified_font_metric::text_dimension (String text) b = tex_kludge (text); } else if (coding_scheme_ == "ASCII" + || coding_scheme_ == "" || coding_scheme_ == orig_->coding_scheme ()) { Interval ydims; diff --git a/lily/stem.cc b/lily/stem.cc index c15682728e..5aa8844849 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -787,8 +787,10 @@ Stem::calc_stem_info (Grob *me) ly_scm2double (robust_list_ref (beam_count - 1,lengths)) * staff_space - /* stem only extends to center of beam */ - - 0.5 * beam_thickness; + /* stem only extends to center of beam + */ + - 0.5 * beam_thickness + ; /* Condition: sane minimum free stem length (chord to beams) */ lengths = me->get_property ("beamed-minimum-free-lengths"); diff --git a/lily/text-item.cc b/lily/text-item.cc index d472c17980..bdeb54c017 100644 --- a/lily/text-item.cc +++ b/lily/text-item.cc @@ -28,6 +28,14 @@ Text_item::interpret_string (SCM paper, SCM props, SCM encoding, SCM markup) || ly_c_symbol_p (encoding), encoding, SCM_ARG2, __FUNCTION__, "symbol"); String str = ly_scm2string (markup); + if (!ly_c_symbol_p (encoding)) + { + SCM var = ly_module_lookup (pap->scope_, + ly_symbol2scm ("inputencoding")); + if (var != SCM_BOOL_F) + input_enc_name = scm_variable_ref (var); + } + Font_metric *fm = select_encoded_font (pap, props, encoding); SCM lst = SCM_EOL; diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly index d86a92ee18..1c9ddec642 100644 --- a/ly/engraver-init.ly +++ b/ly/engraver-init.ly @@ -313,7 +313,6 @@ connected vertically. " \context{ \type "Engraver_group_engraver" - \consists "Hara_kiri_engraver" minimumVerticalExtent = #'(-1.2 . 2.4) extraVerticalExtent = ##f verticalExtent = ##f @@ -330,6 +329,7 @@ printing of a single line of lyrics. " \consists "Vocal_name_engraver" \consists "Skip_event_swallow_translator" \consists "Font_size_engraver" + \consists "Hara_kiri_engraver" \override SeparationItem #'padding = #0.2 } diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index 890b0b3012..26590d3422 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -977,7 +977,6 @@ ;; FIXME this should come from 'lengths (beamed-lengths . (3.26 3.26 1.5)) -; (beamed-lengths . (3.5 3.5 3.5 4.5 5.0)) ;; We use the normal minima as minimum for the ideal lengths, ;; and the extreme minima as abolute minimum length. diff --git a/scm/framework-ps.scm b/scm/framework-ps.scm index 0dd4ba0c44..0c96ee1cdd 100644 --- a/scm/framework-ps.scm +++ b/scm/framework-ps.scm @@ -28,17 +28,6 @@ #f font-encoding) (car override-coding)))) - ;; FIXME: now feta stuff has feta* input-encoding (again?) - ;;(format (current-error-port) "FONT: ~S, ~S\n" name font-encoding) - ;;(format (current-error-port) "INPUT: ~S\n" input-encoding) - (if (and coding-command - (or - (equal? (substring coding-command 0 4) "feta") - (equal? (substring coding-command 0 8) "parmesan") - - )) - (set! coding-command #f)) - (string-append "magfont" (string-encode-integer (hashq name 1000000)) "m" (string-encode-integer (inexact->exact (round (* 1000 magnify)))) diff --git a/scm/output-ps.scm b/scm/output-ps.scm index b5a5446a32..35d850a344 100644 --- a/scm/output-ps.scm +++ b/scm/output-ps.scm @@ -222,11 +222,10 @@ (define (text font s) (let* - ( - ;; ugh, we should find a better way to - ;; extract the hsbw for /space from the font. - - (space-length (cdar (ly:text-dimension font "t"))) + ;; ugh, we should find a better way to + ;; extract the hsbw for /space from the font. + + ((space-length (cdar (ly:text-dimension font "t"))) (commands '()) (add-command (lambda (x) (set! commands (cons x commands)))) ) @@ -238,20 +237,20 @@ (add-command (string-append "(" (ps-encoding word) ") show\n"))) - (if (equal? #\space chr) + (if (equal? #\space chr) (add-command (string-append (number->string space-length) " 0.0 rmoveto ")) ) - (if (equal? #\space chr) + (if (equal? #\space chr) "" (string-append word (make-string 1 chr)))) "" - (string-append s " ")) + (string-append s " ")) (string-append (ps-font-command font) " setfont " (string-join (reverse commands))) )) - + (define (white-text scale s) (let ((mystring (string-append "(" s ") " (number->string scale) " /Helvetica-bold " -- 2.39.2