diff options
Diffstat (limited to 'advice.cpp')
| -rw-r--r-- | advice.cpp | 9 |
1 files changed, 6 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 |
