diff --git a/src/text/font_feature_settings.cpp b/src/text/font_feature_settings.cpp index 81a62f9dd..3eecb1473 100644 --- a/src/text/font_feature_settings.cpp +++ b/src/text/font_feature_settings.cpp @@ -26,11 +26,10 @@ #pragma GCC diagnostic push #include -#include +#include #include #pragma GCC diagnostic pop - // stl #include #include @@ -52,23 +51,14 @@ font_feature_settings::font_feature_settings() void font_feature_settings::from_string(std::string const& features) { features_.clear(); - if (std::all_of(features.begin(), features.end(), isspace)) return; - namespace qi = boost::spirit::qi; - qi::char_type char_; - qi::as_string_type as_string; - -#if BOOST_VERSION <= 104800 - // Call correct overload. - using std::placeholders::_1; - void (font_feature_settings::*append)(std::string const&) = &font_feature_settings::append; - if (!qi::parse(features.begin(), features.end(), as_string[+(char_ - ',')][std::bind(append, this, _1)] % ',')) -#else - auto app = [&](std::string const& s) { append(s); }; - if (!qi::parse(features.begin(), features.end(), as_string[+(char_ - ',')][app] % ',')) -#endif - + namespace x3 = boost::spirit::x3; + auto appender = [&](auto& ctx) + { + this->append(_attr(ctx)); + }; + if (!x3::parse(features.begin(), features.end(), (+(x3::char_ - ','))[appender] % ',')) { throw config_error("failed to parse font-feature-settings: '" + features + "'"); }