Changeset 26727
- Timestamp:
- 2013-01-15T20:53:38+13:00 (11 years ago)
- Location:
- gs3-extensions/html-to-expeditee/trunk/src/perllib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
gs3-extensions/html-to-expeditee/trunk/src/perllib/CssStyleToExpAttr.pm
r24944 r26727 55 55 "tahoma" => "sans-serif", 56 56 "geneva" => "sans-serif", 57 "georgia" => "serif", 57 58 "times" => "serif", 58 59 "times new roman" => "serif", … … 351 352 my $exp_font_size = undef; 352 353 353 if ($css_font_size =~ m/^(\d+(?:\.\d*))px$/) { 354 $exp_font_size = int($1); 355 } 354 355 #if ($css_font_size =~ m/^(\d+(?:\.\d*))px$/) { 356 # $exp_font_size = int($1); 357 #} 358 359 $css_font_size =~ s/[^0-9]//g; 360 361 if(defined $css_font_size){ 362 $exp_font_size = $css_font_size; 363 } 356 364 357 365 return $exp_font_size; … … 384 392 return $exp_color; 385 393 } 394 395 sub convert_font_family 396 { 397 my ($css_font_family) = @_; 398 399 print STDERR "*** PASSING PARAMETER css font family: ".$css_font_family."\n"; 400 401 my $exp_font_family; 402 403 #use $font_specific_family_lookup and $font_generic_family_lookup 404 #to find the appropriate font family tag to output to expeditee. 405 if(defined $font_specific_family_lookup->{lc($css_font_family)}){ 406 $exp_font_family = $css_font_family."_"; 407 } 408 409 print STDERR "**** TESTING TESTING ".$font_specific_family_lookup->{"georgia"}."\n"; 410 print STDERR "**** TESTING TESTING ".$font_specific_family_lookup->{lc($css_font_family)}."\n"; 411 print STDERR "**** TESTING TESTING ".$font_specific_family_lookup->{$css_font_family}."\n"; 412 print STDERR "In CssStyleToExpAttr: font family attribute: $exp_font_family ******* \n"; 413 414 return $exp_font_family; 415 } 416 417 sub convert_font_style 418 { 419 my ($css_font_style) = @_; 420 421 my $exp_font_style; 422 423 return $exp_font_style; 424 } 386 425 387 426 1; 388 -
gs3-extensions/html-to-expeditee/trunk/src/perllib/ExpediteeFrameIO.pm
r26695 r26727 77 77 my $exp_font_family = "s"; # t 78 78 my $exp_font_face = "r"; 79 my $exp_font_size = "1 4";79 my $exp_font_size = "18"; 80 80 81 81 # if (defined $css_attr->{'font-family'}) { … … 84 84 85 85 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 90 116 # if (defined $css_attr->{'font-face'}) { 91 117 # $font = conver_font_face($css_attr->{'font-face'}); 92 118 # } 93 119 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 96 124 # background color 97 125 98 126 99 127 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; 105 133 } 106 134 … … 550 578 } 551 579 } 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"; 552 585 553 586 $self->addRect($xl,$yt,$xr,$yb,$attr); … … 578 611 } 579 612 elsif ($type eq "text") { 613 580 614 my $text = $html_node->{'text'}; 581 615 … … 584 618 my $w = $html_node->{'xr'} - $x +1; 585 619 620 print STDERR "**** CHECKING STYLE NODE: ".$html_node->{'style'}."\n"; 586 621 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 588 629 # fudge factor for now (based on default font size used) 589 630 $y += 16; # y-value of text item in Expeditee is it's base line
Note:
See TracChangeset
for help on using the changeset viewer.