#include "core/fxge/cfx_glyphcache.h"
#include <initializer_list>
#include <memory>
#include <utility>
#include "build/build_config.h"
#include "core/fxcrt/fx_codepage.h"
#include "core/fxcrt/fx_memcpy_wrappers.h"
#include "core/fxcrt/span.h"
#include "core/fxge/cfx_defaultrenderdevice.h"
#include "core/fxge/cfx_font.h"
#include "core/fxge/cfx_glyphbitmap.h"
#include "core/fxge/cfx_path.h"
#include "core/fxge/cfx_substfont.h"
#if defined(PDF_USE_SKIA)
#include "third_party/skia/include/core/SkStream.h"
#include "third_party/skia/include/core/SkTypeface.h"
#include "third_party/skia/include/core/SkFontMgr.h"
#include "third_party/skia/include/ports/SkFontMgr_empty.h"
#if BUILDFLAG(IS_WIN)
#include "third_party/skia/include/ports/SkTypeface_win.h"
#elif BUILDFLAG(IS_APPLE)
#include "third_party/skia/include/ports/SkFontMgr_mac_ct.h"
#endif
#endif
#if BUILDFLAG(IS_APPLE)
#include "core/fxge/cfx_textrenderoptions.h"
#endif
namespace {
constexpr uint32_t kInvalidGlyphIndex = …;
class UniqueKeyGen { … };
void UniqueKeyGen::Initialize(std::initializer_list<const int32_t> args) { … }
pdfium::span<const uint8_t> UniqueKeyGen::span() const { … }
UniqueKeyGen::UniqueKeyGen(const CFX_Font* pFont,
const CFX_Matrix& matrix,
int dest_width,
int anti_alias,
bool bNative) { … }
}
CFX_GlyphCache::CFX_GlyphCache(RetainPtr<CFX_Face> face)
: … { … }
CFX_GlyphCache::~CFX_GlyphCache() = default;
std::unique_ptr<CFX_GlyphBitmap> CFX_GlyphCache::RenderGlyph(
const CFX_Font* pFont,
uint32_t glyph_index,
bool bFontStyle,
const CFX_Matrix& matrix,
int dest_width,
int anti_alias) { … }
const CFX_Path* CFX_GlyphCache::LoadGlyphPath(const CFX_Font* pFont,
uint32_t glyph_index,
int dest_width) { … }
const CFX_GlyphBitmap* CFX_GlyphCache::LoadGlyphBitmap(
const CFX_Font* pFont,
uint32_t glyph_index,
bool bFontStyle,
const CFX_Matrix& matrix,
int dest_width,
int anti_alias,
CFX_TextRenderOptions* text_options) { … }
int CFX_GlyphCache::GetGlyphWidth(const CFX_Font* font,
uint32_t glyph_index,
int dest_width,
int weight) { … }
#if defined(PDF_USE_SKIA)
namespace {
SkFontMgr* g_fontmgr = …;
}
void CFX_GlyphCache::InitializeGlobals() { … }
void CFX_GlyphCache::DestroyGlobals() { … }
CFX_TypeFace* CFX_GlyphCache::GetDeviceCache(const CFX_Font* pFont) { … }
#endif
CFX_GlyphBitmap* CFX_GlyphCache::LookUpGlyphBitmap(
const CFX_Font* pFont,
const CFX_Matrix& matrix,
const ByteString& FaceGlyphsKey,
uint32_t glyph_index,
bool bFontStyle,
int dest_width,
int anti_alias) { … }