summary refs log tree commit diff stats
path: root/advice.cpp
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2017-02-03 21:14:36 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2017-02-03 21:14:36 -0500
commit8a68ce34d7017619c8cc5b39dc5099bfa26e5225 (patch)
tree62ed1f834656ad8af5a0ac3bb62f1754517899fc /advice.cpp
parent7a318b162edb6965538faa7f01448e1fa1de6352 (diff)
downloadadvice-8a68ce34d7017619c8cc5b39dc5099bfa26e5225.tar.gz
advice-8a68ce34d7017619c8cc5b39dc5099bfa26e5225.tar.bz2
advice-8a68ce34d7017619c8cc5b39dc5099bfa26e5225.zip
Added font file config key
Diffstat (limited to 'advice.cpp')
-rw-r--r--advice.cpp9
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
38void advice::run() const 41void 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