}
Stencil
-Pango_font::word_stencil (string str, bool feta) const
+Pango_font::word_stencil (string str, bool music_string) const
{
- return text_stencil (str, feta, true);
+ return text_stencil (str, music_string, true);
}
Stencil
-Pango_font::text_stencil (string str, bool feta) const
+Pango_font::text_stencil (string str, bool music_string) const
{
- return text_stencil (str, feta, false);
+ return text_stencil (str, music_string, false);
}
+extern bool music_strings_to_paths;
+
Stencil
Pango_font::text_stencil (string str,
- bool feta,
+ bool music_string,
bool tight) const
{
/*
SCM utf8_string = ly_module_lookup (mod, ly_symbol2scm ("utf-8-string"));
/*
has_utf8_string should only be true when utf8_string is a
- variable that is bound to a *named* procedure.
+ variable that is bound to a *named* procedure, i.e. not a
+ lambda expression.
*/
if (utf8_string != SCM_BOOL_F
&& scm_procedure_name (SCM_VARIABLE_REF (utf8_string)) != SCM_BOOL_F)
has_utf8_string = true;
}
- /*
- The SVG backend only uses utf-8-string for the non-music
- fonts, hence the check here. --pmccarty
+ bool to_paths = music_strings_to_paths;
- TODO: use a program option (-dmusic-strings-to-paths) here
- instead that is enabled only when -dbackend=svg.
+ /*
+ Backends with the utf-8-string expression use it when
+ 1) the -dmusic-strings-to-paths option is set
+ and `str' is not a music string, or
+ 2) the -dmusic-strings-to-paths option is not set.
*/
- if ((name == "svg" && !feta) || (name != "svg" && has_utf8_string))
+ if (has_utf8_string && ((to_paths && !music_string) || !to_paths))
{
// For Pango based backends, we take a shortcut.
SCM exp = scm_list_3 (ly_symbol2scm ("utf-8-string"),
bool debug_property_callbacks;
bool debug_page_breaking_scoring;
+bool music_strings_to_paths;
bool relative_includes;
/*
}
else if (var == ly_symbol2scm ("warning-as-error"))
val = scm_from_bool (to_boolean (val));
+ else if (var == ly_symbol2scm ("music-strings-to-paths"))
+ {
+ music_strings_to_paths = to_boolean (val);
+ val = scm_from_bool (to_boolean (val));
+ }
scm_hashq_set_x (option_hash, var, val);
}
replace_whitespace (&str);
/*
- We want to use "glyph-string" in the SVG backend for all
- music fonts (Emmentaler and Aybabtu) that pass through the
- text interface. Here the font encoding is checked to see if
- it matches one of the music font encodings. --pmccarty
+ We want to filter strings with a music font that pass through
+ the text interface. Here the font encoding is checked to see
+ if it matches one of the music font encodings. --pmccarty
*/
SCM encoding = ly_chain_assoc_get (ly_symbol2scm ("font-encoding"),
props,
"midi")
"Set the default file extension for MIDI output
file to given string.")
+ (music-strings-to-paths #f
+"Convert text strings to paths when glyphs belong
+to a music font.")
(old-relative #f
"Make \\relative mode for simultaneous music work
similar to chord syntax.")
(define-public parser #f)
+(define music-string-to-path-backends
+ '(svg))
+
+(if (memq (ly:get-option 'backend) music-string-to-path-backends)
+ (ly:set-option 'music-strings-to-paths #t))
;; gettext wrapper for guile < 1.7.2
(if (defined? 'gettext)