[File] [PATCH] Magdir/font X11 SNF font misidentfies DEGAS bitmap BIGSPID.PI1

Jörg Jenderek joerg.jen.der.ek at gmx.net
Mon Nov 22 22:55:27 UTC 2021


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

some days ago i installed an older Adobe software with some fonts.
So i was checking some other font stuff.

When running running file command version 5.41 on DEGAS images
examples i get an output like:
BIGSPID.PI1: X11 SNF font data, MSB first

Furthermore with --extension option only 3 character sequence ???
is shown.

For comparison reason i run the file format identification utility
TrID ( See https://mark0.net/soft-trid-e.html). The example is not
recognized as font (See appended trid-v.txt.gz). But in the TrID
database exist a definition snf-x11-lsb.trid.xml for the little
endian variant. TrID list the used file name extension SNF.

Luckily i found on file formats archive team web site a page about
SNF (Server Normal Format). There also a link to source header file
snfstr.h with specifications is mentioned.
So these informations are now expressed by additional comment lines
inside Magdir/fonts like:
# URL:		http://fileformats.archiveteam.org/wiki/SNF
# Reference:	https://cgit.freedesktop.org/xorg/lib/libXfont/
#		tree/src/bitmap/snfstr.h
# Reference:    http://mark0.net/download/triddefs_xml.7z
#		defs/s/snf-x11-lsb.trid.xml

In current version big endian SNF fonts examples are described by
lines like:
0	belong	00000004	X11 SNF font data, MSB first
!:mime	application/x-font-sfn

So 4 bytes are used for recognition, but 3 are zero. So this is no
so unique enough. The same problem exist for the little endian
variant which i fixed in February 2013. So according to
documentation i also
checked for second version stamp at offset 104 which is the same as
the first version at the beginning. So this now becomes like:
0	belong	00000004
> 104	belong	00000004		X11 SNF font data, MSB first
!:mime	application/x-font-sfn
!:ext	snf
By this additional second test line misidentified Atari DEGAS low
resolution bitmap BIGSPID.PI1 now is skipped.

After applying the above mentioned modifications by patch
file-5.41-fonts-snf.diff then the misidentification vanish. This
now looks like:
BIGSPID.PI1: data

I hope my diff file can be applied in future version of file utility.

I will try to add magic for DEGAS bitmap images in the future, but
it is a little bit difficult because such images have no real
strong magic pattern. So i must look for sufficient test lines.

With best wishes
Jörg Jenderek
- --
Jörg Jenderek





















































-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iF0EARECAB0WIQS5/qNWKD4ASGOJGL+v8rHJQhrU1gUCYZwf3gAKCRCv8rHJQhrU
1vI5AKCDrCmJ2yUrtQLTV7WB9CQfD0iF3wCePWFVKIofl/lxzISsGYYMGmBMCXE=
=1j5i
-----END PGP SIGNATURE-----
-------------- next part --------------
--- file-5.41/magic/Magdir/fonts.old	2021-05-12 16:30:24 +0000
+++ file-5.41/magic/Magdir/fonts	2021-11-22 22:39:12 +0000
@@ -68,13 +68,21 @@
 
 # X11 font files in SNF (Server Natural Format) format
-# updated by Joerg Jenderek at Feb 2013
+# updated by Joerg Jenderek at Feb 2013 and Nov 2021
 # http://computer-programming-forum.com/51-perl/8f22fb96d2e34bab.htm
-0	belong		00000004		X11 SNF font data, MSB first
-#>104	belong		00000004		X11 SNF font data, MSB first
+# URL:		http://fileformats.archiveteam.org/wiki/SNF
+# Reference:	https://cgit.freedesktop.org/xorg/lib/libXfont/tree/src/bitmap/snfstr.h
+0	belong		00000004
+# version2 same as version1 in struct _snfFontInfo
+>104	belong		00000004		X11 SNF font data, MSB first
+# GRR: line above is too general as it catches also DEGAS low-res bitmap like:
+# http://cd.textfiles.com/geminiatari/FILES/GRAPHICS/ANIMAT/SPID_PAT/BIGSPID.PI1
 !:mime	application/x-font-sfn
-# GRR: line below too general as it catches also Xbase index file t3-CHAR.NDX
+!:ext	snf
+# GRR: line below is too general as it catches also Xbase index file t3-CHAR.NDX
 0	lelong		00000004
 >104	lelong		00000004		X11 SNF font data, LSB first
 !:mime	application/x-font-sfn
+# Reference:    http://mark0.net/download/triddefs_xml.7z/defs/s/snf-x11-lsb.trid.xml
+!:ext	snf
 
 # X11 Bitmap Distribution Format, from Daniel Quinlan (quinlan at yggdrasil.com)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: file-5.41-fonts-snf.diff.sig
Type: application/octet-stream
Size: 878 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/file/attachments/20211122/a0755a7a/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: trid-v.txt.gz
Type: application/x-gzip
Size: 558 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/file/attachments/20211122/a0755a7a/attachment.bin>


More information about the File mailing list