Mercurial > hg > Applications > 14x14ja
view bdf2ascii.pl @ 2:7f5d4dad9d6b
merge operation
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 15 Jun 2013 18:19:15 +0900 |
parents | a6ddaa18e3c1 |
children | 4ed010b4a017 |
line wrap: on
line source
#!/usr/bin/perl use strict; my ($name,$encoding,@bitmap); while(<>) { last if (/^ENDPROP/); } my $dum = <>; # skip CHARS while(<>) { if(/^STARTCHAR\s+(.*)/) { &init(); $name=$1; print; } elsif (/^ENCODING\s+(\d+)/) { $encoding=$1; print; } elsif (/^SWIDTH (\d+) (\d+)/) { print; } elsif (/^DWIDTH (\d+) (\d+)/) { print; } elsif (/^BBX ([-+\d]+) ([-+\d]+) ([-+\d]+) ([-+\d]+)/) { print; } elsif (/^BITMAP/) { print; } elsif (/^ENDCHAR/) { &display(); } elsif (/^[0-9a-zA-Z]/) { chop; push(@bitmap,$_); } } sub display { for my $hex (@bitmap) { my $h = pack("H*",$hex); my $b = unpack("B*",$h); $b =~ s/./$&$&/g; $b =~ tr/01/ */; print "$b\n"; } print "\n"; } sub init { $name = ''; $encoding = 0; @bitmap= (); }