From 0a47e4c639c5dbdbec5172ef0366e6f02428f74f Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sat, 13 Jan 2018 21:18:24 +0000 Subject: Fix missing HAlign/VAlign attributes in subtitles when their value is negative. --- src/object.h | 2 ++ src/subtitle_asset_internal.cc | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/object.h b/src/object.h index 0804f4cf..8364efff 100644 --- a/src/object.h +++ b/src/object.h @@ -42,6 +42,7 @@ #include class write_interop_subtitle_test; +class write_interop_subtitle_test2; class write_smpte_subtitle_test; class write_smpte_subtitle_test2; @@ -64,6 +65,7 @@ public: protected: friend class ::write_interop_subtitle_test; + friend class ::write_interop_subtitle_test2; friend class ::write_smpte_subtitle_test; friend class ::write_smpte_subtitle_test2; diff --git a/src/subtitle_asset_internal.cc b/src/subtitle_asset_internal.cc index bd28cdcb..4ae90461 100644 --- a/src/subtitle_asset_internal.cc +++ b/src/subtitle_asset_internal.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2016 Carl Hetherington + Copyright (C) 2012-2018 Carl Hetherington This file is part of libdcp. @@ -33,6 +33,7 @@ #include "subtitle_asset_internal.h" #include "subtitle_string.h" +#include using std::string; using std::map; @@ -156,7 +157,7 @@ order::Text::as_xml (xmlpp::Element* parent, Context& context) const } } - if (_h_position > ALIGN_EPSILON) { + if (fabs(_h_position) > ALIGN_EPSILON) { if (context.standard == SMPTE) { e->set_attribute ("Hposition", raw_convert (_h_position * 100, 6)); } else { @@ -170,7 +171,7 @@ order::Text::as_xml (xmlpp::Element* parent, Context& context) const e->set_attribute ("VAlign", valign_to_string (_v_align)); } - if (_v_position > ALIGN_EPSILON) { + if (fabs(_v_position) > ALIGN_EPSILON) { if (context.standard == SMPTE) { e->set_attribute ("Vposition", raw_convert (_v_position * 100, 6)); } else { -- cgit v1.2.3