#include "core/fxge/cfx_folderfontinfo.h"
#include <array>
#include <iterator>
#include <limits>
#include <utility>
#include "build/build_config.h"
#include "core/fxcrt/byteorder.h"
#include "core/fxcrt/check_op.h"
#include "core/fxcrt/compiler_specific.h"
#include "core/fxcrt/containers/contains.h"
#include "core/fxcrt/fixed_size_data_vector.h"
#include "core/fxcrt/fx_codepage.h"
#include "core/fxcrt/fx_extension.h"
#include "core/fxcrt/fx_folder.h"
#include "core/fxcrt/fx_safe_types.h"
#include "core/fxcrt/fx_system.h"
#include "core/fxcrt/stl_util.h"
#include "core/fxge/cfx_fontmapper.h"
#include "core/fxge/fx_font.h"
namespace {
struct FontSubst { … };
constexpr auto kBase14Substs = …;
struct FxFileCloser { … };
bool FindFamilyNameMatch(ByteStringView family_name,
const ByteString& installed_font_name) { … }
ByteString ReadStringFromFile(FILE* pFile, uint32_t size) { … }
ByteString LoadTableFromTT(FILE* pFile,
const uint8_t* pTables,
uint32_t nTables,
uint32_t tag,
FX_FILESIZE fileSize) { … }
uint32_t GetCharset(FX_Charset charset) { … }
}
CFX_FolderFontInfo::CFX_FolderFontInfo() = default;
CFX_FolderFontInfo::~CFX_FolderFontInfo() = default;
void CFX_FolderFontInfo::AddPath(const ByteString& path) { … }
bool CFX_FolderFontInfo::EnumFontList(CFX_FontMapper* pMapper) { … }
void CFX_FolderFontInfo::ScanPath(const ByteString& path) { … }
void CFX_FolderFontInfo::ScanFile(const ByteString& path) { … }
void CFX_FolderFontInfo::ReportFace(const ByteString& path,
FILE* pFile,
FX_FILESIZE filesize,
uint32_t offset) { … }
void* CFX_FolderFontInfo::GetSubstFont(const ByteString& face) { … }
void* CFX_FolderFontInfo::FindFont(int weight,
bool bItalic,
FX_Charset charset,
int pitch_family,
const ByteString& family,
bool bMatchName) { … }
void* CFX_FolderFontInfo::MapFont(int weight,
bool bItalic,
FX_Charset charset,
int pitch_family,
const ByteString& face) { … }
void* CFX_FolderFontInfo::GetFont(const ByteString& face) { … }
size_t CFX_FolderFontInfo::GetFontData(void* hFont,
uint32_t table,
pdfium::span<uint8_t> buffer) { … }
void CFX_FolderFontInfo::DeleteFont(void* hFont) { … }
bool CFX_FolderFontInfo::GetFaceName(void* hFont, ByteString* name) { … }
bool CFX_FolderFontInfo::GetFontCharset(void* hFont, FX_Charset* charset) { … }
CFX_FolderFontInfo::FontFaceInfo::FontFaceInfo(ByteString filePath,
ByteString faceName,
ByteString fontTables,
uint32_t fontOffset,
uint32_t fileSize)
: … { … }
bool CFX_FolderFontInfo::FontFaceInfo::IsEligibleForFindFont(
uint32_t flag,
FX_Charset charset) const { … }
int32_t CFX_FolderFontInfo::FontFaceInfo::SimilarityScore(
int weight,
bool italic,
int pitch_family,
bool exact_match_bonus) const { … }