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)
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;
}
return tab;
}
-
Index_to_charcode_map
make_index_to_charcode_map (FT_Face face)
{
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);
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;
}
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
{
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);
}
{
return lily_global_table_;
}
+
+String
+Open_type_font::font_name () const
+{
+ return FT_Get_Postscript_Name (face_);
+}
+