>>>>> "Andreas" == Andreas Vox <[EMAIL PROTECTED]> writes:

Andreas> Hi! I've a patch which fixes the math font problem. As it
Andreas> turns out this problem is not Mac specific but Qt specific:
Andreas> the QFontDatabase is initialized when QApplication is
Andreas> initialized. If LyX wants to extend the font path it must
Andreas> happen _before_ LQApplication gets initialized.

Very good work! Do you have documentation somewhere on the fact that
fonts should always be initialized before QApplication?

Only circumstantial docs; you will love this:
The docs to QFontDatabase have an example program which starts

#include <qapplication.h>
#include <qfontdatabase.h>
#include <else.h>

int main( int argc, char **argv )
{
    QApplication app( argc, argv );
    QFontDatabase fdb;
    QStringList families = fdb.families();
    . . .

and then never uses app again. When I added this code, which lists all available font families,
at the end of addFontPath(), the symbol fonts didn't show up.


Andreas> Theoretically the problem should also occur with Qt/X11 if
Andreas> fonts can only be accessed by the LyX -provided additional
Andreas> font directories. But maybe Qt-Unix updates its font database
Andreas> when the X fontpath changes ... not that I believe it. I
Andreas> guess the math fonts are usually installed globally when TeX
Andreas> is installed, or at least included in the fontpath when X
Andreas> starts.

The situation on X11 is a bit different, especially since with Qt
versions using fontconfig/xft (modern linux distribs), the fonts
placed in the xfonts directory do not work properly anyway.

Mph, so why do we add that directory to the font path anyway?

Therefore,
addFontPath should probably not be called before creating the
LQApplication object.

Andreas> This patch needs testing on all Qt platforms with Q_WS_X11 or
Andreas> Q_WS_MACOSX (am I right to assume that the current Windows
Andreas> port for Cygnus also has Q_WS_X11 ?).

Could you make a version of the patch that only affects Q_WS_MACOSX?


Sure.

Unless you have some reasons to believe otherwise, I do not think that
the behaviour of Q_WS_X11 should be changed.


What about having three functions:

// called before QApplication is initialized, friend to lyx_gui
void addFontPathEarly()
// called when available() is first called, private
void addFontPathJustInTime()
// Could be used in the future if the fontpath should change during runtime, public
void addFontPathLate()


If noone shouts I will provide a patch which implements the first to funtions, deferring the third until we need it.

ok?

/Andreas

--
PowerBook and LyX, a perfect match! ;-)



Reply via email to