]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/font-metric.cc
release: 1.3.131
[lilypond.git] / lily / font-metric.cc
index 8ff6a36bac4127269a6525f81d4437ee31b0f380..e8682df66bf4ffa7bb522ef183c9568b60cc014d 100644 (file)
@@ -3,7 +3,7 @@
   
   source file of the GNU LilyPond music typesetter
   
-  (c) 1999--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c) 1999--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 
     Mats Bengtsson <matsb@s3.kth.se>  (the ugly TeX parsing in text_dimension)
  */
@@ -11,6 +11,7 @@
 #include <math.h>
 #include <ctype.h>
 
+#include "warn.hh"
 #include "molecule.hh"
 #include "ly-smobs.icc"
 #include "font-metric.hh"
@@ -69,7 +70,7 @@ Font_metric::Font_metric ()
   smobify_self ();
 }
 
-Font_metric::Font_metric (Font_metric const &)
+Font_metric::Font_metric (Font_metric const &s)
 {
 }
 
@@ -112,4 +113,24 @@ Font_metric::find_by_name (String) const
 }
 
 
+SCM
+ly_find_glyph_by_name (SCM font, SCM name)
+{
+  if (!unsmob_metrics (font) || !gh_string_p (name))
+    {
+      warning ("ly-find-glyph-by-name: invalid argument.");
+      Molecule m;
+      return m.smobbed_copy ();
+    }
+
+  return unsmob_metrics (font)->find_by_name (ly_scm2string (name)).smobbed_copy ();
+}
+
+
+static void
+font_metric_init ()
+{
+   scm_make_gsubr ("ly-find-glyph-by-name", 2 , 0, 0, (Scheme_function_unknown) ly_find_glyph_by_name);
+}
 
+ADD_SCM_INIT_FUNC(font_metric_init, font_metric_init);