diff --git a/DesktopEditor/fontengine/FontFile.cpp b/DesktopEditor/fontengine/FontFile.cpp index 72b052d33f..b9b342d5e1 100644 --- a/DesktopEditor/fontengine/FontFile.cpp +++ b/DesktopEditor/fontengine/FontFile.cpp @@ -175,9 +175,6 @@ CFontFile::CFontFile() CFontFile::~CFontFile() { - if (m_pFontManager && m_pFontManager->m_pFont == this) - m_pFontManager->m_pFont = NULL; - RELEASEINTERFACE(m_pStream); ClearCache(); diff --git a/DesktopEditor/fontengine/FontManager.cpp b/DesktopEditor/fontengine/FontManager.cpp index 7dd45a5f03..3010a39722 100644 --- a/DesktopEditor/fontengine/FontManager.cpp +++ b/DesktopEditor/fontengine/FontManager.cpp @@ -232,13 +232,8 @@ NSFonts::IFontFile* CFontsCache::LockFont(NSFonts::CLibrary& library, const std: if (NULL == m_pApplicationFontStreams) return NULL; - std::string sLock = NSFile::CUtf8Converter::GetUtf8StringFromUnicode2(strFileName.c_str(), strFileName.length(), false); - - char buffer[50]; - sprintf(buffer, "%d_%.2lf", lFaceIndex, dSize); - std::string s(buffer); - - sLock += s; + std::string sLock = U_TO_UTF8(strFileName); + sLock += (std::to_string(lFaceIndex) + "_" + std::to_string((int)(100 * dSize + 0.5))); CFontFile* pFile = m_mapFiles[sLock]; diff --git a/DesktopEditor/graphics/MetafileToRenderer.cpp b/DesktopEditor/graphics/MetafileToRenderer.cpp index fa72fc2237..c6d8a18e7e 100644 --- a/DesktopEditor/graphics/MetafileToRenderer.cpp +++ b/DesktopEditor/graphics/MetafileToRenderer.cpp @@ -140,6 +140,8 @@ public: m_pRenderer->CommandDrawText(bsText, x, y, w, h); m_pRenderer->put_FontName(sName); m_pRenderer->put_FontStyle(nStyle); + + RELEASEINTERFACE(pFileNew); } void SetRenderer(IRenderer* pRenderer) diff --git a/DesktopEditor/raster/Metafile/Common/MetaFileRenderer.h b/DesktopEditor/raster/Metafile/Common/MetaFileRenderer.h index 0f7fe1afd5..becb778fa1 100644 --- a/DesktopEditor/raster/Metafile/Common/MetaFileRenderer.h +++ b/DesktopEditor/raster/Metafile/Common/MetaFileRenderer.h @@ -268,7 +268,7 @@ namespace MetaFile } for (unsigned int unIndex = 0; unIndex < std::min(arPoints.size(), wsString.length()); ++unIndex) - m_pRenderer->CommandDrawText(std::wstring(1, wsString[unIndex]), arGlyphPoint[unIndex].x, arGlyphPoint[unIndex].y, 0, 0); + m_pRenderer->CommandDrawTextCHAR(wsString[unIndex], arGlyphPoint[unIndex].x, arGlyphPoint[unIndex].y, 0, 0); } @@ -574,8 +574,7 @@ namespace MetaFile double dKoefX = m_dScaleX; for (unsigned int unCharIndex = 0; unCharIndex < unUnicodeLen; unCharIndex++) { - std::wstring wsChar = NSStringExt::CConverter::GetUnicodeFromUTF32(&*(pUnicode + unCharIndex), 1); - m_pRenderer->CommandDrawText(wsChar, dX + dOffset, dY, 0, 0); + m_pRenderer->CommandDrawTextCHAR(pUnicode[unCharIndex], dX + dOffset, dY, 0, 0); dOffset += (pDx[unCharIndex] * dKoefX); } diff --git a/HtmlRenderer/include/ASCSVGWriter.h b/HtmlRenderer/include/ASCSVGWriter.h index 960dbfefca..b6fe4b8ce5 100644 --- a/HtmlRenderer/include/ASCSVGWriter.h +++ b/HtmlRenderer/include/ASCSVGWriter.h @@ -191,7 +191,6 @@ namespace NSHtmlRenderer Aggplus::CGraphicsPathSimpleConverter* m_pSimpleGraphicsConverter; // конвертер сложных гафических путей в простые NSFonts::IFontManager* m_pFontManager; // менеджер шрифтов - bool m_bDeleteFontManager; Aggplus::CMatrix* m_pBaseTransform; // матрица перерасчета координатных осей (здесь: миллиметры -> пикселы) Aggplus::CMatrix* m_pTransform; // текущая матрица преобразований рендерера diff --git a/HtmlRenderer/src/ASCSVGWriter.cpp b/HtmlRenderer/src/ASCSVGWriter.cpp index ddb6e571e7..f348c35416 100644 --- a/HtmlRenderer/src/ASCSVGWriter.cpp +++ b/HtmlRenderer/src/ASCSVGWriter.cpp @@ -53,7 +53,6 @@ namespace NSHtmlRenderer m_dTransformAngle = 0.0; m_pFontManager = NULL; - m_bDeleteFontManager = true; m_pPen = new NSStructures::CPen(); m_pBrush = new NSStructures::CBrush(); m_pFont = new NSStructures::CFont(); @@ -79,8 +78,6 @@ namespace NSHtmlRenderer CASCSVGWriter::~CASCSVGWriter() { RELEASEOBJECT(m_pSimpleGraphicsConverter); - if(m_bDeleteFontManager) - NSBase::Release(m_pFontManager); RELEASEOBJECT(m_pPen); RELEASEOBJECT(m_pBrush); RELEASEOBJECT(m_pFont); @@ -89,6 +86,8 @@ namespace NSHtmlRenderer RELEASEOBJECT(m_pTransform); RELEASEOBJECT(m_pFullTransform); RELEASEOBJECT(m_pVectorWriter); + + RELEASEINTERFACE(m_pFontManager); } void CASCSVGWriter::Reset() { @@ -934,13 +933,12 @@ namespace NSHtmlRenderer // -------------------------------------------------------------------------------------------- void CASCSVGWriter::SetFontManager(NSFonts::IFontManager* pFontManager) { - if(NULL != pFontManager) - { - if(m_bDeleteFontManager) - NSBase::Release(m_pFontManager); - m_pFontManager = pFontManager; - m_bDeleteFontManager = false; - } + if (NULL == pFontManager) + return; + + RELEASEINTERFACE(m_pFontManager); + m_pFontManager = pFontManager; + ADDREFINTERFACE(m_pFontManager); } void CASCSVGWriter::CalculateFullTransform() {