On Wed, Feb 01, 2006 at 04:03:50PM +0100, Helge Hafting wrote:

...

> >Helge, see if you can live with this one.
> > 
> >
> Not trying to be difficult, but unfortunately not.
> 
> Make a document, set a nondefault document language, type some text.
> Insert a footnote, notice that it gets blue line, L-cursor, and the text
> inside is in the default language instead of document language. And
> it cannot be reset to document language either, although it _can_ be
> set to any other language.  Ouch!

Apply the attached additional patch. (Did you notice how this grows and
grows? Everything is related to everything. Shouldn't be this way in
well-designed software, but there it is.)
 
> The same applies to table cells.  They are all in "default configured 
> language" instead of "document language".  

Cannot reproduce here. I suspect that the published patch used by you is
not exactly what I have here in my tree. I'll try to carefully make an
exact one.

> Minipages work as they should though,
> text inside is in the document language unless I change it.

Good.
 
...

> Also, when changing language over a selection, the change is not
> propagated into table cells or footnotes. This is an error,
> perhaps unrelated.
 
No, I think it is related.
 
> An oddity:
> * Write some text (in the document language), and insert a minipage
>   in the middle of it. write some text inside the minipage too.
> * Mark one word inside the minipage, and change it to a second language.
>   This works, the word get underlined as expected.
> * Mark everything (the whole document) and change to a third language.
>   Everything is now underlined as it should.  But put the cursor in that
>   special word in the minipage, and see that it is still in the 
> "second" language.
>   Weird - because I tried to change everything.
> * Select all again, and revert language.  Everything goes back to document
>   language, except for that special word in the minipage.  It remains
>   "second language", and can only be reset by making a selection
>   inside the minipage.
> 
> What exactly happens when I change language on a selection?
> Do the minipage simply inherit language for content that
> isn't explicitly nondefault? 

Precisely. "On the fly", during the redoParagraph/metrics computation.

> Incidentally, applying "bold"
> works the same way: mark a word bold but not the rest.
> Then, make a selection that spans the minipage and more.
> Apply bold - everything is then bold. Revert bold, and everything
> except the special word looses boldness.
> 
> My first reaction was surprise, but maybe this is intentional?
> If a few scattered words are marked with a different language then
> this is probably correct, and a wide-selection change shouldn't
> reset them.  But it is inconsistent, for scattered words that doesn't
> happen to be inside some inset wholly contained in the selection
> have no such protection.
> 
> This isn't much of a problem, but could be fixed by recursing
> into insets when applying a font change.

If only it were so simple... you don't want to know what really goes
on... nothing like recursion, rather a bitstring operation between inside
and outside fonts. And the language attribute being handled separately,
wrong or not at all.

> Footnotes, floats,  marginal notes, and tables in a document
> with a nondefault language is broken though.  Language in the
> saved file is ok, but all on-screen indicators (blue line,
> and the status bar) get it wrong.
> 
> Helge Hafting

Try the above, works for me. Or wait for a *really* carefully produced
patch Real Soon Now.

- Martin

Index: insetfootlike.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetfootlike.C,v
retrieving revision 1.33
diff -u -p -r1.33 insetfootlike.C
--- insetfootlike.C     10 Apr 2005 14:07:33 -0000      1.33
+++ insetfootlike.C     1 Feb 2006 17:38:22 -0000
@@ -45,7 +45,7 @@ InsetFootlike::InsetFootlike(InsetFootli
 void InsetFootlike::metrics(MetricsInfo & mi, Dimension & dim) const
 {
        LyXFont tmpfont = mi.base.font;
-       mi.base.font = LyXFont(LyXFont::ALL_SANE);
+       mi.base.font = LyXFont(LyXFont::ALL_SANE, tmpfont.language());
        InsetCollapsable::metrics(mi, dim);
        mi.base.font = tmpfont;
        dim_ = dim;
@@ -55,7 +55,7 @@ void InsetFootlike::metrics(MetricsInfo 
 void InsetFootlike::draw(PainterInfo & pi, int x, int y) const
 {
        LyXFont tmpfont = pi.base.font;
-       pi.base.font = LyXFont(LyXFont::ALL_SANE);
+       pi.base.font = LyXFont(LyXFont::ALL_SANE, tmpfont.language());
        InsetCollapsable::draw(pi, x, y);
        pi.base.font = tmpfont;
 }

Attachment: pgpGOw0P6Y8BT.pgp
Description: PGP signature

Reply via email to