From: Jan Nieuwenhuizen Date: Sat, 21 Oct 2000 13:50:52 +0000 (+0200) Subject: patch::: 1.3.96.jcn6 X-Git-Tag: release/1.3.97~5 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=5a9cd72634e721d75ea49f8985a3b34adf8fe8ff;p=lilypond.git patch::: 1.3.96.jcn6 --- diff --git a/VERSION b/VERSION index 444172cee6..40bf8d0b73 100644 --- a/VERSION +++ b/VERSION @@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=3 PATCH_LEVEL=96 -MY_PATCH_LEVEL=jcn5 +MY_PATCH_LEVEL=jcn6 # use the above to send patches: MY_PATCH_LEVEL is always empty for a # released version. diff --git a/input/test/markup.ly b/input/test/markup.ly index 9b3e531c11..5d8f0a0566 100644 --- a/input/test/markup.ly +++ b/input/test/markup.ly @@ -9,9 +9,10 @@ c-\textscript #'(bold "textb") d-\textscript #'(lines "een" "twee" "drie") e-\textscript #'(lines (bold "een") - (rows "en" "dat" "is" ((family . "orator") "2")) + (rows "en" "dat" "is" ((family . "number") "2")) (italic "drie")) f-\textscript #'(finger "3") + g-\textscript #'(music (named "noteheads-2")) } \paper{ linewidth = -1.\mm; @@ -20,6 +21,7 @@ TextScript \push #'style-sheet = #'paper16 TextScript \push #'font-family = #'roman TextScript \pop #'no-spacing-rods + TextScript \push #'direction = #1 } } } diff --git a/lily/include/text-item.hh b/lily/include/text-item.hh index 1f8beff7dd..507627b5a2 100644 --- a/lily/include/text-item.hh +++ b/lily/include/text-item.hh @@ -20,6 +20,8 @@ public: static Molecule text2molecule (Score_element *me, SCM text, SCM properties); static Molecule string2molecule (Score_element *me, SCM text, SCM properties); static Molecule markup_sentence2molecule (Score_element *me, SCM markup_sentence, SCM properties); + static Molecule lookup_character (Score_element *me, SCM font_name, SCM text); + static Molecule lookup_text (Score_element *me, SCM font_name, SCM char_name); }; #endif /* TEXT_ITEM */ diff --git a/lily/lookup.cc b/lily/lookup.cc index ef4089ca36..4396bd92ec 100644 --- a/lily/lookup.cc +++ b/lily/lookup.cc @@ -237,15 +237,6 @@ sanitise_TeX_string (String text) return text; } -/** - JUNKME - */ -String -sanitise_PS_string (String t) -{ - return t; -} - /** JUNKME */ @@ -306,8 +297,6 @@ Lookup::text (String style, String text, Paper_def *paper_l) String str (lines[i]); if (output_global_ch == "tex") str = sanitise_TeX_string (str); - else if (output_global_ch == "ps") - str = sanitise_PS_string (str); lines[i] = str; } diff --git a/lily/text-item.cc b/lily/text-item.cc index c715035e49..dda7728f25 100644 --- a/lily/text-item.cc +++ b/lily/text-item.cc @@ -7,6 +7,7 @@ Jan Nieuwenhuizen */ +#include "debug.hh" #include "text-item.hh" #include "paper-def.hh" #include "lookup.hh" @@ -70,23 +71,70 @@ Text_item::string2molecule (Score_element *me, SCM text, SCM properties) SCM f = me->get_elt_property ("properties-to-font-name"); font_name = gh_call2 (f, paper, properties); } - String font_str = "roman"; - if (gh_string_p (font_name)) - font_str = ly_scm2string (font_name); + + // should move fallback to scm + if (!gh_string_p (font_name)) + font_name = ly_str02scm ("cmr10"); - SCM magnification = me->get_elt_property ("font-magnification"); + SCM lookup = scm_assoc (ly_symbol2scm ("lookup"), properties); - Font_metric* metric_l = 0; - if (gh_number_p (magnification)) - metric_l = all_fonts_global_p->find_scaled (font_str, - gh_scm2int (magnification)); + Molecule mol; + if (gh_pair_p (lookup) && ly_symbol2string (gh_cdr (lookup)) == "name") + mol = lookup_character (me, font_name, text); else - metric_l = all_fonts_global_p->find_font (font_str); + mol = lookup_text (me, font_name, text); + + return mol; +} - SCM list = gh_list (ly_symbol2scm ("text"), text, SCM_UNDEFINED); - list = fontify_atom (metric_l, list); +/* + caching / use some form of Lookup without 'paper'? +*/ +Molecule +Text_item::lookup_character (Score_element *me, SCM font_name, SCM char_name) +{ + Adobe_font_metric *afm = all_fonts_global_p->find_afm (ly_scm2string (font_name)); + + if (!afm) + { + warning (_f ("can't find font: `%s'", ly_scm2string (font_name))); + warning (_f ("(search path: `%s')", global_path.str ().ch_C())); + error (_ ("Aborting")); + } + + AFM_CharMetricInfo const *metric = + afm->find_char_metric (ly_scm2string (char_name), true); + + if (!metric) + { + Molecule m; + m.set_empty (false); + return m; + } - return Molecule (metric_l->text_dimension (ly_scm2string (text)), list); + SCM list = gh_list (ly_symbol2scm ("char"), + gh_int2scm (metric->code), + SCM_UNDEFINED); + + list = fontify_atom (afm, list); + return Molecule (afm_bbox_to_box (metric->charBBox), list); +} + +Molecule +Text_item::lookup_text (Score_element *me, SCM font_name, SCM text) +{ + SCM magnification = me->get_elt_property ("font-magnification"); + Font_metric* metric = 0; + if (gh_number_p (magnification)) + metric = all_fonts_global_p->find_scaled (ly_scm2string (font_name), + gh_scm2int (magnification)); + else + metric = all_fonts_global_p->find_font (ly_scm2string (font_name)); + + SCM list = gh_list (ly_symbol2scm ("text"), text, SCM_UNDEFINED); + list = fontify_atom (metric, list); + + return Molecule (metric->text_dimension (ly_scm2string (text)), list); } Molecule diff --git a/scm/font.scm b/scm/font.scm index 96a8cb521b..403cca5399 100644 --- a/scm/font.scm +++ b/scm/font.scm @@ -14,10 +14,10 @@ (define style-to-font-alist '( - (finger . "* * orator * * -4") - (volta . "* * orator * * -3") - (timesig . "* * orator * * 0") - (mark . "* * orator * * 2") + (finger . "* * number * * -4") + (volta . "* * number * * -3") + (timesig . "* * number * * 0") + (mark . "* * number * * 2") (script . "* * roman * * -1") (large . "* * roman * * 1") (Large . "bold * roman * * 2") @@ -34,15 +34,15 @@ (("medium upright braces feta-braces 20" . 0) . "feta-braces20") (("bold italic dynamic feta 10" . 0) . "feta-din10") ;; Hmm - (("medium upright orator feta-nummer 13" . 3) . "feta-nummer13") - (("medium upright orator feta-nummer 13" . 2) . "feta-nummer13") - (("medium upright orator feta-nummer 12" . 1) . "feta-nummer12") - (("medium upright orator feta-nummer 10" . 0) . "feta-nummer10") - (("medium upright orator feta-nummer 8" . -1) . "feta-nummer8") - (("medium upright orator feta-nummer 6" . -2) . "feta-nummer6") - (("medium upright orator feta-nummer 5" . -3) . "feta-nummer5") - (("medium upright orator feta-nummer 4" . -4) . "feta-nummer4") - (("medium upright orator feta-nummer 3" . -5) . "feta-nummer3") + (("medium upright number feta-nummer 13" . 3) . "feta-nummer13") + (("medium upright number feta-nummer 13" . 2) . "feta-nummer13") + (("medium upright number feta-nummer 12" . 1) . "feta-nummer12") + (("medium upright number feta-nummer 10" . 0) . "feta-nummer10") + (("medium upright number feta-nummer 8" . -1) . "feta-nummer8") + (("medium upright number feta-nummer 6" . -2) . "feta-nummer6") + (("medium upright number feta-nummer 5" . -3) . "feta-nummer5") + (("medium upright number feta-nummer 4" . -4) . "feta-nummer4") + (("medium upright number feta-nummer 3" . -5) . "feta-nummer3") (("medium upright roman cmr 8" . -1) . "cmr8" ) (("medium upright roman cmr 10" . 0) . "cmr10") (("medium upright roman cmr 12" . 1) . "cmr12") @@ -114,7 +114,9 @@ (roman . (font-family . "roman")) (music . (font-family . "music")) (bold . (font-series . "bold")) - (italic . (font-shape . "italic"))) + (italic . (font-shape . "italic")) + (named . (lookup . name)) + (text . (lookup . value))) (map (lambda (x) (cons (car x) (cons 'font-style (car x)))) style-to-font-alist)))