+ //
+
+ // By default, we use the package name as LyX font name,
+ // so this only needs to be reset if these names differ.
+ // Also, we handle the scaling option here generally.
+ if (is_known(name, known_sans_font_packages)) {
+ h_font_sans[0] = name;
+ if (contains(opts, "scale")) {
+ vector<string>::iterator it = allopts.begin();
+ for (; it != allopts.end() ; ++it) {
+ string const opt = *it;
+ if (prefixIs(opt, "scaled=") || prefixIs(opt, "scale=")) {
+ if (scale_as_percentage(opt, h_font_sf_scale[0])) {
+ allopts.erase(it);
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ if (name == "biolinum" || name == "biolinum-type1") {
+ h_font_sans[0] = "biolinum";
+ for (auto const & opt : allopts) {
+ if (prefixIs(opt, "osf")) {
+ h_font_sans_osf = "true";
+ continue;
+ }
+ if (!xopts.empty())
+ xopts += ", ";
+ xopts += opt;
+ }
+ if (!xopts.empty())
+ h_font_sans_opts = xopts;
+ options.clear();
+ }
+
+ if (name == "cantarell") {
+ for (auto const & opt : allopts) {
+ if (opt == "defaultsans")
+ continue;
+ if (prefixIs(opt, "oldstyle")) {
+ h_font_sans_osf = "true";
+ continue;
+ }
+ if (!xopts.empty())
+ xopts += ", ";
+ xopts += opt;
+ }
+ if (!xopts.empty())
+ h_font_sans_opts = xopts;
+ options.clear();
+ }
+
+ if (name == "Chivo") {
+ for (auto const & opt : allopts) {
+ if (opt == "thin") {
+ h_font_roman[0] = "ChivoThin";
+ continue;
+ }
+ if (opt == "light") {
+ h_font_roman[0] = "ChivoLight";
+ continue;
+ }
+ if (opt == "regular") {
+ h_font_roman[0] = "Chivo";
+ continue;
+ }
+ if (opt == "medium") {
+ h_font_roman[0] = "ChivoMedium";
+ continue;
+ }
+ if (prefixIs(opt, "oldstyle")) {
+ h_font_sans_osf = "true";
+ continue;
+ }
+ if (!xopts.empty())
+ xopts += ", ";
+ xopts += opt;
+ }
+ if (!xopts.empty())
+ h_font_sans_opts = xopts;
+ options.clear();
+ }
+
+ if (name == "PTSans") {
+ h_font_sans[0] = "PTSans-TLF";
+ }
+
+ if (name == "FiraSans") {
+ h_font_sans_osf = "true";
+ for (auto const & opt : allopts) {
+ if (opt == "book") {
+ h_font_sans[0] = "FiraSansBook";
+ continue;
+ }
+ if (opt == "thin") {
+ continue;
+ }
+ if (opt == "extralight") {
+ h_font_sans[0] = "FiraSansExtralight";
+ continue;
+ }
+ if (opt == "light") {
+ h_font_sans[0] = "FiraSansLight";
+ continue;
+ }
+ if (opt == "ultralight") {
+ h_font_sans[0] = "FiraSansUltralight";
+ continue;
+ }
+ if (opt == "thin") {
+ h_font_sans[0] = "FiraSansThin";
+ continue;
+ }
+ if (opt == "lf" || opt == "lining") {
+ h_font_sans_osf = "false";
+ continue;
+ }
+ if (!xopts.empty())
+ xopts += ", ";
+ xopts += opt;
+ }
+ if (!xopts.empty())
+ h_font_sans_opts = xopts;
+ options.clear();
+ }
+
+ if (name == "plex-sans") {
+ h_font_sans[0] = "IBMPlexSans";
+ for (auto const & opt : allopts) {
+ if (opt == "condensed") {
+ h_font_sans[0] = "IBMPlexSansCondensed";
+ continue;
+ }
+ if (opt == "thin") {
+ h_font_sans[0] = "IBMPlexSansThin";
+ continue;
+ }
+ if (opt == "extralight") {
+ h_font_sans[0] = "IBMPlexSansExtraLight";
+ continue;
+ }
+ if (opt == "light") {
+ h_font_sans[0] = "IBMPlexSansLight";
+ continue;
+ }
+ if (!xopts.empty())
+ xopts += ", ";
+ xopts += opt;
+ }
+ if (!xopts.empty())
+ h_font_sans_opts = xopts;
+ options.clear();
+ }
+
+ if (name == "noto-sans") {
+ h_font_sans[0] = "NotoSansRegular";
+ for (auto const & opt : allopts) {
+ if (opt == "regular")
+ continue;
+ if (opt == "medium") {
+ h_font_sans[0] = "NotoSansMedium";
+ continue;
+ }
+ if (opt == "thin") {
+ h_font_sans[0] = "NotoSansThin";
+ continue;
+ }
+ if (opt == "extralight") {
+ h_font_sans[0] = "NotoSansExtralight";
+ continue;
+ }
+ if (opt == "light") {
+ h_font_sans[0] = "NotoSansLight";
+ continue;
+ }
+ if (opt == "osf") {
+ h_font_sans_osf = "true";
+ continue;
+ }
+ if (!xopts.empty())
+ xopts += ", ";
+ xopts += opt;