On 29-Apr-2002 Dekel Tsur wrote:
> On Mon, Apr 29, 2002 at 06:01:27PM +0200, Lars Gullik Bjønnes wrote:
>> Why do you say that 1.2.0cvs is not able to read files with the latex
>> layout? Hmm it seems that we test for a valid layout a bit early in
>> buffer.C... so that the compability reading does not kick in before we
>> have already changed to using defaultLayoutName...
>> 
>> Do anyone have a test file for me? That is f.ex two plain paragraphs
>> and a latex paragraph in between?
> 
> Attached.

Well it seems to me this is perfectly read!

Anyway to anser Lars

>I'd like some one to test this before it is applied.
> What are a relevant test file?

As John told you the test file is on LyXBugs (but you seem to have problems
with it as you told me). Anyway I explain you what is wrong. We set a font
with the default language (I have as default "english"). So we have this font
and it's language is "english". Now we read the \\language tag and set the
default language to f.ex. "norsk" the font is NOT set to this language.

This is only done later when reading the \\layout tag and there the check
for "latex" is too early, before we change the language in the font with

>      font = LyXFont(LyXFont::ALL_INHERIT, params.language);

So an alternative fix would be move the block:

#ifndef NO_COMPABILITY
                if (compare_no_case(layoutname, "latex") == 0) {
                        ert_comp.active = true;
                        ert_comp.font = font;
                }
#endif

To after the settings of the the above fonttag! No to tell the truth now
that I think about it we should just move the above font asignment, BEFORE
the check for "latex", this would then fix also the reading of caption when
we activate that one ;)

Here is the new patch for fixing this bug.

           Jug

--
-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._
Dr. Jürgen Vigna        E-Mail:  [EMAIL PROTECTED]
Italienallee 13/N       Tel/Fax: +39-0471-450260 / +39-0471-450253
I-39100 Bozen           Web:     http://www.sad.it/~jug
-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._

"I DO want your money, because god wants your money!"
-- The Reverend Jimmy, from _Repo_Man_

Index: src/buffer.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/buffer.C,v
retrieving revision 1.329
diff -u -p -r1.329 buffer.C
--- src/buffer.C        29 Apr 2002 21:45:09 -0000      1.329
+++ src/buffer.C        30 Apr 2002 09:53:00 -0000
@@ -482,6 +482,13 @@ Buffer::parseSingleLyXformat2Token(LyXLe
                        layoutname = tclass.defaultLayoutName();
                }
 
+               // reset the font as we start a new layout and if the font is
+               // not ALL_INHERIT,document_language then it will be set to the
+               // right values after this tag (Jug 20020420)
+               font = LyXFont(LyXFont::ALL_INHERIT, params.language);
+               if (file_format < 216 && params.language->lang() == "hebrew")
+                       font.setLanguage(default_language);
+               
 #ifndef NO_COMPABILITY
                if (compare_no_case(layoutname, "latex") == 0) {
                        ert_comp.active = true;
@@ -555,10 +562,6 @@ Buffer::parseSingleLyXformat2Token(LyXLe
                        if (!layout.obsoleted_by().empty())
                                par->layout(layout.obsoleted_by());
                        par->params().depth(depth);
-                       font = LyXFont(LyXFont::ALL_INHERIT, params.language);
-                       if (file_format < 216
-                           && params.language->lang() == "hebrew")
-                               font.setLanguage(default_language);
 #if USE_CAPTION
                }
 #endif

Reply via email to