From: Hironori S. <hs...@mt...> - 2002-02-08 03:06:52
|
$B:dK\$G$9!#(B $B=D=q$-MQ(B 14x14 font$B!"$H$$$C$F$bEl1@%U%)%s%H$N(B shnm7x14a.bdf $B$r(B $BJQ49$9$k%9%/%j%W%H$G$9!#(B $B!X(B(){}[]<>|-+*=:;$B!Y$O2sE>!"B>$NJ8;z$OCf1{$K$:$i$7$?$@$1$G$9!#(B # $B$J$s$+Hs>o$K7Z$/$J$C$F$$$^$9$M!#(B ----------------------------------- $B:dK\(B $B9@B'(B <hs...@mt...> http://www2u.biglobe.ne.jp/~hsaka/ #!/usr/bin/perl map { $C[ord($_)] = 1; } split('', '({[<'); map { $C[ord($_)] = 2; } split('', ')}]>'); map { $C[ord($_)] = 3; } split('', '|-+*=:;'); while(<>) { s/-C-(\d+)/"-VC-" . $1 * 2/e; s/^((FONTBOUNDINGBOX|AVERAGE_WIDTH|X_HEIGHT|QUAD_WIDTH)\s+)(\d+)/$1 . $3* 2/e; print; /^CHARS\s+/ && last; } while(<>) { s/^((DWIDTH|BBX)\s+)(\d+)/$1 . $3 * 2/e; print; if (s/^ENCODING\s+//) { $c = $_; } /^BITMAP/ || next; @b = (); while(<>) { /^ENDCHAR/ && last; push(@b, hex($_)); } &conv($c, @b); print; } sub conv { local($c, @b) = @_; local($_); @b = map { $_ >> 1 } @b; if ($C[$c] == 1) { @b = &rotate(@b); } elsif ($C[$c] == 2) { @b = map { $_ << 7 } @b; @b = &rotate(@b); } elsif ($C[$c] == 3) { @b = map { $_ << 3 } @b; @b = &rotate(@b); } else { @b = map { $_ << 3 } @b; } map { printf "%04x\n", $_ << 2 } @b; } sub rotate { local(@b) = @_; local(@c) = (); local($i, $j, $x); for $i (0 .. $#b) { $x = 0; for $j (0 .. $#b) { $x = ($x << 1) | (($b[$#b - $j] >> $i) & 1); } unshift(@c, $x); } return @c; } |