From: Jean-Marc Lasgouttes Date: Wed, 13 Oct 2004 16:14:57 +0000 (+0000) Subject: fix math fonts with LyX/Mac X-Git-Tag: 1.6.10~14942 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=eb130e41033c2668ad9d4abc3ca9653742cd444b;p=features.git fix math fonts with LyX/Mac git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9086 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/frontends/qt2/ChangeLog b/src/frontends/qt2/ChangeLog index 0994d61248..d5df44ca23 100644 --- a/src/frontends/qt2/ChangeLog +++ b/src/frontends/qt2/ChangeLog @@ -1,3 +1,11 @@ +2004-10-11 Andreas Vox + + * qfont_loader.C (initFontPath, addToFontPath): two new static + member functions that replace addFontPath + (available): remove special MacOSX code; use addToFontPath + + * lyx_gui.C (parse_init): add call to qfont_loader::initFontPath() + 2004-10-01 Jean-Marc Lasgouttes * QLPopupMenu.C (populate): move the code below to here, so that diff --git a/src/frontends/qt2/lyx_gui.C b/src/frontends/qt2/lyx_gui.C index e5d5b9d009..59c1e7c3d4 100644 --- a/src/frontends/qt2/lyx_gui.C +++ b/src/frontends/qt2/lyx_gui.C @@ -154,6 +154,9 @@ bool use_gui = true; void parse_init(int & argc, char * argv[]) { + // Force adding of font path _before_ QApplication is initialized + qfont_loader::initFontPath(); + static LQApplication app(argc, argv); #if QT_VERSION >= 0x030200 diff --git a/src/frontends/qt2/qfont_loader.C b/src/frontends/qt2/qfont_loader.C index 6f1cb146a4..53fad3878e 100644 --- a/src/frontends/qt2/qfont_loader.C +++ b/src/frontends/qt2/qfont_loader.C @@ -50,9 +50,9 @@ using std::string; #include #endif -namespace { -void addFontPath() + +void qfont_loader::addToFontPath() { #ifdef Q_WS_X11 string const dir = OnlyPath(LibFileSearch("xfonts", "fonts.dir")); @@ -72,6 +72,10 @@ void addFontPath() << endl; } #endif +} + +void qfont_loader::initFontPath() +{ #ifdef Q_WS_MACX CFBundleRef myAppBundle = CFBundleGetMainBundle(); CFURLRef myAppResourcesURL, FontsURL; @@ -101,6 +105,7 @@ void addFontPath() #endif } +namespace { struct symbol_font { LyXFont::FONT_FAMILY lyx_family; @@ -385,13 +390,6 @@ bool qfont_loader::available(LyXFont const & f) { if (!lyx_gui::use_gui) return false; -#ifdef Q_WS_MACX - static bool need_bundle_fonts = true; - if (need_bundle_fonts) { - addFontPath(); - need_bundle_fonts = false; - } -#endif static vector cache_set(LyXFont::NUM_FAMILIES, false); static vector cache(LyXFont::NUM_FAMILIES, false); @@ -417,7 +415,7 @@ bool qfont_loader::available(LyXFont const & f) return false; first_time = false; - addFontPath(); + addToFontPath(); tmp = getSymbolFont(pat); if (tmp.second) { cache[family] = true; diff --git a/src/frontends/qt2/qfont_loader.h b/src/frontends/qt2/qfont_loader.h index 87a0c030d2..73a0f4e427 100644 --- a/src/frontends/qt2/qfont_loader.h +++ b/src/frontends/qt2/qfont_loader.h @@ -48,6 +48,12 @@ public: /// return pixel width for the given unicode char int charwidth(LyXFont const & f, Uchar val); + /// Called before QApplication is initialized + static void initFontPath(); + + /// Called the first time when available() can't load a symbol font + static void addToFontPath(); + private: /// hold info about a particular font struct font_info {