+2004-01-15 Ronald Florence <ron@18james.com>
+
+ * Menubar_pimpl.C: change Q_WS_MAC conditional define to
+ Q_WS_MACX.
+
+ * qfont_loader.C: add support for LyX/Mac to find Fonts directory
+ inside the application bundle.
+
2004-01-08 Angus Leeming <leeming@lyx.org>
* FileDialog.C (open, save):
pair<int, QLPopupMenu *> menu =
createMenu(owner_->menuBar(), &(*m), this, true);
name_map_[m->submenuname()] = menu.second;
-#ifdef Q_WS_MAC
+#ifdef Q_WS_MACX
/* The qt/mac menu code has a very silly hack that
moves some menu entries that it recognizes by name
(ex: "Preferences...") to the "LyX" menu. This
using std::vector;
using std::string;
+#ifdef Q_WS_MACX
+#include <ApplicationServices/ApplicationServices.h>
+#endif
+
namespace {
void addFontPath()
<< endl;
}
#endif
+#ifdef Q_WS_MACX
+ CFBundleRef myAppBundle = CFBundleGetMainBundle();
+ CFURLRef myAppResourcesURL, FontsURL;
+ FSRef fontDirRef;
+ FSSpec fontDirSpec;
+ CFStringRef filePath = CFStringCreateWithBytes(kCFAllocatorDefault,
+ (UInt8 *) "Fonts", strlen("Fonts"),
+ kCFStringEncodingISOLatin1, false);
+
+ myAppResourcesURL = CFBundleCopyResourcesDirectoryURL(myAppBundle);
+ FontsURL = CFURLCreateCopyAppendingPathComponent(kCFAllocatorDefault,
+ myAppResourcesURL, filePath, true);
+ if (lyxerr.debugging(Debug::FONT)) {
+ UInt8 buf[255];
+ if (CFURLGetFileSystemRepresentation(FontsURL, true, buf, 255))
+ lyxerr << "Adding Fonts directory: " << buf << endl;
+ }
+ CFURLGetFSRef (FontsURL, &fontDirRef);
+ OSStatus err = FSGetCatalogInfo (&fontDirRef, kFSCatInfoNone,
+ NULL, NULL, &fontDirSpec, NULL);
+ if (err)
+ lyxerr << "FSGetCatalogInfo err = " << err << endl;
+ err = FMActivateFonts (&fontDirSpec, NULL, NULL,
+ kFMLocalActivationContext);
+ if (err)
+ lyxerr << "FMActivateFonts err = " << err << endl;
+#endif
}
{
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);