7#include "core/fxge/apple/fx_apple_platform.h"
12#include "core/fxcrt/compiler_specific.h"
13#include "core/fxcrt/fx_codepage.h"
14#include "core/fxge/cfx_folderfontinfo.h"
15#include "core/fxge/cfx_fontmgr.h"
16#include "core/fxge/fx_font.h"
17#include "core/fxge/systemfontinfo_iface.h"
23 const char* m_pSubstName;
26constexpr Substs kBase14Substs[] = {
27 {
"Courier",
"Courier New"},
28 {
"Courier-Bold",
"Courier New Bold"},
29 {
"Courier-BoldOblique",
"Courier New Bold Italic"},
30 {
"Courier-Oblique",
"Courier New Italic"},
31 {
"Helvetica",
"Arial"},
32 {
"Helvetica-Bold",
"Arial Bold"},
33 {
"Helvetica-BoldOblique",
"Arial Bold Italic"},
34 {
"Helvetica-Oblique",
"Arial Italic"},
35 {
"Times-Roman",
"Times New Roman"},
36 {
"Times-Bold",
"Times New Roman Bold"},
37 {
"Times-BoldItalic",
"Times New Roman Bold Italic"},
38 {
"Times-Italic",
"Times New Roman Italic"},
43 CFX_MacFontInfo() =
default;
44 ~CFX_MacFontInfo()
override =
default;
47 void* MapFont(
int weight,
53 bool ParseFontCfg(
const char** pUserPaths);
56constexpr char kJapanGothic[] =
"Hiragino Kaku Gothic Pro W6";
57constexpr char kJapanMincho[] =
"Hiragino Mincho Pro W6";
62 if (face.Contains(
"Gothic"))
69void* CFX_MacFontInfo::MapFont(
int weight,
74 for (
const auto& sub : kBase14Substs) {
75 if (face == ByteStringView(sub.m_pName))
76 return GetFont(sub.m_pSubstName);
86 if (!face.Contains(
"Bold") && !face.Contains(
"Italic")) {
91 new_face
+= " Italic";
92 auto it = m_FontList.find(new_face);
93 if (it != m_FontList.end())
94 return it->second.get();
97 auto it = m_FontList.find(face);
98 if (it != m_FontList.end())
99 return it->second.get();
110 other_face
= GetJapanesePreference(face, weight, pitch_family);
113 other_face
= "STSong";
116 other_face
= "AppleMyungjo";
119 other_face
= "LiSong Pro Light";
125 it = m_FontList.find(other_face);
126 return it != m_FontList.end() ? it->second.get() :
nullptr;
129bool CFX_MacFontInfo::ParseFontCfg(
const char** pUserPaths) {
134 for (
const char** pPath = pUserPaths; *pPath; ++pPath) {
151 auto pInfo =
std::make_unique<CFX_MacFontInfo>();
153 pInfo->AddPath(
"~/Library/Fonts");
154 pInfo->AddPath(
"/Library/Fonts");
155 pInfo->AddPath(
"/System/Library/Fonts");
161 pdfium::span<
const uint8_t> font_span) {
166std::unique_ptr<CFX_GEModule::PlatformIface>
168 return std::make_unique<CApplePlatform>();
fxcrt::ByteString ByteString
void AddPath(const ByteString &path)
void * GetFont(const ByteString &face) override
static CFX_GEModule * Get()
const char ** GetUserFontPaths() const
ByteString & operator+=(const char *str)
ByteString & operator=(const char *str)
ByteString & operator=(const ByteString &that)
ByteString & operator=(ByteString &&that) noexcept
bool FontFamilyIsFixedPitch(uint32_t family)
bool FontFamilyIsRoman(uint32_t family)