2 Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #include "subtitle_string.h"
25 using boost::optional;
28 SubtitleString::SubtitleString (
29 optional<string> font,
49 , _v_position (v_position)
53 , _effect_colour (effect_colour)
54 , _fade_up_time (fade_up_time)
55 , _fade_down_time (fade_down_time)
61 SubtitleString::size_in_pixels (int screen_height) const
63 /* Size in the subtitle file is given in points as if the screen
64 height is 11 inches, so a 72pt font would be 1/11th of the screen
68 return _size * screen_height / (11 * 72);
72 dcp::operator== (SubtitleString const & a, SubtitleString const & b)
75 a.font() == b.font() &&
76 a.italic() == b.italic() &&
77 a.colour() == b.colour() &&
78 a.size() == b.size() &&
81 a.v_position() == b.v_position() &&
82 a.v_align() == b.v_align() &&
83 a.text() == b.text() &&
84 a.effect() == b.effect() &&
85 a.effect_colour() == b.effect_colour() &&
86 a.fade_up_time() == b.fade_up_time() &&
87 a.fade_down_time() == b.fade_down_time()
92 dcp::operator<< (ostream& s, SubtitleString const & sub)
94 s << "\n`" << sub.text() << "' from " << sub.in() << " to " << sub.out() << ";\n"
95 << "fade up " << sub.fade_up_time() << ", fade down " << sub.fade_down_time() << ";\n"
96 << "font " << sub.font().get_value_or ("[default]") << ", ";
104 s << ", size " << sub.size() << ", colour " << sub.colour() << ", vpos " << sub.v_position() << ", valign " << ((int) sub.v_align()) << ";\n"
105 << "effect " << ((int) sub.effect()) << ", effect colour " << sub.effect_colour();