Backed out changeset e413694940b3

This commit is contained in:
Josh Aas 2009-03-27 14:32:49 -07:00
Родитель 142b887c3f
Коммит ead58807ca
28 изменённых файлов: 142 добавлений и 1944 удалений

Просмотреть файл

@ -86,8 +86,6 @@ MOZ_X11 = @MOZ_X11@
MOZ_PANGO = @MOZ_PANGO@ MOZ_PANGO = @MOZ_PANGO@
MOZ_CORETEXT = @MOZ_CORETEXT@
MOZ_JS_LIBS = @MOZ_JS_LIBS@ MOZ_JS_LIBS = @MOZ_JS_LIBS@
MOZ_DEBUG = @MOZ_DEBUG@ MOZ_DEBUG = @MOZ_DEBUG@

Просмотреть файл

@ -3147,27 +3147,6 @@ if test ! "$GNU_CXX"; then
fi fi
AC_CHECK_LIB(socket, socket) AC_CHECK_LIB(socket, socket)
dnl ========================================================
dnl Check whether we can compile code for Core Text
dnl (Mac OS X 10.5 or later)
dnl ========================================================
case "$target" in
*-darwin*)
AC_MSG_CHECKING([for Core Text])
AC_TRY_COMPILE([#include <ApplicationServices/ApplicationServices.h>],
[CTLineRef lineRef;],
ac_cv_have_core_text="yes",
ac_cv_have_core_text="no")
AC_MSG_RESULT([$ac_cv_have_core_text])
if test "$ac_cv_have_core_text" = "yes"; then
AC_DEFINE(MOZ_CORETEXT, 1)
MOZ_CORETEXT=1
fi
;;
esac
AC_SUBST(MOZ_CORETEXT)
XLDFLAGS="$X_LIBS" XLDFLAGS="$X_LIBS"
XLIBS="$X_EXTRA_LIBS" XLIBS="$X_EXTRA_LIBS"

Просмотреть файл

@ -104,8 +104,4 @@ EXPORTS += gfxPlatformMac.h \
endif endif
ifdef MOZ_CORETEXT
EXPORTS += gfxCoreTextFonts.h
endif
include $(topsrcdir)/config/rules.mk include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -40,8 +40,6 @@
#ifndef GFX_ATSUIFONTS_H #ifndef GFX_ATSUIFONTS_H
#define GFX_ATSUIFONTS_H #define GFX_ATSUIFONTS_H
#ifndef __LP64__ /* ATSUI not available on 64-bit */
#include "cairo.h" #include "cairo.h"
#include "gfxTypes.h" #include "gfxTypes.h"
#include "gfxFont.h" #include "gfxFont.h"
@ -68,7 +66,7 @@ public:
float GetCharWidth(PRUnichar c, PRUint32 *aGlyphID = nsnull); float GetCharWidth(PRUnichar c, PRUint32 *aGlyphID = nsnull);
float GetCharHeight(PRUnichar c); float GetCharHeight(PRUnichar c);
ATSFontRef GetATSFontRef(); ATSUFontID GetATSUFontID();
cairo_font_face_t *CairoFontFace() { return mFontFace; } cairo_font_face_t *CairoFontFace() { return mFontFace; }
cairo_scaled_font_t *CairoScaledFont() { return mScaledFont; } cairo_scaled_font_t *CairoScaledFont() { return mScaledFont; }
@ -146,7 +144,7 @@ public:
return static_cast<gfxAtsuiFont*>(static_cast<gfxFont*>(mFonts[aFontIndex])); return static_cast<gfxAtsuiFont*>(static_cast<gfxFont*>(mFonts[aFontIndex]));
} }
PRBool HasFont(ATSFontRef aFontRef); PRBool HasFont(ATSUFontID fid);
inline gfxAtsuiFont* WhichFontSupportsChar(nsTArray< nsRefPtr<gfxFont> >& aFontList, inline gfxAtsuiFont* WhichFontSupportsChar(nsTArray< nsRefPtr<gfxFont> >& aFontList,
PRUint32 aCh) PRUint32 aCh)
@ -209,7 +207,4 @@ protected:
PRBool mLastPrefFirstFont; // is this the first font in the list of pref fonts for this lang group? PRBool mLastPrefFirstFont; // is this the first font in the list of pref fonts for this lang group?
eFontPrefLang mPageLang; eFontPrefLang mPageLang;
}; };
#endif /* not __LP64__ */
#endif /* GFX_ATSUIFONTS_H */ #endif /* GFX_ATSUIFONTS_H */

Просмотреть файл

@ -1,230 +0,0 @@
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is thebes gfx code.
*
* The Initial Developer of the Original Code is Mozilla Corporation.
* Portions created by the Initial Developer are Copyright (C) 2006-2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Vladimir Vukicevic <vladimir@pobox.com>
* Masayuki Nakano <masayuki@d-toybox.com>
* John Daggett <jdaggett@mozilla.com>
* Jonathan Kew <jfkthame@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef GFX_CORETEXTFONTS_H
#define GFX_CORETEXTFONTS_H
#include "cairo.h"
#include "gfxTypes.h"
#include "gfxFont.h"
#include "gfxFontUtils.h"
#include "gfxPlatform.h"
#include <Carbon/Carbon.h>
class gfxCoreTextFontGroup;
class MacOSFontEntry;
class MacOSFamilyEntry;
class gfxCoreTextFont : public gfxFont {
public:
gfxCoreTextFont(MacOSFontEntry *aFontEntry,
const gfxFontStyle *fontStyle, PRBool aNeedsBold);
virtual ~gfxCoreTextFont();
virtual const gfxFont::Metrics& GetMetrics() {
NS_ASSERTION(mHasMetrics == PR_TRUE, "metrics not initialized");
return mMetrics;
}
float GetCharWidth(PRUnichar c, PRUint32 *aGlyphID = nsnull);
float GetCharHeight(PRUnichar c);
ATSFontRef GetATSFont() {
return mATSFont;
}
CTFontRef GetCTFont() {
return mCTFont;
}
CFDictionaryRef GetAttributesDictionary() {
return mAttributesDict;
}
cairo_font_face_t *CairoFontFace() {
return mFontFace;
}
cairo_scaled_font_t *CairoScaledFont() {
return mScaledFont;
}
virtual nsString GetUniqueName() {
return GetName();
}
virtual PRUint32 GetSpaceGlyph() {
return mSpaceGlyph;
}
PRBool TestCharacterMap(PRUint32 aCh);
MacOSFontEntry* GetFontEntry();
PRBool Valid() {
return mIsValid;
}
// clean up static objects that may have been cached
static void Shutdown();
static CTFontRef CreateCopyWithDisabledLigatures(CTFontRef aFont);
protected:
const gfxFontStyle *mFontStyle;
ATSFontRef mATSFont;
CTFontRef mCTFont;
CFDictionaryRef mAttributesDict;
PRBool mHasMetrics;
nsString mUniqueName;
cairo_font_face_t *mFontFace;
cairo_scaled_font_t *mScaledFont;
gfxFont::Metrics mMetrics;
gfxFloat mAdjustedSize;
PRUint32 mSpaceGlyph;
void InitMetrics();
virtual PRBool SetupCairoFont(gfxContext *aContext);
static void CreateDefaultFeaturesDescriptor();
static CTFontDescriptorRef GetDefaultFeaturesDescriptor() {
if (sDefaultFeaturesDescriptor == NULL)
CreateDefaultFeaturesDescriptor();
return sDefaultFeaturesDescriptor;
}
// cached font descriptor, created the first time it's needed
static CTFontDescriptorRef sDefaultFeaturesDescriptor;
// cached descriptor for adding disable-ligatures setting to a font
static CTFontDescriptorRef sDisableLigaturesDescriptor;
};
class THEBES_API gfxCoreTextFontGroup : public gfxFontGroup {
public:
gfxCoreTextFontGroup(const nsAString& families,
const gfxFontStyle *aStyle,
gfxUserFontSet *aUserFontSet);
virtual ~gfxCoreTextFontGroup() {};
virtual gfxFontGroup *Copy(const gfxFontStyle *aStyle);
virtual gfxTextRun *MakeTextRun(const PRUnichar* aString, PRUint32 aLength,
const Parameters* aParams, PRUint32 aFlags);
virtual gfxTextRun *MakeTextRun(const PRUint8* aString, PRUint32 aLength,
const Parameters* aParams, PRUint32 aFlags);
// When aWrapped is true, the string includes bidi control
// characters. The first character will be LRO or LRO to force setting the
// direction for all characters, the last character is PDF, and the
// second to last character is a non-whitespace character --- to ensure
// that there is no "trailing whitespace" in the string, see
// http://weblogs.mozillazine.org/roc/archives/2007/02/superlaser_targ.html#comments
void MakeTextRunInternal(const PRUnichar *aString, PRUint32 aLength,
PRBool aWrapped, gfxTextRun *aTextRun);
gfxCoreTextFont* GetFontAt(PRInt32 aFontIndex) {
return static_cast<gfxCoreTextFont*>(static_cast<gfxFont*>(mFonts[aFontIndex]));
}
PRBool HasFont(ATSFontRef aFontRef);
inline gfxCoreTextFont* WhichFontSupportsChar(nsTArray< nsRefPtr<gfxFont> >& aFontList,
PRUint32 aCh)
{
PRUint32 len = aFontList.Length();
for (PRUint32 i = 0; i < len; i++) {
gfxCoreTextFont* font = static_cast<gfxCoreTextFont*>(aFontList.ElementAt(i).get());
if (font->TestCharacterMap(aCh))
return font;
}
return nsnull;
}
// search through pref fonts for a character, return nsnull if no matching pref font
already_AddRefed<gfxFont> WhichPrefFontSupportsChar(PRUint32 aCh);
already_AddRefed<gfxFont> WhichSystemFontSupportsChar(PRUint32 aCh);
void UpdateFontList();
protected:
static PRBool FindCTFont(const nsAString& aName,
const nsACString& aGenericName,
void *closure);
/**
* @param aTextRun the text run to fill in
* @param aString the complete text including all wrapper characters
* @param aTotalLength the length of aString
* @param aLayoutStart the first "real" character of aString, skipping any dir override
* @param aLayoutLength the length of the characters that should be actually used
*/
void InitTextRun(gfxTextRun *aTextRun,
const PRUnichar *aString,
PRUint32 aTotalLength,
PRUint32 aLayoutStart,
PRUint32 aLayoutLength);
nsresult SetGlyphsFromRun(gfxTextRun *aTextRun,
CTRunRef aCTRun,
const PRPackedBool *aUnmatched,
PRInt32 aLayoutStart,
PRInt32 aLayoutLength);
// cache the most recent pref font to avoid general pref font lookup
nsRefPtr<MacOSFamilyEntry> mLastPrefFamily;
nsRefPtr<gfxCoreTextFont> mLastPrefFont;
eFontPrefLang mLastPrefLang; // lang group for last pref font
PRBool mLastPrefFirstFont; // is this the first font in the list of pref fonts for this lang group?
eFontPrefLang mPageLang;
};
#endif /* GFX_CORETEXTFONTS_H */

