[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#539108: bdf2psf does not handle empty bitmaps



Apologies for the questions in my previous mail, I wasn't thinking
properly.

In the interests of Science, I tried the same experiment on another
computer I have, running Ubuntu 9.10. For some reason, the only
version of bdf2psf in the Ubuntu archives is "1.34ubuntu4", which is
older than the original Debian version I tested with - and yet, the
Ubuntu version works fine: it produces PSF files with empty U+0020
glyphs. I checked the Ubuntu patches linked from
http://packages.qa.debian.org/c/console-setup.html, and it seems Ubuntu
doesn't have any special patches applied to bdf2psf. 

I also note that since I filed this bug, Testing has received an
updated version of bdf2psf, version 1.49. Sadly, this behaves exactly
the same as the the version I filed this bug with, 1.44.

I tried copying the 1.34 version to my Debian machine and running it
there, and it still produced a properly working PSF file. So, some
change between 1.34 and 1.44 seems to have broken handling of
degenerate glyphs.

Although I don't know Perl, I spotted a likely-looking change in the
difference between those two versions, and when I apply the attached
patch to a copy of bdf2psf from 1.49, the patched version works
properly.

As a (presumably unrelated) aside, while I investigated the above I was
trying to keep track of which versions of bdf2psf produced which PSF
files, and discovered to my dismay that every run of bdf2psf produces
different output, even using the same version with the same input files
on the same machine. Diffing the binary files, it seems that the
segment from 0x0A05 to 0x0D04 (inclusive) changes all the time - I'm
not sure what's stored there, but it's obviously quite volatile. I
can't see any provision in the PSF file format for a 'creation' time
stamp, so I doubt it's that, and since bdf2psf isn't written in C, it's
unlikely to be un-initialised memory. 
--- /usr/bin/bdf2psf	2009-11-20 23:56:56.000000000 +1100
+++ bdf2psf-debian	2009-11-28 21:39:39.000000000 +1100
@@ -376,25 +376,23 @@
 	    next;
 	}
 	if (/^ENDCHAR/) {
-	    if ($rows > 0) {
-		$rows == $height - ($beforebox + $afterbox) / matrix_row_size ()
-		    or die ("$0: $bdf: invalid number of rows $rows " 
-			    ."at line $current_line\n");
-		if ($u == -123456) {
-		    die ("$0: $bdf: missing ENCODING before ENDCHAR " 
-			 ."at line $current_line\n");
+	    $rows == $height - ($beforebox + $afterbox) / matrix_row_size ()
+		or die ("$0: $bdf: invalid number of rows $rows " 
+			."at line $current_line\n");
+	    if ($u == -123456) {
+		die ("$0: $bdf: missing ENCODING before ENDCHAR " 
+		     ."at line $current_line\n");
+	    }
+	    if (! defined $gliphs{$u}) {
+		if ($beforebox < 0) {
+		    @gliph_bytes = @gliph_bytes[-$beforebox..$#gliph_bytes];
 		}
-		if (! defined $gliphs{$u}) {
-		    if ($beforebox < 0) {
-			@gliph_bytes = @gliph_bytes[-$beforebox..$#gliph_bytes];
-		    }
-		    if ($afterbox < 0) {
-			@gliph_bytes = @gliph_bytes[0 .. $#gliph_bytes+$afterbox];
-		    }
-		    $gliphs{$u} = [ (0) x $beforebox,
-				    @gliph_bytes,
-				    (0) x $afterbox];
+		if ($afterbox < 0) {
+		    @gliph_bytes = @gliph_bytes[0 .. $#gliph_bytes+$afterbox];
 		}
+		$gliphs{$u} = [ (0) x $beforebox,
+				@gliph_bytes,
+				(0) x $afterbox];
 	    }
 	}
 	if (/^ENDFONT$/) {

Reply to: