mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Remove depends to CSvgFile from HtmlFile2. Add initialize fontsfor svg.
This commit is contained in:
@ -448,6 +448,37 @@ namespace MetaFile
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMetaFile::LoadFromString(const std::wstring& data)
|
||||
{
|
||||
#ifdef METAFILE_SUPPORT_SVG
|
||||
RELEASEINTERFACE(m_pFontManager);
|
||||
|
||||
if (m_pAppFonts)
|
||||
{
|
||||
m_pFontManager = m_pAppFonts->GenerateFontManager();
|
||||
NSFonts::IFontsCache* pMeasurerCache = NSFonts::NSFontCache::Create();
|
||||
pMeasurerCache->SetStreams(m_pAppFonts->GetStreams());
|
||||
m_pFontManager->SetOwnerCache(pMeasurerCache);
|
||||
}
|
||||
|
||||
m_oSvgFile.SetFontManager(m_pFontManager);
|
||||
|
||||
if (m_oSvgFile.ReadFromWString(data) == true)
|
||||
{
|
||||
m_lType = c_lMetaSvg;
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
void CMetaFile::SetTempDirectory(const std::wstring& dir)
|
||||
{
|
||||
#ifdef METAFILE_SUPPORT_SVG
|
||||
m_oSvgFile.SetWorkingDirectory(dir);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool CMetaFile::DrawOnRenderer(IRenderer* pRenderer, double dX, double dY, double dWidth, double dHeight)
|
||||
{
|
||||
if (NULL == pRenderer)
|
||||
|
||||
@ -64,6 +64,7 @@ namespace MetaFile
|
||||
|
||||
bool LoadFromFile(const wchar_t* wsFilePath);
|
||||
bool LoadFromBuffer(BYTE* pBuffer, unsigned int unSize);
|
||||
bool LoadFromString(const std::wstring& data);
|
||||
bool DrawOnRenderer(IRenderer* pRenderer, double dX, double dY, double dWidth, double dHeight);
|
||||
void Close();
|
||||
void GetBounds(double* pdX, double* pdY, double* pdW, double* pdH);
|
||||
@ -75,6 +76,8 @@ namespace MetaFile
|
||||
//конвертация в Svg
|
||||
std::wstring ConvertToSvg(unsigned int unWidth = 0, unsigned int unHeight = 0);
|
||||
|
||||
void SetTempDirectory(const std::wstring& dir);
|
||||
|
||||
//Для тестов
|
||||
#ifdef METAFILE_SUPPORT_WMF_EMF
|
||||
void ConvertToXml(const wchar_t *wsFilePath);
|
||||
|
||||
Reference in New Issue
Block a user