X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fsubtitle_string.h;h=0f066164e6ccbf2b8e81cd6da5636ee91bfe3fc7;hb=edf35a7acb05289dc024733efd6e13205def5174;hp=076a6ec7437210b9dfcbd11a76c67512cdd2736d;hpb=77b0ffe6c50796b8fb132f56394995e0df089713;p=libdcp.git diff --git a/src/subtitle_string.h b/src/subtitle_string.h index 076a6ec7..0f066164 100644 --- a/src/subtitle_string.h +++ b/src/subtitle_string.h @@ -17,22 +17,30 @@ */ +/** @file src/subtitle_string.h + * @brief SubtitleString class. + */ + #ifndef LIBDCP_SUBTITLE_STRING_H #define LIBDCP_SUBTITLE_STRING_H #include "types.h" #include "dcp_time.h" +#include #include namespace dcp { +/** @class SubtitleString + * @brief A single line of subtitle text with all the associated attributes. + */ class SubtitleString { public: SubtitleString ( - std::string font, + boost::optional font, bool italic, - Color color, + Colour colour, int size, Time in, Time out, @@ -40,12 +48,13 @@ public: VAlign v_align, std::string text, Effect effect, - Color effect_color, + Colour effect_colour, Time fade_up_time, Time fade_down_time ); - std::string font () const { + /** @return font ID */ + boost::optional font () const { return _font; } @@ -53,8 +62,8 @@ public: return _italic; } - Color color () const { - return _color; + Colour colour () const { + return _colour; } Time in () const { @@ -69,6 +78,9 @@ public: return _text; } + /** @return vertical position as a proportion of the screen height from the top + * (between 0 and 1) + */ float v_position () const { return _v_position; } @@ -81,8 +93,8 @@ public: return _effect; } - Color effect_color () const { - return _effect_color; + Colour effect_colour () const { + return _effect_colour; } Time fade_up_time () const { @@ -99,10 +111,24 @@ public: int size_in_pixels (int screen_height) const; + /** @param p New vertical position as a proportion of the screen height + * from the top (between 0 and 1) + */ + void set_v_position (float p) { + _v_position = p; + } + + void set_size (int s) { + _size = s; + } + private: - std::string _font; + /** font ID */ + boost::optional _font; + /** true if the text is italic */ bool _italic; - Color _color; + /** text colour */ + Colour _colour; /** Size in points as if the screen height is 11 inches, so a 72pt font * would be 1/11th of the screen height. */ @@ -116,7 +142,7 @@ private: VAlign _v_align; std::string _text; Effect _effect; - Color _effect_color; + Colour _effect_colour; Time _fade_up_time; Time _fade_down_time; };