aboutsummaryrefslogtreecommitdiff
path: root/sword.cc
diff options
context:
space:
mode:
authorYour Name <you@example.com>2021-08-10 12:30:07 -0400
committerYour Name <you@example.com>2021-08-10 12:30:07 -0400
commit773caa15c74719eeeb2775cdcad2ffb62845e689 (patch)
tree6ebe3b8fdce67f7d37a41f95ac5865e902303a43 /sword.cc
parenteaaabfef24bdd28fe375023823b049c1c6e5f1c8 (diff)
downloadbiblereader-773caa15c74719eeeb2775cdcad2ffb62845e689.tar.gz
biblereader-773caa15c74719eeeb2775cdcad2ffb62845e689.tar.bz2
biblereader-773caa15c74719eeeb2775cdcad2ffb62845e689.zip
Fixed handling of titles
Diffstat (limited to 'sword.cc')
-rw-r--r--sword.cc19
1 files changed, 17 insertions, 2 deletions
diff --git a/sword.cc b/sword.cc
index ada3d6e..a693085 100644
--- a/sword.cc
+++ b/sword.cc
@@ -66,6 +66,9 @@ void Sword::fillBuffer(string ref, Glib::RefPtr<Gtk::TextBuffer> buf) {
auto verseScale = buf->create_tag();
verseScale->property_scale() = 0.8;
+ auto titleScale = buf->create_tag();
+ titleScale->property_scale() = 1.5;
+ titleScale->property_weight() = 600;
auto verseOffset = buf->create_tag();
verseOffset->property_rise() = 3000;
auto indent = buf->create_tag();
@@ -81,6 +84,7 @@ void Sword::fillBuffer(string ref, Glib::RefPtr<Gtk::TextBuffer> buf) {
bool isParagraph = false;
bool isIndent = false;
bool isDivineName = false;
+ bool isPreverse = false;
for(string modifier : tex.modifiers) {
if(modifier == "paragraph") {
isParagraph = true;
@@ -90,6 +94,17 @@ void Sword::fillBuffer(string ref, Glib::RefPtr<Gtk::TextBuffer> buf) {
isDivineName = true;
} else if (modifier == "wordsOfJesus") {
tags.push_back(redletter);
+ } else if (modifier == "title") {
+ tags.push_back(titleScale);
+ // Ensure newline
+ if(tex.text.back() != '\n') {
+ tex.text.push_back('\n');
+ }
+ } else if (modifier == "preverse") {
+ isPreverse = true;
+ } else if (modifier == "parallel") {
+ // We don't support this (yet)
+ tex.text = "";
}
}
if(isIndent) {
@@ -101,13 +116,13 @@ void Sword::fillBuffer(string ref, Glib::RefPtr<Gtk::TextBuffer> buf) {
if(isParagraph) {
iter = buf->insert_with_tags(iter, indentString, tags);
}
- if(tex.verse != verse) {
+ if(tex.verse != verse && ! isPreverse) {
std::vector<Glib::RefPtr<Gtk::TextBuffer::Tag>> verseTags(tags.begin(), tags.end());
verseTags.push_back(verseScale);
verseTags.push_back(verseOffset);
iter = buf->insert_with_tags(iter, " " + std::to_string(tex.verse), verseTags);
+ verse = tex.verse;
}
- verse = tex.verse;
if(isDivineName) {
// There's no small caps support. Sigh. We do fake small caps instead.
// Because i lazy, first letter is normal caps and rest small caps, always.