131 RetainPtr<CFX_Face> face = m_Font.GetFace();
136#if BUILDFLAG(IS_APPLE)
137 bool bCoreText =
true;
138 if (!m_Font.GetPlatformFont()) {
139 if (m_Font.GetPsName() ==
"DFHeiStd-W5")
142 auto* pPlatform = CFX_GEModule::Get()->GetPlatform();
143 pdfium::span<
const uint8_t> span = m_Font.GetFontSpan();
144 m_Font.SetPlatformFont(pPlatform->CreatePlatformFont(span));
145 if (!m_Font.GetPlatformFont())
149 if (!IsEmbedded() && !IsSymbolicFont() && m_Font.IsTTFont()) {
151 bool bGotOne =
false;
152 for (uint32_t charcode = 0; charcode < kInternalTableSize; charcode++) {
153 constexpr std::array<uint8_t, 4> prefix = {{0x00, 0xf0, 0xf1, 0xf2}};
154 for (
int j = 0; j < 4; j++) {
155 uint16_t unicode = prefix[j] * 256 + charcode;
156 m_GlyphIndex[charcode] = face->GetCharIndex(unicode);
157#if BUILDFLAG(IS_APPLE)
158 CalcExtGID(charcode);
160 if (m_GlyphIndex[charcode]) {
167#if BUILDFLAG(IS_APPLE)
169 m_ExtGID = m_GlyphIndex;
179 for (uint32_t charcode = 0; charcode < kInternalTableSize; charcode++) {
181 GetAdobeCharName(m_BaseEncoding, m_CharNames, charcode);
185 m_Encoding.SetUnicode(charcode, UnicodeFromAdobeName(name));
186 m_GlyphIndex[charcode] =
187 face->GetCharIndex(m_Encoding.UnicodeFromCharCode(charcode));
188#if BUILDFLAG(IS_APPLE)
189 CalcExtGID(charcode);
191 if (m_GlyphIndex[charcode] == 0 && strcmp(name,
".notdef") == 0) {
192 m_Encoding.SetUnicode(charcode, 0x20);
193 m_GlyphIndex[charcode] = face->GetCharIndex(0x20);
194#if BUILDFLAG(IS_APPLE)
195 CalcExtGID(charcode);
199#if BUILDFLAG(IS_APPLE)
201 m_ExtGID = m_GlyphIndex;
206 UseType1Charmap(face);
207#if BUILDFLAG(IS_APPLE)
209 if (FontStyleIsSymbolic(m_Flags)) {
210 for (uint32_t charcode = 0; charcode < kInternalTableSize; charcode++) {
212 GetAdobeCharName(m_BaseEncoding, m_CharNames, charcode);
214 m_Encoding.SetUnicode(charcode, UnicodeFromAdobeName(name));
215 m_GlyphIndex[charcode] = m_Font.GetFace()->GetNameIndex((FT_String*)name);
216 SetExtGID(name, charcode);
218 m_GlyphIndex[charcode] = face->GetCharIndex(charcode);
219 ByteString glyph_name = face->GetGlyphName(m_GlyphIndex[charcode]);
220 const wchar_t unicode =
221 glyph_name.IsEmpty() ? 0
222 : UnicodeFromAdobeName(glyph_name.c_str());
223 m_Encoding.SetUnicode(charcode, unicode);
224 SetExtGID(glyph_name.c_str(), charcode);
230 bool bUnicode = face->SelectCharMap(fxge::FontEncoding::kUnicode);
231 for (uint32_t charcode = 0; charcode < kInternalTableSize; charcode++) {
233 GetAdobeCharName(m_BaseEncoding, m_CharNames, charcode);
237 m_Encoding.SetUnicode(charcode, UnicodeFromAdobeName(name));
238 const char* pStrUnicode = GlyphNameRemap(name);
239 int name_index = m_Font.GetFace()->GetNameIndex((FT_String*)name);
240 if (pStrUnicode && name_index == 0) {
243 m_GlyphIndex[charcode] = name_index;
244 SetExtGID(name, charcode);
245 if (m_GlyphIndex[charcode] != 0)
248 if (strcmp(name,
".notdef") != 0 && strcmp(name,
"space") != 0) {
249 m_GlyphIndex[charcode] = face->GetCharIndex(
250 bUnicode ? m_Encoding.UnicodeFromCharCode(charcode) : charcode);
251 CalcExtGID(charcode);
253 m_Encoding.SetUnicode(charcode, 0x20);
254 m_GlyphIndex[charcode] = bUnicode ? face->GetCharIndex(0x20) : 0xffff;
255 CalcExtGID(charcode);
262 for (size_t charcode = 0; charcode < kInternalTableSize; charcode++) {
263 const char* name = GetAdobeCharName(m_BaseEncoding, m_CharNames,
264 static_cast<uint32_t>(charcode));
266 m_Encoding.SetUnicode(charcode, UnicodeFromAdobeName(name));
267 m_GlyphIndex[charcode] = m_Font.GetFace()->GetNameIndex((FT_String*)name);
269 m_GlyphIndex[charcode] =
270 face->GetCharIndex(
static_cast<uint32_t>(charcode));
271 if (m_GlyphIndex[charcode]) {
272 ByteString glyph_name = face->GetGlyphName(m_GlyphIndex[charcode]);
273 const wchar_t unicode =
274 glyph_name.IsEmpty() ? 0
275 : UnicodeFromAdobeName(glyph_name.c_str());
276 m_Encoding.SetUnicode(charcode, unicode);
280#if BUILDFLAG(IS_APPLE)
282 m_ExtGID = m_GlyphIndex;
289 for (size_t charcode = 0; charcode < kInternalTableSize; charcode++) {
290 const char* name = GetAdobeCharName(m_BaseEncoding, m_CharNames,
291 static_cast<uint32_t>(charcode));
295 m_Encoding.SetUnicode(charcode, UnicodeFromAdobeName(name));
296 m_GlyphIndex[charcode] = m_Font.GetFace()->GetNameIndex((FT_String*)name);
297 if (m_GlyphIndex[charcode] != 0)
300 if (strcmp(name,
".notdef") != 0 && strcmp(name,
"space") != 0) {
301 m_GlyphIndex[charcode] =
302 face->GetCharIndex(bUnicode ? m_Encoding.UnicodeFromCharCode(charcode)
303 :
static_cast<uint32_t>(charcode));
305 m_Encoding.SetUnicode(charcode, 0x20);
306 m_GlyphIndex[charcode] = 0xffff;
309#if BUILDFLAG(IS_APPLE)
311 m_ExtGID = m_GlyphIndex;