--- loncom/xml/lonplot.pm 2007/08/03 06:00:18 1.123 +++ loncom/xml/lonplot.pm 2007/08/03 06:08:06 1.124 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Dynamic plot # -# $Id: lonplot.pm,v 1.123 2007/08/03 06:00:18 albertel Exp $ +# $Id: lonplot.pm,v 1.124 2007/08/03 06:08:06 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -703,6 +703,7 @@ my %font_properties = ); sub get_font { + my ($target) = @_; my ($size, $selected_font); if ( $Apache::lonplot::plot{'font'} =~ /^(small|medium|large)/) { @@ -720,6 +721,9 @@ sub get_font { $size = $Apache::lonplot::plot{'font'}; $selected_font = $font_properties{$Apache::lonplot::plot{'fontface'}}; } + if ($target eq 'tex' && defined($Apache::lonplot::plot{'texfont'})) { + $size = $Apache::lonplot::plot{'texfont'}; + } return ($size, $selected_font); } @@ -1117,10 +1121,9 @@ sub get_attributes{ ##------------------------------------------------------- write_gnuplot_file sub write_gnuplot_file { my ($tmpdir,$filename,$target)= @_; - my ($fontsize, $font_properties) = &get_font(); + my ($fontsize, $font_properties) = &get_font($target); my $gnuplot_input = ''; my $curve; - my $pt = $Apache::lonplot::plot{'texfont'}; # # Check to be sure we do not have any empty curves my @curvescopy; @@ -1234,9 +1237,9 @@ sub write_gnuplot_file { # title, xlabel, ylabel # titles if ($target eq 'tex') { - $gnuplot_input .= "set title \"$title\" font \"".$font_properties->{'printname'}.",".$pt."pt\"\n" if (defined($title)) ; - $gnuplot_input .= "set xlabel \"$xlabel\" font \"".$font_properties->{'printname'}.",".$pt."pt\"\n" if (defined($xlabel)); - $gnuplot_input .= "set ylabel \"$ylabel\" font \"".$font_properties->{'printname'}.",".$pt."pt\"\n" if (defined($ylabel)); + $gnuplot_input .= "set title \"$title\" font \"".$font_properties->{'printname'}.",".$fontsize."pt\"\n" if (defined($title)) ; + $gnuplot_input .= "set xlabel \"$xlabel\" font \"".$font_properties->{'printname'}.",".$fontsize."pt\"\n" if (defined($xlabel)); + $gnuplot_input .= "set ylabel \"$ylabel\" font \"".$font_properties->{'printname'}.",".$fontsize."pt\"\n" if (defined($ylabel)); } else { $gnuplot_input .= "set title \"$title\" \n" if (defined($title)) ; $gnuplot_input .= "set xlabel \"$xlabel\" \n" if (defined($xlabel)); @@ -1284,7 +1287,7 @@ sub write_gnuplot_file { $gnuplot_input .= 'set label "'.$label->{'text'}.'" at '. $label->{'xpos'}.','.$label->{'ypos'}.' '.$label->{'justify'}; if ($target eq 'tex') { - $gnuplot_input .=' font "'.$font_properties->{'printname'}.','.$pt.'pt"' ; + $gnuplot_input .=' font "'.$font_properties->{'printname'}.','.$fontsize.'pt"' ; } $gnuplot_input .= $/; }