#include "third_party/blink/renderer/platform/fonts/font_cache.h"
#include <limits>
#include <memory>
#include "base/debug/alias.h"
#include "base/feature_list.h"
#include "base/strings/escape.h"
#include "base/system/sys_info.h"
#include "base/timer/elapsed_timer.h"
#include "base/trace_event/process_memory_dump.h"
#include "base/trace_event/trace_event.h"
#include "build/build_config.h"
#include "skia/ext/font_utils.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/renderer/platform/font_family_names.h"
#include "third_party/blink/renderer/platform/fonts/alternate_font_family.h"
#include "third_party/blink/renderer/platform/fonts/font_cache_client.h"
#include "third_party/blink/renderer/platform/fonts/font_data_cache.h"
#include "third_party/blink/renderer/platform/fonts/font_description.h"
#include "third_party/blink/renderer/platform/fonts/font_fallback_map.h"
#include "third_party/blink/renderer/platform/fonts/font_fallback_priority.h"
#include "third_party/blink/renderer/platform/fonts/font_global_context.h"
#include "third_party/blink/renderer/platform/fonts/font_performance.h"
#include "third_party/blink/renderer/platform/fonts/font_platform_data_cache.h"
#include "third_party/blink/renderer/platform/fonts/font_unique_name_lookup.h"
#include "third_party/blink/renderer/platform/fonts/simple_font_data.h"
#include "third_party/blink/renderer/platform/heap/thread_state.h"
#include "third_party/blink/renderer/platform/instrumentation/tracing/web_memory_allocator_dump.h"
#include "third_party/blink/renderer/platform/instrumentation/tracing/web_process_memory_dump.h"
#include "third_party/blink/renderer/platform/json/json_parser.h"
#include "third_party/blink/renderer/platform/json/json_values.h"
#include "third_party/blink/renderer/platform/wtf/text/atomic_string_hash.h"
#include "third_party/blink/renderer/platform/wtf/text/code_point_iterator.h"
#include "third_party/blink/renderer/platform/wtf/text/string_hash.h"
#include "third_party/blink/renderer/platform/wtf/vector.h"
#include "ui/gfx/font_list.h"
#if BUILDFLAG(IS_WIN)
#include "third_party/skia/include/ports/SkTypeface_win.h"
#endif
namespace blink {
const char kColorEmojiLocale[] = …;
const char kMonoEmojiLocale[] = …;
#if BUILDFLAG(IS_ANDROID)
extern const char kNotoColorEmojiCompat[] = "Noto Color Emoji Compat";
#endif
SkFontMgr* FontCache::static_font_manager_ = …;
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
float FontCache::device_scale_factor_ = …;
#endif
#if BUILDFLAG(IS_WIN)
bool FontCache::antialiased_text_enabled_ = false;
bool FontCache::lcd_text_enabled_ = false;
static bool should_use_test_font_mgr = false;
#endif
FontCache& FontCache::Get() { … }
FontCache::FontCache() : … { … }
FontCache::~FontCache() = default;
void FontCache::Trace(Visitor* visitor) const { … }
#if !BUILDFLAG(IS_MAC)
const FontPlatformData* FontCache::SystemFontPlatformData(
const FontDescription& font_description) { … }
#endif
const FontPlatformData* FontCache::GetFontPlatformData(
const FontDescription& font_description,
const FontFaceCreationParams& creation_params,
AlternateFontName alternate_font_name) { … }
ShapeCache* FontCache::GetShapeCache(const FallbackListCompositeKey& key) { … }
void FontCache::SetFontManager(sk_sp<SkFontMgr> font_manager) { … }
void FontCache::AcceptLanguagesChanged(const String& accept_languages) { … }
const SimpleFontData* FontCache::GetFontData(
const FontDescription& font_description,
const AtomicString& family,
AlternateFontName altername_font_name) { … }
const SimpleFontData* FontCache::FontDataFromFontPlatformData(
const FontPlatformData* platform_data,
bool subpixel_ascent_descent) { … }
bool FontCache::IsPlatformFamilyMatchAvailable(
const FontDescription& font_description,
const AtomicString& family) { … }
bool FontCache::IsPlatformFontUniqueNameMatchAvailable(
const FontDescription& font_description,
const AtomicString& unique_font_name) { … }
String FontCache::FirstAvailableOrFirst(const String& families) { … }
const SimpleFontData* FontCache::FallbackFontForCharacter(
const FontDescription& description,
UChar32 lookup_char,
const SimpleFontData* font_data_to_substitute,
FontFallbackPriority fallback_priority) { … }
void FontCache::PurgeFallbackListShaperCache() { … }
void FontCache::InvalidateShapeCache() { … }
void FontCache::Purge() { … }
void FontCache::AddClient(FontCacheClient* client) { … }
uint16_t FontCache::Generation() { … }
void FontCache::Invalidate() { … }
void FontCache::CrashWithFontInfo(const FontDescription* font_description) { … }
void FontCache::DumpShapeResultCache(
base::trace_event::ProcessMemoryDump* memory_dump) { … }
sk_sp<SkTypeface> FontCache::CreateTypefaceFromUniqueName(
const FontFaceCreationParams& creation_params) { … }
FontCache::Bcp47Vector FontCache::GetBcp47LocaleForRequest(
const FontDescription& font_description,
FontFallbackPriority fallback_priority) { … }
#if BUILDFLAG(IS_FUCHSIA)
void FontCache::MaybePreloadSystemFonts() {}
#else
void FontCache::MaybePreloadSystemFonts() { … }
#endif
FontFallbackMap& FontCache::GetFontFallbackMap() { … }
}