7#ifndef CORE_FXGE_CFX_GLYPHCACHE_H_
8#define CORE_FXGE_CFX_GLYPHCACHE_H_
14#include "core/fxcrt/bytestring.h"
15#include "core/fxcrt/observed_ptr.h"
16#include "core/fxcrt/retain_ptr.h"
17#include "core/fxge/cfx_face.h"
19#if defined(PDF_USE_SKIA)
20#include "core/fxge/fx_font.h"
21#include "third_party/skia/include/core/SkRefCnt.h"
51#if defined(PDF_USE_SKIA)
52 CFX_TypeFace* GetDeviceCache(
const CFX_Font* pFont);
53 static void InitializeGlobals();
54 static void DestroyGlobals();
58 explicit CFX_GlyphCache(
RetainPtr<CFX_Face> face);
61 using SizeGlyphCache = std::map<uint32_t, std::unique_ptr<CFX_GlyphBitmap>>;
63 using PathMapKey =
std::tuple<uint32_t,
int,
int,
int,
bool>;
65 using WidthMapKey =
std::tuple<uint32_t,
int,
int>;
67 std::unique_ptr<CFX_GlyphBitmap> RenderGlyph(
const CFX_Font* pFont,
73 std::unique_ptr<CFX_GlyphBitmap> RenderGlyph_Nativetext(
81 const ByteString& FaceGlyphsKey,
87 std::map<ByteString, SizeGlyphCache> m_SizeMap;
88 std::map<PathMapKey, std::unique_ptr<CFX_Path>> m_PathMap;
89 std::map<WidthMapKey,
int> m_WidthMap;
90#if defined(PDF_USE_SKIA)
91 sk_sp<SkTypeface> m_pTypeface;
ByteString GetPsName() const
CFX_SubstFont * GetSubstFont() const
PlatformIface * GetPlatform() const
static CFX_GEModule * Get()
const CFX_GlyphBitmap * 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 GetGlyphWidth(const CFX_Font *font, uint32_t glyph_index, int dest_width, int weight)
const CFX_Path * LoadGlyphPath(const CFX_Font *pFont, uint32_t glyph_index, int dest_width)
RetainPtr< CFX_Face > GetFace()
~CFX_GlyphCache() override
void SetGraphicsTextMatrix(void *graphics, const CFX_Matrix &matrix)
void DestroyFont(void *pFont)
void DestroyGraphics(void *graphics)
void * CreateGraphics(const RetainPtr< CFX_DIBitmap > &bitmap)
bool DrawGraphicsString(void *graphics, void *font, float fontSize, pdfium::span< uint16_t > glyphIndices, pdfium::span< CGPoint > glyphPositions, FX_ARGB argb)
void * CreateFont(pdfium::span< const uint8_t > pFontData)
bool operator==(const char *ptr) const
bool DrawDeviceText(pdfium::span< const TextCharPos > pCharPos, CFX_Font *pFont, const CFX_Matrix &mtObject2Device, float font_size, uint32_t color, const CFX_TextRenderOptions &options) override
#define CONSTRUCT_VIA_MAKE_RETAIN