summaryrefslogtreecommitdiff
path: root/font/tools/mergebdf
diff options
context:
space:
mode:
Diffstat (limited to 'font/tools/mergebdf')
-rwxr-xr-xfont/tools/mergebdf29
1 files changed, 29 insertions, 0 deletions
diff --git a/font/tools/mergebdf b/font/tools/mergebdf
new file mode 100755
index 0000000..86c75f5
--- /dev/null
+++ b/font/tools/mergebdf
@@ -0,0 +1,29 @@
+#!/usr/bin/perl -w
+
+if ($#ARGV < 0) {
+ die "Usage: mergebdf font1.bdf ... > newfont.bdf\n";
+}
+
+foreach $font (@ARGV) {
+ open(F, "<$font") || die;
+ for (;;) {
+ while (defined($_ = <F>) && !/^STARTCHAR /) {
+ if (!$donehead) { print; }
+ }
+ if (!defined($_)) { last; }
+ $donehead = 1;
+ $c = $_;
+ undef $e;
+ while (($_ = <F>) !~ /^ENDCHAR/) {
+ if (/^ENCODING (\d+)$/) { $e = $1; }
+ $c .= $_;
+ }
+ $c .= $_;
+ if (!$char{$e}) {
+ $char{$e} = 1;
+ print $c;
+ }
+ }
+ close(F);
+}
+print "ENDFONT\n";