-
-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
54 changed files
with
4,005 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
all: | ||
mkdir -p bin | ||
g++ -I /usr/local/include/freetype2 -I /usr/include/freetype2 -I artery-font-format -I msdfgen/include -I msdfgen -D MSDFGEN_USE_CPP11 -D MSDF_ATLAS_STANDALONE -std=c++11 -pthread -O2 -o bin/msdf-atlas-gen msdfgen/core/*.cpp msdfgen/lib/*.cpp msdfgen/ext/*.cpp msdf-atlas-gen/*.cpp -lfreetype |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
|
||
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}") = "Msdfgen", "msdfgen\Msdfgen.vcxproj", "{84BE2D91-F071-4151-BE12-61460464C494}" | ||
EndProject | ||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "msdf-atlas-gen", "msdf-atlas-gen.vcxproj", "{223EDB94-5B35-45F2-A584-273DE6E45F6F}" | ||
ProjectSection(ProjectDependencies) = postProject | ||
{84BE2D91-F071-4151-BE12-61460464C494} = {84BE2D91-F071-4151-BE12-61460464C494} | ||
EndProjectSection | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug Library|x64 = Debug Library|x64 | ||
Debug Library|x86 = Debug Library|x86 | ||
Debug|x64 = Debug|x64 | ||
Debug|x86 = Debug|x86 | ||
Release Library|x64 = Release Library|x64 | ||
Release Library|x86 = Release Library|x86 | ||
Release|x64 = Release|x64 | ||
Release|x86 = Release|x86 | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{84BE2D91-F071-4151-BE12-61460464C494}.Debug Library|x64.ActiveCfg = Debug Library|x64 | ||
{84BE2D91-F071-4151-BE12-61460464C494}.Debug Library|x64.Build.0 = Debug Library|x64 | ||
{84BE2D91-F071-4151-BE12-61460464C494}.Debug Library|x86.ActiveCfg = Debug Library|Win32 | ||
{84BE2D91-F071-4151-BE12-61460464C494}.Debug Library|x86.Build.0 = Debug Library|Win32 | ||
{84BE2D91-F071-4151-BE12-61460464C494}.Debug|x64.ActiveCfg = Debug Library|x64 | ||
{84BE2D91-F071-4151-BE12-61460464C494}.Debug|x64.Build.0 = Debug Library|x64 | ||
{84BE2D91-F071-4151-BE12-61460464C494}.Debug|x86.ActiveCfg = Debug Library|Win32 | ||
{84BE2D91-F071-4151-BE12-61460464C494}.Debug|x86.Build.0 = Debug Library|Win32 | ||
{84BE2D91-F071-4151-BE12-61460464C494}.Release Library|x64.ActiveCfg = Release Library|x64 | ||
{84BE2D91-F071-4151-BE12-61460464C494}.Release Library|x64.Build.0 = Release Library|x64 | ||
{84BE2D91-F071-4151-BE12-61460464C494}.Release Library|x86.ActiveCfg = Release Library|Win32 | ||
{84BE2D91-F071-4151-BE12-61460464C494}.Release Library|x86.Build.0 = Release Library|Win32 | ||
{84BE2D91-F071-4151-BE12-61460464C494}.Release|x64.ActiveCfg = Release Library|x64 | ||
{84BE2D91-F071-4151-BE12-61460464C494}.Release|x64.Build.0 = Release Library|x64 | ||
{84BE2D91-F071-4151-BE12-61460464C494}.Release|x86.ActiveCfg = Release Library|Win32 | ||
{84BE2D91-F071-4151-BE12-61460464C494}.Release|x86.Build.0 = Release Library|Win32 | ||
{223EDB94-5B35-45F2-A584-273DE6E45F6F}.Debug Library|x64.ActiveCfg = Debug Library|x64 | ||
{223EDB94-5B35-45F2-A584-273DE6E45F6F}.Debug Library|x64.Build.0 = Debug Library|x64 | ||
{223EDB94-5B35-45F2-A584-273DE6E45F6F}.Debug Library|x86.ActiveCfg = Debug Library|Win32 | ||
{223EDB94-5B35-45F2-A584-273DE6E45F6F}.Debug Library|x86.Build.0 = Debug Library|Win32 | ||
{223EDB94-5B35-45F2-A584-273DE6E45F6F}.Debug|x64.ActiveCfg = Debug|x64 | ||
{223EDB94-5B35-45F2-A584-273DE6E45F6F}.Debug|x64.Build.0 = Debug|x64 | ||
{223EDB94-5B35-45F2-A584-273DE6E45F6F}.Debug|x86.ActiveCfg = Debug|Win32 | ||
{223EDB94-5B35-45F2-A584-273DE6E45F6F}.Debug|x86.Build.0 = Debug|Win32 | ||
{223EDB94-5B35-45F2-A584-273DE6E45F6F}.Release Library|x64.ActiveCfg = Release Library|x64 | ||
{223EDB94-5B35-45F2-A584-273DE6E45F6F}.Release Library|x64.Build.0 = Release Library|x64 | ||
{223EDB94-5B35-45F2-A584-273DE6E45F6F}.Release Library|x86.ActiveCfg = Release Library|Win32 | ||
{223EDB94-5B35-45F2-A584-273DE6E45F6F}.Release Library|x86.Build.0 = Release Library|Win32 | ||
{223EDB94-5B35-45F2-A584-273DE6E45F6F}.Release|x64.ActiveCfg = Release|x64 | ||
{223EDB94-5B35-45F2-A584-273DE6E45F6F}.Release|x64.Build.0 = Release|x64 | ||
{223EDB94-5B35-45F2-A584-273DE6E45F6F}.Release|x86.ActiveCfg = Release|Win32 | ||
{223EDB94-5B35-45F2-A584-273DE6E45F6F}.Release|x86.Build.0 = Release|Win32 | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,178 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<ItemGroup> | ||
<Filter Include="Source Files"> | ||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> | ||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> | ||
</Filter> | ||
<Filter Include="Header Files"> | ||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> | ||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions> | ||
</Filter> | ||
<Filter Include="Resource Files"> | ||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> | ||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> | ||
</Filter> | ||
<Filter Include="Template Source Files"> | ||
<UniqueIdentifier>{ee785f45-c1cf-48ae-b864-f27237b077c1}</UniqueIdentifier> | ||
</Filter> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClCompile Include="msdf-atlas-gen\artery-font-export.cpp"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
<ClCompile Include="msdf-atlas-gen\bitmap-blit.cpp"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
<ClCompile Include="msdf-atlas-gen\csv-export.cpp"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
<ClCompile Include="msdf-atlas-gen\glyph-generators.cpp"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
<ClCompile Include="msdf-atlas-gen\GlyphGeometry.cpp"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
<ClCompile Include="msdf-atlas-gen\Charset.cpp"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
<ClCompile Include="msdf-atlas-gen\charset-parser.cpp"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
<ClCompile Include="msdf-atlas-gen\image-encode.cpp"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
<ClCompile Include="msdf-atlas-gen\json-export.cpp"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
<ClCompile Include="msdf-atlas-gen\main.cpp"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
<ClCompile Include="msdf-atlas-gen\RectanglePacker.cpp"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
<ClCompile Include="msdf-atlas-gen\shadron-preview-generator.cpp"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
<ClCompile Include="msdf-atlas-gen\size-selectors.cpp"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
<ClCompile Include="msdf-atlas-gen\TightAtlasPacker.cpp"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
<ClCompile Include="msdf-atlas-gen\utf8.cpp"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
<ClCompile Include="msdf-atlas-gen\Workload.cpp"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClInclude Include="resource.h"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="msdf-atlas-gen\artery-font-export.h"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="msdf-atlas-gen\AtlasGenerator.h"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="msdf-atlas-gen\AtlasStorage.h"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="msdf-atlas-gen\BitmapAtlasStorage.h"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="msdf-atlas-gen\BitmapAtlasStorage.hpp"> | ||
<Filter>Template Source Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="msdf-atlas-gen\bitmap-blit.h"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="msdf-atlas-gen\csv-export.h"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="msdf-atlas-gen\DynamicAtlas.h"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="msdf-atlas-gen\DynamicAtlas.hpp"> | ||
<Filter>Template Source Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="msdf-atlas-gen\GlyphBox.h"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="msdf-atlas-gen\glyph-generators.h"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="msdf-atlas-gen\GlyphGeometry.h"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="msdf-atlas-gen\Charset.h"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="msdf-atlas-gen\image-encode.h"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="msdf-atlas-gen\image-save.h"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="msdf-atlas-gen\image-save.hpp"> | ||
<Filter>Template Source Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="msdf-atlas-gen\ImmediateAtlasGenerator.h"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="msdf-atlas-gen\ImmediateAtlasGenerator.hpp"> | ||
<Filter>Template Source Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="msdf-atlas-gen\json-export.h"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="msdf-atlas-gen\msdf-atlas-gen.h"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="msdf-atlas-gen\Rectangle.h"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="msdf-atlas-gen\RectanglePacker.h"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="msdf-atlas-gen\rectangle-packing.h"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="msdf-atlas-gen\rectangle-packing.hpp"> | ||
<Filter>Template Source Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="msdf-atlas-gen\Remap.h"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="msdf-atlas-gen\shadron-preview-generator.h"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="msdf-atlas-gen\size-selectors.h"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="msdf-atlas-gen\TightAtlasPacker.h"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="msdf-atlas-gen\types.h"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="msdf-atlas-gen\utf8.h"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="msdf-atlas-gen\Workload.h"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ResourceCompile Include="msdf-atlas-gen.rc"> | ||
<Filter>Resource Files</Filter> | ||
</ResourceCompile> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Image Include="icon.ico"> | ||
<Filter>Resource Files</Filter> | ||
</Image> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
|
||
#pragma once | ||
|
||
#include <msdfgen.h> | ||
#include "Remap.h" | ||
#include "GlyphGeometry.h" | ||
|
||
namespace msdf_atlas { | ||
|
||
namespace { | ||
|
||
/** Prototype of an atlas generator class. | ||
* An atlas generator maintains the atlas bitmap (AtlasStorage) and its layout and facilitates | ||
* generation of bitmap representation of glyphs. The layout of the atlas is given by the caller. | ||
*/ | ||
class AtlasGenerator { | ||
|
||
public: | ||
AtlasGenerator(); | ||
AtlasGenerator(int width, int height); | ||
/// Generates bitmap representation for the supplied array of glyphs | ||
void generate(const GlyphGeometry *glyphs, int count); | ||
/// Resizes the atlas and rearranges the generated pixels according to the remapping array | ||
void rearrange(int width, int height, const Remap *remapping, int count); | ||
/// Resizes the atlas and keeps the generated pixels in place | ||
void resize(int width, int height); | ||
|
||
}; | ||
|
||
} | ||
|
||
/// Configuration of signed distance field generator | ||
struct GeneratorAttributes { | ||
bool overlapSupport = true; | ||
bool scanlinePass = true; | ||
double errorCorrectionThreshold = MSDFGEN_DEFAULT_ERROR_CORRECTION_THRESHOLD; | ||
}; | ||
|
||
/// A function that generates the bitmap for a single glyph | ||
template <typename T, int N> | ||
using GeneratorFunction = void (*)(const msdfgen::BitmapRef<T, N> &, const GlyphGeometry &, const GeneratorAttributes &); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
|
||
#pragma once | ||
|
||
#include <msdfgen.h> | ||
#include "Remap.h" | ||
|
||
namespace msdf_atlas { | ||
|
||
namespace { | ||
|
||
/** Prototype of an atlas storage class. | ||
* An atlas storage physically holds the pixels of the atlas | ||
* and allows to read and write subsections represented as bitmaps. | ||
* Can be implemented using a simple bitmap (BitmapAtlasStorage), | ||
* as texture memory, or any other way. | ||
*/ | ||
class AtlasStorage { | ||
|
||
public: | ||
AtlasStorage(); | ||
AtlasStorage(int width, int height); | ||
/// Creates a copy with different dimensions | ||
AtlasStorage(const AtlasStorage &orig, int width, int height); | ||
/// Creates a copy with different dimensions and rearranges the pixels according to the remapping array | ||
AtlasStorage(const AtlasStorage &orig, int width, int height, const Remap *remapping, int count); | ||
/// Stores a subsection at x, y into the atlas storage. May be implemented for only some T, N | ||
template <typename T, int N> | ||
void put(int x, int y, const msdfgen::BitmapConstRef<T, N> &subBitmap); | ||
/// Retrieves a subsection at x, y from the atlas storage. May be implemented for only some T, N | ||
template <typename T, int N> | ||
void get(int x, int y, const msdfgen::BitmapRef<T, N> &subBitmap) const; | ||
|
||
}; | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
|
||
#pragma once | ||
|
||
#include "AtlasStorage.h" | ||
|
||
namespace msdf_atlas { | ||
|
||
/// An implementation of AtlasStorage represented by a bitmap in memory (msdfgen::Bitmap) | ||
template <typename T, int N> | ||
class BitmapAtlasStorage { | ||
|
||
public: | ||
BitmapAtlasStorage(); | ||
BitmapAtlasStorage(int width, int height); | ||
explicit BitmapAtlasStorage(const msdfgen::BitmapConstRef<T, N> &bitmap); | ||
explicit BitmapAtlasStorage(msdfgen::Bitmap<T, N> &&bitmap); | ||
BitmapAtlasStorage(const BitmapAtlasStorage<T, N> &orig, int width, int height); | ||
BitmapAtlasStorage(const BitmapAtlasStorage<T, N> &orig, int width, int height, const Remap *remapping, int count); | ||
operator msdfgen::BitmapConstRef<T, N>() const; | ||
operator msdfgen::BitmapRef<T, N>(); | ||
operator msdfgen::Bitmap<T, N>() &&; | ||
template <typename S> | ||
void put(int x, int y, const msdfgen::BitmapConstRef<S, N> &subBitmap); | ||
void get(int x, int y, const msdfgen::BitmapRef<T, N> &subBitmap) const; | ||
|
||
private: | ||
msdfgen::Bitmap<T, N> bitmap; | ||
|
||
}; | ||
|
||
} | ||
|
||
#include "BitmapAtlasStorage.hpp" |
Oops, something went wrong.