Method: ASSFile#initialize

Defined in:
lib/vtt2ass/ass_file.rb

#initialize(title, width, height, css_file_path = nil) ⇒ ASSFile

Creates a new ASSFile instance and assigns the default values of instance variables.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/vtt2ass/ass_file.rb', line 16

def initialize(title, width, height, css_file_path = nil)
  @width = width
  @height = height
  @css_file = nil
  @css_file = CSSFile.new(css_file_path) unless css_file_path.nil?
  @header = <<~HEADER
    [Script Info]
    Title: #{title}
    ScriptType: v4.00+
    Collisions: Normal
    PlayDepth: 0
    PlayResX: #{@width}
    PlayResY: #{@height}
    WrapStyle: 0
    ScaledBorderAndShadow: yes

    [V4+ Styles]
    Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
  HEADER
  @events = <<~EVENTS

    [Events]
    Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
  EVENTS
  @ass_styles = []
  @ass_lines = []
end