From 369946c9964c02d9c702e824292d5dd11a0af102 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Thu, 20 Apr 2023 17:29:28 +0100 Subject: text kinda works --- nextus/src/ofApp.cpp | 7 ++++++- nextus/src/vectorPlugin.h | 18 ++++++++++++++++-- nextus/src/vectorText.h | 2 +- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/nextus/src/ofApp.cpp b/nextus/src/ofApp.cpp index 3a44557..f3aee1d 100644 --- a/nextus/src/ofApp.cpp +++ b/nextus/src/ofApp.cpp @@ -178,7 +178,12 @@ void ofApp::dragEvent(ofDragInfo dragInfo){ string filename= *dragInfo.files.begin(); string extension= filename.substr(filename.find_last_of(".") + 1); if (extension == "svg") { - svginput.load(filename); + if (filename.find_last_of("fonts")){ + textinput.loadFont(filename); + } + else { + svginput.load(filename); + } } else if (extension == "txt"){ textinput.loadText(filename); } else if (extension == "plt"){ diff --git a/nextus/src/vectorPlugin.h b/nextus/src/vectorPlugin.h index 00e38aa..047d836 100644 --- a/nextus/src/vectorPlugin.h +++ b/nextus/src/vectorPlugin.h @@ -188,8 +188,9 @@ class textPanel: public vectorPanel{ panel.add(use_beat.set("use beat", false)); panel.add(beat_duration.set("duration factor", 0.5f, 0.0f, 1.0f)); panel.add(text_speed.set("speed", 5.0f, 0.0f, 25.0f)); - panel.add(text_scale.set("scale", 0.1f, 0.0f, 0.5f)); + panel.add(text_scale.set("scale", 0.001f, 0.0f, 0.01f)); panel.add(enable_anim.set("animate", true)); + panel.add(spread_anim.set("spread", true)); panel.add(anim_rev.set("reverse", false)); panel.add(vert_pos.set("vert_pos", 0.0f, -0.3f, 0.3f)); panel.add(vert_spread.set("vert_spread", 0.0f, -0.3f, 0.3f)); @@ -199,7 +200,16 @@ class textPanel: public vectorPanel{ text.update(); } vector getLines(){ - vector shapes=text.getOutlines(text_scale,STYLE_OVERLAPPING,0,0,enable_anim,anim_rev,vert_spread,use_beat,beat_duration); + vector shapes=text.getOutlines( + text_scale, + spread_anim?STYLE_OVERLAPPING:STYLE_SENTENCE, + 0,0, + enable_anim, + anim_rev, + vert_spread, + use_beat, + beat_duration + ); //ofLog()<<"text returned "< use_beat; ofParameter beat_duration; ofParameter text_speed; ofParameter text_scale; ofParameter enable_anim; + ofParameter spread_anim; ofParameter anim_rev; ofParameter vert_pos; ofParameter vert_spread; diff --git a/nextus/src/vectorText.h b/nextus/src/vectorText.h index 4fac233..f6c4df4 100644 --- a/nextus/src/vectorText.h +++ b/nextus/src/vectorText.h @@ -241,7 +241,7 @@ public: shape.lineTo(ofToFloat(splitGlyphPath[i+1]), ofToFloat(splitGlyphPath[i+2])); } } - if (shape.size()) shapes.push_back(shape); + if (shape.size()) shapes.push_back(shape); return glyph(c,charWidth,shapes,col); } void addGlyph(char g,bool usePalette=false){ -- cgit v1.2.3