]> git.lyx.org Git - features.git/commitdiff
Add latex_language and remove inherit_language
authorDekel Tsur <dekelts@tau.ac.il>
Sat, 11 Aug 2001 18:31:14 +0000 (18:31 +0000)
committerDekel Tsur <dekelts@tau.ac.il>
Sat, 11 Aug 2001 18:31:14 +0000 (18:31 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2492 a592a061-630c-0410-9148-cb99ea01b6c8

15 files changed:
src/BufferView2.C
src/ChangeLog
src/bufferview_funcs.C
src/insets/ChangeLog
src/insets/insetert.C
src/insets/insettext.C
src/language.C
src/language.h
src/layout.C
src/lyxfont.C
src/lyxfont.h
src/paragraph.C
src/paragraph_pimpl.C
src/text.C
src/text2.C

index c130c1d51fe963b65a9be75103386315ccb4f808..faf26c0d291b9533f0a5e41ab9193b657352ffd7 100644 (file)
@@ -420,8 +420,7 @@ void BufferView::showLockedInsetCursor(int x, int y, int asc, int desc)
                                        cursor.par(), cursor.pos() - 1);
                LyXScreen::Cursor_Shape shape = LyXScreen::BAR_SHAPE;
                LyXText * txt = getLyXText();
-               if (theLockingInset()->getLockingInset()->lyxCode() ==
-                   Inset::TEXT_CODE &&
+               if (theLockingInset()->getLockingInset()->isTextInset() &&
                    (txt->real_current_font.language() !=
                     buffer()->params.language
                     || txt->real_current_font.isVisibleRightToLeft()
index 0b81d6116b8878738c705bc6d1bbec0da2c2e22e..2b6a4a6465e10955f61c146130977638a0bf097f 100644 (file)
@@ -1,3 +1,10 @@
+2001-08-11  Dekel Tsur  <dekelts@tau.ac.il>
+
+       * Many files: Remove inherit_language, and add latex_language
+
+       * BufferView2.C (showLockedInsetCursor): Fix cursor shape in
+       collapsible insets.
+
 2001-08-10  Juergen Vigna  <jug@sad.it>
 
        * text.C (prepareToPrint): fixed hfill-width in draw!
index 7239dbd0e268ba547154d8a0289a0b2a22445b62..b8f1b5eff9abbaad253efd262fd823c656548d03 100644 (file)
@@ -120,7 +120,11 @@ void roman(BufferView * bv)
 
 void styleReset(BufferView * bv)
 {
+#ifndef INHERIT_LANG
+       LyXFont font(LyXFont::ALL_INHERIT, ignore_language);
+#else 
        LyXFont font(LyXFont::ALL_INHERIT);
+#endif
        toggleAndShow(bv, font);
 }
 
index a4dbca50ce76e81464da6530bb3f4367bc5889a5..85217b5a9d9eb09ba08a7fdc64f3e78c13eb39a5 100644 (file)
@@ -1,3 +1,8 @@
+2001-08-11  Dekel Tsur  <dekelts@tau.ac.il>
+
+       * insettext.C (localDispatch): Change language only when the inset 
+       becomes empty.
+
 2001-08-10  Juergen Vigna  <jug@sad.it>
 
        * insettabular.C (selectNextWordInt): use the front using edit call.
index 33a0606dcbdd5b5a3436bfd03cc693cd312495f0..628e13c8e95abd676ef2210928f940097f819c19 100644 (file)
@@ -67,7 +67,11 @@ Inset * InsetERT::clone(Buffer const &, bool same_id) const
 InsetERT::InsetERT(string const & contents, bool collapsed)
        : InsetCollapsable(collapsed)
 {
+#ifndef INHERIT_LANG
+       LyXFont font(LyXFont::ALL_INHERIT, latex_language);
+#else 
        LyXFont font(LyXFont::ALL_INHERIT);
+#endif
        font.setFamily(LyXFont::TYPEWRITER_FAMILY);
        font.setColor(LColor::latex);
        string::const_iterator cit = contents.begin();
@@ -354,7 +358,11 @@ void InsetERT::setButtonLabel() const
 
 bool InsetERT::checkInsertChar(LyXFont & font)
 {
+#ifndef INHERIT_LANG
+       LyXFont f(LyXFont::ALL_INHERIT, latex_language);
+#else 
        LyXFont f(LyXFont::ALL_INHERIT);
+#endif
        font = f;
        font.setFamily(LyXFont::TYPEWRITER_FAMILY);
        font.setColor(LColor::latex);
@@ -442,7 +450,11 @@ void InsetERT::draw(BufferView * bv, LyXFont const & f,
 
 void InsetERT::set_latex_font(BufferView * bv)
 {
+#ifndef INHERIT_LANG
+       LyXFont font(LyXFont::ALL_INHERIT, latex_language);
+#else 
        LyXFont font(LyXFont::ALL_INHERIT);
+#endif
 
        font.setFamily(LyXFont::TYPEWRITER_FAMILY);
        font.setColor(LColor::latex);
index 1f747d11aac19c3c9461b01c85cacabd6b7a4ee1..ea523df6eed4efc2632aeee369fe2b58d49beb24 100644 (file)
@@ -987,6 +987,7 @@ UpdatableInset::RESULT
 InsetText::localDispatch(BufferView * bv,
                          kb_action action, string const & arg)
 {
+       bool was_empty = par->size() == 0 && !par->next();
        no_selection = false;
        UpdatableInset::RESULT
                result= UpdatableInset::localDispatch(bv, action, arg);
@@ -1310,7 +1311,7 @@ InsetText::localDispatch(BufferView * bv,
 
        /// If the action has deleted all text in the inset, we need to change the
        // language to the language of the surronding text.
-       if (par->size() == 0 && !par->next()) {
+       if (!was_empty && par->size() == 0 && !par->next()) {
                LyXFont font(LyXFont::ALL_IGNORE);
                font.setLanguage(bv->getParentLanguage(this));
                setFont(bv, font, false);
index 7f7562fb7f9f9080bcaa6b3a61e67720acf56601..7208e3564a23588db2a4a8721fd3b2c47294402a 100644 (file)
@@ -29,8 +29,12 @@ Language const * english_language;
 Language const * default_language;
 Language ignore_lang("ignore", "ignore", "Ignore", false, 0, "ignore", "");
 Language const * ignore_language = &ignore_lang;
+Language latex_lang("latex", "latex", "Latex", false, 0, "latex", "");
+Language const * latex_language = &latex_lang;
+#ifdef INHERIT_LANG
 Language inherit_lang("inherit", "inherit", "Inherit", false, 0, "inherit", "");
 Language const * inherit_language = &inherit_lang;
+#endif
 
 void Languages::setDefaults()
 {
index fff0aa636d214d80f5ecb5df3447653f3f378593..cd156c33e4c8116bfda21cb0c46bf69cbd8fbef4 100644 (file)
@@ -116,6 +116,9 @@ extern Languages languages;
 extern Language const * default_language;
 extern Language const * english_language;
 extern Language const * ignore_language;
+extern Language const * latex_language;
+#ifdef INHERIT_LANGUAGE
 extern Language const * inherit_language;
+#endif
 
 #endif
index e1db0bd5bf04b975bcfd451d4fbcb5dc9df50811..8f4dfffdd5ffb6bc7d46890f6462b785bf5a7718 100644 (file)
@@ -776,9 +776,15 @@ bool LyXTextClass::do_readStyle(LyXLex & lexrc, LyXLayout & lay)
        if (!lay.Read(lexrc, *this)) {
                // Reslove fonts
                lay.resfont = lay.font;
+#ifndef INHERIT_LANGUAGE
+               lay.resfont.realize(defaultfont());
+               lay.reslabelfont = lay.labelfont;
+               lay.reslabelfont.realize(defaultfont());
+#else
                lay.resfont.realize(defaultfont(), default_language);
                lay.reslabelfont = lay.labelfont;
                lay.reslabelfont.realize(defaultfont(), default_language);
+#endif
                return false; // no errors
        } 
        lyxerr << "Error parsing style `" << lay.name() << "'" << endl;
@@ -939,8 +945,12 @@ bool LyXTextClass::Read(string const & filename, bool merge)
                        if (!defaultfont_.resolved()) {
                                lexrc.printError("Warning: defaultfont should "
                                                 "be fully instantiated!");
+#ifndef INHERIT_LANGUAGE
+                               defaultfont_.realize(LyXFont(LyXFont::ALL_SANE));
+#else
                                defaultfont_.realize(LyXFont(LyXFont::ALL_SANE),
                                                     default_language);
+#endif
                        }
                        break;
 
index 1875b15061c28e007b3de195a4fad4fc640f6e39..c8502ea064504ae0150a01de98fefe1cae4612ac 100644 (file)
@@ -157,7 +157,11 @@ bool LyXFont::FontBits::operator!=(LyXFont::FontBits const & fb1) const
 
 
 LyXFont::LyXFont(LyXFont::FONT_INIT1)
+#ifndef INHERIT_LANGUAGE
+       : bits(inherit), lang(default_language)
+#else
        : bits(inherit), lang(inherit_language)
+#endif
 {}
 
 
@@ -377,7 +381,9 @@ LyXFont::FONT_MISC_STATE LyXFont::setMisc(FONT_MISC_STATE newfont,
 
 
 /// Updates font settings according to request
-void LyXFont::update(LyXFont const & newfont, bool toggleall)
+void LyXFont::update(LyXFont const & newfont, 
+                    Language const * document_language,
+                    bool toggleall)
 {
        if (newfont.family() == family() && toggleall)
                setFamily(INHERIT_FAMILY); // toggle 'back'
@@ -423,7 +429,14 @@ void LyXFont::update(LyXFont const & newfont, bool toggleall)
        
        setNumber(setMisc(newfont.number(), number()));
        if (newfont.language() == language() && toggleall)
-               setLanguage(inherit_language);
+               if (language() == document_language)
+                       setLanguage(default_language);
+               else
+#ifndef INHERIT_LANGUAGE
+                       setLanguage(document_language);
+#else  
+                       setLanguage(inherit_language);
+#endif
        else if (newfont.language() != ignore_language)
                setLanguage(newfont.language());
 
@@ -453,14 +466,21 @@ void LyXFont::reduce(LyXFont const & tmplt)
                setNoun(INHERIT);
        if (color() == tmplt.color())
                setColor(LColor::inherit);
+#ifdef INHERIT_LANGUAGE
        if (language() == tmplt.language())
                setLanguage(inherit_language);
+#endif
 }
 
 
 /// Realize font from a template
+#ifndef INHERIT_LANGUAGE
+LyXFont & LyXFont::realize(LyXFont const & tmplt)
+#else
 LyXFont & LyXFont::realize(LyXFont const & tmplt, Language const * deflang)
+#endif
 {
+#ifdef INHERIT_LANGUAGE
        if (language() == inherit_language) {
                if (tmplt.language() == inherit_language ||
                        tmplt.language() == ignore_language ||
@@ -471,6 +491,7 @@ LyXFont & LyXFont::realize(LyXFont const & tmplt, Language const * deflang)
                        setLanguage(tmplt.language());
                }
        }
+#endif
        if (bits == inherit) {
                bits = tmplt.bits;
                return *this;
@@ -511,8 +532,10 @@ bool LyXFont::resolved() const
                shape() != INHERIT_SHAPE && size() != INHERIT_SIZE &&
                emph() != INHERIT && underbar() != INHERIT && 
                noun() != INHERIT &&
-               color() != LColor::inherit &&
-               language() != inherit_language);
+#ifdef INHERIT_LANGUAGE
+               language() != inherit_language &&
+#endif
+               color() != LColor::inherit);
 }
 
 
@@ -708,7 +731,10 @@ LyXFont & LyXFont::lyxRead(LyXLex & lex)
 
 /// Writes the changes from this font to orgfont in .lyx format in file
 void LyXFont::lyxWriteChanges(LyXFont const & orgfont,
-                              Language const * doclang, ostream & os) const
+#ifdef INHERIT_LANGUAGE
+                              Language const * doclang, 
+#endif
+                             ostream & os) const
 {
        os << "\n";
        if (orgfont.family() != family()) {
@@ -757,9 +783,13 @@ void LyXFont::lyxWriteChanges(LyXFont const & orgfont,
                os << "\\color " << col_str << "\n";
        }
        if (orgfont.language() != language()) {
+#ifndef INHERIT_LANGUAGE
+               if (language())
+#else
                if (language() == inherit_language)
                        os << "\\lang " << doclang->lang() << "\n";
                else if (language())
+#endif
                        os << "\\lang " << language()->lang() << "\n";
                else
                        os << "\\lang unknown\n";
index f5fcab9b8c142c1e0f044fbf221717ec2c2d576a..034d4e484f42141876b69ef21e297b334f05ebbb 100644 (file)
@@ -252,15 +252,20 @@ public:
            a INHERIT_FAMILY was asked for.  This is necessary for the
            toggle-user-defined-style button on the toolbar.
        */
-       void update(LyXFont const & newfont, bool toggleall = false);
+       void update(LyXFont const & newfont,
+                   Language const * default_lang,
+                   bool toggleall = false);
  
        /** Reduce font to fall back to template where possible.
            Equal fields are reduced to INHERIT */
        void reduce(LyXFont const & tmplt);
  
        /// Realize font from a template (INHERIT are realized)
+#ifndef INHERIT_LANGUAGE
+       LyXFont & realize(LyXFont const & tmplt);
+#else
        LyXFont & realize(LyXFont const & tmplt, Language const * language);
-
+#endif
        /// Is a given font fully resolved?
        bool resolved() const;
  
@@ -268,8 +273,12 @@ public:
        LyXFont & lyxRead(LyXLex &);
  
        /// Writes the changes from this font to orgfont in .lyx format in file
+#ifndef INHERIT_LANGUAGE
+       void lyxWriteChanges(LyXFont const & orgfont, std::ostream &) const;
+#else
        void lyxWriteChanges(LyXFont const & orgfont, Language const * doclang,
                             std::ostream &) const;
+#endif
 
        /** Writes the head of the LaTeX needed to change to this font.
            Writes to string, the head of the LaTeX needed to change
index cecbf1ba4bbac003d4a9756c83374a4baa7c4600..6823dbadf6a9654497df53e7fb93a063c62b7aae 100644 (file)
@@ -252,7 +252,11 @@ void Paragraph::writeFile(Buffer const * buf, ostream & os,
                // Write font changes
                LyXFont font2 = getFontSettings(bparams, i);
                if (font2 != font1) {
+#ifndef INHERIT_LANGUAGE
+                       font2.lyxWriteChanges(font1, os);
+#else
                        font2.lyxWriteChanges(font1, bparams.language, os);
+#endif
                        column = 0;
                        font1 = font2;
                }
@@ -363,9 +367,12 @@ void Paragraph::validate(LaTeXFeatures & features) const
                }
 
                Language const * language = cit->font().language();
-               if (language != ignore_language &&
-                       language != inherit_language &&
-                       language->babel() != doc_language->babel())
+               if (language->babel() != doc_language->babel() &&
+                   language != ignore_language &&
+#ifdef INHERIT_LANGUAGE
+                   language != inherit_language &&
+#endif
+                   language != latex_language)
                {
                        features.UsedLanguages.insert(language);
                        lyxerr[Debug::LATEX] << "Found language "
@@ -584,8 +591,10 @@ LyXFont const Paragraph::getFontSettings(BufferParams const & bparams,
                retfont = getFontSettings(bparams, pos - 1);
        } else
                retfont = LyXFont(LyXFont::ALL_INHERIT, getParLanguage(bparams));
+#ifdef INHERIT_LANGUAGE
        if (retfont.language() == inherit_language)
                retfont.setLanguage(bparams.language);
+#endif
 
        return retfont;
 }
@@ -629,7 +638,11 @@ LyXFont const Paragraph::getFont(BufferParams const & bparams,
                layoutfont = layout.font;
        
        LyXFont tmpfont = getFontSettings(bparams, pos);
+#ifndef INHERIT_LANGUAGE
+       tmpfont.realize(layoutfont);
+#else
        tmpfont.realize(layoutfont, bparams.language);
+#endif
 
        return pimpl_->realizeFont(tmpfont, bparams);
 }
@@ -1265,8 +1278,6 @@ Paragraph * Paragraph::TeXOnePar(Buffer const * buf,
        Language const * doc_language = bparams.language;
        Language const * previous_language = previous_
                ? previous_->getParLanguage(bparams) : doc_language;
-       if (language == ignore_language || language == inherit_language)
-               lyxerr << "1:" << language->lang() << endl;
        if (language->babel() != doc_language->babel() &&
            language->babel() != previous_language->babel()) {
                os << subst(lyxrc.language_command_begin, "$$lang",
@@ -1837,11 +1848,15 @@ Language const *
 Paragraph::getParLanguage(BufferParams const & bparams) const 
 {
        if (size() > 0) {
+#ifndef INHERIT_LANGUAGE
+               return getFirstFontSettings().language();
+#else
                Language const * lang = getFirstFontSettings().language();
 #warning We should make this somewhat better, any ideas? (Jug)
                if (lang == inherit_language || lang == ignore_language)
                        lang = bparams.language;
                return lang;
+#endif
        } else if (previous_)
                return previous_->getParLanguage(bparams);
        else
@@ -1874,8 +1889,11 @@ bool Paragraph::isMultiLingual(BufferParams const & bparams)
        Language const * doc_language = bparams.language;
        for (Pimpl::FontList::const_iterator cit = pimpl_->fontlist.begin();
             cit != pimpl_->fontlist.end(); ++cit)
-               if (cit->font().language() != inherit_language &&
-                       cit->font().language() != ignore_language &&
+               if (cit->font().language() != ignore_language &&
+                   cit->font().language() != latex_language &&
+#ifdef INHERIT_LANGUAGE
+                       cit->font().language() != inherit_language &&
+#endif
                        cit->font().language() != doc_language)
                        return true;
        return false;
index b021e805025398fe3a0a8fcdde22759c2569795b..6bcc718fa42e75f42161e455058137202685bf8e 100644 (file)
@@ -538,15 +538,25 @@ LyXFont const Paragraph::Pimpl::realizeFont(LyXFont const & font,
        while (par && par->getDepth() && !tmpfont.resolved()) {
                par = par->outerHook();
                if (par) {
+#ifndef INHERIT_LANGUAGE
+                       tmpfont.realize(textclasslist.
+                                       Style(bparams.textclass,
+                                             par->getLayout()).font);
+#else
                        tmpfont.realize(textclasslist.
                                        Style(bparams.textclass,
                                              par->getLayout()).font, bparams.language);
+#endif
                        par_depth = par->getDepth();
                }
        }
 
-       tmpfont.realize(textclasslist
-                       .TextClass(bparams.textclass)
+#ifndef INHERIT_LANGUAGE
+       tmpfont.realize(textclasslist.TextClass(bparams.textclass)
+                       .defaultfont());
+#else
+       tmpfont.realize(textclasslist.TextClass(bparams.textclass)
                        .defaultfont(), bparams.language);
+#endif
        return tmpfont; 
 }
index ace479038f661b3ced976d0d6e96169e5baed76f..b374604f4b15b91fc3424fc706fecaf67c6424b9 100644 (file)
@@ -452,7 +452,7 @@ void LyXText::draw(BufferView * bview, Row const * row,
                ++vpos;
 
                if (lyxrc.mark_foreign_language &&
-                       font.language() != ignore_language &&
+                       font.language() != latex_language &&
                    font.language() != bview->buffer()->params.language) {
                        int const y = offset + row->height() - 1;
                        pain.line(int(tmpx), y, int(x), y, LColor::language);
@@ -568,12 +568,15 @@ void LyXText::draw(BufferView * bview, Row const * row,
                x += lyxfont::width(textstring, font);
        }
 
+#ifdef INHERIT_LANGUAGE
 #ifdef WITH_WARNINGS
        if ((font.language() == inherit_language) ||
                (font.language() == ignore_language))
                lyxerr << "No this shouldn't happen!\n";
+#endif
 #endif
        if (lyxrc.mark_foreign_language &&
+           font.language() != latex_language &&
            font.language() != bview->buffer()->params.language) {
                int const y = offset + row->height() - 1;
                pain.line(int(tmpx), y, int(x), y,
index 7d4172e5ffa6ec01b3b3288919ac3e4d24653bf4..b4fb6d2895d34f21f577dde4f463f99013f6b77b 100644 (file)
@@ -120,16 +120,26 @@ LyXFont const realizeFont(LyXFont const & font,
        while (par && par_depth && !tmpfont.resolved()) {
                par = par->outerHook();
                if (par) {
+#ifndef INHERIT_LANGUAGE
+                       tmpfont.realize(textclasslist.
+                                       Style(buf->params.textclass,
+                                             par->getLayout()).font);
+#else
                        tmpfont.realize(textclasslist.
                                        Style(buf->params.textclass,
                                              par->getLayout()).font,
-                                                       buf->params.language);
+                                       buf->params.language);
+#endif
                        par_depth = par->getDepth();
                }
        }
 
+#ifndef INHERIT_LANGUAGE
+       tmpfont.realize(textclasslist.TextClass(buf->params.textclass).defaultfont());
+#else
        tmpfont.realize(textclasslist.TextClass(buf->params.textclass).defaultfont(),
                        buf->params.language);
+#endif
 
        return tmpfont;
 }
@@ -160,10 +170,18 @@ LyXFont const LyXText::getFont(Buffer const * buf, Paragraph * par,
                                // 1% goes here
                        LyXFont f = par->getFontSettings(buf->params,
                                                         pos);
+#ifndef INHERIT_LANGUAGE
+                       return f.realize(layout.reslabelfont);
+#else
                        return f.realize(layout.reslabelfont, buf->params.language);
+#endif
                } else {
                        LyXFont f = par->getFontSettings(buf->params, pos);
+#ifndef INHERIT_LANGUAGE
+                       return f.realize(layout.resfont);
+#else
                        return f.realize(layout.resfont, buf->params.language);
+#endif
                }
        }
        
@@ -180,7 +198,11 @@ LyXFont const LyXText::getFont(Buffer const * buf, Paragraph * par,
        }
 
        LyXFont tmpfont = par->getFontSettings(buf->params, pos);
+#ifndef INHERIT_LANGUAGE
+       tmpfont.realize(layoutfont);
+#else
        tmpfont.realize(layoutfont, buf->params.language);
+#endif
        
        return realizeFont(tmpfont, buf, par);
 }
@@ -222,7 +244,7 @@ void LyXText::setCharFont(BufferView * bv, Paragraph * par,
 {
        Buffer const * buf = bv->buffer();
        LyXFont font = getFont(buf, par, pos);
-       font.update(fnt, toggleall);
+       font.update(fnt, buf->params.language, toggleall);
        // Let the insets convert their font
        if (par->getChar(pos) == Paragraph::META_INSET) {
                Inset * inset = par->getInset(pos);
@@ -253,15 +275,25 @@ void LyXText::setCharFont(BufferView * bv, Paragraph * par,
                while (!layoutfont.resolved() && tp && tp->getDepth()) {
                        tp = tp->outerHook();
                        if (tp)
+#ifndef INHERIT_LANGUAGE
+                               layoutfont.realize(textclasslist.
+                                                  Style(buf->params.textclass,
+                                                        tp->getLayout()).font);
+#else
                                layoutfont.realize(textclasslist.
                                                   Style(buf->params.textclass,
                                                         tp->getLayout()).font,
                                                   buf->params.language);
+#endif
                }
        }
 
+#ifndef INHERIT_LANGUAGE
+       layoutfont.realize(textclasslist.TextClass(buf->params.textclass).defaultfont());
+#else
        layoutfont.realize(textclasslist.TextClass(buf->params.textclass).defaultfont(),
                           buf->params.language);
+#endif
 
        // Now, reduce font against full layout font
        font.reduce(layoutfont);
@@ -293,15 +325,25 @@ void LyXText::setCharFont(Buffer const * buf, Paragraph * par,
                while (!layoutfont.resolved() && tp && tp->getDepth()) {
                        tp = tp->outerHook();
                        if (tp)
+#ifndef INHERIT_LANGUAGE
+                               layoutfont.realize(textclasslist.
+                                                  Style(buf->params.textclass,
+                                                        tp->getLayout()).font);
+#else
                                layoutfont.realize(textclasslist.
                                                   Style(buf->params.textclass,
                                                         tp->getLayout()).font,
                                                   buf->params.language);
+#endif
                }
        }
 
+#ifndef INHERIT_LANGUAGE
+       layoutfont.realize(textclasslist.TextClass(buf->params.textclass).defaultfont());
+#else
        layoutfont.realize(textclasslist.TextClass(buf->params.textclass).defaultfont(),
                           buf->params.language);
+#endif
 
        // Now, reduce font against full layout font
        font.reduce(layoutfont);
@@ -706,14 +748,20 @@ void LyXText::setFont(BufferView * bview, LyXFont const & font, bool toggleall)
                                                   cursor.par());
                }
                // Update current font
-               real_current_font.update(font, toggleall);
+               real_current_font.update(font, 
+                                        bview->buffer()->params.language,
+                                        toggleall);
 
                // Reduce to implicit settings
                current_font = real_current_font;
                current_font.reduce(layoutfont);
                // And resolve it completely
+#ifndef INHERIT_LANGUAGE
+               real_current_font.realize(layoutfont);
+#else
                real_current_font.realize(layoutfont,
                                          bview->buffer()->params.language);
+#endif
                return;
        }