]> git.lyx.org Git - features.git/commitdiff
fix math fonts with LyX/Mac
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 13 Oct 2004 16:14:57 +0000 (16:14 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 13 Oct 2004 16:14:57 +0000 (16:14 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9086 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt2/ChangeLog
src/frontends/qt2/lyx_gui.C
src/frontends/qt2/qfont_loader.C
src/frontends/qt2/qfont_loader.h

index 0994d6124889f33b542c09b81b7e6d780500d51f..d5df44ca23e4c567e7fd50a2f6b786e964cbc2b1 100644 (file)
@@ -1,3 +1,11 @@
+2004-10-11  Andreas Vox  <vox@isp.uni-luebeck.de>
+
+       * 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  <lasgouttes@lyx.org>
 
        * QLPopupMenu.C (populate): move the code below to here, so that
index e5d5b9d0092844daf9d40f0848bad9b1629b16f7..59c1e7c3d4f71cf9becee1b3aebaf01ecf48fbfa 100644 (file)
@@ -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
index 6f1cb146a4991f91f0113bed3a6435214ea13e6a..53fad3878eeb4aee77ee5a295a099d54ed4db077 100644 (file)
@@ -50,9 +50,9 @@ using std::string;
 #include <ApplicationServices/ApplicationServices.h>
 #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<bool> cache_set(LyXFont::NUM_FAMILIES, false);
        static vector<bool> 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;
index 87a0c030d24eca0c61eb177baace134d4f76fffc..73a0f4e4279085289fa6aa2f34f022a98b230ffe 100644 (file)
@@ -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 {