Ignore:
Timestamp:
2013-01-15T22:49:23+13:00 (11 years ago)
Author:
davidb
Message:

Can now successfully obtain font size, font weight, font colour and font family information about each piece of text on a web page and convert to a corresponding text item on an Expeditee frame. Still need to account for text nodes with parents such as bold elements or heading elements.

File:
1 edited

Legend:

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

    r26727 r26728  
    8787        my $css_font_size = $css_attr->{'font-size'};
    8888        $exp_font_size = CssStyleToExpAttr::convert_font_size($css_font_size);
    89        
    90         print STDERR "CSS Font Size is defined: ".$css_font_size."\n";
    91         print STDERR "Equivalent expeditee font size: ".$exp_font_size."\n";
     89
    9290    }
    9391   
    9492    if(defined $css_attr->{'font-family'}){
    9593        my $obtain_font_family = $css_attr->{'font-family'};
    96         print STDERR "Font family attribute found: ".$obtain_font_family."\n";
    9794        my $new_exp_font_family = CssStyleToExpAttr::convert_font_family($obtain_font_family); 
    9895
     
    10299    }
    103100   
    104     if(defined $css_attr->{'font-face'}){
    105         print STDERR "Font face attribute found: ".$css_attr->{'font-face'}."\n";
    106        
    107         #now need to call a method from CssStyleToExpAttr.pm to extract the matching
    108         #font symbol
    109         #s -
     101    if(defined $css_attr->{'font-style'}){
     102        print STDERR "Font style attribute found: ".$css_attr->{'font-style'}."\n";
    110103    }
    111104   
    112105    if(defined $css_attr->{'font-weight'}){
    113106        print STDERR "Font weight attribute found: ".$css_attr->{'font-weight'}."\n";
     107       
     108        my $css_font_face = $css_attr->{'font-weight'};
     109        $exp_font_face = CssStyleToExpAttr::convert_font_face($css_font_face);
    114110    }
    115111   
    116 #    if (defined $css_attr->{'font-face'}) {
    117 #   $font = conver_font_face($css_attr->{'font-face'});
    118 #    }
    119 
    120112     $exp_attr->{'f'} = $exp_font_family.$exp_font_face.$exp_font_size;
    121      
    122      print STDERR "**** final converted Expeditee font: ".$exp_attr->{'f'};
     113     print STDERR "exp attribute obtained: ".$exp_attr->{'f'}." ****\n";
    123114     
    124115    # background color
     
    581572    #don't want to add font information to non-text items!
    582573    my $deleted = delete $attr->{'f'};
    583    
    584     print STDERR "**** DELETED: $deleted \n";
    585574
    586575    $self->addRect($xl,$yt,$xr,$yb,$attr);
     
    617606    my $y = $html_node->{'yt'};
    618607    my $w = $html_node->{'xr'} - $x +1;
    619 
    620     print STDERR "**** CHECKING STYLE NODE: ".$html_node->{'style'}."\n";
     608   
    621609    my $attr = convertStyleToAttr($html_node->{'style'});
    622    
    623     #DEBUGGING
    624     if(defined $attr->{'f'}){
    625         print STDERR "***** Checking text attributes:".$attr->{'f'}."\n";
    626         print STDERR "****************************************\n";
    627     }
    628610   
    629611    # fudge factor for now (based on default font size used)
Note: See TracChangeset for help on using the changeset viewer.