2 Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net>
4 This file is part of libdcp.
6 libdcp is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 libdcp is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with libdcp. If not, see <http://www.gnu.org/licenses/>.
19 In addition, as a special exception, the copyright holders give
20 permission to link the code of portions of this program with the
21 OpenSSL library under certain conditions as described in each
22 individual source file, and distribute linked combinations
25 You must obey the GNU General Public License in all respects
26 for all of the code used other than OpenSSL. If you modify
27 file(s) with this exception, you may extend this exception to your
28 version of the file(s), but you are not obligated to do so. If you
29 do not wish to do so, delete this exception statement from your
30 version. If you delete this exception statement from all source
31 files in the program, then also delete it here.
34 /** @file src/subtitle_string.h
35 * @brief SubtitleString class.
38 #ifndef LIBDCP_SUBTITLE_STRING_H
39 #define LIBDCP_SUBTITLE_STRING_H
43 #include <boost/optional.hpp>
48 /** @class SubtitleString
49 * @brief A single line of subtitle text with all the associated attributes.
55 boost::optional<std::string> font,
76 /** @return font ID */
77 boost::optional<std::string> font () const {
81 bool italic () const {
89 bool underline () const {
93 Colour colour () const {
105 std::string text () const {
109 float h_position () const {
113 HAlign h_align () const {
117 /** @return vertical position as a proportion of the screen height from the
118 * vertical alignment point.
121 float v_position () const {
125 VAlign v_align () const {
129 Direction direction () const {
133 Effect effect () const {
137 Colour effect_colour () const {
138 return _effect_colour;
141 Time fade_up_time () const {
142 return _fade_up_time;
145 Time fade_down_time () const {
146 return _fade_down_time;
153 int size_in_pixels (int screen_height) const;
155 /** @return Aspect ratio `adjustment' of the font size.
156 * Values greater than 1 widen each character, values less than 1 narrow each character,
157 * and the value must be between 0.25 and 4.
159 float aspect_adjust () const {
160 return _aspect_adjust;
163 void set_in (Time i) {
167 void set_out (Time o) {
171 void set_h_position (float p) {
175 /** @param p New vertical position as a proportion of the screen height
176 * from the top (between 0 and 1)
178 void set_v_position (float p) {
182 void set_size (int s) {
186 void set_aspect_adjust (float a) {
192 boost::optional<std::string> _font;
193 /** true if the text is italic */
195 /** true if the weight is bold, false for normal */
197 /** true to enable underlining, false otherwise */
201 /** Size in points as if the screen height is 11 inches, so a 72pt font
202 * would be 1/11th of the screen height.
205 float _aspect_adjust;
208 /** Horizontal position as a proportion of the screen width from the _h_align
213 /** Vertical position as a proportion of the screen height from the _v_align
218 Direction _direction;
221 Colour _effect_colour;
223 Time _fade_down_time;
226 bool operator== (SubtitleString const & a, SubtitleString const & b);
227 std::ostream& operator<< (std::ostream& s, SubtitleString const & sub);