Ignore:
Timestamp:
2012-01-11T11:17:00+13:00 (12 years ago)
Author:
davidb
Message:

Some initial work at converting CSS style information into Expeditee attributes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gs3-extensions/html-to-expeditee/trunk/src/perllib/ExpediteeFrameIO.pm

    r24938 r24939  
    6565    return $fdate;
    6666}
     67
     68sub convertStyleToAttr
     69{
     70    my ($css_attr) = @_;
     71
     72    my $exp_attr = {};
     73
     74    if (defined $css_attr->{'background-color'}) {
     75    $exp_attr->{'e'} = $css_attr->{'background-color'};
     76    }
     77
     78    # load up some defaults for font information
     79    my $font_family = "s"; # t
     80    my $font_face = "r";
     81    my $font_size = "14";
     82
     83#    if (defined $css_attr->{'font-family'}) {
     84#   $font_family = $font_family_lookup->[$css_attr->{'font-family'}];
     85#    }
     86
     87#    if (defined $css_attr->{'font-size'}) {
     88#   $font_size = convert_font_size($css_attr->{'font-size'});
     89#    }
     90
     91#    if (defined $css_attr->{'font-face'}) {
     92#   $font = conver_font_face($css_attr->{'font-face'});
     93#    }
     94
     95    return $exp_attr;
     96}
     97
    6798
    6899sub _nextFreeId
     
    166197    # fudge factor for now (based on default font size used)
    167198    $y += 16; # y-value of text item in Expeditee is it's base line
     199    $x += 4;
    168200
    169201    my %attr_copy = %$attr; # make a private copy of 'attr'
     
    406438    my $yb = $rect->{'yb'};
    407439
    408     my $attr = {};
     440    my $attr = convertStyleToAttr($html_node->{'style'});
    409441
    410442    $self->addRect($xl,$yt,$xr,$yb,$attr);
     
    417449    my $y = $html_node->{'y'};
    418450
    419     my $attr = {};
     451    my $attr = convertStyleToAttr($html_node->{'style'});
    420452
    421453    $self->addText($x,$y,$text,$attr);
     
    442474
    443475    if (open(FNOUT,">$filename")) {
    444     binmode(FOUT,":utf8");
     476    binmode(FNOUT,":utf8");
    445477   
    446478    print FNOUT "$last_frame_number\n";
Note: See TracChangeset for help on using the changeset viewer.