diff --git a/src/Layer.h b/src/Layer.h index 41a32cf..7f6c269 100644 --- a/src/Layer.h +++ b/src/Layer.h @@ -36,7 +36,7 @@ class Layer { bool mirror_y = false; float mirror_y_distance = 0; float letterDelay = 0; - string text = "abcdefghijklmnoprstuvqxyzABUIWERJSD"; + string text = "abc"; string fontPath; }; @@ -47,6 +47,7 @@ class Layer { glm::vec3 position = glm::vec3(0, 0, 0), glm::vec4 color = glm::vec4(1, 1, 1, 1), float rotation = 0, + float scale = 1, ofxVariableLab::FontVariation fontVariation = ofxVariableLab::FontVariation()) = 0; virtual void setProps(const Props & props) = 0; virtual const Props & getProps() const = 0; diff --git a/src/MsdfLayer.cpp b/src/MsdfLayer.cpp index d2973c0..60541c7 100644 --- a/src/MsdfLayer.cpp +++ b/src/MsdfLayer.cpp @@ -164,6 +164,7 @@ void MsdfLayer::drawCharacter(const char character, glm::vec3 position, glm::vec4 color, float rotation, + float scale, ofxVariableLab::FontVariation fontVariation){ const ofImage & atlasImage = atlas->getAtlasImage(); ofDisableAlphaBlending(); @@ -250,7 +251,7 @@ void MsdfLayer::drawCharacter(const char character, shader->setUniform2f("scale_b", scale_b); shader->setUniform1f("msdf_mix", mix); //ofRotateDeg(rotation, 0, 0, 1); - atlasImage.draw(0, 0, w, h); + atlasImage.draw(0, 0, w * scale, h * scale); shader->end(); ofPopMatrix(); ofPopStyle(); @@ -275,6 +276,8 @@ const Layer::Type & MsdfLayer::getType() const { void MsdfLayer::setAtlas(shared_ptr _atlas){ atlas = _atlas; + // TODO: this does not seem proper + propsBuffer[0].fontSize_px = atlas->settings.scale; } shared_ptr MsdfLayer::getAtlas() const { return atlas; diff --git a/src/MsdfLayer.h b/src/MsdfLayer.h index 8075012..d4216f6 100644 --- a/src/MsdfLayer.h +++ b/src/MsdfLayer.h @@ -17,6 +17,7 @@ class MsdfLayer : public Layer { glm::vec3 position = glm::vec3(0, 0, 0), glm::vec4 color = glm::vec4(1, 1, 1, 1), float rotation = 0, + float scale = 1, ofxVariableLab::FontVariation fontVariation = ofxVariableLab::FontVariation()) override; void setProps(const Props & props) override; const Props & getProps() const override;