HOST_ARCH=`$CC -dumpmachine`
AC_SUBST(HOST_ARCH)
-STEPMAKE_PANGO_FT2(pangoft2, REQUIRED, 1.6.0)
+STEPMAKE_PANGO_FT2(pangoft2, REQUIRED, 1.38.0)
STEPMAKE_FONTCONFIG(fontconfig, REQUIRED, 2.4.0)
STEPMAKE_FREETYPE2(freetype2, REQUIRED, 2.1.10)
--- /dev/null
+\version "2.19.60"
+
+\header
+{
+ texidoc = "Exercise font features. Requires a font that supports the
+ features. This ensures no errors using the interface."
+}
+
+% Comparison between caps styles
+\markup { Hello }
+\markup { HELLO }
+\markup { \caps Hello }
+\markup { \fontCaps Hello }
+% True small caps
+\markup { \override #'(font-features . ("smcp")) Hello }
+
+% Comparison between number styles
+\markup { 0123456789 }
+\markup { \override #'(font-features . ("onum")) 0123456789 }
+
+% Multiple features
+\markup { \override #'(font-features . ("onum" "smcp")) { Hello 0123456789 } }
"font-series "
"font-shape "
"font-size "
+ "font-features "
);
Stencil
Font_metric::text_stencil (Output_def *state,
- const string&, bool) const
+ const string&,
+ bool,
+ const string&) const
{
(void) state;
// Return stencil for given string. output_state may be modified to
// record the font.
virtual Stencil text_stencil (Output_def *output_state,
- const string &text, bool music) const;
+ const string &text,
+ bool music,
+ const string &features_str) const;
virtual string font_name () const;
virtual size_t count () const;
public Font_metric
{
public:
- Stencil text_stencil (Output_def *output_state, const string&, bool) const;
+ Stencil text_stencil (Output_def *output_state, const string&, bool, const string&) const;
Real get_magnification () const;
static SCM make_scaled_font_metric (Font_metric *fm, Real magnification);
Stencil pango_item_string_stencil (PangoGlyphItem const *) const;
virtual Stencil text_stencil (Output_def *output_state,
- const string &text, bool music) const;
+ const string &text,
+ bool music,
+ const string &features_str) const;
virtual void derived_mark () const;
};
Stencil
Modified_font_metric::text_stencil (Output_def *state,
- const string &text, bool feta) const
+ const string &text,
+ bool feta,
+ const string &features_str) const
{
Box b;
if (Pango_font *pf = dynamic_cast<Pango_font *> (orig_))
{
- Stencil stc = pf->text_stencil (state, text, feta);
+ Stencil stc = pf->text_stencil (state, text, feta, features_str);
Box b = stc.extent_box ();
return scaled;
}
- return Font_metric::text_stencil (state, text, feta);
+ return Font_metric::text_stencil (state, text, feta, features_str);
}
Font_metric *
Stencil
Pango_font::text_stencil (Output_def * /* state */,
- const string &str, bool music_string) const
+ const string &str,
+ bool music_string,
+ const string &features_str) const
{
/*
The text assigned to a PangoLayout is automatically divided
Bidirectional Algorithm, if necessary.
*/
PangoLayout *layout = pango_layout_new (context_);
+
+ if (!features_str.empty())
+ {
+ PangoAttrList *list = pango_attr_list_new();
+ PangoAttribute *features_attr = pango_attr_font_features_new(features_str.c_str());
+ pango_attr_list_insert(list, features_attr);
+ pango_layout_set_attributes(layout, list);
+ pango_attr_list_unref(list);
+ }
+
pango_layout_set_text (layout, str.c_str (), -1);
GSList *lines = pango_layout_get_lines (layout);
SCM_BOOL_F);
SCM music_encodings = Lily::all_music_font_encodings;
+ SCM features = ly_chain_assoc_get (ly_symbol2scm ("font-features"),
+ props,
+ SCM_BOOL_F);
+
+ // The font-features value is stored in a scheme list. This joins the entries
+ // with commas for processing with pango.
+ string features_str = string ();
+ if (scm_is_pair (features))
+ {
+ bool first = true;
+ for (SCM s = features; scm_is_pair (s); s = scm_cdr (s))
+ {
+ SCM feature = scm_car (s);
+ if (scm_is_string (feature))
+ {
+ if (first)
+ {
+ first = false;
+ }
+ else
+ {
+ features_str += ",";
+ }
+ features_str += ly_scm2string (feature);
+ }
+ else
+ {
+ scm_misc_error (__FUNCTION__, "Found non-string in font-features list", SCM_EOL);
+ }
+ }
+ }
+ else if (!scm_is_false (features))
+ {
+ scm_misc_error (__FUNCTION__, "Expecting a list for font-features value", SCM_EOL);
+ }
+
bool is_music = scm_is_true (scm_memq (encoding, music_encodings));
- return fm->text_stencil (layout, str, is_music).smobbed_copy ();
+ return fm->text_stencil (layout, str, is_music, features_str).smobbed_copy ();
}
static size_t markup_depth = 0;
larger. If the context property @code{fontSize} is set, its value is
added to this before the glyph is printed. Fractional values are
allowed.")
+ (font-features ,list? "Opentype features.")
(footnote ,boolean? "Should this be a footnote or in-note?")
(footnote-music ,ly:music? "Music creating a footnote.")
(footnote-text ,markup? "A footnote for the grob.")