From: Han-Wen Nienhuys Date: Tue, 10 Jun 2008 03:12:23 +0000 (-0300) Subject: Fix #313. X-Git-Tag: release/2.11.49-1~3 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=306a877dfa0fa36c53f647df9d8bfa8306dc3c50;p=lilypond.git Fix #313. Print warning if music-glyph cannot be found. --- diff --git a/lily/font-metric-scheme.cc b/lily/font-metric-scheme.cc index 88cfc58e2b..b06d419b99 100644 --- a/lily/font-metric-scheme.cc +++ b/lily/font-metric-scheme.cc @@ -16,8 +16,7 @@ LY_DEFINE (ly_font_get_glyph, "ly:font-get-glyph", 2, 0, 0, (SCM font, SCM name), "Return a stencil from @var{font} for the glyph named @var{name}." - " @var{font} must be available as an AFM file. If the glyph" - " is not available, return @code{#f}.") + " If the glyph is not available, return an empty stencil.") { Font_metric *fm = unsmob_metrics (font); LY_ASSERT_SMOB (Font_metric, font, 1); diff --git a/lily/line-interface.cc b/lily/line-interface.cc index 13f5a8cdef..c662d77d9f 100644 --- a/lily/line-interface.cc +++ b/lily/line-interface.cc @@ -210,7 +210,7 @@ Line_interface::line (Grob *me, Offset from, Offset to) else if (type == ly_symbol2scm ("trill")) return make_trill_line (me, from, to); - Stencil stil; + Stencil stencil; if (type == ly_symbol2scm ("dashed-line") || type == ly_symbol2scm ("dotted-line")) { @@ -239,12 +239,12 @@ Line_interface::line (Grob *me, Offset from, Offset to) */ period = ((to-from).length () - period * fraction) / n; } - stil = make_dashed_line (thick, from, to, period, fraction); + stencil = make_dashed_line (thick, from, to, period, fraction); } else - stil = make_line (thick, from, to); + stencil = make_line (thick, from, to); - return stil; + return stencil; } ADD_INTERFACE (Line_interface, diff --git a/scm/define-markup-commands.scm b/scm/define-markup-commands.scm index 36d981b06e..611e3eb08d 100644 --- a/scm/define-markup-commands.scm +++ b/scm/define-markup-commands.scm @@ -1561,10 +1561,14 @@ the possible glyphs. \\musicglyph #\"clefs.G_change\" } @end lilypond" - (ly:font-get-glyph - (ly:paper-get-font layout (cons '((font-encoding . fetaMusic)) - props)) - glyph-name)) + + (let* ((font (ly:paper-get-font layout (cons '((font-encoding . fetaMusic)) + props))) + (glyph (ly:font-get-glyph font glyph-name))) + (if (null? (ly:stencil-expr glyph)) + (ly:warning (_ "Cannot find glyph ~a") glyph-name)) + + glyph)) (define-builtin-markup-command (lookup layout props glyph-name) (string?)