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.
61 lines
1.3 KiB
61 lines
1.3 KiB
24 years ago
|
#!/usr/bin/perl
|
||
|
|
||
|
@encodings=();
|
||
|
for($i=0;$i<256*5;$i++) {
|
||
|
$encodings[$i]="0";
|
||
|
}
|
||
|
|
||
|
$out="";
|
||
|
$counter=0;
|
||
24 years ago
|
$fontname="default";
|
||
24 years ago
|
|
||
|
$i=0;
|
||
|
$searchfor="";
|
||
|
$nullx="0x";
|
||
|
|
||
|
while(<>) {
|
||
24 years ago
|
if(/^FONT (.*)$/) {
|
||
|
$fontname=$1;
|
||
24 years ago
|
$fontname=~y/\"//d;
|
||
24 years ago
|
} elsif(/^ENCODING (.*)$/) {
|
||
24 years ago
|
$glyphindex=$1;
|
||
|
$searchfor="BBX";
|
||
24 years ago
|
$dwidth=0;
|
||
|
} elsif(/^DWIDTH (.*) (.*)/) {
|
||
|
$dwidth=$1;
|
||
24 years ago
|
} elsif(/^BBX (.*) (.*) (.*) (.*)$/) {
|
||
|
($width,$height,$x,$y)=($1,$2,$3,$4);
|
||
|
@encodings[$glyphindex*5..($glyphindex*5+4)]=($counter,$width,$height,$x,$y);
|
||
24 years ago
|
if($dwidth != 0) {
|
||
|
$encodings[$glyphindex*5+1]=$dwidth;
|
||
|
} else {
|
||
|
$dwidth=$width;
|
||
|
}
|
||
24 years ago
|
$searchfor="BITMAP";
|
||
|
} elsif(/^BITMAP/) {
|
||
|
$i=1;
|
||
|
} elsif($i>0) {
|
||
|
if($i>$height) {
|
||
|
$i=0;
|
||
|
$out.=" /* $glyphindex */\n";
|
||
|
} else {
|
||
24 years ago
|
if(int(($dwidth+7)/8) > int(($width+7)/8)) {
|
||
|
$_ .= "00"x(int(($dwidth+7)/8)-int(($width+7)/8));
|
||
|
}
|
||
|
$_=substr($_,0,(int(($dwidth+7)/8)*2));
|
||
|
$counter+=(int(($dwidth+7)/8));
|
||
24 years ago
|
s/(..)/$nullx$1,/g;
|
||
|
$out.=$_;
|
||
|
$i++;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
24 years ago
|
print "unsigned char " . $fontname . "FontData[$counter]={\n" . $out;
|
||
|
print "};\nint " . $fontname . "FontMetaData[256*5]={\n";
|
||
24 years ago
|
for($i=0;$i<256*5;$i++) {
|
||
|
print $encodings[$i] . ",";
|
||
|
}
|
||
24 years ago
|
print "};\nrfbFontData " . $fontname . "Font={" .
|
||
|
$fontname . "FontData, " . $fontname . "FontMetaData};\n";
|