CFX_ByteString _FPDF_GetPSNameFromTT(HDC hDC) { CFX_ByteString result; DWORD size = ::GetFontData(hDC, 'eman', 0, NULL, 0); if (size != GDI_ERROR) { LPBYTE buffer = FX_Alloc(BYTE, size); ::GetFontData(hDC, 'eman', 0, buffer, size); result = GetNameFromTT(buffer, 6); FX_Free(buffer); } return result; }
CFX_ByteString CFX_FontMapper::GetPSNameFromTT(void* hFont) { if (!m_pFontInfo) return CFX_ByteString(); uint32_t size = m_pFontInfo->GetFontData(hFont, kTableNAME, nullptr, 0); if (!size) return CFX_ByteString(); std::vector<uint8_t> buffer(size); uint8_t* buffer_ptr = buffer.data(); uint32_t bytes_read = m_pFontInfo->GetFontData(hFont, kTableNAME, buffer_ptr, size); return bytes_read == size ? GetNameFromTT(buffer_ptr, bytes_read, 6) : CFX_ByteString(); }