mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 19:25:39 +00:00
allow mac os x to find its fonts
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8356 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
f7b38dbdc5
commit
842adc894d
@ -1,3 +1,11 @@
|
|||||||
|
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>
|
2004-01-08 Angus Leeming <leeming@lyx.org>
|
||||||
|
|
||||||
* FileDialog.C (open, save):
|
* FileDialog.C (open, save):
|
||||||
|
@ -33,7 +33,7 @@ QLMenubar::QLMenubar(LyXView * view, MenuBackend const & mbe)
|
|||||||
pair<int, QLPopupMenu *> menu =
|
pair<int, QLPopupMenu *> menu =
|
||||||
createMenu(owner_->menuBar(), &(*m), this, true);
|
createMenu(owner_->menuBar(), &(*m), this, true);
|
||||||
name_map_[m->submenuname()] = menu.second;
|
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
|
/* The qt/mac menu code has a very silly hack that
|
||||||
moves some menu entries that it recognizes by name
|
moves some menu entries that it recognizes by name
|
||||||
(ex: "Preferences...") to the "LyX" menu. This
|
(ex: "Preferences...") to the "LyX" menu. This
|
||||||
|
@ -43,6 +43,10 @@ using std::pair;
|
|||||||
using std::vector;
|
using std::vector;
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
|
#ifdef Q_WS_MACX
|
||||||
|
#include <ApplicationServices/ApplicationServices.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
void addFontPath()
|
void addFontPath()
|
||||||
@ -65,6 +69,33 @@ void addFontPath()
|
|||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
#endif
|
#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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -351,6 +382,13 @@ bool qfont_loader::available(LyXFont const & f)
|
|||||||
{
|
{
|
||||||
if (!lyx_gui::use_gui)
|
if (!lyx_gui::use_gui)
|
||||||
return false;
|
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_set(LyXFont::NUM_FAMILIES, false);
|
||||||
static vector<bool> cache(LyXFont::NUM_FAMILIES, false);
|
static vector<bool> cache(LyXFont::NUM_FAMILIES, false);
|
||||||
|
Loading…
Reference in New Issue
Block a user