/usr/bin/raw2psf is in console-cyrillic 0.9-17.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | #!/usr/bin/perl
open F,$ARGV[0] or die "Cannot open font file $ARGV[0]";
seek(F,0,2);
$size=tell(F);
if ($size % 256!=0) {
die "Size is not multiply of 256. Probably non-raw font file";
} else {
print STDERR "Doing ",$size/256," scan-line font\n";
}
$mode = 0;
if ($ARGV[1]) {
$mode = 2;
open T,$ARGV[1] or die "Cannot open unicode table $ARGV[1]";
while (<T>) {
chomp;
($glyph,$hexcode) = split /\s+/;
$glyph=hex($glyph);
if ($hexcode =~ /^U\+([a-fA-F0-9]+)/) {
$code = hex "0x$1";
} else {
$code=hex($hexcode)
}
if ($unicode[$glyph]) {
push @{$unicode[$glyph]},$code;
} else {
$unicode[$glyph]=[$code]
}
}
for ($i=0;$i<256;$i++) {
die "Unicode data are not defined for glyph $i" unless $unicode[$i]
}
$mode=2;
}
seek(F,0,0);
print "\066\004",chr($mode),chr($size/256);
read F,$data,$size;
print $data;
for ($i=0;$i<256;$i++) {
print pack ("v*", @{$unicode[$i]},0xffff);
}
=head1 NAME raw2psf
adds unicode mapping to given raw console font
=head1 SYNOPSYS
raw2psf fontfile sfmfile >font.psf
=head1 DESCRIPTION
Reads raw console font and sfm (screen font map file) and
writes to stdout font file in psf format with Unicode mapping.
Supports either 256 or 512 char fonts
=head1 SEE ALSO
B<consolechars>(1), documentation files in B<console-tools> package.
=head1 COPYRIGHT
Public domain. Made on Earth
=head1 AUTHOR
Victor Wagner E<lt>vitus@ice.ruE<gt>
|