]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/modified-font-metric.cc
Cleanup: remove Simple_font_metric, Font_metric::text_dimension
[lilypond.git] / lily / modified-font-metric.cc
index ac2c88c68cd3f3151635b1e50a8bb6827a02edbf..5ad26a3548ddeecddaa645377a745ac15fa5e7fc 100644 (file)
@@ -1,9 +1,20 @@
 /*
-  modified-font-metric.cc -- declare Modified_font_metric
+  This file is part of LilyPond, the GNU music typesetter.
 
-  source file of the GNU LilyPond music typesetter
+  Copyright (C) 1999--2010 Han-Wen Nienhuys <hanwen@xs4all.nl>
 
-  (c) 1999--2008 Han-Wen Nienhuys <hanwen@xs4all.nl>
+  LilyPond is free software: you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
+
+  LilyPond is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
 */
 #include <cctype>
 using namespace std;
@@ -102,12 +113,13 @@ Modified_font_metric::derived_mark () const
 }
 
 Stencil
-Modified_font_metric::text_stencil (string text) const
+Modified_font_metric::text_stencil (Output_def* state,
+                                    string text, bool feta) const
 {
   Box b;
   if (Pango_font *pf = dynamic_cast<Pango_font *> (orig_))
     {
-      Stencil stc = pf->text_stencil (text);
+      Stencil stc = pf->text_stencil (state, text, feta);
 
       Box b = stc.extent_box ();
 
@@ -116,28 +128,7 @@ Modified_font_metric::text_stencil (string text) const
       return scaled;
     }
 
-  return Font_metric::text_stencil (text);
-}
-
-Box
-Modified_font_metric::text_dimension (string text) const
-{
-  Box b;
-  Interval ydims;
-  Real w = 0.0;
-
-  for (ssize i = 0; i < text.length (); i++)
-    {
-      Box b = get_ascii_char ((unsigned char)text[i]);
-
-      w += b[X_AXIS].length ();
-      ydims.unite (b[Y_AXIS]);
-    }
-  if (ydims.is_empty ())
-    ydims = Interval (0, 0);
-
-  b = Box (Interval (0, w), ydims);
-  return b;
+  return Font_metric::text_stencil (state, text, feta);
 }
 
 Font_metric *