Compare commits
2 commits
4b0dd3c009
...
e14da13d02
Author | SHA1 | Date | |
---|---|---|---|
|
e14da13d02 | ||
|
efb704185f |
4 changed files with 15 additions and 46 deletions
|
@ -28,40 +28,6 @@
|
||||||
# $ make
|
# $ make
|
||||||
# $ sudo make install
|
# $ sudo make install
|
||||||
#
|
#
|
||||||
# emscripten notes:
|
|
||||||
# additionally to the depencies below
|
|
||||||
# you may have to build freetype from source
|
|
||||||
# and with that also bzip2
|
|
||||||
# $
|
|
||||||
# $ # tinyxml2:
|
|
||||||
# $ cd your/favorite/persistent/build/directory
|
|
||||||
# $ git clone https://github.com/leethomason/tinyxml2.git
|
|
||||||
# $ cd tinyxml2
|
|
||||||
# $ mkdir build && cd build
|
|
||||||
# $ emcmake cmake ..
|
|
||||||
# $ emmake make
|
|
||||||
# $ emmake make install
|
|
||||||
# $
|
|
||||||
# $ # zlib:
|
|
||||||
# $ cd your/favorite/persistent/build/directory
|
|
||||||
# $ wget https://www.zlib.net/zlib-1.2.13.tar.gz
|
|
||||||
# $ tar -xf zlib-1.2.13.tar.gz
|
|
||||||
# $ cd zlib-1.2.13.tar.gz
|
|
||||||
# $ mkdir build && cd build
|
|
||||||
# $ emcmake cmake ..
|
|
||||||
# $ emmake make
|
|
||||||
# $ emmake make install
|
|
||||||
# $
|
|
||||||
# $ # libpng:
|
|
||||||
# $ cd your/favorite/persistent/build/directory
|
|
||||||
# $ wget https://sourceforge.net/projects/libpng/files/libpng16/1.6.39/libpng-1.6.39.tar.xz/download -O libpng-1.6.39.tar.xz
|
|
||||||
# $ tar -xf libpng-1.6.39.tar.xz
|
|
||||||
# $ cd libpng-1.6.39
|
|
||||||
# $ mkdir build && cd build
|
|
||||||
# $ emcmake cmake ..
|
|
||||||
# $ emmake make
|
|
||||||
# $ emmake make install
|
|
||||||
|
|
||||||
|
|
||||||
# array of build types supported by this formula
|
# array of build types supported by this formula
|
||||||
# you can delete this to implicitly support *all* types
|
# you can delete this to implicitly support *all* types
|
||||||
|
@ -134,6 +100,9 @@ function prepare() {
|
||||||
|
|
||||||
PREV_DIR="$(pwd)"
|
PREV_DIR="$(pwd)"
|
||||||
|
|
||||||
|
# NOTE: currently, these are being build and installed in the emscripten sdk directory
|
||||||
|
# however, it would be better to put the sources in the ofxMsdfgen/libs directory
|
||||||
|
# and build them from there
|
||||||
if [ "$TYPE" == "emscripten" ] ; then
|
if [ "$TYPE" == "emscripten" ] ; then
|
||||||
echo "preparing $TYPE thirdparty dependencies"
|
echo "preparing $TYPE thirdparty dependencies"
|
||||||
if decision "download, build and install all thirdparty dependencies" $PROBABLY_YES; then
|
if decision "download, build and install all thirdparty dependencies" $PROBABLY_YES; then
|
||||||
|
|
18
src/Atlas.h
18
src/Atlas.h
|
@ -27,7 +27,7 @@ struct AtlasSettings {
|
||||||
float pixelRange = 2.0;
|
float pixelRange = 2.0;
|
||||||
float miterLimit = 1.0;
|
float miterLimit = 1.0;
|
||||||
float maxInterpolationStepSize = 42.0;
|
float maxInterpolationStepSize = 42.0;
|
||||||
string characters = "charset::ascii";
|
std::string characters = "charset::ascii";
|
||||||
#ifdef TARGET_EMSCRIPTEN
|
#ifdef TARGET_EMSCRIPTEN
|
||||||
int threadCount = 1;
|
int threadCount = 1;
|
||||||
#else
|
#else
|
||||||
|
@ -35,7 +35,7 @@ struct AtlasSettings {
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
struct FontVariation {
|
struct FontVariation {
|
||||||
string name;
|
std::string name;
|
||||||
float value;
|
float value;
|
||||||
bool operator==(const FontVariation & other) const {
|
bool operator==(const FontVariation & other) const {
|
||||||
return (name == other.name
|
return (name == other.name
|
||||||
|
@ -43,7 +43,7 @@ struct FontVariation {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
struct FontVariationAxis {
|
struct FontVariationAxis {
|
||||||
string name;
|
std::string name;
|
||||||
float minValue;
|
float minValue;
|
||||||
float maxValue;
|
float maxValue;
|
||||||
float defaultValue;
|
float defaultValue;
|
||||||
|
@ -84,8 +84,8 @@ class Atlas {
|
||||||
public:
|
public:
|
||||||
Atlas();
|
Atlas();
|
||||||
~Atlas();
|
~Atlas();
|
||||||
void setup(string _fontPath);
|
void setup(std::string _fontPath);
|
||||||
void setup(string _fontPath, AtlasSettings _settings);
|
void setup(std::string _fontPath, AtlasSettings _settings);
|
||||||
void addVariations(vector <FontVariation> variations);
|
void addVariations(vector <FontVariation> variations);
|
||||||
bool generate(bool useCache = true,
|
bool generate(bool useCache = true,
|
||||||
bool saveToCache = false);
|
bool saveToCache = false);
|
||||||
|
@ -106,13 +106,13 @@ class Atlas {
|
||||||
AtlasSettings settings;
|
AtlasSettings settings;
|
||||||
msdfgen::FontHandle * font;
|
msdfgen::FontHandle * font;
|
||||||
msdfgen::FreetypeHandle * ft;
|
msdfgen::FreetypeHandle * ft;
|
||||||
string getAtlasPathDir();
|
std::string getAtlasPathDir();
|
||||||
string getAtlasPath();
|
std::string getAtlasPath();
|
||||||
private:
|
private:
|
||||||
string fontPath;
|
std::string fontPath;
|
||||||
ofImage atlasImage;
|
ofImage atlasImage;
|
||||||
vector <GlyphGeometry> glyphGeometries;
|
vector <GlyphGeometry> glyphGeometries;
|
||||||
unordered_map <GlyphVariationKey, int> glyphGeometryMap;
|
std::unordered_map <GlyphVariationKey, int> glyphGeometryMap;
|
||||||
vector <FontVariationAxis> variationAxesAvailable;
|
vector <FontVariationAxis> variationAxesAvailable;
|
||||||
vector <FontVariation> variationExtremes;
|
vector <FontVariation> variationExtremes;
|
||||||
vector <FontVariation> variationSteps;
|
vector <FontVariation> variationSteps;
|
||||||
|
|
|
@ -30,11 +30,11 @@ void ofxMsdfgen::toOfImage(const msdfgen::Bitmap <float, 3> bitmap,
|
||||||
image.update();
|
image.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ofxMsdfgen::toOfImage(const msdfgen::Bitmap <byte, 3> bitmap,
|
void ofxMsdfgen::toOfImage(const msdfgen::Bitmap <std::byte, 3> bitmap,
|
||||||
ofImage & image){
|
ofImage & image){
|
||||||
image.allocate(bitmap.width(), bitmap.height(), OF_IMAGE_COLOR);
|
image.allocate(bitmap.width(), bitmap.height(), OF_IMAGE_COLOR);
|
||||||
image.getTexture().getTextureData().bFlipTexture = true;
|
image.getTexture().getTextureData().bFlipTexture = true;
|
||||||
memcpy(image.getPixels().getData(), static_cast <const byte *>(bitmap), bitmap.width() * bitmap.height() * 3 * sizeof(byte));
|
memcpy(image.getPixels().getData(), static_cast <const std::byte *>(bitmap), bitmap.width() * bitmap.height() * 3 * sizeof(std::byte));
|
||||||
|
|
||||||
image.update();
|
image.update();
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ void toOfImage(const msdfgen::Bitmap <float, 3> bitmap,
|
||||||
ofFloatImage & image);
|
ofFloatImage & image);
|
||||||
void toOfImage(const msdfgen::Bitmap <float, 3> bitmap,
|
void toOfImage(const msdfgen::Bitmap <float, 3> bitmap,
|
||||||
ofImage & image);
|
ofImage & image);
|
||||||
void toOfImage(const msdfgen::Bitmap <byte, 3> bitmap,
|
void toOfImage(const msdfgen::Bitmap <std::byte, 3> bitmap,
|
||||||
ofImage & image);
|
ofImage & image);
|
||||||
ofImage toOfImage(const msdfgen::Bitmap <float, 3>);
|
ofImage toOfImage(const msdfgen::Bitmap <float, 3>);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue