The branch, master, has been updated.

- Log -----------------------------------------------------------------

commit 35782ccea4e2090bf0224188b71ef968295f9105
Merge: 040fb73 fbb69e1
Author: Juergen Spitzmueller <[email protected]>
Date:   Fri Jun 8 12:55:24 2012 +0200

    Merge branch 'master' of git.lyx.org:lyx


commit 040fb73b9ce527ea483aa081e8971fb76e8a4406
Author: Juergen Spitzmueller <[email protected]>
Date:   Fri Jun 8 12:54:57 2012 +0200

    Do not hardcode polyglossia-only languages

diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp
index b1a61b9..818399d 100644
--- a/src/BufferParams.cpp
+++ b/src/BufferParams.cpp
@@ -1245,21 +1245,9 @@ void BufferParams::validate(LaTeXFeatures & features) 
const
        }
 
        // some languages are only available via polyglossia
-       if ( (features.runparams().flavor == OutputParams::XETEX
-                 || language->lang() == "ancientgreek"
-                 || language->lang() == "coptic"
-                 || language->lang() == "divehi"
-                 || language->lang() == "hindi"
-                 || language->lang() == "kurmanji"
-                 || language->lang() == "lao"
-                 || language->lang() == "marathi"
-                 || language->lang() == "occitan"
-                 || language->lang() == "sanskrit"
-                 || language->lang() == "syriac"
-                 || language->lang() == "tamil"
-                 || language->lang() == "telugu"
-                 || language->lang() == "urdu"
-                ) && useNonTeXFonts)
+       if (features.runparams().flavor == OutputParams::XETEX
+           && (features.hasPolyglossiaExclusiveLanguages()
+               || useNonTeXFonts))
                features.require("polyglossia");
 
        if (language->lang() == "vietnamese")
diff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp
index b5fe2af..f75fdc4 100644
--- a/src/LaTeXFeatures.cpp
+++ b/src/LaTeXFeatures.cpp
@@ -313,12 +313,12 @@ bool LaTeXFeatures::usePolyglossia() const
                        && isRequired("polyglossia")
                        && isAvailable("polyglossia")
                        && !params_.documentClass().provides("babel")
-                       && this->hasPolyglossiaLanguages();
+                       && this->hasOnlyPolyglossiaLanguages();
        return (bufferParams().lang_package == "auto")
                && isRequired("polyglossia")
                && isAvailable("polyglossia")
                && !params_.documentClass().provides("babel")
-               && this->hasPolyglossiaLanguages();
+               && this->hasOnlyPolyglossiaLanguages();
 }
 
 
@@ -477,7 +477,7 @@ bool LaTeXFeatures::hasLanguages() const
 }
 
 
-bool LaTeXFeatures::hasPolyglossiaLanguages() const
+bool LaTeXFeatures::hasOnlyPolyglossiaLanguages() const
 {
        LanguageList::const_iterator const begin = UsedLanguages_.begin();
        for (LanguageList::const_iterator cit = begin;
@@ -490,6 +490,19 @@ bool LaTeXFeatures::hasPolyglossiaLanguages() const
 }
 
 
+bool LaTeXFeatures::hasPolyglossiaExclusiveLanguages() const
+{
+       LanguageList::const_iterator const begin = UsedLanguages_.begin();
+       for (LanguageList::const_iterator cit = begin;
+            cit != UsedLanguages_.end();
+            ++cit) {
+               if ((*cit)->babel().empty() && !(*cit)->polyglossia().empty())
+                       return true;
+       }
+       return false;
+}
+
+
 string LaTeXFeatures::getLanguages() const
 {
        ostringstream languages;
diff --git a/src/LaTeXFeatures.h b/src/LaTeXFeatures.h
index 3b1cc89..7b1f51b 100644
--- a/src/LaTeXFeatures.h
+++ b/src/LaTeXFeatures.h
@@ -106,7 +106,9 @@ public:
        ///
        bool hasLanguages() const;
        /// check if all used languages are supported by polyglossia
-       bool hasPolyglossiaLanguages() const;
+       bool hasOnlyPolyglossiaLanguages() const;
+       /// check if a language is supported only by polyglossia
+       bool hasPolyglossiaExclusiveLanguages() const;
        ///
        std::string getLanguages() const;
        ///
diff --git a/src/frontends/qt4/GuiDocument.cpp 
b/src/frontends/qt4/GuiDocument.cpp
index 4b269ca..cfe83a7 100644
--- a/src/frontends/qt4/GuiDocument.cpp
+++ b/src/frontends/qt4/GuiDocument.cpp
@@ -1760,15 +1760,9 @@ void GuiDocument::deleteBoxBackgroundColor()
 void GuiDocument::languageChanged(int i)
 {
        // some languages only work with polyglossia/XeTeX
-       string current_language = lyx::languages.getLanguage(
-               
fromqstr(langModule->languageCO->itemData(i).toString()))->lang();
-       if (current_language == "ancientgreek"
-               || current_language == "coptic" || current_language == "divehi"
-               || current_language == "hindi" || current_language == "kurmanji"
-               || current_language == "lao" || current_language == "marathi"
-               || current_language == "occitan" || current_language == 
"sanskrit"
-               || current_language == "syriac" || current_language == "tamil"
-               || current_language == "telugu" || current_language == "urdu") {
+       Language const * lang = lyx::languages.getLanguage(
+               fromqstr(langModule->languageCO->itemData(i).toString()));
+       if (lang->babel().empty() && !lang->polyglossia().empty()) {
                        fontModule->osFontsCB->setChecked(true);
                        fontModule->osFontsCB->setEnabled(false);
        }

-----------------------------------------------------------------------

Summary of changes:
 src/BufferParams.cpp              |   18 +++---------------
 src/LaTeXFeatures.cpp             |   19 ++++++++++++++++---
 src/LaTeXFeatures.h               |    4 +++-
 src/frontends/qt4/GuiDocument.cpp |   12 +++---------
 4 files changed, 25 insertions(+), 28 deletions(-)


hooks/post-receive
-- 
The LyX Source Repository

Reply via email to