From 11f6a05bf816ac813748ed0c47e7e2e4a765f3d1 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Tue, 10 Sep 2002 22:24:51 +0000 Subject: [PATCH] 2002-09-10 Juergen Reuter * lily/stem.cc: added warning when font symbol not found; small cleanups --- ChangeLog | 6 ++++++ lily/stem.cc | 58 +++++++++++++++++++++++++++++++++------------------- 2 files changed, 43 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index eebd381a10..52c23ae1ee 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ + +2002-09-10 Juergen Reuter + + * lily/stem.cc: added warning when font symbol not found; + small cleanups + 2002-09-11 Han-Wen Nienhuys * mf/GNUmakefile: make PFA for sauter CM fonts. diff --git a/lily/stem.cc b/lily/stem.cc index 510ca1b60d..c9deff1dc9 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -533,17 +533,12 @@ Stem::flag (Grob*me) e.g. "stroke-style", maybe with values "" (i.e. no stroke), "single" and "double". Needs more discussion. */ - String style, fstyle, staffline_offs; - SCM fst = me->get_grob_property ("flag-style"); - if (gh_string_p (fst)) - { - fstyle = ly_scm2string (fst); - } + String style, staffline_offs; - SCM st = me->get_grob_property ("style"); - if (gh_symbol_p (st)) + SCM style_scm = me->get_grob_property ("style"); + if (gh_symbol_p (style_scm)) { - style = (ly_scm2string (scm_symbol_to_string (st))); + style = (ly_scm2string (scm_symbol_to_string (style_scm))); } else { @@ -585,10 +580,9 @@ Stem::flag (Grob*me) --hwn. */ - Grob *first = first_head(me); - int sz = Staff_symbol_referencer::line_count (me)-1; - int p = (int)rint (Staff_symbol_referencer::get_position (first)); - staffline_offs = (((p ^ sz) & 0x1) == 0) ? "1" : "0"; + int p = (int)rint (Staff_symbol_referencer::get_position (first_head (me))); + staffline_offs = Staff_symbol_referencer::on_staffline (me, p) ? + "1" : "0"; } else { @@ -599,14 +593,36 @@ Stem::flag (Grob*me) { staffline_offs = ""; } - char c = (get_direction (me) == UP) ? 'u' : 'd'; - String index_string - = String ("flags-") + style + to_string (c) + staffline_offs + to_string (duration_log (me)); - Molecule m - = Font_interface::get_default_font (me)->find_by_name (index_string); - if (!fstyle.empty_b ()) - m.add_molecule (Font_interface::get_default_font (me)->find_by_name (String ("flags-") + to_string (c) + fstyle)); - return m; + char dir = (get_direction (me) == UP) ? 'u' : 'd'; + String font_char = + style + to_string (dir) + staffline_offs + to_string (duration_log (me)); + Font_metric *fm = Font_interface::get_default_font (me); + Molecule flag = fm->find_by_name ("flags-" + font_char); + if (flag.empty_b ()) + { + me->warning (_f ("flag `%s' not found", font_char)); + } + + SCM stroke_scm = me->get_grob_property ("flag-style"); + if (gh_string_p (stroke_scm)) + { + String stroke = ly_scm2string (stroke_scm); + if (!stroke.empty_b ()) + { + String font_char = to_string (dir) + stroke; + Molecule stroke = fm->find_by_name ("flags-" + font_char); + if (stroke.empty_b ()) + { + me->warning (_f ("flag stroke `%s' not found", font_char)); + } + else + { + flag.add_molecule (stroke); + } + } + } + + return flag; } MAKE_SCHEME_CALLBACK (Stem,dim_callback,2); -- 2.39.5