Do the last commit the right way. The previous one led to a crash because I wasn't

returning a fully realized font.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26163 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2008-08-14 15:44:36 +00:00
parent 004b672399
commit 42c5781bce

View File

@ -74,6 +74,7 @@ bool Text::isMainText(Buffer const & buffer) const
} }
// Note that this is supposed to return a fully realized font.
FontInfo Text::layoutFont(Buffer const & buffer, pit_type const pit) const FontInfo Text::layoutFont(Buffer const & buffer, pit_type const pit) const
{ {
Layout const & layout = pars_[pit].layout(); Layout const & layout = pars_[pit].layout();
@ -84,9 +85,11 @@ FontInfo Text::layoutFont(Buffer const & buffer, pit_type const pit) const
if (layout.font.family() == INHERIT_FAMILY) if (layout.font.family() == INHERIT_FAMILY)
lf.setFamily(buffer.params().getFont().fontInfo().family()); lf.setFamily(buffer.params().getFont().fontInfo().family());
InsetCollapsable const * icp = pars_[pit].inInset()->asInsetCollapsable(); InsetCollapsable const * icp = pars_[pit].inInset()->asInsetCollapsable();
if (icp) if (!icp)
lf.update(icp->getLayout().font(), false); return lf;
return lf; FontInfo icf = icp->getLayout().font();
icf.realize(lf);
return icf;
} }
FontInfo font = layout.font; FontInfo font = layout.font;
@ -98,6 +101,7 @@ FontInfo Text::layoutFont(Buffer const & buffer, pit_type const pit) const
} }
// Note that this is supposed to return a fully realized font.
FontInfo Text::labelFont(Buffer const & buffer, Paragraph const & par) const FontInfo Text::labelFont(Buffer const & buffer, Paragraph const & par) const
{ {
Layout const & layout = par.layout(); Layout const & layout = par.layout();
@ -108,9 +112,11 @@ FontInfo Text::labelFont(Buffer const & buffer, Paragraph const & par) const
if (layout.labelfont.family() == INHERIT_FAMILY) if (layout.labelfont.family() == INHERIT_FAMILY)
lf.setFamily(buffer.params().getFont().fontInfo().family()); lf.setFamily(buffer.params().getFont().fontInfo().family());
InsetCollapsable const * icp = par.inInset()->asInsetCollapsable(); InsetCollapsable const * icp = par.inInset()->asInsetCollapsable();
if (icp) if (!icp)
lf.update(icp->getLayout().labelfont(), false); return lf;
return lf; FontInfo icf = icp->getLayout().labelfont();
icf.realize(lf);
return icf;
} }
FontInfo font = layout.labelfont; FontInfo font = layout.labelfont;