Show
Ignore:
Timestamp:
12.01.2012 11:03:59 (8 years ago)
Author:
davidb
Message:

Work on converting CSS style attributes to Expeditee attributes

Files:
1 modified

Legend:

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

    r24939 r24941  
    2828use strict; 
    2929 
     30use CssStyleToExpAttr; 
     31 
    3032sub new  
    3133{ 
     
    7779 
    7880    # load up some defaults for font information 
    79     my $font_family = "s"; # t 
    80     my $font_face = "r"; 
    81     my $font_size = "14"; 
     81    my $exp_font_family = "s"; # t 
     82    my $exp_font_face = "r"; 
     83    my $exp_font_size = "14"; 
    8284 
    8385#    if (defined $css_attr->{'font-family'}) { 
     
    8587#    } 
    8688 
    87 #    if (defined $css_attr->{'font-size'}) { 
    88 #   $font_size = convert_font_size($css_attr->{'font-size'}); 
    89 #    } 
     89    if (defined $css_attr->{'font-size'}) { 
     90    my $css_font_size = $css_attr->{'font-size'}; 
     91    $exp_font_size = CssStyleToExpAttr::convert_font_size($css_font_size); 
     92    } 
    9093 
    9194#    if (defined $css_attr->{'font-face'}) { 
    9295#   $font = conver_font_face($css_attr->{'font-face'}); 
    9396#    } 
     97 
     98#    $exp_attr->{'f'} = $exp_font_family.$exp_font_face.$exp_font_size; 
    9499 
    95100    return $exp_attr; 
     
    169174    $self->setPointDefaultAttributes($attr); 
    170175 
    171     $attr->{'d'} = "50 100 50"; # green color for rect lines 
    172     $attr->{'h'} = "2.0";     # line thickness 
     176    $attr->{'d'} = "80 80 80"; # green color for rect lines 
     177    $attr->{'h'} = "1.0";     # line thickness 
    173178} 
    174179 
     
    193198{ 
    194199    my $self = shift @_; 
    195     my ($x, $y, $text, $attr) = @_; 
    196  
    197     # fudge factor for now (based on default font size used) 
    198     $y += 16; # y-value of text item in Expeditee is it's base line 
    199     $x += 4; 
     200    my ($x, $y, $text, $w, $attr) = @_; 
    200201 
    201202    my %attr_copy = %$attr; # make a private copy of 'attr' 
     
    207208    $attr_copy{'P'} = "$x $y"; 
    208209    $attr_copy{'T'} = $text; 
     210    $attr_copy{'w'} = "-$w" if (defined $w); 
    209211 
    210212    return $self->_addItem("T",\%attr_copy); 
     
    442444    $self->addRect($xl,$yt,$xr,$yb,$attr); 
    443445 
     446    if (defined $html_node->{'img'}) { 
     447 
     448        my $img_url = $html_node->{'img'}; 
     449        $img_url =~ s/^http:\/\/www\.nzdl\.org\/greenstone3-showcase\///; 
     450        if ($img_url =~ m/^interfaces\//) { 
     451        $img_url = "images/$img_url"; 
     452        } 
     453        elsif ($img_url =~ m/^sites\//) { 
     454        $img_url =~ s/^sites\/(.*?)\//images\//; 
     455        } 
     456 
     457        my $x = $xl; 
     458        my $y = $yt; 
     459 
     460        my $attr = {}; 
     461 
     462        my $img_text = "\@i: $img_url"; 
     463 
     464        $self->addText($x,$y,$img_text,undef,$attr); 
     465    } 
     466 
    444467    } 
    445468    elsif ($type eq "text") { 
    446469    my $text = $html_node->{'text'}; 
    447470 
    448     my $x = $html_node->{'x'}; 
    449     my $y = $html_node->{'y'}; 
     471    my $x = $html_node->{'xl'}; 
     472    my $y = $html_node->{'yt'}; 
     473    my $w = $html_node->{'xr'} - $x +1; 
    450474 
    451475    my $attr = convertStyleToAttr($html_node->{'style'}); 
    452476 
    453     $self->addText($x,$y,$text,$attr); 
     477    # fudge factor for now (based on default font size used) 
     478    $y += 16; # y-value of text item in Expeditee is it's base line 
     479    $x += 4; 
     480 
     481    $self->addText($x,$y,$text,$w,$attr); 
    454482    } 
    455483    else {