bug 844133 - eliminate the MOZ_GRAPHITE configure option. r=ted

This commit is contained in:
Jonathan Kew 2013-02-22 16:52:20 +00:00
parent de0eaf91ad
commit 696cf350b6
17 changed files with 15 additions and 113 deletions

View File

@ -4251,7 +4251,6 @@ BUILD_CTYPES=1
MOZ_USE_NATIVE_POPUP_WINDOWS=
MOZ_ANDROID_HISTORY=
MOZ_WEBSMS_BACKEND=
MOZ_GRAPHITE=1
ACCESSIBILITY=1
MOZ_SYS_MSG=
MOZ_TIME_MANAGER=
@ -8198,13 +8197,7 @@ AC_SUBST(MOZ_HARFBUZZ_LIBS)
dnl ========================================================
dnl SIL Graphite
dnl ========================================================
if test "$MOZ_GRAPHITE"; then
MOZ_GRAPHITE_LIBS='$(DEPTH)/gfx/graphite2/src/$(LIB_PREFIX)mozgraphite2.$(LIB_SUFFIX)'
AC_DEFINE(MOZ_GRAPHITE)
else
MOZ_GRAPHITE_LIBS=
fi
AC_SUBST(MOZ_GRAPHITE)
MOZ_GRAPHITE_LIBS='$(DEPTH)/gfx/graphite2/src/$(LIB_PREFIX)mozgraphite2.$(LIB_SUFFIX)'
AC_SUBST(MOZ_GRAPHITE_LIBS)
dnl ========================================================

View File

@ -16,11 +16,7 @@ ifdef MOZ_TREE_CAIRO
DIRS = cairo
endif
ifdef MOZ_GRAPHITE
DIRS += graphite2/src
endif
DIRS += 2d ycbcr angle src qcms gl layers harfbuzz/src ots/src thebes ipc
DIRS += 2d ycbcr angle src qcms gl layers graphite2/src harfbuzz/src ots/src thebes ipc
ifdef MOZ_ENABLE_SKIA
DIRS += skia

View File

