Issue #2191 - Remove as much old fontconfig support as needed for Harfbuzz update.

Based on Mozilla bugs 1119128, 1285533, and 1421964.

gfx.font_rendering.fontconfig.fontlist.enabled is no longer available.

gfxFontconfigUtils.h still exists, and will be removed in another commit. Just
need more research on bug 1385029.

Tag #1862
This commit is contained in:
Job Bautista 2023-04-04 21:48:39 +08:00 committed by roytam1
commit b5d5963a4f
17 changed files with 37 additions and 3966 deletions

View file

@ -14,13 +14,13 @@
#include "gfx2DGlue.h"
#include "gfxFcPlatformFontList.h"
#include "gfxFontconfigUtils.h"
#include "gfxFontconfigFonts.h"
#include "gfxConfig.h"
#include "gfxContext.h"
#include "gfxUserFontSet.h"
#include "gfxUtils.h"
#include "gfxFT2FontBase.h"
#include "gfxPrefs.h"
#include "gfxTextRun.h"
#include "VsyncSource.h"
#include "mozilla/Atomics.h"
#include "mozilla/Monitor.h"
@ -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);
@ -197,27 +182,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
@ -280,13 +255,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 *
@ -296,13 +267,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*
@ -311,14 +277,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*
@ -329,16 +290,9 @@ 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);
}
bool
@ -429,11 +383,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()