>>>>> "Martin" == Martin Vermeer <[EMAIL PROTECTED]> writes:
Martin> Do you know a way to similarly initialize current language? Martin> That would fix a bug properly that I sort-of fixed a long time Martin> ago in an ugly way. (And the fix doesn't work; just make your Martin> doc language different from the default, and delete all chars Martin> in your doc, and start writing again). What bug is it? I am not sure what we can do to language. The way it is now, doing anything is annoying :) Martin> The patch works fine BTW in what little testing I did. OK, so here is now the even boldest second version, that gets rid of makeFontEntriesLayoutSpecific. There is no reason I can think of to change the actual paragraph font when changing layout. This means that is I have Hello <bold>there</bold> and change layout to subsection and then back to standard, the bold is still there. However, it is not output in latex. Helge, could you test? JMarc
Index: src/ChangeLog =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v retrieving revision 1.2335 diff -u -p -r1.2335 ChangeLog --- src/ChangeLog 2 Dec 2005 13:20:25 -0000 1.2335 +++ src/ChangeLog 2 Dec 2005 15:28:02 -0000 @@ -1,3 +1,14 @@ +2005-12-02 Jean-Marc Lasgouttes <[EMAIL PROTECTED]> + + * text2.C (makeFontEntriesLayoutSpecific): remove. + (setLayout): adapt. + + * text.C (insertChar): remove bogus caching of fonts (did not do + anything). + + * text2.C (LyXText): initialize current_font to ALL_INHERIT (was + ALL_SANE). + 2005-12-01 Jean-Marc Lasgouttes <[EMAIL PROTECTED]> * rowpainter.C (paintFirst): fix centering of Index: src/lyxtext.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxtext.h,v retrieving revision 1.331 diff -u -p -r1.331 lyxtext.h --- src/lyxtext.h 1 Dec 2005 10:28:48 -0000 1.331 +++ src/lyxtext.h 2 Dec 2005 15:28:02 -0000 @@ -342,6 +342,8 @@ public: /// the current font LyXFont real_current_font; /// our buffer's default layout font. This is textclass specific + /* This is actually never initialized! Should be replaced by a + * defaultfont() method that looks at the textclass (easy). [JMarc]*/ LyXFont defaultfont_; /// int background_color_; @@ -364,9 +366,6 @@ private: /// return past-the-last paragraph influenced by a layout /// change on pit pit_type undoSpan(pit_type pit); - - /// used in setlayout - void makeFontEntriesLayoutSpecific(BufferParams const &, Paragraph & par); /// Calculate and set the height of the row void setHeightOfRow(pit_type, Row & row); Index: src/text.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text.C,v retrieving revision 1.636 diff -u -p -r1.636 text.C --- src/text.C 17 Nov 2005 09:19:02 -0000 1.636 +++ src/text.C 2 Dec 2005 15:28:02 -0000 @@ -1154,16 +1154,6 @@ void LyXText::insertChar(LCursor & cur, // difference are the special checks when calculating the row.fill // (blank does not count at the end of a row) and the check here - // The bug is triggered when we type in a description environment: - // The current_font is not changed when we go from label to main text - // and it should (along with realtmpfont) when we type the space. - // CHECK There is a bug here! (Asger) - - // store the current font. This is because of the use of cursor - // movements. The moving cursor would refresh the current font - LyXFont realtmpfont = real_current_font; - LyXFont rawtmpfont = current_font; - // When the free-spacing option is set for the current layout, // disable the double-space checking if (!freeSpacing && IsLineSeparatorChar(c)) { @@ -1190,10 +1180,7 @@ void LyXText::insertChar(LCursor & cur, } } - par.insertChar(cur.pos(), c, rawtmpfont); - - current_font = rawtmpfont; - real_current_font = realtmpfont; + par.insertChar(cur.pos(), c, current_font); setCursor(cur, cur.pit(), cur.pos() + 1, false, cur.boundary()); charInserted(); } Index: src/text2.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text2.C,v retrieving revision 1.635 diff -u -p -r1.635 text2.C --- src/text2.C 28 Nov 2005 11:52:02 -0000 1.635 +++ src/text2.C 2 Dec 2005 15:28:02 -0000 @@ -68,6 +68,7 @@ using std::min; LyXText::LyXText(BufferView * bv) : maxwidth_(bv ? bv->workWidth() : 100), + current_font(LyXFont::ALL_INHERIT), background_color_(LColor::background), bv_owner(bv), autoBreakRows_(false) @@ -277,28 +278,6 @@ void LyXText::setCharFont(pit_type pit, } -// used in setLayout -// Asger is not sure we want to do this... -void LyXText::makeFontEntriesLayoutSpecific(BufferParams const & params, - Paragraph & par) -{ - LyXLayout_ptr const & layout = par.layout(); - pos_type const psize = par.size(); - - LyXFont layoutfont; - for (pos_type pos = 0; pos < psize; ++pos) { - if (pos < par.beginOfBody()) - layoutfont = layout->labelfont; - else - layoutfont = layout->font; - - LyXFont tmpfont = par.getFontSettings(params, pos); - tmpfont.reduce(layoutfont); - par.setFont(pos, tmpfont); - } -} - - // return past-the-last paragraph influenced by a layout change on pit pit_type LyXText::undoSpan(pit_type pit) { @@ -327,7 +306,6 @@ void LyXText::setLayout(pit_type start, for (pit_type pit = start; pit != end; ++pit) { pars_[pit].applyLayout(lyxlayout); - makeFontEntriesLayoutSpecific(bufparams, pars_[pit]); if (lyxlayout->margintype == MARGIN_MANUAL) pars_[pit].setLabelWidthString(lyxlayout->labelstring()); }