Browse Source

+ Subtitle::SSA->fonts_usage

master
Alex 'AdUser' Z 6 years ago
parent
commit
f09f7a3d98
  1. 18
      lib/Subtitle/SSA.pm

18
lib/Subtitle/SSA.pm

@ -217,4 +217,22 @@ sub style_usage {
return $stats; return $stats;
} }
sub fonts_usage {
my ($self) = @_;
my $stats = {};
foreach my $s (@{ $self->{styles} }) {
my $fn = $s->{fontname};
$stats->{$fn} //= 0;
$stats->{$fn}++;
}
foreach my $e (@{ $self->{events} }) {
next unless index($e->{text}, '\fn') > 0;
my ($fn) = ($e->{text} =~ m<\\fn([^\\}]+)>);
next unless $fn;
$stats->{$fn} //= 0;
$stats->{$fn}++;
}
return $stats;
}
1; 1;

Loading…
Cancel
Save