]> git.lyx.org Git - lyx.git/blobdiff - src/tex2lyx/Preamble.cpp
BufferParams: rename formula_indent to math_indent etc. as requested
[lyx.git] / src / tex2lyx / Preamble.cpp
index 26563f818c2d1f863fb1572672201548c27fc5f8..08d019c49e6bf30e3448c981314c3f1eee035c9e 100644 (file)
@@ -127,16 +127,16 @@ 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",
 "garamondx", "libertine", "libertine-type1", "lmodern", "mathdesign", "mathpazo",
-"mathptmx", "newcent", "tgbonum", "tgchorus", "tgpagella", "tgschola", "tgtermes",
-"utopia", 0};
+"mathptmx", "newcent", "NotoSerif-TLF", "tgbonum", "tgchorus", "tgpagella", "tgschola",
+"tgtermes", "utopia", 0};
 
 const char * const known_sans_fonts[] = { "avant", "berasans", "biolinum-type1",
 "cmbr", "cmss", "helvet", "iwona", "iwonac", "iwonal", "iwonalc", "kurier",
-"kurierc", "kurierl", "kurierlc", "lmss", "tgadventor", "tgheros", 0};
+"kurierc", "kurierl", "kurierlc", "lmss", "NotoSans-TLF", "tgadventor", "tgheros", 0};
 
 const char * const known_typewriter_fonts[] = { "beramono", "cmtl", "cmtt",
 "courier", "lmtt", "luximono", "fourier", "libertineMono-type1", "lmodern",
-"mathpazo", "mathptmx", "newcent", "tgcursor", "txtt", 0};
+"mathpazo", "mathptmx", "newcent", "NotoMono-TLF", "tgcursor", "txtt", 0};
 
 const char * const known_math_fonts[] = { "eulervm", "newtxmath", 0};
 
@@ -462,7 +462,7 @@ string remove_braces(string const & value)
 
 Preamble::Preamble() : one_language(true), explicit_babel(false),
        title_layout_found(false), index_number(0), h_font_cjk_set(false),
-       h_use_microtype(false)
+       h_use_microtype("false")
 {
        //h_backgroundcolor;
        //h_boxbgcolor;
@@ -472,6 +472,7 @@ Preamble::Preamble() : one_language(true), explicit_babel(false),
        h_cite_engine_type        = "default";
        h_color                   = "#008000";
        h_defskip                 = "medskip";
+       h_dynamic_quotes          = false;
        //h_float_placement;
        //h_fontcolor;
        h_fontencoding            = "default";
@@ -492,6 +493,7 @@ Preamble::Preamble() : one_language(true), explicit_babel(false),
        h_font_tt_scale[0]        = "100";
        h_font_tt_scale[1]        = "100";
        //h_font_cjk
+       h_is_mathindent           = "0";
        h_graphics                = "default";
        h_default_output_format   = "default";
        h_html_be_strict          = "false";
@@ -544,11 +546,12 @@ Preamble::Preamble() : one_language(true), explicit_babel(false),
        h_tocdepth                = "3";
        h_tracking_changes        = "false";
        h_use_bibtopic            = "false";
+       h_use_dash_ligatures      = "true";
        h_use_indices             = "false";
        h_use_geometry            = "false";
        h_use_default_options     = "false";
        h_use_hyperref            = "false";
-       h_use_microtype           = false;
+       h_use_microtype           = "false";
        h_use_refstyle            = false;
        h_use_packages["amsmath"]    = "1";
        h_use_packages["amssymb"]    = "0";
@@ -760,6 +763,25 @@ void Preamble::handle_package(Parser &p, string const & name,
                        h_font_osf = "true";
        }
 
+       if (name == "noto") {
+               // noto can have several options
+               if (opts.empty())
+                       h_font_roman[0] = "NotoSerif-TLF";
+               string::size_type pos = opts.find("rm");
+               if (pos != string::npos)
+                       h_font_roman[0] = "NotoSerif-TLF";
+               pos = opts.find("sf");
+               if (pos != string::npos)
+                       h_font_sans[0] = "NotoSans-TLF";
+               pos = opts.find("nott");
+               if (pos != string::npos) {
+                       h_font_roman[0] = "NotoSerif-TLF";
+                       h_font_sans[0] = "NotoSans-TLF";
+               }
+               // noto as typewriter is handled in handling of \ttdefault
+               // special cases are handled in handling of \rmdefault and \sfdefault
+       }
+
        // sansserif fonts
        if (is_known(name, known_sans_fonts)) {
                h_font_sans[0] = name;
@@ -1035,7 +1057,7 @@ void Preamble::handle_package(Parser &p, string const & name,
        else if (name == "microtype") {
                //we internally support only microtype without params
                if (options.empty())
-                       h_use_microtype = true;
+                       h_use_microtype = "true";
                else
                        h_preamble << "\\usepackage[" << opts << "]{microtype}";
        }
@@ -1189,6 +1211,7 @@ bool Preamble::writeLyXHeader(ostream & os, bool subdoc, string const & outfiled
        if (!h_font_cjk.empty())
                os << "\\font_cjk " << h_font_cjk << '\n';
        os << "\\use_microtype " << h_use_microtype << '\n'
+          << "\\use_dash_ligatures " << h_use_dash_ligatures << '\n'
           << "\\graphics " << h_graphics << '\n'
           << "\\default_output_format " << h_default_output_format << "\n"
           << "\\output_sync " << h_output_sync << "\n";
@@ -1267,7 +1290,11 @@ bool Preamble::writeLyXHeader(ostream & os, bool subdoc, string const & outfiled
                os << "\\defskip " << h_defskip << "\n";
        else
                os << "\\paragraph_indentation " << h_paragraph_indentation << "\n";
+       os << "\\is_math_indent " << h_is_mathindent << "\n";
+       if (!h_mathindentation.empty())
+               os << "\\math_indentation " << h_mathindentation << "\n";
        os << "\\quotes_style " << h_quotes_style << "\n"
+          << "\\dynamic_quotes " << h_dynamic_quotes << "\n"
           << "\\papercolumns " << h_papercolumns << "\n"
           << "\\papersides " << h_papersides << "\n"
           << "\\paperpagestyle " << h_paperpagestyle << "\n";
@@ -1654,6 +1681,12 @@ void Preamble::parse(Parser & p, string const & forceclass,
                        handle_opt(opts, known_languages, h_language);
                        delete_opt(opts, known_languages);
 
+                       // math indentation
+                       if ((it = find(opts.begin(), opts.end(), "fleqn"))
+                                != opts.end()) {
+                               h_is_mathindent = "1";
+                               opts.erase(it);
+                       }
                        // paper orientation
                        if ((it = find(opts.begin(), opts.end(), "landscape")) != opts.end()) {
                                h_paperorientation = "landscape";
@@ -1811,6 +1844,8 @@ void Preamble::parse(Parser & p, string const & forceclass,
                                        h_defskip = "bigskip";
                                else
                                        h_defskip = translate_len(content);
+                       } else if (name == "\\mathindent") {
+                               h_mathindentation = translate_len(content);
                        } else
                                h_preamble << "\\setlength{" << name << "}{" << content << "}";
                }