|
|
@ -11,7 +11,7 @@ use overload => ( |
|
|
|
my @FIELDS_SSA = qw(name fontname fontsize primarycolour secondarycolour outlinecolour backcolour bold italic underline strikeout scalex scaley spacing angle borderstyle outline shadow alignment marginl marginr marginv encoding); # FIXME: copypaste |
|
|
|
my @FIELDS_SSA = qw(name fontname fontsize primarycolour secondarycolour outlinecolour backcolour bold italic underline strikeout scalex scaley spacing angle borderstyle outline shadow alignment marginl marginr marginv encoding); # FIXME: copypaste |
|
|
|
my @FIELDS_ASS = qw(name fontname fontsize primarycolour secondarycolour outlinecolour backcolour bold italic underline strikeout scalex scaley spacing angle borderstyle outline shadow alignment marginl marginr marginv encoding); |
|
|
|
my @FIELDS_ASS = qw(name fontname fontsize primarycolour secondarycolour outlinecolour backcolour bold italic underline strikeout scalex scaley spacing angle borderstyle outline shadow alignment marginl marginr marginv encoding); |
|
|
|
|
|
|
|
|
|
|
|
my %STYLE_DEFAULTS = ( |
|
|
|
my %FIELDS = ( |
|
|
|
# format: string |
|
|
|
# format: string |
|
|
|
name => { type => 's', value => 'Default', name => 'Name' }, |
|
|
|
name => { type => 's', value => 'Default', name => 'Name' }, |
|
|
|
fontname => { type => 's', value => 'Arial' , name => 'Fontname' }, |
|
|
|
fontname => { type => 's', value => 'Arial' , name => 'Fontname' }, |
|
|
@ -54,7 +54,7 @@ sub new { |
|
|
|
my @fields = $self->fields(); |
|
|
|
my @fields = $self->fields(); |
|
|
|
foreach my $field (@fields) { |
|
|
|
foreach my $field (@fields) { |
|
|
|
$self->{$field} = ($opts{defaults}) |
|
|
|
$self->{$field} = ($opts{defaults}) |
|
|
|
? $STYLE_DEFAULTS{$field}->{value} |
|
|
|
? $FIELDS{$field}->{value} |
|
|
|
: undef; |
|
|
|
: undef; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -103,7 +103,7 @@ sub to_string { |
|
|
|
my $string = "Style: "; |
|
|
|
my $string = "Style: "; |
|
|
|
my @values = (); |
|
|
|
my @values = (); |
|
|
|
foreach my $field (@fields) { |
|
|
|
foreach my $field (@fields) { |
|
|
|
my $d = $STYLE_DEFAULTS{$field}; |
|
|
|
my $d = $FIELD{$field}; |
|
|
|
my $v = $self->{$f} // $d->{value}; |
|
|
|
my $v = $self->{$f} // $d->{value}; |
|
|
|
if ($d->{type} eq 'x') { |
|
|
|
if ($d->{type} eq 'x') { |
|
|
|
$fmt = ($self->{_vers} eq 'ass') ? '&H%08X' : '%d'; |
|
|
|
$fmt = ($self->{_vers} eq 'ass') ? '&H%08X' : '%d'; |
|
|
|