Re: [LyX master] GuiDocument.cpp: some languages only work with polyglossia, therefore enable non-TeX fonts when one of them is used as document language

2012-06-10 Thread Uwe Stöhr

Am 08.06.2012 08:34, schrieb Jürgen Spitzmüller:



Hardcoding those languages is bad. Can't you just check if the
language has no babel name but a polyglossia name?


You are right. The list of languages only supported by polyglissia will 
grow. I'll have a look when I'm back or you can implement this if you like.


regards Uwe


Re: [LyX master] GuiDocument.cpp: some languages only work with polyglossia, therefore enable non-TeX fonts when one of them is used as document language

2012-06-10 Thread Uwe Stöhr

Am 08.06.2012 08:34, schrieb Jürgen Spitzmüller:



Hardcoding those languages is bad. Can't you just check if the
language has no babel name but a polyglossia name?


You are right. The list of languages only supported by polyglissia will 
grow. I'll have a look when I'm back or you can implement this if you like.


regards Uwe


Re: [LyX master] GuiDocument.cpp: some languages only work with polyglossia, therefore enable non-TeX fonts when one of them is used as document language

2012-06-08 Thread Jürgen Spitzmüller
2012/6/8 Uwe Stöhr:
 +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) {
 +                       fontModule-osFontsCB-setChecked(true);
 +                       fontModule-osFontsCB-setEnabled(false);
 +       }
 +       else
 +               fontModule-osFontsCB-setEnabled(true);
 +}

Hardcoding those languages is bad. Can't you just check if the
language has no babel name but a polyglossia name?

Jürgen


Re: [LyX master] GuiDocument.cpp: some languages only work with polyglossia, therefore enable non-TeX fonts when one of them is used as document language

2012-06-08 Thread Jean-Marc Lasgouttes

Le 08/06/2012 08:34, Jürgen Spitzmüller a écrit :

2012/6/8 Uwe Stöhr:

+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) {
+   fontModule-osFontsCB-setChecked(true);
+   fontModule-osFontsCB-setEnabled(false);
+   }
+   else
+   fontModule-osFontsCB-setEnabled(true);
+}


Hardcoding those languages is bad. Can't you just check if the
language has no babel name but a polyglossia name?


Same remark for the BufferParams change in 7eca5d and probably for the 
hardcoded names in tex2lyx/preamble.cpp.


JMarc




Re: [LyX master] GuiDocument.cpp: some languages only work with polyglossia, therefore enable non-TeX fonts when one of them is used as document language

2012-06-08 Thread Jürgen Spitzmüller
2012/6/8 Jean-Marc Lasgouttes lasgout...@lyx.org:
 Same remark for the BufferParams change in 7eca5d and probably for the
 hardcoded names in tex2lyx/preamble.cpp.

True. Also, I think the logic is wrong in BufferParams. Polyglossia
only works _with_ XeTeX, so it should read

diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp
index b1a61b9..ba7fe31 100644
--- a/src/BufferParams.cpp
+++ b/src/BufferParams.cpp
@@ -1245,21 +1245,10 @@ 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)
+   Language const * lang = lyx::languages.getLanguage(language-lang());
+   if (features.runparams().flavor == OutputParams::XETEX
+((lang-babel().empty()  !lang-polyglossia().empty())
+   || useNonTeXFonts))
features.require(polyglossia);

if (language-lang() == vietnamese)


But I suppose what Uwe wants to do is to force XeTeX if such a
language is used. Of course this has to be done differently.

Also, the case where a polyglossia-only language is used as a
secondary language needs to be handled. IIRC there are also babel
only languages. What happens if a user selects one of each?

Jürgen


Fwd: Re: [LyX master] GuiDocument.cpp: some languages only work with polyglossia, therefore enable non-TeX fonts when one of them is used as document language

2012-06-08 Thread Jean-Marc Lasgouttes




 Message original 
Sujet: Re: [LyX master] GuiDocument.cpp: some languages only work with 
polyglossia, therefore enable non-TeX fonts when one of them is used as 
document language

