]> git.donarmstrong.com Git - lilypond.git/commitdiff
Fix #313.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 10 Jun 2008 03:12:23 +0000 (00:12 -0300)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 10 Jun 2008 03:12:23 +0000 (00:12 -0300)
Print warning if music-glyph cannot be found.

lily/font-metric-scheme.cc
lily/line-interface.cc
scm/define-markup-commands.scm

index 88cfc58e2b707662fd496719b98db9aaf8641d03..b06d419b99e4342e52d5ca8b7f4bdd55ba3cfbc2 100644 (file)
@@ -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);
index 13f5a8cdef59e6d863e4745d379712eb75ae52e1..c662d77d9f84f42b97e62d71f2c17b7320f113fc 100644 (file)
@@ -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,
index 36d981b06eb28b0f800c51e61f6b6dd927fb050d..611e3eb08d36783821df171303cee0fe4a32f745 100644 (file)
@@ -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?)