-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.")
-{
- Box b;
- Modified_font_metric *fm = dynamic_cast<Modified_font_metric *>
- (unsmob_metrics (font));
-
- SCM_ASSERT_TYPE (fm, font, SCM_ARG1, __FUNCTION__, "modified font metric");
- SCM_ASSERT_TYPE (scm_is_string (text), text, SCM_ARG2, __FUNCTION__, "string");
- Stencil stc (fm->text_stencil (ly_scm2string (text)));
- return scm_cons (ly_interval2scm (stc.extent (X_AXIS)),
- ly_interval2scm (stc.extent (Y_AXIS)));
-}
-
-