Commit ad3bad45 authored by Sergey.Konovalov's avatar Sergey.Konovalov Committed by Alexander Trofimov

общий FontProcessor, CFontManager из DesktopEditor/font_engine

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@58487 954022d7-b5bf-4e40-9824-e11837661b57
parent dec019ac
...@@ -3,46 +3,112 @@ Microsoft Visual Studio Solution File, Format Version 9.00 ...@@ -3,46 +3,112 @@ Microsoft Visual Studio Solution File, Format Version 9.00
# Visual C++ Express 2005 # Visual C++ Express 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ASCOfficeDocxFile2", "ASCOfficeDocxFile2.vcproj", "{D02A88E6-5B2B-4A15-A4F6-C057F698FC53}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ASCOfficeDocxFile2", "ASCOfficeDocxFile2.vcproj", "{D02A88E6-5B2B-4A15-A4F6-C057F698FC53}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{A100103A-353E-45E8-A9B8-90B87CC5C0B0} = {A100103A-353E-45E8-A9B8-90B87CC5C0B0} {C739151F-5384-41DF-A1A6-F089E2C1AD56} = {C739151F-5384-41DF-A1A6-F089E2C1AD56}
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B} = {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}
{36636678-AE25-4BE6-9A34-2561D1BCF302} = {36636678-AE25-4BE6-9A34-2561D1BCF302} {36636678-AE25-4BE6-9A34-2561D1BCF302} = {36636678-AE25-4BE6-9A34-2561D1BCF302}
{A100103A-353E-45E8-A9B8-90B87CC5C0B0} = {A100103A-353E-45E8-A9B8-90B87CC5C0B0}
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DocxFormat", "..\Common\DocxFormat\Projects\DocxFormat2005.vcproj", "{A100103A-353E-45E8-A9B8-90B87CC5C0B0}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DocxFormat", "..\Common\DocxFormat\Projects\DocxFormat2005.vcproj", "{A100103A-353E-45E8-A9B8-90B87CC5C0B0}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PPTXFormat", "..\ASCOfficePPTXFile\PPTXLib\PPTXFormat.vcproj", "{36636678-AE25-4BE6-9A34-2561D1BCF302}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PPTXFormat", "..\ASCOfficePPTXFile\PPTXLib\PPTXFormat.vcproj", "{36636678-AE25-4BE6-9A34-2561D1BCF302}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "freetype", "..\DesktopEditor\freetype-2.5.2\builds\windows\vc2005\freetype.vcproj", "{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "font_engine", "..\DesktopEditor\fontengine\font_engine_vs2005.vcproj", "{C739151F-5384-41DF-A1A6-F089E2C1AD56}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug Multithreaded|Win32 = Debug Multithreaded|Win32
Debug Singlethreaded|Win32 = Debug Singlethreaded|Win32
Debug|Win32 = Debug|Win32 Debug|Win32 = Debug|Win32
Release Multithreaded|Win32 = Release Multithreaded|Win32
Release Singlethreaded|Win32 = Release Singlethreaded|Win32
Release|Win32 = Release|Win32 Release|Win32 = Release|Win32
ReleaseASC|Win32 = ReleaseASC|Win32 ReleaseASC|Win32 = ReleaseASC|Win32
ReleaseOpenSource|Win32 = ReleaseOpenSource|Win32 ReleaseOpenSource|Win32 = ReleaseOpenSource|Win32
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D02A88E6-5B2B-4A15-A4F6-C057F698FC53}.Debug Multithreaded|Win32.ActiveCfg = Debug|Win32
{D02A88E6-5B2B-4A15-A4F6-C057F698FC53}.Debug Multithreaded|Win32.Build.0 = Debug|Win32
{D02A88E6-5B2B-4A15-A4F6-C057F698FC53}.Debug Singlethreaded|Win32.ActiveCfg = Debug|Win32
{D02A88E6-5B2B-4A15-A4F6-C057F698FC53}.Debug Singlethreaded|Win32.Build.0 = Debug|Win32
{D02A88E6-5B2B-4A15-A4F6-C057F698FC53}.Debug|Win32.ActiveCfg = Debug|Win32 {D02A88E6-5B2B-4A15-A4F6-C057F698FC53}.Debug|Win32.ActiveCfg = Debug|Win32
{D02A88E6-5B2B-4A15-A4F6-C057F698FC53}.Debug|Win32.Build.0 = Debug|Win32 {D02A88E6-5B2B-4A15-A4F6-C057F698FC53}.Debug|Win32.Build.0 = Debug|Win32
{D02A88E6-5B2B-4A15-A4F6-C057F698FC53}.Release Multithreaded|Win32.ActiveCfg = ReleaseOpenSource|Win32
{D02A88E6-5B2B-4A15-A4F6-C057F698FC53}.Release Multithreaded|Win32.Build.0 = ReleaseOpenSource|Win32
{D02A88E6-5B2B-4A15-A4F6-C057F698FC53}.Release Singlethreaded|Win32.ActiveCfg = ReleaseOpenSource|Win32
{D02A88E6-5B2B-4A15-A4F6-C057F698FC53}.Release Singlethreaded|Win32.Build.0 = ReleaseOpenSource|Win32
{D02A88E6-5B2B-4A15-A4F6-C057F698FC53}.Release|Win32.ActiveCfg = Release|Win32 {D02A88E6-5B2B-4A15-A4F6-C057F698FC53}.Release|Win32.ActiveCfg = Release|Win32
{D02A88E6-5B2B-4A15-A4F6-C057F698FC53}.Release|Win32.Build.0 = Release|Win32 {D02A88E6-5B2B-4A15-A4F6-C057F698FC53}.Release|Win32.Build.0 = Release|Win32
{D02A88E6-5B2B-4A15-A4F6-C057F698FC53}.ReleaseASC|Win32.ActiveCfg = ReleaseASC|Win32 {D02A88E6-5B2B-4A15-A4F6-C057F698FC53}.ReleaseASC|Win32.ActiveCfg = ReleaseASC|Win32
{D02A88E6-5B2B-4A15-A4F6-C057F698FC53}.ReleaseASC|Win32.Build.0 = ReleaseASC|Win32 {D02A88E6-5B2B-4A15-A4F6-C057F698FC53}.ReleaseASC|Win32.Build.0 = ReleaseASC|Win32
{D02A88E6-5B2B-4A15-A4F6-C057F698FC53}.ReleaseOpenSource|Win32.ActiveCfg = ReleaseOpenSource|Win32 {D02A88E6-5B2B-4A15-A4F6-C057F698FC53}.ReleaseOpenSource|Win32.ActiveCfg = ReleaseOpenSource|Win32
{D02A88E6-5B2B-4A15-A4F6-C057F698FC53}.ReleaseOpenSource|Win32.Build.0 = ReleaseOpenSource|Win32 {D02A88E6-5B2B-4A15-A4F6-C057F698FC53}.ReleaseOpenSource|Win32.Build.0 = ReleaseOpenSource|Win32
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.Debug Multithreaded|Win32.ActiveCfg = Debug|Win32
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.Debug Multithreaded|Win32.Build.0 = Debug|Win32
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.Debug Singlethreaded|Win32.ActiveCfg = Debug|Win32
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.Debug Singlethreaded|Win32.Build.0 = Debug|Win32
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.Debug|Win32.ActiveCfg = Debug|Win32 {A100103A-353E-45E8-A9B8-90B87CC5C0B0}.Debug|Win32.ActiveCfg = Debug|Win32
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.Debug|Win32.Build.0 = Debug|Win32 {A100103A-353E-45E8-A9B8-90B87CC5C0B0}.Debug|Win32.Build.0 = Debug|Win32
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.Release Multithreaded|Win32.ActiveCfg = ReleaseOpenSource|Win32
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.Release Multithreaded|Win32.Build.0 = ReleaseOpenSource|Win32
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.Release Singlethreaded|Win32.ActiveCfg = ReleaseOpenSource|Win32
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.Release Singlethreaded|Win32.Build.0 = ReleaseOpenSource|Win32
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.Release|Win32.ActiveCfg = Release|Win32 {A100103A-353E-45E8-A9B8-90B87CC5C0B0}.Release|Win32.ActiveCfg = Release|Win32
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.Release|Win32.Build.0 = Release|Win32 {A100103A-353E-45E8-A9B8-90B87CC5C0B0}.Release|Win32.Build.0 = Release|Win32
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.ReleaseASC|Win32.ActiveCfg = Release|Win32 {A100103A-353E-45E8-A9B8-90B87CC5C0B0}.ReleaseASC|Win32.ActiveCfg = Release|Win32
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.ReleaseASC|Win32.Build.0 = Release|Win32 {A100103A-353E-45E8-A9B8-90B87CC5C0B0}.ReleaseASC|Win32.Build.0 = Release|Win32
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.ReleaseOpenSource|Win32.ActiveCfg = ReleaseOpenSource|Win32 {A100103A-353E-45E8-A9B8-90B87CC5C0B0}.ReleaseOpenSource|Win32.ActiveCfg = ReleaseOpenSource|Win32
{A100103A-353E-45E8-A9B8-90B87CC5C0B0}.ReleaseOpenSource|Win32.Build.0 = ReleaseOpenSource|Win32 {A100103A-353E-45E8-A9B8-90B87CC5C0B0}.ReleaseOpenSource|Win32.Build.0 = ReleaseOpenSource|Win32
{36636678-AE25-4BE6-9A34-2561D1BCF302}.Debug Multithreaded|Win32.ActiveCfg = Debug|Win32
{36636678-AE25-4BE6-9A34-2561D1BCF302}.Debug Multithreaded|Win32.Build.0 = Debug|Win32
{36636678-AE25-4BE6-9A34-2561D1BCF302}.Debug Singlethreaded|Win32.ActiveCfg = Debug|Win32
{36636678-AE25-4BE6-9A34-2561D1BCF302}.Debug Singlethreaded|Win32.Build.0 = Debug|Win32
{36636678-AE25-4BE6-9A34-2561D1BCF302}.Debug|Win32.ActiveCfg = Debug|Win32 {36636678-AE25-4BE6-9A34-2561D1BCF302}.Debug|Win32.ActiveCfg = Debug|Win32
{36636678-AE25-4BE6-9A34-2561D1BCF302}.Debug|Win32.Build.0 = Debug|Win32 {36636678-AE25-4BE6-9A34-2561D1BCF302}.Debug|Win32.Build.0 = Debug|Win32
{36636678-AE25-4BE6-9A34-2561D1BCF302}.Release Multithreaded|Win32.ActiveCfg = Release|Win32
{36636678-AE25-4BE6-9A34-2561D1BCF302}.Release Multithreaded|Win32.Build.0 = Release|Win32
{36636678-AE25-4BE6-9A34-2561D1BCF302}.Release Singlethreaded|Win32.ActiveCfg = Release|Win32
{36636678-AE25-4BE6-9A34-2561D1BCF302}.Release Singlethreaded|Win32.Build.0 = Release|Win32
{36636678-AE25-4BE6-9A34-2561D1BCF302}.Release|Win32.ActiveCfg = Release|Win32 {36636678-AE25-4BE6-9A34-2561D1BCF302}.Release|Win32.ActiveCfg = Release|Win32
{36636678-AE25-4BE6-9A34-2561D1BCF302}.Release|Win32.Build.0 = Release|Win32 {36636678-AE25-4BE6-9A34-2561D1BCF302}.Release|Win32.Build.0 = Release|Win32
{36636678-AE25-4BE6-9A34-2561D1BCF302}.ReleaseASC|Win32.ActiveCfg = Release|Win32 {36636678-AE25-4BE6-9A34-2561D1BCF302}.ReleaseASC|Win32.ActiveCfg = Release|Win32
{36636678-AE25-4BE6-9A34-2561D1BCF302}.ReleaseASC|Win32.Build.0 = Release|Win32 {36636678-AE25-4BE6-9A34-2561D1BCF302}.ReleaseASC|Win32.Build.0 = Release|Win32
{36636678-AE25-4BE6-9A34-2561D1BCF302}.ReleaseOpenSource|Win32.ActiveCfg = Release|Win32 {36636678-AE25-4BE6-9A34-2561D1BCF302}.ReleaseOpenSource|Win32.ActiveCfg = Release|Win32
{36636678-AE25-4BE6-9A34-2561D1BCF302}.ReleaseOpenSource|Win32.Build.0 = Release|Win32 {36636678-AE25-4BE6-9A34-2561D1BCF302}.ReleaseOpenSource|Win32.Build.0 = Release|Win32
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Multithreaded|Win32.ActiveCfg = Debug Multithreaded|Win32
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Multithreaded|Win32.Build.0 = Debug Multithreaded|Win32
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Singlethreaded|Win32.ActiveCfg = Debug Singlethreaded|Win32
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Singlethreaded|Win32.Build.0 = Debug Singlethreaded|Win32
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug|Win32.ActiveCfg = Debug|Win32
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug|Win32.Build.0 = Debug|Win32
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Multithreaded|Win32.ActiveCfg = Release Multithreaded|Win32
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Multithreaded|Win32.Build.0 = Release Multithreaded|Win32
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Singlethreaded|Win32.ActiveCfg = Release Singlethreaded|Win32
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Singlethreaded|Win32.Build.0 = Release Singlethreaded|Win32
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release|Win32.ActiveCfg = Release|Win32
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release|Win32.Build.0 = Release|Win32
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.ReleaseASC|Win32.ActiveCfg = Release Singlethreaded|Win32
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.ReleaseASC|Win32.Build.0 = Release Singlethreaded|Win32
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.ReleaseOpenSource|Win32.ActiveCfg = Release Singlethreaded|Win32
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.ReleaseOpenSource|Win32.Build.0 = Release Singlethreaded|Win32
{C739151F-5384-41DF-A1A6-F089E2C1AD56}.Debug Multithreaded|Win32.ActiveCfg = Debug|Win32
{C739151F-5384-41DF-A1A6-F089E2C1AD56}.Debug Multithreaded|Win32.Build.0 = Debug|Win32
{C739151F-5384-41DF-A1A6-F089E2C1AD56}.Debug Singlethreaded|Win32.ActiveCfg = Debug|Win32
{C739151F-5384-41DF-A1A6-F089E2C1AD56}.Debug Singlethreaded|Win32.Build.0 = Debug|Win32
{C739151F-5384-41DF-A1A6-F089E2C1AD56}.Debug|Win32.ActiveCfg = Debug|Win32
{C739151F-5384-41DF-A1A6-F089E2C1AD56}.Debug|Win32.Build.0 = Debug|Win32
{C739151F-5384-41DF-A1A6-F089E2C1AD56}.Release Multithreaded|Win32.ActiveCfg = Release|Win32
{C739151F-5384-41DF-A1A6-F089E2C1AD56}.Release Multithreaded|Win32.Build.0 = Release|Win32
{C739151F-5384-41DF-A1A6-F089E2C1AD56}.Release Singlethreaded|Win32.ActiveCfg = Release|Win32
{C739151F-5384-41DF-A1A6-F089E2C1AD56}.Release Singlethreaded|Win32.Build.0 = Release|Win32
{C739151F-5384-41DF-A1A6-F089E2C1AD56}.Release|Win32.ActiveCfg = Release|Win32
{C739151F-5384-41DF-A1A6-F089E2C1AD56}.Release|Win32.Build.0 = Release|Win32
{C739151F-5384-41DF-A1A6-F089E2C1AD56}.ReleaseASC|Win32.ActiveCfg = Release|Win32
{C739151F-5384-41DF-A1A6-F089E2C1AD56}.ReleaseASC|Win32.Build.0 = Release|Win32
{C739151F-5384-41DF-A1A6-F089E2C1AD56}.ReleaseOpenSource|Win32.ActiveCfg = Release|Win32
{C739151F-5384-41DF-A1A6-F089E2C1AD56}.ReleaseOpenSource|Win32.Build.0 = Release|Win32
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/Zm1000" AdditionalOptions="/Zm1000"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories=""$(SolutionDir)/../Common/DocxFormat/Source/XML/libxml2/XML/include";"$(SolutionDir)";"$(SolutionDir)/../../AVSImageStudio3/AVSGraphics/Objects";"$(SolutionDir)/../../AVSImageStudio3/AVSGraphics/Objects/Font/FreeType";"$(SolutionDir)/../Common/DocxFormat/Source/DocxFormat"" AdditionalIncludeDirectories=""$(SolutionDir)/../Common/DocxFormat/Source/XML/libxml2/XML/include";"$(SolutionDir)";"$(SolutionDir)/../../AVSImageStudio3/AVSGraphics/Objects";"$(SolutionDir)/../../AVSImageStudio3/AVSGraphics/Objects/Font/FreeType";"$(SolutionDir)/../Common/DocxFormat/Source/DocxFormat";"../DesktopEditor/freetype-2.5.2/include""
PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;_USRDLL;_ATL_ATTRIBUTES;_USE_XMLLITE_READER_;USE_LITE_READER;USE_ATL_CSTRING;USE_AVSOFFICESTUDIO_XMLUTILS;SOLUTION_ASCOFFICEDOCXFILE2;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED" PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;_USRDLL;_ATL_ATTRIBUTES;_USE_XMLLITE_READER_;USE_LITE_READER;USE_ATL_CSTRING;USE_AVSOFFICESTUDIO_XMLUTILS;SOLUTION_ASCOFFICEDOCXFILE2;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED"
MinimalRebuild="true" MinimalRebuild="true"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
...@@ -153,7 +153,7 @@ ...@@ -153,7 +153,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/Zm1000" AdditionalOptions="/Zm1000"
AdditionalIncludeDirectories="&quot;$(SolutionDir)/../Common/DocxFormat/Source/XML/libxml2/XML/include&quot;;&quot;$(SolutionDir)&quot;;&quot;$(SolutionDir)/../../AVSImageStudio3/AVSGraphics/Objects&quot;;&quot;$(SolutionDir)/../../AVSImageStudio3/AVSGraphics/Objects/Font/FreeType&quot;;&quot;$(SolutionDir)/../Common/DocxFormat/Source/DocxFormat&quot;" AdditionalIncludeDirectories="&quot;$(SolutionDir)/../Common/DocxFormat/Source/XML/libxml2/XML/include&quot;;&quot;$(SolutionDir)&quot;;&quot;$(SolutionDir)/../../AVSImageStudio3/AVSGraphics/Objects&quot;;&quot;$(SolutionDir)/../../AVSImageStudio3/AVSGraphics/Objects/Font/FreeType&quot;;&quot;$(SolutionDir)/../Common/DocxFormat/Source/DocxFormat&quot;;&quot;../DesktopEditor/freetype-2.5.2/include&quot;"
PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;_USRDLL;_ATL_ATTRIBUTES;_USE_XMLLITE_READER_;USE_LITE_READER;USE_ATL_CSTRING;USE_AVSOFFICESTUDIO_XMLUTILS;SOLUTION_ASCOFFICEDOCXFILE2;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED" PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;_USRDLL;_ATL_ATTRIBUTES;_USE_XMLLITE_READER_;USE_LITE_READER;USE_ATL_CSTRING;USE_AVSOFFICESTUDIO_XMLUTILS;SOLUTION_ASCOFFICEDOCXFILE2;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED"
RuntimeLibrary="2" RuntimeLibrary="2"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
...@@ -584,10 +584,6 @@ ...@@ -584,10 +584,6 @@
RelativePath="..\XlsxSerializerCom\Reader\CSVReader.h" RelativePath="..\XlsxSerializerCom\Reader\CSVReader.h"
> >
</File> </File>
<File
RelativePath="..\XlsxSerializerCom\Reader\FontProcessor.h"
>
</File>
</Filter> </Filter>
<Filter <Filter
Name="Writer" Name="Writer"
......
#include "stdafx.h" #include "stdafx.h"
#include "FontProcessor.h" #include "FontProcessor.h"
#include "../../Common/DocxFormat/Source/XlsxFormat/Styles/Fonts.h"
#include "../../Common/ASCUtils.h" #include "../../Common/ASCUtils.h"
using SimpleTypes::EPitch;
namespace DocWrapper { namespace DocWrapper {
TCHAR* gc_sNoNameFont = _T("NoNameFont");
bool FontProcessor::useSystemFonts = false; TCHAR* gc_sDefaultFontName = _T("Arial");
FontProcessor::FontProcessor() FontProcessor::FontProcessor() : fontManager(NULL), m_pFontManager(NULL)
: fontManager(NULL) {} {
FontProcessor::~FontProcessor() { }
FontProcessor::~FontProcessor()
{
RELEASEINTERFACE(fontManager); RELEASEINTERFACE(fontManager);
RELEASEOBJECT(m_pFontManager);
} }
void FontProcessor::setFontDir(const CString& fontDir) { void FontProcessor::setFontDir(const CString& fontDir)
{
this->fontDir = fontDir; this->fontDir = fontDir;
initFontManager(); initFontManager();
} }
void FontProcessor::setFontTable(OOX::CFontTable* fontTable) { void FontProcessor::setFontTable(OOX::CFontTable* fontTable)
{
for (int i = 0; i < fontTable->m_arrFonts.size(); ++i) for (int i = 0; i < fontTable->m_arrFonts.size(); ++i)
addToFontMap(*fontTable->m_arrFonts[i]); addToFontMap(*fontTable->m_arrFonts[i]);
} }
CString FontProcessor::getFont(const CString& name) { CString FontProcessor::getFont(const CString& name)
CString fontName = _T("Arial"); {
CString fontName = gc_sDefaultFontName;
if (fontMap.find(name) != fontMap.end()) if (fontMap.find(name) != fontMap.end())
fontName = fontMap[name]; fontName = fontMap[name];
else else
...@@ -38,22 +43,53 @@ namespace DocWrapper { ...@@ -38,22 +43,53 @@ namespace DocWrapper {
} }
return fontName; return fontName;
} }
void FontProcessor::getFonts(CAtlArray<CString>& fonts) {
fonts.RemoveAll(); CString FontProcessor::getFont(const NSCommon::nullable<OOX::Spreadsheet::CFontScheme>& oScheme, const NSCommon::nullable<ComplexTypes::Spreadsheet::CString_>& oRFont, const NSCommon::nullable<OOX::Spreadsheet::CCharset>& oCharset, const NSCommon::nullable<OOX::Spreadsheet::CFontFamily >& oFamily, OOX::CTheme* pTheme)
std::map<CString, CString>::iterator it = fontMap.begin(); {
for (; it != fontMap.end(); ++it) { CFontSelectFormat oFontSelectFormat;
bool contains = false; CString sFontName;
for (int i = 0; i < (int) fonts.GetCount(); ++i) if(oScheme.IsInit() && oScheme->m_oFontScheme.IsInit())
if (fonts[i] == it->second) { {
contains = true; //
break; const SimpleTypes::Spreadsheet::EFontScheme eFontScheme = oScheme->m_oFontScheme->GetValue();
} if(SimpleTypes::Spreadsheet::fontschemeMajor == eFontScheme)
if (!contains) sFontName = pTheme->GetMajorFont();
fonts.Add(it->second); else if(SimpleTypes::Spreadsheet::fontschemeMinor == eFontScheme)
sFontName = pTheme->GetMinorFont();
}
if(sFontName.IsEmpty() && oRFont.IsInit() && oRFont->m_sVal.IsInit())
sFontName = oRFont->ToString2();
if(sFontName.IsEmpty())
sFontName = CString(gc_sNoNameFont);
oFontSelectFormat.wsName = new std::wstring;
*oFontSelectFormat.wsName = string2std_string(sFontName);
if(oCharset.IsInit() && oCharset->m_oCharset.IsInit())
{
SimpleTypes::Spreadsheet::EFontCharset eCharset = oCharset->m_oCharset->GetValue();
// fontcharsetANSI fontcharsetDefault, , dll
if(SimpleTypes::fontcharsetANSI != eCharset && SimpleTypes::fontcharsetDefault != eCharset)
{
oFontSelectFormat.unCharset = new BYTE;
*oFontSelectFormat.unCharset = (BYTE)eCharset;
}
}
if(oFamily.IsInit() && oFamily->m_oFontFamily.IsInit())
{
oFontSelectFormat.wsFamilyClass = new std::wstring;
*oFontSelectFormat.wsFamilyClass = oFamily->m_oFontFamily->ToStringWord();
} }
CString sRes;
CFontInfo* pFontInfo = m_pFontManager->GetFontInfoByParams(oFontSelectFormat);
if(NULL != pFontInfo)
sRes = std_string2string(pFontInfo->m_wsFontName);
else
sRes = gc_sDefaultFontName;
fontMap[sFontName] = sRes;
return sRes;
} }
void FontProcessor::initFontManager()
void FontProcessor::initFontManager() { {
RELEASEINTERFACE(fontManager); RELEASEINTERFACE(fontManager);
fontManager = NULL; fontManager = NULL;
...@@ -66,132 +102,107 @@ namespace DocWrapper { ...@@ -66,132 +102,107 @@ namespace DocWrapper {
fontManager->SetAdditionalParam(L"InitializeFromFolder", var); fontManager->SetAdditionalParam(L"InitializeFromFolder", var);
RELEASESYSSTRING(var.bstrVal); RELEASESYSSTRING(var.bstrVal);
if (useSystemFonts) {
CString options = _T("<FontManagerOptions><FontDir path='") + fontDir + _T("' /></FontManagerOptions>");
BSTR bsOptions = options.AllocSysString();
#ifdef BUILD_CONFIG_OPENSOURCE_VERSION
fontManager->Init(bsOptions, VARIANT_TRUE, VARIANT_FALSE);
#else
fontManager->Initialize(bsOptions);
#endif
SysFreeString(bsOptions);
}
#ifdef BUILD_CONFIG_FULL_VERSION #ifdef BUILD_CONFIG_FULL_VERSION
CString defaultFontName = _T("Arial"); fontManager->SetDefaultFont(gc_sDefaultFontName);
BSTR defFontName = defaultFontName.AllocSysString();
fontManager->SetDefaultFont(defFontName);
SysFreeString(defFontName);
#endif #endif
if(fontDir.IsEmpty())
m_oApplicationFonts.Initialize();
else
m_oApplicationFonts.InitializeFromFolder(string2std_string(fontDir));
m_pFontManager = m_oApplicationFonts.GenerateFontManager();
} }
void FontProcessor::addToFontMap(OOX::CFont& font) { void FontProcessor::addToFontMap(OOX::CFont& font)
XmlUtils::CStringWriter parw; {
parw.WriteString(CString(_T("<FontProperties>"))); CFontSelectFormat oFontSelectFormat;
CString sFontName;
if(font.m_sName.IsEmpty())
sFontName = CString(gc_sNoNameFont);
else
sFontName = font.m_sName;
oFontSelectFormat.wsName = new std::wstring;
*oFontSelectFormat.wsName = string2std_string(sFontName);
if (font.m_oAltName.IsInit() && font.m_oAltName->GetLength() > 0)
{
oFontSelectFormat.wsAltName = new std::wstring;
*oFontSelectFormat.wsAltName = string2std_string(*font.m_oAltName);
}
if(font.m_oCharset.IsInit()) if(font.m_oCharset.IsInit())
{ {
SimpleTypes::EFontCharset eCharset = font.m_oCharset->GetValue(); SimpleTypes::EFontCharset eCharset = font.m_oCharset->GetValue();
// fontcharsetANSI fontcharsetDefault, , dll // fontcharsetANSI fontcharsetDefault, , dll
if(SimpleTypes::fontcharsetANSI != eCharset && SimpleTypes::fontcharsetDefault != eCharset) if(SimpleTypes::fontcharsetANSI != eCharset && SimpleTypes::fontcharsetDefault != eCharset)
parw.WriteString(_T("<Charset value='") + font.m_oCharset->ToString() + _T("'/>")); {
oFontSelectFormat.unCharset = new BYTE;
*oFontSelectFormat.unCharset = (BYTE)eCharset;
}
} }
if(font.m_sName.IsEmpty()) if(font.m_oFamily.IsInit())
parw.WriteString(CString(_T("<Name value='Arial'/>")));
else
{ {
CString sName = font.m_sName; oFontSelectFormat.wsFamilyClass = new std::wstring;
ToXmlString(sName); *oFontSelectFormat.wsFamilyClass = font.m_oFamily->ToString();
parw.WriteString(_T("<Name value='")+ sName + _T("'/>"));
} }
if (font.m_oAltName.IsInit()) if(font.m_oPanose.IsInit())
{ {
CString sAltName = *font.m_oAltName; bool bIsPanose = false;
ToXmlString(sAltName); oFontSelectFormat.pPanose = new BYTE[10];
parw.WriteString(_T("<AltName value='") + sAltName + _T("'/>")); for(int i = 0; i < 10; ++i)
{
unsigned char cCurVal = font.m_oPanose->Get_Number(i);
oFontSelectFormat.pPanose[i] = cCurVal;
// 0, Panose
if ( 0 != cCurVal )
bIsPanose = true;
}
if(!bIsPanose)
RELEASEARRAYOBJECTS(oFontSelectFormat.pPanose);
} }
parw.WriteString(_T("<FamilyClass name='") + font.m_oFamily.ToString() + _T("'/>")); if(font.m_oPitch.IsInit())
if(font.m_oPanose.IsInit()) {
parw.WriteString(_T("<Panose value='") + font.m_oPanose->ToString() + _T("'/>")); oFontSelectFormat.bFixedWidth = new INT;
if (font.m_oPitch.GetValue() == SimpleTypes::pitchFixed) if (font.m_oPitch->GetValue() == SimpleTypes::pitchFixed)
parw.WriteString(CString(_T("<FixedWidth value='1'/>"))); *oFontSelectFormat.bFixedWidth = 1;
else else
parw.WriteString(CString(_T("<FixedWidth value='0'/>"))); *oFontSelectFormat.bFixedWidth = 0;
parw.WriteString(CString(_T("<UnicodeRange "))); }
ULONG ulRange1 = 0;
ULONG ulRange2 = 0;
ULONG ulRange3 = 0;
ULONG ulRange4 = 0;
ULONG ulCodeRange1 = 0;
ULONG ulCodeRange2 = 0;
if (font.m_oUsb0.IsInit()) if (font.m_oUsb0.IsInit())
parw.WriteString(_T("range1='") + font.m_oUsb0->ToString() + _T("' ")); ulRange1 = font.m_oUsb0->GetValue();
if (font.m_oUsb1.IsInit()) if (font.m_oUsb1.IsInit())
parw.WriteString(_T("range2='") + font.m_oUsb1->ToString() + _T("' ")); ulRange2 = font.m_oUsb1->GetValue();
if (font.m_oUsb2.IsInit()) if (font.m_oUsb2.IsInit())
parw.WriteString(_T("range3='") + font.m_oUsb2->ToString() + _T("' ")); ulRange3 = font.m_oUsb2->GetValue();
if (font.m_oUsb3.IsInit()) if (font.m_oUsb3.IsInit())
parw.WriteString(_T("range4='") + font.m_oUsb3->ToString() + _T("' ")); ulRange4 = font.m_oUsb3->GetValue();
if (font.m_oCsb0.IsInit()) if (font.m_oCsb0.IsInit())
parw.WriteString(_T("coderange1='") + font.m_oCsb0->ToString() + _T("' ")); ulCodeRange1 = font.m_oCsb0->GetValue();
if (font.m_oCsb1.IsInit()) if (font.m_oCsb1.IsInit())
parw.WriteString(_T("coderange2='") + font.m_oCsb1->ToString() + _T("' ")); ulCodeRange2 = font.m_oCsb1->GetValue();
parw.WriteString(CString(_T("/>"))); if ( !(0 == ulRange1 && 0 == ulRange2 && 0 == ulRange3 && 0 == ulRange4 && 0 == ulCodeRange1 && 0 == ulCodeRange2) )
parw.WriteString(CString(_T("</FontProperties>")));
CString params = parw.GetData();
BSTR fontPath = NULL;
BSTR familyName = NULL;
long index = 0;
BSTR bstrParams = params.AllocSysString();
#ifdef BUILD_CONFIG_OPENSOURCE_VERSION
fontManager->GetWinFontByParams(bstrParams, &familyName, &fontPath, NULL, &index);
#else
fontManager->GetWinFontByParams(bstrParams, &fontPath, &index);
int status = fontManager->LoadFontFromFile(fontPath, 12, 72, 72, index);
/*if (!CheckRange(fontManager))
{ {
params = _T("<FontProperties>"); oFontSelectFormat.ulRange1 = new ULONG;
CString charset; *oFontSelectFormat.ulRange1 = ulRange1;
charset.Format(_T("%x"), m_Charset); oFontSelectFormat.ulRange2 = new ULONG;
params += _T("<Charset value='") + charset + _T("'/>"); *oFontSelectFormat.ulRange2 = ulRange2;
params += _T("<Name value='") + m_Name + _T("'/>"); oFontSelectFormat.ulRange3 = new ULONG;
params += _T("<AltName value='") + m_AltName + _T("'/>"); *oFontSelectFormat.ulRange3 = ulRange3;
params += _T("</FontProperties>"); oFontSelectFormat.ulRange4 = new ULONG;
*oFontSelectFormat.ulRange4 = ulRange4;
index = 0; oFontSelectFormat.ulCodeRange1 = new ULONG;
bstrParams = params.AllocSysString(); *oFontSelectFormat.ulCodeRange1 = ulCodeRange1;
fontManager->GetWinFontByParams(bstrParams, &bstrFontPath, &index); oFontSelectFormat.ulCodeRange2 = new ULONG;
SysFreeString(bstrParams); *oFontSelectFormat.ulCodeRange2 = ulCodeRange2;
status = fontManager->LoadFontFromFile(bstrFontPath, 12, 72, 72, index); }
SysFreeString(bstrFontPath);
}*/
fontManager->GetFamilyName(&familyName);
#endif
CString resFontName = familyName;
SysFreeString(bstrParams);
SysFreeString(fontPath);
SysFreeString(familyName);
fontMap[font.m_sName] = resFontName; CFontInfo* pFontInfo = m_pFontManager->GetFontInfoByParams(oFontSelectFormat);
} if(NULL != pFontInfo)
fontMap[sFontName] = std_string2string(pFontInfo->m_wsFontName);
bool FontProcessor::checkRange(OOX::CFont& font) { else
return true; fontMap[sFontName] = gc_sDefaultFontName;
/*unsigned char charset = (unsigned char) m_Charset;
unsigned long bit;
unsigned int index;
GetCodePageByCharset(charset, &bit, &index);
VARIANT_BOOL rangeSuits = VARIANT_FALSE;
fontManager->IsUnicodeRangeAvailable(bit, index, &rangeSuits);
return rangeSuits == VARIANT_TRUE;*/
}
void FontProcessor::ToXmlString(CString& strVal)
{
strVal.Replace(L"&", L"&amp;");
strVal.Replace(L"'", L"&apos;");
strVal.Replace(L"<", L"&lt;");
strVal.Replace(L">", L"&gt;");
strVal.Replace(L"\"", L"&quot;");
} }
} }
\ No newline at end of file
...@@ -2,19 +2,38 @@ ...@@ -2,19 +2,38 @@
#include "../stdafx.h" #include "../stdafx.h"
#include <map> #include <map>
#include "../../DesktopEditor/fontengine/ApplicationFonts.h"
//#include "DocWrapper/Base.h" //#include "DocWrapper/Base.h"
namespace NSCommon{
template<class Type> class nullable;
}
namespace OOX
{
class CFont;
class CFontTable;
class CTheme;
namespace Spreadsheet
{
class CFont;
class CFontTable;
class CFontScheme;
class CString_;
class CCharset;
class CFontFamily;
}
}
namespace DocWrapper { namespace DocWrapper {
class FontProcessor { class FontProcessor {
CApplicationFonts m_oApplicationFonts;
CFontManager* m_pFontManager;
ASCGraphics::IASCFontManager* fontManager; ASCGraphics::IASCFontManager* fontManager;
std::map<CString, CString> fontMap; std::map<CString, CString> fontMap;
CString fontDir; CString fontDir;
public:
static bool useSystemFonts;
public: public:
FontProcessor(); FontProcessor();
~FontProcessor(); ~FontProcessor();
...@@ -23,7 +42,7 @@ namespace DocWrapper { ...@@ -23,7 +42,7 @@ namespace DocWrapper {
void setFontTable(OOX::CFontTable* fontTable); void setFontTable(OOX::CFontTable* fontTable);
CString getFont(const CString& name); CString getFont(const CString& name);
void getFonts(CAtlArray<CString>& fonts); CString getFont(const NSCommon::nullable<OOX::Spreadsheet::CFontScheme>& oScheme, const NSCommon::nullable<ComplexTypes::Spreadsheet::CString_>& oRFont, const NSCommon::nullable<OOX::Spreadsheet::CCharset>& oCharset, const NSCommon::nullable<OOX::Spreadsheet::CFontFamily >& oFamily, OOX::CTheme* pTheme);
ASCGraphics::IASCFontManager* getFontManager() { ASCGraphics::IASCFontManager* getFontManager() {
return fontManager; return fontManager;
...@@ -33,9 +52,6 @@ namespace DocWrapper { ...@@ -33,9 +52,6 @@ namespace DocWrapper {
void initFontManager(); void initFontManager();
void addToFontMap(OOX::CFont& font); void addToFontMap(OOX::CFont& font);
bool checkRange(OOX::CFont& font);
void ToXmlString(CString& strVal);
}; };
} }
\ No newline at end of file
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
#include "../../DesktopEditor/common/Directory.h" #include "../../DesktopEditor/common/Directory.h"
#include "../../DesktopEditor/common/File.h" #include "../../DesktopEditor/common/File.h"
#include "../XlsxSerializerCom/Reader/BinaryWriter.h" #include "../XlsxSerializerCom/Reader/BinaryWriter.h"
#include "../XlsxSerializerCom/Reader/FontProcessor.h"
#include "../XlsxSerializerCom/Writer/BinaryReader.h" #include "../XlsxSerializerCom/Writer/BinaryReader.h"
namespace BinXlsxRW{ namespace BinXlsxRW{
...@@ -41,7 +40,7 @@ namespace BinXlsxRW{ ...@@ -41,7 +40,7 @@ namespace BinXlsxRW{
} }
bool CXlsxSerializer::saveToFile(CString& sDstFileName, CString& sSrcPath, CString& sXMLOptions) bool CXlsxSerializer::saveToFile(CString& sDstFileName, CString& sSrcPath, CString& sXMLOptions)
{ {
BinXlsxRW::FontProcessor fp; DocWrapper::FontProcessor fp;
fp.setFontDir(m_sFontDir); fp.setFontDir(m_sFontDir);
PPTXFile::IOfficeFontPicker* pFontPicker = NULL; PPTXFile::IOfficeFontPicker* pFontPicker = NULL;
CoCreateInstance(__uuidof(PPTXFile::COfficeFontPicker), NULL, CLSCTX_ALL, __uuidof(PPTXFile::IOfficeFontPicker), (void**)(&pFontPicker)); CoCreateInstance(__uuidof(PPTXFile::COfficeFontPicker), NULL, CLSCTX_ALL, __uuidof(PPTXFile::IOfficeFontPicker), (void**)(&pFontPicker));
......
...@@ -80,10 +80,12 @@ namespace OOX ...@@ -80,10 +80,12 @@ namespace OOX
sResult += m_oCharset->ToString(); sResult += m_oCharset->ToString();
sResult += _T("\"/>"); sResult += _T("\"/>");
} }
if(m_oFamily.IsInit())
sResult += _T("<w:family w:val=\""); {
sResult += m_oFamily.ToString(); sResult += _T("<w:family w:val=\"");
sResult += _T("\"/>"); sResult += m_oFamily->ToString();
sResult += _T("\"/>");
}
if ( m_oNotTrueType.IsInit() ) if ( m_oNotTrueType.IsInit() )
...@@ -99,10 +101,12 @@ namespace OOX ...@@ -99,10 +101,12 @@ namespace OOX
sResult += m_oPanose->ToString(); sResult += m_oPanose->ToString();
sResult += _T("\"/>"); sResult += _T("\"/>");
} }
if(m_oPitch.IsInit())
sResult += _T("<w:pitch w:val=\""); {
sResult += m_oPitch.ToString(); sResult += _T("<w:pitch w:val=\"");
sResult += _T("\"/>"); sResult += m_oPitch->ToString();
sResult += _T("\"/>");
}
if ( m_oCsb0.IsInit() && m_oCsb1.IsInit() && m_oUsb0.IsInit() && m_oUsb1.IsInit() && m_oUsb2.IsInit() && m_oUsb3.IsInit() ) if ( m_oCsb0.IsInit() && m_oCsb1.IsInit() && m_oUsb0.IsInit() && m_oUsb1.IsInit() && m_oUsb2.IsInit() && m_oUsb3.IsInit() )
{ {
...@@ -137,7 +141,9 @@ namespace OOX ...@@ -137,7 +141,9 @@ namespace OOX
void Reset() void Reset()
{ {
m_sName = _T("Arial"); m_sName = _T("Arial");
m_oCharset.reset();
m_oFamily.reset();
m_oPitch.reset();
m_oAltName.reset(); m_oAltName.reset();
m_oNotTrueType.reset(); m_oNotTrueType.reset();
m_oPanose.reset(); m_oPanose.reset();
...@@ -152,9 +158,9 @@ namespace OOX ...@@ -152,9 +158,9 @@ namespace OOX
public: public:
CString m_sName; CString m_sName;
nullable<SimpleTypes::CFontCharset<SimpleTypes::fontcharsetANSI>> m_oCharset; nullable<SimpleTypes::CFontCharset<SimpleTypes::fontcharsetANSI>> m_oCharset;
SimpleTypes::CFontFamily <SimpleTypes::fontfamilyAuto > m_oFamily; nullable<SimpleTypes::CFontFamily<SimpleTypes::fontfamilyAuto>> m_oFamily;
SimpleTypes::CPitch <SimpleTypes::pitchDefault > m_oPitch; nullable<SimpleTypes::CPitch<SimpleTypes::pitchDefault>> m_oPitch;
nullable<CString > m_oAltName; nullable<CString > m_oAltName;
nullable<SimpleTypes::COnOff<> > m_oNotTrueType; nullable<SimpleTypes::COnOff<> > m_oNotTrueType;
......
...@@ -423,7 +423,7 @@ namespace SimpleTypes ...@@ -423,7 +423,7 @@ namespace SimpleTypes
virtual EFontFamily FromString(CString &sValue) virtual EFontFamily FromString(CString &sValue)
{ {
int nFontFamily = _wtoi(sValue); int nFontFamily = _wtoi(sValue);
switch(nThemeColor) switch(nFontFamily)
{ {
case 0:m_eValue = fontfamilyNotApplicable;break; case 0:m_eValue = fontfamilyNotApplicable;break;
case 1:m_eValue = fontfamilyRoman;break; case 1:m_eValue = fontfamilyRoman;break;
...@@ -438,10 +438,24 @@ namespace SimpleTypes ...@@ -438,10 +438,24 @@ namespace SimpleTypes
virtual CString ToString () const virtual CString ToString () const
{ {
CString sRes;
sRes.Format(_T("%d"), (int)m_eValue);
return sRes;
}
CString ToStringWord() const
{
CString sRes;
switch(m_eValue) switch(m_eValue)
{ {
default : return _T("0"); case fontfamilyNotApplicable:sRes = _T("auto");break;
case fontfamilyRoman:sRes = _T("roman");break;
case fontfamilySwiss:sRes = _T("swiss");break;
case fontfamilyModern:sRes = _T("modern");break;
case fontfamilyScript:sRes = _T("script");break;
case fontfamilyDecorative:sRes = _T("decorative");break;
default:sRes = _T("auto");
} }
return sRes;
} }
SimpleType_FromString (EFontFamily) SimpleType_FromString (EFontFamily)
......
...@@ -555,7 +555,7 @@ namespace OOX ...@@ -555,7 +555,7 @@ namespace OOX
WritingElement_ReadAttributes_End( oReader ) WritingElement_ReadAttributes_End( oReader )
} }
public: public:
nullable<SimpleTypes::CFontFamily<>> m_oFontFamily; nullable<SimpleTypes::Spreadsheet::CFontFamily<>> m_oFontFamily;
}; };
class CFontScheme class CFontScheme
{ {
......
...@@ -452,7 +452,10 @@ int CFontManager::Release() ...@@ -452,7 +452,10 @@ int CFontManager::Release()
delete this; delete this;
return ret; return ret;
} }
CFontInfo* CFontManager::GetFontInfoByParams(const CFontSelectFormat& oFormat)
{
return m_pApplication->GetList()->GetByParams(oFormat);
}
INT CFontManager::LoadFontByName(const std::wstring& sName, const double& dSize, const LONG& lStyle, const double& dDpiX, const double& dDpiY) INT CFontManager::LoadFontByName(const std::wstring& sName, const double& dSize, const LONG& lStyle, const double& dDpiX, const double& dDpiY)
{ {
if (NULL == m_pApplication) if (NULL == m_pApplication)
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
#include "FontFile.h" #include "FontFile.h"
#include <map> #include <map>
class CFontSelectFormat;
class CFontInfo;
class CFontStream class CFontStream
{ {
private: private:
...@@ -131,6 +133,7 @@ public: ...@@ -131,6 +133,7 @@ public:
virtual int AddRef(); virtual int AddRef();
virtual int Release(); virtual int Release();
CFontInfo* GetFontInfoByParams(const CFontSelectFormat& oFormat);
INT LoadFontByName(const std::wstring& sName, const double& dSize, const LONG& lStyle, const double& dDpiX, const double& dDpiY); 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 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); INT LoadFontFromFile2(CFontsCache* pCache, const std::wstring& sPath, const int& lFaceIndex, const double& dSize, const double& dDpiX, const double& dDpiY);
......

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "font_engine", "font_engine.vcproj", "{C739151F-5384-41DF-A1A6-F089E2C1AD56}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C739151F-5384-41DF-A1A6-F089E2C1AD56}.Debug|Win32.ActiveCfg = Debug|Win32
{C739151F-5384-41DF-A1A6-F089E2C1AD56}.Debug|Win32.Build.0 = Debug|Win32
{C739151F-5384-41DF-A1A6-F089E2C1AD56}.Release|Win32.ActiveCfg = Release|Win32
{C739151F-5384-41DF-A1A6-F089E2C1AD56}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Name="font_engine"
ProjectGUID="{C739151F-5384-41DF-A1A6-F089E2C1AD56}"
Keyword="MFCProj"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="4"
UseOfMFC="2"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="&quot;../freetype-2.5.2/include&quot;"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE"
StringPooling="true"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
PrecompiledHeaderFile=".\Release/font_engine.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
SuppressStartupBanner="true"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="2057"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile=".\Release\font_engine.lib"
SuppressStartupBanner="true"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile=".\Release/font_engine.bsc"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="4"
UseOfMFC="2"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="&quot;../freetype-2.5.2/include&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
PrecompiledHeaderFile=".\Debug/font_engine.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="2057"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile=".\Debug\font_engine.lib"
SuppressStartupBanner="true"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile=".\Debug/font_engine.bsc"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
>
<File
RelativePath=".\ApplicationFonts.cpp"
>
</File>
<File
RelativePath=".\FontFile.cpp"
>
</File>
<File
RelativePath=".\FontManager.cpp"
>
</File>
<File
RelativePath=".\FontPath.cpp"
>
</File>
<File
RelativePath=".\GlyphString.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl"
>
<File
RelativePath=".\ApplicationFonts.h"
>
</File>
<File
RelativePath=".\FontFile.h"
>
</File>
<File
RelativePath=".\FontManager.h"
>
</File>
<File
RelativePath=".\FontPath.h"
>
</File>
<File
RelativePath=".\GlyphString.h"
>
</File>
</Filter>
<Filter
Name="Common"
>
<File
RelativePath="..\common\Directory.h"
>
</File>
<File
RelativePath="..\common\File.h"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include "../../Common/OfficeFileFormats.h" #include "../../Common/OfficeFileFormats.h"
#include "../../Common/Base64.h" #include "../../Common/Base64.h"
#include "FontProcessor.h" #include "../../ASCOfficeDocxFile2/DocWrapper/FontProcessor.h"
#include "../../Common/DocxFormat/Source/XlsxFormat/Xlsx.h" #include "../../Common/DocxFormat/Source/XlsxFormat/Xlsx.h"
#include "../Common/BinReaderWriterDefines.h" #include "../Common/BinReaderWriterDefines.h"
#include "../Common/Common.h" #include "../Common/Common.h"
...@@ -523,13 +523,13 @@ namespace BinXlsxRW { ...@@ -523,13 +523,13 @@ namespace BinXlsxRW {
BinaryStyleTableWriter(NSBinPptxRW::CBinaryFileWriter &oCBufferedStream, NSFontCutter::CEmbeddedFontsManager* pEmbeddedFontsManager):m_oBcw(oCBufferedStream),m_pEmbeddedFontsManager(pEmbeddedFontsManager) BinaryStyleTableWriter(NSBinPptxRW::CBinaryFileWriter &oCBufferedStream, NSFontCutter::CEmbeddedFontsManager* pEmbeddedFontsManager):m_oBcw(oCBufferedStream),m_pEmbeddedFontsManager(pEmbeddedFontsManager)
{ {
}; };
void Write(OOX::Spreadsheet::CStyles& styles, OOX::CTheme* pTheme, BinXlsxRW::FontProcessor& oFontProcessor) void Write(OOX::Spreadsheet::CStyles& styles, OOX::CTheme* pTheme, DocWrapper::FontProcessor& oFontProcessor)
{ {
int nStart = m_oBcw.WriteItemWithLengthStart(); int nStart = m_oBcw.WriteItemWithLengthStart();
WriteStylesContent(styles, pTheme, oFontProcessor); WriteStylesContent(styles, pTheme, oFontProcessor);
m_oBcw.WriteItemWithLengthEnd(nStart); m_oBcw.WriteItemWithLengthEnd(nStart);
}; };
void WriteStylesContent(OOX::Spreadsheet::CStyles& styles, OOX::CTheme* pTheme, BinXlsxRW::FontProcessor& oFontProcessor) void WriteStylesContent(OOX::Spreadsheet::CStyles& styles, OOX::CTheme* pTheme, DocWrapper::FontProcessor& oFontProcessor)
{ {
int nCurPos; int nCurPos;
OOX::Spreadsheet::CIndexedColors* pIndexedColors = NULL; OOX::Spreadsheet::CIndexedColors* pIndexedColors = NULL;
...@@ -938,7 +938,7 @@ namespace BinXlsxRW { ...@@ -938,7 +938,7 @@ namespace BinXlsxRW {
m_oBcw.WriteItemEnd(nCurPos); m_oBcw.WriteItemEnd(nCurPos);
} }
}; };
void WriteFonts(const OOX::Spreadsheet::CFonts& fonts, OOX::Spreadsheet::CIndexedColors* pIndexedColors, OOX::CTheme* pTheme, BinXlsxRW::FontProcessor& oFontProcessor) void WriteFonts(const OOX::Spreadsheet::CFonts& fonts, OOX::Spreadsheet::CIndexedColors* pIndexedColors, OOX::CTheme* pTheme, DocWrapper::FontProcessor& oFontProcessor)
{ {
int nCurPos = 0; int nCurPos = 0;
for(int i = 0, length = fonts.m_arrItems.size(); i < length; ++i) for(int i = 0, length = fonts.m_arrItems.size(); i < length; ++i)
...@@ -949,7 +949,7 @@ namespace BinXlsxRW { ...@@ -949,7 +949,7 @@ namespace BinXlsxRW {
m_oBcw.WriteItemEnd(nCurPos); m_oBcw.WriteItemEnd(nCurPos);
} }
}; };
void WriteFont(const OOX::Spreadsheet::CFont& font, OOX::Spreadsheet::CIndexedColors* pIndexedColors, OOX::CTheme* theme, BinXlsxRW::FontProcessor& oFontProcessor) void WriteFont(const OOX::Spreadsheet::CFont& font, OOX::Spreadsheet::CIndexedColors* pIndexedColors, OOX::CTheme* theme, DocWrapper::FontProcessor& oFontProcessor)
{ {
int nCurPos = 0; int nCurPos = 0;
//Bold //Bold
...@@ -976,21 +976,10 @@ namespace BinXlsxRW { ...@@ -976,21 +976,10 @@ namespace BinXlsxRW {
m_oBcw.m_oStream.WriteBOOL(font.m_oItalic->m_oVal.ToBool()); m_oBcw.m_oStream.WriteBOOL(font.m_oItalic->m_oVal.ToBool());
} }
//RFont //RFont
CString sFont; if(font.m_oRFont.IsInit() && font.m_oRFont->m_sVal.IsInit())
if(NULL != theme && font.m_oScheme.IsInit() && font.m_oScheme->m_oFontScheme.IsInit())
{
SimpleTypes::Spreadsheet::EFontScheme eFontScheme = font.m_oScheme->m_oFontScheme->GetValue();
if(SimpleTypes::Spreadsheet::fontschemeMajor == eFontScheme)
sFont = theme->GetMajorFontOrEmpty();
else if(SimpleTypes::Spreadsheet::fontschemeMinor == eFontScheme)
sFont = theme->GetMinorFontOrEmpty();
}
if(sFont.IsEmpty() && font.m_oRFont.IsInit() && font.m_oRFont->m_sVal.IsInit())
sFont = font.m_oRFont->ToString2();
if(!sFont.IsEmpty())
{ {
// //
sFont = oFontProcessor.getFont(sFont); CString sFont = oFontProcessor.getFont(font.m_oScheme, font.m_oRFont, font.m_oCharset, font.m_oFamily, theme);
m_oBcw.m_oStream.WriteBYTE(c_oSerFontTypes::RFont); m_oBcw.m_oStream.WriteBYTE(c_oSerFontTypes::RFont);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Variable); m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Variable);
m_oBcw.m_oStream.WriteStringW(sFont); m_oBcw.m_oStream.WriteStringW(sFont);
...@@ -1125,7 +1114,7 @@ namespace BinXlsxRW { ...@@ -1125,7 +1114,7 @@ namespace BinXlsxRW {
m_oBcw.WriteItemEnd(nCurPos); m_oBcw.WriteItemEnd(nCurPos);
} }
} }
void WriteDxfs(const OOX::Spreadsheet::CDxfs& oDxfs, OOX::Spreadsheet::CIndexedColors* pIndexedColors, OOX::CTheme* pTheme, BinXlsxRW::FontProcessor& oFontProcessor) void WriteDxfs(const OOX::Spreadsheet::CDxfs& oDxfs, OOX::Spreadsheet::CIndexedColors* pIndexedColors, OOX::CTheme* pTheme, DocWrapper::FontProcessor& oFontProcessor)
{ {
int nCurPos = 0; int nCurPos = 0;
for(int i = 0, length = oDxfs.m_arrItems.size(); i < length; ++i) for(int i = 0, length = oDxfs.m_arrItems.size(); i < length; ++i)
...@@ -1136,7 +1125,7 @@ namespace BinXlsxRW { ...@@ -1136,7 +1125,7 @@ namespace BinXlsxRW {
m_oBcw.WriteItemEnd(nCurPos); m_oBcw.WriteItemEnd(nCurPos);
} }
}; };
void WriteDxf(const OOX::Spreadsheet::CDxf& oDxf, OOX::Spreadsheet::CIndexedColors* pIndexedColors, OOX::CTheme* pTheme, BinXlsxRW::FontProcessor& oFontProcessor) void WriteDxf(const OOX::Spreadsheet::CDxf& oDxf, OOX::Spreadsheet::CIndexedColors* pIndexedColors, OOX::CTheme* pTheme, DocWrapper::FontProcessor& oFontProcessor)
{ {
int nCurPos = 0; int nCurPos = 0;
if(oDxf.m_oAlignment.IsInit()) if(oDxf.m_oAlignment.IsInit())
...@@ -1274,13 +1263,13 @@ namespace BinXlsxRW { ...@@ -1274,13 +1263,13 @@ namespace BinXlsxRW {
BinarySharedStringTableWriter(NSBinPptxRW::CBinaryFileWriter &oCBufferedStream, NSFontCutter::CEmbeddedFontsManager* pEmbeddedFontsManager):m_oBcw(oCBufferedStream),m_pEmbeddedFontsManager(pEmbeddedFontsManager) BinarySharedStringTableWriter(NSBinPptxRW::CBinaryFileWriter &oCBufferedStream, NSFontCutter::CEmbeddedFontsManager* pEmbeddedFontsManager):m_oBcw(oCBufferedStream),m_pEmbeddedFontsManager(pEmbeddedFontsManager)
{ {
}; };
void Write(OOX::Spreadsheet::CSharedStrings& sharedString, OOX::Spreadsheet::CIndexedColors* pIndexedColors, OOX::CTheme* pTheme, BinXlsxRW::FontProcessor& oFontProcessor) void Write(OOX::Spreadsheet::CSharedStrings& sharedString, OOX::Spreadsheet::CIndexedColors* pIndexedColors, OOX::CTheme* pTheme, DocWrapper::FontProcessor& oFontProcessor)
{ {
int nStart = m_oBcw.WriteItemWithLengthStart(); int nStart = m_oBcw.WriteItemWithLengthStart();
WriteSharedStrings(sharedString, pIndexedColors, pTheme, oFontProcessor); WriteSharedStrings(sharedString, pIndexedColors, pTheme, oFontProcessor);
m_oBcw.WriteItemWithLengthEnd(nStart); m_oBcw.WriteItemWithLengthEnd(nStart);
}; };
void WriteSharedStrings(OOX::Spreadsheet::CSharedStrings& sharedString, OOX::Spreadsheet::CIndexedColors* pIndexedColors, OOX::CTheme* pTheme, BinXlsxRW::FontProcessor& oFontProcessor) void WriteSharedStrings(OOX::Spreadsheet::CSharedStrings& sharedString, OOX::Spreadsheet::CIndexedColors* pIndexedColors, OOX::CTheme* pTheme, DocWrapper::FontProcessor& oFontProcessor)
{ {
int nCurPos; int nCurPos;
for(int i = 0, length = sharedString.m_arrItems.size(); i < length; ++i) for(int i = 0, length = sharedString.m_arrItems.size(); i < length; ++i)
...@@ -1295,7 +1284,7 @@ namespace BinXlsxRW { ...@@ -1295,7 +1284,7 @@ namespace BinXlsxRW {
} }
} }
}; };
void WriteSharedString(OOX::Spreadsheet::CSi& si, OOX::Spreadsheet::CIndexedColors* pIndexedColors, OOX::CTheme* pTheme, BinXlsxRW::FontProcessor& oFontProcessor) void WriteSharedString(OOX::Spreadsheet::CSi& si, OOX::Spreadsheet::CIndexedColors* pIndexedColors, OOX::CTheme* pTheme, DocWrapper::FontProcessor& oFontProcessor)
{ {
int nCurPos; int nCurPos;
for(int i = 0, length = si.m_arrItems.size(); i < length; ++i) for(int i = 0, length = si.m_arrItems.size(); i < length; ++i)
...@@ -1319,7 +1308,7 @@ namespace BinXlsxRW { ...@@ -1319,7 +1308,7 @@ namespace BinXlsxRW {
} }
} }
}; };
void WriteRun(OOX::Spreadsheet::CRun& run, OOX::Spreadsheet::CIndexedColors* pIndexedColors, OOX::CTheme* pTheme, BinXlsxRW::FontProcessor& oFontProcessor) void WriteRun(OOX::Spreadsheet::CRun& run, OOX::Spreadsheet::CIndexedColors* pIndexedColors, OOX::CTheme* pTheme, DocWrapper::FontProcessor& oFontProcessor)
{ {
int nCurPos; int nCurPos;
//rPr //rPr
...@@ -1343,7 +1332,7 @@ namespace BinXlsxRW { ...@@ -1343,7 +1332,7 @@ namespace BinXlsxRW {
} }
} }
}; };
void WriteRPr(const OOX::Spreadsheet::CRPr& rPr, OOX::Spreadsheet::CIndexedColors* pIndexedColors, OOX::CTheme* pTheme, BinXlsxRW::FontProcessor& oFontProcessor) void WriteRPr(const OOX::Spreadsheet::CRPr& rPr, OOX::Spreadsheet::CIndexedColors* pIndexedColors, OOX::CTheme* pTheme, DocWrapper::FontProcessor& oFontProcessor)
{ {
int nCurPos = 0; int nCurPos = 0;
//Bold //Bold
...@@ -1372,17 +1361,13 @@ namespace BinXlsxRW { ...@@ -1372,17 +1361,13 @@ namespace BinXlsxRW {
//RFont //RFont
if(false != rPr.m_oRFont.IsInit() && rPr.m_oRFont->m_sVal.IsInit()) if(false != rPr.m_oRFont.IsInit() && rPr.m_oRFont->m_sVal.IsInit())
{ {
CString sFont = rPr.m_oRFont->m_sVal.get(); CString sFont = oFontProcessor.getFont(rPr.m_oScheme, rPr.m_oRFont, rPr.m_oCharset, rPr.m_oFamily, pTheme);
if(!sFont.IsEmpty()) m_oBcw.m_oStream.WriteBYTE(c_oSerFontTypes::RFont);
{ m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Variable);
sFont = oFontProcessor.getFont(sFont); m_oBcw.m_oStream.WriteStringW(sFont);
m_oBcw.m_oStream.WriteBYTE(c_oSerFontTypes::RFont);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Variable);
m_oBcw.m_oStream.WriteStringW(sFont);
if(NULL != m_pEmbeddedFontsManager) if(NULL != m_pEmbeddedFontsManager)
m_pEmbeddedFontsManager->CheckFont(sFont, oFontProcessor.getFontManager()); m_pEmbeddedFontsManager->CheckFont(sFont, oFontProcessor.getFontManager());
}
} }
//Scheme //Scheme
if(rPr.m_oScheme.IsInit() && rPr.m_oScheme->m_oFontScheme.IsInit()) if(rPr.m_oScheme.IsInit() && rPr.m_oScheme->m_oFontScheme.IsInit())
...@@ -1545,10 +1530,10 @@ namespace BinXlsxRW { ...@@ -1545,10 +1530,10 @@ namespace BinXlsxRW {
NSFontCutter::CEmbeddedFontsManager* m_pEmbeddedFontsManager; NSFontCutter::CEmbeddedFontsManager* m_pEmbeddedFontsManager;
OOX::Spreadsheet::CIndexedColors* m_pIndexedColors; OOX::Spreadsheet::CIndexedColors* m_pIndexedColors;
OOX::CTheme* m_pTheme; OOX::CTheme* m_pTheme;
BinXlsxRW::FontProcessor& m_oFontProcessor; DocWrapper::FontProcessor& m_oFontProcessor;
NSBinPptxRW::CDrawingConverter* m_pOfficeDrawingConverter; NSBinPptxRW::CDrawingConverter* m_pOfficeDrawingConverter;
public: public:
BinaryWorksheetTableWriter(NSBinPptxRW::CBinaryFileWriter &oCBufferedStream, NSFontCutter::CEmbeddedFontsManager* pEmbeddedFontsManager, OOX::Spreadsheet::CIndexedColors* pIndexedColors, OOX::CTheme* pTheme, BinXlsxRW::FontProcessor& oFontProcessor, NSBinPptxRW::CDrawingConverter* pOfficeDrawingConverter): BinaryWorksheetTableWriter(NSBinPptxRW::CBinaryFileWriter &oCBufferedStream, NSFontCutter::CEmbeddedFontsManager* pEmbeddedFontsManager, OOX::Spreadsheet::CIndexedColors* pIndexedColors, OOX::CTheme* pTheme, DocWrapper::FontProcessor& oFontProcessor, NSBinPptxRW::CDrawingConverter* pOfficeDrawingConverter):
m_oBcw(oCBufferedStream),m_pEmbeddedFontsManager(pEmbeddedFontsManager),m_pIndexedColors(pIndexedColors),m_pTheme(pTheme),m_oFontProcessor(oFontProcessor),m_pOfficeDrawingConverter(pOfficeDrawingConverter) m_oBcw(oCBufferedStream),m_pEmbeddedFontsManager(pEmbeddedFontsManager),m_pIndexedColors(pIndexedColors),m_pTheme(pTheme),m_oFontProcessor(oFontProcessor),m_pOfficeDrawingConverter(pOfficeDrawingConverter)
{ {
}; };
...@@ -3203,9 +3188,9 @@ namespace BinXlsxRW { ...@@ -3203,9 +3188,9 @@ namespace BinXlsxRW {
int m_nLastFilePos; int m_nLastFilePos;
int m_nRealTableCount; int m_nRealTableCount;
int m_nMainTableStart; int m_nMainTableStart;
BinXlsxRW::FontProcessor& m_oFontProcessor; DocWrapper::FontProcessor& m_oFontProcessor;
public: public:
BinaryFileWriter(BinXlsxRW::FontProcessor& oFontProcessor):m_oBcw(NULL),m_oFontProcessor(oFontProcessor) BinaryFileWriter(DocWrapper::FontProcessor& oFontProcessor):m_oBcw(NULL),m_oFontProcessor(oFontProcessor)
{ {
m_nLastFilePos = 0; m_nLastFilePos = 0;
m_nRealTableCount = 0; m_nRealTableCount = 0;
...@@ -3418,7 +3403,7 @@ namespace BinXlsxRW { ...@@ -3418,7 +3403,7 @@ namespace BinXlsxRW {
} }
RELEASEARRAYOBJECTS(pbBase64Buffer); RELEASEARRAYOBJECTS(pbBase64Buffer);
} }
void getDefaultCellStyles(CString& sFileInput, CString& sFileOutput, NSFontCutter::CEmbeddedFontsManager* pEmbeddedFontsManager, OOX::Spreadsheet::CIndexedColors* oIndexedColors, OOX::CTheme* pTheme, BinXlsxRW::FontProcessor& oFontProcessor) void getDefaultCellStyles(CString& sFileInput, CString& sFileOutput, NSFontCutter::CEmbeddedFontsManager* pEmbeddedFontsManager, OOX::Spreadsheet::CIndexedColors* oIndexedColors, OOX::CTheme* pTheme, DocWrapper::FontProcessor& oFontProcessor)
{ {
enum Types enum Types
{ {
...@@ -3603,7 +3588,7 @@ namespace BinXlsxRW { ...@@ -3603,7 +3588,7 @@ namespace BinXlsxRW {
} }
RELEASEARRAYOBJECTS(pbBase64Buffer); RELEASEARRAYOBJECTS(pbBase64Buffer);
} }
void getDefaultTableStyles(CString& sFileInput, CString& sFileOutput, NSFontCutter::CEmbeddedFontsManager* pEmbeddedFontsManager, OOX::Spreadsheet::CIndexedColors* oIndexedColors, OOX::CTheme* pTheme, BinXlsxRW::FontProcessor& oFontProcessor) void getDefaultTableStyles(CString& sFileInput, CString& sFileOutput, NSFontCutter::CEmbeddedFontsManager* pEmbeddedFontsManager, OOX::Spreadsheet::CIndexedColors* oIndexedColors, OOX::CTheme* pTheme, DocWrapper::FontProcessor& oFontProcessor)
{ {
enum Types enum Types
{ {
......
#include "FontProcessor.h"
namespace XlsxReader {
FontProcessor::FontProcessor()
: m_pFontManager(NULL) {}
FontProcessor::~FontProcessor() {
RELEASEINTERFACE(m_pFontManager);
}
void FontProcessor::setFontDir(const CString& fontDir) {
this->m_sFontDir = fontDir;
initFontManager();
}
void FontProcessor::setFontTable(const OOX::Spreadsheet::CFonts& oFonts) {
for (int i = 0, length = oFonts.m_arrItems.GetSize(); i < length; ++i)
{
OOX::Spreadsheet::WritingElement* we = oFonts.m_arrItems[i];
if(OOX::Spreadsheet::et_Font == we->getType())
{
OOX::Spreadsheet::CFont* pFont = static_cast<OOX::Spreadsheet::CFont*>(we);
if(NULL != pFont)
addToFontMap(pFont);
}
}
}
CString FontProcessor::getFont(const CString& name) {
CString fontName = _T("Arial");
if (fontMap.find(name) != fontMap.end())
fontName = fontMap[name];
else
{
OOX::CFont font;
font.m_sName = name;
addToFontMap(font);
if (fontMap.find(name) != fontMap.end())
fontName = fontMap[name];
}
return fontName;
}
void FontProcessor::initFontManager() {
RELEASEINTERFACE(m_pFontManager);
CoCreateInstance(__uuidof(AVSGraphics::CAVSFontManager), NULL, CLSCTX_ALL, __uuidof(AVSGraphics::IAVSFontManager), (void**) &m_pFontManager);
VARIANT var;
var.vt = VT_BSTR;
var.bstrVal = m_sFontDir.AllocSysString();
m_pFontManager->SetAdditionalParam(L"InitializeFromFolder", var);
RELEASESYSSTRING(var.bstrVal);
CString defaultFontName = _T("Arial");
BSTR defFontName = defaultFontName.AllocSysString();
fontManager->SetDefaultFont(defFontName);
SysFreeString(defFontName);
}
void FontProcessor::addToFontMap(OOX::Spreadsheet::CFont* pFont) {
CString parw;
parw += _T("<FontProperties>");
if(pFont->m_oCharset.IsInit() && pFont->m_oCharset->m_oCharset.IsInit())
{
SimpleTypes::EFontCharset eCharset = pFont->m_oCharset->m_oCharset->GetValue();
// fontcharsetANSI fontcharsetDefault, , dll
if(SimpleTypes::fontcharsetANSI != eCharset && SimpleTypes::fontcharsetDefault != eCharset)
parw += _T("<Charset value='") + pFont->m_oCharset->m_oCharset->ToHexString() + _T("'/>");
}
CString sFontName;
if(pFont->m_oRFont.IsInit())
sFontName = pFont->m_oRFont->ToString2();
if(sFontName.IsEmpty())
parw += _T("<Name value='") + CString(gc_sNoNameFont) + _T("'/>");
else
{
//ImageStudio::Serialize::Paint::Common::ToXmlString(sFontName);
parw += _T("<Name value='")+ sFontName + _T("'/>");
}
if(pFont->m_oScheme->m_oFontScheme.IsInit())
{
}
parw += _T("<FamilyClass name='") + font.m_oFamily.ToString() + _T("'/>");
if(font.m_oPanose.IsInit())
parw += _T("<Panose value='") + font.m_oPanose->ToString() + _T("'/>");
if (font.m_oPitch.GetValue() == SimpleTypes::pitchFixed)
parw += _T("<FixedWidth value='1'/>");
else
parw += _T("<FixedWidth value='0'/>");
parw += _T("<UnicodeRange ");
if (font.m_oUsb0.IsInit())
parw += _T("range1='") + font.m_oUsb0->ToString() + _T("' ");
if (font.m_oUsb1.IsInit())
parw += _T("range2='") + font.m_oUsb1->ToString() + _T("' ");
if (font.m_oUsb2.IsInit())
parw += _T("range3='") + font.m_oUsb2->ToString() + _T("' ");
if (font.m_oUsb3.IsInit())
parw += _T("range4='") + font.m_oUsb3->ToString() + _T("' ");
if (font.m_oCsb0.IsInit())
parw += _T("coderange1='") + font.m_oCsb0->ToString() + _T("' ");
if (font.m_oCsb1.IsInit())
parw += _T("coderange2='") + font.m_oCsb1->ToString() + _T("' ");
parw += _T("/>");
parw += _T("</FontProperties>");
CString params = parw.GetCString();
BSTR fontPath;
long index = 0;
BSTR bstrParams = params.AllocSysString();
fontManager->GetWinFontByParams(bstrParams, &fontPath, &index);
SysFreeString(bstrParams);
int status = fontManager->LoadFontFromFile(fontPath, 12, 72, 72, index);
SysFreeString(fontPath);
BSTR familyName;
fontManager->GetFamilyName(&familyName);
CString resFontName = familyName;
SysFreeString(familyName);
fontMap[font.m_sName] = resFontName;
}
}
\ No newline at end of file
#pragma once
#include "../stdafx.h"
#include "../../Common/DocxFormat/Source/XlsxFormat/Styles/Fonts.h"
namespace BinXlsxRW {
static TCHAR* gc_sNoNameFont = _T("NoNameFont");
static TCHAR* gc_sDefaultFontName = _T("Arial");
class FontProcessor {
ASCGraphics::IASCFontManager* m_pFontManager;
std::map<CString, CString> m_mapFontMap;
CString m_sFontDir;
public:
FontProcessor():m_pFontManager(NULL){}
~FontProcessor()
{
RELEASEINTERFACE(m_pFontManager);
}
void setFontDir(const CString& fontDir)
{
this->m_sFontDir = fontDir;
initFontManager();
}
CString getFontDir()
{
return this->m_sFontDir;
}
void setFontTable(const OOX::Spreadsheet::CFonts& oFonts)
{
for (int i = 0, length = oFonts.m_arrItems.size(); i < length; ++i)
{
OOX::Spreadsheet::CFont* pFont = oFonts.m_arrItems[i];
if(NULL != pFont)
addToFontMap(*pFont);
}
}
ASCGraphics::IASCFontManager* getFontManager()
{
return m_pFontManager;
}
CString getFont(const CString& name)
{
CString fontName = gc_sDefaultFontName;
std::map<CString, CString>::const_iterator pPair = m_mapFontMap.find( name );
if ( m_mapFontMap.end() == pPair )
{
if(!name.IsEmpty())
{
OOX::Spreadsheet::CFont oFont;
oFont.m_oRFont.Init();
oFont.m_oRFont->m_sVal = name;
addToFontMap(oFont);
pPair = m_mapFontMap.find( name );
if (m_mapFontMap.end() != pPair)
fontName = pPair->second;
}
}
else
fontName = pPair->second;
return fontName;
}
private:
void initFontManager()
{
RELEASEINTERFACE(m_pFontManager);
CoCreateInstance(ASCGraphics::CLSID_CASCFontManager, NULL, CLSCTX_ALL, ASCGraphics::IID_IASCFontManager, (void**) &m_pFontManager);
VARIANT var;
var.vt = VT_BSTR;
var.bstrVal = m_sFontDir.AllocSysString();
m_pFontManager->SetAdditionalParam(L"InitializeFromFolder", var);
RELEASESYSSTRING(var.bstrVal);
#ifdef BUILD_CONFIG_FULL_VERSION
CString defaultFontName = gc_sDefaultFontName;
BSTR defFontName = defaultFontName.AllocSysString();
m_pFontManager->SetDefaultFont(defFontName);
SysFreeString(defFontName);
#endif
}
void addToFontMap(OOX::Spreadsheet::CFont& font)
{
CString parw;
parw += _T("<FontProperties>");
if(font.m_oCharset.IsInit() && font.m_oCharset->m_oCharset.IsInit())
{
SimpleTypes::Spreadsheet::EFontCharset eCharset = font.m_oCharset->m_oCharset->GetValue();
// fontcharsetANSI fontcharsetDefault, , dll
if(SimpleTypes::fontcharsetANSI != eCharset && SimpleTypes::fontcharsetDefault != eCharset)
parw += _T("<Charset value='") + font.m_oCharset->m_oCharset->ToHexString() + _T("'/>");
}
CString sFontName;
if(font.m_oScheme.IsInit() && font.m_oScheme->m_oFontScheme.IsInit())
{
//
const SimpleTypes::Spreadsheet::EFontScheme eFontScheme = font.m_oScheme->m_oFontScheme->GetValue();
if(SimpleTypes::Spreadsheet::fontschemeNone != eFontScheme)
{
//todo
}
}
if(sFontName.IsEmpty() && font.m_oRFont.IsInit() && font.m_oRFont->m_sVal.IsInit())
sFontName = font.m_oRFont->ToString2();
if(sFontName.IsEmpty())
parw += _T("<Name value='") + CString(gc_sNoNameFont) + _T("'/>");
else
{
//ImageStudio::Serialize::Paint::Common::ToXmlString(sFontName);
parw += _T("<Name value='")+ sFontName + _T("'/>");
}
if(font.m_oFamily.IsInit() && font.m_oFamily->m_oFontFamily.IsInit())
{
parw += _T("<FamilyClass name='") + font.m_oFamily->m_oFontFamily->ToString() + _T("'/>");
}
parw += _T("</FontProperties>");
CString params = parw;
BSTR fontPath;
BSTR familyName;
long index = 0;
BSTR bstrParams = params.AllocSysString();
#ifdef BUILD_CONFIG_FULL_VERSION
m_pFontManager->GetWinFontByParams(bstrParams, &fontPath, &index);
int status = m_pFontManager->LoadFontFromFile(fontPath, 12, 72, 72, index);
SysFreeString(fontPath);
m_pFontManager->GetFamilyName(&familyName);
#else
m_pFontManager->GetWinFontByParams(bstrParams, &familyName, &fontPath, NULL, &index);
#endif
CString resFontName = familyName;
SysFreeString(fontPath);
SysFreeString(familyName);
SysFreeString(bstrParams);
m_mapFontMap[sFontName] = resFontName;
}
};
}
\ No newline at end of file
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