Mostafa Vahedi schrieb:

The correct way is to add the options "LFE,LAE" to the existing call of fontenc in the preamble.
You are right. In fact I don't know how to do that. Whether I should do something in the source or somewhere else.

The attached patch fixes this.

2) Due to the current bugs or limitations of the ARABI package whenever we want to use Farsi we should use Arabic too (because some of the shared definitions are defined in Arabic definitions files only). Moreover Farsi should be called before Arabic. Again there are two ways: 2-a) It is possible to adjust the input field "Options" in "Document->Setteings:Document Class" (though I am not sure!).

This is the way we do know: When a language is used in a document, its name is automatically added to the document class option. To in case the user uses Farsi, we should also add arabic.
You are right! But since this is a bug of ARABI package hopefully it will be OK later and then we should/may remove this part from the source. However Please let me know the point that I should look into the source or ....

I haven't touched this in the patch. Do you reported the bug to the arabi maintainers? If yes and they have it fixed in their development resources, please ask them to release this fixed version, because this is a mayor bug. I don't want to build this in as I expect that they will fix this quickly. This would only be a nasty hack nobody remembers to remove later. The user can for a quick workaround add "arabic" manually to the documentclass options. Or do you think this status will stay in arabi for longer time?

3) ARABI has a seperate command to specify the Main language of the document. This main language is used to specify the language and orientation of the "Table of Contents" and "Page numbers" and so on. It is necessary to put the command "\TOCLanguage{farsi}" in the "Document->Setteings:LaTeX Preamble".

Yes, but not to the user visible preamble but to the one that LyX sets.
You are right! How can we understand what the main language of the document is?

See the attached patch. I implemented this but disabled it because \TOCLanguage gives me the error "unknown command". Therefore your example-lyxified doesn't compile.

4) (One other bug!) We should add the command "[EMAIL PROTECTED]@R{#1}}}" to "Document->Setteings:LaTeX
  > > Preamble".

Why?
Don't worry. This bug is due to ARABI package not to LyX. If we don't do this then the Table of Contents will be written in Arabic Font and also LyX will complain about some undefined characters. We should not change the source code of LyX. This is a bug of ARABI.

I built it into the patch, but please report this to the arabi people.

5) (One other bug!) We should add the following two commands
"\DeclareTextSymbol{\guillemotright}{LFE}{62}" and
  > > "\DeclareTextSymbol{\guillemotleft}{LFE}{60}" to 
"Document->Setteings:LaTeX
  > > Preamble".

Why?
The bug is again due to ARABI package. These two lines define the quote symboles in defined font-encoding LFE used for Farsi which are "«" and "»". Again we should not change the source of LyX. This is a bug of ARABI.

Implemented in the patch too, but please report this to the arabi people.

6) (One other bug!). We should add the command "\selectlanguage{farsi}" as an ERT as the first line of the document.

No need for this. When the document language is Farsi, no switch is needed. For later switches, this is currently correctly done by LyX.
Again as I said this bug is due to ARABI package. In the previous email I have attached the example_lyxified.lyx. Try to compile it as it is and then try to compile it without the first line containing the ERT. You will see that LyX will complain about some undefined characters. Again since this is a bug of LyX we should not change the source again as I said before!

I can see no difference. With and without the ERT command, the result is 
identical.

---

Besides this the pach contains an improved version of Dov's fix that fixes the issue I initially reported in bug 2928.

I tested everything carefully and now everything works fine for me. Does it 
work for you too?

thanks and regards
Uwe
Index: lib/languages
===================================================================
--- lib/languages	(revision 18838)
+++ lib/languages	(working copy)
@@ -1,7 +1,8 @@
 # name      babel name	GUI name	RTL?   encoding	  code	latex options
 afrikaans   afrikaans	"Afrikaans"	false  iso8859-15 af_ZA	 ""
 american    american	"American"	false  iso8859-15 en_US	 ""
