Jean-Marc Lasgouttes wrote:

>>>>>> "Georg" == Georg Baum
>>>>>> <[EMAIL PROTECTED]>
>>>>>> writes:
> 
> Georg> I wanted to be on the safe side and change as little as
> Georg> possible. Of course I could also iterate over the cells of each
> Georg> inset containing text, but I am not sure if this is the right
> Georg> thing to do (e.g. for collapsable insets or ERT). Or I could
> Georg> move the code of InsetTabular::setFont into the loop in
> Georg> setCharFont (or setInsetFont if that is used). What do you
> Georg> think?
> 
> I would tend to think that all collapsable insets should see their
> content changed too. The case of ERT is a bit problematic, but we
> could maybe try to detect it.

I investigated a bit, and have now a solution. Since we have two problems
here, I'd like to fix them one after one.

The first problem which has not beed addressed yet is that insets that
return true in noFontChange() inherit the environment font on screen but
don't inherit it in the .tex output. This is fixed by the attached patch.
OK to apply?

The second problem is that font changes need to be propagated to these
insets. I'd like to address this problem later.


Georg


> 
> JMarc
Index: src/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v
retrieving revision 1.2337
diff -u -p -r1.2337 ChangeLog
--- src/ChangeLog	7 Dec 2005 14:09:30 -0000	1.2337
+++ src/ChangeLog	9 Dec 2005 09:56:18 -0000
@@ -1,3 +1,8 @@
+2005-12-08  Georg Baum  <[EMAIL PROTECTED]>
+
+	* text.C (redoParagraph): honor inset->noFontChange()
+	* rowpainter.C (paintInset): ditto
+
 2005-12-06  Georg Baum  <[EMAIL PROTECTED]>
 
 	* exporter.C (Export): Don't try to copy a file if it does not exist
Index: src/rowpainter.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/rowpainter.C,v
retrieving revision 1.159
diff -u -p -r1.159 rowpainter.C
--- src/rowpainter.C	2 Dec 2005 13:20:26 -0000	1.159
+++ src/rowpainter.C	9 Dec 2005 09:56:18 -0000
@@ -154,7 +154,9 @@ void RowPainter::paintInset(pos_type con
 	InsetBase const * inset = par_.getInset(pos);
 	BOOST_ASSERT(inset);
 	PainterInfo pi(const_cast<BufferView *>(&bv_), pain_);
-	pi.base.font = font;
+	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_);
Index: src/text.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text.C,v
retrieving revision 1.637
diff -u -p -r1.637 text.C
--- src/text.C	6 Dec 2005 14:54:21 -0000	1.637
+++ src/text.C	9 Dec 2005 09:56:18 -0000
@@ -1684,12 +1684,17 @@ bool LyXText::redoParagraph(pit_type con
 	}
 
 	// redo insets
+	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);
 	}
 

Reply via email to