Bug 1412090 - patch 2 - Rework the fontconfig-based platform font list implementation to pass the list of available font patterns from chrome to content, instead of letting the content process get it directly from fontconfig. r=lsalzman

This commit is contained in:
Jonathan Kew 2017-11-02 20:29:33 +00:00
Родитель 90bf3da506
Коммит 0ba9f9c57b
16 изменённых файлов: 304 добавлений и 94 удалений

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

@ -2541,6 +2541,14 @@ ContentChild::RecvUpdateDictionaryList(InfallibleTArray<nsString>&& aDictionarie
return IPC_OK();
}
mozilla::ipc::IPCResult
ContentChild::RecvUpdateFontList(InfallibleTArray<SystemFontListEntry>&& aFontList)
{
mFontList = Move(aFontList);
gfxPlatform::GetPlatform()->UpdateFontList();
return IPC_OK();
}
mozilla::ipc::IPCResult
ContentChild::RecvUpdateAppLocales(nsTArray<nsCString>&& aAppLocales)
{

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

@ -399,6 +399,8 @@ public:
virtual mozilla::ipc::IPCResult RecvUpdateDictionaryList(InfallibleTArray<nsString>&& aDictionaries) override;
virtual mozilla::ipc::IPCResult RecvUpdateFontList(InfallibleTArray<SystemFontListEntry>&& aFontList) override;
virtual mozilla::ipc::IPCResult RecvUpdateAppLocales(nsTArray<nsCString>&& aAppLocales) override;
virtual mozilla::ipc::IPCResult RecvUpdateRequestedLocales(nsTArray<nsCString>&& aRequestedLocales) override;
@ -751,7 +753,7 @@ private:
// Temporary storage for a list of available fonts, passed from the
// parent process and used to initialize gfx in the child. Currently used
// only on MacOSX.
// only on MacOSX and Linux.
InfallibleTArray<mozilla::dom::SystemFontListEntry> mFontList;
// Temporary storage for nsXPLookAndFeel flags.
nsTArray<LookAndFeelInt> mLookAndFeelCache;

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

@ -171,6 +171,7 @@
#include "nsDocShell.h"
#include "nsOpenURIInFrameParams.h"
#include "mozilla/net/NeckoMessageUtils.h"
#include "gfxPlatform.h"
#include "gfxPrefs.h"
#include "prio.h"
#include "private/pprio.h"
@ -2224,9 +2225,10 @@ ContentParent::InitInternal(ProcessPriority aInitialPriority,
}
}
}
// This is only implemented (returns a non-empty list) by MacOSX at present.
// This is only implemented (returns a non-empty list) by MacOSX and Linux
// at present.
nsTArray<SystemFontListEntry> fontList;
gfxPlatform::GetPlatform()->GetSystemFontList(&fontList);
gfxPlatform::GetPlatform()->ReadSystemFontList(&fontList);
nsTArray<LookAndFeelInt> lnfCache = LookAndFeel::GetIntCache();
// Content processes have no permission to access profile directory, so we
@ -4263,6 +4265,17 @@ ContentParent::NotifyUpdatedDictionaries()
}
}
void
ContentParent::NotifyUpdatedFonts()
{
InfallibleTArray<SystemFontListEntry> fontList;
gfxPlatform::GetPlatform()->ReadSystemFontList(&fontList);
for (auto* cp : AllProcesses(eLive)) {
Unused << cp->SendUpdateFontList(fontList);
}
}
/*static*/ void
ContentParent::UnregisterRemoteFrame(const TabId& aTabId,
const ContentParentId& aCpId,

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

@ -269,6 +269,8 @@ public:
static void NotifyUpdatedDictionaries();
static void NotifyUpdatedFonts();
#if defined(XP_WIN)
/**
* Windows helper for firing off an update window request to a plugin

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

@ -442,6 +442,8 @@ child:
async UpdateDictionaryList(nsString[] dictionaries);
async UpdateFontList(SystemFontListEntry[] fontList);
async UpdateAppLocales(nsCString[] appLocales);
async UpdateRequestedLocales(nsCString[] requestedLocales);
@ -489,7 +491,7 @@ child:
async SetXPCOMProcessAttributes(XPCOMInitData xpcomInit,
StructuredCloneData initialData,
LookAndFeelInt[] lookAndFeelIntCache,
/* used on MacOSX only: */
/* used on MacOSX and Linux only: */
SystemFontListEntry[] systemFontList);
// Notify child that last-pb-context-exited notification was observed

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

