diff options
| author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2017-02-03 21:14:36 -0500 | 
|---|---|---|
| committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2017-02-03 21:14:36 -0500 | 
| commit | 8a68ce34d7017619c8cc5b39dc5099bfa26e5225 (patch) | |
| tree | 62ed1f834656ad8af5a0ac3bb62f1754517899fc | |
| parent | 7a318b162edb6965538faa7f01448e1fa1de6352 (diff) | |
| download | advice-8a68ce34d7017619c8cc5b39dc5099bfa26e5225.tar.gz advice-8a68ce34d7017619c8cc5b39dc5099bfa26e5225.tar.bz2 advice-8a68ce34d7017619c8cc5b39dc5099bfa26e5225.zip | |
Added font file config key
| -rw-r--r-- | advice.cpp | 9 | ||||
| -rw-r--r-- | advice.h | 1 | 
2 files changed, 7 insertions, 3 deletions
| diff --git a/advice.cpp b/advice.cpp index b9ab3f9..f0f5014 100644 --- a/advice.cpp +++ b/advice.cpp | |||
| @@ -33,6 +33,9 @@ advice::advice( | |||
| 33 | 33 | ||
| 34 | // Set up the sentence generator. | 34 | // Set up the sentence generator. | 
| 35 | generator_ = std::unique_ptr<sentence>(new sentence(*database_, rng_)); | 35 | generator_ = std::unique_ptr<sentence>(new sentence(*database_, rng_)); | 
| 36 | |||
| 37 | // Read font file path. | ||
| 38 | fontfile_ = "@" + config["font"].as<std::string>(); | ||
| 36 | } | 39 | } | 
| 37 | 40 | ||
| 38 | void advice::run() const | 41 | void advice::run() const | 
| @@ -227,7 +230,7 @@ void advice::run() const | |||
| 227 | std::list<std::string> cur; | 230 | std::list<std::string> cur; | 
| 228 | Magick::TypeMetric metric; | 231 | Magick::TypeMetric metric; | 
| 229 | pic.fontPointsize(20); | 232 | pic.fontPointsize(20); | 
| 230 | pic.font("@coolvetica.ttf"); | 233 | pic.font(fontfile_); | 
| 231 | 234 | ||
| 232 | while (!words.empty()) | 235 | while (!words.empty()) | 
| 233 | { | 236 | { | 
| @@ -271,7 +274,7 @@ void advice::run() const | |||
| 271 | pic.draw(drawList); | 274 | pic.draw(drawList); | 
| 272 | 275 | ||
| 273 | drawList.clear(); | 276 | drawList.clear(); | 
| 274 | drawList.push_back(Magick::DrawableFont("@coolvetica.ttf")); | 277 | drawList.push_back(Magick::DrawableFont(fontfile_)); | 
| 275 | drawList.push_back(Magick::DrawableFillColor("white")); | 278 | drawList.push_back(Magick::DrawableFillColor("white")); | 
| 276 | drawList.push_back(Magick::DrawablePointSize(14)); | 279 | drawList.push_back(Magick::DrawablePointSize(14)); | 
| 277 | drawList.push_back(Magick::DrawableText(10, 225-blockHeight+4, "How to")); // 10, 255-62-4 | 280 | drawList.push_back(Magick::DrawableText(10, 225-blockHeight+4, "How to")); // 10, 255-62-4 | 
| @@ -280,7 +283,7 @@ void advice::run() const | |||
| 280 | for (int i=0; i<lines.size(); i++) | 283 | for (int i=0; i<lines.size(); i++) | 
| 281 | { | 284 | { | 
| 282 | drawList.clear(); | 285 | drawList.clear(); | 
| 283 | drawList.push_back(Magick::DrawableFont("@coolvetica.ttf")); | 286 | drawList.push_back(Magick::DrawableFont(fontfile_)); | 
| 284 | drawList.push_back(Magick::DrawableFillColor("white")); | 287 | drawList.push_back(Magick::DrawableFillColor("white")); | 
| 285 | drawList.push_back(Magick::DrawablePointSize(20)); | 288 | drawList.push_back(Magick::DrawablePointSize(20)); | 
| 286 | drawList.push_back(Magick::DrawableText(10, 255-blockHeight+(i*lineHeight)-4, lines[i])); // 10, 255-20-25 | 289 | drawList.push_back(Magick::DrawableText(10, 255-blockHeight+(i*lineHeight)-4, lines[i])); // 10, 255-20-25 | 
| diff --git a/advice.h b/advice.h index fb83c90..271bc13 100644 --- a/advice.h +++ b/advice.h | |||
| @@ -33,6 +33,7 @@ private: | |||
| 33 | std::unique_ptr<verbly::database> database_; | 33 | std::unique_ptr<verbly::database> database_; | 
| 34 | std::unique_ptr<sentence> generator_; | 34 | std::unique_ptr<sentence> generator_; | 
| 35 | std::unique_ptr<twitter::client> client_; | 35 | std::unique_ptr<twitter::client> client_; | 
| 36 | std::string fontfile_; | ||
| 36 | }; | 37 | }; | 
| 37 | 38 | ||
| 38 | #endif /* end of include guard: ADVICE_H_5934AC1B */ | 39 | #endif /* end of include guard: ADVICE_H_5934AC1B */ | 
