diff --git a/lib/Subtitle/SSA/Style.pm b/lib/Subtitle/SSA/Style.pm index 7b57869..70208a8 100644 --- a/lib/Subtitle/SSA/Style.pm +++ b/lib/Subtitle/SSA/Style.pm @@ -81,15 +81,19 @@ sub to_string { my ($self) = @_; my @fields = $self->fields(); my $string = "Style: "; + my @values = (); foreach my $field (@fields) { my $d = $STYLE_DEFAULTS{$field}; + my $v = $self->{$f} // $d->{value}; if ($d->{type} eq 'x') { $fmt = ($self->{_vers} eq 'ass') ? '&H%08X' : '%d'; - $string .= sprintf $fmt, $self->{$f}; + $v = sprintf $fmt, $v; } else { - $string .= $self->{$f} // $d->{value}; + # use as is } + push @values, $v; } + $string .= join(',', @values); return $string; }