]> git.lyx.org Git - lyx.git/blobdiff - src/Text2.cpp
* GuiDocument.cpp (less_textclass_avail_desc):
[lyx.git] / src / Text2.cpp
index 0386ae764f05a475413f323d7e34fb59d921c74f..ea534752671efe104b520f33b9db8469934b2565 100644 (file)
@@ -84,7 +84,13 @@ FontInfo Text::layoutFont(Buffer const & buffer, pit_type const pit) const
                // In case the default family has been customized
                if (layout.font.family() == INHERIT_FAMILY)
                        lf.setFamily(buffer.params().getFont().fontInfo().family());
-               InsetCollapsable const * icp = pars_[pit].inInset()->asInsetCollapsable();
+               // FIXME
+               // It ought to be possible here just to use Inset::getLayout() and skip
+               // the asInsetCollapsable() bit. Unfortunatley, that doesn't work right
+               // now, because Inset::getLayout() will return a default-constructed
+               // InsetLayout, and that e.g. sets the foreground color to red. So we
+               // need to do some work to make that possible.
+               InsetCollapsable const * icp = pars_[pit].inInset().asInsetCollapsable();
                if (!icp)
                        return lf;
                FontInfo icf = icp->getLayout().font();
@@ -111,12 +117,7 @@ FontInfo Text::labelFont(Buffer const & buffer, Paragraph const & par) const
                // In case the default family has been customized
                if (layout.labelfont.family() == INHERIT_FAMILY)
                        lf.setFamily(buffer.params().getFont().fontInfo().family());
-               InsetCollapsable const * icp = par.inInset()->asInsetCollapsable();
-               if (!icp)
-                       return lf;
-               FontInfo icf = icp->getLayout().labelfont();
-               icf.realize(lf);
-               return icf;
+               return lf;
        }
 
        FontInfo font = layout.labelfont;
@@ -190,7 +191,7 @@ void Text::setInsetFont(BufferView const & bv, pit_type pit,
 // return past-the-last paragraph influenced by a layout change on pit
 pit_type Text::undoSpan(pit_type pit)
 {
-       pit_type end = paragraphs().size();
+       pit_type const end = paragraphs().size();
        pit_type nextpit = pit + 1;
        if (nextpit == end)
                return nextpit;