You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
libtdevnc/bdf2c.pl

45 lines
848 B

#!/usr/bin/perl
@encodings=();
for($i=0;$i<256*5;$i++) {
$encodings[$i]="0";
}
$out="";
$counter=0;
$i=0;
$searchfor="";
$nullx="0x";
while(<>) {
if(/^ENCODING (.*)$/) {
$glyphindex=$1;
$searchfor="BBX";
} elsif(/^BBX (.*) (.*) (.*) (.*)$/) {
($width,$height,$x,$y)=($1,$2,$3,$4);
@encodings[$glyphindex*5..($glyphindex*5+4)]=($counter,$width,$height,$x,$y);
$searchfor="BITMAP";
} elsif(/^BITMAP/) {
$i=1;
} elsif($i>0) {
if($i>$height) {
$i=0;
$out.=" /* $glyphindex */\n";
} else {
$_=substr($_,0,length($_)-1);
$counter+=length($_)/2;
s/(..)/$nullx$1,/g;
$out.=$_;
$i++;
}
}
}
print "unsigned char bdffontdata[$counter]={\n" . $out;
print "};\nint bdffontmetadata[256*5]={\n";
for($i=0;$i<256*5;$i++) {
print $encodings[$i] . ",";
}
print "};\n";