Bug 1018034 - Remove the "gfx.font_rendering.harfbuzz.scripts" pref. r=jfkthame

This commit is contained in:
Masatoshi Kimura 2014-05-31 15:11:29 +09:00
Родитель ecd7363a4a
Коммит 41e75a3dbc
8 изменённых файлов: 23 добавлений и 140 удалений

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

@ -65,7 +65,7 @@ gfxFT2Font::ShapeText(gfxContext *aContext,
}
}
if (!ok && gfxPlatform::GetPlatform()->UseHarfBuzzForScript(aScript)) {
if (!ok) {
if (!mHarfBuzzShaper) {
mHarfBuzzShaper = new gfxHarfBuzzShaper(this);
}

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

@ -3970,10 +3970,8 @@ gfxFont::ShapeText(gfxContext *aContext,
}
if (!ok && mHarfBuzzShaper && !aPreferPlatformShaping) {
if (gfxPlatform::GetPlatform()->UseHarfBuzzForScript(aScript)) {
ok = mHarfBuzzShaper->ShapeText(aContext, aText, aOffset, aLength,
aScript, aShapedText);
}
ok = mHarfBuzzShaper->ShapeText(aContext, aText, aOffset, aLength,
aScript, aShapedText);
}
if (!ok) {

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

@ -143,8 +143,6 @@ NS_IMPL_ISUPPORTS(SRGBOverrideObserver, nsIObserver, nsISupportsWeakReference)
#define GFX_DOWNLOADABLE_FONTS_ENABLED "gfx.downloadable_fonts.enabled"
#define GFX_PREF_HARFBUZZ_SCRIPTS "gfx.font_rendering.harfbuzz.scripts"
#define HARFBUZZ_SCRIPTS_DEFAULT mozilla::unicode::SHAPING_DEFAULT
#define GFX_PREF_FALLBACK_USE_CMAPS "gfx.font_rendering.fallback.always_use_cmaps"
#define GFX_PREF_OPENTYPE_SVG "gfx.font_rendering.opentype_svg.enabled"
@ -262,7 +260,6 @@ gfxPlatform::gfxPlatform()
: mAzureCanvasBackendCollector(MOZ_THIS_IN_INITIALIZER_LIST(),
&gfxPlatform::GetAzureBackendInfo)
{
mUseHarfBuzzScripts = UNINITIALIZED_VALUE;
mAllowDownloadableFonts = UNINITIALIZED_VALUE;
mFallbackUsesCmaps = UNINITIALIZED_VALUE;
@ -1123,18 +1120,6 @@ gfxPlatform::UseGraphiteShaping()
return mGraphiteShapingEnabled;
}
bool
gfxPlatform::UseHarfBuzzForScript(int32_t aScriptCode)
{
if (mUseHarfBuzzScripts == UNINITIALIZED_VALUE) {
mUseHarfBuzzScripts = Preferences::GetInt(GFX_PREF_HARFBUZZ_SCRIPTS, HARFBUZZ_SCRIPTS_DEFAULT);
}
int32_t shapingType = mozilla::unicode::ScriptShapingType(aScriptCode);
return (mUseHarfBuzzScripts & shapingType) != 0;
}
gfxFontEntry*
gfxPlatform::MakePlatformFont(const gfxProxyFontEntry *aProxyEntry,
const uint8_t *aFontData,
@ -1868,9 +1853,6 @@ gfxPlatform::FontsPrefsChanged(const char *aPref)
} else if (!strcmp(GFX_PREF_GRAPHITE_SHAPING, aPref)) {
mGraphiteShapingEnabled = UNINITIALIZED_VALUE;
FlushFontAndWordCaches();
} else if (!strcmp(GFX_PREF_HARFBUZZ_SCRIPTS, aPref)) {
mUseHarfBuzzScripts = UNINITIALIZED_VALUE;
FlushFontAndWordCaches();
} else if (!strcmp(BIDI_NUMERAL_PREF, aPref)) {
mBidiNumeralOption = UNINITIALIZED_VALUE;
} else if (!strcmp(GFX_PREF_OPENTYPE_SVG, aPref)) {

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

@ -407,13 +407,6 @@ public:
*/
bool UseGraphiteShaping();
/**
* Whether to use the harfbuzz shaper (depending on script complexity).
*
* This allows harfbuzz to be enabled selectively via the preferences.
*/
bool UseHarfBuzzForScript(int32_t aScriptCode);
// check whether format is supported on a platform or not (if unclear, returns true)
virtual bool IsFontFormatSupported(nsIURI *aFontURI, uint32_t aFormatFlags) { return false; }
@ -641,9 +634,6 @@ protected:
// when doing system font fallback
int8_t mFallbackUsesCmaps;
// which scripts should be shaped with harfbuzz
int32_t mUseHarfBuzzScripts;
// max character limit for words in word cache
int32_t mWordCacheCharLimit;

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

@ -249,64 +249,6 @@ IsClusterExtender(uint32_t aCh, uint8_t aCategory)
(aCh >= 0xff9e && aCh <= 0xff9f)); // katakana sound marks
}
// TODO: replace this with a properties file or similar;
// expect this to evolve as harfbuzz shaping support matures.
//
// The "shaping type" of each script run, as returned by this
// function, is compared to the bits set in the
// gfx.font_rendering.harfbuzz.scripts
// preference to decide whether to use the harfbuzz shaper.
//
int32_t
ScriptShapingType(int32_t aScriptCode)
{
switch (aScriptCode) {
default:
return SHAPING_DEFAULT; // scripts not explicitly listed here are
// assumed to just use default shaping
case MOZ_SCRIPT_ARABIC:
case MOZ_SCRIPT_SYRIAC:
case MOZ_SCRIPT_NKO:
case MOZ_SCRIPT_MANDAIC:
return SHAPING_ARABIC; // bidi scripts with Arabic-style shaping
case MOZ_SCRIPT_HEBREW:
return SHAPING_HEBREW;
case MOZ_SCRIPT_HANGUL:
return SHAPING_HANGUL;
case MOZ_SCRIPT_MONGOLIAN: // to be supported by the Arabic shaper?
return SHAPING_MONGOLIAN;
case MOZ_SCRIPT_THAI: // no complex OT features, but MS engines like to do
// sequence checking
return SHAPING_THAI;
case MOZ_SCRIPT_BENGALI:
case MOZ_SCRIPT_DEVANAGARI:
case MOZ_SCRIPT_GUJARATI:
case MOZ_SCRIPT_GURMUKHI:
case MOZ_SCRIPT_KANNADA:
case MOZ_SCRIPT_MALAYALAM:
case MOZ_SCRIPT_ORIYA:
case MOZ_SCRIPT_SINHALA:
case MOZ_SCRIPT_TAMIL:
case MOZ_SCRIPT_TELUGU:
case MOZ_SCRIPT_KHMER:
case MOZ_SCRIPT_LAO:
case MOZ_SCRIPT_TIBETAN:
case MOZ_SCRIPT_NEW_TAI_LUE:
case MOZ_SCRIPT_TAI_LE:
case MOZ_SCRIPT_MYANMAR:
case MOZ_SCRIPT_PHAGS_PA:
case MOZ_SCRIPT_BATAK:
case MOZ_SCRIPT_BRAHMI:
return SHAPING_INDIC; // scripts that require Indic or other "special" shaping
}
}
void
ClusterIterator::Next()
{

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

@ -119,18 +119,6 @@ uint32_t GetLowercase(uint32_t aCh);
uint32_t GetTitlecaseForLower(uint32_t aCh); // maps LC to titlecase, UC unchanged
uint32_t GetTitlecaseForAll(uint32_t aCh); // maps both UC and LC to titlecase
enum ShapingType {
SHAPING_DEFAULT = 0x0001,
SHAPING_ARABIC = 0x0002,
SHAPING_HEBREW = 0x0004,
SHAPING_HANGUL = 0x0008,
SHAPING_MONGOLIAN = 0x0010,
SHAPING_INDIC = 0x0020,
SHAPING_THAI = 0x0040
};
int32_t ScriptShapingType(int32_t aScriptCode);
// A simple iterator for a string of char16_t codepoints that advances
// by Unicode grapheme clusters
class ClusterIterator

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

@ -1,22 +1,22 @@
skip-if(B2G) pref(gfx.font_rendering.harfbuzz.scripts,-1) HTTP(..) == devanagari-1a.html devanagari-1-ref.html
pref(gfx.font_rendering.harfbuzz.scripts,-1) HTTP(..) != devanagari-1b.html devanagari-1-ref.html
pref(gfx.font_rendering.harfbuzz.scripts,-1) HTTP(..) == devanagari-2.html devanagari-2-ref.html
pref(gfx.font_rendering.harfbuzz.scripts,-1) HTTP(..) != devanagari-3a.html devanagari-3-ref.html
pref(gfx.font_rendering.harfbuzz.scripts,-1) HTTP(..) == devanagari-3b.html devanagari-3-ref.html
pref(gfx.font_rendering.harfbuzz.scripts,-1) HTTP(..) != devanagari-4.html devanagari-4-notref.html
skip-if(B2G) HTTP(..) == devanagari-1a.html devanagari-1-ref.html
HTTP(..) != devanagari-1b.html devanagari-1-ref.html
HTTP(..) == devanagari-2.html devanagari-2-ref.html
HTTP(..) != devanagari-3a.html devanagari-3-ref.html
HTTP(..) == devanagari-3b.html devanagari-3-ref.html
HTTP(..) != devanagari-4.html devanagari-4-notref.html
pref(gfx.font_rendering.harfbuzz.scripts,-1) HTTP(..) == gujarati-1a.html gujarati-1-ref.html
pref(gfx.font_rendering.harfbuzz.scripts,-1) HTTP(..) != gujarati-1b.html gujarati-1-ref.html
pref(gfx.font_rendering.harfbuzz.scripts,-1) HTTP(..) == gujarati-2.html gujarati-2-ref.html
pref(gfx.font_rendering.harfbuzz.scripts,-1) HTTP(..) != gujarati-3a.html gujarati-3-ref.html
skip-if(B2G) pref(gfx.font_rendering.harfbuzz.scripts,-1) HTTP(..) == gujarati-3b.html gujarati-3-ref.html
pref(gfx.font_rendering.harfbuzz.scripts,-1) HTTP(..) != gujarati-4.html gujarati-4-notref.html
HTTP(..) == gujarati-1a.html gujarati-1-ref.html
HTTP(..) != gujarati-1b.html gujarati-1-ref.html
HTTP(..) == gujarati-2.html gujarati-2-ref.html
HTTP(..) != gujarati-3a.html gujarati-3-ref.html
skip-if(B2G) HTTP(..) == gujarati-3b.html gujarati-3-ref.html
HTTP(..) != gujarati-4.html gujarati-4-notref.html
skip-if(B2G) pref(gfx.font_rendering.harfbuzz.scripts,-1) HTTP(..) == bengali-1a.html bengali-1-ref.html
pref(gfx.font_rendering.harfbuzz.scripts,-1) HTTP(..) != bengali-1b.html bengali-1-ref.html
pref(gfx.font_rendering.harfbuzz.scripts,-1) HTTP(..) != bengali-2a.html bengali-2-ref.html
pref(gfx.font_rendering.harfbuzz.scripts,-1) HTTP(..) != bengali-2b.html bengali-2-ref.html
skip-if(B2G) pref(gfx.font_rendering.harfbuzz.scripts,-1) HTTP(..) == bengali-3a.html bengali-3-ref.html
pref(gfx.font_rendering.harfbuzz.scripts,-1) HTTP(..) != bengali-3b.html bengali-3-ref.html
pref(gfx.font_rendering.harfbuzz.scripts,-1) HTTP(..) != bengali-3c.html bengali-3-ref.html
pref(gfx.font_rendering.harfbuzz.scripts,-1) HTTP(..) != bengali-3c.html bengali-3b.html
skip-if(B2G) HTTP(..) == bengali-1a.html bengali-1-ref.html
HTTP(..) != bengali-1b.html bengali-1-ref.html
HTTP(..) != bengali-2a.html bengali-2-ref.html
HTTP(..) != bengali-2b.html bengali-2-ref.html
skip-if(B2G) HTTP(..) == bengali-3a.html bengali-3-ref.html
HTTP(..) != bengali-3b.html bengali-3-ref.html
HTTP(..) != bengali-3c.html bengali-3-ref.html
HTTP(..) != bengali-3c.html bengali-3b.html

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

@ -424,23 +424,6 @@ pref("gfx.font_rendering.wordcache.maxentries", 10000);
pref("gfx.font_rendering.graphite.enabled", true);
// Check intl/unicharutil/util/nsUnicodeProperties.h for definitions of script bits
// in the ShapingType enumeration
// Currently-defined bits:
// SHAPING_DEFAULT = 0x0001,
// SHAPING_ARABIC = 0x0002,
// SHAPING_HEBREW = 0x0004,
// SHAPING_HANGUL = 0x0008,
// SHAPING_MONGOLIAN = 0x0010,
// SHAPING_INDIC = 0x0020,
// SHAPING_THAI = 0x0040
// (see http://mxr.mozilla.org/mozilla-central/ident?i=ShapingType)
// Scripts not listed are grouped in the default category.
// Set the pref to 255 to have all text shaped via the harfbuzz backend.
// Default setting:
// We use harfbuzz for all scripts (except when using AAT fonts on OS X).
pref("gfx.font_rendering.harfbuzz.scripts", 255);
#ifdef XP_WIN
pref("gfx.font_rendering.directwrite.enabled", false);
pref("gfx.font_rendering.directwrite.use_gdi_table_loading", true);