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/gfxFT2FontList.cpp | |
parent | Adding upstream version 124.0.1. (diff) | |
download | firefox-adbda400be353e676059e335c3c0aaf99e719475.tar.xz firefox-adbda400be353e676059e335c3c0aaf99e719475.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/gfxFT2FontList.cpp')
-rw-r--r-- | gfx/thebes/gfxFT2FontList.cpp | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/gfx/thebes/gfxFT2FontList.cpp b/gfx/thebes/gfxFT2FontList.cpp index 6ff9788dc1..66f7655282 100644 --- a/gfx/thebes/gfxFT2FontList.cpp +++ b/gfx/thebes/gfxFT2FontList.cpp @@ -1321,6 +1321,55 @@ FontVisibility gfxFT2FontList::GetVisibilityForFamily( return FontVisibility::User; } +nsTArray<std::pair<const char**, uint32_t>> +gfxFT2FontList::GetFilteredPlatformFontLists() { + static Device fontVisibilityDevice = Device::Unassigned; + if (fontVisibilityDevice == Device::Unassigned) { + nsCOMPtr<nsIGfxInfo> gfxInfo = components::GfxInfo::Service(); + Unused << gfxInfo->GetFontVisibilityDetermination(&fontVisibilityDevice); + } + + nsTArray<std::pair<const char**, uint32_t>> fontLists; + + if (fontVisibilityDevice == Device::Android_Unknown_Release_Version || + fontVisibilityDevice == Device::Android_Unknown_Peloton || + fontVisibilityDevice == Device::Android_Unknown_vbox || + fontVisibilityDevice == Device::Android_Unknown_mitv || + fontVisibilityDevice == Device::Android_Chromebook || + fontVisibilityDevice == Device::Android_Amazon) { + return fontLists; + } + + // Sanity Check + if (fontVisibilityDevice != Device::Android_sub_9 && + fontVisibilityDevice != Device::Android_9_11 && + fontVisibilityDevice != Device::Android_12_plus) { + return fontLists; + } + + fontLists.AppendElement( + std::make_pair(kBaseFonts_Android, ArrayLength(kBaseFonts_Android))); + + if (fontVisibilityDevice == Device::Android_sub_9) { + fontLists.AppendElement(std::make_pair(kBaseFonts_Android5_8, + ArrayLength(kBaseFonts_Android5_8))); + } else { + fontLists.AppendElement(std::make_pair( + kBaseFonts_Android9_Higher, ArrayLength(kBaseFonts_Android9_Higher))); + + if (fontVisibilityDevice == Device::Android_9_11) { + fontLists.AppendElement(std::make_pair( + kBaseFonts_Android9_11, ArrayLength(kBaseFonts_Android9_11))); + } else { + fontLists.AppendElement( + std::make_pair(kBaseFonts_Android12_Higher, + ArrayLength(kBaseFonts_Android12_Higher))); + } + } + + return fontLists; +} + static void GetName(hb_face_t* aFace, hb_ot_name_id_t aNameID, nsACString& aName) { unsigned int n = 0; |