]> git.lyx.org Git - lyx.git/blobdiff - src/Font.cpp
fix a crash when the inset containing the new word at cursor is deleted
[lyx.git] / src / Font.cpp
index e84b66b0c89b41fdfe5fb445151a47d090378d1e..46cba97231dfea6949b0cb8875f2e54b1894cd5f 100644 (file)
@@ -57,7 +57,7 @@ namespace {
 
 char const * GUIFamilyNames[NUM_FAMILIES + 2 /* default & error */] =
 { N_("Roman"), N_("Sans Serif"), N_("Typewriter"), N_("Symbol"),
-  "cmr", "cmsy", "cmm", "cmex", "msa", "msb", "eufrak", "wasy", "esint",
+  "cmr", "cmsy", "cmm", "cmex", "msa", "msb", "eufrak", "rsfs", "wasy", "esint",
   N_("Inherit"), N_("Ignore") };
 
 char const * GUISeriesNames[4] =
@@ -95,7 +95,7 @@ char const * LaTeXSizeNames[14] =
 
 
 Font::Font(FontInfo bits, Language const * l)
-       : bits_(bits), lang_(l), misspelled_(false), open_encoding_(false)
+       : bits_(bits), lang_(l), open_encoding_(false)
 {
        if (!lang_)
                lang_ = default_language;
@@ -189,7 +189,7 @@ docstring const Font::stateText(BufferParams * params) const
                os << bformat(_("Language: %1$s, "),
                              _(language()->display()));
        if (bits_.number() != FONT_OFF)
-               os << bformat(_("  Number %1$s"),
+               os << "  " << bformat(_("Number %1$s"),
                              _(GUIMiscNames[bits_.number()]));
        return rtrim(os.str(), ", ");
 }
@@ -272,7 +272,20 @@ int Font::latexWriteStartChanges(odocstream & os, BufferParams const & bparams,
        bool env = false;
 
        int count = 0;
-       if (language()->babel() != base.language()->babel() &&
+
+       // polyglossia or babel?
+       if (runparams.use_polyglossia
+           && language()->lang() != base.language()->lang()
+           && language() != prev.language()) {
+               if (!language()->polyglossia().empty()) {
+                       string tmp = "\\text" + language()->polyglossia();
+                       if (!language()->polyglossiaOpts().empty())
+                               tmp += "[" + language()->polyglossiaOpts() + "]";
+                       tmp += "{";
+                       os << from_ascii(tmp);
+                       count += tmp.length();
+               }
+       } else if (language()->babel() != base.language()->babel() &&
            language() != prev.language()) {
                if (language()->lang() == "farsi") {
                        os << "\\textFR{";
@@ -425,7 +438,7 @@ int Font::latexWriteStartChanges(odocstream & os, BufferParams const & bparams,
 /// Writes ending block of LaTeX needed to close use of this font
 // Returns number of chars written
 // This one corresponds to latexWriteStartChanges(). (Asger)
-int Font::latexWriteEndChanges(odocstream & os, BufferParams const & bparams,
+int Font::latexWriteEndChanges(otexstream & os, BufferParams const & bparams,
                                  OutputParams const & runparams,
                                  Font const & base,
                                  Font const & next,
@@ -518,7 +531,7 @@ int Font::latexWriteEndChanges(odocstream & os, BufferParams const & bparams,
                // We need to close the encoding even if it does not change
                // to do correct environment nesting
                Encoding const * const ascii = encodings.fromLyXName("ascii");
-               pair<bool, int> const c = switchEncoding(os, bparams,
+               pair<bool, int> const c = switchEncoding(os.os(), bparams,
                                runparams, *ascii);
                LASSERT(c.first, /**/);
                count += c.second;