Fix embedded fonts

This commit is contained in:
Svetlana Kulikova
2024-06-14 12:34:34 +03:00
parent ad4ba02895
commit cc27db504f
3 changed files with 18 additions and 11 deletions

View File

@ -886,23 +886,29 @@ HRESULT CPdfFile::put_FontName(const std::wstring& wsName)
{
if (!m_pInternal->pWriter)
return S_FALSE;
std::wstring wsFont = wsName;
if (m_pInternal->pEditor && wsName.find(L"Embedded: ") == 0)
{
std::wstring sSub = wsName.substr(0, 10);
std::wstring sSub = wsName.substr(10);
bool bBold = false, bItalic = false;
std::wstring wsFontPath;
if (m_pInternal->pEditor->IsBase14(sSub, bBold, bItalic, wsFontPath) && (bBold || bItalic))
if (m_pInternal->pEditor->IsBase14(sSub, bBold, bItalic, wsFontPath))
{
LONG lStyle = 0;
if (bBold)
lStyle |= 1;
if (bItalic)
lStyle |= 2;
put_FontStyle(lStyle);
if (bBold || bItalic)
{
LONG lStyle = 0;
if (bBold)
lStyle |= 1;
if (bItalic)
lStyle |= 2;
put_FontStyle(lStyle);
}
}
m_pInternal->pWriter->AddFont(wsName, bBold, bItalic, wsFontPath, 0);
else
wsFont = sSub;
m_pInternal->pWriter->AddFont(wsFont, bBold, bItalic, wsFontPath, 0);
}
return m_pInternal->pWriter->put_FontName(wsName);
return m_pInternal->pWriter->put_FontName(wsFont);
}
HRESULT CPdfFile::get_FontPath(std::wstring* wsPath)
{