From adf6098d9af0da439e92fc1aa2cb0aa50e59d922 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Sat, 12 Oct 2002 22:46:46 +0000 Subject: [PATCH] * lily/parser.yy (assignment): allow SCM expression as assignment. * lily/include/music-output-def.hh (class Music_output_def): * lily/music-output-def.cc: * lily/paper-def.cc: * scm/font.scm (markup-to-properties): * lily/parser.yy (music_output_def_body): remove style_sheet_ --- ChangeLog | 13 +++++- lily/bar-line.cc | 30 ++++++------- lily/bar-number-engraver.cc | 4 +- lily/font-interface.cc | 16 +++---- lily/include/music-output-def.hh | 1 - lily/music-output-def.cc | 6 --- lily/my-lily-lexer.cc | 1 - lily/parser.yy | 7 +-- lily/text-item.cc | 11 +++-- lilypond-font-lock.el | 4 +- ly/paper-as5-init.ly | 2 +- ly/paper11-init.ly | 2 +- ly/paper13-init.ly | 2 +- ly/paper16-init.ly | 2 +- ly/paper19.ly | 4 +- ly/paper20-init.ly | 2 +- ly/paper23-init.ly | 2 +- ly/paper26-init.ly | 3 +- ly/params-init.ly | 48 ++++++++++++++++++++ scm/font.scm | 75 +++++--------------------------- 20 files changed, 112 insertions(+), 123 deletions(-) diff --git a/ChangeLog b/ChangeLog index 93aa738f99..35e18b2149 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2002-10-13 Han-Wen Nienhuys + + * lily/parser.yy (assignment): allow SCM expression as assignment. + + * lily/include/music-output-def.hh (class Music_output_def): + * lily/music-output-def.cc: + * lily/paper-def.cc: + * scm/font.scm (markup-to-properties): + * lily/parser.yy (music_output_def_body): + remove style_sheet_ + 2002-10-12 Han-Wen Nienhuys * ly/grace-init.ly (startGraceMusic): shorten default grace stem @@ -113,8 +124,6 @@ 2002-09-30 Han-Wen Nienhuys - * VERSION: 1.6.5 released - * scripts/lilypond-book.py (make_pixmap): don't produce empty pages. 2002-09-28 Han-Wen Nienhuys diff --git a/lily/bar-line.cc b/lily/bar-line.cc index 43137f1c4d..717da932c1 100644 --- a/lily/bar-line.cc +++ b/lily/bar-line.cc @@ -190,20 +190,18 @@ Bar_line::get_staff_bar_size (SCM smob) ADD_INTERFACE (Bar_line, "bar-line-interface", - "Bar line. - -Print a special bar symbol. It replaces the -regular bar symbol with a special -symbol. The argument @var{bartype} is a string which specifies the -kind of bar to print. Options are @code{:|}, -@code{|:}, @code{:|:}, -@code{||}, @code{|.}, -@code{.|}, and @code{.|.}. - -These produce, respectively, a right repeat, a left repeat, a double -repeat, a double bar, a start bar, an end bar, and a thick double bar. -If @var{bartype} is set to @code{empty} then nothing is printed, -but a line break is allowed at that spot. -" -, + "Bar line.\n" +"\n" +"Print a special bar symbol. It replaces the \n" +"regular bar symbol with a special\n" +"symbol. The argument @var{bartype} is a string which specifies the\n" +"kind of bar to print. Options are @code{:|},\n" +"@code{|:}, @code{:|:},\n" +"@code{||}, @code{|.},\n" +"@code{.|}, and @code{.|.}. \n" +"\n" +"These produce, respectively, a right repeat, a left repeat, a double\n" +"repeat, a double bar, a start bar, an end bar, and a thick double bar.\n" +"If @var{bartype} is set to @code{empty} then nothing is printed,\n" +"but a line break is allowed at that spot.\n", "bar-size-procedure kern thin-kern hair-thickness thick-thickness glyph bar-size break-glyph-function"); diff --git a/lily/bar-number-engraver.cc b/lily/bar-number-engraver.cc index 8a4a0d85fd..4e1a45d180 100644 --- a/lily/bar-number-engraver.cc +++ b/lily/bar-number-engraver.cc @@ -115,8 +115,8 @@ Bar_number_engraver::create_items () } ENTER_DESCRIPTION(Bar_number_engraver, -/* descr */ "A bar number is created whenever measurePosition is zero. It is -put on top of all staves, and appears only at left side of the staff.", +/* descr */ "A bar number is created whenever measurePosition is zero. It is\n" +"put on top of all staves, and appears only at left side of the staff.", /* creats*/ "BarNumber", /* accepts */ "", /* acks */ "break-aligned-interface", diff --git a/lily/font-interface.cc b/lily/font-interface.cc index 417581fc3a..0694a85ef8 100644 --- a/lily/font-interface.cc +++ b/lily/font-interface.cc @@ -38,11 +38,9 @@ Font_interface::font_alist_chain (Grob *me) /* Ugh: why the defaults? */ - SCM defaults = ly_cdr (scm_assoc (ly_symbol2scm ("font-defaults"), - me->get_paper ()->style_sheet_)); + SCM defaults = me->get_paper ()->lookup_variable (ly_symbol2scm ("font-defaults")); SCM ch = me->get_property_alist_chain (defaults); - return ch; } @@ -107,12 +105,10 @@ Font_interface::get_font (Grob *me, SCM chain) if (!gh_string_p (name)) { - SCM ss = me->get_paper ()->style_sheet_; - - SCM proc = ly_cdr (scm_assoc (ly_symbol2scm ("properties-to-font"), - ss)); + Paper_def * p = me->get_paper (); - SCM fonts = ly_cdr (scm_assoc (ly_symbol2scm ("fonts"), ss)); + SCM proc = p->lookup_variable (ly_symbol2scm ("properties-to-font")); + SCM fonts = p->lookup_variable (ly_symbol2scm ("fonts")); assert (gh_procedure_p (proc)); name = gh_call2 (proc, fonts, chain); @@ -129,10 +125,8 @@ SCM Font_interface::add_style (Grob* me, SCM style, SCM chain) { assert (gh_symbol_p (style)); - - SCM sheet = me->get_paper ()->style_sheet_; - SCM style_alist = ly_cdr (scm_assoc (ly_symbol2scm ("style-alist"), sheet)); + SCM style_alist = me->get_paper ()->lookup_variable (ly_symbol2scm ("style-alist")); SCM entry = scm_assoc (style, style_alist); if (gh_pair_p (entry)) { diff --git a/lily/include/music-output-def.hh b/lily/include/music-output-def.hh index b01a7e8a3f..6a7df0ff3c 100644 --- a/lily/include/music-output-def.hh +++ b/lily/include/music-output-def.hh @@ -26,7 +26,6 @@ public: SCM scope_; SCM scaled_fonts_; - SCM style_sheet_; VIRTUAL_COPY_CONS (Music_output_def); Music_output_def (Music_output_def const&); diff --git a/lily/music-output-def.cc b/lily/music-output-def.cc index ee064079ab..2bfcaa075e 100644 --- a/lily/music-output-def.cc +++ b/lily/music-output-def.cc @@ -28,12 +28,9 @@ Music_output_def::get_next_score_count () const Music_output_def::Music_output_def () { - style_sheet_ = SCM_EOL; scaled_fonts_ = SCM_EOL; - translator_tab_ = new Scheme_hash_table; scope_ = SCM_EOL; - smobify_self (); scm_gc_unprotect_object (translator_tab_->self_scm ()); @@ -49,13 +46,11 @@ Music_output_def::Music_output_def (Music_output_def const &s) scope_ = SCM_EOL; translator_tab_ = new Scheme_hash_table (*s.translator_tab_); - style_sheet_ = SCM_EOL; scaled_fonts_ = SCM_EOL; smobify_self (); scm_gc_unprotect_object (translator_tab_->self_scm ()); - style_sheet_ = scm_list_copy (s.style_sheet_); scaled_fonts_ = scm_list_copy (s.scaled_fonts_); scope_= ly_make_anonymous_module (); @@ -71,7 +66,6 @@ SCM Music_output_def::mark_smob (SCM m) { Music_output_def * mo = (Music_output_def*) SCM_CELL_WORD_1 (m); - scm_gc_mark (mo->style_sheet_); scm_gc_mark (mo->translator_tab_->self_scm ()); scm_gc_mark (mo->scope_); diff --git a/lily/my-lily-lexer.cc b/lily/my-lily-lexer.cc index 2abbd0946e..edc49b7c50 100644 --- a/lily/my-lily-lexer.cc +++ b/lily/my-lily-lexer.cc @@ -84,7 +84,6 @@ static Keyword_ent the_key_tab[]={ {"partcombine", PARTCOMBINE}, {"score", SCORE}, {"script", SCRIPT}, - {"stylesheet", STYLESHEET}, {"skip", SKIP}, {"tempo", TEMPO}, {"translator", TRANSLATOR}, diff --git a/lily/parser.yy b/lily/parser.yy index 9bb82de271..2492b91be2 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -351,9 +351,6 @@ toplevel_expression: else if (dynamic_cast ($1)) THIS->lexer_->set_identifier (scm_makfrom0str ("$defaultmidi"), $1->self_scm ()); } - | embedded_scm { - // junk value - } ; embedded_scm: @@ -433,6 +430,7 @@ all objects can be unprotected as soon as they're here. */ } + | embedded_scm { } ; @@ -639,9 +637,6 @@ music_output_def_body: | music_output_def_body translator_spec_block { $$->assign_translator ($2); } - | music_output_def_body STYLESHEET embedded_scm { - dynamic_cast ($$)-> style_sheet_ = $3; - } | music_output_def_body tempo_event { /* junk this ? there already is tempo stuff in diff --git a/lily/text-item.cc b/lily/text-item.cc index 6e70076a55..f503ab8592 100644 --- a/lily/text-item.cc +++ b/lily/text-item.cc @@ -111,13 +111,18 @@ Molecule Text_item::markup_text2molecule (Grob *me, SCM markup_text, SCM alist_chain) { - SCM sheet = me->get_paper ()->style_sheet_; - SCM f = ly_cdr (scm_assoc (ly_symbol2scm ("markup-to-properties"), sheet)); + SCM f = me->get_paper ()->lookup_variable (ly_symbol2scm ("markup-to-properties")); SCM markup = ly_car (markup_text); SCM text = ly_cdr (markup_text); - SCM p = gh_cons (gh_call2 (f, sheet, markup), alist_chain); + /* ARGRGRRGRARGRA + */ + + SCM abbrev = me->get_paper ()->lookup_variable (ly_symbol2scm ("abbreviation-alist")); + SCM style = me->get_paper ()->lookup_variable (ly_symbol2scm ("style-alist")); + + SCM p = gh_cons (scm_call_3 (f, abbrev, style, markup), alist_chain); Real staff_space = Staff_symbol_referencer::staff_space (me); diff --git a/lilypond-font-lock.el b/lilypond-font-lock.el index e2ff2655f5..8d34f5ded3 100644 --- a/lilypond-font-lock.el +++ b/lilypond-font-lock.el @@ -39,7 +39,7 @@ "clipping" "[cm]m" "coda" "complex" "\\(command\\)?spanrequest" "consists\\(end\\)?" "context" "contrabasso" "\\(de\\)?cr" "default" "denies" "different" "dirs" -"down\\(bow\\|prall\\)?" "duration" "\\(dynamic\\|text\\)?script" +"down\\(bow\\|prall\\)?" "duration" "\\(text\\)?script" "eccentric" "eg" "embeddedps" "elementdescriptions" "\\(end\\)?cresc" "ex\\(treme\\)?" "fermata" "f+" "figures" "font" "flageolet" "fp" "fragment" "s?fz" "gliss\\(ando\\)?" "gg" "gmsus" "grace" "gr\\(and\\)?staff" @@ -60,7 +60,7 @@ "simultaneous" "singlepart" "skip" "small" "\\(smart\\)?transpose" "s[pf]+" "staccat\\(issim\\)?o" "staff\\(height\\|space\\)" "start" "stop\\(ped\\)?" -"st\\(paper\\|score\\)" "stuff" "stylesheet" "su" "tab" "tempo" "tenuto" +"st\\(paper\\|score\\)" "stuff" "su" "tab" "tempo" "tenuto" "thenotes" "thrd" "threevoice" "thumb" "tilt\\(down\\|up\\)" "timb" "times?" "tiny" "toeters" "touch" "translator" "trill" "type" "t\\(wo\\(voice\\(steminvert\\)?\\)?\\)?" diff --git a/ly/paper-as5-init.ly b/ly/paper-as5-init.ly index c2fcfa8497..18ff108c66 100644 --- a/ly/paper-as5-init.ly +++ b/ly/paper-as5-init.ly @@ -5,7 +5,7 @@ paperAsFive = \paper { staffheight = 5.\char - \stylesheet #(as-make-style-sheet 'as5) + \stylesheet #(as-make-font-list 'as5) \translator { \StaffContext barSize = #5 } diff --git a/ly/paper11-init.ly b/ly/paper11-init.ly index f92047ce1b..dbd03094c1 100644 --- a/ly/paper11-init.ly +++ b/ly/paper11-init.ly @@ -4,7 +4,7 @@ paperEleven = \paper { staffheight = 11.0\pt - \stylesheet #(make-style-sheet 'paper11) + #(define fonts (make-font-list 'paper11)) \include "params-init.ly" } diff --git a/ly/paper13-init.ly b/ly/paper13-init.ly index 8c557bfdad..dbacf585dc 100644 --- a/ly/paper13-init.ly +++ b/ly/paper13-init.ly @@ -6,7 +6,7 @@ paperThirteen = \paper { staffheight = 13.0\pt - \stylesheet #(make-style-sheet 'paper13) + #(define fonts (make-font-list 'paper13)) \include "params-init.ly" } diff --git a/ly/paper16-init.ly b/ly/paper16-init.ly index 4b154bc867..453c823d1d 100644 --- a/ly/paper16-init.ly +++ b/ly/paper16-init.ly @@ -4,7 +4,7 @@ paperSixteen = \paper { staffheight = 16.0\pt - \stylesheet #(make-style-sheet 'paper16) + \stylesheet #(make-font-list 'paper16) \include "params-init.ly" } diff --git a/ly/paper19.ly b/ly/paper19.ly index b1ae87e08d..89d4321bbc 100644 --- a/ly/paper19.ly +++ b/ly/paper19.ly @@ -5,8 +5,8 @@ paperNineteen = \paper { staffheight = 19.0\pt - \stylesheet #(make-style-sheet 'paper19) - + #(define fonts (make-font-list 'paper19)) + \include "params-init.ly" } diff --git a/ly/paper20-init.ly b/ly/paper20-init.ly index e32470b781..55f9613521 100644 --- a/ly/paper20-init.ly +++ b/ly/paper20-init.ly @@ -5,7 +5,7 @@ paperTwenty = \paper { staffheight = 20.0\pt - \stylesheet #(make-style-sheet 'paper20) + #(define fonts (make-font-list 'paper20)) \include "params-init.ly" } diff --git a/ly/paper23-init.ly b/ly/paper23-init.ly index 4e95f7edae..40730e0316 100644 --- a/ly/paper23-init.ly +++ b/ly/paper23-init.ly @@ -5,7 +5,7 @@ paperTwentythree = \paper { staffheight = 23.0\pt - \stylesheet #(make-style-sheet 'paper23) + #(define fonts (make-font-list 'paper23)) \include "params-init.ly" } diff --git a/ly/paper26-init.ly b/ly/paper26-init.ly index 53c7bb6a22..0e5845ae10 100644 --- a/ly/paper26-init.ly +++ b/ly/paper26-init.ly @@ -4,8 +4,7 @@ paperTwentysix = \paper { staffheight = 26.0\pt - \stylesheet #(make-style-sheet 'paper26) - + #(define fonts (make-font-list 'paper26)) \include "params-init.ly" } diff --git a/ly/params-init.ly b/ly/params-init.ly index f35faf4ef4..8e144cc9a7 100644 --- a/ly/params-init.ly +++ b/ly/params-init.ly @@ -54,3 +54,51 @@ interscoreline = 4. \mm +#(define font-defaults + '((font-family . music) + (font-relative-size . 0) + (font-shape . upright) + (font-series . medium) + )) + +#(define style-alist + '((finger . ((font-family . number) (font-relative-size . -3))) + (volta . ((font-family . number) (font-relative-size . -2))) + (tuplet . ((font-family . roman) (font-shape . italic) (font-relative-size . -1))) + + (timesig . ((font-family . number) )) + (timesig-symbol . ((font-family . music) )) + + (mmrest . ((font-family . number) )) + (mmrest-symbol . ((font-family . music) )) + + (mark-number . ((font-family . number) (font-relative-size . 1))) + (mark-letter . ((font-family . roman) + (font-series . bold) + (font-shape . upright) + (font-relative-size . 2))) + + (script . ((font-family . roman) (font-relative-size . -1))) + (large . ((font-family . roman) (font-relative-size . 1))) + (Large . ((font-series . bold) (font-family . roman) + (font-relative-size . 2))) + (dynamic . ((font-family . dynamic) (font-relative-size . 0))) + )) +#(define properties-to-font Font_interface::properties_to_font_name) +#(define markup-to-properties markup-to-properties) +#(define abbreviation-alist + '((columns . ((axis . 0))) + (lines . ((axis . 1))) + (roman . ((font-family . roman))) + (music . ((font-family . music) (lookup . name))) + (finger . ((font-style . finger))) + (bold . ((font-series . bold))) + (upright . ((font-shape . upright))) + (italic . ((font-shape . italic))) + (named . ((lookup . name))) + (overstrike . ((extent . (0 . 0)))) + (super . ((raise . 1) (font-relative-size . -1) (extent . (0 . 0)))) + (sub . ((raise . -1) (font-relative-size . -1) (extent . (0 . 0)))) + (text . ((lookup . value))) + ) + ) diff --git a/scm/font.scm b/scm/font.scm index e4d95ba338..805d26cab9 100644 --- a/scm/font.scm +++ b/scm/font.scm @@ -39,7 +39,8 @@ font-descr-alist) ) -(define paper-style-sheet-alist + +(define size-independent-fonts `( ((* * * braces *) . ("feta-braces0" "feta-braces1" @@ -225,61 +226,9 @@ paper20-style-sheet-alist)) font-list-alist))) -(define-public (make-style-sheet sym) - `((fonts . ,(append paper-style-sheet-alist - (cdr (assoc sym font-list-alist)))) - (font-defaults - . ((font-family . music) - (font-relative-size . 0) - (font-shape . upright) - (font-series . medium) - )) - (style-alist - . ((finger . ((font-family . number) (font-relative-size . -3))) - (volta . ((font-family . number) (font-relative-size . -2))) - (tuplet . ((font-family . roman) (font-shape . italic) (font-relative-size . -1))) - - (timesig . ((font-family . number) )) - (timesig-symbol . ((font-family . music) )) - - (mmrest . ((font-family . number) )) - (mmrest-symbol . ((font-family . music) )) - - (mark-number . ((font-family . number) (font-relative-size . 1))) - (mark-letter . ((font-family . roman) - (font-series . bold) - (font-shape . upright) - (font-relative-size . 2))) - - (script . ((font-family . roman) (font-relative-size . -1))) - (large . ((font-family . roman) (font-relative-size . 1))) - (Large . ((font-series . bold) (font-family . roman) - (font-relative-size . 2))) - (dynamic . ((font-family . dynamic) (font-relative-size . 0))) - )) - (properties-to-font . - ,Font_interface::properties_to_font_name) - - (markup-to-properties . ,markup-to-properties) - (abbreviation-alist - . ((columns . ((axis . 0))) - (lines . ((axis . 1))) - (roman . ((font-family . roman))) - (music . ((font-family . music) (lookup . name))) - (finger . ((font-style . finger))) - (bold . ((font-series . bold))) - (upright . ((font-shape . upright))) - (italic . ((font-shape . italic))) - (named . ((lookup . name))) - (overstrike . ((extent . (0 . 0)))) - (super . ((raise . 1) (font-relative-size . -1) (extent . (0 . 0)))) - (sub . ((raise . -1) (font-relative-size . -1) (extent . (0 . 0)))) - (text . ((lookup . value))) - ) - ) - - ) - ) +(define-public (make-font-list sym) + (append size-independent-fonts + (cdr (assoc sym font-list-alist)))) (define (qualifiers-to-fontnames qualifiers font-descr-alist) " reduce the font list by successively applying a font-qualifier." @@ -374,7 +323,8 @@ and warn if the selected font is not unique. selected) ; return the topmost. )) -(define (markup-to-properties sheet markup) +(define-public (markup-to-properties abbrev-alist style-alist markup) + "DOCME." ;; (display "markup: `") ;; (write markup) ;; (display "'\n") @@ -389,19 +339,18 @@ and warn if the selected font is not unique. (or (not (pair? (cdr markup))) (number? (cadr markup)))) (if (equal? '() (cdr markup)) - (markup-to-properties sheet (car markup)) + (markup-to-properties abbrev-alist style-alist (car markup)) (list markup)) (if (equal? '() (cdr markup)) - (markup-to-properties sheet (car markup)) - (append (markup-to-properties sheet (car markup)) - (markup-to-properties sheet (cdr markup))))) + (markup-to-properties abbrev-alist style-alist (car markup)) + (append (markup-to-properties abbrev-alist style-alist (car markup)) + (markup-to-properties abbrev-alist style-alist (cdr markup))))) ;; markup is single abbreviation (let ((entry (assoc markup ;; assoc-chain? - (append (cdr (assoc 'abbreviation-alist sheet)) - (cdr (assoc 'style-alist sheet)))))) + (append abbrev-alist style-alist)))) (if entry (cdr entry) (list (cons markup #t)))))) -- 2.39.5