#include "core/fpdfapi/font/cpdf_font.h"
#include <algorithm>
#include <array>
#include <memory>
#include <utility>
#include <vector>
#include "build/build_config.h"
#include "constants/font_encodings.h"
#include "core/fpdfapi/font/cpdf_cidfont.h"
#include "core/fpdfapi/font/cpdf_fontencoding.h"
#include "core/fpdfapi/font/cpdf_fontglobals.h"
#include "core/fpdfapi/font/cpdf_tounicodemap.h"
#include "core/fpdfapi/font/cpdf_truetypefont.h"
#include "core/fpdfapi/font/cpdf_type1font.h"
#include "core/fpdfapi/font/cpdf_type3font.h"
#include "core/fpdfapi/parser/cpdf_array.h"
#include "core/fpdfapi/parser/cpdf_dictionary.h"
#include "core/fpdfapi/parser/cpdf_document.h"
#include "core/fpdfapi/parser/cpdf_name.h"
#include "core/fpdfapi/parser/cpdf_stream.h"
#include "core/fpdfapi/parser/cpdf_stream_acc.h"
#include "core/fxcrt/check.h"
#include "core/fxcrt/fx_codepage.h"
#include "core/fxcrt/fx_safe_types.h"
#include "core/fxcrt/stl_util.h"
#include "core/fxge/cfx_fontmapper.h"
#include "core/fxge/cfx_substfont.h"
#include "core/fxge/fx_font.h"
namespace {
constexpr std::array<const char*, 5> kChineseFontNames = …;
}
CPDF_Font::CPDF_Font(CPDF_Document* pDocument,
RetainPtr<CPDF_Dictionary> pFontDict)
: … { … }
CPDF_Font::~CPDF_Font() { … }
bool CPDF_Font::IsType1Font() const { … }
bool CPDF_Font::IsTrueTypeFont() const { … }
bool CPDF_Font::IsType3Font() const { … }
bool CPDF_Font::IsCIDFont() const { … }
const CPDF_Type1Font* CPDF_Font::AsType1Font() const { … }
CPDF_Type1Font* CPDF_Font::AsType1Font() { … }
const CPDF_TrueTypeFont* CPDF_Font::AsTrueTypeFont() const { … }
CPDF_TrueTypeFont* CPDF_Font::AsTrueTypeFont() { … }
const CPDF_Type3Font* CPDF_Font::AsType3Font() const { … }
CPDF_Type3Font* CPDF_Font::AsType3Font() { … }
const CPDF_CIDFont* CPDF_Font::AsCIDFont() const { … }
CPDF_CIDFont* CPDF_Font::AsCIDFont() { … }
size_t CPDF_Font::CountChar(ByteStringView pString) const { … }
#if BUILDFLAG(IS_APPLE)
int CPDF_Font::GlyphFromCharCodeExt(uint32_t charcode) {
return GlyphFromCharCode(charcode, nullptr);
}
#endif
void CPDF_Font::WillBeDestroyed() { … }
bool CPDF_Font::IsVertWriting() const { … }
void CPDF_Font::AppendChar(ByteString* str, uint32_t charcode) const { … }
WideString CPDF_Font::UnicodeFromCharCode(uint32_t charcode) const { … }
uint32_t CPDF_Font::CharCodeFromUnicode(wchar_t unicode) const { … }
bool CPDF_Font::HasFontWidths() const { … }
void CPDF_Font::LoadFontDescriptor(const CPDF_Dictionary* pFontDesc) { … }
void CPDF_Font::CheckFontMetrics() { … }
void CPDF_Font::LoadUnicodeMap() const { … }
int CPDF_Font::GetStringWidth(ByteStringView pString) { … }
RetainPtr<CPDF_Font> CPDF_Font::GetStockFont(CPDF_Document* pDoc,
ByteStringView name) { … }
RetainPtr<CPDF_Font> CPDF_Font::Create(CPDF_Document* pDoc,
RetainPtr<CPDF_Dictionary> pFontDict,
FormFactoryIface* pFactory) { … }
uint32_t CPDF_Font::GetNextChar(ByteStringView pString, size_t* pOffset) const { … }
bool CPDF_Font::IsStandardFont() const { … }
std::optional<FX_Charset> CPDF_Font::GetSubstFontCharset() const { … }
const char* CPDF_Font::GetAdobeCharName(
FontEncoding base_encoding,
const std::vector<ByteString>& charnames,
uint32_t charcode) { … }
uint32_t CPDF_Font::FallbackFontFromCharcode(uint32_t charcode) { … }
int CPDF_Font::FallbackGlyphFromCharcode(int fallbackFont, uint32_t charcode) { … }
CFX_Font* CPDF_Font::GetFontFallback(int position) { … }
bool CPDF_Font::UseTTCharmap(const RetainPtr<CFX_Face>& face,
int platform_id,
int encoding_id) { … }
int CPDF_Font::GetFontWeight() const { … }