source file of the GNU LilyPond music typesetter
- (c) 1999--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ (c) 1999--2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
*/
#include "all-font-metrics.hh"
All_font_metrics::~All_font_metrics ()
{
- scm_gc_unprotect_object (afm_dict_->self_scm ());
- scm_gc_unprotect_object (tfm_dict_->self_scm ());
- scm_gc_unprotect_object (otf_dict_->self_scm ());
+ afm_dict_->unprotect ();
+ tfm_dict_->unprotect ();
+ otf_dict_->unprotect ();
#if HAVE_PANGO_FT2
- scm_gc_unprotect_object (pango_dict_->self_scm ());
+ pango_dict_->unprotect ();
g_object_unref (pango_ft2_fontmap_);
#endif
}
Pango_font *
All_font_metrics::find_pango_font (PangoFontDescription *description,
Real magnification,
- Real output_scale)
+ Real output_scale
+ )
{
pango_font_description_set_size (description,
gint (magnification *
SCM val;
if (!pango_dict_->try_retrieve (key, &val))
{
- progress_indication ("[" + String (pango_fn));
-
+ if (be_verbose_global)
+ progress_indication ("[" + String (pango_fn));
+
Pango_font *pf = new Pango_font (pango_ft2_fontmap_,
- RIGHT,
description,
- output_scale);
+ output_scale
+ );
+
val = pf->self_scm ();
pango_dict_->set (key, val);
- scm_gc_unprotect_object (val);
+ pf->unprotect ();
if (be_verbose_global)
progress_indication ("]");
pf->description_ = scm_cons (SCM_BOOL_F,
- scm_make_real (1.0));
+ scm_from_double (1.0));
}
g_free (pango_fn);
return dynamic_cast<Pango_font *> (unsmob_metrics (val));
if (path.length () > 0)
return path;
- SCM kpath = ly_lily_module_constant ("ly:kpathsea-find-file");
- if (ly_c_procedure_p (kpath))
+ static SCM proc;
+ if (!proc)
+ {
+ SCM module = scm_c_resolve_module ("scm kpathsea");
+ proc = scm_c_module_lookup (module, "ly:kpathsea-find-file");
+ proc = scm_variable_ref (proc);
+ }
+
+ if (ly_is_procedure (proc))
{
- SCM kp_result = scm_call_1 (kpath, scm_makfrom0str (name.to_str0 ()));
+ SCM kp_result = scm_call_1 (proc, scm_makfrom0str (name.to_str0 ()));
if (scm_is_string (kp_result))
return ly_scm2string (kp_result);
}
unsmob_metrics (val)->file_name_ = file_name;
unsmob_metrics (val)->description_ = scm_cons (name_string,
- scm_make_real (1.0));
+ scm_from_double (1.0));
if (be_verbose_global)
progress_indication ("]");
afm_dict_->set (sname, val);
- scm_gc_unprotect_object (val);
+ unsmob_metrics (val)->unprotect ();
Adobe_font_metric *afm
= dynamic_cast<Adobe_font_metric *> (unsmob_metrics (val));
unsmob_metrics (val)->file_name_ = file_name;
unsmob_metrics (val)->description_ = scm_cons (name_string,
- scm_make_real (1.0));
+ scm_from_double (1.0));
otf_dict_->set (sname, val);
- scm_gc_unprotect_object (val);
+ unsmob_metrics (val)->unprotect ();
}
return dynamic_cast<Open_type_font *> (unsmob_metrics (val));
unsmob_metrics (val)->file_name_ = file_name;
unsmob_metrics (val)->description_ = scm_cons (name_string,
- scm_make_real (1.0));
+ scm_from_double (1.0));
tfm_dict_->set (sname, val);
- scm_gc_unprotect_object (val);
+ unsmob_metrics (val)->unprotect ();
}
return dynamic_cast<Tex_font_metric *> (unsmob_metrics (val));