summaryrefslogtreecommitdiffstats
path: root/utils/consolefont2c.pl
diff options
context:
space:
mode:
authorChristian Beier <dontmind@freeshell.org>2011-03-29 16:43:02 +0200
committerChristian Beier <dontmind@freeshell.org>2011-03-29 16:43:02 +0200
commiteeafad20bfbc4ff3728f02016d354ec28df01068 (patch)
tree9a9ea3061722b56e52bf098b4089c917e1dea5d1 /utils/consolefont2c.pl
parentc0e3fa40543a5de50c46ab436593479daf584870 (diff)
downloadlibtdevnc-eeafad20bfbc4ff3728f02016d354ec28df01068.tar.gz
libtdevnc-eeafad20bfbc4ff3728f02016d354ec28df01068.zip
Add a git-log to GNU-Style ChangeLog converter script.
Also put all helper scripts into a utils directory.
Diffstat (limited to 'utils/consolefont2c.pl')
-rwxr-xr-xutils/consolefont2c.pl38
1 files changed, 38 insertions, 0 deletions
diff --git a/utils/consolefont2c.pl b/utils/consolefont2c.pl
new file mode 100755
index 0000000..9196649
--- /dev/null
+++ b/utils/consolefont2c.pl
@@ -0,0 +1,38 @@
+#!/usr/bin/perl
+
+# convert a linux console font (8x16 format) to a font definition
+# suitable for processing with LibVNCServer
+
+#if($#ARGV == 0) { exit; }
+
+foreach $i (@ARGV) {
+ $fontname = $i;
+ $fontname =~ s/\.fnt$//;
+ $fontname =~ s/^.*\///g;
+ $fontname =~ y/+/_/;
+
+ print STDERR "$i -> $fontname\n";
+
+ open IN, "<$i";
+ print STDERR read(IN,$x,4096);
+ close(IN);
+
+ open OUT, ">$fontname.h";
+ print OUT "unsigned char ".$fontname."FontData[4096+1]={";
+ for($i=0;$i<4096;$i++) {
+ if(($i%16)==0) {
+ print OUT "\n";
+ }
+ printf OUT "0x%02x,", ord(substr($x,$i));
+ }
+
+ print OUT "\n};\nint ".$fontname."FontMetaData[256*5+1]={\n";
+ for($i=0;$i<256;$i++) {
+ print OUT ($i*16).",8,16,0,0,";
+ }
+
+ print OUT "};\nrfbFontData ".$fontname."Font = { ".$fontname."FontData, "
+ .$fontname."FontMetaData };\n";
+
+ close OUT;
+}