diff options
-rw-r--r-- | sword.cc | 19 |
1 files changed, 17 insertions, 2 deletions
@@ -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. |