Jean-Marc Lasgouttes wrote:
"Dov" == Dov Feldstern <dfeldstern-rhxOsnTko2JWk0Htik3J/[EMAIL PROTECTED]> 
writes:

Dov> I think that I'll try to create a constructor which accepts a
Dov> font to be used as the initial font. Does this sound all right?

That may turn out to be complicated. Do you really need to set the
font in the constructor? If you do not see a simple solution, just put
your original patch in (with appropriate comments) and we will move
this stuff to Cursor later.


Yes, it turned out to be really complicated. After spending about an hour-and-a-half trying to do this I gave up :( . It means changing practically all the insets which inherit from InsetText, and sometimes the changes are not trivial. And since we don't think this is the right long-term solution, anyway, it's not worth the effort.

Therefore, attached is the original patch, with a comment explaining the situation. OK to commit?

Dov
Index: lyx-devel/src/Paragraph.cpp
===================================================================
--- lyx-devel.orig/src/Paragraph.cpp    2007-07-05 00:39:03.000000000 +0300
+++ lyx-devel/src/Paragraph.cpp 2007-07-05 01:54:53.000000000 +0300
@@ -1254,7 +1254,19 @@
                            Font const & font, Change const & change)
 {
        pimpl_->insertInset(pos, inset, change);
+       // Set the font/language of the inset...
        setFont(pos, font);
+       // ... as well as the font/language of the text inside the inset
+       // FIXME: This is far from perfect. It basically overrides work being 
done
+       // in the InsetText constructor. Also, it doesn't work for Tables 
+       // (precisely because each cell's font/language is set in the Table's 
+       // constructor, so by now it's too late). The long-term solution should
+       // be moving current_font into Cursor, and getting rid of all this...
+       // (see 
http://thread.gmane.org/gmane.editors.lyx.devel/88869/focus=88944)
+       if (inset->asTextInset()) {
+               inset->asTextInset()->text_.current_font = font;
+               inset->asTextInset()->text_.real_current_font = font;
+       }
 }
 
 

Reply via email to