Просмотреть файл

@ -548,6 +548,7 @@ public:
gfxFloat strikeoutOffset; gfxFloat strikeoutOffset;
gfxFloat underlineSize; gfxFloat underlineSize;
gfxFloat underlineOffset; gfxFloat underlineOffset;
gfxFloat height;
gfxFloat internalLeading; gfxFloat internalLeading;
gfxFloat externalLeading; gfxFloat externalLeading;
@ -1230,11 +1231,6 @@ public:
PRBool IsLigatureGroupStart() const { PRBool IsLigatureGroupStart() const {
return (mValue & FLAG_IS_SIMPLE_GLYPH) || !(mValue & FLAG_NOT_LIGATURE_GROUP_START); return (mValue & FLAG_IS_SIMPLE_GLYPH) || !(mValue & FLAG_NOT_LIGATURE_GROUP_START);
} }
PRBool IsLigatureContinuation() const {
return (mValue & FLAG_IS_SIMPLE_GLYPH) == 0 &&
(mValue & (FLAG_NOT_LIGATURE_GROUP_START | FLAG_NOT_MISSING)) ==
(FLAG_NOT_LIGATURE_GROUP_START | FLAG_NOT_MISSING);
}
PRBool CanBreakBefore() const { return (mValue & FLAG_CAN_BREAK_BEFORE) != 0; } PRBool CanBreakBefore() const { return (mValue & FLAG_CAN_BREAK_BEFORE) != 0; }
// Returns FLAG_CAN_BREAK_BEFORE if the setting changed, 0 otherwise // Returns FLAG_CAN_BREAK_BEFORE if the setting changed, 0 otherwise
@ -1371,7 +1367,6 @@ public:
nsresult AddGlyphRun(gfxFont *aFont, PRUint32 aStartCharIndex, PRBool aForceNewRun = PR_FALSE); nsresult AddGlyphRun(gfxFont *aFont, PRUint32 aStartCharIndex, PRBool aForceNewRun = PR_FALSE);
void ResetGlyphRuns() { mGlyphRuns.Clear(); } void ResetGlyphRuns() { mGlyphRuns.Clear(); }
void SortGlyphRuns(); void SortGlyphRuns();
void SanitizeGlyphRuns();
// Call the following glyph-setters during initialization or during reshaping // Call the following glyph-setters during initialization or during reshaping
// only. It is OK to overwrite existing data for a character. // only. It is OK to overwrite existing data for a character.

Просмотреть файл

