From 23d1269df7431cf2d537fb12a969062e05b44cbe Mon Sep 17 00:00:00 2001 From: "Troy A. Griffitts" Date: Fri, 9 Nov 2007 09:24:36 +0000 Subject: Added feature to specify font git-svn-id: https://www.crosswire.org/svn/sword-tools/trunk@120 07627401-56e2-0310-80f4-f8cd0041bdcd --- flashtools/Makefile | 8 ++++---- flashtools/flash.cpp | 13 +++++++++++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/flashtools/Makefile b/flashtools/Makefile index 4339bac..74f14b3 100644 --- a/flashtools/Makefile +++ b/flashtools/Makefile @@ -8,10 +8,10 @@ clean: lessons: rm -rf lessons mkdir -p lessons/hebrewFreq lessons/hebrewFreqKJV lessons/greekFreq lessons/greekFreqKJV - ./flash -o lessons/hebrewFreq -w 25 -d m -r Gen-Mal - ./flash -o lessons/hebrewFreqKJV -w 25 -d k -r Gen-Mal - ./flash -o lessons/greekFreq -w 25 -d m -r Mat-Rev - ./flash -o lessons/greekFreqKJV -w 25 -d k -r Mat-Rev + ./flash -o lessons/hebrewFreq -w 25 -d m -r Gen-Mal -f Ezra + ./flash -o lessons/hebrewFreqKJV -w 25 -d k -r Gen-Mal -f Ezra + ./flash -o lessons/greekFreq -w 25 -d m -r Mat-Rev -f Galatia + ./flash -o lessons/greekFreqKJV -w 25 -d k -r Mat-Rev -f Galatia .cpp: g++ -g `pkg-config --cflags sword` $< -o $@ `pkg-config --libs sword` diff --git a/flashtools/flash.cpp b/flashtools/flash.cpp index 1167166..def5e99 100644 --- a/flashtools/flash.cpp +++ b/flashtools/flash.cpp @@ -197,7 +197,7 @@ void outputCSV(const vector &wordList) { * maxPerLesson - maximum number of words per lesson * */ -void outputFlash(const vector &wordList, const char *outputDir = ".", bool kjvFreq = true, int maxPerLesson = 25) { +void outputFlash(const vector &wordList, const char *outputDir = ".", bool kjvFreq = true, int maxPerLesson = 25, const char *fontName=0) { ThMLPlain strip; ofstream ofile; int wordCount = 0; @@ -249,6 +249,9 @@ void outputFlash(const vector &wordList, const char *outputDir = ".", bool lessonTitle.appendFormatted("lessonTitle=%.3d Freqs. %d-%d\n", lessonNumber, startFreq, lastFreq); ofile << lessonTitle; ofile << "wordCount=" << wordCount << "\n"; + if (fontName) { + ofile << "lessonFont=" << fontName << "\n"; + } ofile.close(); wordCount = 0; lessonNumber++; @@ -388,6 +391,7 @@ void usage(const char *app, const char *error = 0) { fprintf(stderr, " -d \t\t definition to use (default k):\n"); fprintf(stderr, "\t\t\t\t m - short meaning; k - KJV collation\n"); fprintf(stderr, " -r <\"range\">\t\t verse range\n"); + fprintf(stderr, " -f \t\t include special font name for lesson\n"); fprintf(stderr, " -h\t\t\t display this help message\n\n"); exit(-1); } @@ -404,6 +408,7 @@ int main(int argc, char **argv) { bool csv = false; char def = 'k'; SWBuf range = "Mat-Rev"; + SWBuf fontName = ""; SWBuf outDir = "."; int count = 25; @@ -429,6 +434,10 @@ int main(int argc, char **argv) { if (i+1 < argc) range = argv[++i]; else usage(*argv, "-r requires <\"range\">"); } + else if (!strcmp(argv[i], "-f")) { + if (i+1 < argc) fontName = argv[++i]; + else usage(*argv, "-f requires <\"fontName\">"); + } else if (!strcmp(argv[i], "-o")) { if (i+1 < argc) outDir = argv[++i]; else usage(*argv, "-o requires "); @@ -443,7 +452,7 @@ int main(int argc, char **argv) { outputCSV(processWords(range)); } else { - outputFlash(processWords(range), outDir, (def == 'k'), count); + outputFlash(processWords(range), outDir, (def == 'k'), count, (fontName.length()?fontName.c_str():0)); } return 0; -- cgit