libdcp
Public Member Functions | Private Attributes | List of all members
dcp::SubtitleString Class Reference

A single line of subtitle text with all the associated attributes. More...

#include <subtitle_string.h>

Inheritance diagram for dcp::SubtitleString:
dcp::Subtitle

Public Member Functions

 SubtitleString (boost::optional< std::string > font, bool italic, bool bold, bool underline, Colour colour, int size, float aspect_adjust, Time in, Time out, float h_position, HAlign h_align, float v_position, VAlign v_align, Direction direction, std::string text, Effect effect, Colour effect_colour, Time fade_up_time, Time fade_down_time, float space_before)
 
boost::optional< std::string > font () const
 
bool italic () const
 
bool bold () const
 
bool underline () const
 
Colour colour () const
 
std::string text () const
 
Direction direction () const
 
Effect effect () const
 
Colour effect_colour () const
 
int size () const
 
int size_in_pixels (int screen_height) const
 
float space_before () const
 
float aspect_adjust () const
 
void set_font (std::string id)
 
void unset_font ()
 
void set_size (int s)
 
void set_aspect_adjust (float a)
 
void set_text (std::string t)
 
void set_colour (Colour c)
 
void set_effect (Effect e)
 
void set_effect_colour (Colour c)
 
- Public Member Functions inherited from dcp::Subtitle
Time in () const
 
Time out () const
 
float h_position () const
 
HAlign h_align () const
 
float v_position () const
 
VAlign v_align () const
 
Time fade_up_time () const
 
Time fade_down_time () const
 
void set_in (Time i)
 
void set_out (Time o)
 
void set_h_position (float p)
 
void set_v_position (float p)
 
void set_fade_up_time (Time t)
 
void set_fade_down_time (Time t)
 

Private Attributes

boost::optional< std::string > _font
 
bool _italic
 
bool _bold
 
bool _underline
 
Colour _colour
 
int _size
 
float _aspect_adjust
 
Direction _direction
 
std::string _text
 
Effect _effect
 
Colour _effect_colour
 
float _space_before
 

Additional Inherited Members

- Protected Member Functions inherited from dcp::Subtitle
 Subtitle (Time in, Time out, float h_position, HAlign h_align, float v_position, VAlign v_align, Time fade_up_time, Time fade_down_time)
 
- Protected Attributes inherited from dcp::Subtitle
Time _in
 
Time _out
 
float _h_position = 0
 
HAlign _h_align = HAlign::CENTER
 
float _v_position = 0
 
VAlign _v_align = VAlign::CENTER
 
Time _fade_up_time
 
Time _fade_down_time
 

Detailed Description

A single line of subtitle text with all the associated attributes.

Definition at line 57 of file subtitle_string.h.

Constructor & Destructor Documentation

◆ SubtitleString()

SubtitleString::SubtitleString ( boost::optional< std::string >  font,
bool  italic,
bool  bold,
bool  underline,
Colour  colour,
int  size,
float  aspect_adjust,
Time  in,
Time  out,
float  h_position,
HAlign  h_align,
float  v_position,
VAlign  v_align,
Direction  direction,
std::string  text,
Effect  effect,
Colour  effect_colour,
Time  fade_up_time,
Time  fade_down_time,
float  space_before 
)
Parameters
fontFont ID, or empty to use the default
italictrue for italic text
boldtrue for bold text
underlinetrue for underlined text
colourColour of the text
sizeSize in points as if the screen height is 11 inches, so a 72pt font would be 1/11th of the screen height
aspect_adjustgreater than 1 to stretch text to be wider, less than 1 to shrink text to be narrower (must be between 0.25 and 4)
instart time
outfinish time
h_positionHorizontal position as a fraction of the screen width (between 0 and 1) from h_align
h_alignHorizontal alignment point
v_positionVertical position as a fraction of the screen height (between 0 and 1) from v_align
v_alignVertical alignment point
directionDirection of text
textThe text to display
effectEffect to use
effect_colourColour of the effect
fade_up_timeTime to fade the text in
fade_down_timeTime to fade the text out
space_beforeSpace to add before this string, in ems (could be negative to remove space).

Definition at line 53 of file subtitle_string.cc.

Member Function Documentation

◆ aspect_adjust()

float dcp::SubtitleString::aspect_adjust ( ) const
inline
Returns
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.

Definition at line 155 of file subtitle_string.h.

◆ font()

boost::optional<std::string> dcp::SubtitleString::font ( ) const
inline
Returns
font ID

Definition at line 105 of file subtitle_string.h.

Member Data Documentation

◆ _bold

bool dcp::SubtitleString::_bold
private

true if the weight is bold, false for normal

Definition at line 197 of file subtitle_string.h.

◆ _colour

Colour dcp::SubtitleString::_colour
private

text colour

Definition at line 201 of file subtitle_string.h.

◆ _font

boost::optional<std::string> dcp::SubtitleString::_font
private

font ID

Definition at line 193 of file subtitle_string.h.

◆ _italic

bool dcp::SubtitleString::_italic
private

true if the text is italic

Definition at line 195 of file subtitle_string.h.

◆ _size

int dcp::SubtitleString::_size
private

Size in points as if the screen height is 11 inches, so a 72pt font would be 1/11th of the screen height.

Definition at line 205 of file subtitle_string.h.

◆ _underline

bool dcp::SubtitleString::_underline
private

true to enable underlining, false otherwise

Definition at line 199 of file subtitle_string.h.


The documentation for this class was generated from the following files: