Hi!

Attached find a patch which fixes some problems that existed with the "default" encoding. Georg and I discussed some of these a few months back, but nothing ever came of it then. Now this patch seems to fix all of the problems that I have with "default" encoding.

The attached files are two examples, for which there's no problem viewing the DVI if the encoding is "auto", but if you change it to "default" it fails. The attached patch fixes both.

Just a reminder: "default" is supposed to be exactly like "auto" (i.e., the encoding is determined based on the language), except that it shouldn't output any "inputencoding" commands, because LaTeX will determine the encoding on it's own. This patch achieves that, by fixing a few places where differences between "auto" and "default" have crept in.

This should be considered a regression, because in earlier versions Hebrew worked only with the "default" encoding.

Also, just a thought: something similar to the change in Paragraph.cpp may also be relevant to bug 3561 (which I don't understand exactly, but may be somehow related...)?

Please test and OK!

Dov
Index: lyx-devel/src/output_latex.cpp
===================================================================
--- lyx-devel.orig/src/output_latex.cpp 2007-06-29 15:19:39.000000000 +0300
+++ lyx-devel/src/output_latex.cpp      2007-06-29 15:28:25.000000000 +0300
@@ -296,7 +296,7 @@
        }
 
        // Switch file encoding if necessary
-       if (bparams.inputenc == "auto" &&
+       if ((bparams.inputenc == "auto" || bparams.inputenc == "default") &&
            runparams.encoding->package() == Encoding::inputenc) {
                // Look ahead for future encoding changes.
                // We try to output them at the beginning of the paragraph,
@@ -602,8 +602,8 @@
                   bool moving_arg, Encoding const & oldEnc,
                   Encoding const & newEnc)
 {
-       if ((bparams.inputenc != "auto" || moving_arg)
-               && bparams.inputenc != "default")
+       if ((bparams.inputenc != "auto" && bparams.inputenc != "default")
+               || moving_arg)
                return 0;
 
        // Do nothing if the encoding is unchanged.
Index: lyx-devel/src/Paragraph.cpp
===================================================================
--- lyx-devel.orig/src/Paragraph.cpp    2007-06-29 15:19:39.000000000 +0300
+++ lyx-devel/src/Paragraph.cpp 2007-06-29 15:28:25.000000000 +0300
@@ -2047,7 +2047,7 @@
                        int const count = switchEncoding(os, bparams,
                                        runparams.moving_arg, 
*(runparams.encoding),
                                        *(font.language()->encoding()));
-                       if (count > 0) {
+                       if (count > 0 || bparams.inputenc == "default") {
                                column += count;
                                runparams.encoding = 
font.language()->encoding();
                        }

Attachment: bidi-challenge.lyx
Description: application/lyx

Attachment: encoding2.lyx
Description: application/lyx

Reply via email to