aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authordongie <timecop@gmail.com>2016-10-02 23:33:28 +0900
committerdongie <timecop@gmail.com>2016-10-02 23:33:28 +0900
commitc9b616014fee75c60824819f78eb8e7ff247439e (patch)
tree20f9b712d9724e92188942464a3efc7eecffb549 /tools
parentea0dd89cfcc752f38a315c6721fafdec80eb8280 (diff)
downloaduGFX-c9b616014fee75c60824819f78eb8e7ff247439e.tar.gz
uGFX-c9b616014fee75c60824819f78eb8e7ff247439e.tar.bz2
uGFX-c9b616014fee75c60824819f78eb8e7ff247439e.zip
Added build files for mcufont on Windows, using Visual Studio 2015.
Corrected opening .ttf/.bdf files in BINARY mode (which has an effect on Win32, no change on other platforms). Added progress report to import_ttf as with a large font file, it may take several minutes.
Diffstat (limited to 'tools')
-rw-r--r--tools/mcufontencoder/binaries/windows/freetype6.dllbin522240 -> 0 bytes
-rw-r--r--tools/mcufontencoder/binaries/windows/libgcc_s_dw2-1.dllbin112142 -> 0 bytes
-rw-r--r--tools/mcufontencoder/binaries/windows/mcufont.exebin817166 -> 977408 bytes
-rw-r--r--tools/mcufontencoder/binaries/windows/zlib1.dllbin131598 -> 0 bytes
-rw-r--r--tools/mcufontencoder/src/freetype_import.cc16
-rw-r--r--tools/mcufontencoder/src/main.cc4
-rw-r--r--tools/mcufontencoder/src/mcufont.icobin0 -> 15086 bytes
-rw-r--r--tools/mcufontencoder/src/mcufont.rcbin0 -> 3270 bytes
-rw-r--r--tools/mcufontencoder/src/mcufont.sln22
-rw-r--r--tools/mcufontencoder/src/mcufont.vcxproj177
-rw-r--r--tools/mcufontencoder/src/readme_win32.txt9
11 files changed, 222 insertions, 6 deletions
diff --git a/tools/mcufontencoder/binaries/windows/freetype6.dll b/tools/mcufontencoder/binaries/windows/freetype6.dll
deleted file mode 100644
index e35edc6b..00000000
--- a/tools/mcufontencoder/binaries/windows/freetype6.dll
+++ /dev/null
Binary files differ
diff --git a/tools/mcufontencoder/binaries/windows/libgcc_s_dw2-1.dll b/tools/mcufontencoder/binaries/windows/libgcc_s_dw2-1.dll
deleted file mode 100644
index 99a76cf3..00000000
--- a/tools/mcufontencoder/binaries/windows/libgcc_s_dw2-1.dll
+++ /dev/null
Binary files differ
diff --git a/tools/mcufontencoder/binaries/windows/mcufont.exe b/tools/mcufontencoder/binaries/windows/mcufont.exe
index c3c670d2..f12c9c47 100644
--- a/tools/mcufontencoder/binaries/windows/mcufont.exe
+++ b/tools/mcufontencoder/binaries/windows/mcufont.exe
Binary files differ
diff --git a/tools/mcufontencoder/binaries/windows/zlib1.dll b/tools/mcufontencoder/binaries/windows/zlib1.dll
deleted file mode 100644
index bb116109..00000000
--- a/tools/mcufontencoder/binaries/windows/zlib1.dll
+++ /dev/null
Binary files differ
diff --git a/tools/mcufontencoder/src/freetype_import.cc b/tools/mcufontencoder/src/freetype_import.cc
index 27a0734d..07a9cde5 100644
--- a/tools/mcufontencoder/src/freetype_import.cc
+++ b/tools/mcufontencoder/src/freetype_import.cc
@@ -163,14 +163,22 @@ std::unique_ptr<DataFile> LoadFreetype(std::istream &file, int size, bool bw)
glyphtable.push_back(glyph);
charcode = FT_Get_Next_Char(face, charcode, &gindex);
+ if (gindex % 1000 == 0)
+ std::cout << ".";
}
-
+
+ std::cout << "\nEliminating duplicates (this may take a while)...";
+
eliminate_duplicates(glyphtable);
- crop_glyphs(glyphtable, fontinfo);
- detect_flags(glyphtable, fontinfo);
+ std::cout << "\nCropping glyphs...";
+ crop_glyphs(glyphtable, fontinfo);
+ std::cout << "\nDetecting flags...";
+ detect_flags(glyphtable, fontinfo);
- std::unique_ptr<DataFile> result(new DataFile(
+ std::cout << "\nGenerating datafile...";
+ std::unique_ptr<DataFile> result(new DataFile(
dictionary, glyphtable, fontinfo));
+ std::cout << "\n";
return result;
}
diff --git a/tools/mcufontencoder/src/main.cc b/tools/mcufontencoder/src/main.cc
index 19c9c6f7..70cd9132 100644
--- a/tools/mcufontencoder/src/main.cc
+++ b/tools/mcufontencoder/src/main.cc
@@ -90,7 +90,7 @@ static status_t cmd_import_ttf(const std::vector<std::string> &args)
int size = std::stoi(args.at(2));
bool bw = (args.size() == 4 && args.at(3) == "bw");
std::string dest = strip_extension(src) + std::to_string(size) + (bw ? "bw" : "") + ".dat";
- std::ifstream infile(src);
+ std::ifstream infile(src, std::ios::binary);
if (!infile.good())
{
@@ -118,7 +118,7 @@ static status_t cmd_import_bdf(const std::vector<std::string> &args)
std::string src = args.at(1);
std::string dest = strip_extension(args.at(1)) + ".dat";
- std::ifstream infile(src);
+ std::ifstream infile(src, std::ios::binary);
if (!infile.good())
{
diff --git a/tools/mcufontencoder/src/mcufont.ico b/tools/mcufontencoder/src/mcufont.ico
new file mode 100644
index 00000000..66f8a131
--- /dev/null
+++ b/tools/mcufontencoder/src/mcufont.ico
Binary files differ
diff --git a/tools/mcufontencoder/src/mcufont.rc b/tools/mcufontencoder/src/mcufont.rc
new file mode 100644
index 00000000..84481771
--- /dev/null
+++ b/tools/mcufontencoder/src/mcufont.rc
Binary files differ
diff --git a/tools/mcufontencoder/src/mcufont.sln b/tools/mcufontencoder/src/mcufont.sln
new file mode 100644
index 00000000..156c6b27
--- /dev/null
+++ b/tools/mcufontencoder/src/mcufont.sln
@@ -0,0 +1,22 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 14
+VisualStudioVersion = 14.0.25420.1
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mcufont", "mcufont.vcxproj", "{387183DE-A542-4506-8BB1-1A240036E4F4}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|x86 = Debug|x86
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {387183DE-A542-4506-8BB1-1A240036E4F4}.Debug|x86.ActiveCfg = Debug|Win32
+ {387183DE-A542-4506-8BB1-1A240036E4F4}.Debug|x86.Build.0 = Debug|Win32
+ {387183DE-A542-4506-8BB1-1A240036E4F4}.Release|x86.ActiveCfg = Release|Win32
+ {387183DE-A542-4506-8BB1-1A240036E4F4}.Release|x86.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/tools/mcufontencoder/src/mcufont.vcxproj b/tools/mcufontencoder/src/mcufont.vcxproj
new file mode 100644
index 00000000..3f6e0ee1
--- /dev/null
+++ b/tools/mcufontencoder/src/mcufont.vcxproj
@@ -0,0 +1,177 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{387183DE-A542-4506-8BB1-1A240036E4F4}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>mcufont</RootNamespace>
+ <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v140</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v140</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v140</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v140</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="Shared">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <EmbedManifest>false</EmbedManifest>
+ <GenerateManifest>false</GenerateManifest>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>freetype-2.7\include</AdditionalIncludeDirectories>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <AdditionalDependencies>freetype-2.7\objs\vc2010\Win32\freetype27MTd.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>freetype-2.7\include</AdditionalIncludeDirectories>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <DebugInformationFormat>None</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <AdditionalDependencies>freetype-2.7\objs\vc2010\Win32\freetype27MT.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="bdf_import.cc" />
+ <ClCompile Include="datafile.cc" />
+ <ClCompile Include="encode_rlefont.cc" />
+ <ClCompile Include="exporttools.cc" />
+ <ClCompile Include="export_bwfont.cc" />
+ <ClCompile Include="export_rlefont.cc" />
+ <ClCompile Include="freetype_import.cc" />
+ <ClCompile Include="importtools.cc" />
+ <ClCompile Include="main.cc" />
+ <ClCompile Include="optimize_rlefont.cc" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="resource.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <ResourceCompile Include="mcufont.rc" />
+ </ItemGroup>
+ <ItemGroup>
+ <Image Include="mcufont.ico" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/tools/mcufontencoder/src/readme_win32.txt b/tools/mcufontencoder/src/readme_win32.txt
new file mode 100644
index 00000000..42b18466
--- /dev/null
+++ b/tools/mcufontencoder/src/readme_win32.txt
@@ -0,0 +1,9 @@
+How to build on Windows using Visual Studio 2015
+
+* Download freetype-2.7 and extract to mcufont dir. result will contain freetype-2.7\src, freetype-2.7\include, etc.
+* Go to freetype-2.7\builds\windows\vc2010 and open freetype.sln
+* Select "Debug Multithreaded" and build. Select "Release Multithreaded" and build. Close Visual Studio.
+* Open mcufont.sln
+* Select Debug or Release, and build
+* Resulting mcufont.exe is in Release\ or Debug\ folder and needs no further dependencies.
+