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

font names

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@56276 954022d7-b5bf-4e40-9824-e11837661b57
parent 885a6386
......@@ -399,6 +399,7 @@ DesktopEditor/editor/build/windows/Test/next.bmp svn_mime_002dtype=application%2
DesktopEditor/editor/build/windows/Test/open.bmp svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/editor/build/windows/Test/prev.bmp svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/expat/lib/libexpat.lib svn_mime_002dtype=application%2Foctet-stream
DesktopEditor/freetype_names/FontMaps/Debug/FontMaps.exe svn_mime_002dtype=application%2Foctet-stream
DoctRenderer/COMMON/Dlls/AVSGraphics.dll svn_mime_002dtype=application%2Foctet-stream
DoctRenderer/COMMON/Dlls/AVSOfficeFOFile.dll svn_mime_002dtype=application%2Foctet-stream
DoctRenderer/COMMON/Joiner/bin/Debug/Joiner.exe svn_mime_002dtype=application%2Foctet-stream
......
#pragma once
#include "windows.h"
class CFile
{
public:
CFile()
{
m_hFileHandle = NULL;
m_lFileSize = 0;
m_lFilePosition = 0;
}
virtual ~CFile()
{
CloseFile();
}
virtual HRESULT OpenFile(CString FileName)
{
CloseFile();
HRESULT hRes = S_OK;
DWORD AccessMode = GENERIC_READ;
DWORD ShareMode = FILE_SHARE_READ;
DWORD Disposition = OPEN_EXISTING;
m_hFileHandle = ::CreateFile(FileName, AccessMode, ShareMode, NULL, Disposition, FILE_ATTRIBUTE_NORMAL, NULL);
if (NULL == m_hFileHandle || INVALID_HANDLE_VALUE == m_hFileHandle)
hRes = S_FALSE;
else
{
ULARGE_INTEGER nTempSize;
nTempSize.LowPart = ::GetFileSize(m_hFileHandle, &nTempSize.HighPart);
m_lFileSize = nTempSize.QuadPart;
SetPosition(0);
}
return hRes;
}
virtual HRESULT OpenFileRW(CString FileName)
{
CloseFile();
HRESULT hRes = S_OK;
DWORD AccessMode = GENERIC_READ | GENERIC_WRITE;
DWORD ShareMode = FILE_SHARE_READ;
DWORD Disposition = OPEN_EXISTING;
m_hFileHandle = ::CreateFile(FileName, AccessMode, ShareMode, NULL, Disposition, 0, 0);
if (NULL == m_hFileHandle || INVALID_HANDLE_VALUE == m_hFileHandle)
{
hRes = S_FALSE;
}
else
{
ULARGE_INTEGER nTempSize;
nTempSize.LowPart = ::GetFileSize(m_hFileHandle, &nTempSize.HighPart);
m_lFileSize = nTempSize.QuadPart;
SetPosition(0);
}
return hRes;
}
HRESULT ReadFile(BYTE* pData, DWORD nBytesToRead)
{
DWORD nBytesRead = 0;
if(NULL == pData)
return S_FALSE;
if(m_hFileHandle && (pData))
{
SetPosition(m_lFilePosition);
::ReadFile(m_hFileHandle, pData, nBytesToRead, &nBytesRead, NULL);
m_lFilePosition += nBytesRead;
}
return S_OK;
}
HRESULT ReadFile2(BYTE* pData, DWORD nBytesToRead)
{
DWORD nBytesRead = 0;
if(NULL == pData)
return S_FALSE;
if(m_hFileHandle && (pData))
{
SetPosition(m_lFilePosition);
::ReadFile(m_hFileHandle, pData, nBytesToRead, &nBytesRead, NULL);
m_lFilePosition += nBytesRead;
for (size_t index = 0; index < nBytesToRead / 2; ++index)
{
BYTE temp = pData[index];
pData[index] = pData[nBytesToRead - index - 1];
pData[nBytesToRead - index - 1] = temp;
}
}
return S_OK;
}
HRESULT ReadFile3(void* pData, DWORD nBytesToRead)
{
DWORD nBytesRead = 0;
if(NULL == pData)
return S_FALSE;
if(m_hFileHandle && (pData))
{
SetPosition(m_lFilePosition);
::ReadFile(m_hFileHandle, pData, nBytesToRead, &nBytesRead, NULL);
m_lFilePosition += nBytesRead;
}
return S_OK;
}
HRESULT WriteFile(void* pData, DWORD nBytesToWrite)
{
if(m_hFileHandle)
{
DWORD dwWritten = 0;
::WriteFile(m_hFileHandle, pData, nBytesToWrite, &dwWritten, NULL);
m_lFilePosition += nBytesToWrite;
}
return S_OK;
}
HRESULT WriteFile2(void* pData, DWORD nBytesToWrite)
{
if(m_hFileHandle)
{
BYTE* mem = new BYTE[nBytesToWrite];
memcpy(mem, pData, nBytesToWrite);
for (size_t index = 0; index < nBytesToWrite / 2; ++index)
{
BYTE temp = mem[index];
mem[index] = mem[nBytesToWrite - index - 1];
mem[nBytesToWrite - index - 1] = temp;
}
DWORD dwWritten = 0;
::WriteFile(m_hFileHandle, (void*)mem, nBytesToWrite, &dwWritten, NULL);
m_lFilePosition += nBytesToWrite;
delete[] mem;
}
return S_OK;
}
HRESULT CreateFile(CString strFileName)
{
CloseFile();
DWORD AccessMode = GENERIC_WRITE;
DWORD ShareMode = FILE_SHARE_WRITE;
DWORD Disposition = CREATE_ALWAYS;
m_hFileHandle = ::CreateFile(strFileName, AccessMode, ShareMode, NULL, Disposition, FILE_ATTRIBUTE_NORMAL, NULL);
return SetPosition(0);
}
HRESULT SetPosition( ULONG64 nPos )
{
if (m_hFileHandle && nPos < (ULONG)m_lFileSize)
{
LARGE_INTEGER nTempPos;
nTempPos.QuadPart = nPos;
::SetFilePointer(m_hFileHandle, nTempPos.LowPart, &nTempPos.HighPart, FILE_BEGIN);
m_lFilePosition = nPos;
return S_OK;
}
else
{
return (INVALID_HANDLE_VALUE == m_hFileHandle) ? S_FALSE : S_OK;
}
}
LONG64 GetPosition()
{
return m_lFilePosition;
}
HRESULT SkipBytes(ULONG64 nCount)
{
return SetPosition(m_lFilePosition + nCount);
}
HRESULT CloseFile()
{
m_lFileSize = 0;
m_lFilePosition = 0;
CloseHandle(m_hFileHandle);
m_hFileHandle = NULL;
return S_OK;
}
ULONG64 GetFileSize()
{
return m_lFileSize;
}
void WriteStringUTF8(CString& strXml)
{
int nLength = strXml.GetLength();
CStringA saStr;
#ifdef UNICODE
// Encoding Unicode to UTF-8
WideCharToMultiByte(CP_UTF8, 0, strXml.GetBuffer(), nLength + 1, saStr.GetBuffer(nLength*3 + 1), nLength*3, NULL, NULL);
saStr.ReleaseBuffer();
#else
wchar_t* pWStr = new wchar_t[nLength + 1];
if (!pWStr)
return;
// set end string
pWStr[nLength] = 0;
// Encoding ASCII to Unicode
MultiByteToWideChar(CP_ACP, 0, strXml, nLength, pWStr, nLength);
int nLengthW = (int)wcslen(pWStr);
// Encoding Unicode to UTF-8
WideCharToMultiByte(CP_UTF8, 0, pWStr, nLengthW + 1, saStr.GetBuffer(nLengthW*3 + 1), nLengthW*3, NULL, NULL);
saStr.ReleaseBuffer();
delete[] pWStr;
#endif
WriteFile((void*)saStr.GetBuffer(), saStr.GetLength());
}
LONG GetProgress()
{
if (0 >= m_lFileSize)
return -1;
double dVal = (double)(100 * m_lFilePosition);
LONG lProgress = (LONG)(dVal / m_lFileSize);
return lProgress;
}
protected:
HANDLE m_hFileHandle;
LONG64 m_lFileSize;
LONG64 m_lFilePosition;
};
\ No newline at end of file
#ifndef _FONT_DICTIONARY_H
#define FONTS_DICT_ASCII_NAMES_COUNT 2
static const char* FD_Ascii_Names[FONTS_DICT_ASCII_NAMES_COUNT] =
{
"Arial",
"Times New Roman"
};
static const int FD_Ascii_Names_Offsets[256] =
{
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
};
#define FONTS_DICT_UNICODE_NAMES_COUNT 1
static const char* FD_Unicode_Names[FONTS_DICT_UNICODE_NAMES_COUNT] =
{
"Arial"
};
typedef struct FD_FontInfo_Rec
{
const char* m_name;
long m_lIndex;
unsigned char m_bBold;
unsigned char m_bItalic;
unsigned char m_bIsFixed;
unsigned char m_aPanose[10];
unsigned long m_ulUnicodeRange1;
unsigned long m_ulUnicodeRange2;
unsigned long m_ulUnicodeRange3;
unsigned long m_ulUnicodeRange4;
unsigned long m_ulCodePageRange1;
unsigned long m_ulCodePageRange2;
unsigned short m_usWeigth;
unsigned short m_usWidth;
short m_sFamilyClass;
unsigned char m_eFontFormat;
short m_shAvgCharWidth;
short m_shAscent;
short m_shDescent;
short m_shLineGap;
short m_shXHeight;
short m_shCapHeight;
} FD_FontInfo;
static const FD_FontInfo FD_Ascii_Infos[FONTS_DICT_ASCII_NAMES_COUNT] =
{
{"Arial", 0, 0, 0, 0, { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 }, 1, 2, 3, 4, 1, 2, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1 },
{"Times New Roman", 0, 0, 0, 0, { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 }, 1, 2, 3, 4, 1, 2, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1 }
};
#endif /* _FONT_DICTIONARY_H */
\ No newline at end of file
// FontMaps.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "WinFont.h"
#include "File.h"
class CFontInfoJS
{
public:
CString m_sName;
LONG m_lIndexR;
LONG m_lFaceIndexR;
CAtlArray<CString> namesR;
LONG m_lIndexI;
LONG m_lFaceIndexI;
CAtlArray<CString> namesI;
LONG m_lIndexB;
LONG m_lFaceIndexB;
CAtlArray<CString> namesB;
LONG m_lIndexBI;
LONG m_lFaceIndexBI;
CAtlArray<CString> namesBI;
CFontInfoJS()
{
m_sName = _T("");
m_lIndexR = -1;
m_lFaceIndexR = -1;
m_lIndexI = -1;
m_lFaceIndexI = -1;
m_lIndexB = -1;
m_lFaceIndexB = -1;
m_lIndexBI = -1;
m_lFaceIndexBI = -1;
}
CFontInfoJS(const CFontInfoJS& oSrc)
{
*this = oSrc;
}
CFontInfoJS& operator=(const CFontInfoJS& oSrc)
{
m_sName = oSrc.m_sName;
m_lIndexR = oSrc.m_lIndexR;
m_lIndexI = oSrc.m_lIndexI;
m_lIndexB = oSrc.m_lIndexB;
m_lIndexBI = oSrc.m_lIndexBI;
m_lFaceIndexR = oSrc.m_lFaceIndexR;
m_lFaceIndexI = oSrc.m_lFaceIndexI;
m_lFaceIndexB = oSrc.m_lFaceIndexB;
m_lFaceIndexBI = oSrc.m_lFaceIndexBI;
namesR.RemoveAll();
namesR.Copy(oSrc.namesR);
namesI.RemoveAll();
namesI.Copy(oSrc.namesI);
namesB.RemoveAll();
namesB.Copy(oSrc.namesB);
namesBI.RemoveAll();
namesBI.Copy(oSrc.namesBI);
return *this;
}
};
int _tmain(int argc, _TCHAR* argv[])
{
FT_Library pLibrary = NULL;
CString strFolder = _T("\\\\mediaserver\\Exchange\\Korshul\\Fonts");
CWinFontList* m_pList = NULL;
if (!FT_Init_FreeType( &pLibrary ))
{
if (_T("") == strFolder)
m_pList = new CWinFontList(pLibrary);
else
m_pList = new CWinFontList(pLibrary, strFolder);
FT_Done_FreeType( pLibrary );
}
int nCount = m_pList->GetFonts()->GetLength();
//
CAtlMap<CString, LONG> mapFontFiles;
CAtlMap<LONG, CString> mapFontFiles2;
LONG lFontFiles = 0;
for (int i = 0; i < nCount; ++i)
{
CWinFontInfo* pInfo = (CWinFontInfo*)m_pList->GetByIndex(i);
CString strPath = (CString)pInfo->m_wsFontPath;
CAtlMap<CString, LONG>::CPair* pPair = mapFontFiles.Lookup(strPath);
if (NULL == pPair)
{
mapFontFiles.SetAt(strPath, lFontFiles);
mapFontFiles2.SetAt(lFontFiles, strPath);
++lFontFiles;
}
}
// -----------------------------------------
//
CAtlMap<CString, CFontInfoJS> mapFonts;
CAtlArray<CString> arrFonts;
for (int i = 0; i < nCount; ++i)
{
CWinFontInfo* pInfo = (CWinFontInfo*)m_pList->GetByIndex(i);
CString strPath = (CString)pInfo->m_wsFontPath;
CString strName = (CString)pInfo->m_wsFontName;
LONG lFontIndex = 0;
LONG lFaceIndex = 0;
CAtlMap<CString, LONG>::CPair* pPairFontFiles = mapFontFiles.Lookup(strPath);
lFontIndex = pPairFontFiles->m_value;
if (pInfo->m_lIndex >= 0)
lFaceIndex = pInfo->m_lIndex;
CAtlMap<CString, CFontInfoJS>::CPair* pPair = mapFonts.Lookup(pInfo->m_wsFontName);
if (NULL != pPair)
{
pPair->m_value.m_sName = pInfo->m_wsFontName;
if (pInfo->m_bBold && pInfo->m_bItalic)
{
pPair->m_value.m_lIndexBI = lFontIndex;
pPair->m_value.m_lFaceIndexBI = lFaceIndex;
pPair->m_value.namesBI.RemoveAll();
pPair->m_value.namesBI.Copy(pInfo->names);
}
else if (pInfo->m_bBold)
{
pPair->m_value.m_lIndexB = lFontIndex;
pPair->m_value.m_lFaceIndexB = lFaceIndex;
pPair->m_value.namesB.RemoveAll();
pPair->m_value.namesB.Copy(pInfo->names);
}
else if (pInfo->m_bItalic)
{
pPair->m_value.m_lIndexI = lFontIndex;
pPair->m_value.m_lFaceIndexI = lFaceIndex;
pPair->m_value.namesI.RemoveAll();
pPair->m_value.namesI.Copy(pInfo->names);
}
else
{
pPair->m_value.m_lIndexR = lFontIndex;
pPair->m_value.m_lFaceIndexR = lFaceIndex;
pPair->m_value.namesR.RemoveAll();
pPair->m_value.namesR.Copy(pInfo->names);
}
}
else
{
CFontInfoJS fontInfo;
fontInfo.m_sName = pInfo->m_wsFontName;
if (pInfo->m_bBold && pInfo->m_bItalic)
{
fontInfo.m_lIndexBI = lFontIndex;
fontInfo.m_lFaceIndexBI = lFaceIndex;
fontInfo.namesBI.RemoveAll();
fontInfo.namesBI.Copy(pInfo->names);
}
else if (pInfo->m_bBold)
{
fontInfo.m_lIndexB = lFontIndex;
fontInfo.m_lFaceIndexB = lFaceIndex;
fontInfo.namesB.RemoveAll();
fontInfo.namesB.Copy(pInfo->names);
}
else if (pInfo->m_bItalic)
{
fontInfo.m_lIndexI = lFontIndex;
fontInfo.m_lFaceIndexI = lFaceIndex;
fontInfo.namesI.RemoveAll();
fontInfo.namesI.Copy(pInfo->names);
}
else
{
fontInfo.m_lIndexR = lFontIndex;
fontInfo.m_lFaceIndexR = lFaceIndex;
fontInfo.namesR.RemoveAll();
fontInfo.namesR.Copy(pInfo->names);
}
mapFonts.SetAt(fontInfo.m_sName, fontInfo);
arrFonts.Add(fontInfo.m_sName);
}
}
// -------------------------------------------
// ----------
size_t nCountFonts = arrFonts.GetCount();
for (size_t i = 0; i < nCountFonts; ++i)
{
for (size_t j = i + 1; j < nCountFonts; ++j)
{
if (arrFonts[i] > arrFonts[j])
{
CString temp = arrFonts[i];
arrFonts[i] = arrFonts[j];
arrFonts[j] = temp;
}
}
}
CFile oFile;
oFile.CreateFile(_T("c:\\fonts.txt"));
BYTE bom[3];
bom[0] = 0xEF;
bom[1] = 0xBB;
bom[2] = 0xBF;
oFile.WriteFile((void*)&bom, 3);
CString strInfos = _T("");
for (int index = 0; index < nCountFonts; ++index)
{
const CAtlMap<CString, CFontInfoJS>::CPair* pPair = mapFonts.Lookup(arrFonts[index]);
CString strFontInfo = pPair->m_value.m_sName + _T(": [");
for (size_t i = 0; i < pPair->m_value.namesR.GetCount(); ++i)
{
strFontInfo += pPair->m_value.namesR[i];
strFontInfo += _T(",");
}
strFontInfo += _T(";");
for (size_t i = 0; i < pPair->m_value.namesI.GetCount(); ++i)
{
strFontInfo += pPair->m_value.namesI[i];
strFontInfo += _T(",");
}
strFontInfo += _T(";");
for (size_t i = 0; i < pPair->m_value.namesB.GetCount(); ++i)
{
strFontInfo += pPair->m_value.namesB[i];
strFontInfo += _T(",");
}
strFontInfo += _T(";");
for (size_t i = 0; i < pPair->m_value.namesBI.GetCount(); ++i)
{
strFontInfo += pPair->m_value.namesBI[i];
strFontInfo += _T(",");
}
strFontInfo += _T("]\n");
strInfos += strFontInfo;
}
oFile.WriteStringUTF8(strInfos);
oFile.CloseFile();
if (NULL != m_pList)
delete m_pList;
return 0;
}

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual C++ Express 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FontMaps", "FontMaps.vcproj", "{841E1A33-234B-4C2B-97EB-1D6785A26DA9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{841E1A33-234B-4C2B-97EB-1D6785A26DA9}.Debug|Win32.ActiveCfg = Debug|Win32
{841E1A33-234B-4C2B-97EB-1D6785A26DA9}.Debug|Win32.Build.0 = Debug|Win32
{841E1A33-234B-4C2B-97EB-1D6785A26DA9}.Release|Win32.ActiveCfg = Release|Win32
{841E1A33-234B-4C2B-97EB-1D6785A26DA9}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Name="FontMaps"
ProjectGUID="{841E1A33-234B-4C2B-97EB-1D6785A26DA9}"
RootNamespace="FontMaps"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
UseOfATL="1"
ATLMinimizesCRunTimeLibraryUsage="true"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../freetype-2.5.3/include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="2"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="kernel32.lib $(NoInherit)"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
UsePrecompiledHeader="2"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="kernel32.lib $(NoInherit)"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\FontMaps.cpp"
>
</File>
<File
RelativePath=".\stdafx.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\File.h"
>
</File>
<File
RelativePath=".\FontDictionary.h"
>
</File>
<File
RelativePath=".\FontUtils.h"
>
</File>
<File
RelativePath=".\List.h"
>
</File>
<File
RelativePath=".\ShareMemArray.h"
>
</File>
<File
RelativePath=".\stdafx.h"
>
</File>
<File
RelativePath=".\WinFont.h"
>
</File>
<File
RelativePath=".\WinFontStorage.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
<File
RelativePath=".\ReadMe.txt"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
#ifndef _FONT_UTILS_H
#define _FONT_UTILS_H
#include FT_SFNT_NAMES_H
#define fabs(X) ( X >= 0 ? X : -X )
namespace FontConstants
{
enum FontStyle
{
FontStyleRegular = 0,
FontStyleBold = 1,
FontStyleItalic = 2,
FontStyleBoldItalic = 3,
FontStyleUnderline = 4,
FontStyleStrikeout = 8
};
}
#define UNKNOWN_CHARSET 3 // , DEFAULT_CHARSET,
// charset
//---------------------------------------------------------------------------------------------------
#define MAX_FONT_CACHE_SIZE 16
#define MAX_FONT_NAME_LEN 50
#define MAX_FONT_STYLE_LEN 40
static long GetNextNameValue(HKEY key, LPCTSTR pszSubkey, LPTSTR pszName, LPTSTR pszData)
{
static HKEY hkey = NULL; // registry handle, kept open between calls
static DWORD dwIndex = 0; // count of values returned
LONG retval;
// if all parameters are NULL then close key
if (pszSubkey == NULL && pszName == NULL && pszData == NULL)
{
if (hkey)
RegCloseKey(hkey);
hkey = NULL;
return ERROR_SUCCESS;
}
// if subkey is specified then open key (first time)
if (pszSubkey && pszSubkey[0] != 0)
{
retval = RegOpenKeyEx(key, pszSubkey, 0, KEY_READ, &hkey);
if (retval != ERROR_SUCCESS)
{
return retval;
}
dwIndex = 0;
}
else
{
dwIndex++;
}
_ASSERTE(pszName != NULL && pszData != NULL);
*pszName = 0;
*pszData = 0;
TCHAR szValueName[MAX_PATH];
DWORD dwValueNameSize = sizeof(szValueName)-1;
BYTE szValueData[MAX_PATH];
DWORD dwValueDataSize = sizeof(szValueData)-1;
DWORD dwType = 0;
retval = RegEnumValue(hkey, dwIndex, szValueName, &dwValueNameSize, NULL,
&dwType, szValueData, &dwValueDataSize);
if (retval == ERROR_SUCCESS)
{
lstrcpy(pszName, (LPTSTR)szValueName);
lstrcpy(pszData, (LPTSTR)szValueData);
}
return retval;
}
static FT_Error FT_New_FaceW(FT_Library pLibrary, wchar_t *wsFilePath, FT_Long lIndex, FT_Face *pFace)
{
USES_CONVERSION;
FT_Open_Args oOpenArgs;
oOpenArgs.flags = FT_OPEN_PATHNAME;
oOpenArgs.pathname = W2A( wsFilePath );
FT_Parameter *pParams = (FT_Parameter *)::malloc( sizeof(FT_Parameter) * 4 );
pParams[0].tag = FT_MAKE_TAG( 'i', 'g', 'p', 'f' );
pParams[0].data = NULL;
pParams[1].tag = FT_MAKE_TAG( 'i', 'g', 'p', 's' );
pParams[1].data = NULL;
pParams[2].tag = FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY;
pParams[2].data = NULL;
pParams[3].tag = FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY;
pParams[3].data = NULL;
oOpenArgs.num_params = 4;
oOpenArgs.params = pParams;
int nError = FT_Open_Face( pLibrary, &oOpenArgs, lIndex, pFace );
::free( pParams );
return nError;
}
static int GetDefaultCharset(BOOL bUseDefCharset = TRUE)
{
if ( !bUseDefCharset )
return UNKNOWN_CHARSET;
LOCALESIGNATURE LocSig;
GetLocaleInfo( GetSystemDefaultLCID(), LOCALE_FONTSIGNATURE, (LPWSTR)&LocSig, sizeof(LocSig) / sizeof(TCHAR) );
if ( LocSig.lsCsbDefault[0] & 1 )
return 0;
else if ( LocSig.lsCsbDefault[0] & 2 )
return 238;
else if ( LocSig.lsCsbDefault[0] & 4 )
return 204;
else if ( LocSig.lsCsbDefault[0] & 8 )
return 161;
else if ( LocSig.lsCsbDefault[0] & 16 )
return 162;
else if ( LocSig.lsCsbDefault[0] & 32 )
return 177;
else if ( LocSig.lsCsbDefault[0] & 64 )
return 178;
else if ( LocSig.lsCsbDefault[0] & 128 )
return 186;
else if ( LocSig.lsCsbDefault[0] & 256 )
return 163;
else if ( LocSig.lsCsbDefault[0] & 0x10000 )
return 222;
else if ( LocSig.lsCsbDefault[0] & 0x20000 )
return 128;
else if ( LocSig.lsCsbDefault[0] & 0x40000 )
return 134;
else if ( LocSig.lsCsbDefault[0] & 0x80000 )
return 129;
else if ( LocSig.lsCsbDefault[0] & 0x100000 )
return 136;
else if ( LocSig.lsCsbDefault[0] & 0x200000 )
return 130;
else if ( LocSig.lsCsbDefault[0] & 0x20000000 )
return 77;
else if ( LocSig.lsCsbDefault[0] & 0x40000000 )
return 255;
else if ( LocSig.lsCsbDefault[0] & 0x80000000 )
return 2;
return 0;
}
static void GetCodePageByCharset(unsigned char unCharset, unsigned long *pulBit, unsigned int *punLongIndex)
{
// ,
// AVSFontManager::IsUnicodeRangeAvailable
// Charset -> Codepage: http://support.microsoft.com/kb/165478
// http://msdn.microsoft.com/en-us/library/cc194829.aspx
// Charset Name Charset Value(hex) Codepage number
// ------------------------------------------------------
//
// DEFAULT_CHARSET 1 (x01)
// SYMBOL_CHARSET 2 (x02)
// OEM_CHARSET 255 (xFF)
// ANSI_CHARSET 0 (x00) 1252
// RUSSIAN_CHARSET 204 (xCC) 1251
// EASTEUROPE_CHARSET 238 (xEE) 1250
// GREEK_CHARSET 161 (xA1) 1253
// TURKISH_CHARSET 162 (xA2) 1254
// BALTIC_CHARSET 186 (xBA) 1257
// HEBREW_CHARSET 177 (xB1) 1255
// ARABIC _CHARSET 178 (xB2) 1256
// SHIFTJIS_CHARSET 128 (x80) 932
// HANGEUL_CHARSET 129 (x81) 949
// GB2313_CHARSET 134 (x86) 936
// CHINESEBIG5_CHARSET 136 (x88) 950
// THAI_CHARSET 222 (xDE) 874
// JOHAB_CHARSET 130 (x82) 1361
// VIETNAMESE_CHARSET 163 (xA3) 1258
// MAC_CHARSET 77 (x4D)
// CodePage -> ulCodePageRange1 : http://www.microsoft.com/Typography/otspec/os2.htm#cpr
if ( punLongIndex )
*punLongIndex = 4;
if ( unCharset == DEFAULT_CHARSET )
unCharset = GetDefaultCharset();
if ( pulBit )
{
switch( unCharset )
{
case 0x00: *pulBit = 0; break;
case 0xEE: *pulBit = 1; break;
case 0xCC: *pulBit = 2; break;
case 0xA1: *pulBit = 3; break;
case 0xA2: *pulBit = 4; break;
case 0xB1: *pulBit = 5; break;
case 0xB2: *pulBit = 6; break;
case 0xBA: *pulBit = 7; break;
case 0xA3: *pulBit = 8; break;
case 0xDE: *pulBit = 16; break;
case 0x80: *pulBit = 17; break;
case 0x86: *pulBit = 18; break;
case 0x81: *pulBit = 19; break;
case 0x88: *pulBit = 20; break;
case 0x82: *pulBit = 21; break;
case 0x4D: *pulBit = 29; break;
case 0x02: *pulBit = 31; break;
case 0xFF: *pulBit = 30; break;
default: *pulBit = 0; break;
}
}
}
#endif /* _FONT_UTILS_H */
\ No newline at end of file
#ifndef _LIST_H
#define _LIST_H
//------------------------------------------------------------------------
// CList
//------------------------------------------------------------------------
class CList
{
public:
// .
CList()
{
m_nItemSize = 8;
m_ppData = (void **)::malloc( m_nItemSize * sizeof(void*) );
m_nCount = 0;
m_nIncreament = 0;
}
// <nSize> .
CList(int nSize)
{
m_nItemSize = nSize;
m_ppData = (void **)::malloc( m_nItemSize * sizeof(void*) );
m_nCount = 0;
m_nIncreament = 0;
}
// .
~CList()
{
if ( m_ppData )
::free( m_ppData );
}
int GetLength()
{
return m_nCount;
}
// <nIndex> .
// 0 <= nIndex < m_nCount, NULL.
void *GetByIndex(int nIndex)
{
if ( nIndex < 0 || nIndex >= m_nCount )
return NULL;
return m_ppData[ nIndex ];
}
// .
void Append(void *pItem)
{
if ( m_nCount >= m_nItemSize )
Expand();
m_ppData[m_nCount++] = pItem;
}
// .
void Append(CList *pList)
{
while ( m_nCount + pList->m_nCount > m_nItemSize )
Expand();
for (int nIndex = 0; nIndex < pList->m_nCount; ++nIndex )
m_ppData[m_nCount++] = pList->m_ppData[ nIndex ];
}
// <nIndex>.
// !(0 <= nIndex <= m_nCount), .
void Insert(int nIndex, void *pItem)
{
if ( 0 > nIndex || nIndex > m_nCount )
return;
if ( m_nCount >= m_nItemSize )
Expand();
if ( nIndex < m_nCount )
memmove( m_ppData + nIndex + 1, m_ppData + nIndex, ( m_nCount - nIndex ) * sizeof(void *));
m_ppData[ nIndex ] = pItem;
++m_nCount;
}
// .
// !(0 <= nIndex <= m_nCount), .
void *Delete(int nIndex)
{
void *pItem = m_ppData[ nIndex ];
if ( nIndex < m_nCount - 1 )
memmove( m_ppData + nIndex, m_ppData + nIndex + 1, (m_nCount - nIndex - 1) * sizeof(void *));
--m_nCount;
if ( m_nItemSize - m_nCount >= ((m_nIncreament > 0) ? m_nIncreament : m_nItemSize / 2 ) )
Shrink();
return pItem;
}
// ,
// .
void Sort(int (*CompareFunc)(const void *pItem1, const void *pItem2 ) )
{
qsort( m_ppData, m_nCount, sizeof(void *), CompareFunc);
}
// m_nIncreament > 0,
// m_nIncreament . m_nIncreament <= 0,
// .
void SetAllocationIncreament(int nIncreament)
{
m_nIncreament = nIncreament;
}
private:
void Expand()
{
m_nItemSize += ( m_nIncreament > 0 ) ? m_nIncreament : m_nItemSize;
m_ppData = (void **)::realloc( m_ppData, m_nItemSize * sizeof(void*) );
}
void Shrink()
{
m_nItemSize -= ( m_nIncreament > 0 ) ? m_nIncreament : m_nItemSize / 2;
m_ppData = (void **)::realloc( m_ppData, m_nItemSize * sizeof(void*) );
}
private:
void **m_ppData; //
int m_nItemSize; //
int m_nCount; //
int m_nIncreament; //
};
#define DeleteCList(list, T) \
do { \
CList *_list = (list); \
{ \
int _i; \
for (_i = 0; _i < _list->GetLength(); ++_i) { \
delete (T*)_list->GetByIndex(_i); \
} \
delete _list; \
} \
} while (0)
#endif /* _LIST_H */
\ No newline at end of file
========================================================================
CONSOLE APPLICATION : FontMaps Project Overview
========================================================================
AppWizard has created this FontMaps application for you.
This file contains a summary of what you will find in each of the files that
make up your FontMaps application.
FontMaps.vcproj
This is the main project file for VC++ projects generated using an Application Wizard.
It contains information about the version of Visual C++ that generated the file, and
information about the platforms, configurations, and project features selected with the
Application Wizard.
FontMaps.cpp
This is the main application source file.
/////////////////////////////////////////////////////////////////////////////
Other standard files:
StdAfx.h, StdAfx.cpp
These files are used to build a precompiled header (PCH) file
named FontMaps.pch and a precompiled types file named StdAfx.obj.
/////////////////////////////////////////////////////////////////////////////
Other notes:
AppWizard uses "TODO:" comments to indicate parts of the source code you
should add to or customize.
/////////////////////////////////////////////////////////////////////////////
/***************************************************************
CShareMemArray
Shared-.
.
***************************************************************/
#pragma once
#pragma warning( disable : 4996 4244) // No CRT-secure warning
#include <atlcoll.h>
#include "../../../Common/ASCUtils.h" // CSyncAccess class definition
#define AVS_USER_NAME_LEN 1024
// (, , )
enum TSMAStatus {SMAS_ERROR, SMAS_ALREADYEXISTS, SMAS_NEW};
//
template <typename STOR_TYPE>
class CShareMemArray
{
protected:
HANDLE m_hAccessMutex; // Shared-Memory
HANDLE m_hMapFile; // map
STOR_TYPE *m_pArray; //
LONG64 m_nSize; //
CString m_sMutexName; //
CString m_sMapName; //
TSMAStatus m_sStatus;
protected:
//
bool ReadFromSharedMem(LONG64 nIndex, STOR_TYPE &nValue)
{
if (NULL == m_pArray)
{
m_sStatus = SMAS_ERROR;
return false;
}
__try
{
STOR_TYPE *pTable = (STOR_TYPE *) (((BYTE *) m_pArray) + sizeof(LONG64)); // sizeof(LONG64) -
nValue = pTable[nIndex];
}
__except(EXCEPTION_IN_PAGE_ERROR == GetExceptionCode() ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH)
{
// Failed to read from the view.
ATLTRACE2("CIndexerStorage::ReadFromSharedMem()\n");
return false;
}
return true;
}
//
bool WriteToSharedMem(LONG64 nIndex, STOR_TYPE aValue)
{
if (NULL == m_pArray)
{
m_sStatus = SMAS_ERROR;
return false;
}
__try
{
STOR_TYPE *pTable = (STOR_TYPE *) (((BYTE *) m_pArray) + sizeof(LONG64)); // sizeof(LONG64) -
pTable[nIndex] = aValue;
}
__except(EXCEPTION_IN_PAGE_ERROR == GetExceptionCode() ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH)
{
// Failed to read from the view.
ATLTRACE2("Error CIndexerStorage::WriteToSharedMem(#i)\n", nIndex);
return false;
}
return true;
}
// SharedMemory
bool SaveTable_unsync(CAtlArray<STOR_TYPE> &aTable)
{
if ((NULL == m_pArray) || (NULL == m_hMapFile))
{
m_sStatus = SMAS_ERROR;
return false; //
}
bool bRes = true;
//
LONG64 nCopyCount = (m_nSize <= (LONG64) aTable.GetCount()) ? m_nSize : aTable.GetCount();
//
Size_unsync(m_nSize);
// (safe)
for (LONG64 nIndex = 0; nIndex < nCopyCount; nIndex++)
{
bRes &= WriteToSharedMem (nIndex, aTable[nIndex]);
}
return bRes;
}
// SharedMemory
bool LoadTable_unsync(CAtlArray<STOR_TYPE> &aTable)
{
if ((NULL == m_pArray) || (NULL == m_hMapFile))
{
m_sStatus = SMAS_ERROR;
return false; //
}
aTable.RemoveAll();
//
m_nSize = Size_unsync();
STOR_TYPE nValue;
//
for (DWORD nIndex = 0; nIndex < m_nSize; nIndex++)
{
if (ReadFromSharedMem(nIndex, nValue))
{
//
aTable.Add(nValue);
}
}
return true;
}
//
LONG64 Size_unsync()
{
LONG64 nValue = -1;
if (NULL == m_pArray)
{
m_sStatus = SMAS_ERROR;
return nValue;
}
__try
{
LONG64 *pSize = (LONG64 *) m_pArray;
nValue = *pSize;
}
__except(EXCEPTION_IN_PAGE_ERROR == GetExceptionCode() ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH)
{
// Failed to read from the view.
ATLTRACE2("CIndexerStorage::Size_unsync()\n");
return -1;
}
return nValue;
}
void Size_unsync(LONG64 aSize)
{
if (NULL == m_pArray)
{
m_sStatus = SMAS_ERROR;
return;
}
__try
{
LONG64 *pSize = (LONG64*) m_pArray; // sizeof(LONG64) -
*pSize = aSize;
}
__except(EXCEPTION_IN_PAGE_ERROR == GetExceptionCode() ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH)
{
// Failed to read from the view.
ATLTRACE2("Error CIndexerStorage::Size_unsync(LONG64 aSize)\n");
}
}
public:
// aSize - (- ),
// Id - ,
CShareMemArray(CString &aFileName, LONG64 aSize, DWORD aId = ISID_DEFAULT):
m_hMapFile(NULL), m_nSize(aSize), m_pArray(NULL), m_sStatus(SMAS_ERROR)
{
// ""
TCHAR aDrive[_MAX_DRIVE];
TCHAR aDir[_MAX_DIR];
TCHAR aFName[_MAX_FNAME];
TCHAR aExt[_MAX_EXT];
_tsplitpath (aFileName.GetBuffer(), aDrive, aDir, aFName, aExt);
//_wsplitpath_s (aFileName.GetBuffer(), aDrive, _MAX_DRIVE, aDir, _MAX_DIR, aFName, _MAX_FNAME, aExt, _MAX_EXT);
// ,
DWORD dwPathID = 0;
TCHAR tcPathIDItem = 0;
//
for (int i = 0; i < (int) _tcslen(aDir); i++)
{
tcPathIDItem ^= aDir[i];
dwPathID ^= dwPathID << 1;
dwPathID += (DWORD) tcPathIDItem;
}
//
DWORD dwExtID = 0;
TCHAR tcExtIDItem = 0;
for (int i = 0; i < (int) _tcslen(aExt); i++)
{
tcExtIDItem ^= aExt[i];
dwExtID ^= dwExtID << 1;
dwExtID += (DWORD) tcExtIDItem;
}
//
// .
// .
// "Global\"
// : "Global\" Win7,
m_sMutexName.Format(_T("Local\\avs_mutex%u_%s_%06x_%06I64x_%06x"), aId, aFName, dwPathID, aSize, dwExtID);
m_sMapName.Format(_T("Local\\avs_storage%u_%s_%06x_%06I64x_%06x"), aId, aFName, dwPathID, aSize, dwExtID);
//
TCHAR pBufferUserName[AVS_USER_NAME_LEN];
DWORD dwBufferUserNameLen = AVS_USER_NAME_LEN;
GetUserName(pBufferUserName, &dwBufferUserNameLen);
CString strUserName(pBufferUserName, dwBufferUserNameLen);
m_sMutexName += strUserName;
m_sMapName += strUserName;
//
m_hAccessMutex = CreateMutex(NULL, FALSE, m_sMutexName.GetBuffer());
// " " :)
CSynchAccess oAccess = m_hAccessMutex;
//
ATLTRACE2("CShareMemArray()::CShareMemArray(): m_nSize = %d\n", m_nSize);
ULARGE_INTEGER nMappingSize;
nMappingSize.QuadPart = m_nSize * sizeof(STOR_TYPE) + sizeof(LONG64);
m_hMapFile = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, nMappingSize.HighPart, nMappingSize.LowPart, m_sMapName.GetBuffer());
if (NULL == m_hMapFile)
{
//
ATLTRACE2("CShareMemArray::CShareMemArray():CreateFileMapping() FAILS (0x%x)!\n", GetLastError());
m_sStatus = SMAS_ERROR;
}
else
{
// !
m_sStatus = (GetLastError() == ERROR_ALREADY_EXISTS) ? SMAS_ALREADYEXISTS : SMAS_NEW;
ATLTRACE2 (SMAS_ALREADYEXISTS == m_sStatus ? "CShareMemArray: open existing!\n" : "CShareMemArray: create new!\n");
// View of file
m_pArray = (STOR_TYPE *) MapViewOfFile(m_hMapFile, FILE_MAP_ALL_ACCESS, 0, 0, (SIZE_T) nMappingSize.QuadPart);
if (NULL == m_pArray)
{
//
ATLTRACE2("CShareMemArray::CShareMemArray():MapViewOfFile() FAILS (0x%x)!\n", GetLastError());
m_sStatus = SMAS_ERROR;
}
}
}
virtual ~CShareMemArray()
{
if (m_pArray) UnmapViewOfFile(m_pArray); // view
if (NULL != m_hMapFile) CloseHandle(m_hMapFile); //
if (NULL != m_hAccessMutex) CloseHandle(m_hAccessMutex); //
}
public:
// -
bool Save(CAtlArray<STOR_TYPE> &aTable)
{
CSynchAccess oAccess = m_hAccessMutex;
return SaveTable_unsync(aTable);
}
//
bool Load(CAtlArray<STOR_TYPE> &aTable)
{
CSynchAccess oAccess = m_hAccessMutex;
return LoadTable_unsync(aTable);
}
//
LONG64 Size()
{
CSynchAccess oAccess = m_hAccessMutex;
return Size_unsync();
}
/*void Size(LONG64 aSize)
{
CSynchAccess oAccess = m_hAccessMutex;
Size_unsync(aSize);
}*/
//
TSMAStatus Status(void) const
{
CSynchAccess oAccess = m_hAccessMutex;
return m_sStatus;
}
};
This diff is collapsed.
#pragma once
#include "../../../Common/ShareMemArray.h"
//
#define ISID_DEFAULT 0x0000 //
#define ISID_WIN_FONT_STATUS_STORAGE 0x0001 //
#define ISID_WIN_FONT_INFO_STORAGE 0x0002 //
// .
#define STORAGE_TABLE_NAME_LEN 1024
#define STATUS_STORAGE_NAME CString( _T("AVS_LOADED_WIN_FONTS") )
namespace NSStrings
{
static CString ConvertCStringWToCString(CStringW& strW)
{
BSTR bstr = strW.AllocSysString();
CString str(bstr);
SysFreeString(bstr);
return str;
}
static CStringW GetCStringWFromUTF8( BYTE* pBuffer, LONG64 lCount )
{
LONG64 lLenght = 0;
CStringW strRes = L"";
for (LONG lIndex = 0; lIndex < lCount; ++lIndex)
{
if (0x00 == (0x80 & pBuffer[lIndex]))
{
strRes += (WCHAR)pBuffer[lIndex];
continue;
}
else if (0x00 == (0x20 & pBuffer[lIndex]))
{
WCHAR mem = (WCHAR)(((pBuffer[lIndex] & 0x1F) << 6) + (pBuffer[lIndex + 1] & 0x3F));
strRes += mem;
lIndex += 1;
}
else if (0x00 == (0x10 & pBuffer[lIndex]))
{
WCHAR mem = (WCHAR)(((pBuffer[lIndex] & 0x0F) << 12) + ((pBuffer[lIndex + 1] & 0x3F) << 6) + (pBuffer[lIndex + 2] & 0x3F));
strRes += mem;
lIndex += 2;
}
}
return strRes;
}
static CString GetCStringFromUTF8( BYTE* pBuffer, LONG64 lCount )
{
CStringW strRes = GetCStringWFromUTF8(pBuffer, lCount);
return ConvertCStringWToCString(strRes);
}
};
//
enum WinFontsTableStatus {STIF_ERROR, STIF_AVAILABLE, STIF_CREATING, STIF_BROKEN};
enum StringCoding
{
scASCII = 0,
scUNICODE = 1,
scUTF8 = 2
};
//
struct WinFontsStatusStorage
{
//
WinFontsTableStatus m_sStatus; //
LONG64 m_lLength; //
WinFontsStatusStorage()
{
Reset();
}
void Reset()
{
//
m_sStatus = STIF_ERROR; //
m_lLength = 0;
}
};
//
struct WinFontsInfoStorage
{
LONG m_lCount;
CStringA m_strXml;
BYTE* m_pBuffer;
LONG m_lCountData;
WinFontsInfoStorage()
{
Reset();
}
~WinFontsInfoStorage()
{
}
void Reset()
{
m_lCount = 0;
m_strXml = "";
m_pBuffer = NULL;
}
void GenerateInfo(BSTR bstrXML)
{
m_strXml = CStringA(bstrXML);
m_pBuffer = NULL;
m_lCountData = 0;
}
void GenerateInfo(BYTE* pBuffer, LONG lCountData)
{
m_pBuffer = pBuffer;
m_lCountData = lCountData;
}
void Save(BYTE* pBuffer)
{
if (NULL == pBuffer)
return;
if (0 == m_lCountData)
{
memcpy(pBuffer, (BYTE*)m_strXml.GetBuffer(), m_strXml.GetLength());
}
else
{
memcpy(pBuffer, m_pBuffer, m_lCountData);
}
}
LONG64 GetLength()
{
if (0 == m_lCountData)
{
return m_strXml.GetLength();
}
return m_lCountData;
}
void Load(BYTE* pBuffer, LONG64 lLength)
{
//m_pBuffer = pBuffer;
m_lCountData = (LONG)lLength;
m_pBuffer = new BYTE[m_lCountData];
memcpy(m_pBuffer, pBuffer, m_lCountData);
}
};
//
class CWinFontsStatusStorage: public CShareMemArray<BYTE>
{
protected:
bool ReadStruct_unsync(WinFontsStatusStorage *aData) // unsync
{
__try
{
WinFontsStatusStorage *pTable = (WinFontsStatusStorage *) ( (BYTE *)m_pArray + sizeof(LONG64)); // sizeof(LONG64) -
memcpy(aData, pTable, sizeof(WinFontsStatusStorage));
}
__except(EXCEPTION_IN_PAGE_ERROR == GetExceptionCode() ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH)
{
// Failed to read from the view.
//ATLTRACE2("CStatusStorage::ReadStruct_unsync() fails!\n");
return false;
}
return true;
}
bool WriteStruct_unsync(WinFontsStatusStorage *aData) // unsync
{
__try
{
WinFontsStatusStorage *pTable = (WinFontsStatusStorage *) ( (BYTE *)m_pArray + sizeof(LONG64)); // sizeof(LONG64) -
memcpy(pTable, aData, sizeof(WinFontsStatusStorage));
}
__except(EXCEPTION_IN_PAGE_ERROR == GetExceptionCode() ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH)
{
// Failed to read from the view.
//ATLTRACE2("CStatusStorage::ReadStruct_unsync() fails!\n");
return false;
}
return true;
}
public:
bool ReadStruct(WinFontsStatusStorage *aData)
{
CSynchAccess oAccess = m_hAccessMutex;
return ReadStruct_unsync(aData);
}
bool WriteStruct(WinFontsStatusStorage *aData)
{
CSynchAccess oAccess = m_hAccessMutex;
return WriteStruct_unsync(aData);
}
public:
// (bForceControl - , )
// *bForceControl == true -
bool GetStatus(bool *bForceControl, WinFontsStatusStorage* aIS)
{
bool bTryToForceControl = bForceControl && (*bForceControl);
if (NULL == aIS) return false;
if (bForceControl) *bForceControl = false; //
// :)
CSynchAccess oAccess = m_hAccessMutex;
if (!ReadStruct_unsync(aIS)) return false; //
if ((STIF_BROKEN == aIS->m_sStatus) || (STIF_ERROR == aIS->m_sStatus))
{
// - , ( )
if (bTryToForceControl)
{
//
aIS->Reset();
aIS->m_sStatus = STIF_CREATING;
*bForceControl = WriteStruct_unsync(aIS); // ,
}
}
return true;
}
// , .
bool SetBroken()
{
CSynchAccess oAccess = m_hAccessMutex;
WinFontsStatusStorage sStor;
sStor.m_sStatus = STIF_BROKEN;
// -
return WriteStruct_unsync(&sStor);
}
private:
//
bool Save(CAtlArray<BYTE> &aTable)
{
return false;
}
bool Load(CAtlArray<BYTE> &aTable)
{
return false;
}
public:
CWinFontsStatusStorage(CString &aName): CShareMemArray(aName, sizeof(WinFontsStatusStorage), ISID_WIN_FONT_STATUS_STORAGE)
{
// aName AVS_LOAD_WIN_FONTS
//ATLTRACE2("CStatusStorage created;\n");
};
~CWinFontsStatusStorage()
{
//ATLTRACE2("CStatusStorage destroyed;\n");
};
};
//
class CWinFontsInfoStorage: public CShareMemArray<BYTE>
{
protected:
bool ReadStruct_unsync(WinFontsInfoStorage *aData) // unsync
{
__try
{
LONG64 lLength = Size();
aData->Load((BYTE*)m_pArray + sizeof(LONG64), lLength); // sizeof(LONG64) -
}
__except(EXCEPTION_IN_PAGE_ERROR == GetExceptionCode() ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH)
{
// Failed to read from the view.
//ATLTRACE2("CStatusStorage::ReadStruct_unsync() fails!\n");
return false;
}
return true;
}
bool WriteStruct_unsync(WinFontsInfoStorage *aData) // unsync
{
__try
{
LONG64 *pSize = (LONG64*)m_pArray;
*pSize = m_nSize;
aData->Save((BYTE*)m_pArray + sizeof(LONG64)); // sizeof(LONG64) -
}
__except(EXCEPTION_IN_PAGE_ERROR == GetExceptionCode() ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH)
{
// Failed to read from the view.
//ATLTRACE2("CStatusStorage::ReadStruct_unsync() fails!\n");
return false;
}
return true;
}
public:
bool ReadStruct(WinFontsInfoStorage *aData)
{
//CSynchAccess oAccess = m_hAccessMutex;
return ReadStruct_unsync(aData);
}
bool WriteStruct(WinFontsInfoStorage *aData)
{
CSynchAccess oAccess = m_hAccessMutex;
return WriteStruct_unsync(aData);
}
bool WriteCount(WinFontsInfoStorage *aData)
{
__try
{
BYTE* pData = (BYTE*)m_pArray + sizeof(LONG64);
*((LONG*)pData) = aData->m_lCount;
}
__except(EXCEPTION_IN_PAGE_ERROR == GetExceptionCode() ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH)
{
// Failed to read from the view.
//ATLTRACE2("CWinFontsInfoStorage::ReadStruct_unsync() fails!\n");
return false;
}
return true;
}
private:
//
bool Save(CAtlArray<BYTE> &aTable)
{
return false;
}
bool Load(CAtlArray<BYTE> &aTable)
{
return false;
}
public:
CWinFontsInfoStorage(CString &aFileName, LONG64 lSize): CShareMemArray(aFileName, lSize, ISID_WIN_FONT_INFO_STORAGE)
{
//ATLTRACE2("CWinFontsInfoStorage created;\n");
};
~CWinFontsInfoStorage()
{
//ATLTRACE2("CWinFontsInfoStorage destroyed;\n");
};
};
// stdafx.cpp : source file that includes just the standard includes
// FontMaps.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <stdio.h>
#include <tchar.h>
// TODO: reference additional headers your program requires here
#ifndef STRICT
#define STRICT
#endif
// Modify the following defines if you have to target a platform prior to the ones specified below.
// Refer to MSDN for the latest info on corresponding values for different platforms.
#ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later.
#define WINVER 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
#endif
#ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later.
#define _WIN32_WINNT 0x0400 // Change this to the appropriate value to target Windows 2000 or later.
#endif
#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
#endif
#ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later.
#define _WIN32_IE 0x0400 // Change this to the appropriate value to target IE 5.0 or later.
#endif
#define _ATL_APARTMENT_THREADED
#define _ATL_NO_AUTOMATIC_NAMESPACE
#define _CRT_SECURE_NO_DEPRECATE
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
// turns off ATL's hiding of some common and often safely ignored warning messages
#define _ATL_ALL_WARNINGS
#include <atlbase.h>
#include <atlcom.h>
#include <atlwin.h>
#include <atltypes.h>
#include <atlctl.h>
#include <atlhost.h>
#include <atlstr.h>
using namespace ATL;
# CMakeLists.txt
#
# Copyright 2013, 2014 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# Written by John Cary <cary@txcorp.com>
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
#
#
# Say
#
# cmake CMakeLists.txt
#
# to create a Makefile that builds a static version of the library. For a
# dynamic library, use
#
# cmake CMakeLists.txt -DBUILD_SHARED_LIBS:BOOL=true
#
# instead. Please refer to the cmake manual for further options, in
# particular, how to modify compilation and linking parameters.
#
# Some notes.
#
# . `cmake' will overwrite FreeType's original (top-level) `Makefile' file.
#
# . You can use `cmake' directly on a freshly cloned FreeType git
# repository.
#
# . `CMakeLists.txt' is provided as-is since it is not used by the
# developer team.
cmake_minimum_required(VERSION 2.6)
project(freetype)
set(VERSION_MAJOR "2")
set(VERSION_MINOR "5")
set(VERSION_PATCH "3")
set(PROJECT_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
# Compiler definitions for building the library
add_definitions(-DFT2_BUILD_LIBRARY)
# Specify library include directories
include_directories("${PROJECT_SOURCE_DIR}/include")
# Create the configuration file
message(STATUS "Creating directory, ${PROJECT_BINARY_DIR}/include.")
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/include)
# For the auto-generated ftconfig.h file
include_directories("${PROJECT_BINARY_DIR}/include")
message(STATUS "Creating ${PROJECT_BINARY_DIR}/include/ftconfig.h.")
execute_process(
COMMAND sed -e "s/FT_CONFIG_OPTIONS_H/<ftoption.h>/" -e "s/FT_CONFIG_STANDARD_LIBRARY_H/<ftstdlib.h>/" -e "s?/undef ?#undef ?"
INPUT_FILE ${PROJECT_SOURCE_DIR}/builds/unix/ftconfig.in
OUTPUT_FILE ${PROJECT_BINARY_DIR}/include/ftconfig.h
)
set(BASE_SRCS
src/autofit/autofit.c
src/base/ftadvanc.c
src/base/ftbbox.c
src/base/ftbitmap.c
src/base/ftcalc.c
src/base/ftcid.c
src/base/ftdbgmem.c
src/base/ftdebug.c
src/base/ftfstype.c
src/base/ftgasp.c
src/base/ftgloadr.c
src/base/ftglyph.c
src/base/ftgxval.c
src/base/ftinit.c
src/base/ftlcdfil.c
src/base/ftmm.c
src/base/ftobjs.c
src/base/ftotval.c
src/base/ftoutln.c
src/base/ftpatent.c
src/base/ftpfr.c
src/base/ftrfork.c
src/base/ftsnames.c
src/base/ftstream.c
src/base/ftstroke.c
src/base/ftsynth.c
src/base/ftsystem.c
src/base/fttrigon.c
src/base/fttype1.c
src/base/ftutil.c
src/base/ftwinfnt.c
src/base/ftxf86.c
src/bdf/bdf.c
src/bzip2/ftbzip2.c
src/cache/ftcache.c
src/cff/cff.c
src/cid/type1cid.c
src/gzip/ftgzip.c
src/lzw/ftlzw.c
src/pcf/pcf.c
src/pfr/pfr.c
src/psaux/psaux.c
src/pshinter/pshinter.c
src/psnames/psmodule.c
src/raster/raster.c
src/sfnt/sfnt.c
src/smooth/smooth.c
src/truetype/truetype.c
src/type1/type1.c
src/type42/type42.c
src/winfonts/winfnt.c
)
include_directories("src/truetype")
include_directories("src/sfnt")
include_directories("src/autofit")
include_directories("src/smooth")
include_directories("src/raster")
include_directories("src/psaux")
include_directories("src/psnames")
add_library(freetype ${BASE_SRCS})
# Installations
# Note the trailing slash in the argument to the `DIRECTORY' directive
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/
DESTINATION include/freetype2
PATTERN "internal" EXCLUDE
)
install(TARGETS freetype
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
# Packaging
# CPack version numbers for release tarball name.
set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH}})
if (NOT DEFINED CPACK_PACKAGE_DESCRIPTION_SUMMARY)
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${CMAKE_PROJECT_NAME}")
endif ()
if (NOT DEFINED CPACK_SOURCE_PACKAGE_FILE_NAME)
set(CPACK_SOURCE_PACKAGE_FILE_NAME
"${CMAKE_PROJECT_NAME}-${PROJECT_VERSION}-r${PROJECT_REV}"
CACHE INTERNAL "tarball basename"
)
endif ()
set(CPACK_SOURCE_GENERATOR TGZ)
set(CPACK_SOURCE_IGNORE_FILES
"/CVS/;/.svn/;.swp$;.#;/#;/build/;/serial/;/ser/;/parallel/;/par/;~;/preconfig.out;/autom4te.cache/;/.config")
set(CPACK_GENERATOR TGZ)
include(CPack)
# add make dist target
add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source)
# eof
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
# FreeType 2 top Jamfile.
#
# Copyright 2001-2014 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
# The HDRMACRO is already defined in FTJam and is used to add
# the content of certain macros to the list of included header
# files.
#
# We can compile FreeType 2 with classic Jam however thanks to
# the following code
#
if ! $(JAM_TOOLSET)
{
rule HDRMACRO
{
# nothing
}
}
# We need to invoke a SubDir rule if the FT2 source directory top is not the
# current directory. This allows us to build FreeType 2 as part of a larger
# project easily.
#
if $(FT2_TOP) != $(DOT)
{
SubDir FT2_TOP ;
}
# The following macros define the include directory, the source directory,
# and the final library name (without library extensions). They can be
# replaced by other definitions when the library is compiled as part of
# a larger project.
#
# Name of FreeType include directory during compilation.
# This is relative to FT2_TOP.
#
FT2_INCLUDE_DIR ?= include ;
# Name of FreeType source directory during compilation.
# This is relative to FT2_TOP.
#
FT2_SRC_DIR ?= src ;
# Name of final library, without extension.
#
FT2_LIB ?= $(LIBPREFIX)freetype ;
# Define FT2_BUILD_INCLUDE to point to your build-specific directory.
# This is prepended to FT2_INCLUDE_DIR. It can be used to specify
# the location of a custom <ft2build.h> which will point to custom
# versions of `ftmodule.h' and `ftoption.h', for example.
#
FT2_BUILD_INCLUDE ?= ;
# The list of modules to compile on any given build of the library.
# By default, this will contain _all_ modules defined in FT2_SRC_DIR.
#
# IMPORTANT: You'll need to change the content of `ftmodule.h' as well
# if you modify this list or provide your own.
#
FT2_COMPONENTS ?= autofit # auto-fitter
base # base component (public APIs)
bdf # BDF font driver
cache # cache sub-system
cff # CFF/CEF font driver
cid # PostScript CID-keyed font driver
pcf # PCF font driver
bzip2 # support for bzip2-compressed PCF font
gzip # support for gzip-compressed PCF font
lzw # support for LZW-compressed PCF font
pfr # PFR/TrueDoc font driver
psaux # common PostScript routines module
pshinter # PostScript hinter module
psnames # PostScript names handling
raster # monochrome rasterizer
smooth # anti-aliased rasterizer
sfnt # SFNT-based format support routines
truetype # TrueType font driver
type1 # PostScript Type 1 font driver
type42 # PostScript Type 42 (embedded TrueType) driver
winfonts # Windows FON/FNT font driver
;
# Don't touch.
#
FT2_INCLUDE = $(FT2_BUILD_INCLUDE)
[ FT2_SubDir $(FT2_INCLUDE_DIR) ] ;
FT2_SRC = [ FT2_SubDir $(FT2_SRC_DIR) ] ;
# Location of API Reference Documentation
#
if $(DOC_DIR)
{
DOC_DIR = $(DOCDIR:T) ;
}
else
{
DOC_DIR = docs/reference ;
}
# Only used by FreeType developers.
#
if $(DEBUG_HINTER)
{
CCFLAGS += -DDEBUG_HINTER ;
}
# We need `freetype2/include' in the current include path in order to
# compile any part of FreeType 2.
#: updating documentation for upcoming release
HDRS += $(FT2_INCLUDE) ;
# We need to #define FT2_BUILD_LIBRARY so that our sources find the
# internal headers
#
DEFINES += FT2_BUILD_LIBRARY ;
# Uncomment the following line if you want to build individual source files
# for each FreeType 2 module. This is only useful during development, and
# is better defined as an environment variable anyway!
#
# FT2_MULTI = true ;
# The file <config/ftheader.h> is used to define macros that are later used
# in #include statements. It needs to be parsed in order to record these
# definitions.
#
HDRMACRO [ FT2_SubDir include freetype config ftheader.h ] ;
HDRMACRO [ FT2_SubDir include freetype internal internal.h ] ;
# Now include the Jamfile in `freetype2/src', used to drive the compilation
# of each FreeType 2 component and/or module.
#
SubInclude FT2_TOP $(FT2_SRC_DIR) ;
# Handle the generation of the `ftexport.sym' file which contain the list
# of exported symbols. This can be used on Unix by libtool.
#
SubInclude FT2_TOP $(FT2_SRC_DIR) tools ;
rule GenExportSymbols
{
local apinames = apinames$(SUFEXE) ;
local headers = [ Glob $(2) : *.h ] ;
LOCATE on $(1) = $(ALL_LOCATE_TARGET) ;
APINAMES on $(1) = apinames$(SUFEXE) ;
Depends $(1) : $(apinames) $(headers) ;
GenExportSymbols1 $(1) : $(headers) ;
Clean clean : $(1) ;
}
actions GenExportSymbols1 bind APINAMES
{
$(APINAMES) $(2) > $(1)
}
GenExportSymbols ftexport.sym : include include/cache ;
# Test files (hinter debugging). Only used by FreeType developers.
#
if $(DEBUG_HINTER)
{
SubInclude FT2_TOP tests ;
}
rule RefDoc
{
Depends $1 : all ;
NotFile $1 ;
Always $1 ;
}
actions RefDoc
{
python $(FT2_SRC)/tools/docmaker/docmaker.py --prefix=ft2 --title=FreeType-2.5.3 --output=$(DOC_DIR) $(FT2_INCLUDE)/*.h $(FT2_INCLUDE)/config/*.h
}
RefDoc refdoc ;
# end of top Jamfile
# FreeType 2 JamRules.
#
# Copyright 2001, 2002, 2003 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
# This file contains the Jam rules needed to build the FreeType 2 library.
# It is shared by all Jamfiles and is included only once in the build
# process.
#
# Call SubDirHdrs on a list of directories.
#
rule AddSubDirHdrs
{
local x ;
for x in $(<)
{
SubDirHdrs $(x) ;
}
}
# Determine prefix of library file. We must use "libxxxxx" on Unix systems,
# while all other simply use the real name.
#
if $(UNIX)
{
LIBPREFIX ?= lib ;
}
else
{
LIBPREFIX ?= "" ;
}
# FT2_TOP contains the location of the FreeType source directory. You can
# set it to a specific value if you want to compile the library as part of a
# larger project.
#
FT2_TOP ?= $(DOT) ;
# Define a new rule used to declare a sub directory of the Nirvana source
# tree.
#
rule FT2_SubDir
{
if $(FT2_TOP) = $(DOT)
{
return [ FDirName $(<) ] ;
}
else
{
return [ FDirName $(FT2_TOP) $(<) ] ;
}
}
# We also set ALL_LOCATE_TARGET in order to place all object and library
# files in "objs".
#
ALL_LOCATE_TARGET ?= [ FT2_SubDir objs ] ;
# end of Jamrules
#
# FreeType 2 build system -- top-level Makefile
#
# Copyright 1996-2000, 2002, 2006 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
# Project names
#
PROJECT := freetype
PROJECT_TITLE := FreeType
# The variable TOP_DIR holds the path to the topmost directory in the project
# engine source hierarchy. If it is not defined, default it to `.'.
#
TOP_DIR ?= .
# The variable OBJ_DIR gives the location where object files and the
# FreeType library are built.
#
OBJ_DIR ?= $(TOP_DIR)/objs
include $(TOP_DIR)/builds/toplevel.mk
# EOF
FreeType 2.5.3
==============
Homepage: http://www.freetype.org
FreeType is a freely available software library to render fonts.
It is written in C, designed to be small, efficient, highly
customizable, and portable while capable of producing high-quality
output (glyph images) of most vector and bitmap font formats.
Please read the docs/CHANGES file, it contains IMPORTANT
INFORMATION.
Read the files `docs/INSTALL*' for installation instructions; see
the file `docs/LICENSE.TXT' for the available licenses.
The FreeType 2 API reference is located in `docs/reference'; use the
file `ft2-toc.html' as the top entry point. Additional
documentation is available as a separate package from our sites. Go
to
http://download.savannah.gnu.org/releases/freetype/
and download one of the following files.
freetype-doc-2.5.3.tar.bz2
freetype-doc-2.5.3.tar.gz
ftdoc253.zip
To view the documentation online, go to
http://www.freetype.org/freetype2/documentation.html
Mailing Lists
=============
The preferred way of communication with the FreeType team is using
e-mail lists.
general use and discussion: freetype@nongnu.org
engine internals, porting, etc.: freetype-devel@nongnu.org
announcements: freetype-announce@nongnu.org
The lists are moderated; see
http://www.freetype.org/contact.html
how to subscribe.
Bugs
====
Please report bugs by e-mail to `freetype-devel@nongnu.org'. Don't
forget to send a detailed explanation of the problem -- there is
nothing worse than receiving a terse message that only says `it
doesn't work'.
Alternatively, you may submit a bug report at
https://savannah.nongnu.org/bugs/?group=freetype
Enjoy!
The FreeType Team
----------------------------------------------------------------------
Copyright 2006-2014 by
David Turner, Robert Wilhelm, and Werner Lemberg.
This file is part of the FreeType project, and may only be used,
modified, and distributed under the terms of the FreeType project
license, LICENSE.TXT. By continuing to use, modify, or distribute
this file you indicate that you have read the license and understand
and accept it fully.
--- end of README ---
The git archive doesn't contain pre-built configuration scripts for
UNIXish platforms. To generate them say
sh autogen.sh
which in turn depends on the following packages:
automake (1.10.1)
libtool (2.2.4)
autoconf (2.62)
The versions given in parentheses are known to work. Newer versions
should work too, of course. Note that autogen.sh also sets up proper
file permissions for the `configure' and auxiliary scripts.
The autogen.sh script now checks the version of above three packages
whether they match the numbers above. Otherwise it will complain and
suggest either upgrading or using an environment variable to point to
a more recent version of the required tool(s).
Note that `aclocal' is provided by the `automake' package on Linux,
and that `libtoolize' is called `glibtoolize' on Darwin (OS X).
For static builds which don't use platform specific optimizations, no
configure script is necessary at all; saying
make setup ansi
make
should work on all platforms which have GNU make (or makepp).
Similarly, a build with `cmake' can be done directly from the git
repository.
----------------------------------------------------------------------
Copyright 2005-2010, 2013 by
David Turner, Robert Wilhelm, and Werner Lemberg.
This file is part of the FreeType project, and may only be used,
modified, and distributed under the terms of the FreeType project
license, LICENSE.TXT. By continuing to use, modify, or distribute
this file you indicate that you have read the license and understand
and accept it fully.
--- end of README.git ---
#!/bin/sh
# Copyright 2005-2010, 2013 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
run ()
{
echo "running \`$*'"
eval $*
if test $? != 0 ; then
echo "error while running \`$*'"
exit 1
fi
}
get_major_version ()
{
echo $1 | sed -e 's/\([0-9][0-9]*\)\..*/\1/g'
}
get_minor_version ()
{
echo $1 | sed -e 's/[0-9][0-9]*\.\([0-9][0-9]*\).*/\1/g'
}
get_patch_version ()
{
# tricky: some version numbers don't include a patch
# separated with a point, but something like 1.4-p6
patch=`echo $1 | sed -e 's/[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*/\1/g'`
if test "$patch" = "$1"; then
patch=`echo $1 | sed -e 's/[0-9][0-9]*\.[0-9][0-9]*\-p\([0-9][0-9]*\).*/\1/g'`
# if there isn't any patch number, default to 0
if test "$patch" = "$1"; then
patch=0
fi
fi
echo $patch
}
# $1: version to check
# $2: minimum version
compare_to_minimum_version ()
{
MAJOR1=`get_major_version $1`
MAJOR2=`get_major_version $2`
if test $MAJOR1 -lt $MAJOR2; then
echo 0
return
else
if test $MAJOR1 -gt $MAJOR2; then
echo 1
return
fi
fi
MINOR1=`get_minor_version $1`
MINOR2=`get_minor_version $2`
if test $MINOR1 -lt $MINOR2; then
echo 0
return
else
if test $MINOR1 -gt $MINOR2; then
echo 1
return
fi
fi
PATCH1=`get_patch_version $1`
PATCH2=`get_patch_version $2`
if test $PATCH1 -lt $PATCH2; then
echo 0
else
echo 1
fi
}
# check the version of a given tool against a minimum version number
#
# $1: tool path
# $2: tool usual name (e.g. `aclocal')
# $3: tool variable (e.g. `ACLOCAL')
# $4: minimum version to check against
# $5: option field index used to extract the tool version from the
# output of --version
check_tool_version ()
{
field=$5
# assume the output of "[TOOL] --version" is "toolname (GNU toolname foo bar) version"
if test "$field"x = x; then
field=3 # default to 3 for all GNU autotools, after filtering enclosed string
fi
version=`$1 --version | head -1 | sed 's/([^)]*)/()/g' | cut -d ' ' -f $field`
version_check=`compare_to_minimum_version $version $4`
if test "$version_check"x = 0x; then
echo "ERROR: Your version of the \`$2' tool is too old."
echo " Minimum version $4 is required (yours is version $version)."
echo " Please upgrade or use the $3 variable to point to a more recent one."
echo ""
exit 1
fi
}
if test ! -f ./builds/unix/configure.raw; then
echo "You must be in the same directory as \`autogen.sh'."
echo "Bootstrapping doesn't work if srcdir != builddir."
exit 1
fi
# On MacOS X, the GNU libtool is named `glibtool'.
HOSTOS=`uname`
if test "$LIBTOOLIZE"x != x; then
:
elif test "$HOSTOS"x = Darwinx; then
LIBTOOLIZE=glibtoolize
else
LIBTOOLIZE=libtoolize
fi
if test "$ACLOCAL"x = x; then
ACLOCAL=aclocal
fi
if test "$AUTOCONF"x = x; then
AUTOCONF=autoconf
fi
check_tool_version $ACLOCAL aclocal ACLOCAL 1.10.1
check_tool_version $LIBTOOLIZE libtoolize LIBTOOLIZE 2.2.4
check_tool_version $AUTOCONF autoconf AUTOCONF 2.62
# This sets freetype_major, freetype_minor, and freetype_patch.
eval `sed -nf version.sed include/freetype.h`
# We set freetype-patch to an empty value if it is zero.
if test "$freetype_patch" = ".0"; then
freetype_patch=
fi
cd builds/unix
echo "generating \`configure.ac'"
sed -e "s;@VERSION@;$freetype_major$freetype_minor$freetype_patch;" \
< configure.raw > configure.ac
run aclocal -I . --force
run $LIBTOOLIZE --force --copy --install
run autoconf --force
chmod +x mkinstalldirs
chmod +x install-sh
cd ../..
chmod +x ./configure
# EOF
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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