source file of the GNU LilyPond music typesetter
- (c) 1999--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ (c) 1999--2003 Han-Wen Nienhuys <hanwen@cs.uu.nl>
Mats Bengtsson <matsb@s3.kth.se> (the ugly TeX parsing in text_dimension)
*/
return m;
}
-
LY_DEFINE(ly_find_glyph_by_name, "ly:find-glyph-by-name", 2 , 0, 0,
(SCM font, SCM name),
- "This function retrieves a Molecule for the glyph named @var{name} in
-@var{font}. The font must be available as an AFM file.")
+ "This function retrieves a Molecule for the glyph named @var{name} in "
+"@var{font}. The font must be available as an AFM file.")
{
Font_metric *fm = unsmob_metrics (font);
SCM_ASSERT_TYPE(fm, font, SCM_ARG1, __FUNCTION__, "font-metric");
return fm->find_by_name (ly_scm2string (name)).smobbed_copy ();
}
+LY_DEFINE(ly_get_glyph, "ly:get-glyph", 2 , 0, 0,
+ (SCM font, SCM index),
+ "This function retrieves a Molecule for the glyph numbered @var{index} in "
+"@var{font}. ")
+{
+ Font_metric *fm = unsmob_metrics (font);
+ SCM_ASSERT_TYPE(fm, font, SCM_ARG1, __FUNCTION__, "font-metric");
+ SCM_ASSERT_TYPE(gh_number_p (index), index, SCM_ARG2, __FUNCTION__, "number");
+
+ return fm->get_char_molecule (gh_scm2int (index)).smobbed_copy ();
+}
LY_DEFINE(ly_text_dimension,"ly:text-dimension", 2 , 0, 0,
(SCM font, SCM text),
- "Given the font metric in @var{font} and the string @var{text}, compute
-the extents of that text in that font. The return value is a pair of
-number-pairs.")
+ "Given the font metric in @var{font} and the string @var{text}, compute "
+"the extents of that text in that font. The return value is a pair of "
+"number-pairs.")
{
Box b;
Font_metric *fm = unsmob_metrics (font);
return gh_cons (ly_interval2scm (b[X_AXIS]), ly_interval2scm(b[Y_AXIS]));
}
-
-
-
-
Molecule
Font_metric::get_char_molecule (int code) const
{
- Molecule m ;
SCM at = scm_list_n (ly_symbol2scm ("char"), gh_int2scm (code),
SCM_UNDEFINED);
at = fontify_atom (this, at);