>>>>> "Lars" == Lars Gullik Bj�nnes <[EMAIL PROTECTED]> writes:
Lars> I cannot remember the case at all...
Basically, I applied the patch below to 1.3.x, but it is so ugly that
I ask for your approval before checking it in 1.4.0cvs.
JMarc
Index: src/frontends/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/ChangeLog,v
retrieving revision 1.148
diff -u -p -r1.148 ChangeLog
--- src/frontends/ChangeLog 14 Jan 2003 21:51:33 -0000 1.148
+++ src/frontends/ChangeLog 22 Oct 2003 15:36:59 -0000
@@ -1,3 +1,7 @@
+2003-10-22 Jean-Marc Lasgouttes <[EMAIL PROTECTED]>
+
+ * lyx_gui.h: add need_ugly_metrics_hack
+
2003-01-11 Juergen Spitzmueller <[EMAIL PROTECTED]>
* FileDialog.h: implement opendir (browse directory) [bug 824]
Index: src/frontends/lyx_gui.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/lyx_gui.h,v
retrieving revision 1.15
diff -u -p -r1.15 lyx_gui.h
--- src/frontends/lyx_gui.h 18 Dec 2002 14:24:31 -0000 1.15
+++ src/frontends/lyx_gui.h 22 Oct 2003 15:36:59 -0000
@@ -84,6 +84,13 @@ void set_read_callback(int fd, LyXComm *
*/
void remove_read_callback(int fd);
+/**
+ * tells whether a special metrics hack is needed by mathed. Currently
+ * only Qt/Mac requires it. The name has been chosen to be horrible
+ * enough to get someone to fix the fonts :)
+ */
+bool needs_ugly_metrics_hack();
+
} // namespace lyx_gui
#endif // LYX_GUI_H
Index: src/frontends/qt2/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/ChangeLog,v
retrieving revision 1.389.2.37
diff -u -p -r1.389.2.37 ChangeLog
--- src/frontends/qt2/ChangeLog 3 Oct 2003 13:34:39 -0000 1.389.2.37
+++ src/frontends/qt2/ChangeLog 22 Oct 2003 15:37:01 -0000
@@ -1,3 +1,8 @@
+2003-10-22 Jean-Marc Lasgouttes <[EMAIL PROTECTED]>
+
+ * lyx_gui.C (needs_ugly_metrics_hack): new function. Returns true
+ only for Qt/Mac.
+
2003-10-02 Jean-Marc Lasgouttes <[EMAIL PROTECTED]>
* qfont_loader.C: add an #include
Index: src/frontends/qt2/lyx_gui.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/lyx_gui.C,v
retrieving revision 1.30.2.1
diff -u -p -r1.30.2.1 lyx_gui.C
--- src/frontends/qt2/lyx_gui.C 7 Feb 2003 16:49:20 -0000 1.30.2.1
+++ src/frontends/qt2/lyx_gui.C 22 Oct 2003 15:37:01 -0000
@@ -243,3 +243,17 @@ void lyx_gui::remove_read_callback(int f
io_callbacks.erase(it);
}
}
+
+
+bool lyx_gui::needs_ugly_metrics_hack()
+{
+// There is some bug (in our fonts) which make the metrics of things
+// like \sum wrong under Qt/Mac. The only solution we have for now is
+// to add this ugly function, so that MathSymbolInset::metrics can do
+// the right thing
+#ifdef Q_WS_MAC
+ return true;
+#else
+ return false;
+#endif
+}
Index: src/frontends/xforms/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/ChangeLog,v
retrieving revision 1.661.2.10
diff -u -p -r1.661.2.10 ChangeLog
--- src/frontends/xforms/ChangeLog 21 Jul 2003 13:06:37 -0000 1.661.2.10
+++ src/frontends/xforms/ChangeLog 22 Oct 2003 15:37:01 -0000
@@ -1,3 +1,7 @@
+2003-10-22 Jean-Marc Lasgouttes <[EMAIL PROTECTED]>
+
+ * lyx_gui.C (needs_ugly_metrics_hack): new method, returns false
+
2003-07-11 Jean-Marc Lasgouttes <[EMAIL PROTECTED]>
* xfont_loader.C (addFontPath): condition message to Debug::FONT
Index: src/frontends/xforms/lyx_gui.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/lyx_gui.C,v
retrieving revision 1.31
diff -u -p -r1.31 lyx_gui.C
--- src/frontends/xforms/lyx_gui.C 18 Dec 2002 14:24:32 -0000 1.31
+++ src/frontends/xforms/lyx_gui.C 22 Oct 2003 15:37:01 -0000
@@ -388,3 +388,9 @@ void lyx_gui::remove_read_callback(int f
{
fl_remove_io_callback(fd, FL_READ, C_read_callback);
}
+
+
+bool lyx_gui::needs_ugly_metrics_hack()
+{
+ return false;
+}
Index: src/mathed/math_symbolinset.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_symbolinset.C,v
retrieving revision 1.52.2.1
diff -u -p -r1.52.2.1 math_symbolinset.C
--- src/mathed/math_symbolinset.C 22 Sep 2003 14:40:40 -0000 1.52.2.1
+++ src/mathed/math_symbolinset.C 22 Oct 2003 15:37:01 -0000
@@ -12,6 +12,9 @@
#include "LaTeXFeatures.h"
#include "debug.h"
+// needed for the metrics hack
+#include "frontends/lyx_gui.h"
+
MathSymbolInset::MathSymbolInset(const latexkeys * l)
: sym_(l), h_(0)
{}
@@ -51,24 +54,25 @@ void MathSymbolInset::metrics(MathMetric
MathFontSetChanger dummy(mi.base, sym_->inset.c_str());
mathed_string_dim(mi.base.font, sym_->draw, dim_);
// correct height for broken cmex and wasy font
-#if defined(__APPLE__) && defined(__GNUC__)
- if (sym_->inset == "cmex") {
- h_ = 4 * dim_.d / 5;
- dim_.a += 0*h_;
- dim_.d -= h_;
- h_ = dim_.a;
- } else if (sym_->inset == "wasy") {
- h_ = 4 * dim_.d / 5;
- dim_.a += h_;
- dim_.d -= h_;
+ if (lyx_gui::needs_ugly_metrics_hack()) {
+ if (sym_->inset == "cmex") {
+ h_ = 4 * dim_.d / 5;
+ dim_.a += 0*h_;
+ dim_.d -= h_;
+ h_ = dim_.a;
+ } else if (sym_->inset == "wasy") {
+ h_ = 4 * dim_.d / 5;
+ dim_.a += h_;
+ dim_.d -= h_;
+ }
+ } else {
+ if (sym_->inset == "cmex" || sym_->inset == "wasy") {
+ h_ = 4 * dim_.d / 5;
+ dim_.a += h_;
+ dim_.d -= h_;
+ }
}
-#else
- if (sym_->inset == "cmex" || sym_->inset == "wasy") {
- h_ = 4 * dim_.d / 5;
- dim_.a += h_;
- dim_.d -= h_;
- }
-#endif
+
// seperate things a bit
if (isRelOp())
dim_.w += static_cast<int>(0.5*em+0.5);