129 RetainPtr<CFX_Face> face = m_Font.GetFace();
134#if BUILDFLAG(IS_APPLE)
135 bool bCoreText =
true;
136 if (!m_Font.GetPlatformFont()) {
137 if (m_Font.GetPsName() ==
"DFHeiStd-W5")
140 auto* pPlatform = CFX_GEModule::Get()->GetPlatform();
141 pdfium::span<
const uint8_t> span = m_Font.GetFontSpan();
142 m_Font.SetPlatformFont(pPlatform->CreatePlatformFont(span));
143 if (!m_Font.GetPlatformFont())
147 if (!IsEmbedded() && !IsSymbolicFont() && m_Font.IsTTFont()) {
149 bool bGotOne =
false;
150 for (uint32_t charcode = 0; charcode < kInternalTableSize; charcode++) {
151 const uint8_t prefix[4] = {0x00, 0xf0, 0xf1, 0xf2};
152 for (
int j = 0; j < 4; j++) {
153 uint16_t unicode = prefix[j] * 256 + charcode;
154 m_GlyphIndex[charcode] = face->GetCharIndex(unicode);
155#if BUILDFLAG(IS_APPLE)
156 CalcExtGID(charcode);
158 if (m_GlyphIndex[charcode]) {
165#if BUILDFLAG(IS_APPLE)
167 memcpy(m_ExtGID, m_GlyphIndex,
sizeof(m_ExtGID));
176 for (uint32_t charcode = 0; charcode < kInternalTableSize; charcode++) {
178 GetAdobeCharName(m_BaseEncoding, m_CharNames, charcode);
182 m_Encoding.SetUnicode(charcode, UnicodeFromAdobeName(name));
183 m_GlyphIndex[charcode] =
184 face->GetCharIndex(m_Encoding.UnicodeFromCharCode(charcode));
185#if BUILDFLAG(IS_APPLE)
186 CalcExtGID(charcode);
188 if (m_GlyphIndex[charcode] == 0 && strcmp(name,
".notdef") == 0) {
189 m_Encoding.SetUnicode(charcode, 0x20);
190 m_GlyphIndex[charcode] = face->GetCharIndex(0x20);
191#if BUILDFLAG(IS_APPLE)
192 CalcExtGID(charcode);
196#if BUILDFLAG(IS_APPLE)
198 fxcrt::spancpy(pdfium::make_span(m_ExtGID),
199 pdfium::make_span(m_GlyphIndex));
204 UseType1Charmap(face);
205#if BUILDFLAG(IS_APPLE)
207 if (FontStyleIsSymbolic(m_Flags)) {
208 for (uint32_t charcode = 0; charcode < kInternalTableSize; charcode++) {
210 GetAdobeCharName(m_BaseEncoding, m_CharNames, charcode);
212 m_Encoding.SetUnicode(charcode, UnicodeFromAdobeName(name));
213 m_GlyphIndex[charcode] = m_Font.GetFace()->GetNameIndex((FT_String*)name);
214 SetExtGID(name, charcode);
216 m_GlyphIndex[charcode] = face->GetCharIndex(charcode);
217 char name_glyph[kInternalTableSize] = {};
218 FT_Get_Glyph_Name(m_Font.GetFaceRec(), m_GlyphIndex[charcode],
219 name_glyph,
sizeof(name_glyph));
220 name_glyph[kInternalTableSize - 1] = 0;
221 const wchar_t unicode =
222 name_glyph[0] != 0 ? UnicodeFromAdobeName(name_glyph) : 0;
223 m_Encoding.SetUnicode(charcode, unicode);
224 SetExtGID(name_glyph, 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 char name_glyph[kInternalTableSize] = {};
273 FT_Get_Glyph_Name(m_Font.GetFaceRec(), m_GlyphIndex[charcode],
274 name_glyph,
sizeof(name_glyph));
275 name_glyph[kInternalTableSize - 1] = 0;
276 const wchar_t unicode =
277 name_glyph[0] != 0 ? UnicodeFromAdobeName(name_glyph) : 0;
278 m_Encoding.SetUnicode(charcode, unicode);
282#if BUILDFLAG(IS_APPLE)
284 memcpy(m_ExtGID, m_GlyphIndex,
sizeof(m_ExtGID));
290 for (size_t charcode = 0; charcode < kInternalTableSize; charcode++) {
291 const char* name = GetAdobeCharName(m_BaseEncoding, m_CharNames,
292 static_cast<uint32_t>(charcode));
296 m_Encoding.SetUnicode(charcode, UnicodeFromAdobeName(name));
297 m_GlyphIndex[charcode] = m_Font.GetFace()->GetNameIndex((FT_String*)name);
298 if (m_GlyphIndex[charcode] != 0)
301 if (strcmp(name,
".notdef") != 0 && strcmp(name,
"space") != 0) {
302 m_GlyphIndex[charcode] =
303 face->GetCharIndex(bUnicode ? m_Encoding.UnicodeFromCharCode(charcode)
304 :
static_cast<uint32_t>(charcode));
306 m_Encoding.SetUnicode(charcode, 0x20);
307 m_GlyphIndex[charcode] = 0xffff;
310#if BUILDFLAG(IS_APPLE)
312 memcpy(m_ExtGID, m_GlyphIndex,
sizeof(m_ExtGID));