]> git.lyx.org Git - lyx.git/blobdiff - src/tex2lyx/Preamble.cpp
FindAdv: Comments
[lyx.git] / src / tex2lyx / Preamble.cpp
index 4222425887953e4118570aebdb8246aede8c2156..924df1692941990dfb2b432344eb6f4cbb3293f8 100644 (file)
@@ -141,18 +141,18 @@ const char * const known_old_language_packages[] = {"french", "frenchle",
 char const * const known_fontsizes[] = { "10pt", "11pt", "12pt", 0 };
 
 const char * const known_roman_fonts[] = { "ae", "beraserif", "bookman",
-"ccfonts", "chancery", "charter", "cmr", "cochineal", "crimson", "fourier",
+"ccfonts", "chancery", "charter", "cmr", "cochineal", "crimson", "DejaVuSerif", "DejaVuSerifCondensed", "fourier",
 "garamondx", "libertine", "libertineRoman", "libertine-type1", "lmodern", "mathdesign", "mathpazo",
 "mathptmx", "MinionPro", "newcent", "NotoSerif-TLF", "PTSerif-TLF", "tgbonum", "tgchorus",
 "tgpagella", "tgschola", "tgtermes", "utopia", "xcharter", 0 };
 
 const char * const known_sans_fonts[] = { "avant", "berasans", "biolinum",
-"biolinum-type1", "cmbr", "cmss", "helvet", "iwona", "iwonac", "iwonal", "iwonalc",
+"biolinum-type1", "cmbr", "cmss", "DejaVuSans", "DejaVuSansCondensed", "helvet", "iwona", "iwonac", "iwonal", "iwonalc",
 "kurier", "kurierc", "kurierl", "kurierlc", "lmss", "NotoSans-TLF", "PTSans-TLF",
 "tgadventor", "tgheros", "uop", 0 };
 
 const char * const known_typewriter_fonts[] = { "beramono", "cmtl", "cmtt",
-"courier", "lmtt", "luximono", "fourier", "libertineMono", "libertineMono-type1", "lmodern",
+"courier", "DejaVuSansMono", "lmtt", "luximono", "fourier", "libertineMono", "libertineMono-type1", "lmodern",
 "mathpazo", "mathptmx", "newcent", "NotoMono-TLF", "PTMono-TLF", "tgcursor", "txtt", 0 };
 
 const char * const known_math_fonts[] = { "eulervm", "newtxmath", 0};
@@ -206,8 +206,8 @@ const char * const known_lyx_packages[] = {"amsbsy", "amsmath", "amssymb",
 "amstext", "amsthm", "array", "babel", "booktabs", "calc", "CJK", "color",
 "float", "fontspec", "framed", "graphicx", "hhline", "ifthen", "longtable",
 "makeidx", "minted", "multirow", "nomencl", "pdfpages", "prettyref", "refstyle",
-"rotating", "rotfloat", "splitidx", "setspace", "subscript", "textcomp", "tipa",
-"tipx", "tone", "ulem", "url", "varioref", "verbatim", "wrapfig", "xcolor",
+"rotating", "rotfloat", "splitidx", "setspace", "subscript", "tabularx","textcomp", "tipa",
+"tipx", "tone", "ulem", "url", "varioref", "verbatim", "wrapfig", "xcolor", "xltabular",
 "xunicode", 0};
 
 // codes used to remove packages that are loaded automatically by LyX.
@@ -845,7 +845,20 @@ void Preamble::handle_package(Parser &p, string const & name,
                if (opts == "osf")
                        h_font_osf = "true";
        }
-       
+
+       if (name == "plex-serif") {
+               if (opts.empty())
+                       h_font_roman[0] = "IBMPlexSerif";
+               else if (opts.find("thin") != string::npos)
+                       h_font_roman[0] = "IBMPlexSerifThin";
+               else if (opts.find("extralight") != string::npos)
+                       h_font_roman[0] = "IBMPlexSerifExtraLight";
+               else if (opts.find("light") != string::npos)
+                       h_font_roman[0] = "IBMPlexSerifLight";
+               else if (opts.find("semibold") != string::npos)
+                       h_font_roman[0] = "IBMPlexSerifSemibold";
+       }
+
        // sansserif fonts
        if (is_known(name, known_sans_fonts)) {
                h_font_sans[0] = name;
@@ -871,6 +884,33 @@ void Preamble::handle_package(Parser &p, string const & name,
                }
        }
 
+       if (name == "plex-sans") {
+               if (opts.find("condensed") != string::npos)
+                       h_font_sans[0] = "IBMPlexSansCondensed";
+               else if (opts.find("thin") != string::npos)
+                       h_font_sans[0] = "IBMPlexSansThin";
+               else if (opts.find("extralight") != string::npos)
+                       h_font_sans[0] = "IBMPlexSansExtraLight";
+               else if (opts.find("light") != string::npos)
+                       h_font_sans[0] = "IBMPlexSansLight";
+               else if (opts.find("semibold") != string::npos)
+                       h_font_sans[0] = "IBMPlexSansSemibold";
+               else
+                       h_font_sans[0] = "IBMPlexSans";
+               // check if the option contains scaling, if yes, extract it
+               string::size_type pos = opts.find("scale");
+               if (pos != string::npos) {
+                       string scale;
+                       string::size_type i = opts.find(',', pos);
+                       if (i == string::npos)
+                               scale_as_percentage(opts.substr(pos + 1), scale);
+                       else
+                               scale_as_percentage(opts.substr(pos, i - pos), scale);
+                       if (!scale.empty())
+                               h_font_sf_scale[1] = scale;
+               }
+       }
+
        // typewriter fonts
        if (is_known(name, known_typewriter_fonts)) {
                // fourier can be set as roman font _only_
@@ -895,6 +935,31 @@ void Preamble::handle_package(Parser &p, string const & name,
                }
        }
 
+       if (name == "plex-mono") {
+               if (opts.find("thin") != string::npos)
+                       h_font_typewriter[0] = "IBMPlexMonoThin";
+               else if (opts.find("extralight") != string::npos)
+                       h_font_typewriter[0] = "IBMPlexMonoExtraLight";
+               else if (opts.find("light") != string::npos)
+                       h_font_typewriter[0] = "IBMPlexMonoLight";
+               else if (opts.find("semibold") != string::npos)
+                       h_font_typewriter[0] = "IBMPlexMonoSemibold";
+               else
+                       h_font_typewriter[0] = "IBMPlexMono";
+               // check if the option contains scaling, if yes, extract it
+               string::size_type pos = opts.find("scale");
+               if (pos != string::npos) {
+                       string scale;
+                       string::size_type i = opts.find(',', pos);
+                       if (i == string::npos)
+                               scale_as_percentage(opts.substr(pos + 1), scale);
+                       else
+                               scale_as_percentage(opts.substr(pos, i - pos), scale);
+                       if (!scale.empty())
+                               h_font_tt_scale[1] = scale;
+               }
+       }
+
        // font uses old-style figure
        if (name == "eco")
                h_font_osf = "true";
@@ -1146,6 +1211,9 @@ void Preamble::handle_package(Parser &p, string const & name,
                                cerr << "Ignoring unkown refesection value '"
                                     << opt << "'.";
                }
+               opt = process_keyval_opt(options, "bibencoding");
+               if (!opt.empty())
+                       bibencoding = opt;
                if (!options.empty()) {
                        h_biblio_options = join(options, ",");
                        options.clear();