I took a closer look at
http://bugzilla.lyx.org/show_bug.cgi?id=1934

It turns out that the problem is not at all that we use the wrong
font. What seems to happen is that two-stage drawing is going mad.

Consider the attached instrumentation patch, together with the
following textcase, which contains basically:

$\textrm{A}\frac{1}{2}B$SW

When I load it, I see
ehrenfest: ./lyx ~/bug1934.lyx
QLPainter::text: draw "A" at (41, 41) with font 0x8869a98 and painter 0x87a8d68
QLPainter::text: draw "A" at (41, 41) with font 0x8869a98 and painter 0x87a8d68
QLPainter::text: draw "1" at (56, 34) with font 0x88bcff8 and painter 0x87a8d68
QLPainter::text: draw "2" at (56, 48) with font 0x88bcff8 and painter 0x87a8d68
QLPainter::text: draw "1" at (56, 34) with font 0x88bcff8 and painter 0x87a8d68
QLPainter::text: draw "2" at (56, 48) with font 0x88bcff8 and painter 0x87a8d68
QLPainter::text: draw "B" at (64, 41) with font 0x88b12a8 and painter 0x87a8d68
QLPainter::text: draw "A" at (41, 41) with font 0x8869a98 and painter 0x87a8d68
QLPainter::text: draw "A" at (41, 41) with font 0x8869a98 and painter 0x87a8d68
QLPainter::text: draw "1" at (56, 34) with font 0x88bcff8 and painter 0x87a8d68
QLPainter::text: draw "2" at (56, 48) with font 0x88bcff8 and painter 0x87a8d68
QLPainter::text: draw "1" at (56, 34) with font 0x88bcff8 and painter 0x87a8d68
QLPainter::text: draw "2" at (56, 48) with font 0x88bcff8 and painter 0x87a8d68
QLPainter::text: draw "B" at (64, 41) with font 0x88b12a8 and painter 0x87a8d68
QLPainter::text: draw "SW" at (77, 41) with font 0x8869a98 and painter 0x87a8d68

So what happens is that A is drawn 4 times, the fraction 4 times too
and B twice. I suspect that the antialiasing code of Qt darkens the
gray parts at every draw. If you look closely, you will see that even
the B is not as nice as it should.

I am not sure what to do at this point, since I have no idea of how
2-stage drawing works. All I can say is that it turns into 4-stage
drawing in some cases :)

Andre', I need you input.

JMarc

Index: frontends/qt2/QLPainter.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/QLPainter.C,v
retrieving revision 1.37
diff -u -p -r1.37 QLPainter.C
--- frontends/qt2/QLPainter.C	16 Jul 2005 15:43:33 -0000	1.37
+++ frontends/qt2/QLPainter.C	26 Jan 2006 17:02:01 -0000
@@ -236,6 +236,10 @@ void QLPainter::text(int x, int y, char 
 		str = ' ' + str;
 
 	if (f.realShape() != LyXFont::SMALLCAPS_SHAPE) {
+		lyxerr << "QLPainter::text: draw \""  << str.latin1() 
+		       << "\" at ("  << x << ", " << y 
+		       << ") with font " << &fontloader.get(f) 
+		       << " and painter " << qp_.get() << endl;
 		qp_->setFont(fontloader.get(f));
 		// We need to draw the text as LTR as we use our own bidi
 		// code.
#LyX 1.4.0cvs created this file. For more info see http://www.lyx.org/
\lyxformat 245
\begin_document
\begin_header
\textclass article
\language english
\inputencoding auto
\fontscheme default
\graphics default
\paperfontsize default
\papersize default
\use_geometry false
\use_amsmath 1
\cite_engine basic
\use_bibtopic false
\paperorientation portrait
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\defskip medskip
\quotes_language english
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes true
\end_header

\begin_body

\begin_layout Standard
\begin_inset Formula $\textrm{A}\frac{1}{2}B$
\end_inset

SW
\end_layout

\end_body
\end_document

Reply via email to