On Tue, Jan 24, 2006 at 11:33:45PM +0100, Helge Hafting wrote:
> This extra patch helped a lot:
> 
> Create document, select nondefault language, type some: OK!
> Insert a table too and fill it OK!
> 
> Change language in normal text - it gets underlined as it should.
> 
> Change language for the paragraph containing a table:
> first row gets underlined, which look odd. 
> Probably nothing to do with your patch though. Individual
> table cells do not change - they remain in the document language.
> Do users have to change language for each cell individually?

I think this is by design. From the viewpoint of the outer text, the
inset is just a "character". if this character has a foreign language
attribute (!= document language), it will get bluelined.
 
> Changing language for a single cell can be done, and the change will be 
> written to the .lyx file.  BUT the display does not indicate the
> language change - no blue underline, and nothing about language on the
> status bar when the cursor visits such text.

Yes... seems that I cut the wrong corner with applyOuterFont ;-)

Please replace the patch part for text2.C by the attached. Works for me.


> Another issue that probably is unrelated to your patch:
> Attempting to spellcheck some text in a different language
> (select only that text) still tries to load the _document_ language
> into aspell.  This fail when there is no dictionary for that language,
> even though the language for the selected text exist.
> This prevents spellchecking.
 
I suppose it is unrelated, as my patch only touches rendering stuff. The
underlying document (on disk/in memory) remains untouched.
 
> A remaining nit:
> Insert an ERT box, minipage or a table into a document that has a 
> nondefault doc language.
> Observe how the curor is L-shaped (i.e. underlined) as if
> the language is different (from document language) even though it isn't.
> There will be no stupid underlining when actually typing text, but the
> cursor indicate otherwise. Perhaps the same fix should be applied to cursor
> handling as well?
 
Yes, I see that too. From the code, the cursor is L-shaped when the
real_current_font language differs from the buffer/document language. I
suppose I should go through all the places where this var is being
assigned to... but I think this is a separate problem (perhaps
"blanketed" by the bigger blueline problem uptill now).
 
> Your patchset seems to address most of  the "language silliness" problems
> now.  This is much better than what we had.  There is still the L-cursor,
> and the missing underlining in table cells though.

OK, Helge, thanks a lot for your thorough testing!

Lars, Jean-Marc, assuming Helge confirms the above applyOuterFont
sub-fix, shall I prepare a more official looking patch for this? It
fixes a visually bad regression, and replaces a kludge that didn't work
properly and wasn't based on any deep understanding of what happens in
the code, by a solution that does and is. 

I personally feel this should go into 1.4.0, but I won't lose sleep if
it goes to 1.4.1. (but my local tree is so horribly full!  inside-inset
row rendering cache, cursor movement into/out of/inside math insets,
font changes inside charstyle insets, bookmarks-as-floats, "dissolving"
insets from the inside, ...)

- Martin

Index: text2.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text2.C,v
retrieving revision 1.638
diff -u -p -r1.638 text2.C
--- text2.C     23 Jan 2006 10:25:41 -0000      1.638
+++ text2.C     25 Jan 2006 09:25:43 -0000
@@ -222,7 +222,10 @@ void LyXText::applyOuterFont(LyXFont & f
        LyXFont lf(font_);
        lf.reduce(defaultfont_);
        lf.realize(font);
-       lf.setLanguage(font.language());
+       if (font.language() == default_language)
+               lf.setLanguage(bv()->buffer()->params().language);
+       else
+               lf.setLanguage(font.language());
        font = lf;
 }
 

Attachment: pgpjJLOYfvWyo.pgp
Description: PGP signature

Reply via email to