aboutsummaryrefslogtreecommitdiff
path: root/fonts/mkpsf.pl
diff options
context:
space:
mode:
Diffstat (limited to 'fonts/mkpsf.pl')
-rw-r--r--fonts/mkpsf.pl58
1 files changed, 32 insertions, 26 deletions
diff --git a/fonts/mkpsf.pl b/fonts/mkpsf.pl
index 1ff5816..e3e9295 100644
--- a/fonts/mkpsf.pl
+++ b/fonts/mkpsf.pl
@@ -158,7 +158,7 @@ sub setup_map {
0x002A, # 0x2A
0x002B, # 0x2B
0x002C, # 0x2C
- [ 0x002D, 0x00ad, 0x2013, 0x2014 ] # 0x2D (plus soft hyphen, en, em)
+ [ 0x002D, 0x00ad, 0x2013, 0x2014 ], # 0x2D (plus soft hyphen, en, em)
0x002E, # 0x2E
0x002F, # 0x2F
0x0030, # 0x30
@@ -466,7 +466,7 @@ while($raw =~ /(.{8})/gc) {
my @bytes;
my $got = $1;
my $chr = $map[$cnt++];
- die "incomplete map" unless defined $chr;
+ die "$0: incomplete map" unless defined $chr;
#warn $got;
push @bytes, ord(substr($got, $_, 1)) for(0..7);
#warn $_ for @bytes;
@@ -487,9 +487,14 @@ while(<DATA>) {
}
}
-warn "$cnt characters\n";
+#warn "$cnt characters\n";
#warn "(padding to 256 characters)\n" unless $cnt >= 256;
-warn "(padding to 512 characters)\n" unless $cnt >= 512;
+#warn "(padding to 512 characters)\n" unless $cnt >= 512;
+
+if($cnt > 512) {
+ die "$0: too many characters ($cnt > 512)";
+}
+
while($cnt < 512) {
my $fake = "%\nUnicode: [0000];\nBitmap: ";
push @scale1, $fake . (("-" x 8) x 8) . "\n";
@@ -497,25 +502,26 @@ while($cnt < 512) {
push @scale3, $fake . (("-" x 24) x 24) . "\n";
$cnt++;
}
-warn "$cnt characters with padding\n";
-
-open $fh, '>', "$fontname-8.txt" or die $!;
-print $fh psf2txt_header($cnt, 1);
-print $fh $_ for(@scale1);
-close $fh;
-system("txt2psf $fontname-8.txt $fontname-8.psf");
-
-open $fh, '>', "$fontname-16.txt" or die $!;
-print $fh psf2txt_header($cnt, 2);
-print $fh $_ for(@scale2);
-close $fh;
-system("txt2psf $fontname-16.txt $fontname-16.psf");
-
-open $fh, '>', "$fontname-24.txt" or die $!;
-print $fh psf2txt_header($cnt, 3);
-print $fh $_ for(@scale3);
-close $fh;
-system("txt2psf $fontname-24.txt $fontname-24.psf");
+
+#warn "$cnt characters with padding\n";
+sub mkfonts {
+ my $px = shift;
+ my $scaled_data = shift;
+ my $scale = shift;
+
+ open $fh, '>', "$fontname-$px.txt" or die $!;
+ print $fh psf2txt_header($cnt, $scale);
+ print $fh $_ for(@$scaled_data);
+ close $fh;
+ system("txt2psf $fontname-$px.txt $fontname-$px.psf");
+ system("psf2bdf --iso10646 --fontname=$fontname-$px $fontname-$px.psf $fontname-$px.bdf");
+}
+
+mkfonts(8, \@scale1, 1);
+mkfonts(16, \@scale2, 2);
+mkfonts(24, \@scale3, 3);
+
+exit 0;
__DATA__
%
@@ -630,9 +636,9 @@ Bitmap: \
Unicode: [00b0];[00ba];
Bitmap: \
-------- \
- ---XX--- \
- --x--x-- \
- ---xx--- \
+ ---##--- \
+ --#--#-- \
+ ---##--- \
-------- \
-------- \
-------- \