Changeset 26728 for gs3-extensions/html-to-expeditee
- Timestamp:
- 2013-01-15T22:49:23+13:00 (11 years ago)
- Location:
- gs3-extensions/html-to-expeditee/trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
gs3-extensions/html-to-expeditee/trunk/src/perllib/CssStyleToExpAttr.pm
r26727 r26728 353 353 354 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; 355 if ($css_font_size =~ m/^(\d+(?:\.\d*))px$/) { 356 $exp_font_size = int($1); 357 } 358 359 return $exp_font_size; 360 } 361 362 sub convert_font_face 363 { 364 my ($css_font_face) = @_; 365 my $exp_font_face = undef; 366 367 if(lc($css_font_face) eq "bold"){ 368 $exp_font_face = "b"; 369 }else{ #for now - also need to take into account italic and italic bold. 370 $exp_font_face = "r"; 363 371 } 364 372 365 return $exp_font_size;373 return $exp_font_face; 366 374 } 367 375 … … 405 413 if(defined $font_specific_family_lookup->{lc($css_font_family)}){ 406 414 $exp_font_family = $css_font_family."_"; 415 }else{ 416 417 #to account for instances where a list of fonts is stored as the font family, e.g. "Arial,Segoe...Sans-Serif". 418 #just extract the first font name from this list. 419 my @font_family_vals = split(',',$css_font_family); 420 421 if(scalar(@font_family_vals) > 0){ 422 $exp_font_family = $font_family_vals[0]."_"; 423 } 424 407 425 } 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 426 414 427 return $exp_font_family; -
gs3-extensions/html-to-expeditee/trunk/src/perllib/ExpediteeFrameIO.pm
r26727 r26728 87 87 my $css_font_size = $css_attr->{'font-size'}; 88 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"; 89 92 90 } 93 91 94 92 if(defined $css_attr->{'font-family'}){ 95 93 my $obtain_font_family = $css_attr->{'font-family'}; 96 print STDERR "Font family attribute found: ".$obtain_font_family."\n";97 94 my $new_exp_font_family = CssStyleToExpAttr::convert_font_family($obtain_font_family); 98 95 … … 102 99 } 103 100 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"; 110 103 } 111 104 112 105 if(defined $css_attr->{'font-weight'}){ 113 106 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); 114 110 } 115 111 116 # if (defined $css_attr->{'font-face'}) {117 # $font = conver_font_face($css_attr->{'font-face'});118 # }119 120 112 $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"; 123 114 124 115 # background color … … 581 572 #don't want to add font information to non-text items! 582 573 my $deleted = delete $attr->{'f'}; 583 584 print STDERR "**** DELETED: $deleted \n";585 574 586 575 $self->addRect($xl,$yt,$xr,$yb,$attr); … … 617 606 my $y = $html_node->{'yt'}; 618 607 my $w = $html_node->{'xr'} - $x +1; 619 620 print STDERR "**** CHECKING STYLE NODE: ".$html_node->{'style'}."\n"; 608 621 609 my $attr = convertStyleToAttr($html_node->{'style'}); 622 623 #DEBUGGING624 if(defined $attr->{'f'}){625 print STDERR "***** Checking text attributes:".$attr->{'f'}."\n";626 print STDERR "****************************************\n";627 }628 610 629 611 # fudge factor for now (based on default font size used) -
gs3-extensions/html-to-expeditee/trunk/src/src/cgi-bin/html-to-expeditee.pl.in
r26725 r26728 256 256 var expFrame = JSON.stringify(expFrameTree); 257 257 258 console.log("******");259 258 console.log(expFrame); 260 259 -
gs3-extensions/html-to-expeditee/trunk/src/src/js/html-to-expeditee.js
r26726 r26728 5 5 var font_size; 6 6 var font_color; 7 var font_weight; 7 8 8 9 Element.prototype.getElementWidth = function() { … … 159 160 var new_font_color = getStyle(parent,"color"); 160 161 162 var new_font_weight = getStyle(parent,"font-weight"); 163 161 164 if(new_font_family !== undefined && new_font_family !== null) 162 165 font_family = new_font_family; … … 167 170 if(new_font_color !== undefined && new_font_color !== null) 168 171 font_color = new_font_color; 172 173 if(new_font_weight !== undefined && new_font_weight !== null) 174 font_weight = new_font_weight; 169 175 170 176 var data = parent.attributes["data"]; … … 173 179 jsonNode.data = data.value; 174 180 } 175 jsonNode.style = style; 176 } 177 } 178 181 179 182 var style = {}; 180 183 style["font-family"] = font_family; 181 184 style["font-size"] = font_size; 182 185 style["color"] = font_color; 186 style["font-weight"] = font_weight; 187 188 //TODO: if parent node is a <b> element, then set style["font-weight"] to be "bold". 189 190 jsonNode.style = style; 191 } 192 } 193 194 183 195 184 196 }
Note:
See TracChangeset
for help on using the changeset viewer.