-arabic      arabic	"Arabic"	true   cp1256     ar_SA	 ""
+# the definitions are only used due to bugs in the arabi-package - remove them if they become unnecessary!
+arabic      arabic	"Arabic"	true   cp1256     ar_SA	 "\DeclareTextSymbol{\guillemotright}{LFE}{62}\DeclareTextSymbol{\guillemotleft}{LFE}{60}"
 armenian    ""		"Armenian"	false  armscii8   hy_AM	 ""
 austrian    austrian	"Austrian"	false  iso8859-15 de_AT	 ""
 naustrian   naustrian	"Austrian (new spelling)" false  iso8859-15  de_AT	 ""
@@ -25,7 +26,8 @@
 # Esperanto has no country code
 esperanto   esperanto	"Esperanto"	false  iso8859-3  eo	 ""
 estonian    estonian	"Estonian"	false  iso8859-15 et_EE	 ""
-farsi       farsi	"Farsi"		true   utf8       fa_IR	 ""
+# the definitions are only used due to bugs in the arabi-package - remove them if they become unnecessary!
+farsi       farsi	"Farsi"		true   utf8       fa_IR	 "[EMAIL PROTECTED]@R{#1}}}\DeclareTextSymbol{\guillemotright}{LFE}{62}\DeclareTextSymbol{\guillemotleft}{LFE}{60}"
 finnish     finnish	"Finnish"	false  iso8859-15 fi_FI	 ""
 # We redefine \og and \fg (guillemets) for older french language definitions
 french      french 	"French"	false  iso8859-15 fr_FR	 "\addto\extrasfrench{\providecommand{\og}{\leavevmode\flqq~}\providecommand{\fg}{\ifdim\lastskip>[EMAIL PROTECTED]"
Index: src/BufferParams.cpp
===================================================================
--- src/BufferParams.cpp	(revision 18838)
+++ src/BufferParams.cpp	(working copy)
@@ -892,9 +892,16 @@
 	if (fontsDefaultFamily != "default")
 		os << "\\renewcommand{\\familydefault}{\\"
 		   << from_ascii(fontsDefaultFamily) << "}\n";
+
+	//set font encoding
 	// this one is not per buffer
-	if (lyxrc.fontenc != "default") {
+	if ((lyxrc.fontenc != "default" && language->lang() == "arabic") ||
+		(lyxrc.fontenc != "default" && language->lang() == "farsi")) {
 		os << "\\usepackage[" << from_ascii(lyxrc.fontenc)
+		   << ",LFE,LAE]{fontenc}\n";
+		texrow.newline();
+	} else {
+		os << "\\usepackage[" << from_ascii(lyxrc.fontenc)
 		   << "]{fontenc}\n";
 		texrow.newline();
 	}
@@ -1059,6 +1066,12 @@
 		texrow.newline();
 	}
 
+	//these definitions are needed by the arabi-package
+	//if (language->babel() == "arabic")
+	//	os << "\\TOCLanguage{arabic}\n";
+	//if (language->babel() == "farsi")
+	//	os << "\\TOCLanguage{farsi}\n";
+
 	// If we use jurabib, we have to call babel here.
 	if (use_babel && features.isRequired("jurabib")) {
 		os << from_ascii(babelCall(language_options.str()))
Index: src/Font.cpp
===================================================================
--- src/Font.cpp	(revision 18838)
+++ src/Font.cpp	(working copy)
@@ -756,6 +756,13 @@
 			    base.language()->lang() == "farsi") {
 			os << "\\textLR{";
 			count += 8;
+		} else if (language()->lang() == "arabic") {
+			os << "\\textAR{";
+			count += 8;
+		} else if (!isRightToLeft() &&
+			    base.language()->lang() == "arabic") {
+			os << "\\textLR{";
+			count += 8;
 		} else if (isRightToLeft() != prev.isRightToLeft()) {
 			if (isRightToLeft()) {
 				os << "\\R{";
Index: src/insets/InsetTabular.cpp
===================================================================
--- src/insets/InsetTabular.cpp	(revision 18838)
+++ src/insets/InsetTabular.cpp	(working copy)
@@ -2286,6 +2286,8 @@
 			if (par.getParLanguage(buf.params())->lang() ==
 			"farsi")
 				os << "\\textFR{";
+			else if (par.getParLanguage(buf.params())->lang() == "arabic")
+				os << "\\textAR{";
 			else
 				os << "\\R{";
 		}

Reply via email to