Return to convertjme.pl CVS log | Up to [LON-CAPA] / loncom / homework |
version 1.10, 2005/01/25 14:55:15 | version 1.13, 2005/02/09 21:50:06 |
---|---|
Line 137 if ($png) { | Line 137 if ($png) { |
my %electrons = ("C",4,"N",5,"P",5,"O",6,"S",6); | my %electrons = ("C",4,"N",5,"P",5,"O",6,"S",6); |
my %font_width = (" ",250,"+",564,"-",500,"0",500,"1",500,"2",500,"3",500,"4",500,"5",500,"6",500,"7",500,"8",500,"9",500,"A",722,"B",667,"C",667,"D",722,"E",611,"F",556,"G",722,"H",722,"I",333,"J",389,"K",722,"L",611,"M",889,"N",722,"O",722,"P",556,"Q",722,"R",667,"S",556,"T",611,"U",722,"V",722,"W",944,"X",722,"Y",722,"Z",611,"a",444,"b",500,"c",444,"d",500,"e",444,"f",333,"g",500,"h",500,"i",278,"j",278,"k",500,"l",278,"m",778,"n",500,"o",500,"p",500,"q",500,"r",333,"s",389,"t",278,"u",500,"v",500,"w",722,"x",500,"y",500,"z",444); | my %font_width = (" ",250,"+",564,"-",500,"0",500,"1",500,"2",500,"3",500,"4",500,"5",500,"6",500,"7",500,"8",500,"9",500,"A",722,"B",667,"C",667,"D",722,"E",611,"F",556,"G",722,"H",722,"I",333,"J",389,"K",722,"L",611,"M",889,"N",722,"O",722,"P",556,"Q",722,"R",667,"S",556,"T",611,"U",722,"V",722,"W",944,"X",722,"Y",722,"Z",611,"a",444,"b",500,"c",444,"d",500,"e",444,"f",333,"g",500,"h",500,"i",278,"j",278,"k",500,"l",278,"m",778,"n",500,"o",500,"p",500,"q",500,"r",333,"s",389,"t",278,"u",500,"v",500,"w",722,"x",500,"y",500,"z",444); |
my $font = '/usr/share/fonts/default/Type1/n021003l.pfb'; | my $font = '/home/httpd/html/adm/fonts/DejaVuSerif-Roman.ttf'; |
my $pointsize = 20; | my $pointsize = 20; |
my ($ptsize,@bounds); | my ($ptsize,@bounds); |
if ($png) { | if ($png) { |
Line 396 foreach my $struct (@all_structs) { | Line 396 foreach my $struct (@all_structs) { |
(shift @formula) =~ /([A-Z][a-z]?)(\d*)/; | (shift @formula) =~ /([A-Z][a-z]?)(\d*)/; |
my $carrige = $x[$i]-stringWidth($1)/2; | my $carrige = $x[$i]-stringWidth($1)/2; |
$carrige = printElement ($1,$2,$carrige,$y[$i]); | $carrige = printElement ($1,$2,$carrige,$y[$i]); |
my $y = (@formula > 0) ? $y[$i] + fm2cm(800) : $y[$i]; | my $y = (@formula > 0) ? $y[$i] + fm2cm(900) : $y[$i]; |
$carrige = | $carrige = |
(@formula > 0) ? $x[$i]-stringWidth($1)/2 : $carrige; | (@formula > 0) ? $x[$i]-stringWidth($1)/2 : $carrige; |
foreach (@formula) { | foreach (@formula) { |
Line 409 foreach my $struct (@all_structs) { | Line 409 foreach my $struct (@all_structs) { |
(shift @formula) =~ /([A-Z][a-z]?)(\d*)/; | (shift @formula) =~ /([A-Z][a-z]?)(\d*)/; |
my $carrige = $x[$i]-stringWidth($1)/2; | my $carrige = $x[$i]-stringWidth($1)/2; |
$carrige = printElement ($1,$2,$carrige,$y[$i]); | $carrige = printElement ($1,$2,$carrige,$y[$i]); |
my $y = (@formula > 0) ? $y[$i] + fm2cm(-800) : $y[$i]; | my $y = (@formula > 0) ? $y[$i] + fm2cm(-900) : $y[$i]; |
$carrige = | $carrige = |
(@formula > 0) ? $x[$i]-stringWidth($1)/2 : $carrige; | (@formula > 0) ? $x[$i]-stringWidth($1)/2 : $carrige; |
foreach (@formula) { | foreach (@formula) { |
Line 552 sub printCharge_png { | Line 552 sub printCharge_png { |
my ($sign,$charge,$x,$y) = @_; | my ($sign,$charge,$x,$y) = @_; |
my $yy = 662; | my $yy = 662; |
$sign = "–" if ($sign eq "-"); # replace by n-dash | $sign = "−" if ($sign eq "-"); # replace by n-dash |
$charge = "" if ($charge == 1); | $charge = "" if ($charge == 1); |
$charge .= $sign; | $charge .= $sign; |