2 Copyright (C) 2012-2015 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 /** @file src/subtitle_string.h
21 * @brief SubtitleString class.
24 #ifndef LIBDCP_SUBTITLE_STRING_H
25 #define LIBDCP_SUBTITLE_STRING_H
29 #include <boost/optional.hpp>
34 /** @class SubtitleString
35 * @brief A single line of subtitle text with all the associated attributes.
41 boost::optional<std::string> font,
57 /** @return font ID */
58 boost::optional<std::string> font () const {
62 bool italic () const {
66 Colour colour () const {
78 std::string text () const {
82 /** @return vertical position as a proportion of the screen height from the top
85 float v_position () const {
89 VAlign v_align () const {
93 Effect effect () const {
97 Colour effect_colour () const {
98 return _effect_colour;
101 Time fade_up_time () const {
102 return _fade_up_time;
105 Time fade_down_time () const {
106 return _fade_down_time;
113 int size_in_pixels (int screen_height) const;
115 /** @return Aspect ratio `adjustment' of the font size.
116 * Values greater than 1 widen each character, values less than 1 narrow each character,
117 * and the value must be between 0.25 and 4.
119 float aspect_adjust () const {
120 return _aspect_adjust;
123 /** @param p New vertical position as a proportion of the screen height
124 * from the top (between 0 and 1)
126 void set_v_position (float p) {
130 void set_size (int s) {
136 boost::optional<std::string> _font;
137 /** true if the text is italic */
141 /** Size in points as if the screen height is 11 inches, so a 72pt font
142 * would be 1/11th of the screen height.
145 float _aspect_adjust;
148 /** Vertical position as a proportion of the screen height from the _v_align
155 Colour _effect_colour;
157 Time _fade_down_time;
160 bool operator== (SubtitleString const & a, SubtitleString const & b);
161 std::ostream& operator<< (std::ostream& s, SubtitleString const & sub);