diff --git a/scripts/formulas/msdf-atlas-gen.sh b/scripts/formulas/msdf-atlas-gen.sh index 23594c5..c439ab7 100644 --- a/scripts/formulas/msdf-atlas-gen.sh +++ b/scripts/formulas/msdf-atlas-gen.sh @@ -28,40 +28,6 @@ # $ make # $ 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 # you can delete this to implicitly support *all* types @@ -134,6 +100,9 @@ function prepare() { 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 echo "preparing $TYPE thirdparty dependencies" if decision "download, build and install all thirdparty dependencies" $PROBABLY_YES; then diff --git a/src/Atlas.h b/src/Atlas.h index 5f27a87..81b85bb 100644 --- a/src/Atlas.h +++ b/src/Atlas.h @@ -27,7 +27,7 @@ struct AtlasSettings { float pixelRange = 2.0; float miterLimit = 1.0; float maxInterpolationStepSize = 42.0; - string characters = "charset::ascii"; + std::string characters = "charset::ascii"; #ifdef TARGET_EMSCRIPTEN int threadCount = 1; #else @@ -35,7 +35,7 @@ struct AtlasSettings { #endif }; struct FontVariation { - string name; + std::string name; float value; bool operator==(const FontVariation & other) const { return (name == other.name @@ -43,7 +43,7 @@ struct FontVariation { } }; struct FontVariationAxis { - string name; + std::string name; float minValue; float maxValue; float defaultValue; @@ -84,8 +84,8 @@ class Atlas { public: Atlas(); ~Atlas(); - void setup(string _fontPath); - void setup(string _fontPath, AtlasSettings _settings); + void setup(std::string _fontPath); + void setup(std::string _fontPath, AtlasSettings _settings); void addVariations(vector variations); bool generate(bool useCache = true, bool saveToCache = false); @@ -106,13 +106,13 @@ class Atlas { AtlasSettings settings; msdfgen::FontHandle * font; msdfgen::FreetypeHandle * ft; - string getAtlasPathDir(); - string getAtlasPath(); + std::string getAtlasPathDir(); + std::string getAtlasPath(); private: - string fontPath; + std::string fontPath; ofImage atlasImage; vector glyphGeometries; - unordered_map glyphGeometryMap; + std::unordered_map glyphGeometryMap; vector variationAxesAvailable; vector variationExtremes; vector variationSteps; diff --git a/src/conversion.cpp b/src/conversion.cpp index 797e93a..5102ba2 100644 --- a/src/conversion.cpp +++ b/src/conversion.cpp @@ -30,11 +30,11 @@ void ofxMsdfgen::toOfImage(const msdfgen::Bitmap bitmap, image.update(); } -void ofxMsdfgen::toOfImage(const msdfgen::Bitmap bitmap, +void ofxMsdfgen::toOfImage(const msdfgen::Bitmap bitmap, ofImage & image){ image.allocate(bitmap.width(), bitmap.height(), OF_IMAGE_COLOR); image.getTexture().getTextureData().bFlipTexture = true; - memcpy(image.getPixels().getData(), static_cast (bitmap), bitmap.width() * bitmap.height() * 3 * sizeof(byte)); + memcpy(image.getPixels().getData(), static_cast (bitmap), bitmap.width() * bitmap.height() * 3 * sizeof(std::byte)); image.update(); } diff --git a/src/conversion.h b/src/conversion.h index 5a7cd39..7dc6571 100644 --- a/src/conversion.h +++ b/src/conversion.h @@ -23,7 +23,7 @@ void toOfImage(const msdfgen::Bitmap bitmap, ofFloatImage & image); void toOfImage(const msdfgen::Bitmap bitmap, ofImage & image); -void toOfImage(const msdfgen::Bitmap bitmap, +void toOfImage(const msdfgen::Bitmap bitmap, ofImage & image); ofImage toOfImage(const msdfgen::Bitmap ); }