mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-10 18:05:41 +08:00
Create test GetEmbeddedFont
This commit is contained in:
@ -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)
|
||||
{
|
||||
|
||||
@ -856,7 +856,9 @@ std::map<std::wstring, std::wstring> CAnnotFonts::GetFreeTextFont(PDFDoc* pdfDoc
|
||||
std::map<std::wstring, std::wstring> mRes;
|
||||
|
||||
std::map<std::wstring, std::wstring> mFontFreeText = GetAnnotFont(pdfDoc, pFontManager, pFontList, oAnnotRef);
|
||||
|
||||
#ifndef BUILDING_WASM_MODULE
|
||||
return mFontFreeText;
|
||||
#endif
|
||||
CFontList* pAppFontList = (CFontList*)pFontManager->GetApplication()->GetList();
|
||||
for (int i = 0; i < arrRC.size(); ++i)
|
||||
{
|
||||
@ -891,8 +893,10 @@ std::map<std::wstring, std::wstring> CAnnotFonts::GetFreeTextFont(PDFDoc* pdfDoc
|
||||
|
||||
const unsigned char* pData14 = NULL;
|
||||
unsigned int nSize14 = 0;
|
||||
if (!NSFonts::NSApplicationFontStream::GetGlobalMemoryStorage()->Get(wsFontName) && GetBaseFont(wsFontName, pData14, nSize14))
|
||||
NSFonts::NSApplicationFontStream::GetGlobalMemoryStorage()->Add(wsFontName, (BYTE*)pData14, nSize14, false);
|
||||
NSFonts::IFontsMemoryStorage* pMemoryStorage = NSFonts::NSApplicationFontStream::GetGlobalMemoryStorage();
|
||||
if (pMemoryStorage && !pMemoryStorage->Get(wsFontName) && GetBaseFont(wsFontName, pData14, nSize14))
|
||||
pMemoryStorage->Add(wsFontName, (BYTE*)pData14, nSize14, false);
|
||||
|
||||
std::string sFontNameBefore = arrRC[i]->sFontFamily;
|
||||
arrRC[i]->sFontFamily = sFontName;
|
||||
arrRC[i]->bFind = true;
|
||||
|
||||
@ -196,6 +196,15 @@ TEST_F(CPdfFileTest, GetMetaData)
|
||||
RELEASEARRAYOBJECTS(pMetaData);
|
||||
}
|
||||
|
||||
TEST_F(CPdfFileTest, GetEmbeddedFont)
|
||||
{
|
||||
//GTEST_SKIP();
|
||||
|
||||
LoadFromFile();
|
||||
|
||||
std::wcout << pdfFile->GetEmbeddedFontPath(L"Symbol") << std::endl;
|
||||
}
|
||||
|
||||
TEST_F(CPdfFileTest, ValidMetaData)
|
||||
{
|
||||
GTEST_SKIP();
|
||||
@ -282,7 +291,7 @@ TEST_F(CPdfFileTest, SetMetaData)
|
||||
|
||||
TEST_F(CPdfFileTest, ConvertToRaster)
|
||||
{
|
||||
//GTEST_SKIP();
|
||||
GTEST_SKIP();
|
||||
|
||||
LoadFromFile();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user