diff options
| -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 */ |
