>>>>> "Ruurd" == Ruurd Reitsma <[EMAIL PROTECTED]> writes:

Ruurd> "Jean-Marc Lasgouttes" <[EMAIL PROTECTED]> wrote in
Ruurd> message news:[EMAIL PROTECTED]
>> >>>>> "Ruurd" == Ruurd Reitsma
Ruurd> <[EMAIL PROTECTED]> writes:
>> Hmm, these values seem very weird to me... I cannot understand how
>> qt 3.2.1 could have been sooo broken.
>> 

Ruurd> Some reverse engineering reveils that the height is substracted
Ruurd> from the y value.

OK, I am going to apply the following pair of patches.

JMarc

Index: src/frontends/qt2/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/ChangeLog,v
retrieving revision 1.389.2.58
diff -u -p -r1.389.2.58 ChangeLog
--- src/frontends/qt2/ChangeLog	5 Jan 2005 15:53:19 -0000	1.389.2.58
+++ src/frontends/qt2/ChangeLog	7 Jan 2005 15:01:44 -0000
@@ -1,3 +1,8 @@
+2005-01-07  Ruurd Reitsma  <[EMAIL PROTECTED]>
+
+	* qfont_metrics.C (ascent, descent): correct the metrics returned
+	by Qt/Win 3.2.1 non-commercial edition.
+
 2005-01-05  Angus Leeming  <[EMAIL PROTECTED]>
 
 	* QGraphics.C: remove unnecessary "#include support/FileInfo.h".
Index: src/frontends/qt2/qfont_metrics.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/qfont_metrics.C,v
retrieving revision 1.18.2.2
diff -u -p -r1.18.2.2 qfont_metrics.C
--- src/frontends/qt2/qfont_metrics.C	7 Dec 2004 10:49:15 -0000	1.18.2.2
+++ src/frontends/qt2/qfont_metrics.C	7 Jan 2005 15:01:44 -0000
@@ -64,7 +64,14 @@ int ascent(char c, LyXFont const & f)
 	if (!lyxrc.use_gui)
 		return 1;
 	QRect const & r = metrics(f).boundingRect(c);
+	// Qt/Win 3.2.1nc (at least) corrects the GetGlyphOutlineA|W y
+	// value by the height: (x, -y-height, width, height). 
+	// Other versions return: (x, -y, width, height)
+#if defined(Q_WS_WIN) && (QT_VERSION == 0x030201)
+	return -(r.top() + r.height());
+#else
 	return -r.top();
+#endif
 }
 
 
@@ -73,7 +80,14 @@ int descent(char c, LyXFont const & f)
 	if (!lyxrc.use_gui)
 		return 1;
 	QRect const & r = metrics(f).boundingRect(c);
-	return r.bottom()+1;
+	// Qt/Win 3.2.1nc (at least) corrects the GetGlyphOutlineA|W y
+	// value by the height: (x, -y-height, width, height). 
+	// Other versions return: (x, -y, width, height)
+#if defined(Q_WS_WIN) && (QT_VERSION == 0x030201)
+	return r.bottom() + r.height() + 1;
+#else
+	return r.bottom() + 1;
+#endif
 }
 
 
Index: src/frontends/qt2/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/ChangeLog,v
retrieving revision 1.747
diff -u -p -r1.747 ChangeLog
--- src/frontends/qt2/ChangeLog	6 Jan 2005 15:40:45 -0000	1.747
+++ src/frontends/qt2/ChangeLog	7 Jan 2005 15:03:52 -0000
@@ -1,3 +1,8 @@
+2005-01-07  Ruurd Reitsma  <[EMAIL PROTECTED]>
+
+	* qfont_metrics.C (ascent, descent): correct the metrics returned
+	by Qt/Win 3.2.1 non-commercial edition.
+
 2005-01-06  Lars Gullik Bjonnes  <[EMAIL PROTECTED]>
 
 	* QDocument.C:
Index: src/frontends/qt2/qfont_metrics.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/qfont_metrics.C,v
retrieving revision 1.27
diff -u -p -r1.27 qfont_metrics.C
--- src/frontends/qt2/qfont_metrics.C	20 May 2004 09:36:28 -0000	1.27
+++ src/frontends/qt2/qfont_metrics.C	7 Jan 2005 15:03:52 -0000
@@ -65,7 +65,14 @@ int ascent(char c, LyXFont const & f)
 	if (!lyx_gui::use_gui)
 		return 1;
 	QRect const & r = metrics(f).boundingRect(c);
+	// Qt/Win 3.2.1nc (at least) corrects the GetGlyphOutlineA|W y
+	// value by the height: (x, -y-height, width, height). 
+	// Other versions return: (x, -y, width, height)
+#if defined(Q_WS_WIN) && (QT_VERSION == 0x030201)
+	return -(r.top() + r.height());
+#else
 	return -r.top();
+#endif
 }
 
 
@@ -74,7 +81,14 @@ int descent(char c, LyXFont const & f)
 	if (!lyx_gui::use_gui)
 		return 1;
 	QRect const & r = metrics(f).boundingRect(c);
-	return r.bottom()+1;
+	// Qt/Win 3.2.1nc (at least) corrects the GetGlyphOutlineA|W y
+	// value by the height: (x, -y-height, width, height). 
+	// Other versions return: (x, -y, width, height)
+#if defined(Q_WS_WIN) && (QT_VERSION == 0x030201)
+	return r.bottom() + r.height() + 1;
+#else
+	return r.bottom() + 1;
+#endif
 }
 
 

Reply via email to