#include "core/fpdfapi/font/cpdf_cidfont.h"
#include <algorithm>
#include <array>
#include <limits>
#include <utility>
#include <vector>
#include "build/build_config.h"
#include "core/fpdfapi/cmaps/fpdf_cmaps.h"
#include "core/fpdfapi/font/cfx_cttgsubtable.h"
#include "core/fpdfapi/font/cpdf_cid2unicodemap.h"
#include "core/fpdfapi/font/cpdf_cmap.h"
#include "core/fpdfapi/font/cpdf_cmapparser.h"
#include "core/fpdfapi/font/cpdf_fontencoding.h"
#include "core/fpdfapi/font/cpdf_fontglobals.h"
#include "core/fpdfapi/parser/cpdf_array.h"
#include "core/fpdfapi/parser/cpdf_dictionary.h"
#include "core/fpdfapi/parser/cpdf_stream.h"
#include "core/fpdfapi/parser/cpdf_stream_acc.h"
#include "core/fxcrt/check.h"
#include "core/fxcrt/check_op.h"
#include "core/fxcrt/fixed_size_data_vector.h"
#include "core/fxcrt/fx_codepage.h"
#include "core/fxcrt/fx_memory.h"
#include "core/fxcrt/fx_safe_types.h"
#include "core/fxcrt/fx_unicode.h"
#include "core/fxcrt/span.h"
#include "core/fxcrt/span_util.h"
#include "core/fxcrt/stl_util.h"
#include "core/fxge/fx_font.h"
namespace {
struct LowHighVal { … };
struct LowHighValXY : LowHighVal { … };
bool IsMetricForCID(const LowHighVal& val, uint16_t cid) { … }
constexpr std::array<FX_CodePage, CIDSET_NUM_SETS> kCharsetCodePages = …;
constexpr CIDTransform kJapan1VerticalCIDs[] = …;
#if !BUILDFLAG(IS_WIN)
bool IsValidEmbeddedCharcodeFromUnicodeCharset(CIDSet charset) { … }
wchar_t EmbeddedUnicodeFromCharcode(const fxcmap::CMap* pEmbedMap,
CIDSet charset,
uint32_t charcode) { … }
uint32_t EmbeddedCharcodeFromUnicode(const fxcmap::CMap* pEmbedMap,
CIDSet charset,
wchar_t unicode) { … }
#endif
void UseCIDCharmap(const RetainPtr<CFX_Face>& face, CIDCoding coding) { … }
void LoadMetricsArray(RetainPtr<const CPDF_Array> pArray,
std::vector<int>* result,
int nElements) { … }
}
CPDF_CIDFont::CPDF_CIDFont(CPDF_Document* pDocument,
RetainPtr<CPDF_Dictionary> pFontDict)
: … { … }
CPDF_CIDFont::~CPDF_CIDFont() = default;
bool CPDF_CIDFont::IsCIDFont() const { … }
const CPDF_CIDFont* CPDF_CIDFont::AsCIDFont() const { … }
CPDF_CIDFont* CPDF_CIDFont::AsCIDFont() { … }
uint16_t CPDF_CIDFont::CIDFromCharCode(uint32_t charcode) const { … }
bool CPDF_CIDFont::IsVertWriting() const { … }
WideString CPDF_CIDFont::UnicodeFromCharCode(uint32_t charcode) const { … }
wchar_t CPDF_CIDFont::GetUnicodeFromCharCode(uint32_t charcode) const { … }
uint32_t CPDF_CIDFont::CharCodeFromUnicode(wchar_t unicode) const { … }
bool CPDF_CIDFont::Load() { … }
FX_RECT CPDF_CIDFont::GetCharBBox(uint32_t charcode) { … }
int CPDF_CIDFont::GetCharWidthF(uint32_t charcode) { … }
int16_t CPDF_CIDFont::GetVertWidth(uint16_t cid) const { … }
CFX_Point16 CPDF_CIDFont::GetVertOrigin(uint16_t cid) const { … }
int CPDF_CIDFont::GetGlyphIndex(uint32_t unicode, bool* pVertGlyph) { … }
int CPDF_CIDFont::GetVerticalGlyph(int index, bool* pVertGlyph) { … }
int CPDF_CIDFont::GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) { … }
uint32_t CPDF_CIDFont::GetNextChar(ByteStringView pString,
size_t* pOffset) const { … }
int CPDF_CIDFont::GetCharSize(uint32_t charcode) const { … }
size_t CPDF_CIDFont::CountChar(ByteStringView pString) const { … }
void CPDF_CIDFont::AppendChar(ByteString* str, uint32_t charcode) const { … }
bool CPDF_CIDFont::IsUnicodeCompatible() const { … }
void CPDF_CIDFont::LoadSubstFont() { … }
float CPDF_CIDFont::CIDTransformToFloat(uint8_t ch) { … }
void CPDF_CIDFont::LoadGB2312() { … }
const CIDTransform* CPDF_CIDFont::GetCIDTransform(uint16_t cid) const { … }