Commit 26caa9ea authored by Ivan.Shulga's avatar Ivan.Shulga Committed by Alexander Trofimov

linux build

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@59020 954022d7-b5bf-4e40-9824-e11837661b57
parent a3059990
......@@ -189,7 +189,13 @@ namespace NSFontCutter
bool bIsFirst = true;
ULONG lIndexF = 0;
SAFEARRAY* pArrayUnicodes = GenerateSafearray();
USHORT* pArrayUnicodes = NULL;
size_t pArrayUnicodesLength = 0;
bool bRes = GenerateSafearray(&pArrayUnicodes, pArrayUnicodesLength);
if (!bRes) // what about error handling?
return;
Fonts::IFontConverter* pFontConverter = NULL;
CoCreateInstance(__uuidof(Fonts::CFontConverter), NULL, CLSCTX_ALL, __uuidof(Fonts::IFontConverter), (void**)&pFontConverter);
......@@ -203,7 +209,7 @@ namespace NSFontCutter
oFile.WriteFile(strWrite.GetBuffer(), strWrite.GetLength());
bIsFirst = false;
WriteFont(oInfo.Name, oInfo.FaceRegular, oInfo.PathRegular, &oFile, pArrayUnicodes, pFontConverter);
WriteFont(oInfo.Name, oInfo.FaceRegular, oInfo.PathRegular, &oFile, pArrayUnicodes, pArrayUnicodesLength, pFontConverter);
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
......@@ -230,7 +236,7 @@ namespace NSFontCutter
oFile.WriteFile(strWrite.GetBuffer(), strWrite.GetLength());
bIsFirst = false;
WriteFont(oInfo.Name, oInfo.FaceBold, oInfo.PathBold, &oFile, pArrayUnicodes, pFontConverter);
WriteFont(oInfo.Name, oInfo.FaceBold, oInfo.PathBold, &oFile, pArrayUnicodes, pArrayUnicodesLength, pFontConverter);
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
......@@ -257,7 +263,7 @@ namespace NSFontCutter
oFile.WriteFile(strWrite.GetBuffer(), strWrite.GetLength());
bIsFirst = false;
WriteFont(oInfo.Name, oInfo.FaceItalic, oInfo.PathItalic, &oFile, pArrayUnicodes, pFontConverter);
WriteFont(oInfo.Name, oInfo.FaceItalic, oInfo.PathItalic, &oFile, pArrayUnicodes, pArrayUnicodesLength, pFontConverter);
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
......@@ -284,7 +290,7 @@ namespace NSFontCutter
oFile.WriteFile(strWrite.GetBuffer(), strWrite.GetLength());
bIsFirst = false;
WriteFont(oInfo.Name, oInfo.FaceBoldItalic, oInfo.PathBoldItalic, &oFile, pArrayUnicodes, pFontConverter);
WriteFont(oInfo.Name, oInfo.FaceBoldItalic, oInfo.PathBoldItalic, &oFile, pArrayUnicodes, pArrayUnicodesLength, pFontConverter);
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
......@@ -311,12 +317,12 @@ namespace NSFontCutter
oFile.CloseFile();
RELEASEARRAY(pArrayUnicodes);
delete [] pArrayUnicodes;
RELEASEINTERFACE(pFontConverter);
#endif
}
SAFEARRAY* GenerateSafearray()
bool GenerateSafearray(USHORT **ppArray, size_t& nCount)
{
// . -
CheckString(_T("0123456789"));
......@@ -330,40 +336,40 @@ namespace NSFontCutter
m_CharMap [(WCHAR)0x0038] = TRUE;
m_CharMap [(WCHAR)0x0097] = TRUE;
ULONG nCount = (ULONG)m_CharMap.size();
SAFEARRAYBOUND rgsab;
rgsab.lLbound = 0;
rgsab.cElements = nCount;
nCount = (ULONG)m_CharMap.size();
USHORT *pArray = new USHORT [nCount];
if (NULL == pArray)
return false;
// be sure that WCHAR is 2 bytes long
SAFEARRAY* pArray = SafeArrayCreate(VT_UI2, 1, &rgsab);
USHORT* pBuffer = (USHORT*)(pArray->pvData);
USHORT *pBuffer = pArray;
for (std::map<WCHAR, BOOL>::const_iterator pPair = m_CharMap.begin(); pPair != m_CharMap.end(); ++pPair)
{
*pBuffer = pPair->first;
++pBuffer;
}
return pArray;
*ppArray = pArray;
return true;
}
#ifdef BUILD_CONFIG_FULL_VERSION
void WriteFont(CString& strName, LONG& lFaceIndex, CString& strFontPath, CFile* pFile, SAFEARRAY* pArrayUnicodes, Fonts::IFontConverter* pFontConverter)
void WriteFont(CString& strName, LONG& lFaceIndex, CString& strFontPath, CFile* pFile, USHORT* pArrayUnicodes, size_t pArrayUnicodesLength, Fonts::IFontConverter* pFontConverter)
{
LONG lFontConverterFlag = 16; // truetype only
BSTR bsFontIn = strFontPath.AllocSysString();
CString _strName = strName + _T("_Embedded");
BSTR bsName = _strName.AllocSysString();
//BSTR bsName = _strName.AllocSysString();
SAFEARRAY* pArrayData = NULL;
pFontConverter->ToOTF2(bsFontIn, pArrayUnicodes, bsName, lFontConverterFlag, lFaceIndex, &pArrayData); // TrueType only
pFontConverter->ToOTF2(bsFontIn, pArrayUnicodes, pArrayUnicodesLength, _strName, lFontConverterFlag, lFaceIndex, &pArrayData); // TrueType only
SysFreeString(bsFontIn);
SysFreeString(bsName);
//SysFreeString(bsFontIn);
//SysFreeString(bsName);
BYTE* pbBinBuffer = (BYTE*)pArrayData->pvData;
int nBinBufferLen = pArrayData->rgsabound[0].cElements;
......@@ -388,4 +394,4 @@ namespace NSFontCutter
}
#define FONT_PICKER_BINARYDATA_SAVEEMBEDDED 0
#define FONT_PICKER_BINARYDATA_SAVEMAP 1
\ No newline at end of file
#define FONT_PICKER_BINARYDATA_SAVEMAP 1
......@@ -2,7 +2,12 @@
#include "../../Common/DocxFormat/Source/SystemUtility/File.h"
#include "BinReaderWriterDefines.h"
#ifdef _WIN32
#include "FontCutter.h"
#endif
//#include "../../DesktopEditor/fontengine/FontManager.h"
#include "../../DesktopEditor/fontengine/ApplicationFonts.h"
namespace NSFontCutter
{
......@@ -16,7 +21,7 @@ namespace NSFontCutter
CString m_strFontsDir;
BOOL m_bIsEmbeddedFonts;
CEmbeddedFontsManager m_oEmbeddedFonts;
CEmbeddedFontsManager m_oEmbeddedFonts;
public:
CFontDstManager() : m_mapPicks()
......
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