From: Georg Baum Date: Sat, 17 Dec 2005 15:03:41 +0000 (+0000) Subject: partial fix for bug 1973 X-Git-Tag: 1.6.10~13746 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=035861d4dc9d7165876239f7091336232bcc9fdd;p=features.git partial fix for bug 1973 git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10664 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/ChangeLog b/src/ChangeLog index 3c341f2d05..519672102c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2005-12-08 Georg Baum + + * text.C (redoParagraph): honor inset->noFontChange() + * rowpainter.C (paintInset): ditto + 2005-12-15 Jürgen Spitzmüller * lyx_main.C (priv_exec): don't initialize Math on startup diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index a81d11ec52..d92960c25f 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,7 @@ +2005-12-12 Georg Baum + + * insetbase.h (noFontChange): refine documentation + 2005-12-16 Martin Vermeer * insetcollapsable.C: fix "turds" when changing openinlined_ diff --git a/src/insets/insetbase.h b/src/insets/insetbase.h index 6f0a860ba8..516558828e 100644 --- a/src/insets/insetbase.h +++ b/src/insets/insetbase.h @@ -383,7 +383,14 @@ public: virtual mode_type currentMode() const { return UNDECIDED_MODE; } /// returns whether this inset is allowed in other insets of given mode virtual bool allowedIn(mode_type) const { return true; } - /// is this inset allowed within a font change? + /** + * Is this inset allowed within a font change? + * + * FIXME: noFontChange means currently that the font change is closed + * in LaTeX before the inset, and that the contents of the inset + * will be in default font. This should be changed so that the inset + * changes the font again. + */ virtual bool noFontChange() const { return false; } /// mark the inset as erased or not diff --git a/src/rowpainter.C b/src/rowpainter.C index 8543e147de..75a8f1fb1f 100644 --- a/src/rowpainter.C +++ b/src/rowpainter.C @@ -154,7 +154,11 @@ void RowPainter::paintInset(pos_type const pos, LyXFont const & font) InsetBase const * inset = par_.getInset(pos); BOOST_ASSERT(inset); PainterInfo pi(const_cast(&bv_), pain_); - pi.base.font = font; + // FIXME: We should always use font, see documentation of + // noFontChange() in insetbase.h. + pi.base.font = inset->noFontChange() ? + bv_.buffer()->params().getLyXTextClass().defaultfont() : + font; pi.ltr_pos = (text_.bidi.level(pos) % 2 == 0); pi.erased_ = erased_ || isDeletedText(par_, pos); theCoords.insets().add(inset, int(x_), yo_); diff --git a/src/text.C b/src/text.C index dcdf3b92ea..f19a06144c 100644 --- a/src/text.C +++ b/src/text.C @@ -1684,12 +1684,19 @@ bool LyXText::redoParagraph(pit_type const pit) } // redo insets + // FIXME: We should always use getFont(), see documentation of + // noFontChange() in insetbase.h. + LyXFont const tclassfont = + bv()->buffer()->params().getLyXTextClass().defaultfont(); InsetList::iterator ii = par.insetlist.begin(); InsetList::iterator iend = par.insetlist.end(); for (; ii != iend; ++ii) { Dimension dim; int const w = maxwidth_ - leftMargin(pit, ii->pos) - rightMargin(par); - MetricsInfo mi(bv(), getFont(par, ii->pos), w); + LyXFont const & font = ii->inset->noFontChange() ? + tclassfont : + getFont(par, ii->pos); + MetricsInfo mi(bv(), font, w); ii->inset->metrics(mi, dim); }