summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-06-18 18:03:06 +0200
committerCarl Hetherington <cth@carlh.net>2024-06-24 23:02:00 +0200
commitb11083f68b7971556e5003093b44c1835407b315 (patch)
treeb17ec406ff68690ed5bde835228b972f772b9f53
parent6675bba6ab7d5cee50fa4d8c892af69d054c6804 (diff)
Fix y offset direction of bitmap subs (#2807).
-rw-r--r--src/lib/player.cc2
-rw-r--r--src/lib/release_notes.cc63
-rw-r--r--test/release_notes_test.cc6
3 files changed, 58 insertions, 13 deletions
diff --git a/src/lib/player.cc b/src/lib/player.cc
index ea236db39..14cd95906 100644
--- a/src/lib/player.cc
+++ b/src/lib/player.cc
@@ -1250,7 +1250,7 @@ Player::bitmap_text_start (weak_ptr<Piece> weak_piece, weak_ptr<const TextConten
{
/* Apply content's subtitle offsets */
sub.rectangle.x += content->x_offset ();
- sub.rectangle.y += content->y_offset ();
+ sub.rectangle.y -= content->y_offset ();
/* Apply a corrective translation to keep the subtitle centred after the scale that is coming up */
sub.rectangle.x -= sub.rectangle.width * ((content->x_scale() - 1) / 2);
diff --git a/src/lib/release_notes.cc b/src/lib/release_notes.cc
index b12ebc030..64556bb26 100644
--- a/src/lib/release_notes.cc
+++ b/src/lib/release_notes.cc
@@ -23,14 +23,44 @@
#include "release_notes.h"
#include "variant.h"
#include "version.h"
+#include <dcp/raw_convert.h>
+#include <boost/algorithm/string.hpp>
#include "i18n.h"
using std::string;
+using std::vector;
using boost::optional;
+bool
+before(optional<string> last, string current)
+{
+ if (!last) {
+ return true;
+ }
+
+ vector<string> last_parts;
+ boost::split(last_parts, *last, boost::is_any_of("."));
+ vector<string> current_parts;
+ boost::split(current_parts, current, boost::is_any_of("."));
+
+ if (last_parts.size() != 3 || current_parts.size() != 3) {
+ /* One or other is a git version; don't bother reporting anything */
+ return false;
+ }
+
+ for (int i = 0; i < 3; ++i) {
+ if (dcp::raw_convert<int>(last_parts[i]) < dcp::raw_convert<int>(current_parts[i])) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+
optional<string>
find_release_notes(bool dark, optional<string> current)
{
@@ -44,19 +74,34 @@ find_release_notes(bool dark, optional<string> current)
Config::instance()->set_last_release_notes_version(*current);
+ vector<string> notes;
+ if (!last) {
+ notes.push_back(_("In this version there are changes to the way that subtitles are positioned. "
+ "Positioning should now be more correct, with respect to the standards, but you "
+ "should check any subtitles in your project to make sure that they are placed "
+ "where you want them."));
+ }
+
+ if (before(last, "2.17.19")) {
+ notes.push_back(_("The vertical offset control for some subtitles now works in the opposite direction "
+ "to how it was before. You should check any subtitles in your project to make sure "
+ "that they are placed where you want them."));
+ }
+
+ if (notes.empty()) {
+ return {};
+ }
+
string const colour = dark ? "white" : "black";
auto const span = String::compose("<span style=\"color: %1\">", colour);
- const string header = String::compose("<h1>%1%2 %3 release notes</span></h1>", span, variant::dcpomatic(), *current);
+ auto output = String::compose("<h1>%1%2 %3 release notes</span></h1><ul>", span, variant::dcpomatic(), *current);
- if (!last) {
- return header + span +
- _("In this version there are changes to the way that subtitles are positioned. "
- "Positioning should now be more correct, with respect to the standards, but you "
- "should check any subtitles in your project to make sure that they are placed "
- "where you want them.")
- + "</span>";
+ for (auto const& note: notes) {
+ output += string("<li>") + span + note + "</span>";
}
- return {};
+ output += "</ul>";
+
+ return output;
}
diff --git a/test/release_notes_test.cc b/test/release_notes_test.cc
index c05ad2618..c303985de 100644
--- a/test/release_notes_test.cc
+++ b/test/release_notes_test.cc
@@ -38,11 +38,11 @@ BOOST_AUTO_TEST_CASE(release_notes_test1)
}
-// Once we're running 2.16.19 we have no more release notes (for now, at least)
+// Once we're running 2.17.19 we have no more release notes (for now, at least)
BOOST_AUTO_TEST_CASE(release_notes_test2)
{
- for (auto version: { "2.16.19", "2.16.20", "2.18.0", "2.18.1devel6" }) {
- Config::instance()->set_last_release_notes_version("2.16.19");
+ for (auto version: { "2.17.19", "2.17.20", "2.18.0", "2.18.1devel6" }) {
+ Config::instance()->set_last_release_notes_version("2.17.19");
auto notes = find_release_notes(false, string(version));
BOOST_CHECK(!static_cast<bool>(notes));
}