@ -45,12 +45,9 @@
#define MAC_OS_X_VERSION_10_4_HEX 0x00001040 #define MAC_OS_X_VERSION_10_4_HEX 0x00001040
#define MAC_OS_X_VERSION_10_5_HEX 0x00001050 #define MAC_OS_X_VERSION_10_5_HEX 0x00001050
class gfxTextRun;
class THEBES_API gfxPlatformMac : public gfxPlatform { class THEBES_API gfxPlatformMac : public gfxPlatform {
public: public:
gfxPlatformMac(); gfxPlatformMac();
virtual ~gfxPlatformMac();
static gfxPlatformMac *GetPlatform() { static gfxPlatformMac *GetPlatform() {
return (gfxPlatformMac*) gfxPlatform::GetPlatform(); return (gfxPlatformMac*) gfxPlatform::GetPlatform();
@ -97,12 +94,6 @@ public:
// lower threshold on font anti-aliasing // lower threshold on font anti-aliasing
PRUint32 GetAntiAliasingThreshold() { return mFontAntiAliasingThreshold; } PRUint32 GetAntiAliasingThreshold() { return mFontAntiAliasingThreshold; }
// record Unicode cluster boundaries in the text run
static void SetupClusterBoundaries(gfxTextRun *aTextRun, const PRUnichar *aString);
// map a Unicode range (based on char code) to a font language for Preferences
static eFontPrefLang GetFontPrefLangFor(PRUint8 aUnicodeRange);
private: private:
void AppendCJKPrefLangs(eFontPrefLang aPrefLangs[], PRUint32 &aLen, void AppendCJKPrefLangs(eFontPrefLang aPrefLangs[], PRUint32 &aLen,
eFontPrefLang aCharLang, eFontPrefLang aPageLang); eFontPrefLang aCharLang, eFontPrefLang aPageLang);
@ -115,12 +106,6 @@ private:
nsTArray<PRUint32> mCJKPrefLangs; nsTArray<PRUint32> mCJKPrefLangs;
PRInt32 mOSXVersion; PRInt32 mOSXVersion;
PRUint32 mFontAntiAliasingThreshold; PRUint32 mFontAntiAliasingThreshold;
#ifndef __LP64__
// whether to use CoreText instead of ATSUI
// NOTE that this must not be changed after startup, once font objects have been created
PRBool mUseCoreText;
#endif
}; };
#endif /* GFX_PLATFORM_MAC_H */ #endif /* GFX_PLATFORM_MAC_H */

Просмотреть файл

@ -153,10 +153,6 @@ CPPSRCS += \
CPPSRCS += nsUnicodeRange.cpp CPPSRCS += nsUnicodeRange.cpp
CPPSRCS += gfxQuartzNativeDrawing.cpp CPPSRCS += gfxQuartzNativeDrawing.cpp
ifdef MOZ_CORETEXT
CPPSRCS += gfxCoreTextFonts.cpp
endif
CMMSRCS = gfxQuartzFontCache.mm CMMSRCS = gfxQuartzFontCache.mm
# Always link with OpenGL/AGL # Always link with OpenGL/AGL

Просмотреть файл

@ -37,8 +37,6 @@
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
#ifndef __LP64__ /* don't compile any of this on 64-bit as ATSUI is not available */
#include "prtypes.h" #include "prtypes.h"
#include "prmem.h" #include "prmem.h"
#include "nsString.h" #include "nsString.h"
@ -91,6 +89,8 @@ OSStatus ATSInitializeGlyphVector(int size, void *glyphVectorPtr);
OSStatus ATSClearGlyphVector(void *glyphVectorPtr); OSStatus ATSClearGlyphVector(void *glyphVectorPtr);
#endif #endif
eFontPrefLang GetFontPrefLangFor(PRUint8 aUnicodeRange);
gfxAtsuiFont::gfxAtsuiFont(MacOSFontEntry *aFontEntry, gfxAtsuiFont::gfxAtsuiFont(MacOSFontEntry *aFontEntry,
const gfxFontStyle *fontStyle, PRBool aNeedsBold) const gfxFontStyle *fontStyle, PRBool aNeedsBold)
: gfxFont(aFontEntry, fontStyle), : gfxFont(aFontEntry, fontStyle),
@ -98,8 +98,8 @@ gfxAtsuiFont::gfxAtsuiFont(MacOSFontEntry *aFontEntry,
mHasMirroring(PR_FALSE), mHasMirroringLookedUp(PR_FALSE), mHasMirroring(PR_FALSE), mHasMirroringLookedUp(PR_FALSE),
mFontFace(nsnull), mScaledFont(nsnull), mAdjustedSize(0.0f) mFontFace(nsnull), mScaledFont(nsnull), mAdjustedSize(0.0f)
{ {
ATSFontRef fontRef = aFontEntry->GetFontRef(); ATSUFontID fontID = aFontEntry->GetFontID();
ATSUFontID fontID = FMGetFontFromATSFontRef(fontRef); ATSFontRef fontRef = FMGetATSFontRefFromFont(fontID);
// determine whether synthetic bolding is needed // determine whether synthetic bolding is needed
PRInt8 baseWeight, weightDistance; PRInt8 baseWeight, weightDistance;
@ -168,9 +168,9 @@ gfxAtsuiFont::gfxAtsuiFont(MacOSFontEntry *aFontEntry,
} }
ATSFontRef gfxAtsuiFont::GetATSFontRef() ATSUFontID gfxAtsuiFont::GetATSUFontID()
{ {
return GetFontEntry()->GetFontRef(); return GetFontEntry()->GetFontID();
} }
static void static void
@ -357,11 +357,10 @@ gfxAtsuiFont::InitMetrics(ATSUFontID aFontID, ATSFontRef aFontRef)
SanitizeMetrics(&mMetrics, GetFontEntry()->mIsBadUnderlineFont); SanitizeMetrics(&mMetrics, GetFontEntry()->mIsBadUnderlineFont);
#if 0 #if 0
fprintf (stderr, "Font: %p (%s) size: %f\n", this, fprintf (stderr, "Font: %p size: %f (fixed: %d)", this, size, gfxQuartzFontCache::SharedFontCache()->IsFixedPitch(aFontID));
NS_ConvertUTF16toUTF8(GetName()).get(), mStyle.size);
fprintf (stderr, " emHeight: %f emAscent: %f emDescent: %f\n", mMetrics.emHeight, mMetrics.emAscent, mMetrics.emDescent); fprintf (stderr, " emHeight: %f emAscent: %f emDescent: %f\n", mMetrics.emHeight, mMetrics.emAscent, mMetrics.emDescent);
fprintf (stderr, " maxAscent: %f maxDescent: %f maxAdvance: %f\n", mMetrics.maxAscent, mMetrics.maxDescent, mMetrics.maxAdvance); fprintf (stderr, " maxAscent: %f maxDescent: %f maxAdvance: %f\n", mMetrics.maxAscent, mMetrics.maxDescent, mMetrics.maxAdvance);
fprintf (stderr, " internalLeading: %f externalLeading: %f\n", mMetrics.internalLeading, mMetrics.externalLeading); fprintf (stderr, " internalLeading: %f externalLeading: %f\n", mMetrics.externalLeading, mMetrics.internalLeading);
fprintf (stderr, " spaceWidth: %f aveCharWidth: %f xHeight: %f\n", mMetrics.spaceWidth, mMetrics.aveCharWidth, mMetrics.xHeight); fprintf (stderr, " spaceWidth: %f aveCharWidth: %f xHeight: %f\n", mMetrics.spaceWidth, mMetrics.aveCharWidth, mMetrics.xHeight);
fprintf (stderr, " uOff: %f uSize: %f stOff: %f stSize: %f suOff: %f suSize: %f\n", mMetrics.underlineOffset, mMetrics.underlineSize, mMetrics.strikeoutOffset, mMetrics.strikeoutSize, mMetrics.superscriptOffset, mMetrics.subscriptOffset); fprintf (stderr, " uOff: %f uSize: %f stOff: %f stSize: %f suOff: %f suSize: %f\n", mMetrics.underlineOffset, mMetrics.underlineSize, mMetrics.strikeoutOffset, mMetrics.strikeoutSize, mMetrics.superscriptOffset, mMetrics.subscriptOffset);
#endif #endif
@ -491,7 +490,7 @@ gfxAtsuiFont::HasMirroringInfo()
ByteCount size; ByteCount size;
// 361695 - if the font has a 'prop' table, assume that ATSUI will handle glyph mirroring // 361695 - if the font has a 'prop' table, assume that ATSUI will handle glyph mirroring
status = ATSFontGetTable(GetATSFontRef(), 'prop', 0, 0, 0, &size); status = ATSFontGetTable(GetATSUFontID(), 'prop', 0, 0, 0, &size);
mHasMirroring = (status == noErr); mHasMirroring = (status == noErr);
mHasMirroringLookedUp = PR_TRUE; mHasMirroringLookedUp = PR_TRUE;
} }
@ -574,7 +573,7 @@ gfxAtsuiFontGroup::FindATSUFont(const nsAString& aName,
fe = fc->FindFontForFamily(aName, fontStyle, needsBold); fe = fc->FindFontForFamily(aName, fontStyle, needsBold);
} }
if (fe && !fontGroup->HasFont(fe->GetFontRef())) { if (fe && !fontGroup->HasFont(fe->GetFontID())) {
nsRefPtr<gfxAtsuiFont> font = GetOrMakeFont(fe, fontStyle, needsBold); nsRefPtr<gfxAtsuiFont> font = GetOrMakeFont(fe, fontStyle, needsBold);
if (font) { if (font) {
fontGroup->mFonts.AppendElement(font); fontGroup->mFonts.AppendElement(font);
@ -590,6 +589,37 @@ gfxAtsuiFontGroup::Copy(const gfxFontStyle *aStyle)
return new gfxAtsuiFontGroup(mFamilies, aStyle, mUserFontSet); return new gfxAtsuiFontGroup(mFamilies, aStyle, mUserFontSet);
} }
static void
SetupClusterBoundaries(gfxTextRun *aTextRun, const PRUnichar *aString)
{
TextBreakLocatorRef locator;
OSStatus status = UCCreateTextBreakLocator(NULL, 0, kUCTextBreakClusterMask,
&locator);
if (status != noErr)
return;
UniCharArrayOffset breakOffset = 0;
UCTextBreakOptions options = kUCTextBreakLeadingEdgeMask;
PRUint32 length = aTextRun->GetLength();
while (breakOffset < length) {
UniCharArrayOffset next;
status = UCFindTextBreak(locator, kUCTextBreakClusterMask, options,
aString, length, breakOffset, &next);
if (status != noErr)
break;
options |= kUCTextBreakIterateMask;
PRUint32 i;
for (i = breakOffset + 1; i < next; ++i) {
gfxTextRun::CompressedGlyph g;
// Remember that this character is not the start of a cluster by
// setting its glyph data to "not a cluster start", "is a
// ligature start", with no glyphs.
aTextRun->SetGlyphs(i, g.SetComplex(PR_FALSE, PR_TRUE, 0), nsnull);
}
breakOffset = next;
}
UCDisposeTextBreakLocator(&locator);
}
#define UNICODE_LRO 0x202d #define UNICODE_LRO 0x202d
#define UNICODE_RLO 0x202e #define UNICODE_RLO 0x202e
#define UNICODE_PDF 0x202c #define UNICODE_PDF 0x202c
@ -714,7 +744,7 @@ gfxAtsuiFontGroup::MakeTextRun(const PRUnichar *aString, PRUint32 aLength,
return nsnull; return nsnull;
textRun->RecordSurrogates(aString); textRun->RecordSurrogates(aString);
gfxPlatformMac::SetupClusterBoundaries(textRun, aString); SetupClusterBoundaries(textRun, aString);
PRUint32 maxLen; PRUint32 maxLen;
nsAutoString utf16; nsAutoString utf16;
@ -793,10 +823,10 @@ gfxAtsuiFontGroup::MakeTextRun(const PRUint8 *aString, PRUint32 aLength,
} }
PRBool PRBool
gfxAtsuiFontGroup::HasFont(ATSFontRef aFontRef) gfxAtsuiFontGroup::HasFont(ATSUFontID fid)
{ {
for (PRUint32 i = 0; i < mFonts.Length(); ++i) { for (PRUint32 i = 0; i < mFonts.Length(); ++i) {
if (aFontRef == static_cast<gfxAtsuiFont *>(mFonts.ElementAt(i).get())->GetATSFontRef()) if (fid == static_cast<gfxAtsuiFont *>(mFonts.ElementAt(i).get())->GetATSUFontID())
return PR_TRUE; return PR_TRUE;
} }
return PR_FALSE; return PR_FALSE;
@ -833,7 +863,7 @@ gfxAtsuiFontGroup::WhichPrefFontSupportsChar(PRUint32 aCh)
// get the pref font list if it hasn't been set up already // get the pref font list if it hasn't been set up already
PRUint32 unicodeRange = FindCharUnicodeRange(aCh); PRUint32 unicodeRange = FindCharUnicodeRange(aCh);
eFontPrefLang charLang = gfxPlatformMac::GetFontPrefLangFor(unicodeRange); eFontPrefLang charLang = GetFontPrefLangFor(unicodeRange);
// if the last pref font was the first family in the pref list, no need to recheck through a list of families // if the last pref font was the first family in the pref list, no need to recheck through a list of families
if (mLastPrefFont && charLang == mLastPrefLang && mLastPrefFirstFont && mLastPrefFont->TestCharacterMap(aCh)) { if (mLastPrefFont && charLang == mLastPrefLang && mLastPrefFirstFont && mLastPrefFont->TestCharacterMap(aCh)) {
@ -1282,6 +1312,40 @@ PostLayoutOperationCallback(ATSULayoutOperationSelector iCurrentOperation,
return noErr; return noErr;
} }
// xxx - leaving this here for now, probably belongs in platform code somewhere
eFontPrefLang
GetFontPrefLangFor(PRUint8 aUnicodeRange)
{
switch (aUnicodeRange) {
case kRangeSetLatin: return eFontPrefLang_Western;
case kRangeCyrillic: return eFontPrefLang_Cyrillic;
case kRangeGreek: return eFontPrefLang_Greek;
case kRangeTurkish: return eFontPrefLang_Turkish;
case kRangeHebrew: return eFontPrefLang_Hebrew;
case kRangeArabic: return eFontPrefLang_Arabic;
case kRangeBaltic: return eFontPrefLang_Baltic;
case kRangeThai: return eFontPrefLang_Thai;
case kRangeKorean: return eFontPrefLang_Korean;
case kRangeJapanese: return eFontPrefLang_Japanese;
case kRangeSChinese: return eFontPrefLang_ChineseCN;
case kRangeTChinese: return eFontPrefLang_ChineseTW;
case kRangeDevanagari: return eFontPrefLang_Devanagari;
case kRangeTamil: return eFontPrefLang_Tamil;
case kRangeArmenian: return eFontPrefLang_Armenian;
case kRangeBengali: return eFontPrefLang_Bengali;
case kRangeCanadian: return eFontPrefLang_Canadian;
case kRangeEthiopic: return eFontPrefLang_Ethiopic;
case kRangeGeorgian: return eFontPrefLang_Georgian;
case kRangeGujarati: return eFontPrefLang_Gujarati;
case kRangeGurmukhi: return eFontPrefLang_Gurmukhi;
case kRangeKhmer: return eFontPrefLang_Khmer;
case kRangeMalayalam: return eFontPrefLang_Malayalam;
case kRangeSetCJK: return eFontPrefLang_CJKSet;
default: return eFontPrefLang_Others;
}
}
// 361695 - ATSUI only does glyph mirroring when the font contains a 'prop' table // 361695 - ATSUI only does glyph mirroring when the font contains a 'prop' table
// with glyph mirroring info, the character mirroring has to be done manually in the // with glyph mirroring info, the character mirroring has to be done manually in the
// fallback case. Only used for RTL text runs. The autoptr for the mirrored copy // fallback case. Only used for RTL text runs. The autoptr for the mirrored copy
@ -1365,9 +1429,9 @@ gfxAtsuiFontGroup::InitTextRun(gfxTextRun *aRun,
PR_LOG(gAtsuiTextRunLog, PR_LOG_DEBUG,\ PR_LOG(gAtsuiTextRunLog, PR_LOG_DEBUG,\
("InitTextRun %p fontgroup %p (%s) lang: %s len %d TEXTRUN \"%s\" ENDTEXTRUN\n", ("InitTextRun %p fontgroup %p (%s) lang: %s len %d TEXTRUN \"%s\" ENDTEXTRUN\n",
aRun, this, families.get(), mStyle.langGroup.get(), aLengthInTextRun, str.get()) ); aRun, this, families.get(), mStyle.langGroup.get(), aLengthInTextRun, str.get()) );
// PR_LOG(gAtsuiTextRunLog, PR_LOG_DEBUG, PR_LOG(gAtsuiTextRunLog, PR_LOG_DEBUG,
// ("InitTextRun font: %s user font set: %p (%8.8x)\n", ("InitTextRun font: %s user font set: %p (%8.8x)\n",
// NS_ConvertUTF16toUTF8(firstFont->GetUniqueName()).get(), mUserFontSet, PRUint32(mCurrGeneration)) ); NS_ConvertUTF16toUTF8(firstFont->GetUniqueName()).get(), mUserFontSet, PRUint32(mCurrGeneration)) );
#endif #endif
if (aRun->GetFlags() & TEXT_DISABLE_OPTIONAL_LIGATURES) { if (aRun->GetFlags() & TEXT_DISABLE_OPTIONAL_LIGATURES) {
@ -1488,8 +1552,7 @@ gfxAtsuiFontGroup::InitTextRun(gfxTextRun *aRun,
if (matchedFont != firstFont) { if (matchedFont != firstFont) {
// create a new sub-style and add it to the layout // create a new sub-style and add it to the layout
ATSUStyle subStyle = SetLayoutRangeToFont(layout, mainStyle, runStart, matchedLength, ATSUStyle subStyle = SetLayoutRangeToFont(layout, mainStyle, runStart, matchedLength, matchedFont->GetATSUFontID());
FMGetFontFromATSFontRef(matchedFont->GetATSFontRef()));
stylesToDispose.AppendElement(subStyle); stylesToDispose.AppendElement(subStyle);
} }
@ -1568,5 +1631,3 @@ gfxAtsuiFontGroup::InitFontList()
} }
} }
} }
#endif /* not __LP64__ */

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1486,7 +1486,6 @@ gfxTextRun::ComputeLigatureData(PRUint32 aPartStart, PRUint32 aPartEnd,
} }
} }
} }
NS_ASSERTION(totalClusterCount > 0, "Ligature involving no clusters??");
result.mPartAdvance = ligatureWidth*partClusterIndex/totalClusterCount; result.mPartAdvance = ligatureWidth*partClusterIndex/totalClusterCount;
result.mPartWidth = ligatureWidth*partClusterCount/totalClusterCount; result.mPartWidth = ligatureWidth*partClusterCount/totalClusterCount;
@ -2246,33 +2245,6 @@ gfxTextRun::SortGlyphRuns()
} }
} }
void
gfxTextRun::SanitizeGlyphRuns()
{
if (mGlyphRuns.Length() <= 1)
return;
// If any glyph run starts with ligature-continuation characters, we need to advance it
// to the first "real" character to avoid drawing partial ligature glyphs from wrong font
// (seen with U+FEFF in reftest 474417-1, as Core Text eliminates the glyph, which makes
// it appear as if a ligature has been formed)
PRInt32 i;
for (i = mGlyphRuns.Length() - 1; i >= 0; --i) {
GlyphRun& run = mGlyphRuns[i];
while (mCharacterGlyphs[run.mCharacterOffset].IsLigatureContinuation() &&
run.mCharacterOffset < mCharacterCount) {
run.mCharacterOffset++;
}
// if the run has become empty, eliminate it
if ((i < mGlyphRuns.Length() - 1 &&
run.mCharacterOffset >= mGlyphRuns[i+1].mCharacterOffset) ||
(i == mGlyphRuns.Length() - 1 &&
run.mCharacterOffset == mCharacterCount)) {
mGlyphRuns.RemoveElementAt(i);
}
}
}
PRUint32 PRUint32
gfxTextRun::CountMissingGlyphs() gfxTextRun::CountMissingGlyphs()
{ {
@ -2349,13 +2321,6 @@ gfxTextRun::SetMissingGlyph(PRUint32 aIndex, PRUint32 aChar)
void void
gfxTextRun::RecordSurrogates(const PRUnichar *aString) gfxTextRun::RecordSurrogates(const PRUnichar *aString)
{ {
// !! FIXME !!
//
// This is called from the platform font implementations when making text runs, but currently it
// doesn't do anything because callers do not (consistently, or ever?) set the TEXT_HAS_SURROGATES flag.
// However, I have not seen anything that relies on the surrogate flag on glyphs, so perhaps we can
// simply eliminate this and remove that flag from gfxTextRunFactory?
if (!(mFlags & gfxTextRunFactory::TEXT_HAS_SURROGATES)) if (!(mFlags & gfxTextRunFactory::TEXT_HAS_SURROGATES))
return; return;
@ -2444,9 +2409,6 @@ gfxTextRun::CopyGlyphDataFrom(gfxTextRun *aSource, PRUint32 aStart,
PRUint32 end = iter.GetStringEnd(); PRUint32 end = iter.GetStringEnd();
#endif #endif
PRUint32 start = iter.GetStringStart(); PRUint32 start = iter.GetStringStart();
// These assertions are probably not needed; it's possible for us to assign
// different fonts to a base character and a following diacritic.
// View http://www.alanwood.net/unicode/cyrillic.html on OS X 10.5 for an example.
NS_ASSERTION(aSource->IsClusterStart(start), NS_ASSERTION(aSource->IsClusterStart(start),
"Started word in the middle of a cluster..."); "Started word in the middle of a cluster...");
NS_ASSERTION(end == aSource->GetLength() || aSource->IsClusterStart(end), NS_ASSERTION(end == aSource->GetLength() || aSource->IsClusterStart(end),

Просмотреть файл

@ -46,17 +46,12 @@
#include "gfxAtsuiFonts.h" #include "gfxAtsuiFonts.h"
#include "gfxUserFontSet.h" #include "gfxUserFontSet.h"
#ifdef MOZ_CORETEXT
#include "gfxCoreTextFonts.h"
#endif
#include "nsIPrefBranch.h" #include "nsIPrefBranch.h"
#include "nsIPrefService.h" #include "nsIPrefService.h"
#include "nsIPrefLocalizedString.h" #include "nsIPrefLocalizedString.h"
#include "nsServiceManagerUtils.h" #include "nsServiceManagerUtils.h"
#include "nsCRT.h" #include "nsCRT.h"
#include "nsTArray.h" #include "nsTArray.h"
#include "nsUnicodeRange.h"
#include "lcms.h" #include "lcms.h"
@ -64,38 +59,6 @@ gfxPlatformMac::gfxPlatformMac()
{ {
mOSXVersion = 0; mOSXVersion = 0;
mFontAntiAliasingThreshold = ReadAntiAliasingThreshold(); mFontAntiAliasingThreshold = ReadAntiAliasingThreshold();
#ifndef __LP64__
// On 64-bit, we only have CoreText, no ATSUI;
// for 32-bit, check whether we can and should use CoreText
mUseCoreText = PR_FALSE;
#ifdef MOZ_CORETEXT
if (&CTLineCreateWithAttributedString != NULL) {
mUseCoreText = PR_TRUE;
nsCOMPtr<nsIPrefBranch> prefbranch = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (prefbranch) {
PRBool enabled;
nsresult rv = prefbranch->GetBoolPref("gfx.force_atsui_text", &enabled);
if (NS_SUCCEEDED(rv) && enabled)
mUseCoreText = PR_FALSE;
}
}
#ifdef DEBUG_jonathan
printf("Using %s for font & glyph shaping support\n",
mUseCoreText ? "CoreText" : "ATSUI");
#endif
#endif /* MOZ_CORETEXT */
#endif /* not __LP64__ */
}
gfxPlatformMac::~gfxPlatformMac()
{
#ifdef MOZ_CORETEXT
if (mUseCoreText)
gfxCoreTextFont::Shutdown();
#endif
} }
already_AddRefed<gfxASurface> already_AddRefed<gfxASurface>
@ -157,15 +120,7 @@ gfxPlatformMac::CreateFontGroup(const nsAString &aFamilies,
const gfxFontStyle *aStyle, const gfxFontStyle *aStyle,
gfxUserFontSet *aUserFontSet) gfxUserFontSet *aUserFontSet)
{ {
#ifdef __LP64__
return new gfxCoreTextFontGroup(aFamilies, aStyle, aUserFontSet);
#else
#ifdef MOZ_CORETEXT
if (mUseCoreText)
return new gfxCoreTextFontGroup(aFamilies, aStyle, aUserFontSet);
#endif
return new gfxAtsuiFontGroup(aFamilies, aStyle, aUserFontSet); return new gfxAtsuiFontGroup(aFamilies, aStyle, aUserFontSet);
#endif
} }
gfxFontEntry* gfxFontEntry*
@ -212,8 +167,8 @@ gfxPlatformMac::GetFontList(const nsACString& aLangGroup,
const nsACString& aGenericFamily, const nsACString& aGenericFamily,
nsTArray<nsString>& aListOfFonts) nsTArray<nsString>& aListOfFonts)
{ {
gfxQuartzFontCache::SharedFontCache()->GetFontList(aLangGroup, aGenericFamily, aListOfFonts); gfxQuartzFontCache::SharedFontCache()->
GetFontList(aLangGroup, aGenericFamily, aListOfFonts);
return NS_OK; return NS_OK;
} }
@ -428,67 +383,3 @@ gfxPlatformMac::GetPlatformCMSOutputProfile()
return profile; return profile;
} }
void
gfxPlatformMac::SetupClusterBoundaries(gfxTextRun *aTextRun, const PRUnichar *aString)
{
TextBreakLocatorRef locator;
OSStatus status = UCCreateTextBreakLocator(NULL, 0, kUCTextBreakClusterMask,
&locator);
if (status != noErr)
return;
UniCharArrayOffset breakOffset = 0;
UCTextBreakOptions options = kUCTextBreakLeadingEdgeMask;
PRUint32 length = aTextRun->GetLength();
while (breakOffset < length) {
UniCharArrayOffset next;
status = UCFindTextBreak(locator, kUCTextBreakClusterMask, options,
aString, length, breakOffset, &next);
if (status != noErr)
break;
options |= kUCTextBreakIterateMask;
PRUint32 i;
for (i = breakOffset + 1; i < next; ++i) {
gfxTextRun::CompressedGlyph g;
// Remember that this character is not the start of a cluster by
// setting its glyph data to "not a cluster start", "is a
// ligature start", with no glyphs.
aTextRun->SetGlyphs(i, g.SetComplex(PR_FALSE, PR_TRUE, 0), nsnull);
}
breakOffset = next;
}
UCDisposeTextBreakLocator(&locator);
}
eFontPrefLang
gfxPlatformMac::GetFontPrefLangFor(PRUint8 aUnicodeRange)
{
switch (aUnicodeRange) {
case kRangeSetLatin: return eFontPrefLang_Western;
case kRangeCyrillic: return eFontPrefLang_Cyrillic;
case kRangeGreek: return eFontPrefLang_Greek;
case kRangeTurkish: return eFontPrefLang_Turkish;
case kRangeHebrew: return eFontPrefLang_Hebrew;
case kRangeArabic: return eFontPrefLang_Arabic;
case kRangeBaltic: return eFontPrefLang_Baltic;
case kRangeThai: return eFontPrefLang_Thai;
case kRangeKorean: return eFontPrefLang_Korean;
case kRangeJapanese: return eFontPrefLang_Japanese;
case kRangeSChinese: return eFontPrefLang_ChineseCN;
case kRangeTChinese: return eFontPrefLang_ChineseTW;
case kRangeDevanagari: return eFontPrefLang_Devanagari;
case kRangeTamil: return eFontPrefLang_Tamil;
case kRangeArmenian: return eFontPrefLang_Armenian;
case kRangeBengali: return eFontPrefLang_Bengali;
case kRangeCanadian: return eFontPrefLang_Canadian;
case kRangeEthiopic: return eFontPrefLang_Ethiopic;
case kRangeGeorgian: return eFontPrefLang_Georgian;
case kRangeGujarati: return eFontPrefLang_Gujarati;
case kRangeGurmukhi: return eFontPrefLang_Gurmukhi;
case kRangeKhmer: return eFontPrefLang_Khmer;
case kRangeMalayalam: return eFontPrefLang_Malayalam;
case kRangeSetCJK: return eFontPrefLang_CJKSet;
default: return eFontPrefLang_Others;
}
}

Просмотреть файл

@ -80,19 +80,19 @@ public:
PRUint32 Traits() { return mTraits; } PRUint32 Traits() { return mTraits; }
ATSFontRef GetFontRef(); ATSUFontID GetFontID();
nsresult ReadCMAP(); nsresult ReadCMAP();
protected: protected:
// for use with data fonts // for use with data fonts
MacOSFontEntry(const nsAString& aPostscriptName, ATSFontRef aFontRef, MacOSFontEntry(const nsAString& aPostscriptName, ATSUFontID aFontID,
PRUint16 aWeight, PRUint16 aStretch, PRUint32 aItalicStyle, PRUint16 aWeight, PRUint16 aStretch, PRUint32 aItalicStyle,
gfxUserFontData *aUserFontData); gfxUserFontData *aUserFontData);
PRUint32 mTraits; PRUint32 mTraits;
ATSFontRef mATSFontRef; ATSUFontID mATSUFontID;
PRPackedBool mATSFontRefInitialized; PRPackedBool mATSUIDInitialized;
PRPackedBool mStandardFace; PRPackedBool mStandardFace;
}; };

Просмотреть файл

@ -58,6 +58,10 @@
#include <unistd.h> #include <unistd.h>
#include <time.h> #include <time.h>
// _atsFontID is private; add it in our new category to NSFont
@interface NSFont (MozillaCategory)
- (ATSUFontID)_atsFontID;
@end
// font info loader constants // font info loader constants
static const PRUint32 kDelayBeforeLoadingCmaps = 8 * 1000; // 8secs static const PRUint32 kDelayBeforeLoadingCmaps = 8 * 1000; // 8secs
@ -119,8 +123,8 @@ gfxQuartzFontCache::GenerateFontListKey(const nsAString& aKeyName, nsAString& aR
MacOSFontEntry::MacOSFontEntry(const nsAString& aPostscriptName, MacOSFontEntry::MacOSFontEntry(const nsAString& aPostscriptName,
PRInt32 aWeight, PRUint32 aTraits, PRInt32 aWeight, PRUint32 aTraits,
PRBool aIsStandardFace) PRBool aIsStandardFace)
: gfxFontEntry(aPostscriptName), mTraits(aTraits), mATSFontRef(0), : gfxFontEntry(aPostscriptName), mTraits(aTraits), mATSUFontID(0),
mATSFontRefInitialized(PR_FALSE), mStandardFace(aIsStandardFace) mATSUIDInitialized(0), mStandardFace(aIsStandardFace)
{ {
mWeight = aWeight; mWeight = aWeight;
@ -128,11 +132,11 @@ MacOSFontEntry::MacOSFontEntry(const nsAString& aPostscriptName,
mFixedPitch = (mTraits & NSFixedPitchFontMask ? 1 : 0); mFixedPitch = (mTraits & NSFixedPitchFontMask ? 1 : 0);
} }
MacOSFontEntry::MacOSFontEntry(const nsAString& aPostscriptName, ATSFontRef aFontRef, MacOSFontEntry::MacOSFontEntry(const nsAString& aPostscriptName, ATSUFontID aFontID,
PRUint16 aWeight, PRUint16 aStretch, PRUint32 aItalicStyle, PRUint16 aWeight, PRUint16 aStretch, PRUint32 aItalicStyle,
gfxUserFontData *aUserFontData) gfxUserFontData *aUserFontData)
: gfxFontEntry(aPostscriptName), mATSFontRef(aFontRef), : gfxFontEntry(aPostscriptName), mATSUFontID(aFontID),
mATSFontRefInitialized(PR_TRUE), mStandardFace(PR_FALSE) mATSUIDInitialized(PR_TRUE), mStandardFace(PR_FALSE)
{ {
// xxx - stretch is basically ignored for now // xxx - stretch is basically ignored for now
@ -147,16 +151,16 @@ MacOSFontEntry::MacOSFontEntry(const nsAString& aPostscriptName, ATSFontRef aFon
(mWeight >= 600 ? NSBoldFontMask : NSUnboldFontMask); (mWeight >= 600 ? NSBoldFontMask : NSUnboldFontMask);
} }
ATSFontRef ATSUFontID
MacOSFontEntry::GetFontRef() MacOSFontEntry::GetFontID()
{ {
if (!mATSFontRefInitialized) { if (!mATSUIDInitialized) {
mATSFontRefInitialized = PR_TRUE; mATSUIDInitialized = PR_TRUE;
NSString *psname = GetNSStringForString(mName); NSString *psname = GetNSStringForString(mName);
mATSFontRef = ATSFontFindFromPostScriptName(CFStringRef(psname), NSFont *font = [NSFont fontWithName:psname size:0.0];
kATSOptionFlagsDefault); if (font) mATSUFontID = [font _atsFontID];
} }
return mATSFontRef; return mATSUFontID;
} }
// ATSUI requires AAT-enabled fonts to render complex scripts correctly. // ATSUI requires AAT-enabled fonts to render complex scripts correctly.
@ -190,12 +194,12 @@ MacOSFontEntry::ReadCMAP()
ByteCount size, cmapSize; ByteCount size, cmapSize;
if (mCmapInitialized) return NS_OK; if (mCmapInitialized) return NS_OK;
ATSFontRef fontRef = GetFontRef(); ATSUFontID fontID = GetFontID();
// attempt this once, if errors occur leave a blank cmap // attempt this once, if errors occur leave a blank cmap
mCmapInitialized = PR_TRUE; mCmapInitialized = PR_TRUE;
status = ATSFontGetTable(fontRef, 'cmap', 0, 0, 0, &size); status = ATSFontGetTable(fontID, 'cmap', 0, 0, 0, &size);
cmapSize = size; cmapSize = size;
//printf( "cmap size: %s %d", NS_ConvertUTF16toUTF8(mName).get(), size ); //printf( "cmap size: %s %d", NS_ConvertUTF16toUTF8(mName).get(), size );
#if DEBUG #if DEBUG
@ -212,7 +216,7 @@ MacOSFontEntry::ReadCMAP()
return NS_ERROR_OUT_OF_MEMORY; return NS_ERROR_OUT_OF_MEMORY;
PRUint8 *cmap = buffer.Elements(); PRUint8 *cmap = buffer.Elements();
status = ATSFontGetTable(fontRef, 'cmap', 0, size, cmap, &size); status = ATSFontGetTable(fontID, 'cmap', 0, size, cmap, &size);
NS_ENSURE_TRUE(status == noErr, NS_ERROR_FAILURE); NS_ENSURE_TRUE(status == noErr, NS_ERROR_FAILURE);
nsresult rv = NS_ERROR_FAILURE; nsresult rv = NS_ERROR_FAILURE;
@ -232,13 +236,13 @@ MacOSFontEntry::ReadCMAP()
// check for mort/morx table, if haven't already // check for mort/morx table, if haven't already
if (!checkedForMorphTable) { if (!checkedForMorphTable) {
status = ATSFontGetTable(fontRef, 'morx', 0, 0, 0, &size); status = ATSFontGetTable(fontID, 'morx', 0, 0, 0, &size);
if (status == noErr) { if (status == noErr) {
checkedForMorphTable = PR_TRUE; checkedForMorphTable = PR_TRUE;
hasMorphTable = PR_TRUE; hasMorphTable = PR_TRUE;
} else { } else {
// check for a mort table // check for a mort table
status = ATSFontGetTable(fontRef, 'mort', 0, 0, 0, &size); status = ATSFontGetTable(fontID, 'mort', 0, 0, 0, &size);
checkedForMorphTable = PR_TRUE; checkedForMorphTable = PR_TRUE;
if (status == noErr) { if (status == noErr) {
hasMorphTable = PR_TRUE; hasMorphTable = PR_TRUE;
@ -543,14 +547,12 @@ enum {
// returns true if other names were found, false otherwise // returns true if other names were found, false otherwise
static PRBool ReadOtherFamilyNamesForFace(AddOtherFamilyNameFunctor& aOtherFamilyFunctor, MacOSFamilyEntry *aFamilyEntry, static PRBool ReadOtherFamilyNamesForFace(AddOtherFamilyNameFunctor& aOtherFamilyFunctor, MacOSFamilyEntry *aFamilyEntry,
NSString *familyName, ATSFontRef aFontRef, bool useFullName = false) NSString *familyName, ATSUFontID fontID, bool useFullName = false)
{ {
OSStatus err; OSStatus err;
ItemCount i, nameCount; ItemCount i, nameCount;
PRBool foundNames = PR_FALSE; PRBool foundNames = PR_FALSE;
ATSUFontID fontID = FMGetFontFromATSFontRef(aFontRef);
if (fontID == kATSUInvalidFontID) if (fontID == kATSUInvalidFontID)
return foundNames; return foundNames;
@ -617,7 +619,7 @@ MacOSFamilyEntry::ReadOtherFamilyNames(AddOtherFamilyNameFunctor& aOtherFamilyFu
// read in other family names for the first face in the list // read in other family names for the first face in the list
MacOSFontEntry *fe = mAvailableFonts[0]; MacOSFontEntry *fe = mAvailableFonts[0];
mHasOtherFamilyNames = ReadOtherFamilyNamesForFace(aOtherFamilyFunctor, this, familyName, fe->GetFontRef()); mHasOtherFamilyNames = ReadOtherFamilyNamesForFace(aOtherFamilyFunctor, this, familyName, fe->GetFontID());
// read in other names for the first face in the list with the assumption // read in other names for the first face in the list with the assumption
// that if extra names don't exist in that face then they don't exist in // that if extra names don't exist in that face then they don't exist in
@ -630,7 +632,7 @@ MacOSFamilyEntry::ReadOtherFamilyNames(AddOtherFamilyNameFunctor& aOtherFamilyFu
numFonts = mAvailableFonts.Length(); numFonts = mAvailableFonts.Length();
for (i = 1; i < numFonts; i++) { for (i = 1; i < numFonts; i++) {
fe = mAvailableFonts[i]; fe = mAvailableFonts[i];
ReadOtherFamilyNamesForFace(aOtherFamilyFunctor, this, familyName, fe->GetFontRef()); ReadOtherFamilyNamesForFace(aOtherFamilyFunctor, this, familyName, fe->GetFontID());
} }
} }
} }
@ -669,7 +671,7 @@ void SingleFaceFamily::ReadOtherFamilyNames(AddOtherFamilyNameFunctor& aOtherFam
MacOSFontEntry *fe = mAvailableFonts[0]; MacOSFontEntry *fe = mAvailableFonts[0];
// read in other names, using the full font names as the family names // read in other names, using the full font names as the family names
mHasOtherFamilyNames = ReadOtherFamilyNamesForFace(aOtherFamilyFunctor, this, familyName, fe->GetFontRef(), true); mHasOtherFamilyNames = ReadOtherFamilyNamesForFace(aOtherFamilyFunctor, this, familyName, fe->GetFontID(), true);
} }
/* gfxQuartzFontCache */ /* gfxQuartzFontCache */
@ -813,7 +815,7 @@ gfxQuartzFontCache::InitFontList()
// clean up various minor 10.4 font problems for specific fonts // clean up various minor 10.4 font problems for specific fonts
if (gfxPlatformMac::GetPlatform()->OSXVersion() < MAC_OS_X_VERSION_10_5_HEX) { if (gfxPlatformMac::GetPlatform()->OSXVersion() < MAC_OS_X_VERSION_10_5_HEX) {
// Cocoa calls report that italic faces exist for Courier and Helvetica, // Cocoa calls report that italic faces exist for Courier and Helvetica,
// even though only bold faces exist so test for this using ATS font refs (10.5 has proper faces) // even though only bold faces exist so test for this using ATSUI id's (10.5 has proper faces)
EliminateDuplicateFaces(NS_LITERAL_STRING("Courier")); EliminateDuplicateFaces(NS_LITERAL_STRING("Courier"));
EliminateDuplicateFaces(NS_LITERAL_STRING("Helvetica")); EliminateDuplicateFaces(NS_LITERAL_STRING("Helvetica"));
@ -942,8 +944,8 @@ gfxQuartzFontCache::EliminateDuplicateFaces(const nsAString& aFamilyName)
MacOSFontEntry *italic, *nonitalic; MacOSFontEntry *italic, *nonitalic;
PRUint32 boldtraits[2] = { 0, NSBoldFontMask }; PRUint32 boldtraits[2] = { 0, NSBoldFontMask };
// if normal and italic have the same ATS font ref, delete italic // if normal and italic have the same ATSUI id, delete italic
// if bold and bold-italic have the same ATS font ref, delete bold-italic // if bold and bold-italic have the same ATSUI id, delete bold-italic
// two iterations, one for normal, one for bold // two iterations, one for normal, one for bold
for (bold = 0; bold < 2; bold++) { for (bold = 0; bold < 2; bold++) {
@ -971,9 +973,9 @@ gfxQuartzFontCache::EliminateDuplicateFaces(const nsAString& aFamilyName)
} }
} }
// if italic face and non-italic face have matching ATS refs, // if italic face and non-italic face have matching ATSUI id's,
// the italic face is bogus so remove it // the italic face is bogus so remove it
if (italic && italic->GetFontRef() == nonitalic->GetFontRef()) { if (italic && italic->GetFontID() == nonitalic->GetFontID()) {
fontlist.RemoveElementAt(italicIndex); fontlist.RemoveElementAt(italicIndex);
} }
} }
@ -1332,7 +1334,7 @@ gfxQuartzFontCache::LookupLocalFont(const gfxProxyFontEntry *aProxyEntry,
// grumble, another non-publised Apple API dependency (found in Webkit code) // grumble, another non-publised Apple API dependency (found in Webkit code)
// activated with this value, font will not be found via system lookup routines // activated with this value, font will not be found via system lookup routines
// it can only be used via the created ATSFontRef // it can only be used via the created ATSUFontID
// needed to prevent one doc from finding a font used in a separate doc // needed to prevent one doc from finding a font used in a separate doc
enum { enum {

Просмотреть файл

@ -1,8 +0,0 @@
<!DOCTYPE html>
<!-- check that U+FEFF doesn't disrupt glyph rendering, see bug 389074 comments 26, 30 -->
<html>
<div style="font-size: large;">
<!-- leave one FEFF in the text to maintain same line height -->
<p>&#xfeff;ABC</p>
</div>
</html>

Просмотреть файл

@ -1,7 +0,0 @@
<!DOCTYPE html>
<!-- check that U+FEFF doesn't disrupt glyph rendering, see bug 389074 comments 26, 30 -->
<html>
<div style="font-size: large;">
<p>&#xfeff;A&#xfeff;B&#xfeff;C&#xfeff;</p>
</div>
</html>

Просмотреть файл

@ -1,11 +1,11 @@
<!DOCTYPE html> <!DOCTYPE html>
<!-- use monospace to eliminate kerning issues --> <!-- Use the 0-width non-breakable space to force the same kerning behavior
as <wbr> -->
<html style="font-family: monospace;"> <html>
<div style="width: 100em"> <div style="width: 100em">
AB A&#xFEFF;B
</div> </div>
<div style="width: 0"> <div style="width: 0">
A B A&#xFEFF; B
</div> </div>
</html> </html>

Просмотреть файл

@ -1,11 +1,11 @@
<!DOCTYPE html> <!DOCTYPE html>
<!-- use monospace to eliminate kerning issues --> <!-- Use the 0-width non-breakable space to give the same heights as the
reference -->
<html style="font-family: monospace;"> <html>
<div style="width: 100em;"> <div style="width: 100em">
A<wbr>B A&#xFEFF;<wbr>B
</div> </div>
<div style="width: 0"> <div style="width: 0">
A<wbr>B A&#xFEFF;<wbr>B
</div> </div>
</html> </html>

Просмотреть файл

@ -411,8 +411,7 @@ random-if(MOZ_WIDGET_TOOLKIT=="gtk2") == 333970-1.html 333970-1-ref.html # bug 3
== 348809-2h.html 348809-2-ref.html == 348809-2h.html 348809-2-ref.html
== 349695-1a.html 349695-1-ref.html == 349695-1a.html 349695-1-ref.html
== 349695-1b.html 349695-1-ref.html == 349695-1b.html 349695-1-ref.html
# fails with CoreText rendering due to clipping of one subpixel-antialiasing pixel at end of text == 350506-1.html 350506-1-ref.html
random-if(MOZ_WIDGET_TOOLKIT=="cocoa") == 350506-1.html 350506-1-ref.html
== 351641-1a.html 351641-1-ref.html == 351641-1a.html 351641-1-ref.html
== 351641-1b.html 351641-1-ref.html == 351641-1b.html 351641-1-ref.html
== 351641-2a.html 351641-2-ref.html == 351641-2a.html 351641-2-ref.html
@ -674,7 +673,6 @@ random == 387876-2.html 387876-2-ref.html # bug 471630
== 388026-1.html 388026-1-ref.html == 388026-1.html 388026-1-ref.html
== 388367-1.html about:blank == 388367-1.html about:blank
== 388980-1.html 388980-1-ref.html == 388980-1.html 388980-1-ref.html
== 389074-1.html 389074-1-ref.html
== 389468-1.html 389468-1-ref.html == 389468-1.html 389468-1-ref.html
== 389623-1.html 389623-1-ref.html == 389623-1.html 389623-1-ref.html
== 389636-1.html about:blank # assertion test == 389636-1.html about:blank # assertion test

Просмотреть файл

@ -3,12 +3,9 @@
== currency-2.html currency-2-ref.html == currency-2.html currency-2-ref.html
== datetime-1.html datetime-1-ref.html == datetime-1.html datetime-1-ref.html
== hyphens-1.html hyphens-1-ref.html == hyphens-1.html hyphens-1-ref.html
# The following three tests may fail if rendering with Core Text (see bug 389074) == ja-1.html ja-1-ref.html
# due to subpixel glyph positioning differences between the reference cases with <br> == ja-2.html ja-2-ref.html
# and the automatically-wrapped lines in the test file == ja-3.html ja-3-ref.html
random-if(MOZ_WIDGET_TOOLKIT=="cocoa") == ja-1.html ja-1-ref.html
random-if(MOZ_WIDGET_TOOLKIT=="cocoa") == ja-2.html ja-2-ref.html
random-if(MOZ_WIDGET_TOOLKIT=="cocoa") == ja-3.html ja-3-ref.html
== leaders-1.html leaders-1-ref.html == leaders-1.html leaders-1-ref.html
== markup-src-1.html markup-src-1-ref.html == markup-src-1.html markup-src-1-ref.html
== non-breakable-1.html non-breakable-1-ref.html == non-breakable-1.html non-breakable-1-ref.html

Просмотреть файл

@ -1,14 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<style>
p { font-family: sans-serif; font-size: 24pt; }
</style>
<body>
<p>hello</p>
<p>small</p>
<p>world</p>
</body>
</html>

Просмотреть файл

@ -1,16 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<style>
p { font-family: sans-serif; font-size: 24pt; }
.small { font-size-adjust: 0.25; }
.large { font-size-adjust: 0.9; }
</style>
<body>
<p>hello</p>
<p class="small">small</p>
<p class="large">world</p>
</body>
</html>

Просмотреть файл

@ -1,15 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<style>
.big { font-family: sans-serif; font-size: 40pt; }
.a { font-family: sans-serif; font-size: 15pt; font-size-adjust: 0.8; }
.b { font-family: sans-serif; font-size: 30pt; font-size-adjust: 0.4; }
</style>
<body>
<p class="big">1. <span class="a">lines should be the same size</span></p>
<p class="big">2. <span class="b">lines should be the same size</span></p>
</body>
</html>

Просмотреть файл

@ -1,15 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<style>
.big { font-family: sans-serif; font-size: 40pt; }
.a { font-family: sans-serif; font-size: 15pt; font-size-adjust: 0.8; }
.b { font-family: sans-serif; font-size: 30pt; font-size-adjust: 0.4; }
</style>
<body>
<p class="big">1. <span class="b">lines should be the same size</span></p>
<p class="big">2. <span class="a">lines should be the same size</span></p>
</body>
</html>

Просмотреть файл

@ -1,14 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<style>
.a { font-family: sans-serif; font-size: 15pt; font-size-adjust: 0.8; }
.b { font-family: sans-serif; font-size: 30pt; font-size-adjust: 0.4; }
</style>
<body>
<p class="b">lines should be the same size</p>
<p class="a">lines should be the same size</p>
</body>
</html>

Просмотреть файл

@ -1,14 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<style>
.a { font-family: sans-serif; font-size: 15pt; font-size-adjust: 0.8; }
.b { font-family: sans-serif; font-size: 30pt; font-size-adjust: 0.4; }
</style>
<body>
<p class="a">lines should be the same size</p>
<p class="b">lines should be the same size</p>
</body>
</html>

Просмотреть файл

@ -1,14 +1,5 @@
== fallback-01.xhtml fallback-01-ref.xhtml == fallback-01.xhtml fallback-01-ref.xhtml
== font-selection-by-lang-01.html font-selection-by-lang-01-ref.html == font-selection-by-lang-01.html font-selection-by-lang-01-ref.html
!= font-size-adjust-01.html font-size-adjust-01-ref.html
# The following test passes consistently only on Mac OS X;
# both Windows and Linux give results that vary depending on the font size/zoom factor used,
# because hinting affects the metrics used to compute the font size adjustment. See bug 429605.
random-if(MOZ_WIDGET_TOOLKIT!="cocoa") == font-size-adjust-02.html font-size-adjust-02-ref.html
# This currently fails because line spacing does not respect font-size-adjust
# in the "obvious" way, but it is unclear what the behavior should really be;
# see bug #366138 for some (inconclusive) discussion
# == font-size-adjust-03.html font-size-adjust-03-ref.html
== justification-1.html justification-1-ref.html == justification-1.html justification-1-ref.html
== justification-2a.html justification-2-ref.html == justification-2a.html justification-2-ref.html
== justification-2b.html justification-2-ref.html == justification-2b.html justification-2-ref.html
@ -36,9 +27,7 @@ random-if(MOZ_WIDGET_TOOLKIT=="gtk2") == wordwrap-03.html wordwrap-03-ref.html #
!= wordwrap-09.html wordwrap-01-ref.html != wordwrap-09.html wordwrap-01-ref.html
== wordwrap-09.html wordwrap-09-ref.html == wordwrap-09.html wordwrap-09-ref.html
== word-spacing-01.html word-spacing-01-ref.html == word-spacing-01.html word-spacing-01-ref.html
# the following will fail when rendering with Core Text (see bug 389074) due to what appears to be HTTP(..) == zwnj-01.xhtml zwnj-01-ref.xhtml
# an Apple bug: the presence of ZWNJ disturbs the positioning of an adjacent glyph. rdar://6427865
random-if(MOZ_WIDGET_TOOLKIT=="cocoa") HTTP(..) == zwnj-01.xhtml zwnj-01-ref.xhtml
HTTP(..) == zwnj-02.xhtml zwnj-02-ref.xhtml # HTTP(..) for ../filters.svg HTTP(..) == zwnj-02.xhtml zwnj-02-ref.xhtml # HTTP(..) for ../filters.svg
random-if(MOZ_WIDGET_TOOLKIT=="gtk2") != zwnj-01.html zwnj-01-notref.html # Bad fonts on the tinderbox -- works locally random-if(MOZ_WIDGET_TOOLKIT=="gtk2") != zwnj-01.html zwnj-01-notref.html # Bad fonts on the tinderbox -- works locally
fails-if(MOZ_WIDGET_TOOLKIT=="windows") == cgj-01.html cgj-01-ref.html # bug 455455 fails-if(MOZ_WIDGET_TOOLKIT=="windows") == cgj-01.html cgj-01-ref.html # bug 455455

Просмотреть файл

@ -1571,11 +1571,6 @@ pref("browser.drag_out_of_frame_style", 1);
pref("ui.key.saveLink.shift", false); // true = shift, false = meta pref("ui.key.saveLink.shift", false); // true = shift, false = meta
pref("ui.click_hold_context_menus", false); pref("ui.click_hold_context_menus", false);
#ifndef __LP64__
// whether to always use ATSUI for text even if CoreText is available
pref("gfx.force_atsui_text", false);
#endif
// default fonts (in UTF8 and using canonical names) // default fonts (in UTF8 and using canonical names)
// to determine canonical font names, use a debug build and // to determine canonical font names, use a debug build and
// enable NSPR logging for module fontInfoLog:5 // enable NSPR logging for module fontInfoLog:5