summaryrefslogtreecommitdiff
path: root/menuApp/src/ofApp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'menuApp/src/ofApp.cpp')
-rw-r--r--menuApp/src/ofApp.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/menuApp/src/ofApp.cpp b/menuApp/src/ofApp.cpp
index 1617251..b1da2ff 100644
--- a/menuApp/src/ofApp.cpp
+++ b/menuApp/src/ofApp.cpp
@@ -35,7 +35,7 @@ void ofApp::loadimages(){
void ofApp::setup(){
- ofTrueTypeFont::setGlobalDpi(72);
+ ofTrueTypeFont::setGlobalDpi(180);
type14.load("American Typewriter Regular.ttf", 14*FACTOR, true, true);
type14.setLineHeight(18.0f*FACTOR);
@@ -125,7 +125,22 @@ ofPopMatrix(); //Restore the coordinate system
int imgx=(colinitialoffset+(col*coloffset))*FACTOR;
int imgy=(rowinitialoffset+(row*rowoffset))*FACTOR;
images[i].draw(imgx,imgy,imgsize*FACTOR,imgsize*FACTOR);
- type14.drawString(instagram.getImageCaption()[i],imgx+(textrowinset*FACTOR), imgy+(textcolinset*FACTOR));
+ std::string caption=instagram.getImageCaption()[i];
+ int captionend = caption.find("#");
+ if (captionend == std::string::npos){
+ captionend=caption.size();
+ }
+ float width=type14.stringWidth(caption.substr(0,captionend));
+ ofLog(OF_LOG_NOTICE) << caption.substr(0,captionend) << " <<<<:width: " << width;
+
+ vector<std::string> captions = ofSplitString(caption.substr(0,captionend), " ");
+
+ if (width<imgsize){
+ captions.push_back(caption.substr(0,captionend));
+ }
+
+
+ type14.drawString(caption.substr(0,captionend),imgx+(textrowinset*FACTOR), imgy+((imgsize+textcolinset)*FACTOR));
}
col++;
if (col==cols){