1#!@PERL@ 2# This is a help script to converting font_src.bit to bdf. 3# 4# programmed by KANOU Hiroki <kanou@mil.allnet.ne.jp> 5# modified by Yasuyuki Furukawa <Furukawa.Yasuyuki@fujixerox.co.jp> 6# 7# * public domain * 8# 9 10$verbose = 0; 11$verbose_min = 100; 12 13@vmeter = ("|", "\\", "-", "/"); 14 15for $opt (@ARGV) { 16 if ($opt =~ /^-/) { # option 17 $verbose = 1 if $opt eq '-V'; # verbose 18 next; 19 } else { 20 $file = $opt; 21 last; 22 } 23} 24 25if ($verbose) { 26 $col = int(`stty size 2>/dev/null | sed 's/.* //'`) || 80; 27} 28 29$file= "-" unless $file; 30$ch_count = 0; 31open F, $file || die; 32 33while (<F>) { 34 if (/^ENDCHAR/) { 35 $flag = 0; 36 s/\s*#.*//; 37 print; 38 if (($ch_count++ % 100) == 0 && $verbose != 0 && $max_chars > $verbose_min) { 39 $n = int($ch_count * 100 / $max_chars); 40 $m = int($n * ($col - 21) / 100); 41 $l = $col - 20 - $m; 42 print STDERR "\rprogress|". ("=" x $m). (" " x $l). "$n\%". 43 $vmeter[$ch_count2++ % 4]; 44 } 45 } elsif ($flag == 1) { 46 chomp; 47 tr/pPOo@:;,\\\/./##### /; 48 print unpack("H*", pack("B*", $_)), "\n"; 49 } elsif (/^BITMAP/) { 50 $flag = 1; 51 print; 52 } elsif (/^CHARS\s+(\d+)/) { 53 $max_chars = $1; 54 print; 55 } elsif (/\S/) { 56 print; 57 } 58} 59 60# clear progress bar 61print STDERR "\r" . (" " x ($col - 1)) . "\r" if ($verbose != 0); 62 63if ($ch_count != $max_chars) { 64 print STDERR 65 "'CHARS' line in $ARGV says that $max_chars glyphs are included,\n", 66 "but actual number of glyphs are $ch_count. check and correct.\n"; 67 exit 1; 68} else { 69 exit 0; 70} 71