@ -12,6 +12,8 @@
#include "gfxFT2Utils.h"
#include "gfxPlatform.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/Preferences.h"
#include "mozilla/Sprintf.h"
#include "mozilla/TimeStamp.h"
@ -22,10 +24,12 @@
#include "nsDirectoryServiceDefs.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsCharSeparatedTokenizer.h"
#include "nsXULAppAPI.h"
#include "mozilla/gfx/HelpersCairo.h"
#include <fontconfig/fcfreetype.h>
#include <unistd.h>
#ifdef MOZ_WIDGET_GTK
#include <gdk/gdk.h>
@ -40,6 +44,9 @@ using namespace mozilla;
using namespace mozilla::gfx;
using namespace mozilla::unicode;
using mozilla::dom::SystemFontListEntry;
using mozilla::dom::FontPatternListEntry;
#ifndef FC_POSTSCRIPT_NAME
#define FC_POSTSCRIPT_NAME "postscriptname" /* String */
#endif
@ -1205,6 +1212,25 @@ gfxFontconfigFontFamily::~gfxFontconfigFontFamily()
MOZ_ASSERT(NS_IsMainThread());
}
template<typename Func>
void
gfxFontconfigFontFamily::AddFacesToFontList(Func aAddPatternFunc)
{
if (HasStyles()) {
for (auto& fe : mAvailableFonts) {
if (!fe) {
continue;
}
auto fce = static_cast<gfxFontconfigFontEntry*>(fe.get());
aAddPatternFunc(fce->GetPattern(), mContainsAppFonts);
}
} else {
for (auto& pat : mFontPatterns) {
aAddPatternFunc(pat, mContainsAppFonts);
}
}
}
gfxFontconfigFont::gfxFontconfigFont(const RefPtr<UnscaledFontFontconfig>& aUnscaledFont,
cairo_scaled_font_t *aScaledFont,
FcPattern *aPattern,
@ -1244,18 +1270,20 @@ gfxFcPlatformFontList::gfxFcPlatformFontList()
, mLastConfig(nullptr)
, mAlwaysUseFontconfigGenerics(true)
{
// if the rescan interval is set, start the timer
int rescanInterval = FcConfigGetRescanInterval(nullptr);
if (rescanInterval) {
mLastConfig = FcConfigGetCurrent();
NS_NewTimerWithFuncCallback(getter_AddRefs(mCheckFontUpdatesTimer),
CheckFontUpdates,
this,
(rescanInterval + 1) * 1000,
nsITimer::TYPE_REPEATING_SLACK,
"gfxFcPlatformFontList::gfxFcPlatformFontList");
if (!mCheckFontUpdatesTimer) {
NS_WARNING("Failure to create font updates timer");
if (XRE_IsParentProcess()) {
// if the rescan interval is set, start the timer
int rescanInterval = FcConfigGetRescanInterval(nullptr);
if (rescanInterval) {
mLastConfig = FcConfigGetCurrent();
NS_NewTimerWithFuncCallback(getter_AddRefs(mCheckFontUpdatesTimer),
CheckFontUpdates,
this,
(rescanInterval + 1) * 1000,
nsITimer::TYPE_REPEATING_SLACK,
"gfxFcPlatformFontList::gfxFcPlatformFontList");
if (!mCheckFontUpdatesTimer) {
NS_WARNING("Failure to create font updates timer");
}
}
}
@ -1276,11 +1304,10 @@ void
gfxFcPlatformFontList::AddFontSetFamilies(FcFontSet* aFontSet, bool aAppFonts)
{
// This iterates over the fonts in a font set and adds in gfxFontFamily
// objects for each family. The patterns for individual fonts are not
// copied here. When a family is actually used, the fonts in the family
// are enumerated and the patterns copied. Note that we're explicitly
// excluding non-scalable fonts such as X11 bitmap fonts, which
// Chrome Skia/Webkit code does also.
// objects for each family. Individual gfxFontEntry objects for each face
// are not created here; the patterns are just stored in the family. When
// a family is actually used, it will be populated with gfxFontEntry
// records and the patterns moved to those.
if (!aFontSet) {
NS_WARNING("AddFontSetFamilies called with a null font set.");
@ -1291,95 +1318,196 @@ gfxFcPlatformFontList::AddFontSetFamilies(FcFontSet* aFontSet, bool aAppFonts)
RefPtr<gfxFontconfigFontFamily> fontFamily;
nsAutoString familyName;
for (int f = 0; f < aFontSet->nfont; f++) {
FcPattern* font = aFontSet->fonts[f];
FcPattern* pattern = aFontSet->fonts[f];
// get canonical name
uint32_t cIndex = FindCanonicalNameIndex(font, FC_FAMILYLANG);
FcChar8* canonical = nullptr;
FcPatternGetString(font, FC_FAMILY, cIndex, &canonical);
if (!canonical) {
// Skip any fonts that aren't readable for us (e.g. due to restrictive
// file ownership/permissions).
FcChar8* path;
if (FcPatternGetString(pattern, FC_FILE, 0, &path) != FcResultMatch) {
continue;
}
if (access(reinterpret_cast<const char*>(path), F_OK | R_OK) != 0) {
continue;
}
// same as the last one? no need to add a new family, skip
if (FcStrCmp(canonical, lastFamilyName) != 0) {
lastFamilyName = canonical;
// TODO:
// Verify that /path/ will be readable with the content-process sandbox
// rules; any blocked fonts must not be included in the font list.
// add new family if one doesn't already exist
familyName.Truncate();
AppendUTF8toUTF16(ToCharPtr(canonical), familyName);
nsAutoString keyName(familyName);
ToLowerCase(keyName);
AddPatternToFontList(pattern, lastFamilyName,
familyName, fontFamily, aAppFonts);
}
}
fontFamily = static_cast<gfxFontconfigFontFamily*>
(mFontFamilies.GetWeak(keyName));
if (!fontFamily) {
fontFamily = new gfxFontconfigFontFamily(familyName);
mFontFamilies.Put(keyName, fontFamily);
}
// Record if the family contains fonts from the app font set
// (in which case we won't rely on fontconfig's charmap, due to
// bug 1276594).
if (aAppFonts) {
fontFamily->SetFamilyContainsAppFonts(true);
}
void
gfxFcPlatformFontList::AddPatternToFontList(FcPattern* aFont,
FcChar8*& aLastFamilyName,
nsAString& aFamilyName,
RefPtr<gfxFontconfigFontFamily>& aFontFamily,
bool aAppFonts)
{
// get canonical name
uint32_t cIndex = FindCanonicalNameIndex(aFont, FC_FAMILYLANG);
FcChar8* canonical = nullptr;
FcPatternGetString(aFont, FC_FAMILY, cIndex, &canonical);
if (!canonical) {
return;
}
// Add pointers to other localized family names. Most fonts
// only have a single name, so the first call to GetString
// will usually not match
FcChar8* otherName;
int n = (cIndex == 0 ? 1 : 0);
while (FcPatternGetString(font, FC_FAMILY, n, &otherName) == FcResultMatch) {
NS_ConvertUTF8toUTF16 otherFamilyName(ToCharPtr(otherName));
AddOtherFamilyName(fontFamily, otherFamilyName);
n++;
if (n == int(cIndex)) {
n++; // skip over canonical name
}
}
// same as the last one? no need to add a new family, skip
if (FcStrCmp(canonical, aLastFamilyName) != 0) {
aLastFamilyName = canonical;
// add new family if one doesn't already exist
aFamilyName.Truncate();
AppendUTF8toUTF16(ToCharPtr(canonical), aFamilyName);
nsAutoString keyName(aFamilyName);
ToLowerCase(keyName);
aFontFamily = static_cast<gfxFontconfigFontFamily*>
(mFontFamilies.GetWeak(keyName));
if (!aFontFamily) {
aFontFamily = new gfxFontconfigFontFamily(aFamilyName);
mFontFamilies.Put(keyName, aFontFamily);
}
// Record if the family contains fonts from the app font set
// (in which case we won't rely on fontconfig's charmap, due to
// bug 1276594).
if (aAppFonts) {
aFontFamily->SetFamilyContainsAppFonts(true);
}
NS_ASSERTION(fontFamily, "font must belong to a font family");
fontFamily->AddFontPattern(font);
// Add pointers to other localized family names. Most fonts
// only have a single name, so the first call to GetString
// will usually not match
FcChar8* otherName;
int n = (cIndex == 0 ? 1 : 0);
while (FcPatternGetString(aFont, FC_FAMILY, n, &otherName) ==
FcResultMatch) {
NS_ConvertUTF8toUTF16 otherFamilyName(ToCharPtr(otherName));
AddOtherFamilyName(aFontFamily, otherFamilyName);
n++;
if (n == int(cIndex)) {
n++; // skip over canonical name
}
}
}
// map the psname, fullname ==> font family for local font lookups
nsAutoString psname, fullname;
GetFaceNames(font, familyName, psname, fullname);
if (!psname.IsEmpty()) {
ToLowerCase(psname);
mLocalNames.Put(psname, font);
}
if (!fullname.IsEmpty()) {
ToLowerCase(fullname);
mLocalNames.Put(fullname, font);
}
MOZ_ASSERT(aFontFamily, "font must belong to a font family");
aFontFamily->AddFontPattern(aFont);
// map the psname, fullname ==> font family for local font lookups
nsAutoString psname, fullname;
GetFaceNames(aFont, aFamilyName, psname, fullname);
if (!psname.IsEmpty()) {
ToLowerCase(psname);
mLocalNames.Put(psname, aFont);
}
if (!fullname.IsEmpty()) {
ToLowerCase(fullname);
mLocalNames.Put(fullname, aFont);
}
}
nsresult
gfxFcPlatformFontList::InitFontListForPlatform()
{
mLastConfig = FcConfigGetCurrent();
#ifdef MOZ_BUNDLED_FONTS
ActivateBundledFonts();
#endif
mLocalNames.Clear();
mFcSubstituteCache.Clear();
mAlwaysUseFontconfigGenerics = PrefFontListsUseOnlyGenerics();
mOtherFamilyNamesInitialized = true;
if (XRE_IsContentProcess()) {
// Content process: use the font list passed from the chrome process,
// because we can't rely on fontconfig in the presence of sandboxing;
// it may report fonts that we can't actually access.
FcChar8* lastFamilyName = (FcChar8*)"";
RefPtr<gfxFontconfigFontFamily> fontFamily;
nsAutoString familyName;
// Get font list that was passed during XPCOM startup
// or in an UpdateFontList message.
auto& fontList = dom::ContentChild::GetSingleton()->SystemFontList();
for (SystemFontListEntry& fle : fontList) {
MOZ_ASSERT(fle.type() ==
SystemFontListEntry::Type::TFontPatternListEntry);
FontPatternListEntry& fpe(fle);
FcPattern* pattern =
FcNameParse((const FcChar8*)fpe.pattern().get());
AddPatternToFontList(pattern, lastFamilyName, familyName,
fontFamily, fpe.appFontFamily());
FcPatternDestroy(pattern);
}
LOG_FONTLIST(("got font list from chrome process: "
"%u faces in %u families",
(unsigned)fontList.Length(), mFontFamilies.Count()));
fontList.Clear();
return NS_OK;
}
mLastConfig = FcConfigGetCurrent();
// iterate over available fonts
FcFontSet* systemFonts = FcConfigGetFonts(nullptr, FcSetSystem);
AddFontSetFamilies(systemFonts, /* aAppFonts = */ false);
mAlwaysUseFontconfigGenerics = PrefFontListsUseOnlyGenerics();
#ifdef MOZ_BUNDLED_FONTS
ActivateBundledFonts();
FcFontSet* appFonts = FcConfigGetFonts(nullptr, FcSetApplication);
AddFontSetFamilies(appFonts, /* aAppFonts = */ true);
#endif
mOtherFamilyNamesInitialized = true;
return NS_OK;
}
void
gfxFcPlatformFontList::ReadSystemFontList(
InfallibleTArray<SystemFontListEntry>* retValue)
{
// Fontconfig versions below 2.9 drop the FC_FILE element in FcNameUnparse
// (see https://bugs.freedesktop.org/show_bug.cgi?id=26718), so when using
// an older version, we manually append it to the unparsed pattern.
if (FcGetVersion() < 20900) {
for (auto iter = mFontFamilies.Iter(); !iter.Done(); iter.Next()) {
auto family =
static_cast<gfxFontconfigFontFamily*>(iter.Data().get());
family->AddFacesToFontList([&](FcPattern* aPat, bool aAppFonts) {
char* s = (char*)FcNameUnparse(aPat);
nsAutoCString patternStr(s);
free(s);
if (FcResultMatch ==
FcPatternGetString(aPat, FC_FILE, 0, (FcChar8**)&s)) {
patternStr.Append(":file=");
patternStr.Append(s);
}
retValue->AppendElement(FontPatternListEntry(patternStr,
aAppFonts));
});
}
} else {
for (auto iter = mFontFamilies.Iter(); !iter.Done(); iter.Next()) {
auto family =
static_cast<gfxFontconfigFontFamily*>(iter.Data().get());
family->AddFacesToFontList([&](FcPattern* aPat, bool aAppFonts) {
char* s = (char*)FcNameUnparse(aPat);
nsDependentCString patternStr(s);
retValue->AppendElement(FontPatternListEntry(patternStr,
aAppFonts));
free(s);
});
}
}
}
// For displaying the fontlist in UI, use explicit call to FcFontList. Using
// FcFontList results in the list containing the localized names as dictated
// by system defaults.
@ -1978,6 +2106,10 @@ gfxFcPlatformFontList::PrefFontListsUseOnlyGenerics()
/* static */ void
gfxFcPlatformFontList::CheckFontUpdates(nsITimer *aTimer, void *aThis)
{
// A content process is not supposed to check this directly;
// it will be notified by the parent when the font list changes.
MOZ_ASSERT(XRE_IsParentProcess());
// check for font updates
FcInitBringUptoDate();
@ -1987,6 +2119,8 @@ gfxFcPlatformFontList::CheckFontUpdates(nsITimer *aTimer, void *aThis)
if (current != pfl->GetLastConfig()) {
pfl->UpdateFontList();
pfl->ForceGlobalReflow();
mozilla::dom::ContentParent::NotifyUpdatedFonts();
}
}

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

@ -21,6 +21,12 @@
#include <cairo.h>
#include <cairo-ft.h>
namespace mozilla {
namespace dom {
class SystemFontListEntry;
};
};
template <>
class nsAutoRefTraits<FcPattern> : public nsPointerRefTraits<FcPattern>
{
@ -182,6 +188,9 @@ public:
mForceScalable(false)
{ }
template<typename Func>
void AddFacesToFontList(Func aAddPatternFunc);
void FindStyleVariations(FontInfoData *aFontInfoData = nullptr) override;
// Families are constructed initially with just references to patterns.
@ -254,6 +263,8 @@ public:
const nsACString& aGenericFamily,
nsTArray<nsString>& aListOfFonts) override;
void ReadSystemFontList(
InfallibleTArray<mozilla::dom::SystemFontListEntry>* retValue);
gfxFontEntry*
LookupLocalFont(const nsAString& aFontName, uint16_t aWeight,
@ -298,6 +309,12 @@ protected:
// aAppFonts indicates whether this is the system or application fontset.
void AddFontSetFamilies(FcFontSet* aFontSet, bool aAppFonts);
// Helper for above, to add a single font pattern.
void AddPatternToFontList(FcPattern* aFont, FcChar8*& aLastFamilyName,
nsAString& aFamilyName,
RefPtr<gfxFontconfigFontFamily>& aFontFamily,
bool aAppFonts);
// figure out which families fontconfig maps a generic to
// (aGeneric assumed already lowercase)
PrefFontList* FindGenericFamilies(const nsAString& aGeneric,

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

@ -159,7 +159,7 @@ public:
kTextSizeSystemFontFamily = 2, // name of 'system' font at text sizes
kDisplaySizeSystemFontFamily = 3 // 'system' font at display sizes
};
void GetSystemFontList(
void ReadSystemFontList(
InfallibleTArray<mozilla::dom::SystemFontListEntry>* aList);
protected:

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

@ -1057,7 +1057,7 @@ gfxMacPlatformFontList::AddFamily(CFStringRef aFamily)
}
void
gfxMacPlatformFontList::GetSystemFontList(
gfxMacPlatformFontList::ReadSystemFontList(
InfallibleTArray<SystemFontListEntry>* aList)
{
// Note: We rely on the records for mSystemTextFontFamilyName and

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

@ -339,9 +339,9 @@ public:
/**
* Fill aFontList with a list of SystemFontListEntry records for the
* available fonts on the platform; used to pass the list from chrome to
* content process. Currently implemented only on MacOSX.
* content process. Currently implemented only on MacOSX and Linux.
*/
virtual void GetSystemFontList(
virtual void ReadSystemFontList(
InfallibleTArray<mozilla::dom::SystemFontListEntry>* aFontList)
{ }

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

@ -17,6 +17,7 @@
#include "nsUnicharUtils.h"
#include "nsUnicodeRange.h"
#include "nsUnicodeProperties.h"
#include "nsXULAppAPI.h"
#include "mozilla/Attributes.h"
#include "mozilla/Likely.h"
@ -25,6 +26,7 @@
#include "mozilla/Preferences.h"
#include "mozilla/Telemetry.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/gfx/2D.h"
#include <locale.h>
@ -200,8 +202,12 @@ gfxPlatformFontList::gfxPlatformFontList(bool aNeedFullnamePostscriptNames)
NS_ADDREF(gFontListPrefObserver);
Preferences::AddStrongObservers(gFontListPrefObserver, kObservedPrefs);
Preferences::RegisterCallback(FontWhitelistPrefChanged,
kFontSystemWhitelistPref);
// Only the parent process listens for whitelist changes; it will then
// notify its children to rebuild their font lists.
if (XRE_IsParentProcess()) {
Preferences::RegisterCallback(FontWhitelistPrefChanged,
kFontSystemWhitelistPref);
}
RegisterStrongMemoryReporter(new MemoryReporter());
}
@ -212,11 +218,23 @@ gfxPlatformFontList::~gfxPlatformFontList()
ClearLangGroupPrefFonts();
NS_ASSERTION(gFontListPrefObserver, "There is no font list pref observer");
Preferences::RemoveObservers(gFontListPrefObserver, kObservedPrefs);
Preferences::UnregisterCallback(FontWhitelistPrefChanged,
kFontSystemWhitelistPref);
if (XRE_IsParentProcess()) {
Preferences::UnregisterCallback(FontWhitelistPrefChanged,
kFontSystemWhitelistPref);
}
NS_RELEASE(gFontListPrefObserver);
}
/* static */
void
gfxPlatformFontList::FontWhitelistPrefChanged(const char *aPref,
void *aClosure)
{
MOZ_ASSERT(XRE_IsParentProcess());
gfxPlatformFontList::PlatformFontList()->UpdateFontList();
mozilla::dom::ContentParent::NotifyUpdatedFonts();
}
// number of CSS generic font families
const uint32_t kNumGenerics = 5;

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

@ -280,9 +280,7 @@ public:
// Returns true if the font family whitelist is not empty.
bool IsFontFamilyWhitelistActive();
static void FontWhitelistPrefChanged(const char *aPref, void *aClosure) {
gfxPlatformFontList::PlatformFontList()->UpdateFontList();
}
static void FontWhitelistPrefChanged(const char *aPref, void *aClosure);
bool AddWithLegacyFamilyName(const nsAString& aLegacyName,
gfxFontEntry* aFontEntry);

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

@ -65,6 +65,7 @@
using namespace mozilla;
using namespace mozilla::gfx;
using namespace mozilla::unicode;
using mozilla::dom::SystemFontListEntry;
#if (MOZ_WIDGET_GTK == 2)
static cairo_user_data_key_t cairo_gdk_drawable_key;
@ -249,6 +250,13 @@ gfxPlatformGtk::GetCommonFallbackFonts(uint32_t aCh, uint32_t aNextCh,
}
}
void
gfxPlatformGtk::ReadSystemFontList(
InfallibleTArray<SystemFontListEntry>* retValue)
{
gfxFcPlatformFontList::PlatformFontList()->ReadSystemFontList(retValue);
}
gfxPlatformFontList*
gfxPlatformGtk::CreatePlatformFontList()
{

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

@ -22,6 +22,12 @@ struct _XDisplay;
typedef struct _XDisplay Display;
#endif // MOZ_X11
namespace mozilla {
namespace dom {
class SystemFontListEntry;
};
};
class gfxPlatformGtk : public gfxPlatform {
public:
gfxPlatformGtk();
@ -31,6 +37,9 @@ public:
return (gfxPlatformGtk*) gfxPlatform::GetPlatform();
}
void ReadSystemFontList(
InfallibleTArray<mozilla::dom::SystemFontListEntry>* retValue) override;
virtual already_AddRefed<gfxASurface>
CreateOffscreenSurface(const IntSize& aSize,
gfxImageFormat aFormat) override;

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

@ -113,11 +113,10 @@ gfxPlatformMac::CreatePlatformFontList()
}
void
gfxPlatformMac::GetSystemFontList(
gfxPlatformMac::ReadSystemFontList(
InfallibleTArray<SystemFontListEntry>* aFontList)
{
gfxMacPlatformFontList::PlatformFontList()->
GetSystemFontList(aFontList);
gfxMacPlatformFontList::PlatformFontList()->ReadSystemFontList(aFontList);
}
already_AddRefed<gfxASurface>

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

@ -40,8 +40,8 @@ public:
virtual gfxPlatformFontList* CreatePlatformFontList() override;
void
GetSystemFontList(InfallibleTArray<mozilla::dom::SystemFontListEntry>*
aFontList) override;
ReadSystemFontList(InfallibleTArray<mozilla::dom::SystemFontListEntry>*
aFontList) override;
bool IsFontFormatSupported(uint32_t aFormatFlags) override;