diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
commit | 40a355a42d4a9444dc753c04c6608dade2f06a23 (patch) | |
tree | 871fc667d2de662f171103ce5ec067014ef85e61 /gfx/thebes/gfxPlatformFontList.cpp | |
parent | Adding upstream version 124.0.1. (diff) | |
download | firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.tar.xz firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.zip |
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gfx/thebes/gfxPlatformFontList.cpp')
-rw-r--r-- | gfx/thebes/gfxPlatformFontList.cpp | 44 |
1 files changed, 41 insertions, 3 deletions
diff --git a/gfx/thebes/gfxPlatformFontList.cpp b/gfx/thebes/gfxPlatformFontList.cpp index 709a0f3c27..bc0e123f85 100644 --- a/gfx/thebes/gfxPlatformFontList.cpp +++ b/gfx/thebes/gfxPlatformFontList.cpp @@ -378,6 +378,40 @@ gfxPlatformFontList::~gfxPlatformFontList() { NS_RELEASE(gFontListPrefObserver); } +void gfxPlatformFontList::GetMissingFonts(nsCString& aMissingFonts) { + AutoLock lock(mLock); + + auto fontLists = GetFilteredPlatformFontLists(); + + if (!fontLists.Length()) { + aMissingFonts.Append("No font list available for this device."); + } + + for (unsigned int i = 0; i < fontLists.Length(); i++) { + for (unsigned int j = 0; j < fontLists[i].second; j++) { + nsCString key(fontLists[i].first[j]); + GenerateFontListKey(key); + + if (SharedFontList()) { + fontlist::Family* family = SharedFontList()->FindFamily(key); + if (!family) { + aMissingFonts.Append(fontLists[i].first[j]); + aMissingFonts.Append("|"); + } + } else { + gfxFontFamily* familyEntry = mFontFamilies.GetWeak(key); + if (!familyEntry) { + familyEntry = mOtherFamilyNames.GetWeak(key); + } + if (!familyEntry) { + aMissingFonts.Append(fontLists[i].first[j]); + aMissingFonts.Append("|"); + } + } + } + } +} + /* static */ void gfxPlatformFontList::FontWhitelistPrefChanged(const char* aPref, void* aClosure) { @@ -700,6 +734,10 @@ void gfxPlatformFontList::GenerateFontListKey(const nsACString& aKeyName, ToLowerCase(aResult); } +void gfxPlatformFontList::GenerateFontListKey(nsACString& aKeyName) { + ToLowerCase(aKeyName); +} + // Used if a stylo thread wants to trigger InitOtherFamilyNames in the main // process: we can't do IPC from the stylo thread so we post this to the main // thread instead. @@ -755,7 +793,7 @@ bool gfxPlatformFontList::InitOtherFamilyNames( // (This is used so we can reliably run reftests that depend on localized // font-family names being available.) if (aDeferOtherFamilyNamesLoading && - StaticPrefs::gfx_font_loader_delay_AtStartup() > 0) { + StaticPrefs::gfx_font_loader_delay() > 0) { if (!mPendingOtherFamilyNameTask) { RefPtr<mozilla::CancelableRunnable> task = new InitOtherFamilyNamesRunnable(); @@ -2648,7 +2686,7 @@ bool gfxPlatformFontList::LoadFontInfo() { // Limit the time spent reading fonts in one pass, unless the font-loader // delay was set to zero, in which case we run to completion even if it // causes some jank. - if (StaticPrefs::gfx_font_loader_delay_AtStartup() > 0) { + if (StaticPrefs::gfx_font_loader_delay() > 0) { TimeDuration elapsed = TimeStamp::Now() - start; if (elapsed.ToMilliseconds() > FONT_LOADER_MAX_TIMESLICE && i + 1 != endIndex) { @@ -2751,7 +2789,7 @@ void gfxPlatformFontList::GetPrefsAndStartLoader() { if (AppShutdown::IsInOrBeyond(ShutdownPhase::AppShutdownConfirmed)) { return; } - uint32_t delay = std::max(1u, StaticPrefs::gfx_font_loader_delay_AtStartup()); + uint32_t delay = std::max(1u, StaticPrefs::gfx_font_loader_delay()); if (NS_IsMainThread()) { StartLoader(delay); } else { |