fix math fonts with LyX/Mac

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9086 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2004-10-13 16:14:57 +00:00
parent f9c7781121
commit eb130e4103
4 changed files with 25 additions and 10 deletions

View 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

View 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

View 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;

View 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 {