Commit c5eaf5e2 authored by Ilya.Kirillov's avatar Ilya.Kirillov Committed by Alexander Trofimov

Ускорен поиск шрифтов по имени. Исправлены баги с записью лишних объектов ExtGState.

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@63271 954022d7-b5bf-4e40-9824-e11837661b57
parent 9bda3e86
......@@ -70,6 +70,7 @@ CPdfRenderer::CPdfRenderer(CApplicationFonts* pAppFonts)
m_pFont = NULL;
m_nCounter = 0;
m_nPagesCount = 0;
m_wsTempFolder = L"";
SetTempFolder(NSFile::CFileBinary::GetTempPath());
......@@ -149,6 +150,8 @@ HRESULT CPdfRenderer::NewPage()
m_lClipDepth = 0;
printf("Page %d\n", m_nPagesCount++);
return S_OK;
}
HRESULT CPdfRenderer::get_Height(double* dHeight)
......@@ -950,6 +953,24 @@ void CPdfRenderer::UpdateFont()
std::wstring& wsFontPath = m_oFont.GetPath();
LONG lFaceIndex = m_oFont.GetFaceIndex();
if (L"" == wsFontPath)
{
std::wstring& wsFontName = m_oFont.GetName();
bool bBold = m_oFont.IsBold();
bool bItalic = m_oFont.IsItalic();
bool bFind = false;
for (int nIndex = 0, nCount = m_vFonts.size(); nIndex < nCount; nIndex++)
{
TFontInfo& oInfo = m_vFonts.at(nIndex);
if (oInfo.wsFontName == wsFontName && oInfo.bBold == bBold && oInfo.bItalic == bItalic)
{
wsFontPath = oInfo.wsFontPath;
lFaceIndex = oInfo.lFaceIndex;
bFind = true;
break;
}
}
if (!bFind)
{
CFontSelectFormat oFontSelect;
oFontSelect.wsName = new std::wstring(m_oFont.GetName());
......@@ -959,6 +980,9 @@ void CPdfRenderer::UpdateFont()
wsFontPath = pFontInfo->m_wsFontPath;
lFaceIndex = pFontInfo->m_lIndex;
m_vFonts.push_back(TFontInfo(wsFontName, bBold, bItalic, wsFontPath, lFaceIndex));
}
}
m_pFont = NULL;
......@@ -1042,7 +1066,6 @@ void CPdfRenderer::UpdateBrush()
m_pShadingExtGrState = NULL;
LONG lBrushType = m_oBrush.GetType();
m_pDocument->GetExtGState();
if (c_BrushTypeTexture == lBrushType)
{
std::wstring& wsTexturePath = m_oBrush.GetTexturePath();
......
......@@ -206,6 +206,23 @@ private:
private:
struct TFontInfo
{
TFontInfo(const std::wstring& fontName, const bool& bold, const bool& italic, const std::wstring& fontPath, const LONG& faceIndex)
{
wsFontName = fontName;
bBold = bold;
bItalic = italic;
wsFontPath = fontPath;
lFaceIndex = faceIndex;
}
std::wstring wsFontName;
bool bBold;
bool bItalic;
std::wstring wsFontPath;
LONG lFaceIndex;
};
struct TColor
{
TColor()
......@@ -1424,9 +1441,11 @@ private:
double m_dPageHeight;
double m_dPageWidth;
LONG m_lClipDepth;
std::vector<TFontInfo> m_vFonts;
bool m_bValid;
int m_nPagesCount;
int m_nCounter; // TODO: ,
};
......
......@@ -918,7 +918,7 @@ void TestMetafile()
}
void TestOnlineBin()
{
std::wstring wsFolderPath = L"D://Test Files//Txt//";
std::wstring wsFolderPath = L"D://Test Files//Txt//IvanovaVeronica//";
std::wstring wsTempFolder = L"D://Test Files//Temp//";
CApplicationFonts oFonts;
......
......@@ -362,7 +362,7 @@ namespace PdfWriter
{
pExtGrState = m_vFillAlpha.at(unIndex);
if (abs(dAlpha == pExtGrState->GetAlphaFill()) < 0.001)
if (abs(dAlpha - pExtGrState->GetAlphaFill()) < 0.001)
return pExtGrState;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment