Updated to msdfgen 1.8, Skia geometry preprocessing, added -threads argument
This commit is contained in:
parent
78142f6131
commit
c42964a9ec
|
|
@ -100,9 +100,11 @@ Any subset of the following may be specified:
|
||||||
- `-angle <angle>` – sets the minimum angle between adjacent edges to be considered a corner. Append D for degrees (`msdf` / `mtsdf` only)
|
- `-angle <angle>` – sets the minimum angle between adjacent edges to be considered a corner. Append D for degrees (`msdf` / `mtsdf` only)
|
||||||
- `-errorcorrection <threshold>` – sets the threshold used to detect and correct potential artifacts. 0 disables error correction (`msdf` / `mtsdf` only)
|
- `-errorcorrection <threshold>` – sets the threshold used to detect and correct potential artifacts. 0 disables error correction (`msdf` / `mtsdf` only)
|
||||||
- `-miterlimit <value>` – sets the miter limit that limits the extension of each glyph's bounding box due to very sharp corners (`psdf` / `msdf` / `mtsdf` only)
|
- `-miterlimit <value>` – sets the miter limit that limits the extension of each glyph's bounding box due to very sharp corners (`psdf` / `msdf` / `mtsdf` only)
|
||||||
- `-nooverlap` – disables resolution of overlapping contours
|
- `-overlap` – switches to distance field generator with support for overlapping contours
|
||||||
- `-noscanline` – disables the scanline pass, which corrects the distance field's signs according to the non-zero fill rule
|
- `-nopreprocess` – disables path preprocessing which resolves self-intersections and overlapping contours
|
||||||
|
- `-scanline` – performs an additional scanline pass to fix the signs of the distances
|
||||||
- `-seed <N>` – sets the initial seed for the edge coloring heuristic
|
- `-seed <N>` – sets the initial seed for the edge coloring heuristic
|
||||||
|
- `-threads <N>` – sets the number of threads for the parallel computation (0 = auto)
|
||||||
|
|
||||||
## Character set specification syntax
|
## Character set specification syntax
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit 185eb7a3ab3913fa09173739de152935d3e4399e
|
Subproject commit 00ac3d8f964ec00a836c2bb5aeb126235ac98234
|
||||||
Binary file not shown.
Binary file not shown.
|
|
@ -161,12 +161,12 @@
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>msdfgen\include;msdfgen\freetype\include;msdfgen;artery-font-format;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>msdfgen\include;msdfgen\freetype\include;msdfgen;artery-font-format;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;MSDFGEN_USE_CPP11;MSDF_ATLAS_STANDALONE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;MSDFGEN_USE_CPP11;MSDFGEN_USE_SKIA;MSDF_ATLAS_STANDALONE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
<AdditionalDependencies>freetype.lib;msdfgen.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>freetype.lib;skia.lib;msdfgen.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<AdditionalLibraryDirectories>msdfgen\freetype\win32;msdfgen\$(Configuration) Library;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>msdfgen\freetype\win$(PlatformArchitecture);msdfgen\skia\win$(PlatformArchitecture)\$(Configuration);msdfgen\$(Configuration) Library;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Library|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Library|Win32'">
|
||||||
|
|
@ -176,7 +176,7 @@
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>msdfgen\include;msdfgen\freetype\include;msdfgen;artery-font-format;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>msdfgen\include;msdfgen\freetype\include;msdfgen;artery-font-format;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;MSDFGEN_USE_CPP11;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;MSDFGEN_USE_CPP11;MSDFGEN_USE_SKIA;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
|
|
@ -185,6 +185,7 @@
|
||||||
</Link>
|
</Link>
|
||||||
<Lib>
|
<Lib>
|
||||||
<TargetMachine>MachineX86</TargetMachine>
|
<TargetMachine>MachineX86</TargetMachine>
|
||||||
|
<AdditionalLibraryDirectories>msdfgen\freetype\win$(PlatformArchitecture);msdfgen\skia\win$(PlatformArchitecture)\debug;msdfgen\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
</Lib>
|
</Lib>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
|
@ -194,12 +195,12 @@
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>msdfgen\include;msdfgen\freetype\include;msdfgen;artery-font-format;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>msdfgen\include;msdfgen\freetype\include;msdfgen;artery-font-format;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;MSDFGEN_USE_CPP11;MSDF_ATLAS_STANDALONE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;MSDFGEN_USE_CPP11;MSDFGEN_USE_SKIA;MSDF_ATLAS_STANDALONE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
<AdditionalDependencies>freetype.lib;msdfgen.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>freetype.lib;skia.lib;msdfgen.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<AdditionalLibraryDirectories>msdfgen\freetype\win64;msdfgen\$(Platform)\$(Configuration) Library;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>msdfgen\freetype\win$(PlatformArchitecture);msdfgen\skia\win$(PlatformArchitecture)\$(Configuration);msdfgen\$(Platform)\$(Configuration) Library;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Library|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Library|x64'">
|
||||||
|
|
@ -209,13 +210,16 @@
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>msdfgen\include;msdfgen\freetype\include;msdfgen;artery-font-format;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>msdfgen\include;msdfgen\freetype\include;msdfgen;artery-font-format;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;MSDFGEN_USE_CPP11;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;MSDFGEN_USE_CPP11;MSDFGEN_USE_SKIA;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
<AdditionalDependencies>freetype.lib;msdfgen.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>freetype.lib;msdfgen.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<AdditionalLibraryDirectories>..\msdfgen\freetype\win64;$(SolutionDir)$(Platform)\$(Configuration) Library;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>..\msdfgen\freetype\win64;$(SolutionDir)$(Platform)\$(Configuration) Library;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
</Link>
|
</Link>
|
||||||
|
<Lib>
|
||||||
|
<AdditionalLibraryDirectories>msdfgen\freetype\win$(PlatformArchitecture);msdfgen\skia\win$(PlatformArchitecture)\debug;msdfgen\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
</Lib>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
|
|
@ -226,14 +230,16 @@
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>msdfgen\include;msdfgen\freetype\include;msdfgen;artery-font-format;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>msdfgen\include;msdfgen\freetype\include;msdfgen;artery-font-format;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;MSDFGEN_USE_CPP11;MSDF_ATLAS_STANDALONE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;MSDFGEN_USE_CPP11;MSDFGEN_USE_SKIA;MSDF_ATLAS_STANDALONE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<DebugInformationFormat>None</DebugInformationFormat>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
<AdditionalDependencies>freetype.lib;msdfgen.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>freetype.lib;skia.lib;msdfgen.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<AdditionalLibraryDirectories>msdfgen\freetype\win32;msdfgen\bin;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>msdfgen\freetype\win$(PlatformArchitecture);msdfgen\skia\win$(PlatformArchitecture)\$(Configuration);msdfgen\bin;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Library|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Library|Win32'">
|
||||||
|
|
@ -245,7 +251,7 @@
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>msdfgen\include;msdfgen\freetype\include;msdfgen;artery-font-format;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>msdfgen\include;msdfgen\freetype\include;msdfgen;artery-font-format;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;MSDFGEN_USE_CPP11;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;MSDFGEN_USE_CPP11;MSDFGEN_USE_SKIA;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
|
@ -256,6 +262,7 @@
|
||||||
</Link>
|
</Link>
|
||||||
<Lib>
|
<Lib>
|
||||||
<TargetMachine>MachineX86</TargetMachine>
|
<TargetMachine>MachineX86</TargetMachine>
|
||||||
|
<AdditionalLibraryDirectories>msdfgen\freetype\win$(PlatformArchitecture);msdfgen\skia\win$(PlatformArchitecture)\release;msdfgen\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
</Lib>
|
</Lib>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
|
@ -267,14 +274,16 @@
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>msdfgen\include;msdfgen\freetype\include;msdfgen;artery-font-format;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>msdfgen\include;msdfgen\freetype\include;msdfgen;artery-font-format;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;MSDFGEN_USE_CPP11;MSDF_ATLAS_STANDALONE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;MSDFGEN_USE_CPP11;MSDFGEN_USE_SKIA;MSDF_ATLAS_STANDALONE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<DebugInformationFormat>None</DebugInformationFormat>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
<AdditionalDependencies>freetype.lib;msdfgen.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>freetype.lib;skia.lib;msdfgen.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<AdditionalLibraryDirectories>msdfgen\freetype\win64;msdfgen\$(Platform)\$(Configuration) Library;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>msdfgen\freetype\win$(PlatformArchitecture);msdfgen\skia\win$(PlatformArchitecture)\$(Configuration);msdfgen\$(Platform)\$(Configuration) Library;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Library|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Library|x64'">
|
||||||
|
|
@ -286,7 +295,7 @@
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>msdfgen\include;msdfgen\freetype\include;msdfgen;artery-font-format;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>msdfgen\include;msdfgen\freetype\include;msdfgen;artery-font-format;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;MSDFGEN_USE_CPP11;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;MSDFGEN_USE_CPP11;MSDFGEN_USE_SKIA;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
|
@ -295,6 +304,9 @@
|
||||||
<AdditionalDependencies>freetype.lib;msdfgen.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>freetype.lib;msdfgen.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<AdditionalLibraryDirectories>..\msdfgen\freetype\win64;$(SolutionDir)$(Platform)\$(Configuration) Library;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>..\msdfgen\freetype\win64;$(SolutionDir)$(Platform)\$(Configuration) Library;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
</Link>
|
</Link>
|
||||||
|
<Lib>
|
||||||
|
<AdditionalLibraryDirectories>msdfgen\freetype\win$(PlatformArchitecture);msdfgen\skia\win$(PlatformArchitecture)\release;msdfgen\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
</Lib>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="msdf-atlas-gen\artery-font-export.cpp" />
|
<ClCompile Include="msdf-atlas-gen\artery-font-export.cpp" />
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,8 @@ public:
|
||||||
|
|
||||||
/// Configuration of signed distance field generator
|
/// Configuration of signed distance field generator
|
||||||
struct GeneratorAttributes {
|
struct GeneratorAttributes {
|
||||||
bool overlapSupport = true;
|
bool overlapSupport = false;
|
||||||
bool scanlinePass = true;
|
bool scanlinePass = false;
|
||||||
double errorCorrectionThreshold = MSDFGEN_DEFAULT_ERROR_CORRECTION_THRESHOLD;
|
double errorCorrectionThreshold = MSDFGEN_DEFAULT_ERROR_CORRECTION_THRESHOLD;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,30 +2,32 @@
|
||||||
#include "GlyphGeometry.h"
|
#include "GlyphGeometry.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <core/ShapeDistanceFinder.h>
|
||||||
|
|
||||||
namespace msdf_atlas {
|
namespace msdf_atlas {
|
||||||
|
|
||||||
GlyphGeometry::GlyphGeometry() : codepoint(), bounds(), reverseWinding(), advance(), box() { }
|
GlyphGeometry::GlyphGeometry() : codepoint(), bounds(), advance(), box() { }
|
||||||
|
|
||||||
double GlyphGeometry::simpleSignedDistance(const msdfgen::Point2 &p) const {
|
bool GlyphGeometry::load(msdfgen::FontHandle *font, unicode_t codepoint, bool preprocessGeometry) {
|
||||||
double dummy;
|
|
||||||
msdfgen::SignedDistance minDistance;
|
|
||||||
for (const msdfgen::Contour &contour : shape.contours)
|
|
||||||
for (const msdfgen::EdgeHolder &edge : contour.edges) {
|
|
||||||
msdfgen::SignedDistance distance = edge->signedDistance(p, dummy);
|
|
||||||
if (distance < minDistance)
|
|
||||||
minDistance = distance;
|
|
||||||
}
|
|
||||||
return minDistance.distance;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GlyphGeometry::load(msdfgen::FontHandle *font, unicode_t codepoint) {
|
|
||||||
if (font && msdfgen::loadGlyph(shape, font, codepoint, &advance) && shape.validate()) {
|
if (font && msdfgen::loadGlyph(shape, font, codepoint, &advance) && shape.validate()) {
|
||||||
this->codepoint = codepoint;
|
this->codepoint = codepoint;
|
||||||
|
#ifdef MSDFGEN_USE_SKIA
|
||||||
|
if (preprocessGeometry)
|
||||||
|
msdfgen::resolveShapeGeometry(shape);
|
||||||
|
#endif
|
||||||
shape.normalize();
|
shape.normalize();
|
||||||
bounds = shape.getBounds();
|
bounds = shape.getBounds();
|
||||||
|
#ifdef MSDFGEN_USE_SKIA
|
||||||
|
if (!preprocessGeometry)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
// Determine if shape is winded incorrectly and reverse it in that case
|
||||||
msdfgen::Point2 outerPoint(bounds.l-(bounds.r-bounds.l)-1, bounds.b-(bounds.t-bounds.b)-1);
|
msdfgen::Point2 outerPoint(bounds.l-(bounds.r-bounds.l)-1, bounds.b-(bounds.t-bounds.b)-1);
|
||||||
reverseWinding = simpleSignedDistance(outerPoint) > 0;
|
if (msdfgen::SimpleTrueShapeDistanceFinder::oneShotDistance(shape, outerPoint) > 0) {
|
||||||
|
for (msdfgen::Contour &contour : shape.contours)
|
||||||
|
contour.reverse();
|
||||||
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -43,7 +45,7 @@ void GlyphGeometry::wrapBox(double scale, double range, double miterLimit) {
|
||||||
l -= .5*range, b -= .5*range;
|
l -= .5*range, b -= .5*range;
|
||||||
r += .5*range, t += .5*range;
|
r += .5*range, t += .5*range;
|
||||||
if (miterLimit > 0)
|
if (miterLimit > 0)
|
||||||
shape.boundMiters(l, b, r, t, .5*range, miterLimit, reverseWinding ? -1 : +1);
|
shape.boundMiters(l, b, r, t, .5*range, miterLimit, 1);
|
||||||
double w = scale*(r-l);
|
double w = scale*(r-l);
|
||||||
double h = scale*(t-b);
|
double h = scale*(t-b);
|
||||||
box.rect.w = (int) ceil(w)+1;
|
box.rect.w = (int) ceil(w)+1;
|
||||||
|
|
@ -72,10 +74,6 @@ double GlyphGeometry::getAdvance() const {
|
||||||
return advance;
|
return advance;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GlyphGeometry::isWindingReverse() const {
|
|
||||||
return reverseWinding;
|
|
||||||
}
|
|
||||||
|
|
||||||
void GlyphGeometry::getBoxRect(int &x, int &y, int &w, int &h) const {
|
void GlyphGeometry::getBoxRect(int &x, int &y, int &w, int &h) const {
|
||||||
x = box.rect.x, y = box.rect.y;
|
x = box.rect.x, y = box.rect.y;
|
||||||
w = box.rect.w, h = box.rect.h;
|
w = box.rect.w, h = box.rect.h;
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ class GlyphGeometry {
|
||||||
public:
|
public:
|
||||||
GlyphGeometry();
|
GlyphGeometry();
|
||||||
/// Loads glyph geometry from font
|
/// Loads glyph geometry from font
|
||||||
bool load(msdfgen::FontHandle *font, unicode_t codepoint);
|
bool load(msdfgen::FontHandle *font, unicode_t codepoint, bool preprocessGeometry = true);
|
||||||
/// Applies edge coloring to glyph shape
|
/// Applies edge coloring to glyph shape
|
||||||
void edgeColoring(double angleThreshold, unsigned long long seed);
|
void edgeColoring(double angleThreshold, unsigned long long seed);
|
||||||
/// Computes the dimensions of the glyph's box as well as the transformation for the generator function
|
/// Computes the dimensions of the glyph's box as well as the transformation for the generator function
|
||||||
|
|
@ -27,8 +27,6 @@ public:
|
||||||
const msdfgen::Shape & getShape() const;
|
const msdfgen::Shape & getShape() const;
|
||||||
/// Returns the glyph's advance
|
/// Returns the glyph's advance
|
||||||
double getAdvance() const;
|
double getAdvance() const;
|
||||||
/// Returns true if the shape has reverse winding
|
|
||||||
bool isWindingReverse() const;
|
|
||||||
/// Outputs the position and dimensions of the glyph's box in the atlas
|
/// Outputs the position and dimensions of the glyph's box in the atlas
|
||||||
void getBoxRect(int &x, int &y, int &w, int &h) const;
|
void getBoxRect(int &x, int &y, int &w, int &h) const;
|
||||||
/// Outputs the dimensions of the glyph's box in the atlas
|
/// Outputs the dimensions of the glyph's box in the atlas
|
||||||
|
|
@ -52,7 +50,6 @@ private:
|
||||||
unicode_t codepoint;
|
unicode_t codepoint;
|
||||||
msdfgen::Shape shape;
|
msdfgen::Shape shape;
|
||||||
msdfgen::Shape::Bounds bounds;
|
msdfgen::Shape::Bounds bounds;
|
||||||
bool reverseWinding;
|
|
||||||
double advance;
|
double advance;
|
||||||
struct {
|
struct {
|
||||||
struct {
|
struct {
|
||||||
|
|
@ -63,9 +60,6 @@ private:
|
||||||
msdfgen::Vector2 translate;
|
msdfgen::Vector2 translate;
|
||||||
} box;
|
} box;
|
||||||
|
|
||||||
/// Computes the signed distance from point p in a naive way
|
|
||||||
double simpleSignedDistance(const msdfgen::Point2 &p) const;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
namespace msdf_atlas {
|
namespace msdf_atlas {
|
||||||
|
|
||||||
|
|
@ -42,7 +43,7 @@ bool Workload::finish(int threadCount) {
|
||||||
if (threadCount == 1 || chunks == 1)
|
if (threadCount == 1 || chunks == 1)
|
||||||
return finishSequential();
|
return finishSequential();
|
||||||
if (threadCount > 1)
|
if (threadCount > 1)
|
||||||
return finishParallel(threadCount);
|
return finishParallel(std::min(threadCount, chunks));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,51 +3,38 @@
|
||||||
|
|
||||||
namespace msdf_atlas {
|
namespace msdf_atlas {
|
||||||
|
|
||||||
template <int N>
|
|
||||||
static void invertColor(const msdfgen::BitmapRef<float, N> &bitmap) {
|
|
||||||
const float *end = bitmap.pixels+N*bitmap.width*bitmap.height;
|
|
||||||
for (float *p = bitmap.pixels; p < end; ++p)
|
|
||||||
*p = 1.f-*p;
|
|
||||||
}
|
|
||||||
|
|
||||||
void scanlineGenerator(const msdfgen::BitmapRef<float, 1> &output, const GlyphGeometry &glyph, const GeneratorAttributes &attribs) {
|
void scanlineGenerator(const msdfgen::BitmapRef<float, 1> &output, const GlyphGeometry &glyph, const GeneratorAttributes &attribs) {
|
||||||
msdfgen::rasterize(output, glyph.getShape(), glyph.getBoxScale(), glyph.getBoxTranslate(), MSDF_ATLAS_GLYPH_FILL_RULE);
|
msdfgen::rasterize(output, glyph.getShape(), glyph.getBoxScale(), glyph.getBoxTranslate(), MSDF_ATLAS_GLYPH_FILL_RULE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sdfGenerator(const msdfgen::BitmapRef<float, 1> &output, const GlyphGeometry &glyph, const GeneratorAttributes &attribs) {
|
void sdfGenerator(const msdfgen::BitmapRef<float, 1> &output, const GlyphGeometry &glyph, const GeneratorAttributes &attribs) {
|
||||||
msdfgen::generateSDF(output, glyph.getShape(), glyph.getBoxRange(), glyph.getBoxScale(), glyph.getBoxTranslate(), attribs.overlapSupport);
|
msdfgen::generateSDF(output, glyph.getShape(), glyph.getBoxRange(), glyph.getBoxScale(), glyph.getBoxTranslate(), attribs.overlapSupport);
|
||||||
if (glyph.isWindingReverse())
|
|
||||||
invertColor(output);
|
|
||||||
if (attribs.scanlinePass)
|
if (attribs.scanlinePass)
|
||||||
msdfgen::distanceSignCorrection(output, glyph.getShape(), glyph.getBoxScale(), glyph.getBoxTranslate(), MSDF_ATLAS_GLYPH_FILL_RULE);
|
msdfgen::distanceSignCorrection(output, glyph.getShape(), glyph.getBoxScale(), glyph.getBoxTranslate(), MSDF_ATLAS_GLYPH_FILL_RULE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void psdfGenerator(const msdfgen::BitmapRef<float, 1> &output, const GlyphGeometry &glyph, const GeneratorAttributes &attribs) {
|
void psdfGenerator(const msdfgen::BitmapRef<float, 1> &output, const GlyphGeometry &glyph, const GeneratorAttributes &attribs) {
|
||||||
msdfgen::generatePseudoSDF(output, glyph.getShape(), glyph.getBoxRange(), glyph.getBoxScale(), glyph.getBoxTranslate(), attribs.overlapSupport);
|
msdfgen::generatePseudoSDF(output, glyph.getShape(), glyph.getBoxRange(), glyph.getBoxScale(), glyph.getBoxTranslate(), attribs.overlapSupport);
|
||||||
if (glyph.isWindingReverse())
|
|
||||||
invertColor(output);
|
|
||||||
if (attribs.scanlinePass)
|
if (attribs.scanlinePass)
|
||||||
msdfgen::distanceSignCorrection(output, glyph.getShape(), glyph.getBoxScale(), glyph.getBoxTranslate(), MSDF_ATLAS_GLYPH_FILL_RULE);
|
msdfgen::distanceSignCorrection(output, glyph.getShape(), glyph.getBoxScale(), glyph.getBoxTranslate(), MSDF_ATLAS_GLYPH_FILL_RULE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void msdfGenerator(const msdfgen::BitmapRef<float, 3> &output, const GlyphGeometry &glyph, const GeneratorAttributes &attribs) {
|
void msdfGenerator(const msdfgen::BitmapRef<float, 3> &output, const GlyphGeometry &glyph, const GeneratorAttributes &attribs) {
|
||||||
msdfgen::generateMSDF(output, glyph.getShape(), glyph.getBoxRange(), glyph.getBoxScale(), glyph.getBoxTranslate(), 0, attribs.overlapSupport);
|
msdfgen::generateMSDF(output, glyph.getShape(), glyph.getBoxRange(), glyph.getBoxScale(), glyph.getBoxTranslate(), attribs.errorCorrectionThreshold, attribs.overlapSupport);
|
||||||
if (glyph.isWindingReverse())
|
if (attribs.scanlinePass) {
|
||||||
invertColor(output);
|
|
||||||
if (attribs.scanlinePass)
|
|
||||||
msdfgen::distanceSignCorrection(output, glyph.getShape(), glyph.getBoxScale(), glyph.getBoxTranslate(), MSDF_ATLAS_GLYPH_FILL_RULE);
|
msdfgen::distanceSignCorrection(output, glyph.getShape(), glyph.getBoxScale(), glyph.getBoxTranslate(), MSDF_ATLAS_GLYPH_FILL_RULE);
|
||||||
if (attribs.errorCorrectionThreshold > 0)
|
if (attribs.errorCorrectionThreshold > 0)
|
||||||
msdfgen::msdfErrorCorrection(output, attribs.errorCorrectionThreshold/(glyph.getBoxScale()*glyph.getBoxRange()));
|
msdfgen::msdfErrorCorrection(output, attribs.errorCorrectionThreshold/(glyph.getBoxScale()*glyph.getBoxRange()));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void mtsdfGenerator(const msdfgen::BitmapRef<float, 4> &output, const GlyphGeometry &glyph, const GeneratorAttributes &attribs) {
|
void mtsdfGenerator(const msdfgen::BitmapRef<float, 4> &output, const GlyphGeometry &glyph, const GeneratorAttributes &attribs) {
|
||||||
msdfgen::generateMTSDF(output, glyph.getShape(), glyph.getBoxRange(), glyph.getBoxScale(), glyph.getBoxTranslate(), 0, attribs.overlapSupport);
|
msdfgen::generateMTSDF(output, glyph.getShape(), glyph.getBoxRange(), glyph.getBoxScale(), glyph.getBoxTranslate(), attribs.errorCorrectionThreshold, attribs.overlapSupport);
|
||||||
if (glyph.isWindingReverse())
|
if (attribs.scanlinePass) {
|
||||||
invertColor(output);
|
|
||||||
if (attribs.scanlinePass)
|
|
||||||
msdfgen::distanceSignCorrection(output, glyph.getShape(), glyph.getBoxScale(), glyph.getBoxTranslate(), MSDF_ATLAS_GLYPH_FILL_RULE);
|
msdfgen::distanceSignCorrection(output, glyph.getShape(), glyph.getBoxScale(), glyph.getBoxTranslate(), MSDF_ATLAS_GLYPH_FILL_RULE);
|
||||||
if (attribs.errorCorrectionThreshold > 0)
|
if (attribs.errorCorrectionThreshold > 0)
|
||||||
msdfgen::msdfErrorCorrection(output, attribs.errorCorrectionThreshold/(glyph.getBoxScale()*glyph.getBoxRange()));
|
msdfgen::msdfErrorCorrection(output, attribs.errorCorrectionThreshold/(glyph.getBoxScale()*glyph.getBoxRange()));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* MULTI-CHANNEL SIGNED DISTANCE FIELD ATLAS GENERATOR v1.0 (2020-03-08) - standalone console program
|
* MULTI-CHANNEL SIGNED DISTANCE FIELD ATLAS GENERATOR v1.1 (2020-10-18) - standalone console program
|
||||||
* --------------------------------------------------------------------------------------------------
|
* --------------------------------------------------------------------------------------------------
|
||||||
* A utility by Viktor Chlumsky, (c) 2020
|
* A utility by Viktor Chlumsky, (c) 2020
|
||||||
*
|
*
|
||||||
|
|
@ -27,9 +27,17 @@ using namespace msdf_atlas;
|
||||||
#define GLYPH_FILL_RULE msdfgen::FILL_NONZERO
|
#define GLYPH_FILL_RULE msdfgen::FILL_NONZERO
|
||||||
#define MCG_MULTIPLIER 6364136223846793005ull
|
#define MCG_MULTIPLIER 6364136223846793005ull
|
||||||
|
|
||||||
|
#ifdef MSDFGEN_USE_SKIA
|
||||||
|
#define TITLE_SUFFIX " & Skia"
|
||||||
|
#define EXTRA_UNDERLINE "-------"
|
||||||
|
#else
|
||||||
|
#define TITLE_SUFFIX
|
||||||
|
#define EXTRA_UNDERLINE
|
||||||
|
#endif
|
||||||
|
|
||||||
static const char * const helpText = R"(
|
static const char * const helpText = R"(
|
||||||
MSDF Atlas Generator by Viktor Chlumsky v)" MSDF_ATLAS_VERSION R"( (with MSDFGEN v)" MSDFGEN_VERSION R"()
|
MSDF Atlas Generator by Viktor Chlumsky v)" MSDF_ATLAS_VERSION R"( (with MSDFGEN v)" MSDFGEN_VERSION TITLE_SUFFIX R"()
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------)" EXTRA_UNDERLINE R"(
|
||||||
|
|
||||||
INPUT SPECIFICATION
|
INPUT SPECIFICATION
|
||||||
-font <filename.ttf/otf>
|
-font <filename.ttf/otf>
|
||||||
|
|
@ -76,13 +84,27 @@ DISTANCE FIELD GENERATOR SETTINGS
|
||||||
-errorcorrection <threshold>
|
-errorcorrection <threshold>
|
||||||
Changes the threshold used to detect and correct potential artifacts. 0 disables error correction. (msdf / mtsdf only)
|
Changes the threshold used to detect and correct potential artifacts. 0 disables error correction. (msdf / mtsdf only)
|
||||||
-miterlimit <value>
|
-miterlimit <value>
|
||||||
Sets the miter limit that limits the extension of each glyph's bounding box due to very sharp corners. (psdf / msdf / mtsdf only)
|
Sets the miter limit that limits the extension of each glyph's bounding box due to very sharp corners. (psdf / msdf / mtsdf only))"
|
||||||
|
#ifdef MSDFGEN_USE_SKIA
|
||||||
|
R"(
|
||||||
|
-overlap
|
||||||
|
Switches to distance field generator with support for overlapping contours.
|
||||||
|
-nopreprocess
|
||||||
|
Disables path preprocessing which resolves self-intersections and overlapping contours.
|
||||||
|
-scanline
|
||||||
|
Performs an additional scanline pass to fix the signs of the distances.)"
|
||||||
|
#else
|
||||||
|
R"(
|
||||||
-nooverlap
|
-nooverlap
|
||||||
Disables resolution of overlapping contours.
|
Disables resolution of overlapping contours.
|
||||||
-noscanline
|
-noscanline
|
||||||
Disables the scanline pass, which corrects the distance field's signs according to the non-zero fill rule.
|
Disables the scanline pass, which corrects the distance field's signs according to the non-zero fill rule.)"
|
||||||
|
#endif
|
||||||
|
R"(
|
||||||
-seed <N>
|
-seed <N>
|
||||||
Sets the initial seed for the edge coloring heuristic.
|
Sets the initial seed for the edge coloring heuristic.
|
||||||
|
-threads <N>
|
||||||
|
Sets the number of threads for the parallel computation. (0 = auto)
|
||||||
)";
|
)";
|
||||||
|
|
||||||
static char toupper(char c) {
|
static char toupper(char c) {
|
||||||
|
|
@ -123,12 +145,12 @@ static bool cmpExtension(const char *path, const char *ext) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void loadGlyphs(std::vector<GlyphGeometry> &glyphs, msdfgen::FontHandle *font, const Charset &charset) {
|
static void loadGlyphs(std::vector<GlyphGeometry> &glyphs, msdfgen::FontHandle *font, const Charset &charset, bool preprocessGeometry) {
|
||||||
glyphs.clear();
|
glyphs.clear();
|
||||||
glyphs.reserve(charset.size());
|
glyphs.reserve(charset.size());
|
||||||
for (unicode_t cp : charset) {
|
for (unicode_t cp : charset) {
|
||||||
GlyphGeometry glyph;
|
GlyphGeometry glyph;
|
||||||
if (glyph.load(font, cp))
|
if (glyph.load(font, cp, preprocessGeometry))
|
||||||
glyphs.push_back((GlyphGeometry &&) glyph);
|
glyphs.push_back((GlyphGeometry &&) glyph);
|
||||||
else
|
else
|
||||||
printf("Glyph for codepoint 0x%X missing\n", cp);
|
printf("Glyph for codepoint 0x%X missing\n", cp);
|
||||||
|
|
@ -145,6 +167,7 @@ struct Configuration {
|
||||||
double miterLimit;
|
double miterLimit;
|
||||||
unsigned long long coloringSeed;
|
unsigned long long coloringSeed;
|
||||||
GeneratorAttributes generatorAttributes;
|
GeneratorAttributes generatorAttributes;
|
||||||
|
bool preprocessGeometry;
|
||||||
int threadCount;
|
int threadCount;
|
||||||
const char *arteryFontFilename;
|
const char *arteryFontFilename;
|
||||||
const char *imageFilename;
|
const char *imageFilename;
|
||||||
|
|
@ -196,8 +219,15 @@ int main(int argc, const char * const *argv) {
|
||||||
config.imageFormat = ImageFormat::UNSPECIFIED;
|
config.imageFormat = ImageFormat::UNSPECIFIED;
|
||||||
const char *imageFormatName = nullptr;
|
const char *imageFormatName = nullptr;
|
||||||
int fixedWidth = -1, fixedHeight = -1;
|
int fixedWidth = -1, fixedHeight = -1;
|
||||||
config.generatorAttributes.overlapSupport = true;
|
config.preprocessGeometry = (
|
||||||
config.generatorAttributes.scanlinePass = true;
|
#ifdef MSDFGEN_USE_SKIA
|
||||||
|
true
|
||||||
|
#else
|
||||||
|
false
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
config.generatorAttributes.overlapSupport = !config.preprocessGeometry;
|
||||||
|
config.generatorAttributes.scanlinePass = !config.preprocessGeometry;
|
||||||
config.generatorAttributes.errorCorrectionThreshold = MSDFGEN_DEFAULT_ERROR_CORRECTION_THRESHOLD;
|
config.generatorAttributes.errorCorrectionThreshold = MSDFGEN_DEFAULT_ERROR_CORRECTION_THRESHOLD;
|
||||||
double minEmSize = 0;
|
double minEmSize = 0;
|
||||||
enum {
|
enum {
|
||||||
|
|
@ -210,7 +240,7 @@ int main(int argc, const char * const *argv) {
|
||||||
TightAtlasPacker::DimensionsConstraint atlasSizeConstraint = TightAtlasPacker::DimensionsConstraint::MULTIPLE_OF_FOUR_SQUARE;
|
TightAtlasPacker::DimensionsConstraint atlasSizeConstraint = TightAtlasPacker::DimensionsConstraint::MULTIPLE_OF_FOUR_SQUARE;
|
||||||
config.angleThreshold = DEFAULT_ANGLE_THRESHOLD;
|
config.angleThreshold = DEFAULT_ANGLE_THRESHOLD;
|
||||||
config.miterLimit = DEFAULT_MITER_LIMIT;
|
config.miterLimit = DEFAULT_MITER_LIMIT;
|
||||||
config.threadCount = std::max((int) std::thread::hardware_concurrency(), 1);
|
config.threadCount = 0;
|
||||||
|
|
||||||
// Parse command line
|
// Parse command line
|
||||||
int argPos = 1;
|
int argPos = 1;
|
||||||
|
|
@ -394,11 +424,26 @@ int main(int argc, const char * const *argv) {
|
||||||
++argPos;
|
++argPos;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
ARG_CASE("-nopreprocess", 0) {
|
||||||
|
config.preprocessGeometry = false;
|
||||||
|
argPos += 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
ARG_CASE("-preprocess", 0) {
|
||||||
|
config.preprocessGeometry = true;
|
||||||
|
argPos += 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
ARG_CASE("-nooverlap", 0) {
|
ARG_CASE("-nooverlap", 0) {
|
||||||
config.generatorAttributes.overlapSupport = false;
|
config.generatorAttributes.overlapSupport = false;
|
||||||
argPos += 1;
|
argPos += 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
ARG_CASE("-overlap", 0) {
|
||||||
|
config.generatorAttributes.overlapSupport = true;
|
||||||
|
argPos += 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
ARG_CASE("-noscanline", 0) {
|
ARG_CASE("-noscanline", 0) {
|
||||||
config.generatorAttributes.scanlinePass = false;
|
config.generatorAttributes.scanlinePass = false;
|
||||||
argPos += 1;
|
argPos += 1;
|
||||||
|
|
@ -415,6 +460,14 @@ int main(int argc, const char * const *argv) {
|
||||||
argPos += 2;
|
argPos += 2;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
ARG_CASE("-threads", 1) {
|
||||||
|
unsigned tc;
|
||||||
|
if (!parseUnsigned(tc, argv[argPos+1]) || (int) tc < 0)
|
||||||
|
ABORT("Invalid thread count. Use -threads <N> with N being a non-negative integer.");
|
||||||
|
config.threadCount = (int) tc;
|
||||||
|
argPos += 2;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
ARG_CASE("-help", 0) {
|
ARG_CASE("-help", 0) {
|
||||||
puts(helpText);
|
puts(helpText);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -462,6 +515,8 @@ int main(int argc, const char * const *argv) {
|
||||||
rangeMode = RANGE_PIXEL;
|
rangeMode = RANGE_PIXEL;
|
||||||
rangeValue = DEFAULT_PIXEL_RANGE;
|
rangeValue = DEFAULT_PIXEL_RANGE;
|
||||||
}
|
}
|
||||||
|
if (config.threadCount <= 0)
|
||||||
|
config.threadCount = std::max((int) std::thread::hardware_concurrency(), 1);
|
||||||
|
|
||||||
// Finalize image format
|
// Finalize image format
|
||||||
ImageFormat imageExtension = ImageFormat::UNSPECIFIED;
|
ImageFormat imageExtension = ImageFormat::UNSPECIFIED;
|
||||||
|
|
@ -547,7 +602,7 @@ int main(int argc, const char * const *argv) {
|
||||||
|
|
||||||
// Load glyphs
|
// Load glyphs
|
||||||
std::vector<GlyphGeometry> glyphs;
|
std::vector<GlyphGeometry> glyphs;
|
||||||
loadGlyphs(glyphs, font, charset);
|
loadGlyphs(glyphs, font, charset, config.preprocessGeometry);
|
||||||
printf("Loaded geometry of %d out of %d characters.\n", (int) glyphs.size(), (int) charset.size());
|
printf("Loaded geometry of %d out of %d characters.\n", (int) glyphs.size(), (int) charset.size());
|
||||||
|
|
||||||
// Determine final atlas dimensions, scale and range, pack glyphs
|
// Determine final atlas dimensions, scale and range, pack glyphs
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* MULTI-CHANNEL SIGNED DISTANCE FIELD ATLAS GENERATOR v1.0 (2020-03-08)
|
* MULTI-CHANNEL SIGNED DISTANCE FIELD ATLAS GENERATOR v1.1 (2020-10-18)
|
||||||
* ---------------------------------------------------------------------
|
* ---------------------------------------------------------------------
|
||||||
* A utility by Viktor Chlumsky, (c) 2020
|
* A utility by Viktor Chlumsky, (c) 2020
|
||||||
*
|
*
|
||||||
|
|
@ -38,4 +38,4 @@
|
||||||
#include "json-export.h"
|
#include "json-export.h"
|
||||||
#include "shadron-preview-generator.h"
|
#include "shadron-preview-generator.h"
|
||||||
|
|
||||||
#define MSDF_ATLAS_VERSION "1.0"
|
#define MSDF_ATLAS_VERSION "1.1"
|
||||||
|
|
|
||||||
2
msdfgen
2
msdfgen
|
|
@ -1 +1 @@
|
||||||
Subproject commit 5b5272e7a8bd71a6c7f55951659df69a355486c8
|
Subproject commit 9d22335ea093422d7bf212d31bfaa6adcb9b89f0
|
||||||
Loading…
Reference in New Issue