Browse Source

* Subtitle::SSA->parse : fix [Fonts] section data decoding

master
Alex 'AdUser' Z 6 years ago
parent
commit
77976c2927
  1. 26
      lib/Subtitle/SSA.pm

26
lib/Subtitle/SSA.pm

@ -72,6 +72,19 @@ sub parse {
$self->log(warn => "Line $linenum outside any section, skip"); $self->log(warn => "Line $linenum outside any section, skip");
next; next;
} }
if ($section eq 'fonts') {
if ($line =~ m/^fontname:\s*(.*)/i) {
my $font = Subtitle::SSA::File->new;
$font->type('font');
$font->name($1);
push @{ $self->{fonts} }, $font;
next;
}
my $curr = $self->{fonts}->[-1]
or next; # missing 'fontname' line?
$curr->parse_uue_line($line);
next;
}
# TODO: graphics section # TODO: graphics section
# skip comments # skip comments
next if $line =~ m{^ \s* ;}xo; next if $line =~ m{^ \s* ;}xo;
@ -123,19 +136,6 @@ sub parse {
} }
next; next;
} }
if ($section eq 'fonts') {
if ($line =~ m/^fontname:\s*(.*)/i) {
my $font = Subtitle::SSA::File->new;
$font->type('font');
$font->name($1);
push @{ $self->{fonts} }, $font;
next;
}
my $curr = $self->{fonts}->[-1]
or next; # missing 'fontname' line?
$curr->parse_uue_line($line);
next;
}
$self->log(warn => "unrecognized line at line $linenum: $line"); $self->log(warn => "unrecognized line at line $linenum: $line");
} }

Loading…
Cancel
Save