diff --git a/lib/Subtitle/SSA.pm b/lib/Subtitle/SSA.pm index b479277..52b79bc 100644 --- a/lib/Subtitle/SSA.pm +++ b/lib/Subtitle/SSA.pm @@ -72,6 +72,19 @@ sub parse { $self->log(warn => "Line $linenum outside any section, skip"); 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 # skip comments next if $line =~ m{^ \s* ;}xo; @@ -123,19 +136,6 @@ sub parse { } 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"); }