#should be called format


package StyleFFF4;

use Style;

@ISA = ('Style');

sub taggedValueOutput {
  my ($self, $tag, $value) = @_;

  if ($value =~ /[^a-zA-Z0-9.]/) {
    $value =~ s/\"/\\\"/g;
    $value = "\"$value\"";
  }

  "$tag:$value";
}

sub blockOutput {
  shift;
  '<' . join('; ', @_) . '>';
}

# for each kind of attribute, define EITHER <attrib>Output, or
# <attrib>Tag and <attrib>Value
#
# in the latter case the default Style::attribOutput will use
# <attrib>Tag and <attrib>Value in conjunction with the supplied 
# taggedValueOutput above

sub nameTag {
  'PA';
}

sub alignmentTag {
  'JU';
}

$alignmentValues = {
  'left' => 'LF',
  'right' => 'RT',
  'centre' => 'CN',
  'justify' => 'FL'
};

sub alignmentValue {
  $alignmentValues{$_[1]};
}

sub indentOutput {
  undef;
}

sub leadingOutput {
  undef;
}

sub space_beforeTag {
  'BP';
}

sub space_afterTag {
  'AP';
}

sub keep_withOutput {
  undef;
}

sub tabstopsOutput {
  undef;
}

sub keep_togetherOutput {
  undef;
}

sub font_nameTag {
  'FT';
}

sub font_sizeTag {
  'PT';
}

sub boldOutput {
  $_[1]->{bold} ? 'BD+' : 'BD';
}

sub italicOutput {
  $_[1]->{italic} ? 'IT+' : 'IT';
}

sub underlineOutput {
  $_[1]->{underline} ? 'UL+' : 'UL';
}

sub strikethroughOutput {
  $_[1]->{strikethrough} ? 'SO+' : 'SO';
}

# FIXME what is this meant to be?

sub verticalOffsetTag {
  'SP';
}

sub hscale_percentOutput {
  undef;
}

sub colourOutput {
  undef;
}

sub smallCapsOutput {
  undef;
}

sub outlineOutput {
  undef;
}

sub definitionOutput {
  my $self = shift;
  my $name = shift;

  $self->attribBlockOutput('name', $name, @_);
}

sub invocationOutput {
  $_[0]->blockOutput($_[0]->taggedValueOutput('PS', $_[1]));
}

sub new {
  bless {};
}

1;