Date : Fri, 8 Jun 2012 12:58:39 +0200
De : Jürgen Spitzmüller sp...@lyx.org
Pour : Jean-Marc Lasgouttes lasgout...@lyx.org

I've committed something that removes the hardcoding in LyX itself
(not tex2lyx) and checks for all involved languages. Uwe, please test.

What needs to be done is to place an error message somewhere if
(!features.hasOnlyPolyglossiaLanguages 
features.hasPolyglossiaExclusiveLanguages).

Jürgen




Re: [LyX master] GuiDocument.cpp: some languages only work with polyglossia, therefore enable non-TeX fonts when one of them is used as document language

2012-06-08 Thread Jürgen Spitzmüller
2012/6/8 Uwe Stöhr:
> +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") {
> +                       fontModule->osFontsCB->setChecked(true);
> +                       fontModule->osFontsCB->setEnabled(false);
> +       }
> +       else
> +               fontModule->osFontsCB->setEnabled(true);
> +}

Hardcoding those languages is bad. Can't you just check if the
language has no babel name but a polyglossia name?

Jürgen


Re: [LyX master] GuiDocument.cpp: some languages only work with polyglossia, therefore enable non-TeX fonts when one of them is used as document language

2012-06-08 Thread Jean-Marc Lasgouttes

Le 08/06/2012 08:34, Jürgen Spitzmüller a écrit :

2012/6/8 Uwe Stöhr:

+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") {
+   fontModule->osFontsCB->setChecked(true);
+   fontModule->osFontsCB->setEnabled(false);
+   }
+   else
+   fontModule->osFontsCB->setEnabled(true);
+}


Hardcoding those languages is bad. Can't you just check if the
language has no babel name but a polyglossia name?


Same remark for the BufferParams change in 7eca5d and probably for the 
hardcoded names in tex2lyx/preamble.cpp.


JMarc




Re: [LyX master] GuiDocument.cpp: some languages only work with polyglossia, therefore enable non-TeX fonts when one of them is used as document language

2012-06-08 Thread Jürgen Spitzmüller
2012/6/8 Jean-Marc Lasgouttes :
> Same remark for the BufferParams change in 7eca5d and probably for the
> hardcoded names in tex2lyx/preamble.cpp.

True. Also, I think the logic is wrong in BufferParams. Polyglossia
only works _with_ XeTeX, so it should read

diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp
index b1a61b9..ba7fe31 100644
--- a/src/BufferParams.cpp
+++ b/src/BufferParams.cpp
@@ -1245,21 +1245,10 @@ 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)
+   Language const * lang = lyx::languages.getLanguage(language->lang());
+   if (features.runparams().flavor == OutputParams::XETEX
+   && ((lang->babel().empty() && !lang->polyglossia().empty())
+   || useNonTeXFonts))
features.require("polyglossia");

if (language->lang() == "vietnamese")


But I suppose what Uwe wants to do is to force XeTeX if such a
language is used. Of course this has to be done differently.

Also, the case where a "polyglossia-only" language is used as a
secondary language needs to be handled. IIRC there are also "babel
only" languages. What happens if a user selects one of each?

Jürgen


Fwd: Re: [LyX master] GuiDocument.cpp: some languages only work with polyglossia, therefore enable non-TeX fonts when one of them is used as document language

2012-06-08 Thread Jean-Marc Lasgouttes




 Message original 
Sujet: Re: [LyX master] GuiDocument.cpp: some languages only work with 
polyglossia, therefore enable non-TeX fonts when one of them is used as 
document language

Date : Fri, 8 Jun 2012 12:58:39 +0200
De : Jürgen Spitzmüller 
Pour : Jean-Marc Lasgouttes 

I've committed something that removes the hardcoding in LyX itself
(not tex2lyx) and checks for all involved languages. Uwe, please test.

What needs to be done is to place an error message somewhere if
(!features.hasOnlyPolyglossiaLanguages &&
features.hasPolyglossiaExclusiveLanguages).

Jürgen