]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/open-type-font.cc
remove PDF related files
[lilypond.git] / lily / open-type-font.cc
index e17fbc1bd09f5aa966aa044513593676b0b7da5a..dabbbba28609171f2ed58bdcabaf45991e260005 100644 (file)
@@ -3,8 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 2004 Han-Wen Nienhuys <hanwen@xs4all.nl>
-
+  (c) 2004--2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
 */
 
 #include <map>
 #include "dimensions.hh"
 #include "modified-font-metric.hh"
 
-const Real point_constant = 1 PT;
-
 FT_Byte *
 load_table (char const *tag_str, FT_Face face, FT_ULong *length)
 {
-  FT_ULong tag = FT_MAKE_TAG(tag_str[0], tag_str[1], tag_str[2], tag_str[3]);
+  FT_ULong tag = FT_MAKE_TAG (tag_str[0], tag_str[1], tag_str[2], tag_str[3]);
 
   int error_code = FT_Load_Sfnt_Table (face, tag, 0, NULL, length);
   if (!error_code)
@@ -33,9 +30,7 @@ load_table (char const *tag_str, FT_Face face, FT_ULong *length)
 
       error_code = FT_Load_Sfnt_Table (face, tag, 0, buffer, length );
       if (error_code)
-       {
-         error (_f ("Could not load %s font table", tag_str));
-       }
+       error (_f ("Could not load %s font table", tag_str));
 
       return buffer;
     }
@@ -61,7 +56,6 @@ load_scheme_table (char const *tag_str, FT_Face face)
   return tab;
 }
 
-
 Index_to_charcode_map 
 make_index_to_charcode_map (FT_Face face)
 {
@@ -147,9 +141,7 @@ Open_type_font::get_indexed_char (int signed_idx) const
       char name[len];
       int code = FT_Get_Glyph_Name (face_, signed_idx, name, len);
       if (code)
-       {
-         warning ("FT_Get_Glyph_Name() returned error");
-       }
+       warning (_f ("FT_Get_Glyph_Name() returned error: %d", code));
        
       SCM sym = ly_symbol2scm (name);
       SCM alist = scm_hashq_ref (lily_character_table_, sym, SCM_BOOL_F);
@@ -184,7 +176,7 @@ Open_type_font::get_indexed_char (int signed_idx) const
   Box b (Interval (-hb, m.width - hb),
         Interval (-vb, m.height - vb));
 
-  b.scale (design_size () * Real (point_constant) / face_->units_per_EM);
+  b.scale (design_size ()  / Real (face_->units_per_EM));
   return b;
 }
 
@@ -203,14 +195,6 @@ Open_type_font::index_to_charcode (int i) const
   return ((Open_type_font*) this)->index_to_charcode_map_[i];
 }
 
-#if 0
-unsigned
-Open_type_font::glyph_name_to_index (String glyph_name) const
-{
-  return ((Open_type_font*) this)->glyph_name_to_charcode_map_[glyph_name];
-}
-#endif
-
 int
 Open_type_font::count () const
 {
@@ -221,9 +205,16 @@ Real
 Open_type_font::design_size () const
 {
   SCM entry = scm_hashq_ref (lily_global_table_,
-                            ly_symbol2scm ("staffsize"),
-                            scm_from_int (12));
-  return scm_to_double (entry);
+                            ly_symbol2scm ("design_size"),
+
+                            /*
+                              Hmm. Design size is arbitrary for
+                              non-design-size fonts. I vote for 1 -
+                              which will trip errors more
+                              quickly. --hwn.
+                             */
+                            scm_from_int (1));
+  return scm_to_double (entry) * Real (point_constant);
 }
 
 
@@ -276,3 +267,10 @@ Open_type_font::get_global_table () const
 {
   return lily_global_table_;
 }
+
+String
+Open_type_font::font_name () const
+{
+  return FT_Get_Postscript_Name (face_);
+}
+