]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/modified-font-metric.cc
Run `make grand-replace'.
[lilypond.git] / lily / modified-font-metric.cc
index 6d50d06d51031b3549bb8fe722af25c060e9649e..114b8e38248e4236f69a8b461285aa016c52f62c 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 1999--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
+  (c) 1999--2008 Han-Wen Nienhuys <hanwen@xs4all.nl>
 */
 #include <cctype>
 using namespace std;
@@ -13,8 +13,8 @@ using namespace std;
 #include "text-metrics.hh"
 #include "warn.hh"
 #include "stencil.hh"
-#include "lookup.hh"
 #include "main.hh"
+#include "program-option.hh"
 
 Modified_font_metric::Modified_font_metric (Font_metric *fm,
                                            Real magnification)
@@ -66,7 +66,7 @@ Modified_font_metric::count () const
 }
 
 Offset
-Modified_font_metric::attachment_point (std::string s) const
+Modified_font_metric::attachment_point (string s) const
 {
   Offset o = orig_->attachment_point (s);
   return o * magnification_;
@@ -80,7 +80,7 @@ Modified_font_metric::get_indexed_wxwy (vsize k) const
 }
 
 vsize
-Modified_font_metric::name_to_index (std::string s) const
+Modified_font_metric::name_to_index (string s) const
 {
   return orig_->name_to_index (s);
 }
@@ -104,7 +104,7 @@ Modified_font_metric::derived_mark () const
 
 /* TODO: put this klutchness behind ly:option switch.  */
 Box
-Modified_font_metric::tex_kludge (std::string text) const
+Modified_font_metric::tex_kludge (string text) const
 {
   Interval ydims;
   Real w = 0;
@@ -159,7 +159,7 @@ Modified_font_metric::tex_kludge (std::string text) const
 }
 
 Stencil
-Modified_font_metric::text_stencil (std::string text) const
+Modified_font_metric::text_stencil (string text) const
 {
   Box b;
   if (Pango_font *pf = dynamic_cast<Pango_font *> (orig_))
@@ -177,18 +177,21 @@ Modified_font_metric::text_stencil (std::string text) const
 }
 
 Box
-Modified_font_metric::text_dimension (std::string text) const
+Modified_font_metric::text_dimension (string text) const
 {
-  SCM stext = scm_makfrom0str (text.c_str ());
-  Box b = lookup_tex_text_dimension (orig_, stext);
-  if (!b[Y_AXIS].is_empty ())
+  SCM stext = ly_string2scm (text);
+  
+  Box b;
+  if (get_output_backend_name () == "tex")
     {
-      b.scale (magnification_);
-      return b;
-    }
+      b = lookup_tex_text_dimension (orig_, stext);
+
+      if (!b[Y_AXIS].is_empty ())
+       {
+         b.scale (magnification_);
+         return b;
+       }
 
-  if (output_backend_global == "tex")
-    {
       b = tex_kludge (text);
       return b;
     }
@@ -223,7 +226,7 @@ Modified_font_metric::sub_fonts () const
   return orig_->sub_fonts ();
 }
 
-std::string
+string
 Modified_font_metric::font_name () const
 {
   return original_font ()->font_name ();