Ignore:
Timestamp:
2013-01-15T20:53:38+13:00 (11 years ago)
Author:
davidb
Message:

Working on obtaining the correct font information for text elements on an html page.

File:
1 edited

Legend:

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

    r26695 r26727  
    7777    my $exp_font_family = "s"; # t
    7878    my $exp_font_face = "r";
    79     my $exp_font_size = "14";
     79    my $exp_font_size = "18";
    8080
    8181#    if (defined $css_attr->{'font-family'}) {
     
    8484
    8585    if (defined $css_attr->{'font-size'}) {
    86     my $css_font_size = $css_attr->{'font-size'};
    87     $exp_font_size = CssStyleToExpAttr::convert_font_size($css_font_size);
    88     }
    89 
     86       
     87        my $css_font_size = $css_attr->{'font-size'};
     88        $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";
     92    }
     93   
     94    if(defined $css_attr->{'font-family'}){
     95        my $obtain_font_family = $css_attr->{'font-family'};
     96        print STDERR "Font family attribute found: ".$obtain_font_family."\n";
     97        my $new_exp_font_family = CssStyleToExpAttr::convert_font_family($obtain_font_family); 
     98
     99        if(defined $new_exp_font_family){
     100            $exp_font_family = $new_exp_font_family;
     101        }
     102    }
     103   
     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 -
     110    }
     111   
     112    if(defined $css_attr->{'font-weight'}){
     113        print STDERR "Font weight attribute found: ".$css_attr->{'font-weight'}."\n";
     114    }
     115   
    90116#    if (defined $css_attr->{'font-face'}) {
    91117#   $font = conver_font_face($css_attr->{'font-face'});
    92118#    }
    93119
    94 #    $exp_attr->{'f'} = $exp_font_family.$exp_font_face.$exp_font_size;
    95 
     120     $exp_attr->{'f'} = $exp_font_family.$exp_font_face.$exp_font_size;
     121     
     122     print STDERR "**** final converted Expeditee font: ".$exp_attr->{'f'};
     123     
    96124    # background color
    97125
    98126
    99127    if (defined $css_attr->{'background-color'}) {
    100     my $css_color = $css_attr->{'background-color'};
    101 
    102     my $exp_color = CssStyleToExpAttr::convert_color($css_color);
    103 
    104     $exp_attr->{'e'} = $exp_color;
     128        my $css_color = $css_attr->{'background-color'};
     129
     130        my $exp_color = CssStyleToExpAttr::convert_color($css_color);
     131
     132        $exp_attr->{'e'} = $exp_color;
    105133    }
    106134
     
    550578        }
    551579    }
     580   
     581    #don't want to add font information to non-text items!
     582    my $deleted = delete $attr->{'f'};
     583   
     584    print STDERR "**** DELETED: $deleted \n";
    552585
    553586    $self->addRect($xl,$yt,$xr,$yb,$attr);
     
    578611    }
    579612    elsif ($type eq "text") {
     613   
    580614    my $text = $html_node->{'text'};
    581615
     
    584618    my $w = $html_node->{'xr'} - $x +1;
    585619
     620    print STDERR "**** CHECKING STYLE NODE: ".$html_node->{'style'}."\n";
    586621    my $attr = convertStyleToAttr($html_node->{'style'});
    587 
     622   
     623    #DEBUGGING
     624    if(defined $attr->{'f'}){
     625        print STDERR "***** Checking text attributes:".$attr->{'f'}."\n";
     626        print STDERR "****************************************\n";
     627    }
     628   
    588629    # fudge factor for now (based on default font size used)
    589630    $y += 16; # y-value of text item in Expeditee is it's base line
Note: See TracChangeset for help on using the changeset viewer.