8a8ac7fbe562099d2c2ecb7ada1ff6623ac604ba
[libsub.git] / src / raw_subtitle.h
1 /*
2     Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
3
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.
8
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.
13
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.
17
18 */
19
20 #ifndef LIBSUB_RAW_SUBTITLE_H
21 #define LIBSUB_RAW_SUBTITLE_H
22
23 #include "frame_time.h"
24 #include "metric_time.h"
25 #include "colour.h"
26 #include "vertical_reference.h"
27 #include "effect.h"
28 #include "time_pair.h"
29 #include "font_size.h"
30 #include "vertical_position.h"
31 #include <boost/optional.hpp>
32 #include <string>
33 #include <list>
34
35 namespace sub {
36
37 /** @class RawSubtitle
38  *  @brief A bit of a subtitle, created with no regard for any nearby bits.
39  */
40 class RawSubtitle
41 {
42 public:
43         RawSubtitle ()
44                 : colour (1, 1, 1)
45                 , bold (false)
46                 , italic (false)
47                 , underline (false)
48         {}
49
50         /** Subtitle text in UTF-8 */
51         std::string text;
52         std::string font;
53
54         /** font size */
55         FontSize font_size;
56
57         boost::optional<Effect> effect;
58         boost::optional<Colour> effect_colour;
59         
60         Colour colour;
61         bool bold;      ///< true to use a bold version of font
62         bool italic;    ///< true to use an italic version of font
63         bool underline; ///< true to underline
64
65         /** vertical position of the baseline of the text */
66         VerticalPosition vertical_position;
67
68         /** from time */
69         TimePair from;
70         /** to time */
71         TimePair to;
72         
73         boost::optional<MetricTime> fade_up;
74         boost::optional<MetricTime> fade_down;
75 };
76
77 bool operator< (RawSubtitle const &, RawSubtitle const &);      
78
79 }
80
81 #endif