No-op: whitespace.
[libdcp.git] / src / subtitle_string.h
index b313e82b56100bc775faaa42bb1f171bf983abee..2dfdbe0a04b20358ffb1048493df748917e84487 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -26,6 +26,7 @@
 
 #include "types.h"
 #include "dcp_time.h"
+#include <boost/optional.hpp>
 #include <string>
 
 namespace dcp {
@@ -37,23 +38,26 @@ class SubtitleString
 {
 public:
        SubtitleString (
-               std::string font,
+               boost::optional<std::string> font,
                bool italic,
-               Color color,
+               Colour colour,
                int size,
+               float aspect_adjust,
                Time in,
                Time out,
+               float h_position,
+               HAlign h_align,
                float v_position,
                VAlign v_align,
                std::string text,
                Effect effect,
-               Color effect_color,
+               Colour effect_colour,
                Time fade_up_time,
                Time fade_down_time
                );
 
-       /** @return font name */
-       std::string font () const {
+       /** @return font ID */
+       boost::optional<std::string> font () const {
                return _font;
        }
 
@@ -61,8 +65,8 @@ public:
                return _italic;
        }
 
-       Color color () const {
-               return _color;
+       Colour colour () const {
+               return _colour;
        }
 
        Time in () const {
@@ -77,6 +81,14 @@ public:
                return _text;
        }
 
+       float h_position () const {
+               return _h_position;
+       }
+
+       HAlign h_align () const {
+               return _h_align;
+       }
+
        /** @return vertical position as a proportion of the screen height from the top
         *  (between 0 and 1)
         */
@@ -92,8 +104,8 @@ public:
                return _effect;
        }
 
-       Color effect_color () const {
-               return _effect_color;
+       Colour effect_colour () const {
+               return _effect_colour;
        }
 
        Time fade_up_time () const {
@@ -107,9 +119,21 @@ public:
        int size () const {
                return _size;
        }
-       
+
        int size_in_pixels (int screen_height) const;
 
+       /** @return Aspect ratio `adjustment' of the font size.
+        *  Values greater than 1 widen each character, values less than 1 narrow each character,
+        *  and the value must be between 0.25 and 4.
+        */
+       float aspect_adjust () const {
+               return _aspect_adjust;
+       }
+
+       void set_h_position (float p) {
+               _h_position = p;
+       }
+
        /** @param p New vertical position as a proportion of the screen height
         *  from the top (between 0 and 1)
         */
@@ -121,27 +145,37 @@ public:
                _size = s;
        }
 
+       void set_aspect_adjust (float a) {
+               _aspect_adjust = a;
+       }
+
 private:
-       /** font name */
-       std::string _font;
+       /** font ID */
+       boost::optional<std::string> _font;
        /** true if the text is italic */
        bool _italic;
        /** text colour */
-       Color _color;
+       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.
-        */ 
+        */
        int _size;
+       float _aspect_adjust;
        Time _in;
        Time _out;
-       /** Vertical position as a proportion of the screen height from the top
+       /** Horizontal position as a proportion of the screen width from the _h_align
+        *  (between 0 and 1)
+        */
+       float _h_position;
+       HAlign _h_align;
+       /** Vertical position as a proportion of the screen height from the _v_align
         *  (between 0 and 1)
         */
        float _v_position;
        VAlign _v_align;
        std::string _text;
        Effect _effect;
-       Color _effect_color;
+       Colour _effect_colour;
        Time _fade_up_time;
        Time _fade_down_time;
 };