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) ...@@ -70,6 +70,7 @@ CPdfRenderer::CPdfRenderer(CApplicationFonts* pAppFonts)
m_pFont = NULL; m_pFont = NULL;
m_nCounter = 0; m_nCounter = 0;
m_nPagesCount = 0;
m_wsTempFolder = L""; m_wsTempFolder = L"";
SetTempFolder(NSFile::CFileBinary::GetTempPath()); SetTempFolder(NSFile::CFileBinary::GetTempPath());
...@@ -149,6 +150,8 @@ HRESULT CPdfRenderer::NewPage() ...@@ -149,6 +150,8 @@ HRESULT CPdfRenderer::NewPage()
m_lClipDepth = 0; m_lClipDepth = 0;
printf("Page %d\n", m_nPagesCount++);
return S_OK; return S_OK;
} }
HRESULT CPdfRenderer::get_Height(double* dHeight) HRESULT CPdfRenderer::get_Height(double* dHeight)
...@@ -951,14 +954,35 @@ void CPdfRenderer::UpdateFont() ...@@ -951,14 +954,35 @@ void CPdfRenderer::UpdateFont()
LONG lFaceIndex = m_oFont.GetFaceIndex(); LONG lFaceIndex = m_oFont.GetFaceIndex();
if (L"" == wsFontPath) if (L"" == wsFontPath)
{ {
CFontSelectFormat oFontSelect; std::wstring& wsFontName = m_oFont.GetName();
oFontSelect.wsName = new std::wstring(m_oFont.GetName()); bool bBold = m_oFont.IsBold();
oFontSelect.bItalic = new INT(m_oFont.IsItalic() ? 1 : 0); bool bItalic = m_oFont.IsItalic();
oFontSelect.bBold = new INT(m_oFont.IsBold() ? 1 : 0); bool bFind = false;
CFontInfo* pFontInfo = m_pFontManager->GetFontInfoByParams(oFontSelect); for (int nIndex = 0, nCount = m_vFonts.size(); nIndex < nCount; nIndex++)
{
wsFontPath = pFontInfo->m_wsFontPath; TFontInfo& oInfo = m_vFonts.at(nIndex);
lFaceIndex = pFontInfo->m_lIndex; 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());
oFontSelect.bItalic = new INT(m_oFont.IsItalic() ? 1 : 0);
oFontSelect.bBold = new INT(m_oFont.IsBold() ? 1 : 0);
CFontInfo* pFontInfo = m_pFontManager->GetFontInfoByParams(oFontSelect);
wsFontPath = pFontInfo->m_wsFontPath;
lFaceIndex = pFontInfo->m_lIndex;
m_vFonts.push_back(TFontInfo(wsFontName, bBold, bItalic, wsFontPath, lFaceIndex));
}
} }
m_pFont = NULL; m_pFont = NULL;
...@@ -1042,7 +1066,6 @@ void CPdfRenderer::UpdateBrush() ...@@ -1042,7 +1066,6 @@ void CPdfRenderer::UpdateBrush()
m_pShadingExtGrState = NULL; m_pShadingExtGrState = NULL;
LONG lBrushType = m_oBrush.GetType(); LONG lBrushType = m_oBrush.GetType();
m_pDocument->GetExtGState();
if (c_BrushTypeTexture == lBrushType) if (c_BrushTypeTexture == lBrushType)
{ {
std::wstring& wsTexturePath = m_oBrush.GetTexturePath(); std::wstring& wsTexturePath = m_oBrush.GetTexturePath();
......
...@@ -206,6 +206,23 @@ private: ...@@ -206,6 +206,23 @@ private:
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 struct TColor
{ {
TColor() TColor()
...@@ -1424,9 +1441,11 @@ private: ...@@ -1424,9 +1441,11 @@ private:
double m_dPageHeight; double m_dPageHeight;
double m_dPageWidth; double m_dPageWidth;
LONG m_lClipDepth; LONG m_lClipDepth;
std::vector<TFontInfo> m_vFonts;
bool m_bValid; bool m_bValid;
int m_nPagesCount;
int m_nCounter; // TODO: , int m_nCounter; // TODO: ,
}; };
......
...@@ -918,7 +918,7 @@ void TestMetafile() ...@@ -918,7 +918,7 @@ void TestMetafile()
} }
void TestOnlineBin() 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//"; std::wstring wsTempFolder = L"D://Test Files//Temp//";
CApplicationFonts oFonts; CApplicationFonts oFonts;
......
...@@ -362,7 +362,7 @@ namespace PdfWriter ...@@ -362,7 +362,7 @@ namespace PdfWriter
{ {
pExtGrState = m_vFillAlpha.at(unIndex); pExtGrState = m_vFillAlpha.at(unIndex);
if (abs(dAlpha == pExtGrState->GetAlphaFill()) < 0.001) if (abs(dAlpha - pExtGrState->GetAlphaFill()) < 0.001)
return pExtGrState; 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