Ignore:
Timestamp:
2013-01-16T18:56:21+13:00 (11 years ago)
Author:
davidb
Message:

Can now correctly obtain colours and size of text when generating Expeditee frames. Also accounted for when the web browser being used is Firefox (FF uses "700" instead of the word "bold" for font-weight). The width of text items is also calculated and written to Expeditee. Parameters have also been provided so the user can decide whether they want the correct font information and text width used or to just use default values.

File:
1 edited

Legend:

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

    r26729 r26731  
    352352    my $exp_font_size = undef;
    353353
    354    
    355354    if ($css_font_size =~ m/^(\d+(?:\.\d*))px$/) {
    356355        $exp_font_size = int($1);
    357     }
     356    }else{ 
     357        #FF rounds sizes, e.g. 16.13px will just be 16px.
     358        my $end_index = length($css_font_size) - 2;
     359        $exp_font_size = substr($css_font_size,0,$end_index);
     360    }
    358361   
    359362    return $exp_font_size;
     
    365368    my $exp_font_face = undef;
    366369   
    367     if(lc($css_font_face) eq "bold"){
     370    #Firefox uses '700' instead of 'bold' for font-weight.
     371    if(lc($css_font_face) eq "bold" || $css_font_face eq "700"){
    368372            $exp_font_face = "b";
    369     }elsif(lc($css_font_face) eq "italic"){     #for now - also need to take into account italic and italic bold.
     373    }elsif(lc($css_font_face) eq "italic"){
    370374        $exp_font_face = "i";
    371     }elsif(lc($css_font_face) eq "bold-italic"){
     375    }elsif(lc($css_font_face) eq "bold-italic" || $css_font_face eq "700-italic"){
    372376        $exp_font_face = "p";
    373377    }else{
    374378        $exp_font_face = "r";
    375379    }
    376 
     380   
    377381    return $exp_font_face;
    378382}
Note: See TracChangeset for help on using the changeset viewer.