[Bugs 3461 and 3630] Allow real_current_font to be reset in Text::setFont even when we have a selection.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18382 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2007-05-17 12:17:38 +00:00
parent 98554422d1
commit 3430c35ee3

View File

@ -437,29 +437,29 @@ void Text::changeDepth(Cursor & cur, DEPTH_CHANGE type)
void Text::setFont(Cursor & cur, Font const & font, bool toggleall)
{
BOOST_ASSERT(this == cur.text());
// if there is no selection just set the current_font
if (!cur.selection()) {
// Determine basis font
Font layoutfont;
pit_type pit = cur.pit();
if (cur.pos() < pars_[pit].beginOfBody())
layoutfont = getLabelFont(cur.buffer(), pars_[pit]);
else
layoutfont = getLayoutFont(cur.buffer(), pit);
// Set the current_font
// Determine basis font
Font layoutfont;
pit_type pit = cur.pit();
if (cur.pos() < pars_[pit].beginOfBody())
layoutfont = getLabelFont(cur.buffer(), pars_[pit]);
else
layoutfont = getLayoutFont(cur.buffer(), pit);
// Update current font
real_current_font.update(font,
cur.buffer().params().language,
toggleall);
// Update current font
real_current_font.update(font,
cur.buffer().params().language,
toggleall);
// Reduce to implicit settings
current_font = real_current_font;
current_font.reduce(layoutfont);
// And resolve it completely
real_current_font.realize(layoutfont);
// Reduce to implicit settings
current_font = real_current_font;
current_font.reduce(layoutfont);
// And resolve it completely
real_current_font.realize(layoutfont);
// if there is no selection that's all we need to do
if (!cur.selection())
return;
}
// Ok, we have a selection.
recordUndoSelection(cur);