#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "third_party/blink/renderer/platform/fonts/font_platform_data.h"
#include "base/feature_list.h"
#include "build/build_config.h"
#include "hb-ot.h"
#include "hb.h"
#include "third_party/blink/public/common/privacy_budget/identifiable_token_builder.h"
#include "third_party/blink/public/platform/linux/web_sandbox_support.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/renderer/platform/fonts/font_cache.h"
#include "third_party/blink/renderer/platform/fonts/shaping/harfbuzz_face.h"
#include "third_party/blink/renderer/platform/fonts/shaping/harfbuzz_font_cache.h"
#include "third_party/blink/renderer/platform/fonts/shaping/harfbuzz_font_data.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
#include "third_party/blink/renderer/platform/text/character.h"
#include "third_party/blink/renderer/platform/web_test_support.h"
#include "third_party/blink/renderer/platform/wtf/hash_map.h"
#include "third_party/blink/renderer/platform/wtf/text/character_names.h"
#include "third_party/blink/renderer/platform/wtf/text/string_hash.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
#include "third_party/skia/include/core/SkData.h"
#include "third_party/skia/include/core/SkFont.h"
#include "third_party/skia/include/core/SkTypeface.h"
#if BUILDFLAG(IS_MAC)
#include "third_party/skia/include/ports/SkTypeface_mac.h"
#endif
namespace blink {
namespace {
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
BASE_FEATURE(…);
#endif
}
FontPlatformData::FontPlatformData(WTF::HashTableDeletedValueType)
: … { … }
FontPlatformData::FontPlatformData() = default;
FontPlatformData::FontPlatformData(const FontPlatformData& source)
: … { … }
FontPlatformData::FontPlatformData(const FontPlatformData& src, float text_size)
: … { … }
FontPlatformData::FontPlatformData(sk_sp<SkTypeface> typeface,
const std::string& family,
float text_size,
bool synthetic_bold,
bool synthetic_italic,
TextRenderingMode text_rendering,
ResolvedFontFeatures resolved_font_features,
FontOrientation orientation)
: … { … }
FontPlatformData::~FontPlatformData() = default;
void FontPlatformData::Trace(Visitor* visitor) const { … }
#if BUILDFLAG(IS_MAC)
CTFontRef FontPlatformData::CtFont() const {
return SkTypeface_GetCTFontRef(typeface_.get());
}
#endif
bool FontPlatformData::operator==(const FontPlatformData& a) const { … }
SkTypefaceID FontPlatformData::UniqueID() const { … }
String FontPlatformData::FontFamilyName() const { … }
bool FontPlatformData::IsAhem() const { … }
SkTypeface* FontPlatformData::Typeface() const { … }
HarfBuzzFace* FontPlatformData::GetHarfBuzzFace() const { … }
bool FontPlatformData::HasSpaceInLigaturesOrKerning(
TypesettingFeatures features) const { … }
unsigned FontPlatformData::GetHash() const { … }
#if !BUILDFLAG(IS_MAC)
bool FontPlatformData::FontContainsCharacter(UChar32 character) const { … }
#endif
#if !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_WIN)
WebFontRenderStyle FontPlatformData::QuerySystemRenderStyle(
const std::string& family,
float text_size,
SkFontStyle font_style,
TextRenderingMode text_rendering) { … }
#endif
#if !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_WIN) && !BUILDFLAG(IS_IOS)
SkFont FontPlatformData::CreateSkFont(const FontDescription*) const { … }
#endif
IdentifiableToken FontPlatformData::ComputeTypefaceDigest() const { … }
String FontPlatformData::GetPostScriptName() const { … }
}