+ if (t.cs() == "babelfont") {
+ xetex = true;
+ h_use_non_tex_fonts = true;
+ h_language_package = "babel";
+ if (h_inputencoding == "auto-legacy")
+ p.setEncoding("UTF-8");
+ // we don't care about the lang option
+ string const lang = p.hasOpt() ? p.getArg('[', ']') : string();
+ string const family = p.getArg('{', '}');
+ string fontopts = p.hasOpt() ? p.getArg('[', ']') : string();
+ string const fontname = p.getArg('{', '}');
+ if (lang.empty() && family == "rm") {
+ h_font_roman[1] = fontname;
+ if (!fontopts.empty()) {
+ vector<string> opts = getVectorFromString(fontopts);
+ fontopts.clear();
+ for (auto const & opt : opts) {
+ if (opt == "Mapping=tex-text" || opt == "Ligatures=TeX")
+ // ignore
+ continue;
+ if (!fontopts.empty())
+ fontopts += ", ";
+ fontopts += opt;
+ }
+ h_font_roman_opts = fontopts;
+ }
+ continue;
+ } else if (lang.empty() && (family == "sf" || family == "tt")) {
+ string scale;
+ if (!fontopts.empty()) {
+ vector<string> opts = getVectorFromString(fontopts);
+ fontopts.clear();
+ for (auto const & opt : opts) {
+ if (opt == "Mapping=tex-text" || opt == "Ligatures=TeX")
+ // ignore
+ continue;
+ if (prefixIs(opt, "Scale=")) {
+ scale_as_percentage(opt, scale);
+ continue;
+ }
+ if (!fontopts.empty())
+ fontopts += ", ";
+ fontopts += opt;
+ }
+ }
+ if (family == "sf") {
+ if (!scale.empty())
+ h_font_sf_scale[1] = scale;
+ h_font_sans[1] = fontname;
+ if (!fontopts.empty())
+ h_font_sans_opts = fontopts;
+ } else {
+ if (!scale.empty())
+ h_font_tt_scale[1] = scale;
+ h_font_typewriter[1] = fontname;
+ if (!fontopts.empty())
+ h_font_typewriter_opts = fontopts;
+ }
+ continue;
+ } else {
+ // not rm, sf or tt or lang specific
+ h_preamble << '\\' << t.cs();
+ if (!lang.empty())
+ h_preamble << '[' << lang << ']';
+ h_preamble << '{' << family << '}';
+ if (!fontopts.empty())
+ h_preamble << '[' << fontopts << ']';
+ h_preamble << '{' << fontname << '}' << '\n';
+ continue;
+ }
+ }
+