Port gfx to 64-bit Mac OS X, part 1.
b=489354 r=jfkthame sr=roc
--- a/gfx/thebes/src/gfxCoreTextFonts.cpp
+++ b/gfx/thebes/src/gfxCoreTextFonts.cpp
@@ -115,17 +115,19 @@ gfxCoreTextFont::gfxCoreTextFont(MacOSFo
CFDictionaryCreate(kCFAllocatorDefault,
(const void**) &kCTFontAttributeName,
(const void**) &mCTFont,
1, // count of attributes
&kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
// Remaining initialization is largely based on CommonInit() in the gfxAtsuiFont code
- mFontFace = cairo_quartz_font_face_create_for_atsu_font_id(FMGetFontFromATSFontRef(mATSFont));
+ CGFontRef cgFont = ::CGFontCreateWithPlatformFont(&mATSFont);
+ mFontFace = cairo_quartz_font_face_create_for_cgfont(cgFont);
+ ::CGFontRelease(cgFont);
cairo_matrix_t sizeMatrix, ctm;
cairo_matrix_init_identity(&ctm);
cairo_matrix_init_scale(&sizeMatrix, mAdjustedSize, mAdjustedSize);
// synthetic oblique by skewing via the font matrix
PRBool needsOblique =
(mFontEntry != NULL) &&
--- a/gfx/thebes/src/gfxPlatformMac.cpp
+++ b/gfx/thebes/src/gfxPlatformMac.cpp
@@ -88,17 +88,19 @@ gfxPlatformMac::gfxPlatformMac()
#endif /* MOZ_CORETEXT */
#endif /* not __LP64__ */
}
gfxPlatformMac::~gfxPlatformMac()
{
#ifdef MOZ_CORETEXT
+#ifndef __LP64__
if (mUseCoreText)
+#endif
gfxCoreTextFont::Shutdown();
#endif
}
already_AddRefed<gfxASurface>
gfxPlatformMac::CreateOffscreenSurface(const gfxIntSize& size,
gfxASurface::gfxImageFormat imageFormat)
{
@@ -224,17 +226,17 @@ gfxPlatformMac::UpdateFontList()
return NS_OK;
}
PRInt32
gfxPlatformMac::OSXVersion()
{
if (!mOSXVersion) {
// minor version is not accurate, use gestaltSystemVersionMajor, gestaltSystemVersionMinor, gestaltSystemVersionBugFix for these
- OSErr err = ::Gestalt(gestaltSystemVersion, (long int*) &mOSXVersion);
+ OSErr err = ::Gestalt(gestaltSystemVersion, (SInt32*) &mOSXVersion);
if (err != noErr) {
//This should probably be changed when our minimum version changes
NS_ERROR("Couldn't determine OS X version, assuming 10.4");
mOSXVersion = MAC_OS_X_VERSION_10_4_HEX;
}
}
return mOSXVersion;
}
@@ -308,28 +310,28 @@ gfxPlatformMac::AppendCJKPrefLangs(eFont
AppendPrefLang(tempPrefLangs, tempLen, fpl);
break;
default:
break;
}
p++;
}
}
-
+
// Prefer the system locale if it is CJK.
- ScriptCode sysScript = ::GetScriptManagerVariable(smSysScript);
+ TextEncoding sysScript = ::GetApplicationTextEncoding();
// XXX Is not there the HK locale?
switch (sysScript) {
- case smJapanese: AppendPrefLang(tempPrefLangs, tempLen, eFontPrefLang_Japanese); break;
- case smTradChinese: AppendPrefLang(tempPrefLangs, tempLen, eFontPrefLang_ChineseTW); break;
- case smKorean: AppendPrefLang(tempPrefLangs, tempLen, eFontPrefLang_Korean); break;
- case smSimpChinese: AppendPrefLang(tempPrefLangs, tempLen, eFontPrefLang_ChineseCN); break;
- default: break;
+ case kTextEncodingMacJapanese: AppendPrefLang(tempPrefLangs, tempLen, eFontPrefLang_Japanese); break;
+ case kTextEncodingMacChineseTrad: AppendPrefLang(tempPrefLangs, tempLen, eFontPrefLang_ChineseTW); break;
+ case kTextEncodingMacKorean: AppendPrefLang(tempPrefLangs, tempLen, eFontPrefLang_Korean); break;
+ case kTextEncodingMacChineseSimp: AppendPrefLang(tempPrefLangs, tempLen, eFontPrefLang_ChineseCN); break;
+ default: break;
}
-
+
// last resort... (the order is same as old gfx.)
AppendPrefLang(tempPrefLangs, tempLen, eFontPrefLang_Japanese);
AppendPrefLang(tempPrefLangs, tempLen, eFontPrefLang_Korean);
AppendPrefLang(tempPrefLangs, tempLen, eFontPrefLang_ChineseCN);
AppendPrefLang(tempPrefLangs, tempLen, eFontPrefLang_ChineseHK);
AppendPrefLang(tempPrefLangs, tempLen, eFontPrefLang_ChineseTW);
// copy into the cached array
@@ -390,31 +392,33 @@ gfxPlatformMac::GetPlatformCMSOutputProf
cmDefaultDeviceID,
cmDefaultProfileID,
&device);
if (err != noErr)
return nsnull;
qcms_profile *profile = nsnull;
switch (device.locType) {
+#ifndef __LP64__
case cmFileBasedProfile: {
FSRef fsRef;
if (!FSpMakeFSRef(&device.u.fileLoc.spec, &fsRef)) {
char path[512];
if (!FSRefMakePath(&fsRef, (UInt8*)(path), sizeof(path))) {
profile = qcms_profile_from_path(path);
#ifdef DEBUG_tor
if (profile)
fprintf(stderr,
"ICM profile read from %s fileLoc successfully\n", path);
#endif
}
}
break;
}
+#endif
case cmPathBasedProfile:
profile = qcms_profile_from_path(device.u.pathLoc.path);
#ifdef DEBUG_tor
if (profile)
fprintf(stderr,
"ICM profile read from %s pathLoc successfully\n",
device.u.pathLoc.path);
#endif
--- a/gfx/thebes/src/gfxQuartzFontCache.h
+++ b/gfx/thebes/src/gfxQuartzFontCache.h
@@ -39,16 +39,19 @@
#ifndef GFXQUARTZFONTCACHE_H_
#define GFXQUARTZFONTCACHE_H_
#include "nsDataHashtable.h"
#include "nsRefPtrHashtable.h"
#include "gfxFontUtils.h"
+#ifdef MOZ_CORETEXT
+#include "gfxCoreTextFonts.h"
+#endif
#include "gfxAtsuiFonts.h"
#include "gfxPlatform.h"
#include <Carbon/Carbon.h>
#include "nsUnicharUtils.h"
#include "nsTArray.h"