]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/font-metric-scheme.cc
Merge branch 'master' of git+ssh://jneem@git.sv.gnu.org/srv/git/lilypond
[lilypond.git] / lily / font-metric-scheme.cc
index b24a94c3dbd4c3ad03b9a9bb405d473c9b93188d..18edb7513a060344de7036c85cb641ae29376493 100644 (file)
@@ -3,11 +3,13 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 2005--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
+  (c) 2005--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
 */
 
-#include "stencil.hh"
 #include "font-metric.hh"
+
+#include "warn.hh"
+#include "stencil.hh"
 #include "modified-font-metric.hh"
 
 LY_DEFINE (ly_font_get_glyph, "ly:font-get-glyph",
@@ -72,11 +74,8 @@ LY_DEFINE (ly_font_glyph_name_to_charcode, "ly:font-glyph-name-to-charcode",
   Font_metric *fm = unsmob_metrics (font);
   SCM_ASSERT_TYPE (fm, font, SCM_ARG1, __FUNCTION__, "font-metric");
   SCM_ASSERT_TYPE (scm_is_string (name), name, SCM_ARG2, __FUNCTION__, "string");
-#if 1
+
   return scm_from_unsigned_integer (fm->index_to_charcode (fm->name_to_index (ly_scm2string (name))));
-#else
-  return scm_from_unsigned_integer (fm->glyph_name_to_charcode (ly_scm2string (name)));
-#endif
 }
 
 LY_DEFINE (ly_text_dimension, "ly:text-dimension",
@@ -97,6 +96,10 @@ LY_DEFINE (ly_text_dimension, "ly:text-dimension",
                   ly_interval2scm (stc.extent (Y_AXIS)));
 }
 
+
+/*
+  TODO: when are non string retvals allowed?
+ */
 LY_DEFINE (ly_font_file_name, "ly:font-file-name",
           1, 0, 0,
           (SCM font),
@@ -105,7 +108,9 @@ LY_DEFINE (ly_font_file_name, "ly:font-file-name",
 {
   Font_metric *fm = unsmob_metrics (font);
   SCM_ASSERT_TYPE (fm, font, SCM_ARG1, __FUNCTION__, "font-metric");
-  return fm->font_file_name ();
+  SCM name = fm->font_file_name ();
+
+  return name;
 }
 
 LY_DEFINE (ly_font_name, "ly:font-name",
@@ -117,13 +122,13 @@ LY_DEFINE (ly_font_name, "ly:font-name",
   Font_metric *fm = unsmob_metrics (font);
 
   SCM_ASSERT_TYPE (fm, font, SCM_ARG1, __FUNCTION__, "font-metric");
-  return scm_makfrom0str (fm->font_name ().c_str ());
+  return ly_string2scm (fm->font_name ());
 }
 
 LY_DEFINE (ly_font_magnification, "ly:font-magnification", 1, 0, 0,
           (SCM font),
           "Given the font metric @var{font}, return the "
-          "magnification, relative to the current outputscale.")
+          "magnification, relative to the current outputs-cale.")
 {
   Font_metric *fm = unsmob_metrics (font);
   SCM_ASSERT_TYPE (fm, font, SCM_ARG1, __FUNCTION__, "font-metric");
@@ -133,7 +138,7 @@ LY_DEFINE (ly_font_magnification, "ly:font-magnification", 1, 0, 0,
 LY_DEFINE (ly_font_design_size, "ly:font-design-size", 1, 0, 0,
           (SCM font),
           "Given the font metric @var{font}, return the "
-          "design size, relative to the current outputscale.")
+          "design size, relative to the current output-scale.")
 {
   Font_metric *fm = unsmob_metrics (font);
   SCM_ASSERT_TYPE (fm, font, SCM_ARG1, __FUNCTION__, "font-metric");