Method: ASSStyle#initialize

Defined in:
lib/vtt2ass/ass_style.rb

#initialize(style_name, params, font_family, font_size, font_color, is_bold, is_italic, offset, 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.



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/vtt2ass/ass_style.rb', line 19

def initialize(style_name, params, font_family, font_size, font_color, is_bold, is_italic, offset, width, height)
  @width = width
  @height = height
  @font_family = font_family
  @font_size = font_size
  @font_color = font_color
  @style_name = style_name
  @s_params = ASSStyleParams.new(params, width, height)
  @s_params.vertical_margin = 50 if style_name.eql? 'MainTop'
  @s_params.vertical_margin -= offset[:line] if style_name.include?('Subtitle') || style_name.eql?('Main')
  @s_params.vertical_margin += offset[:caption] if style_name.include?('Caption') || style_name.eql?('MainTop')
  @is_italic = is_italic
  @is_bold = is_bold
end