From 77976c2927ac97b801ae7e1afe0c500ab9295bac Mon Sep 17 00:00:00 2001 From: Alex 'AdUser' Z Date: Mon, 23 Jul 2018 02:59:18 +1000 Subject: [PATCH] * Subtitle::SSA->parse : fix [Fonts] section data decoding --- lib/Subtitle/SSA.pm | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) 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"); }