fix bug 2146

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10645 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2005-12-06 14:54:23 +00:00
parent 94828848a5
commit d0cb16c256
4 changed files with 15 additions and 40 deletions

View File

@ -1,3 +1,14 @@
2005-12-02 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* 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). (bug 2146)
2005-12-01 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* rowpainter.C (paintFirst): fix centering of

View File

@ -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_;
@ -365,9 +367,6 @@ private:
/// 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);

View File

@ -1154,16 +1154,6 @@ void LyXText::insertChar(LCursor & cur, char c)
// 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, char c)
}
}
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();
}

View File

@ -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, pos_type pos, LyXFont const & fnt)
}
// 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, pit_type end, string const & layout)
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());
}