зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1454598 - part 4 - Disable font variations on macOS Sierra due to Core Text unreliability. r=jwatt
This commit is contained in:
Родитель
c57f185cd9
Коммит
2a3d1d4598
|
@ -1066,6 +1066,10 @@ gfxFontconfigFontEntry::HasVariations()
|
|||
mHasVariationsInitialized = true;
|
||||
mHasVariations = false;
|
||||
|
||||
if (!gfxPlatform::GetPlatform()->HasVariationFontSupport()) {
|
||||
return mHasVariations;
|
||||
}
|
||||
|
||||
// For installed fonts, query the fontconfig pattern rather than paying
|
||||
// the cost of loading a FT_Face that we otherwise might never need.
|
||||
if (!IsUserFont() || IsLocalUserFont()) {
|
||||
|
@ -1208,7 +1212,10 @@ gfxFontconfigFontFamily::FindStyleVariations(FontInfoData *aFontInfoData)
|
|||
|
||||
gfxFontconfigFontEntry *fontEntry =
|
||||
new gfxFontconfigFontEntry(faceName, face, mContainsAppFonts);
|
||||
fontEntry->SetupVariationRanges();
|
||||
|
||||
if (gfxPlatform::GetPlatform()->HasVariationFontSupport()) {
|
||||
fontEntry->SetupVariationRanges();
|
||||
}
|
||||
|
||||
AddFontEntry(fontEntry);
|
||||
|
||||
|
|
|
@ -1035,7 +1035,8 @@ gfxFontEntry::GetColorLayersInfo(uint32_t aGlyphId,
|
|||
void
|
||||
gfxFontEntry::SetupVariationRanges()
|
||||
{
|
||||
if (!HasVariations() || IsUserFont()) {
|
||||
if (!gfxPlatform::GetPlatform()->HasVariationFontSupport() ||
|
||||
!HasVariations() || IsUserFont()) {
|
||||
return;
|
||||
}
|
||||
AutoTArray<gfxFontVariationAxis,4> axes;
|
||||
|
@ -1097,6 +1098,10 @@ void
|
|||
gfxFontEntry::GetVariationsForStyle(nsTArray<gfxFontVariation>& aResult,
|
||||
const gfxFontStyle& aStyle)
|
||||
{
|
||||
if (!gfxPlatform::GetPlatform()->HasVariationFontSupport()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Resolve high-level CSS properties from the requested style
|
||||
// (font-{style,weight,stretch}) to the appropriate variations.
|
||||
float clampedWeight = Weight().Clamp(aStyle.weight).ToFloat();
|
||||
|
|
|
@ -288,7 +288,9 @@ MacOSFontEntry::HasVariations()
|
|||
{
|
||||
if (!mHasVariationsInitialized) {
|
||||
mHasVariationsInitialized = true;
|
||||
mHasVariations = HasFontTable(TRUETYPE_TAG('f','v','a','r'));
|
||||
mHasVariations =
|
||||
gfxPlatform::GetPlatform()->HasVariationFontSupport() &&
|
||||
HasFontTable(TRUETYPE_TAG('f','v','a','r'));
|
||||
}
|
||||
|
||||
return mHasVariations;
|
||||
|
@ -929,7 +931,9 @@ gfxMacFontFamily::FindStyleVariations(FontInfoData *aFontInfoData)
|
|||
fontEntry->mFixedPitch = true;
|
||||
}
|
||||
|
||||
fontEntry->SetupVariationRanges();
|
||||
if (gfxPlatform::GetPlatform()->HasVariationFontSupport()) {
|
||||
fontEntry->SetupVariationRanges();
|
||||
}
|
||||
|
||||
if (LOG_FONTLIST_ENABLED()) {
|
||||
nsAutoCString weightString;
|
||||
|
|
|
@ -778,6 +778,9 @@ gfxPlatform::Init()
|
|||
Factory::SetFTLibrary(gPlatform->GetFTLibrary());
|
||||
#endif
|
||||
|
||||
gPlatform->mHasVariationFontSupport =
|
||||
gPlatform->CheckVariationFontSupport();
|
||||
|
||||
nsresult rv;
|
||||
rv = gfxPlatformFontList::Init();
|
||||
if (NS_FAILED(rv)) {
|
||||
|
@ -851,7 +854,7 @@ gfxPlatform::Init()
|
|||
if (XRE_IsParentProcess()) {
|
||||
gfxVars::SetDXInterop2Blocked(IsDXInterop2Blocked());
|
||||
Preferences::Unlock(FONT_VARIATIONS_PREF);
|
||||
if (!gPlatform->CheckVariationFontSupport()) {
|
||||
if (!gPlatform->HasVariationFontSupport()) {
|
||||
// Ensure variation fonts are disabled and the pref is locked.
|
||||
Preferences::SetBool(FONT_VARIATIONS_PREF, false,
|
||||
PrefValueKind::Default);
|
||||
|
|
|
@ -724,6 +724,10 @@ public:
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
bool HasVariationFontSupport() const {
|
||||
return mHasVariationFontSupport;
|
||||
}
|
||||
|
||||
// you probably want to use gfxVars::UseWebRender() instead of this
|
||||
static bool WebRenderPrefEnabled();
|
||||
// you probably want to use gfxVars::UseWebRender() instead of this
|
||||
|
@ -814,6 +818,9 @@ protected:
|
|||
// when doing system font fallback
|
||||
int8_t mFallbackUsesCmaps;
|
||||
|
||||
// Whether the platform supports rendering OpenType font variations
|
||||
bool mHasVariationFontSupport;
|
||||
|
||||
// max character limit for words in word cache
|
||||
int32_t mWordCacheCharLimit;
|
||||
|
||||
|
|
|
@ -639,8 +639,9 @@ gfxPlatformMac::GetPlatformCMSOutputProfile(void* &mem, size_t &size)
|
|||
bool
|
||||
gfxPlatformMac::CheckVariationFontSupport()
|
||||
{
|
||||
// We don't allow variation fonts to be enabled before 10.12,
|
||||
// We don't allow variation fonts to be enabled before 10.13,
|
||||
// as although the Core Text APIs existed, they are known to be
|
||||
// fairly buggy.
|
||||
return nsCocoaFeatures::OnSierraOrLater();
|
||||
// (Note that Safari also requires 10.13 for variation-font support.)
|
||||
return nsCocoaFeatures::OnHighSierraOrLater();
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче