summaryrefslogtreecommitdiffstats
path: root/krfb/libvncserver/bdf2c.pl
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitbcb704366cb5e333a626c18c308c7e0448a8e69f (patch)
treef0d6ab7d78ecdd9207cf46536376b44b91a1ca71 /krfb/libvncserver/bdf2c.pl
downloadtdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.tar.gz
tdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'krfb/libvncserver/bdf2c.pl')
-rw-r--r--krfb/libvncserver/bdf2c.pl60
1 files changed, 60 insertions, 0 deletions
diff --git a/krfb/libvncserver/bdf2c.pl b/krfb/libvncserver/bdf2c.pl
new file mode 100644
index 00000000..fc437127
--- /dev/null
+++ b/krfb/libvncserver/bdf2c.pl
@@ -0,0 +1,60 @@
+#!/usr/bin/perl
+
+@encodings=();
+for($i=0;$i<256*5;$i++) {
+ $encodings[$i]="0";
+}
+
+$out="";
+$counter=0;
+$fontname="default";
+
+$i=0;
+$searchfor="";
+$nullx="0x";
+
+while(<>) {
+ if(/^FONT (.*)$/) {
+ $fontname=$1;
+ $fontname=~y/\"//d;
+ } elsif(/^ENCODING (.*)$/) {
+ $glyphindex=$1;
+ $searchfor="BBX";
+ $dwidth=0;
+ } elsif(/^DWIDTH (.*) (.*)/) {
+ $dwidth=$1;
+ } elsif(/^BBX (.*) (.*) (.*) (.*)$/) {
+ ($width,$height,$x,$y)=($1,$2,$3,$4);
+ @encodings[$glyphindex*5..($glyphindex*5+4)]=($counter,$width,$height,$x,$y);
+ if($dwidth != 0) {
+ $encodings[$glyphindex*5+1]=$dwidth;
+ } else {
+ $dwidth=$width;
+ }
+ $searchfor="BITMAP";
+ } elsif(/^BITMAP/) {
+ $i=1;
+ } elsif($i>0) {
+ if($i>$height) {
+ $i=0;
+ $out.=" /* $glyphindex */\n";
+ } else {
+ 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));
+ s/(..)/$nullx$1,/g;
+ $out.=$_;
+ $i++;
+ }
+ }
+}
+
+print "unsigned char " . $fontname . "FontData[$counter]={\n" . $out;
+print "};\nint " . $fontname . "FontMetaData[256*5]={\n";
+for($i=0;$i<256*5;$i++) {
+ print $encodings[$i] . ",";
+}
+print "};\nrfbFontData " . $fontname . "Font={" .
+ $fontname . "FontData, " . $fontname . "FontMetaData};\n";