@ -184,6 +184,7 @@ CPPSRCS = \
gfxUserFontSet.cpp \
gfxUtils.cpp \
gfxScriptItemizer.cpp \
gfxGraphiteShaper.cpp \
gfxHarfBuzzShaper.cpp \
gfxBaseSharedMemorySurface.cpp \
gfxReusableSurfaceWrapper.cpp \
@ -195,13 +196,6 @@ ifeq ($(MOZ_WIDGET_TOOLKIT),$(findstring $(MOZ_WIDGET_TOOLKIT),android gtk2 gonk
DEFINES += -DMOZ_ENABLE_FREETYPE
endif
ifdef MOZ_GRAPHITE
DEFINES += -DGRAPHITE2_STATIC
CPPSRCS += \
gfxGraphiteShaper.cpp \
$(NULL)
endif
# Are we targeting x86 or x64? If so, build gfxAlphaRecoverySSE2.cpp.
ifneq (,$(INTEL_ARCHITECTURE))
CPPSRCS += gfxAlphaRecoverySSE2.cpp
@ -348,8 +342,12 @@ CMMSRCS = \
endif
DEFINES += -DIMPL_THEBES -DHB_DONT_DEFINE_STDINT
DEFINES += -DMOZ_OTS_REPORT_ERRORS
DEFINES += \
-DIMPL_THEBES \
-DHB_DONT_DEFINE_STDINT \
-DMOZ_OTS_REPORT_ERRORS \
-DGRAPHITE2_STATIC \
$(NULL)
ifeq (WINNT,$(OS_TARGET))
DEFINES += -DOTS_DLL

View File

@ -7,9 +7,7 @@
#include "gfxDWriteShaper.h"
#include "gfxHarfBuzzShaper.h"
#include <algorithm>
#ifdef MOZ_GRAPHITE
#include "gfxGraphiteShaper.h"
#endif
#include "gfxDWriteFontList.h"
#include "gfxContext.h"
#include <dwrite.h>
@ -108,11 +106,9 @@ gfxDWriteFont::gfxDWriteFont(gfxFontEntry *aFontEntry,
ComputeMetrics(anAAOption);
#ifdef MOZ_GRAPHITE
if (FontCanSupportGraphite()) {
mGraphiteShaper = new gfxGraphiteShaper(this);
}
#endif
if (FontCanSupportHarfBuzz()) {
mHarfBuzzShaper = new gfxHarfBuzzShaper(this);

View File

@ -25,9 +25,7 @@
#include "gfxFT2FontList.h"
#include <locale.h>
#include "gfxHarfBuzzShaper.h"
#ifdef MOZ_GRAPHITE
#include "gfxGraphiteShaper.h"
#endif
#include "nsGkAtoms.h"
#include "nsTArray.h"
#include "nsUnicodeRange.h"
@ -413,7 +411,6 @@ gfxFT2Font::ShapeText(gfxContext *aContext,
{
bool ok = false;
#ifdef MOZ_GRAPHITE
if (FontCanSupportGraphite()) {
if (gfxPlatform::GetPlatform()->UseGraphiteShaping()) {
if (!mGraphiteShaper) {
@ -424,7 +421,6 @@ gfxFT2Font::ShapeText(gfxContext *aContext,
aScript, aShapedText);
}
}
#endif
if (!ok && gfxPlatform::GetPlatform()->UseHarfBuzzForScript(aScript)) {
if (!mHarfBuzzShaper) {

View File

@ -431,7 +431,6 @@ gfxFontEntry::ShareFontTableAndGetBlob(uint32_t aTag,
return entry->ShareTableAndGetBlob(*aBuffer, &mFontTableCache);
}
#ifdef MOZ_GRAPHITE
void
gfxFontEntry::CheckForGraphiteTables()
{
@ -439,7 +438,6 @@ gfxFontEntry::CheckForGraphiteTables()
mHasGraphiteTables =
NS_SUCCEEDED(GetFontTable(TRUETYPE_TAG('S','i','l','f'), buffer));
}
#endif
/* static */ size_t
gfxFontEntry::FontTableHashEntry::SizeOfEntryExcludingThis
@ -2542,12 +2540,10 @@ gfxFont::ShapeText(gfxContext *aContext,
{
bool ok = false;
#ifdef MOZ_GRAPHITE
if (mGraphiteShaper && gfxPlatform::GetPlatform()->UseGraphiteShaping()) {
ok = mGraphiteShaper->ShapeText(aContext, aText, aOffset, aLength,
aScript, aShapedText);
}
#endif
if (!ok && mHarfBuzzShaper && !aPreferPlatformShaping) {
if (gfxPlatform::GetPlatform()->UseHarfBuzzForScript(aScript)) {

View File

@ -216,9 +216,7 @@ public:
mIgnoreGSUB(false),
mSVGInitialized(false),
mWeight(500), mStretch(NS_FONT_STRETCH_NORMAL),
#ifdef MOZ_GRAPHITE
mCheckedForGraphiteTables(false),
#endif
mHasCmapTable(false),
mUVSOffset(0), mUVSData(nullptr),
mUserFontData(nullptr),
@ -257,7 +255,6 @@ public:
virtual bool IsSymbolFont();
#ifdef MOZ_GRAPHITE
inline bool HasGraphiteTables() {
if (!mCheckedForGraphiteTables) {
CheckForGraphiteTables();
@ -265,7 +262,6 @@ public:
}
return mHasGraphiteTables;
}
#endif
inline bool HasCmapTable() {
if (!mCharacterMap) {
@ -352,10 +348,8 @@ public:
uint16_t mWeight;
int16_t mStretch;
#ifdef MOZ_GRAPHITE
bool mHasGraphiteTables;
bool mCheckedForGraphiteTables;
#endif
bool mHasCmapTable;
nsRefPtr<gfxCharacterMap> mCharacterMap;
uint32_t mUVSOffset;
@ -385,9 +379,7 @@ protected:
mIgnoreGSUB(false),
mSVGInitialized(false),
mWeight(500), mStretch(NS_FONT_STRETCH_NORMAL),
#ifdef MOZ_GRAPHITE
mCheckedForGraphiteTables(false),
#endif
mHasCmapTable(false),
mUVSOffset(0), mUVSData(nullptr),
mUserFontData(nullptr),
@ -400,9 +392,7 @@ protected:
return nullptr;
}
#ifdef MOZ_GRAPHITE
virtual void CheckForGraphiteTables();
#endif
private:
@ -1274,12 +1264,10 @@ public:
return mFontEntry->HasCmapTable();
}
#ifdef MOZ_GRAPHITE
// check whether this is an sfnt we can potentially use with Graphite
bool FontCanSupportGraphite() {
return mFontEntry->HasGraphiteTables();
}
#endif
// Access to raw font table data (needed for Harfbuzz):
// returns a pointer to data owned by the fontEntry or the OS,
@ -1733,9 +1721,8 @@ protected:
// of the text run being shaped
nsAutoPtr<gfxFontShaper> mPlatformShaper;
nsAutoPtr<gfxFontShaper> mHarfBuzzShaper;
#ifdef MOZ_GRAPHITE
nsAutoPtr<gfxFontShaper> mGraphiteShaper;
#endif
mozilla::RefPtr<mozilla::gfx::ScaledFont> mAzureScaledFont;
// Create a default platform text shaper for this font.

View File

@ -8,9 +8,7 @@
#include "gfxUniscribeShaper.h"
#include "gfxHarfBuzzShaper.h"
#include <algorithm>
#ifdef MOZ_GRAPHITE
#include "gfxGraphiteShaper.h"
#endif
#include "gfxWindowsPlatform.h"
#include "gfxContext.h"
@ -45,11 +43,9 @@ gfxGDIFont::gfxGDIFont(GDIFontEntry *aFontEntry,
mSpaceGlyph(0),
mNeedsBold(aNeedsBold)
{
#ifdef MOZ_GRAPHITE
if (FontCanSupportGraphite()) {
mGraphiteShaper = new gfxGraphiteShaper(this);
}
#endif
if (FontCanSupportHarfBuzz()) {
mHarfBuzzShaper = new gfxHarfBuzzShaper(this);
}
@ -133,13 +129,11 @@ gfxGDIFont::ShapeText(gfxContext *aContext,
return false;
}
#ifdef MOZ_GRAPHITE
if (mGraphiteShaper && gfxPlatform::GetPlatform()->UseGraphiteShaping()) {
ok = mGraphiteShaper->ShapeText(aContext, aText,
aOffset, aLength,
aScript, aShapedText);
}
#endif
if (!ok && mHarfBuzzShaper) {
if (gfxPlatform::GetPlatform()->UseHarfBuzzForScript(aScript)) {

View File

@ -7,9 +7,7 @@
#include "gfxCoreTextShaper.h"
#include "gfxHarfBuzzShaper.h"
#include <algorithm>
#ifdef MOZ_GRAPHITE
#include "gfxGraphiteShaper.h"
#endif
#include "gfxPlatformMac.h"
#include "gfxContext.h"
#include "gfxFontUtils.h"
@ -100,11 +98,9 @@ gfxMacFont::gfxMacFont(MacOSFontEntry *aFontEntry, const gfxFontStyle *aFontStyl
#endif
}
#ifdef MOZ_GRAPHITE
if (FontCanSupportGraphite()) {
mGraphiteShaper = new gfxGraphiteShaper(this);
}
#endif
if (FontCanSupportHarfBuzz()) {
mHarfBuzzShaper = new gfxHarfBuzzShaper(this);
}

View File

@ -263,20 +263,12 @@ MacOSFontEntry::ReadCMAP()
unicodeFont, symbolFont);
}
if (NS_SUCCEEDED(rv)) {
#ifdef MOZ_GRAPHITE
// TODO: when we remove the MOZ_GRAPHITE conditional,
// we can merge this into the preceding if().
// Hence not (temporarily) indenting the code below
// by an extra level, only to undo that next time we
// touch it.
//
if (NS_SUCCEEDED(rv) && !HasGraphiteTables()) {
// We assume a Graphite font knows what it's doing,
// and provides whatever shaping is needed for the
// characters it supports, so only check/clear the
// complex-script ranges for non-Graphite fonts
if (!HasGraphiteTables()) {
#endif
// for layout support, check for the presence of mort/morx and/or
// opentype layout tables
bool hasAATLayout = HasFontTable(TRUETYPE_TAG('m','o','r','x')) ||
@ -311,9 +303,6 @@ MacOSFontEntry::ReadCMAP()
charmap->ClearRange(sr.rangeStart, sr.rangeEnd);
}
}
#ifdef MOZ_GRAPHITE
}
#endif
}
mHasCmapTable = NS_SUCCEEDED(rv);

View File

@ -27,9 +27,7 @@
#include "harfbuzz/hb.h"
#include "harfbuzz/hb-ot.h"
#include "gfxHarfBuzzShaper.h"
#ifdef MOZ_GRAPHITE
#include "gfxGraphiteShaper.h"
#endif
#include "nsUnicodeProperties.h"
#include "nsUnicodeScriptCodes.h"
#include "gfxFontconfigUtils.h"
@ -193,9 +191,7 @@ protected:
{
}
#ifdef MOZ_GRAPHITE
virtual void CheckForGraphiteTables();
#endif
// One pattern is the common case and some subclasses rely on successful
// addition of the first element to the array.
@ -232,7 +228,6 @@ gfxFcFontEntry::RealFaceName()
return gfxFontEntry::RealFaceName();
}
#ifdef MOZ_GRAPHITE
void
gfxFcFontEntry::CheckForGraphiteTables()
{
@ -243,7 +238,6 @@ gfxFcFontEntry::CheckForGraphiteTables()
FC_CAPABILITY, 0, &capability) == FcResultMatch &&
FcStrStr(capability, gfxFontconfigUtils::ToFcChar8("ttable:Silf"));
}
#endif
bool
gfxFcFontEntry::ShouldUseHarfBuzz(int32_t aRunScript) {
@ -2233,7 +2227,6 @@ gfxFcFont::ShapeText(gfxContext *aContext,
bool ok = false;
#ifdef MOZ_GRAPHITE
if (FontCanSupportGraphite()) {
if (gfxPlatform::GetPlatform()->UseGraphiteShaping()) {
if (!mGraphiteShaper) {
@ -2243,7 +2236,6 @@ gfxFcFont::ShapeText(gfxContext *aContext,
aScript, aShapedText);
}
}
#endif
if (!ok && fontEntry->ShouldUseHarfBuzz(aScript)) {
if (!mHarfBuzzShaper) {

View File

@ -40,9 +40,7 @@
#include "gfxUserFontSet.h"
#include "nsUnicodeProperties.h"
#include "harfbuzz/hb.h"
#ifdef MOZ_GRAPHITE
#include "gfxGraphiteShaper.h"
#endif
#include "nsUnicodeRange.h"
#include "nsServiceManagerUtils.h"
@ -136,9 +134,7 @@ SRGBOverrideObserver::Observe(nsISupports *aSubject,
#define GFX_PREF_OPENTYPE_SVG "gfx.font_rendering.opentype_svg.enabled"
#ifdef MOZ_GRAPHITE
#define GFX_PREF_GRAPHITE_SHAPING "gfx.font_rendering.graphite.enabled"
#endif
#define BIDI_NUMERAL_PREF "bidi.numeral"
@ -241,9 +237,7 @@ gfxPlatform::gfxPlatform()
mAllowDownloadableFonts = UNINITIALIZED_VALUE;
mFallbackUsesCmaps = UNINITIALIZED_VALUE;
#ifdef MOZ_GRAPHITE
mGraphiteShapingEnabled = UNINITIALIZED_VALUE;
#endif
mBidiNumeralOption = UNINITIALIZED_VALUE;
uint32_t canvasMask = (1 << BACKEND_CAIRO) | (1 << BACKEND_SKIA);
@ -393,9 +387,7 @@ gfxPlatform::Shutdown()
// started up. That's OK, they can handle it.
gfxFontCache::Shutdown();
gfxFontGroup::Shutdown();
#ifdef MOZ_GRAPHITE
gfxGraphiteShaper::Shutdown();
#endif
#if defined(XP_MACOSX) || defined(XP_WIN) // temporary, until this is implemented on others
gfxPlatformFontList::Shutdown();
#endif
@ -828,7 +820,6 @@ gfxPlatform::UseCmapsDuringSystemFallback()
return mFallbackUsesCmaps;
}
#ifdef MOZ_GRAPHITE
bool
gfxPlatform::UseGraphiteShaping()
{
@ -839,7 +830,6 @@ gfxPlatform::UseGraphiteShaping()
return mGraphiteShapingEnabled;
}
#endif
bool
gfxPlatform::UseHarfBuzzForScript(int32_t aScriptCode)
@ -1608,7 +1598,6 @@ gfxPlatform::FontsPrefsChanged(const char *aPref)
mAllowDownloadableFonts = UNINITIALIZED_VALUE;
} else if (!strcmp(GFX_PREF_FALLBACK_USE_CMAPS, aPref)) {
mFallbackUsesCmaps = UNINITIALIZED_VALUE;
#ifdef MOZ_GRAPHITE
} else if (!strcmp(GFX_PREF_GRAPHITE_SHAPING, aPref)) {
mGraphiteShapingEnabled = UNINITIALIZED_VALUE;
gfxFontCache *fontCache = gfxFontCache::GetCache();
@ -1616,7 +1605,6 @@ gfxPlatform::FontsPrefsChanged(const char *aPref)
fontCache->AgeAllGenerations();
fontCache->FlushShapedWordCaches();
}
#endif
} else if (!strcmp(GFX_PREF_HARFBUZZ_SCRIPTS, aPref)) {
mUseHarfBuzzScripts = UNINITIALIZED_VALUE;
gfxFontCache *fontCache = gfxFontCache::GetCache();

View File

@ -352,13 +352,11 @@ public:
*/
bool UseCmapsDuringSystemFallback();
#ifdef MOZ_GRAPHITE
/**
* Whether to use the SIL Graphite rendering engine
* (for fonts that include Graphite tables)
*/
bool UseGraphiteShaping();
#endif
/**
* Whether to use the harfbuzz shaper (depending on script complexity).
@ -565,9 +563,7 @@ protected:
}
int8_t mAllowDownloadableFonts;
#ifdef MOZ_GRAPHITE
int8_t mGraphiteShapingEnabled;
#endif
int8_t mBidiNumeralOption;

View File

@ -306,11 +306,6 @@ gfxUserFontSet::SanitizeOpenTypeData(gfxMixedFontFamily *aFamily,
// limit output/expansion to 256MB
ExpandingMemoryStream output(aIsCompressed ? aLength * 2 : aLength,
1024 * 1024 * 256);
#ifdef MOZ_GRAPHITE
#define PRESERVE_GRAPHITE true
#else
#define PRESERVE_GRAPHITE false
#endif
#ifdef MOZ_OTS_REPORT_ERRORS
OTSCallbackUserData userData;
@ -324,7 +319,7 @@ gfxUserFontSet::SanitizeOpenTypeData(gfxMixedFontFamily *aFamily,
if (ots::Process(&output, aData, aLength,
ERROR_REPORTING_ARGS
PRESERVE_GRAPHITE)) {
true)) {
aSaneLength = output.Tell();
return static_cast<uint8_t*>(output.forget());
} else {

View File

@ -20,6 +20,7 @@ endif
SHARED_LIBRARY_LIBS = \
$(MOZ_OTS_LIBS) \
$(QCMS_LIBS) \
$(MOZ_GRAPHITE_LIBS) \
$(MOZ_HARFBUZZ_LIBS) \
$(NULL)
@ -31,10 +32,6 @@ ifdef MOZ_TREE_PIXMAN
SHARED_LIBRARY_LIBS += $(MOZ_PIXMAN_LIBS)
endif
ifdef MOZ_GRAPHITE
SHARED_LIBRARY_LIBS += $(MOZ_GRAPHITE_LIBS)
endif
ifdef MOZ_VORBIS
SHARED_LIBRARY_LIBS += \
$(DEPTH)/media/libvorbis/lib/$(LIB_PREFIX)vorbis.$(LIB_SUFFIX) \

View File

@ -232,9 +232,7 @@ pref("gfx.filter.nearest.force-enabled", false);
// whether to always search all font cmaps during system font fallback
pref("gfx.font_rendering.fallback.always_use_cmaps", false);
#ifdef MOZ_GRAPHITE
pref("gfx.font_rendering.graphite.enabled", false);
#endif
// Check intl/unicharutil/util/nsUnicodeProperties.h for definitions of script bits
// in the ShapingType enumeration

View File

@ -124,6 +124,7 @@ MAKEFILES_gfx="
gfx/2d/Makefile
gfx/angle/Makefile
gfx/gl/Makefile
gfx/graphite2/src/Makefile
gfx/harfbuzz/src/Makefile
gfx/ipc/Makefile
gfx/layers/Makefile
@ -1336,12 +1337,6 @@ if [ "$MOZ_FEEDS" ]; then
"
fi
if [ "$MOZ_GRAPHITE" ]; then
add_makefiles "
gfx/graphite2/src/Makefile
"
fi
if [ "$MOZ_HELP_VIEWER" ]; then
add_makefiles "
toolkit/components/help/Makefile