Jean-Marc Lasgouttes wrote:
rgheck <[EMAIL PROTECTED]> writes:
I propose we get rid of Inset::getLayout() altogether. It's not
needed. As the attached shows.

The potential usefulness of getLayout for basic insets is to be able
to define the fonts used by all insets (ref, cite, math) from the
layout file.

Right, I see. At present we don't have InsetLayouts defined for insets other than InsetCollapsable, but we could.

If so, then getLayout(BufferParams const &) is fine, and does what it should. So it might be that we could go with the attached, which is what you suggested earlier. I'm not sure, however, because e.g.
pars_[pit].inInset()->getLayout(buffer.params()).font()
will be sane_font for InsetText, and I'm worried that that isn't right.

Unfortunately, I don't have time to investigate this now, as we're off on vacation tomorrow....

rh

Index: Text2.cpp
===================================================================
--- Text2.cpp	(revision 26166)
+++ Text2.cpp	(working copy)
@@ -84,10 +84,7 @@
 		// 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();
-		if (!icp)
-			return lf;
-		FontInfo icf = icp->getLayout().font();
+		FontInfo icf = pars_[pit].inInset()->getLayout(buffer.params()).font();
 		icf.realize(lf);
 		return icf;
 	}
@@ -111,10 +108,7 @@
 		// 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();
+		FontInfo icf = par.inInset()->getLayout(buffer.params()).font();
 		icf.realize(lf);
 		return icf;
 	}

Reply via email to