Subject: | Bad code produced with degree symbol |
Date: | Thu, 11 May 2017 12:24:07 +0100 |
To: | bug-SVG [...] rt.cpan.org |
From: | Bob Goddard <perl-svg [...] 1.perl-svg.bgcomp.co.uk> |
Simple code below produces code for the degree symbol as "Temperature & #176".
For some reason, I am getting 4 spaces between the ampersand and the hash.
The printf statement produces the correct single character.
This is with V2.64.
#!/usr/bin/perl
use base;
use POSIX;
use SVG;
use strict;
use warnings;
use Carp;
use Readonly;
Readonly my $DEGREE=>176;
Readonly my $rr=>"Temperature " . chr($DEGREE);
my $svg = SVG->new(width=>60 + 60 * 60 * 24 * 31 / (60 * 30) + 20, height=>260);
$svg->desc()->cdata('Monthly power usage descrption');
$svg->title()->cdata('Monthly power usage');
$svg->rectangle(x=>0, y=>0, width=>(60 + ((60 * 60 * 24 * 31) / (60 * 30)) + 20), rx=>10, ry=>10, height=>260, fill=>'#2080dd', id=>'rect_1');
my $verttxt = $svg->group( id=>"textLayout5", transform=>"translate(0, 0)");
$verttxt->text(x=>"0", y=>"0",
style=>{'font-family'=>'Verdana',
fill=>'black','font-size'=>"14pt",
stroke=>'none',
'writing-mode'=>'lr',
'text-anchor'=>'middle'},
transform=>"translate(30, 130), rotate(-90)"
)->cdata($rr);
print($rr . '\n');
$verttxt->text(x=>"10", y=>"250",
style=>{'font-family'=>'Verdana',
fill=>'black','font-size'=>"14pt",
stroke=>'none',
'writing-mode'=>'lr',
'text-anchor'=>'start'}
)->cdata('Voltage V');