#include "text-item.hh"
-#include <cmath>
+#include <math.h>
+#include "main.hh"
+#include "config.hh"
+#include "pango-font.hh"
#include "warn.hh"
#include "grob.hh"
#include "font-interface.hh"
-#include "virtual-font-metric.hh"
#include "output-def.hh"
#include "modified-font-metric.hh"
#include "ly-module.hh"
+
MAKE_SCHEME_CALLBACK (Text_interface, interpret_string, 4)
SCM
Text_interface::interpret_string (SCM layout_smob,
__FUNCTION__, "Layout definition");
SCM_ASSERT_TYPE (scm_is_string (markup), markup, SCM_ARG3,
__FUNCTION__, "string");
+
+ String str = ly_scm2string (markup);
+
+#if HAVE_PANGO_FT2
+ if (output_format_global != "tex")
+ {
+ Font_metric *fm = select_pango_font (layout, props);
+ return fm->text_stencil (str).smobbed_copy ();
+ }
+#endif
+
SCM_ASSERT_TYPE (input_encoding == SCM_EOL || scm_is_symbol (input_encoding),
input_encoding, SCM_ARG2, __FUNCTION__, "symbol");
-
- String str = ly_scm2string (markup);
+
if (!scm_is_symbol (input_encoding))
{
SCM enc = layout->lookup_variable (ly_symbol2scm ("inputencoding"));
Font_metric *fm = select_encoded_font (layout, props, input_encoding);
- SCM lst = SCM_EOL;
- Box b;
- if (Modified_font_metric* mf = dynamic_cast<Modified_font_metric*> (fm))
- {
- lst = scm_list_3 (ly_symbol2scm ("text"),
- mf->self_scm (),
- markup);
-
- b = mf->text_dimension (str);
- }
- else
- {
- /* ARGH. */
- programming_error ("Must have Modified_font_metric for text.");
- scm_display (fm->description_, scm_current_error_port ());
- }
-
- return Stencil (b, lst).smobbed_copy ();
+ return fm->text_stencil (str).smobbed_copy();
}
-
MAKE_SCHEME_CALLBACK (Text_interface, interpret_markup, 3)
SCM
Text_interface::interpret_markup (SCM layout_smob, SCM props, SCM markup)