]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/include/font-metric.hh
unsmob_pitch -> Pitch::unsmob and related
[lilypond.git] / lily / include / font-metric.hh
index d43403b378458da995e625be130f4c34b1a87737..720f33b8375799f47110dfe07f8cc12553e2006e 100644 (file)
@@ -1,45 +1,60 @@
 /*
-  font-metric.hh -- declare Font_metric
+  This file is part of LilyPond, the GNU music typesetter.
 
-  source file of the GNU LilyPond music typesetter
+  Copyright (C) 1999--2014 Han-Wen Nienhuys <hanwen@xs4all.nl>
 
-  (c) 1999--2006 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/>.
 */
 
 #ifndef FONT_METRIC_HH
 #define FONT_METRIC_HH
 
 #include "box.hh"
+#include "freetype.hh"
 #include "lily-proto.hh"
 #include "smobs.hh"
 #include "virtual-methods.hh"
 
+#include <map>
+
+typedef std::map<FT_UInt, FT_ULong> Index_to_charcode_map;
+
 class Font_metric
 {
-  DECLARE_CLASSNAME(Font_metric);
+  DECLARE_CLASSNAME (Font_metric);
 
 public:
   SCM description_;
-  std::string file_name_;
-
-  virtual Stencil text_stencil (std::string) const;
-  virtual Box text_dimension (std::string) const;
-  virtual std::string font_name () const;
-  virtual int count () const;
-  virtual Offset attachment_point (std::string) const;
-  virtual Offset get_indexed_wxwy (int) const;
-  virtual Box get_indexed_char (int index) const;
-  virtual Box get_ascii_char (int ascii) const;
-  virtual int name_to_index (std::string) const;
-  virtual unsigned index_to_charcode (int) const;
-  virtual int index_to_ascii (int) const;
+  string file_name_;
+
+  // Return stencil for given string. output_state may be modified to
+  // record the font.
+  virtual Stencil text_stencil (Output_def *output_state,
+                                const string &text, bool music) const;
+
+  virtual string font_name () const;
+  virtual size_t count () const;
+  virtual Offset attachment_point (const string&) const;
+  virtual Offset get_indexed_wxwy (size_t) const;
+  virtual Box get_indexed_char_dimensions (size_t index) const;
+  virtual size_t name_to_index (string) const=0;
+  virtual size_t index_to_charcode (size_t) const;
   virtual Real design_size () const;
-  virtual Stencil find_by_name (std::string) const;
-  virtual Stencil get_indexed_char_stencil (int k) const;
-  virtual Stencil get_ascii_char_stencil (int k) const;
+  virtual Stencil find_by_name (string) const;
   virtual SCM sub_fonts () const;
   virtual SCM font_file_name () const;
-  DECLARE_SMOBS (Font_metric,);
+  DECLARE_SMOBS (Font_metric);
 
 private:
   /* No copying, no implicit copy constructor.  */
@@ -51,16 +66,7 @@ protected:
   Font_metric ();
 };
 
-int get_encoded_index (Font_metric *m, std::string input_coding, int code);
-
-class Simple_font_metric : public Font_metric
-{
-  DECLARE_CLASSNAME(Simple_font_metric);
-public:
-};
-
-DECLARE_UNSMOB (Font_metric, metrics);
 
-Box lookup_tex_text_dimension (Font_metric *font, SCM text);
+char *pfb2pfa (Byte const *pfb, int length);
 
 #endif /* FONT_METRIC_HH */