Dependency configuration optimized
This commit is contained in:
parent
bed35b13b0
commit
f424021a2b
|
|
@ -12,6 +12,7 @@ option(MSDF_ATLAS_DYNAMIC_RUNTIME "Link dynamic runtime library instead of stati
|
||||||
option(BUILD_SHARED_LIBS "Generate dynamic library files instead of static" OFF)
|
option(BUILD_SHARED_LIBS "Generate dynamic library files instead of static" OFF)
|
||||||
|
|
||||||
if(NOT MSDF_ATLAS_MSDFGEN_EXTERNAL)
|
if(NOT MSDF_ATLAS_MSDFGEN_EXTERNAL)
|
||||||
|
set(MSDFGEN_DISABLE_SVG ON CACHE BOOL "Disable unused SVG functionality to minimize dependencies")
|
||||||
set(MSDFGEN_CORE_ONLY OFF CACHE INTERNAL "Only build the core msdfgen library with no dependencies (disabled for msdf-atlas-gen)" FORCE)
|
set(MSDFGEN_CORE_ONLY OFF CACHE INTERNAL "Only build the core msdfgen library with no dependencies (disabled for msdf-atlas-gen)" FORCE)
|
||||||
set(MSDFGEN_BUILD_STANDALONE OFF CACHE BOOL "Build the msdfgen standalone executable")
|
set(MSDFGEN_BUILD_STANDALONE OFF CACHE BOOL "Build the msdfgen standalone executable")
|
||||||
set(MSDFGEN_USE_VCPKG ${MSDF_ATLAS_USE_VCPKG} CACHE INTERNAL "Use vcpkg package manager to link msdfgen project dependencies" FORCE)
|
set(MSDFGEN_USE_VCPKG ${MSDF_ATLAS_USE_VCPKG} CACHE INTERNAL "Use vcpkg package manager to link msdfgen project dependencies" FORCE)
|
||||||
|
|
@ -82,7 +83,7 @@ else()
|
||||||
add_subdirectory(msdfgen)
|
add_subdirectory(msdfgen)
|
||||||
endif()
|
endif()
|
||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
if(NOT TARGET PNG::PNG)
|
if(NOT MSDFGEN_DISABLE_PNG AND NOT TARGET PNG::PNG)
|
||||||
find_package(PNG REQUIRED)
|
find_package(PNG REQUIRED)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
@ -113,7 +114,10 @@ endif()
|
||||||
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT msdf-atlas-gen)
|
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT msdf-atlas-gen)
|
||||||
|
|
||||||
target_compile_features(msdf-atlas-gen PUBLIC cxx_std_11)
|
target_compile_features(msdf-atlas-gen PUBLIC cxx_std_11)
|
||||||
target_link_libraries(msdf-atlas-gen PRIVATE Threads::Threads PNG::PNG)
|
target_link_libraries(msdf-atlas-gen PRIVATE Threads::Threads)
|
||||||
|
if(NOT MSDFGEN_DISABLE_PNG)
|
||||||
|
target_link_libraries(msdf-atlas-gen PRIVATE PNG::PNG)
|
||||||
|
endif()
|
||||||
target_link_libraries(msdf-atlas-gen PUBLIC msdfgen::msdfgen)
|
target_link_libraries(msdf-atlas-gen PUBLIC msdfgen::msdfgen)
|
||||||
|
|
||||||
if(BUILD_SHARED_LIBS AND WIN32)
|
if(BUILD_SHARED_LIBS AND WIN32)
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,8 @@ The atlas generator can generate the following six types of atlases.
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
- *Sharp corners* refers to preservation of corner sharpness when upscaled.
|
- *Sharp corners* refers to preservation of corner sharpness when upscaled.
|
||||||
- *Soft effects* refers to the support of effects that use true distance, such as glows, rounded borders, or simplified shadows.
|
- *Soft effects* refers to the support of effects that use true distance, such as glows, rounded outlines, or simplified shadows.
|
||||||
- *Hard effects* refers to the support of effects that use pseudo-distance, such as mitered borders or thickness adjustment.
|
- *Hard effects* refers to the support of effects that use perpendicular distance, such as mitered outlines or thickness adjustment.
|
||||||
|
|
||||||
## Getting started
|
## Getting started
|
||||||
|
|
||||||
|
|
@ -63,7 +63,7 @@ Use the following command line arguments for the standalone version of the atlas
|
||||||
- `hardmask` – a non-anti-aliased binary image
|
- `hardmask` – a non-anti-aliased binary image
|
||||||
- `softmask` – an anti-aliased image
|
- `softmask` – an anti-aliased image
|
||||||
- `sdf` – a true signed distance field (SDF)
|
- `sdf` – a true signed distance field (SDF)
|
||||||
- `psdf` – a pseudo-distance field
|
- `psdf` – a signed perpendicular distance field (PSDF)
|
||||||
- `msdf` (default) – a multi-channel signed distance field (MSDF)
|
- `msdf` (default) – a multi-channel signed distance field (MSDF)
|
||||||
- `mtsdf` – a combination of MSDF and true SDF in the alpha channel
|
- `mtsdf` – a combination of MSDF and true SDF in the alpha channel
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,11 @@
|
||||||
include(CMakeFindDependencyMacro)
|
include(CMakeFindDependencyMacro)
|
||||||
|
|
||||||
set(MSDF_ATLAS_STANDALONE_AVAILABLE @MSDF_ATLAS_BUILD_STANDALONE@)
|
set(MSDF_ATLAS_STANDALONE_AVAILABLE @MSDF_ATLAS_BUILD_STANDALONE@)
|
||||||
|
set(MSDF_ATLAS_NO_PNG @MSDFGEN_DISABLE_PNG@)
|
||||||
|
|
||||||
find_dependency(PNG REQUIRED)
|
if(NOT MSDF_ATLAS_NO_PNG)
|
||||||
|
find_dependency(PNG REQUIRED)
|
||||||
|
endif()
|
||||||
find_dependency(msdfgen REQUIRED)
|
find_dependency(msdfgen REQUIRED)
|
||||||
|
|
||||||
include("${CMAKE_CURRENT_LIST_DIR}/msdf-atlas-gen-targets.cmake")
|
include("${CMAKE_CURRENT_LIST_DIR}/msdf-atlas-gen-targets.cmake")
|
||||||
|
|
|
||||||
|
|
@ -134,12 +134,14 @@ bool exportArteryFont(const FontGeometry *fonts, int fontCount, const msdfgen::B
|
||||||
image.channels = N;
|
image.channels = N;
|
||||||
image.imageType = convertImageType(properties.imageType);
|
image.imageType = convertImageType(properties.imageType);
|
||||||
switch (properties.imageFormat) {
|
switch (properties.imageFormat) {
|
||||||
|
#ifndef MSDFGEN_DISABLE_PNG
|
||||||
case ImageFormat::PNG:
|
case ImageFormat::PNG:
|
||||||
image.encoding = artery_font::IMAGE_PNG;
|
image.encoding = artery_font::IMAGE_PNG;
|
||||||
image.pixelFormat = artery_font::PIXEL_UNSIGNED8;
|
image.pixelFormat = artery_font::PIXEL_UNSIGNED8;
|
||||||
if (!encodePng((std::vector<byte> &) image.data, atlas))
|
if (!encodePng((std::vector<byte> &) image.data, atlas))
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
case ImageFormat::TIFF:
|
case ImageFormat::TIFF:
|
||||||
image.encoding = artery_font::IMAGE_TIFF;
|
image.encoding = artery_font::IMAGE_TIFF;
|
||||||
image.pixelFormat = artery_font::PIXEL_FLOAT32;
|
image.pixelFormat = artery_font::PIXEL_FLOAT32;
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ void sdfGenerator(const msdfgen::BitmapRef<float, 1> &output, const GlyphGeometr
|
||||||
}
|
}
|
||||||
|
|
||||||
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.getBoxProjection(), glyph.getBoxRange(), attribs.config);
|
msdfgen::generatePSDF(output, glyph.getShape(), glyph.getBoxProjection(), glyph.getBoxRange(), attribs.config);
|
||||||
if (attribs.scanlinePass)
|
if (attribs.scanlinePass)
|
||||||
msdfgen::distanceSignCorrection(output, glyph.getShape(), glyph.getBoxProjection(), MSDF_ATLAS_GLYPH_FILL_RULE);
|
msdfgen::distanceSignCorrection(output, glyph.getShape(), glyph.getBoxProjection(), MSDF_ATLAS_GLYPH_FILL_RULE);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ namespace msdf_atlas {
|
||||||
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);
|
||||||
/// Generates a true signed distance field of the glyph
|
/// Generates a true signed distance field of the glyph
|
||||||
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);
|
||||||
/// Generates a signed pseudo-distance field of the glyph
|
/// Generates a signed perpendicular distance field of the glyph
|
||||||
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);
|
||||||
/// Generates a multi-channel signed distance field of the glyph
|
/// Generates a multi-channel signed distance field of the glyph
|
||||||
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);
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,8 @@
|
||||||
#include <msdfgen.h>
|
#include <msdfgen.h>
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
|
#ifndef MSDFGEN_DISABLE_PNG
|
||||||
|
|
||||||
namespace msdf_atlas {
|
namespace msdf_atlas {
|
||||||
|
|
||||||
// Functions to encode an image as a sequence of bytes in memory
|
// Functions to encode an image as a sequence of bytes in memory
|
||||||
|
|
@ -18,3 +20,5 @@ bool encodePng(std::vector<byte> &output, const msdfgen::BitmapConstRef<float, 3
|
||||||
bool encodePng(std::vector<byte> &output, const msdfgen::BitmapConstRef<float, 4> &bitmap);
|
bool encodePng(std::vector<byte> &output, const msdfgen::BitmapConstRef<float, 4> &bitmap);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,10 @@ bool saveImageText(const msdfgen::BitmapConstRef<float, N> &bitmap, const char *
|
||||||
template <int N>
|
template <int N>
|
||||||
bool saveImage(const msdfgen::BitmapConstRef<byte, N> &bitmap, ImageFormat format, const char *filename, YDirection outputYDirection) {
|
bool saveImage(const msdfgen::BitmapConstRef<byte, N> &bitmap, ImageFormat format, const char *filename, YDirection outputYDirection) {
|
||||||
switch (format) {
|
switch (format) {
|
||||||
|
#ifndef MSDFGEN_DISABLE_PNG
|
||||||
case ImageFormat::PNG:
|
case ImageFormat::PNG:
|
||||||
return msdfgen::savePng(bitmap, filename);
|
return msdfgen::savePng(bitmap, filename);
|
||||||
|
#endif
|
||||||
case ImageFormat::BMP:
|
case ImageFormat::BMP:
|
||||||
return msdfgen::saveBmp(bitmap, filename);
|
return msdfgen::saveBmp(bitmap, filename);
|
||||||
case ImageFormat::TIFF:
|
case ImageFormat::TIFF:
|
||||||
|
|
@ -44,8 +46,10 @@ bool saveImage(const msdfgen::BitmapConstRef<byte, N> &bitmap, ImageFormat forma
|
||||||
template <int N>
|
template <int N>
|
||||||
bool saveImage(const msdfgen::BitmapConstRef<float, N> &bitmap, ImageFormat format, const char *filename, YDirection outputYDirection) {
|
bool saveImage(const msdfgen::BitmapConstRef<float, N> &bitmap, ImageFormat format, const char *filename, YDirection outputYDirection) {
|
||||||
switch (format) {
|
switch (format) {
|
||||||
|
#ifndef MSDFGEN_DISABLE_PNG
|
||||||
case ImageFormat::PNG:
|
case ImageFormat::PNG:
|
||||||
return msdfgen::savePng(bitmap, filename);
|
return msdfgen::savePng(bitmap, filename);
|
||||||
|
#endif
|
||||||
case ImageFormat::BMP:
|
case ImageFormat::BMP:
|
||||||
return msdfgen::saveBmp(bitmap, filename);
|
return msdfgen::saveBmp(bitmap, filename);
|
||||||
case ImageFormat::TIFF:
|
case ImageFormat::TIFF:
|
||||||
|
|
|
||||||
|
|
@ -57,9 +57,13 @@ MSDF Atlas Generator by Viktor Chlumsky v)" MSDF_ATLAS_VERSION_STRING R"( (with
|
||||||
|
|
||||||
INPUT SPECIFICATION
|
INPUT SPECIFICATION
|
||||||
-font <filename.ttf/otf>
|
-font <filename.ttf/otf>
|
||||||
Specifies the input TrueType / OpenType font file. A font specification is required.
|
Specifies the input TrueType / OpenType font file. A font specification is required.)"
|
||||||
|
#ifndef MSDFGEN_DISABLE_VARIABLE_FONTS
|
||||||
|
R"(
|
||||||
-varfont <filename.ttf/otf?var0=value0&var1=value1>
|
-varfont <filename.ttf/otf?var0=value0&var1=value1>
|
||||||
Specifies an input variable font file and configures its variables.
|
Specifies an input variable font file and configures its variables.)"
|
||||||
|
#endif
|
||||||
|
R"(
|
||||||
-charset <filename>
|
-charset <filename>
|
||||||
Specifies the input character set. Refer to the documentation for format of charset specification. Defaults to ASCII.
|
Specifies the input character set. Refer to the documentation for format of charset specification. Defaults to ASCII.
|
||||||
-glyphset <filename>
|
-glyphset <filename>
|
||||||
|
|
@ -76,7 +80,13 @@ INPUT SPECIFICATION
|
||||||
ATLAS CONFIGURATION
|
ATLAS CONFIGURATION
|
||||||
-type <hardmask / softmask / sdf / psdf / msdf / mtsdf>
|
-type <hardmask / softmask / sdf / psdf / msdf / mtsdf>
|
||||||
Selects the type of atlas to be generated.
|
Selects the type of atlas to be generated.
|
||||||
-format <png / bmp / tiff / text / textfloat / bin / binfloat / binfloatbe>
|
)"
|
||||||
|
#ifndef MSDFGEN_DISABLE_PNG
|
||||||
|
R"( -format <png / bmp / tiff / text / textfloat / bin / binfloat / binfloatbe>)"
|
||||||
|
#else
|
||||||
|
R"( -format <bmp / tiff / text / textfloat / bin / binfloat / binfloatbe>)"
|
||||||
|
#endif
|
||||||
|
R"(
|
||||||
Selects the format for the atlas image output. Some image formats may be incompatible with embedded output formats.
|
Selects the format for the atlas image output. Some image formats may be incompatible with embedded output formats.
|
||||||
-dimensions <width> <height>
|
-dimensions <width> <height>
|
||||||
Sets the atlas to have fixed dimensions (width x height).
|
Sets the atlas to have fixed dimensions (width x height).
|
||||||
|
|
@ -90,9 +100,9 @@ ATLAS CONFIGURATION
|
||||||
-uniformcell <width> <height>
|
-uniformcell <width> <height>
|
||||||
Sets fixed dimensions of the grid's cells.
|
Sets fixed dimensions of the grid's cells.
|
||||||
-uniformcellconstraint <none / pots / potr / square / square2 / square4>
|
-uniformcellconstraint <none / pots / potr / square / square2 / square4>
|
||||||
Constrains cell dimensions to the given rule (see -pots / ... above)
|
Constrains cell dimensions to the given rule (see -pots / ... above).
|
||||||
-uniformorigin <off / on / horizontal / vertical>
|
-uniformorigin <off / on / horizontal / vertical>
|
||||||
Sets whether the glyph's origin point should be fixed at the same position in each cell
|
Sets whether the glyph's origin point should be fixed at the same position in each cell.
|
||||||
-yorigin <bottom / top>
|
-yorigin <bottom / top>
|
||||||
Determines whether the Y-axis is oriented upwards (bottom origin, default) or downwards (top origin).
|
Determines whether the Y-axis is oriented upwards (bottom origin, default) or downwards (top origin).
|
||||||
|
|
||||||
|
|
@ -228,6 +238,7 @@ static bool strStartsWith(const char *str, const char *prefix) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef MSDFGEN_DISABLE_VARIABLE_FONTS
|
||||||
static msdfgen::FontHandle *loadVarFont(msdfgen::FreetypeHandle *library, const char *filename) {
|
static msdfgen::FontHandle *loadVarFont(msdfgen::FreetypeHandle *library, const char *filename) {
|
||||||
std::string buffer;
|
std::string buffer;
|
||||||
while (*filename && *filename != '?')
|
while (*filename && *filename != '?')
|
||||||
|
|
@ -250,6 +261,7 @@ static msdfgen::FontHandle *loadVarFont(msdfgen::FreetypeHandle *library, const
|
||||||
}
|
}
|
||||||
return font;
|
return font;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
struct FontInput {
|
struct FontInput {
|
||||||
const char *fontFilename;
|
const char *fontFilename;
|
||||||
|
|
@ -406,9 +418,12 @@ int main(int argc, const char *const *argv) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ARG_CASE("-format", 1) {
|
ARG_CASE("-format", 1) {
|
||||||
if (ARG_IS("png"))
|
#ifndef MSDFGEN_DISABLE_PNG
|
||||||
config.imageFormat = ImageFormat::PNG;
|
if (ARG_IS("png"))
|
||||||
else if (ARG_IS("bmp"))
|
config.imageFormat = ImageFormat::PNG;
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
if (ARG_IS("bmp"))
|
||||||
config.imageFormat = ImageFormat::BMP;
|
config.imageFormat = ImageFormat::BMP;
|
||||||
else if (ARG_IS("tiff"))
|
else if (ARG_IS("tiff"))
|
||||||
config.imageFormat = ImageFormat::TIFF;
|
config.imageFormat = ImageFormat::TIFF;
|
||||||
|
|
@ -422,8 +437,13 @@ int main(int argc, const char *const *argv) {
|
||||||
config.imageFormat = ImageFormat::BINARY_FLOAT;
|
config.imageFormat = ImageFormat::BINARY_FLOAT;
|
||||||
else if (ARG_IS("binfloatbe"))
|
else if (ARG_IS("binfloatbe"))
|
||||||
config.imageFormat = ImageFormat::BINARY_FLOAT_BE;
|
config.imageFormat = ImageFormat::BINARY_FLOAT_BE;
|
||||||
else
|
else {
|
||||||
ABORT("Invalid image format. Valid formats are: png, bmp, tiff, text, textfloat, bin, binfloat");
|
#ifndef MSDFGEN_DISABLE_PNG
|
||||||
|
ABORT("Invalid image format. Valid formats are: png, bmp, tiff, text, textfloat, bin, binfloat");
|
||||||
|
#else
|
||||||
|
ABORT("Invalid image format. Valid formats are: bmp, tiff, text, textfloat, bin, binfloat");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
imageFormatName = arg;
|
imageFormatName = arg;
|
||||||
++argPos;
|
++argPos;
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -433,11 +453,13 @@ int main(int argc, const char *const *argv) {
|
||||||
fontInput.variableFont = false;
|
fontInput.variableFont = false;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
#ifndef MSDFGEN_DISABLE_VARIABLE_FONTS
|
||||||
ARG_CASE("-varfont", 1) {
|
ARG_CASE("-varfont", 1) {
|
||||||
fontInput.fontFilename = argv[argPos++];
|
fontInput.fontFilename = argv[argPos++];
|
||||||
fontInput.variableFont = true;
|
fontInput.variableFont = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
ARG_CASE("-charset", 1) {
|
ARG_CASE("-charset", 1) {
|
||||||
fontInput.charsetFilename = argv[argPos++];
|
fontInput.charsetFilename = argv[argPos++];
|
||||||
fontInput.glyphIdentifierType = GlyphIdentifierType::UNICODE_CODEPOINT;
|
fontInput.glyphIdentifierType = GlyphIdentifierType::UNICODE_CODEPOINT;
|
||||||
|
|
@ -845,21 +867,31 @@ int main(int argc, const char *const *argv) {
|
||||||
// Finalize image format
|
// Finalize image format
|
||||||
ImageFormat imageExtension = ImageFormat::UNSPECIFIED;
|
ImageFormat imageExtension = ImageFormat::UNSPECIFIED;
|
||||||
if (config.imageFilename) {
|
if (config.imageFilename) {
|
||||||
if (cmpExtension(config.imageFilename, ".png")) imageExtension = ImageFormat::PNG;
|
if (cmpExtension(config.imageFilename, ".png")) {
|
||||||
else if (cmpExtension(config.imageFilename, ".bmp")) imageExtension = ImageFormat::BMP;
|
#ifndef MSDFGEN_DISABLE_PNG
|
||||||
|
imageExtension = ImageFormat::PNG;
|
||||||
|
#else
|
||||||
|
fputs("Warning: You are using a version of this program without PNG image support!\n", stderr);
|
||||||
|
#endif
|
||||||
|
} else if (cmpExtension(config.imageFilename, ".bmp")) imageExtension = ImageFormat::BMP;
|
||||||
else if (cmpExtension(config.imageFilename, ".tif") || cmpExtension(config.imageFilename, ".tiff")) imageExtension = ImageFormat::TIFF;
|
else if (cmpExtension(config.imageFilename, ".tif") || cmpExtension(config.imageFilename, ".tiff")) imageExtension = ImageFormat::TIFF;
|
||||||
else if (cmpExtension(config.imageFilename, ".txt")) imageExtension = ImageFormat::TEXT;
|
else if (cmpExtension(config.imageFilename, ".txt")) imageExtension = ImageFormat::TEXT;
|
||||||
else if (cmpExtension(config.imageFilename, ".bin")) imageExtension = ImageFormat::BINARY;
|
else if (cmpExtension(config.imageFilename, ".bin")) imageExtension = ImageFormat::BINARY;
|
||||||
}
|
}
|
||||||
if (config.imageFormat == ImageFormat::UNSPECIFIED) {
|
if (config.imageFormat == ImageFormat::UNSPECIFIED) {
|
||||||
config.imageFormat = ImageFormat::PNG;
|
#ifndef MSDFGEN_DISABLE_PNG
|
||||||
imageFormatName = "png";
|
config.imageFormat = ImageFormat::PNG;
|
||||||
|
imageFormatName = "png";
|
||||||
|
#else
|
||||||
|
config.imageFormat = ImageFormat::TIFF;
|
||||||
|
imageFormatName = "tiff";
|
||||||
|
#endif
|
||||||
// If image format is not specified and -imageout is the only image output, infer format from its extension
|
// If image format is not specified and -imageout is the only image output, infer format from its extension
|
||||||
if (!config.arteryFontFilename) {
|
if (!config.arteryFontFilename) {
|
||||||
if (imageExtension != ImageFormat::UNSPECIFIED)
|
if (imageExtension != ImageFormat::UNSPECIFIED)
|
||||||
config.imageFormat = imageExtension;
|
config.imageFormat = imageExtension;
|
||||||
else if (config.imageFilename)
|
else if (config.imageFilename)
|
||||||
fputs("Warning: Could not infer image format from file extension, PNG will be used.\n", stderr);
|
fprintf(stderr, "Warning: Could not infer image format from file extension, %s will be used.\n", imageFormatName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (config.imageType == ImageType::MTSDF && config.imageFormat == ImageFormat::BMP)
|
if (config.imageType == ImageType::MTSDF && config.imageFormat == ImageFormat::BMP)
|
||||||
|
|
@ -926,7 +958,12 @@ int main(int argc, const char *const *argv) {
|
||||||
return true;
|
return true;
|
||||||
if (font)
|
if (font)
|
||||||
msdfgen::destroyFont(font);
|
msdfgen::destroyFont(font);
|
||||||
if ((font = isVarFont ? loadVarFont(ft, fontFilename) : msdfgen::loadFont(ft, fontFilename))) {
|
if ((font = (
|
||||||
|
#ifndef MSDFGEN_DISABLE_VARIABLE_FONTS
|
||||||
|
isVarFont ? loadVarFont(ft, fontFilename) :
|
||||||
|
#endif
|
||||||
|
msdfgen::loadFont(ft, fontFilename)
|
||||||
|
))) {
|
||||||
this->fontFilename = fontFilename;
|
this->fontFilename = fontFilename;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ enum class ImageType {
|
||||||
SOFT_MASK,
|
SOFT_MASK,
|
||||||
/// Signed (true) distance field
|
/// Signed (true) distance field
|
||||||
SDF,
|
SDF,
|
||||||
/// Signed pseudo-distance field
|
/// Signed perpendicular distance field
|
||||||
PSDF,
|
PSDF,
|
||||||
/// Multi-channel signed distance field
|
/// Multi-channel signed distance field
|
||||||
MSDF,
|
MSDF,
|
||||||
|
|
|
||||||
2
msdfgen
2
msdfgen
|
|
@ -1 +1 @@
|
||||||
Subproject commit 682381a03c5876cffcad256a59eab7efd83c3f4e
|
Subproject commit 937f31ff418e488e4b707a77c294cdb4fadb4235
|
||||||
|
|
@ -7,7 +7,6 @@
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
"freetype",
|
"freetype",
|
||||||
"tinyxml2",
|
|
||||||
"libpng"
|
"libpng"
|
||||||
],
|
],
|
||||||
"default-features": [
|
"default-features": [
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue