The striking-out line for erased text is misplaced in the first row of the 
main text, since this also includes the top margin, which is not honoured by 
the strikeout calculation. The attached patch fixes it.

The offset is still there for headings, if they are not in the first row. The 
labeladdon value is not recognized, it is not accessable from rowpainter. I 
won't fix this now. This whole ct mark drawing stuff is a hack. As John wrote 
in the FIXME's, we should rather try to calculate the actual font dimensions 
than dealing with the row height. For 1.4, I think we have to live with the 
hack.

OK?

Jürgen 
Index: rowpainter.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/rowpainter.C,v
retrieving revision 1.142
diff -u -r1.142 rowpainter.C
--- rowpainter.C	15 Feb 2005 19:34:44 -0000	1.142
+++ rowpainter.C	20 Mar 2005 16:22:09 -0000
@@ -667,7 +667,11 @@
 			// FIXME this should take real text height into account, not
 			// the whole row including padding whitespace
 			//int const middle = yo_ + (- row_.ascent() + row_.top_of_text()) / 2;
-			int const middle = yo_ - row_.ascent() / 2;
+			int middle = yo_ - row_.ascent() / 2;
+			// The first row of the main text includes the top margin
+			// we have to correct this offset here
+			if (text_.isMainText() && text_.isFirstRow(pit_, row_))
+				middle += 13;
 			pain_.line(last_strikeout_x, middle, int(x_), middle,
 				LColor::strikeout, Painter::line_solid, Painter::line_thin);
 			running_strikeout = false;
@@ -720,7 +724,11 @@
 	if (running_strikeout) {
 		//top_of_text = font_metrics::maxAscent(font);
 		//int const middle = yo_ - top_of_text() / 2;
-		int const middle = yo_ - row_.ascent() / 2;
+		int middle = yo_ - row_.ascent() / 2;
+		// The first row of the main text includes the top margin
+		// we have to correct this offset here
+		if (text_.isMainText() && text_.isFirstRow(pit_, row_))
+			middle += 13;
 		pain_.line(last_strikeout_x, middle, int(x_), middle,
 			LColor::strikeout, Painter::line_solid, Painter::line_thin);
 		running_strikeout = false;

Reply via email to