ofxSVG - correct usage and text capabilities

Hi,

I’m new here… and looking for help :slight_smile:

I’m currently working on integrating openFrameworks into an existing setup. The goal is to enable several networked PCs to provide simple (!) content for a projector. As network bandwidth is precious, I plan on sending plain strings that contain SVG markup which will be rendered on the target PC (to which the projector is attached).

I’ve already created an interface to the existing network infrastructure/protocol so my of-app receives the strings, passes them on to ofxSVG (that comes included in the of-installer) and calls the ofxSVG.draw()-method in every app.update()-cycle. It works mostly, but for the non-working part some comments would be appreciated!

Graphical content of the SVG is rendered and displayed as expected. However, text is not rendered :frowning:
Digging through the code, I found the line

  
ofLogWarning("ofxSVG") << "setupDiagram(): text: not implemented yet";  

in ofxSVG.cpp. However, no such message shows up in my console.

Questions:

  1. Are there plans for text support in ofxSVG? If I’d want to do it myself, how much effort might it be (based on no experience with the of-datatypes, concepts etc)?

  2. I’ve seen that there’s a separate ofxSVG-addon-on-github that seems to be a larger project (in terms of more files), but wasn’t updated for 2 years. Is this still current and should/could be used?

  3. When I receive a new svg-string and call .draw(), its content is displayed in addition to the previous one. How can I clear the screen/svg-buffer/whatever in order to only display the current svg?

For reference, the main steps of displaying svg in my app are

  
// in testApp.h: create members  
ofxSVG svgHandler;  
std::string svgData;  
  
// in testApp.myCustomNetworkCallback(): received svg-string via network, save to member  
svgData = svgMsg.data;  
svgHandler.load(svgData, true);  // hacked to accept strings as input (instead of loading the contents of a file)  
  
// in testApp.draw()  
svgHandler.draw();  
  

  1. [Not directly related to ofxSVG] In my app.setup()-method, I call
  
ofSetLogLevel("ofxSVG", OF_LOG_VERBOSE);  

. However, the “no text support”-warning from ofxSVG still doesn’t show up in the console. I’m probably missing something… but what?

That ofxSVG-addon is mine and I should delete it, it’s not being updated because the one that ships is the correct one. I would love it and would be happy to help if you wanted to add text. It’s easy to do simple text and hard to do complex “correct” text. That said, if you want to get in touch on github, let’s make it happen.

1 Like