Class: ASSStyle

Inherits:
Object
  • Object
show all
Defined in:
lib/vtt2ass/ASSStyle.rb

Overview

This class defines an ASS style that can be applied on a subtitle line.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(style_name, params, font_family, font_size, width, height) ⇒ ASSStyle

This method creates and instance of an ASSStyle.

  • Requires style_name, a string name for the style as input.

  • Requires params, a string of VTT styling as input.

  • Requires a video width as input.

  • Requires a video height as input.



16
17
18
19
20
21
22
23
# File 'lib/vtt2ass/ASSStyle.rb', line 16

def initialize(style_name, params, font_family, font_size, width, height)
    @width = width
    @height = height
    @font_family = font_family
    @font_size = font_size
    @style_name = style_name
    @s_params = ASSStyleParams.new(params, width, height)
end

Instance Attribute Details

#style_nameObject (readonly)

Returns the value of attribute style_name.



7
8
9
# File 'lib/vtt2ass/ASSStyle.rb', line 7

def style_name
  @style_name
end

Instance Method Details

#to_sObject

This method assigns the object values to an ASS style line and outputs it.



27
28
29
# File 'lib/vtt2ass/ASSStyle.rb', line 27

def to_s
    return "Style: #{@style_name},#{@font_family},#{@font_size},&H00FFFFFF,&H000000FF,&H00020713,&H00000000,-1,0,0,0,100,100,0,0,1,2.0,2.0,#{@s_params.alignment},#{@s_params.horizontal_margin},0,#{@s_params.vertical_margin},1"
end