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

В FontManager добавлены функции GetFontType и GetNameIndex. Исправлен баг в...

В FontManager добавлены функции GetFontType и GetNameIndex. Исправлен баг в FontManager прии загрузке строки по Gid. Сделаны отдельные функции в IRenderer для перезаписи Pdf.

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@62495 954022d7-b5bf-4e40-9824-e11837661b57
parent 8dcae785
......@@ -2,6 +2,7 @@
#include "internal/internal.h"
#include "internal/ftobjs.h"
#include "../common/Types.h"
#include "../common/String.h"
#ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b))
......@@ -1478,6 +1479,35 @@ INT CFontFile::GetString2C(CGlyphString& oString)
return TRUE;
}
std::wstring CFontFile::GetFontFormat() const
{
if (!m_pFace)
return L"";
const char* sFormat = FT_Get_X11_Font_Format(m_pFace);
return NSString::CConverter::GetUnicodeFromSingleByteString((const unsigned char*)sFormat, strlen(sFormat));
}
unsigned int CFontFile::GetNameIndex(const std::wstring& wsName) const
{
if (!m_pFace)
return 0;
int nLen = wsName.length();
char* sName = new char[nLen + 1];
if (!sName)
return 0;
sName[nLen] = 0x00;
for (int nIndex = 0; nIndex < nLen; nIndex++)
{
sName[nIndex] = (char)(wsName[nIndex]);
}
unsigned int unGID = FT_Get_Name_Index(m_pFace, sName);
delete[] sName;
return unGID;
}
////////////////////////////////////////////////////////////////////////////////
static int GlyphPathMoveTo(const FT_Vector *pPoint, void *pPath)
{
......@@ -1590,4 +1620,4 @@ CFontPath* CFontFile::GetGlyphPath(int nCode)
FT_Done_Glyph( oGlyph );
return oGlyphPath.pPath;
}
}
\ No newline at end of file
......@@ -229,6 +229,9 @@ public:
void CheckHintsSupport();
std::wstring GetFontFormat() const;
unsigned int GetNameIndex(const std::wstring& wsName) const;
// path
CFontPath* GetGlyphPath(int nCode);
};
......
......@@ -629,3 +629,17 @@ INT CFontManager::LoadFontFromFile2(CFontsCache* pCache, const std::wstring& sPa
return TRUE;
}
std::wstring CFontManager::GetFontType() const
{
if (!m_pFont)
return L"";
return m_pFont->GetFontFormat();
}
unsigned int CFontManager::GetNameIndex(const std::wstring& wsName) const
{
if (!m_pFont)
return 0;
return m_pFont->GetNameIndex(wsName);
}
......@@ -142,6 +142,9 @@ public:
INT LoadFontByName(const std::wstring& sName, const double& dSize, const LONG& lStyle, const double& dDpiX, const double& dDpiY);
INT LoadFontFromFile(const std::wstring& sPath, const int& lFaceIndex, const double& dSize, const double& dDpiX, const double& dDpiY);
INT LoadFontFromFile2(CFontsCache* pCache, const std::wstring& sPath, const int& lFaceIndex, const double& dSize, const double& dDpiX, const double& dDpiY);
std::wstring GetFontType() const;
unsigned int GetNameIndex(const std::wstring& wsName) const;
public:
static CFontFile* LoadFontFile(FT_Library library, CFontStream* pStream, LONG lFaceIndex);
......
......@@ -1064,7 +1064,6 @@ void CGraphicsRenderer::_SetFont()
return;
}
m_pFontManager->SetStringGID(m_oFont.StringGID);
if (1 < m_dWidth)
{
double dPix = m_oFont.CharSpace * m_dPixelsWidth / m_dWidth;
......@@ -1080,6 +1079,7 @@ void CGraphicsRenderer::_SetFont()
m_pFontManager->LoadFontFromFile(m_oFont.Path, m_oFont.FaceIndex, m_oFont.Size, m_pRenderer->GetDpiX(), m_pRenderer->GetDpiY());
}
m_pFontManager->m_oString.ResetCTM();
m_pFontManager->SetStringGID(m_oFont.StringGID);
m_pFontManager->SetCharSpacing(m_pFontManager->m_fCharSpacing);
m_oInstalledFont = m_oFont;
......
......@@ -226,6 +226,7 @@ public:
virtual HRESULT CommandDrawTextExCHAR(const LONG& c, const LONG& gid, const double& x, const double& y, const double& w, const double& h, const double& baselineOffset, const DWORD& lFlags) = 0;
virtual HRESULT CommandDrawTextEx(const std::wstring& bsUnicodeText, const std::wstring& bsGidText, const double& x, const double& y, const double& w, const double& h, const double& baselineOffset, const DWORD& lFlags) = 0;
virtual HRESULT CommandDrawTextPdf(const std::wstring& bsUnicodeText, const std::wstring& bsGidText, const std::wstring& wsSrcCodeText, const double& x, const double& y, const double& w, const double& h, const double& baselineOffset, const DWORD& lFlags) { return 0; };
//-------- Маркеры для команд ---------------------------------------------------------------
virtual HRESULT BeginCommand(const DWORD& lType) = 0;
......@@ -249,6 +250,7 @@ public:
virtual HRESULT PathCommandTextExCHAR(const LONG& c, const LONG& gid, const double& x, const double& y, const double& w, const double& h, const double& baselineOffset, const DWORD& lFlags) = 0;
virtual HRESULT PathCommandTextEx(const std::wstring& bsUnicodeText, const std::wstring& bsGidText, const double& x, const double& y, const double& w, const double& h, const double& baselineOffset, const DWORD& lFlags) = 0;
virtual HRESULT PathCommandTextPdf(const std::wstring& bsUnicodeText, const std::wstring& bsGidText, const std::wstring& bsSrcCodeText, const double& x, const double& y, const double& w, const double& h, const double& baselineOffset, const DWORD& lFlags) { return 0; };
//-------- Функции для вывода изображений ---------------------------------------------------
virtual HRESULT DrawImage(IGrObject* pImage, const double& x, const double& y, const double& w, const double& h) = 0;
......
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