From 8a68ce34d7017619c8cc5b39dc5099bfa26e5225 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Fri, 3 Feb 2017 21:14:36 -0500 Subject: Added font file config key --- advice.cpp | 9 ++++++--- 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( // Set up the sentence generator. generator_ = std::unique_ptr(new sentence(*database_, rng_)); + + // Read font file path. + fontfile_ = "@" + config["font"].as(); } void advice::run() const @@ -227,7 +230,7 @@ void advice::run() const std::list cur; Magick::TypeMetric metric; pic.fontPointsize(20); - pic.font("@coolvetica.ttf"); + pic.font(fontfile_); while (!words.empty()) { @@ -271,7 +274,7 @@ void advice::run() const pic.draw(drawList); drawList.clear(); - drawList.push_back(Magick::DrawableFont("@coolvetica.ttf")); + drawList.push_back(Magick::DrawableFont(fontfile_)); drawList.push_back(Magick::DrawableFillColor("white")); drawList.push_back(Magick::DrawablePointSize(14)); drawList.push_back(Magick::DrawableText(10, 225-blockHeight+4, "How to")); // 10, 255-62-4 @@ -280,7 +283,7 @@ void advice::run() const for (int i=0; i database_; std::unique_ptr generator_; std::unique_ptr client_; + std::string fontfile_; }; #endif /* end of include guard: ADVICE_H_5934AC1B */ -- cgit 1.4.1