Create test GetEmbeddedFont

This commit is contained in:
Svetlana Kulikova
2024-09-23 15:43:48 +03:00
parent 5c3a697880
commit b536d6eb41
3 changed files with 18 additions and 34 deletions

View File

@ -751,36 +751,7 @@ std::wstring CPdfReader::GetInfo()
std::wstring CPdfReader::GetFontPath(const std::wstring& wsFontName, bool bSave)
{
std::map<std::wstring, std::wstring>::const_iterator oIter = m_mFonts.find(wsFontName);
if (oIter == m_mFonts.end())
return std::wstring();
if (!bSave)
return oIter->second;
NSFonts::IFontsMemoryStorage* pMemoryStorage = NSFonts::NSApplicationFontStream::GetGlobalMemoryStorage();
if (pMemoryStorage)
{
NSFonts::IFontStream* pStream = pMemoryStorage->Get(oIter->second);
if (pStream)
{
BYTE* pData = NULL;
LONG lLength = 0;
pStream->GetMemory(pData, lLength);
if (pData)
{
NSFile::CFileBinary oFile;
std::wstring sFilePath = oFile.CreateTempFileWithUniqueName(m_wsTempFolder, L"EF");
if (oFile.WriteFile(pData, lLength))
{
oFile.CloseFile();
return sFilePath;
}
oFile.CloseFile();
}
}
}
return std::wstring();
return oIter == m_mFonts.end() ? std::wstring() : oIter->second;
}
void getBookmarks(PDFDoc* pdfDoc, OutlineItem* pOutlineItem, NSWasm::CData& out, int level)
{