#include "LayerComposition.h" #include "ofUtils.h" #include namespace ofxVariableLab { void LayerComposition::setup(){ ofxMsdfgen::AtlasSettings settings; //settings.characters = "ABCDEFGHIJKL"; settings.scale = 64; settings.characters = ""; //string fontName = "RobotoFlex.ttf"; //string fontPath = "data/fonts/" + fontName; //string fontPath = "data/celines-fonts/testing2VF.ttf"; string fontPath = "data/celines-fonts/Version-2-var.ttf"; //string fontPath = "data/celines-fonts/Alfarn2.otf"; //string fontPath = "data/celines-fonts/Cottagecore.ttf"; atlas = make_shared (); msdfShader = make_shared (); #ifdef TARGET_EMSCRIPTEN msdfShader->load("ofxMsdfgen/shaders/mix/ES3/shader"); #else msdfShader->load("ofxMsdfgen/shaders/mix/GL3/shader"); #endif auto layer = make_unique (); layer->atlas = atlas; layer->shader = msdfShader; layer->setProps(Layer::Props()); settings.characters += layer->getProps().text; layers.push_back(std::move(layer)); atlas->setup(fontPath, settings); atlas->generate(); atlasImage = make_shared (atlas->getAtlasImage()); glyphGeometries = atlas->getGlyphGeometries(); } void LayerComposition::update(){ } void LayerComposition::draw() const { for(const auto & layer : layers){ layer->draw(glm::vec3(400, 200, 0)); } } shared_ptr LayerComposition::getAtlasImage(){ return atlasImage; } }