From 608e1518a5d078a08e6137b8348a527c5d61330e Mon Sep 17 00:00:00 2001 From: MiroslavR Date: Mon, 22 Sep 2014 21:47:21 +0200 Subject: [PATCH] Hack to prevent newlines at the end of books possibly creating unnecessary pages for mygui versions lower than 3.2.2 --- apps/openmw/mwgui/formatting.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/apps/openmw/mwgui/formatting.cpp b/apps/openmw/mwgui/formatting.cpp index 9c918e626..7de4950ee 100644 --- a/apps/openmw/mwgui/formatting.cpp +++ b/apps/openmw/mwgui/formatting.cpp @@ -197,6 +197,18 @@ namespace MWGui if (plainText[plainText.size()-1] == '\n') plainText.erase(plainText.end()-1); +#if (MYGUI_VERSION < MYGUI_DEFINE_VERSION(3, 2, 2)) + // splitting won't be fully functional until 3.2.2 (see TextElement::pageSplit()) + // hack: prevent newlines at the end of the book possibly creating unnecessary pages + if (event == BookTextParser::Event_EOF) + { + while (plainText[plainText.size()-1] == '\n') + { + plainText.erase(plainText.end()-1); + } + } +#endif + TextElement elem(paper, pag, mTextStyle, plainText); elem.paginate(); }