Commit a91417b3 authored by Oleg.Korshul's avatar Oleg.Korshul Committed by Alexander Trofimov

сдвиг букв завязан на матрицу шрифта

обработка больших размеров шрифта

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@65353 954022d7-b5bf-4e40-9824-e11837661b57
parent e8714161
...@@ -187,6 +187,9 @@ namespace NSHtmlRenderer ...@@ -187,6 +187,9 @@ namespace NSHtmlRenderer
NSStructures::CFont* m_pInstalledFont; NSStructures::CFont* m_pInstalledFont;
bool m_bIsRaster; bool m_bIsRaster;
double m_dTextScale;
bool m_bIsTextPath;
//todo //todo
//IASCWinFonts* m_pFonts; //IASCWinFonts* m_pFonts;
......
...@@ -401,12 +401,14 @@ namespace NSHtmlRenderer ...@@ -401,12 +401,14 @@ namespace NSHtmlRenderer
if (m_bIsRaster) if (m_bIsRaster)
return S_OK; return S_OK;
m_bIsTextPath = true;
PathCommandEnd(); PathCommandEnd();
BeginCommand(c_nPathType); BeginCommand(c_nPathType);
PathCommandTextCHAR(c, x, y, w, h); PathCommandTextCHAR(c, x, y, w, h);
DrawPath(c_nWindingFillMode); DrawPath(c_nWindingFillMode);
EndCommand(c_nPathType); EndCommand(c_nPathType);
PathCommandEnd(); PathCommandEnd();
m_bIsTextPath = false;
return S_OK; return S_OK;
} }
HRESULT CASCSVGWriter::CommandDrawText(const std::wstring& bsText,const double& x,const double& y,const double& w, const double& h) HRESULT CASCSVGWriter::CommandDrawText(const std::wstring& bsText,const double& x,const double& y,const double& w, const double& h)
...@@ -417,12 +419,14 @@ namespace NSHtmlRenderer ...@@ -417,12 +419,14 @@ namespace NSHtmlRenderer
if (m_bIsRaster) if (m_bIsRaster)
return S_OK; return S_OK;
m_bIsTextPath = true;
PathCommandEnd(); PathCommandEnd();
BeginCommand(c_nPathType); BeginCommand(c_nPathType);
PathCommandText(bsText, x, y, w, h); PathCommandText(bsText, x, y, w, h);
DrawPath(c_nWindingFillMode); DrawPath(c_nWindingFillMode);
EndCommand(c_nPathType); EndCommand(c_nPathType);
PathCommandEnd(); PathCommandEnd();
m_bIsTextPath = false;
return S_OK; return S_OK;
} }
HRESULT CASCSVGWriter::CommandDrawTextExCHAR(const LONG& c, const LONG& gid, const double& x, const double& y, const double& w, const double& h) HRESULT CASCSVGWriter::CommandDrawTextExCHAR(const LONG& c, const LONG& gid, const double& x, const double& y, const double& w, const double& h)
...@@ -430,12 +434,14 @@ namespace NSHtmlRenderer ...@@ -430,12 +434,14 @@ namespace NSHtmlRenderer
if (m_bIsRaster) if (m_bIsRaster)
return S_OK; return S_OK;
m_bIsTextPath = true;
PathCommandEnd(); PathCommandEnd();
BeginCommand(c_nPathType); BeginCommand(c_nPathType);
PathCommandTextExCHAR(c, gid, x, y, w, h); PathCommandTextExCHAR(c, gid, x, y, w, h);
DrawPath(c_nWindingFillMode); DrawPath(c_nWindingFillMode);
EndCommand(c_nPathType); EndCommand(c_nPathType);
PathCommandEnd(); PathCommandEnd();
m_bIsTextPath = false;
return S_OK; return S_OK;
} }
HRESULT CASCSVGWriter::CommandDrawTextEx(const std::wstring& bsUnicodeText, const unsigned int* pGids, const unsigned int nGidsCount, const double& x, const double& y, const double& w, const double& h) HRESULT CASCSVGWriter::CommandDrawTextEx(const std::wstring& bsUnicodeText, const unsigned int* pGids, const unsigned int nGidsCount, const double& x, const double& y, const double& w, const double& h)
...@@ -443,12 +449,14 @@ namespace NSHtmlRenderer ...@@ -443,12 +449,14 @@ namespace NSHtmlRenderer
if (m_bIsRaster) if (m_bIsRaster)
return S_OK; return S_OK;
m_bIsTextPath = true;
PathCommandEnd(); PathCommandEnd();
BeginCommand(c_nPathType); BeginCommand(c_nPathType);
PathCommandTextEx(bsUnicodeText, pGids,nGidsCount , x, y, w, h); PathCommandTextEx(bsUnicodeText, pGids,nGidsCount , x, y, w, h);
DrawPath(c_nWindingFillMode); DrawPath(c_nWindingFillMode);
EndCommand(c_nPathType); EndCommand(c_nPathType);
PathCommandEnd(); PathCommandEnd();
m_bIsTextPath = false;
return S_OK; return S_OK;
} }
//-------- Маркеры для команд --------------------------------------------------------------- //-------- Маркеры для команд ---------------------------------------------------------------
...@@ -918,13 +926,29 @@ namespace NSHtmlRenderer ...@@ -918,13 +926,29 @@ namespace NSHtmlRenderer
m_pFontManager->SetCharSpacing(dPix); m_pFontManager->SetCharSpacing(dPix);
} }
if (m_pFont->Path.empty()) double dSizeFont = m_pFont->Size;
m_dTextScale = 1.0;
bool bIsTransform = false;
if (dSizeFont > 1000)
{ {
m_pFontManager->LoadFontByName(m_pFont->Name, (float)m_pFont->Size, m_pFont->GetStyle(), m_dDpiX, m_dDpiY); bIsTransform = true;
m_dTextScale = dSizeFont / 1000;
dSizeFont = 1000;
}
if (m_pFont->Path.empty())
{
m_pFontManager->LoadFontByName(m_pFont->Name, (float)dSizeFont, m_pFont->GetStyle(), m_dDpiX, m_dDpiY);
} }
else else
{ {
m_pFontManager->LoadFontFromFile(m_pFont->Path, (float)m_pFont->Size, m_dDpiX, m_dDpiY, 0); m_pFontManager->LoadFontFromFile(m_pFont->Path, (float)dSizeFont, m_dDpiX, m_dDpiY, 0);
}
if (bIsTransform && NULL != m_pFontManager->m_pFont)
{
m_pFontManager->m_pFont->SetFontMatrix(m_dTextScale, 0, 0, m_dTextScale, 0, 0);
m_pFontManager->m_pFont->CheckTextMatrix();
} }
*m_pInstalledFont = *m_pFont; *m_pInstalledFont = *m_pFont;
......
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