void CFGAS_FontMgr::RegisterFace(FXFT_Face pFace, const CFX_WideString* pFaceName) { if ((pFace->face_flags & FT_FACE_FLAG_SCALABLE) == 0) return; std::unique_ptr<CFX_FontDescriptor> pFont(new CFX_FontDescriptor); pFont->m_dwFontStyles |= FXFT_Is_Face_Bold(pFace) ? FX_FONTSTYLE_Bold : 0; pFont->m_dwFontStyles |= FXFT_Is_Face_Italic(pFace) ? FX_FONTSTYLE_Italic : 0; pFont->m_dwFontStyles |= GetFlags(pFace); std::vector<uint16_t> charsets = GetCharsets(pFace); GetUSBCSB(pFace, pFont->m_dwUsb, pFont->m_dwCsb); FT_ULong dwTag; FT_ENC_TAG(dwTag, 'n', 'a', 'm', 'e'); std::vector<uint8_t> table; unsigned long nLength = 0; unsigned int error = FXFT_Load_Sfnt_Table(pFace, dwTag, 0, nullptr, &nLength); if (error == 0 && nLength != 0) { table.resize(nLength); if (FXFT_Load_Sfnt_Table(pFace, dwTag, 0, table.data(), nullptr)) table.clear(); } GetNames(table.empty() ? nullptr : table.data(), pFont->m_wsFamilyNames); pFont->m_wsFamilyNames.Add(CFX_ByteString(pFace->family_name).UTF8Decode()); pFont->m_wsFaceName = pFaceName ? *pFaceName : CFX_WideString::FromLocal(FXFT_Get_Postscript_Name(pFace)); pFont->m_nFaceIndex = pFace->face_index; m_InstalledFonts.Add(pFont.release()); }
CFX_WideString CFPF_SkiaFont::GetPsName() { if (!m_Face) { return CFX_WideString(); } return CFX_WideString::FromLocal(FXFT_Get_Postscript_Name(m_Face)); }
CFX_WideString CFX_Font::GetPsName() const { if (m_Face == NULL) { return CFX_WideString(); } CFX_WideString psName = CFX_WideString::FromLocal(FXFT_Get_Postscript_Name(m_Face)); if (psName.IsEmpty()) { psName = CFX_WideString::FromLocal("Untitled"); } return psName; }