summaryrefslogtreecommitdiff
path: root/src/subtitle_string.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-01-24 22:56:33 +0100
committerCarl Hetherington <cth@carlh.net>2021-01-24 22:56:33 +0100
commite1e7de8d73bedd0c741e7df0390068c67867e09f (patch)
tree02f007aad80f4d99707f2507a81b0685865026d0 /src/subtitle_string.cc
parentceaf7bc52712cb60708ed5eb5c62c5e463dd8e89 (diff)
Tidying.
Diffstat (limited to 'src/subtitle_string.cc')
-rw-r--r--src/subtitle_string.cc21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/subtitle_string.cc b/src/subtitle_string.cc
index 0f89291e..28c02114 100644
--- a/src/subtitle_string.cc
+++ b/src/subtitle_string.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
This file is part of libdcp.
@@ -31,16 +31,25 @@
files in the program, then also delete it here.
*/
+
+/** @file src/subtitle_string.cc
+ * @brief SubtitleString class
+ */
+
+
#include "subtitle_string.h"
#include "xml.h"
#include <cmath>
-using std::string;
+
+using std::max;
+using std::min;
using std::ostream;
+using std::string;
using boost::optional;
using namespace dcp;
-/** @param v_position Vertical position as a fraction of the screen height (between 0 and 1) from v_align */
+
SubtitleString::SubtitleString (
optional<string> font,
bool italic,
@@ -75,9 +84,10 @@ SubtitleString::SubtitleString (
, _effect (effect)
, _effect_colour (effect_colour)
{
-
+ _aspect_adjust = max(min(_aspect_adjust, 4.0), 0.25);
}
+
int
SubtitleString::size_in_pixels (int screen_height) const
{
@@ -89,6 +99,7 @@ SubtitleString::size_in_pixels (int screen_height) const
return _size * screen_height / (11 * 72);
}
+
bool
dcp::operator== (SubtitleString const & a, SubtitleString const & b)
{
@@ -115,12 +126,14 @@ dcp::operator== (SubtitleString const & a, SubtitleString const & b)
);
}
+
bool
dcp::operator!= (SubtitleString const & a, SubtitleString const & b)
{
return !(a == b);
}
+
ostream&
dcp::operator<< (ostream& s, SubtitleString const & sub)
{