mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-07 18:04:46 +00:00
Bug 1285533. Remove non-fontconfig platform fontlist codepath. r=lsalzman
This has been disabled for two years. It's time for it to die.
This commit is contained in:
parent
baebc83432
commit
49eb5ba0b6
@ -18,10 +18,6 @@
|
||||
#include "mozilla/AppUnits.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
|
||||
#if defined(MOZ_WIDGET_GTK)
|
||||
#include "gfxPlatformGtk.h" // xxx - for UseFcFontList
|
||||
#endif
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
@ -652,28 +648,14 @@ TextAttrsMgr::FontWeightTextAttr::
|
||||
if (font->IsSyntheticBold())
|
||||
return 700;
|
||||
|
||||
bool useFontEntryWeight = true;
|
||||
|
||||
// Under Linux, when gfxPangoFontGroup code is used,
|
||||
// font->GetStyle()->weight will give the absolute weight requested of the
|
||||
// font face. The gfxPangoFontGroup code uses the gfxFontEntry constructor
|
||||
// which doesn't initialize the weight field.
|
||||
#if defined(MOZ_WIDGET_GTK)
|
||||
useFontEntryWeight = gfxPlatformGtk::UseFcFontList();
|
||||
#endif
|
||||
|
||||
if (useFontEntryWeight) {
|
||||
// On Windows, font->GetStyle()->weight will give the same weight as
|
||||
// fontEntry->Weight(), the weight of the first font in the font group,
|
||||
// which may not be the weight of the font face used to render the
|
||||
// characters. On Mac, font->GetStyle()->weight will just give the same
|
||||
// number as getComputedStyle(). fontEntry->Weight() will give the weight
|
||||
// of the font face used.
|
||||
gfxFontEntry *fontEntry = font->GetFontEntry();
|
||||
return fontEntry->Weight();
|
||||
} else {
|
||||
return font->GetStyle()->weight;
|
||||
}
|
||||
// On Windows, font->GetStyle()->weight will give the same weight as
|
||||
// fontEntry->Weight(), the weight of the first font in the font group,
|
||||
// which may not be the weight of the font face used to render the
|
||||
// characters. On Mac, font->GetStyle()->weight will just give the same
|
||||
// number as getComputedStyle(). fontEntry->Weight() will give the weight
|
||||
// of the font face used.
|
||||
gfxFontEntry *fontEntry = font->GetFontEntry();
|
||||
return fontEntry->Weight();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -88,10 +88,6 @@
|
||||
#include "GLContextProvider.h"
|
||||
#include "mozilla/gfx/Logging.h"
|
||||
|
||||
#if defined(MOZ_WIDGET_GTK)
|
||||
#include "gfxPlatformGtk.h" // xxx - for UseFcFontList
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
#include "TexturePoolOGL.h"
|
||||
#include "mozilla/layers/UiCompositorControllerChild.h"
|
||||
@ -711,17 +707,9 @@ gfxPlatform::Init()
|
||||
gPlatform->ComputeTileSize();
|
||||
|
||||
nsresult rv;
|
||||
|
||||
bool usePlatformFontList = true;
|
||||
#if defined(MOZ_WIDGET_GTK)
|
||||
usePlatformFontList = gfxPlatformGtk::UseFcFontList();
|
||||
#endif
|
||||
|
||||
if (usePlatformFontList) {
|
||||
rv = gfxPlatformFontList::Init();
|
||||
if (NS_FAILED(rv)) {
|
||||
MOZ_CRASH("Could not initialize gfxPlatformFontList");
|
||||
}
|
||||
rv = gfxPlatformFontList::Init();
|
||||
if (NS_FAILED(rv)) {
|
||||
MOZ_CRASH("Could not initialize gfxPlatformFontList");
|
||||
}
|
||||
|
||||
gPlatform->mScreenReferenceSurface =
|
||||
|
@ -67,23 +67,14 @@ using namespace mozilla;
|
||||
using namespace mozilla::gfx;
|
||||
using namespace mozilla::unicode;
|
||||
|
||||
gfxFontconfigUtils *gfxPlatformGtk::sFontconfigUtils = nullptr;
|
||||
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
static cairo_user_data_key_t cairo_gdk_drawable_key;
|
||||
#endif
|
||||
|
||||
bool gfxPlatformGtk::sUseFcFontList = false;
|
||||
|
||||
gfxPlatformGtk::gfxPlatformGtk()
|
||||
{
|
||||
gtk_init(nullptr, nullptr);
|
||||
|
||||
sUseFcFontList = mozilla::Preferences::GetBool("gfx.font_rendering.fontconfig.fontlist.enabled");
|
||||
if (!sUseFcFontList && !sFontconfigUtils) {
|
||||
sFontconfigUtils = gfxFontconfigUtils::GetFontconfigUtils();
|
||||
}
|
||||
|
||||
mMaxGenericSubstitutions = UNINITIALIZED_VALUE;
|
||||
|
||||
#ifdef MOZ_X11
|
||||
@ -117,12 +108,6 @@ gfxPlatformGtk::gfxPlatformGtk()
|
||||
|
||||
gfxPlatformGtk::~gfxPlatformGtk()
|
||||
{
|
||||
if (!sUseFcFontList) {
|
||||
gfxFontconfigUtils::Shutdown();
|
||||
sFontconfigUtils = nullptr;
|
||||
gfxPangoFontGroup::Shutdown();
|
||||
}
|
||||
|
||||
#ifdef MOZ_X11
|
||||
if (mCompositorDisplay) {
|
||||
XCloseDisplay(mCompositorDisplay);
|
||||
@ -200,27 +185,17 @@ gfxPlatformGtk::GetFontList(nsIAtom *aLangGroup,
|
||||
const nsACString& aGenericFamily,
|
||||
nsTArray<nsString>& aListOfFonts)
|
||||
{
|
||||
if (sUseFcFontList) {
|
||||
gfxPlatformFontList::PlatformFontList()->GetFontList(aLangGroup,
|
||||
aGenericFamily,
|
||||
aListOfFonts);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return sFontconfigUtils->GetFontList(aLangGroup,
|
||||
aGenericFamily,
|
||||
aListOfFonts);
|
||||
gfxPlatformFontList::PlatformFontList()->GetFontList(aLangGroup,
|
||||
aGenericFamily,
|
||||
aListOfFonts);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
gfxPlatformGtk::UpdateFontList()
|
||||
{
|
||||
if (sUseFcFontList) {
|
||||
gfxPlatformFontList::PlatformFontList()->UpdateFontList();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return sFontconfigUtils->UpdateFontList();
|
||||
gfxPlatformFontList::PlatformFontList()->UpdateFontList();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// xxx - this is ubuntu centric, need to go through other distros and flesh
|
||||
@ -287,13 +262,9 @@ gfxPlatformGtk::CreatePlatformFontList()
|
||||
nsresult
|
||||
gfxPlatformGtk::GetStandardFamilyName(const nsAString& aFontName, nsAString& aFamilyName)
|
||||
{
|
||||
if (sUseFcFontList) {
|
||||
gfxPlatformFontList::PlatformFontList()->
|
||||
GetStandardFamilyName(aFontName, aFamilyName);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return sFontconfigUtils->GetStandardFamilyName(aFontName, aFamilyName);
|
||||
gfxPlatformFontList::PlatformFontList()->
|
||||
GetStandardFamilyName(aFontName, aFamilyName);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
gfxFontGroup *
|
||||
@ -303,13 +274,8 @@ gfxPlatformGtk::CreateFontGroup(const FontFamilyList& aFontFamilyList,
|
||||
gfxUserFontSet* aUserFontSet,
|
||||
gfxFloat aDevToCssSize)
|
||||
{
|
||||
if (sUseFcFontList) {
|
||||
return new gfxFontGroup(aFontFamilyList, aStyle, aTextPerf,
|
||||
aUserFontSet, aDevToCssSize);
|
||||
}
|
||||
|
||||
return new gfxPangoFontGroup(aFontFamilyList, aStyle,
|
||||
aUserFontSet, aDevToCssSize);
|
||||
return new gfxFontGroup(aFontFamilyList, aStyle, aTextPerf,
|
||||
aUserFontSet, aDevToCssSize);
|
||||
}
|
||||
|
||||
gfxFontEntry*
|
||||
@ -318,14 +284,9 @@ gfxPlatformGtk::LookupLocalFont(const nsAString& aFontName,
|
||||
int16_t aStretch,
|
||||
uint8_t aStyle)
|
||||
{
|
||||
if (sUseFcFontList) {
|
||||
gfxPlatformFontList* pfl = gfxPlatformFontList::PlatformFontList();
|
||||
return pfl->LookupLocalFont(aFontName, aWeight, aStretch,
|
||||
aStyle);
|
||||
}
|
||||
|
||||
return gfxPangoFontGroup::NewFontEntry(aFontName, aWeight,
|
||||
aStretch, aStyle);
|
||||
gfxPlatformFontList* pfl = gfxPlatformFontList::PlatformFontList();
|
||||
return pfl->LookupLocalFont(aFontName, aWeight, aStretch,
|
||||
aStyle);
|
||||
}
|
||||
|
||||
gfxFontEntry*
|
||||
@ -336,26 +297,15 @@ gfxPlatformGtk::MakePlatformFont(const nsAString& aFontName,
|
||||
const uint8_t* aFontData,
|
||||
uint32_t aLength)
|
||||
{
|
||||
if (sUseFcFontList) {
|
||||
gfxPlatformFontList* pfl = gfxPlatformFontList::PlatformFontList();
|
||||
return pfl->MakePlatformFont(aFontName, aWeight, aStretch,
|
||||
aStyle, aFontData, aLength);
|
||||
}
|
||||
|
||||
// passing ownership of the font data to the new font entry
|
||||
return gfxPangoFontGroup::NewFontEntry(aFontName, aWeight,
|
||||
aStretch, aStyle,
|
||||
aFontData, aLength);
|
||||
gfxPlatformFontList* pfl = gfxPlatformFontList::PlatformFontList();
|
||||
return pfl->MakePlatformFont(aFontName, aWeight, aStretch,
|
||||
aStyle, aFontData, aLength);
|
||||
}
|
||||
|
||||
FT_Library
|
||||
gfxPlatformGtk::GetFTLibrary()
|
||||
{
|
||||
if (sUseFcFontList) {
|
||||
return gfxFcPlatformFontList::GetFTLibrary();
|
||||
}
|
||||
|
||||
return gfxPangoFontGroup::GetFTLibrary();
|
||||
return gfxFcPlatformFontList::GetFTLibrary();
|
||||
}
|
||||
|
||||
bool
|
||||
@ -447,11 +397,9 @@ void gfxPlatformGtk::FontsPrefsChanged(const char *aPref)
|
||||
}
|
||||
|
||||
mMaxGenericSubstitutions = UNINITIALIZED_VALUE;
|
||||
if (sUseFcFontList) {
|
||||
gfxFcPlatformFontList* pfl = gfxFcPlatformFontList::PlatformFontList();
|
||||
pfl->ClearGenericMappings();
|
||||
FlushFontAndWordCaches();
|
||||
}
|
||||
gfxFcPlatformFontList* pfl = gfxFcPlatformFontList::PlatformFontList();
|
||||
pfl->ClearGenericMappings();
|
||||
FlushFontAndWordCaches();
|
||||
}
|
||||
|
||||
uint32_t gfxPlatformGtk::MaxGenericSubstitions()
|
||||
|
@ -113,8 +113,6 @@ public:
|
||||
}
|
||||
#endif
|
||||
|
||||
static bool UseFcFontList() { return sUseFcFontList; }
|
||||
|
||||
bool UseImageOffscreenSurfaces();
|
||||
|
||||
virtual gfxImageFormat GetOffscreenFormat() override;
|
||||
@ -158,10 +156,6 @@ private:
|
||||
#ifdef MOZ_X11
|
||||
Display* mCompositorDisplay;
|
||||
#endif
|
||||
|
||||
// xxx - this will be removed once the new fontconfig platform font list
|
||||
// replaces gfxPangoFontGroup
|
||||
static bool sUseFcFontList;
|
||||
};
|
||||
|
||||
#endif /* GFX_PLATFORM_GTK_H */
|
||||
|
@ -28,10 +28,6 @@
|
||||
#include "mozilla/gfx/Logging.h" // for gfxCriticalError
|
||||
#include "mozilla/UniquePtr.h"
|
||||
|
||||
#if defined(MOZ_WIDGET_GTK)
|
||||
#include "gfxPlatformGtk.h" // xxx - for UseFcFontList
|
||||
#endif
|
||||
|
||||
#ifdef XP_WIN
|
||||
#include "gfxWindowsPlatform.h"
|
||||
#endif
|
||||
@ -1730,16 +1726,6 @@ gfxFontGroup::~gfxFontGroup()
|
||||
void
|
||||
gfxFontGroup::BuildFontList()
|
||||
{
|
||||
bool enumerateFonts = true;
|
||||
|
||||
#if defined(MOZ_WIDGET_GTK)
|
||||
// xxx - eliminate this once gfxPangoFontGroup is no longer needed
|
||||
enumerateFonts = gfxPlatformGtk::UseFcFontList();
|
||||
#endif
|
||||
if (!enumerateFonts) {
|
||||
return;
|
||||
}
|
||||
|
||||
// initialize fonts in the font family list
|
||||
AutoTArray<gfxFontFamily*,10> fonts;
|
||||
gfxPlatformFontList *pfl = gfxPlatformFontList::PlatformFontList();
|
||||
|
@ -82,11 +82,6 @@
|
||||
#include "mozilla/dom/PerformanceTiming.h"
|
||||
#include "mozilla/layers/APZThreadUtils.h"
|
||||
|
||||
#if defined(MOZ_WIDGET_GTK)
|
||||
#include "gfxPlatformGtk.h" // xxx - for UseFcFontList
|
||||
#endif
|
||||
|
||||
|
||||
// Needed for Start/Stop of Image Animation
|
||||
#include "imgIContainer.h"
|
||||
#include "nsIImageLoadingContent.h"
|
||||
@ -2214,19 +2209,12 @@ nsPresContext::UserFontSetUpdated(gfxUserFontEntry* aUpdatedFont)
|
||||
if (!mShell)
|
||||
return;
|
||||
|
||||
bool usePlatformFontList = true;
|
||||
#if defined(MOZ_WIDGET_GTK)
|
||||
usePlatformFontList = gfxPlatformGtk::UseFcFontList();
|
||||
#endif
|
||||
|
||||
// xxx - until the Linux platform font list is always used, use full
|
||||
// restyle to force updates with gfxPangoFontGroup usage
|
||||
// Note: this method is called without a font when rules in the userfont set
|
||||
// are updated, which may occur during reflow as a result of the lazy
|
||||
// initialization of the userfont set. It would be better to avoid a full
|
||||
// restyle but until this method is only called outside of reflow, schedule a
|
||||
// full restyle in these cases.
|
||||
if (!usePlatformFontList || !aUpdatedFont) {
|
||||
if (!aUpdatedFont) {
|
||||
PostRebuildAllStyleDataEvent(NS_STYLE_HINT_REFLOW, eRestyle_ForceDescendants);
|
||||
return;
|
||||
}
|
||||
|
@ -4204,13 +4204,7 @@ pref("intl.ime.use_simple_context_on_password_field", true);
|
||||
pref("intl.ime.use_simple_context_on_password_field", false);
|
||||
#endif
|
||||
|
||||
# enable new platform fontlist for linux on GTK platforms
|
||||
# temporary pref to allow flipping back to the existing
|
||||
# gfxPangoFontGroup/gfxFontconfigUtils code for handling system fonts
|
||||
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
pref("gfx.font_rendering.fontconfig.fontlist.enabled", true);
|
||||
|
||||
// maximum number of fonts to substitute for a generic
|
||||
pref("gfx.font_rendering.fontconfig.max_generic_substitutions", 3);
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user