]> git.lyx.org Git - lyx.git/commitdiff
Bug in 'Use non-tex fonts' checkbox auto-toggling (#8717)
authorJuergen Spitzmueller <spitz@lyx.org>
Sat, 20 Jul 2013 14:15:47 +0000 (16:15 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Sat, 20 Jul 2013 14:15:47 +0000 (16:15 +0200)
src/frontends/qt4/GuiDocument.cpp

index 4fd3d53babdd814768674db9900c8f2dce65fc1d..80b41595c031f28929aa21b292259584d9856dbf 100644 (file)
@@ -149,6 +149,7 @@ RGBColor set_fontcolor;
 bool is_fontcolor;
 RGBColor set_notefontcolor;
 RGBColor set_boxbgcolor;
+bool forced_fontspec_activation;
 
 namespace {
 // used when sorting the textclass list.
@@ -1735,11 +1736,22 @@ void GuiDocument::languageChanged(int i)
        Language const * lang = lyx::languages.getLanguage(
                fromqstr(langModule->languageCO->itemData(i).toString()));
        if (lang->babel().empty() && !lang->polyglossia().empty()) {
+                       // If we force to switch fontspec on, store
+                       // current state (#8717)
+                       if (fontModule->osFontsCB->isEnabled())
+                               forced_fontspec_activation =
+                                       !fontModule->osFontsCB->isChecked();
                        fontModule->osFontsCB->setChecked(true);
                        fontModule->osFontsCB->setEnabled(false);
        }
-       else
+       else {
                fontModule->osFontsCB->setEnabled(true);
+               // If we have forced to switch fontspec on,
+               // restore previous state (#8717)
+               if (forced_fontspec_activation)
+                       fontModule->osFontsCB->setChecked(false);
+               forced_fontspec_activation = false;
+       }
 
        // set appropriate quotation mark style
        if (!lang->quoteStyle().empty()) {
@@ -1916,7 +1928,7 @@ void GuiDocument::updateFontlist()
        fontModule->fontsTypewriterCO->clear();
        fontModule->fontsMathCO->clear();
 
-       // With XeTeX, we have access to all system fonts, but not the LaTeX fonts
+       // With fontspec (XeTeX, LuaTeX), we have access to all system fonts, but not the LaTeX fonts
        if (fontModule->osFontsCB->isChecked()) {
                fontModule->fontsRomanCO->addItem(qt_("Default"), QString("default"));
                fontModule->fontsSansCO->addItem(qt_("Default"), QString("default"));