--- m/menu.pl 2001/06/29 11:12:59 1.5 +++ m/menu.pl 2001/10/10 12:00:18 1.6 @@ -7,12 +7,31 @@ use constant TYPE_NONE => scalar 2; use constant TYPE_BULLET => scalar 3; use constant TYPE_LINE => scalar 1; +use constant TYPE_BLUEDOT => scalar 4; # size of menu image my $w=125; my $h_base=13; my $h; +my %iso2utf_tab = ( +'¹' => 0x0161, 'ð' => 0x0111, 'è' => 0x010d, 'æ' => 0x0107, '¾' => 0x017e, +'©' => 0x0160, 'Ð' => 0x0110, 'È' => 0x010c, 'Æ' => 0x0106, '®' => 0x017d +); + +sub iso2utf { + local($_)=@_; + + sub utf8 { + local($_)=@_; + return $_ < 0x80 ? chr($_) : + $_ < 0x800 ? chr($_>>6&0x3F|0xC0) . chr($_&0x3F|0x80) : + chr($_>>12&0x0F|0xE0).chr($_>>6&0x3F|0x80).chr($_&0x3F|0x80); + } + s/([¹ðè澩ÐÈÆ®])/utf8($iso2utf_tab{$1})/ge; + return $_; +} + sub dump_gif { my ($text, $type, $file) = @_; $type ||= TYPE_NONE; @@ -27,6 +46,8 @@ my $image = Image::Magick->new; $image->Set('size' => "${w}x${h}"); $image->Read('xc:#283880'); + $text=~tr/šðžèæŠÐŽÈÆ/¹ð¾èæ©Ð®ÈÆ/; # 1250 -> iso8859-2 + $text=iso2utf($text); if ($type == TYPE_BULLET) { $image->Annotate('text' => $text, 'geometry' => '+17+10', 'font' => "\@arialbd.ttf", 'pointsize' => 11, @@ -38,6 +59,13 @@ $image->Draw('primitive' => 'rectangle', 'stroke' => '#00D000', 'fill' => '#00D000', 'antialias' => 1, 'points' => '7,4 10,7'); + } elsif ($type == TYPE_BLUEDOT) { + $image->Annotate('text' => $text, 'geometry' => '+17+10', + 'font' => "\@arialbd.ttf", 'pointsize' => 11, + 'fill' => '#ffffff', 'align' => 'left'); + $image->Draw('primitive' => 'rectangle', 'stroke' => '#00b2dc', + 'fill' => '#00b2dc', 'antialias' => 1, 'points' => + '7,4 10,7'); } else { if ($type == TYPE_LINE) { $image->Draw('primitive' => 'line',