[File] [PATCH] Magdir/fonts PostScript Type 1 font program data without fontname

Jörg Jenderek joerg.jen.der.ek at gmx.net
Thu Nov 18 23:07:11 UTC 2021


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

Hello,

some days ago i installed an older Adobe software. In font directory
of that software i found files with PFB extensions.

When running running file command version 5.41 on these and more
such examples i get an output like:

CASLONOP.PFB:                 PostScript Type 1 font program data
DarkGardenMK.pfb:             PostScript Type 1 font program data
			      (DarkGardenMK 1.1)
FETTEFRK.PFB:                 PostScript Type 1 font program data
FRANKFRT.PFB:                 PostScript Type 1 font program data
			      (%CreationDate:
			      Fri Aug 28 16:35:24 1992)
KAUFMANN.PFB:                 PostScript Type 1 font program data
LG______.PFB:                 PostScript Type 1 font program data
			      (LetterGothic 001.003)
LINCOLN.PFB:                  PostScript Type 1 font program data
LITHOS.PFB:                   PostScript Type 1 font program data
			      (%CreationDate:
			      Sat Aug 29 15:47:14 1992)
MESOZIC.PFB:                  PostScript Type 1 font program data
MIRROR__.PFB:                 data
OLD_TOWN.PFB:                 PostScript Type 1 font program data
PLAYBI__.PFB:                 data
c0583bt_.pfb:                 PostScript Type 1 font program data
			      (%CreationDate:
			      Sun Nov  4 19:31:10 1990)
fmt-525-signature-id-816.pfb: PostScript Type 1 font program data

In most cases the font name is shown in parentheses at the end, but
some times not. Furthermore with --extension option only 3 character
sequence ??? is shown. With -i option only generic mime type
application/octet-stream is shown.

For comparison reason i run the file format identification utility
TrID ( See https://mark0.net/soft-trid-e.html). The examples are also
described correctly by TrID first as "Adobe PostScript Type 1 Font"
by pfb.trid.xml  Furthermore it does not misidentify DROID
fmt-525-signature-id-816.pfb as font data (See appended
pfb-trid-v.txt.gz). TrID list the used file name extension PFB and
with -v option the related URL pointing to used file information.

For comparison reason i also run the file format identification
utility DROID ( See https://sourceforge.net/projects/droid/). This
identifies many PFB examples as "Adobe Printer Font Binary" by PUID
fmt/525 (See appended pfb_droid.csv.gz).

So these informations are now expressed by additional comment lines
inside Magdir/fonts like:
# URL:		https://en.wikipedia.org/wiki/PostScript_fonts
# Reference:	http://mark0.net/download/triddefs_xml.7z
#		defs/p/pfb.trid.xml
# http://www.nationalarchives.gov.uk/pronom/fmt/525

In current version many PFB examples are described by lines like:
 6	string	%!PS-AdobeFont-1. PostScript Type 1 font program data
 >26	string	>\0			(%s)

This now becomes like:
 6	string		%!PS-AdobeFont-1.
 >24	ubyte		x	PostScript Type 1 font program data
 !:mime	font/x-postscript-pfb
 !:ext	pfb
 >>24	ubyte		=0x3A
 >>>26	string		>\0		(%s)
 >>24	ubyte		!0x3A
 >>>25	search/568	/FontName\040/
 >>>>&0	regex		[A-Za-z\-]+	(%s)
After phrase part string like "!PS-AdobeFont-1.0" first check for
more real content by second test line. By this step invalid DROID
example fmt-525-signature-id-816.pfb is skipped. Often afterwards
this is followed by colon (3Ah) and space (20h) and font name (like:
DarkGardenMK LetterGothic) in examples like DarkGardenMK.pfb and
LG______.PFB. These "good" examples are handled by first branch. So
font name with "scale" factor is shown in parentheses like before.
But in some examples like FRANKFRT.PFB and LITHOS.PFB instead of
colon a Line Break followed by phrase %%CreationDate occur. So i
look in second branch for font information by looking for directive
"/FontName /". This is followed "font name" and def directive. So
that name is now shown by regular expression surrounded by
parentheses like in the other branch. Now after tests i display a
user defined one instead generic mime type application/octet-stream
and 3 byte file name extension PFB.

Some examples are described by line like:
 6 string	%!FontType1	PostScript Type 1 font program data
Here no font name is displayed. This is irritating, when some times
font name is shown and then sometimes not. So now i look for font
name string. Hoping that my observations are always true this
together with mime type and file name extension now becomes like:
 6 string	%!FontType1	PostScript Type 1 font program data
 !:mime	font/x-postscript-pfb
 !:ext	pfb

Then i found one example MIRROR__.PFB where exclamation mark is
missing. I do not know if this is an accident but i added it by
lines like:
 6 string %PS-AdobeFont-1.	PostScript Type 1 font program data
 !:mime	font/x-postscript-pfb
 !:ext	pfb

Then i found one example PLAYBI.PFB where characteristic pattern
occur later after long postscript comment line. This is now
described by lines like:
 230 string	%!FontType1	PostScript Type 1 font program data
 !:mime	font/x-postscript-pfb
 !:ext	pfb
 >247	string		>\0			(%s)

After applying the above mentioned modifications by patch
file-5.41-fonts-pfb.diff then all my PFB examples (more than
thousand) are still described with more details (font name) and
some misidentification vanish. This now looks like:

CASLONOP.PFB:                 PostScript Type 1 font program data
			      (CaslonOpenFace 001.003)
DarkGardenMK.pfb:             PostScript Type 1 font program data
			      (DarkGardenMK 1.1)
FETTEFRK.PFB:                 PostScript Type 1 font program data
			      (FetteFraktur 001.003)
FRANKFRT.PFB:                 PostScript Type 1 font program data
			      (Frankfurt)
KAUFMANN.PFB:                 PostScript Type 1 font program data
			      (Kaufmann 001.003)
LG______.PFB:                 PostScript Type 1 font program data
			      (LetterGothic 001.003)
LINCOLN.PFB:                  PostScript Type 1 font program data
			      (Linotext 001.003)
LITHOS.PFB:                   PostScript Type 1 font program data
			      (Lithos)
MESOZIC.PFB:                  PostScript Type 1 font program data
			      (MesozoicGothic 001.001)
MIRROR__.PFB:                 PostScript Type 1 font program data
			      (Times-Mirror 001.001)
OLD_TOWN.PFB:                 PostScript Type 1 font program data
			      (Old-Town 001.003)
PLAYBI__.PFB:                 PostScript Type 1 font program data
			      (Playbill 001.001)
c0583bt_.pfb:                 PostScript Type 1 font program data
			      (Courier10PitchBT-Bold)
fmt-525-signature-id-816.pfb: data

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

There exist 3 more pattern which should identify PFB samples but i
do not find such examples and that patterns are different from TrID
and DROID patterns. So i add mime and extension lines as comments
because i do not know if this is really true.

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



















































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

iF0EARECAB0WIQS5/qNWKD4ASGOJGL+v8rHJQhrU1gUCYZbcnwAKCRCv8rHJQhrU
1pTyAJwP99yCbjr4TJcI/7DILaaTOWdknQCg0emTQUEr2v9kAIDSthI0DBqMIi8=
=1Vyn
-----END PGP SIGNATURE-----
-------------- next part --------------
-- 
File mailing list
File at astron.com
https://mailman.astron.com/mailman/listinfo/file

-------------- next part --------------
A non-text attachment was scrubbed...
Name: pfb_trid-v.txt.gz
Type: application/x-gzip
Size: 677 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/file/attachments/20211119/5d069df1/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pfb_droid.csv.gz
Type: application/x-gzip
Size: 620 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/file/attachments/20211119/5d069df1/attachment-0001.bin>
-------------- next part --------------
--- file-5.41/magic/Magdir/fonts.old	2021-05-12 16:30:24 +0000
+++ file-5.41/magic/Magdir/fonts	2021-11-18 22:52:48 +0000
@@ -10,9 +10,52 @@
 # PostScript fonts (must precede "printer" entries), quinlan at yggdrasil.com
+# Modified by:	Joerg Jenderek
+# URL:		https://en.wikipedia.org/wiki/PostScript_fonts
+#		http://fileformats.archiveteam.org/wiki/Adobe_Type_1
+# Reference:	http://mark0.net/download/triddefs_xml.7z
+#		defs/p/pfb.trid.xml
+# Note:		PFB stands for Printer Font Binary
 0	string		%!PS-AdobeFont-1.	PostScript Type 1 font text
+#!:mime	font/x-postscript-pfb
+#!:ext	pfb
 >20	string		>\0			(%s)
-6	string		%!PS-AdobeFont-1.	PostScript Type 1 font program data
->26	string		>\0			(%s)
+# http://www.nationalarchives.gov.uk/pronom/fmt/525
+6	string		%!PS-AdobeFont-1.
+# skip DROID fmt-525-signature-id-816.pfb by checking for content after header
+>24	ubyte		x			PostScript Type 1 font program data
+#!:mime	application/octet-stream
+!:mime	font/x-postscript-pfb
+!:ext	pfb
+# often followed by colon (3Ah) and space (20h) and font name like: DarkGardenMK LetterGothic
+>>24	ubyte		=0x3A
+>>>26	string		>\0			(%s)
+# some times instead of colon %%CreationDate: and "font name" later
+>>24	ubyte		!0x3A
+# font name directive followed by def like: c0633bt_.pfb
+>>>25	search/1247	/FontName\040/
+# show font name in parentheses like: Frankfurt Lithos CharterBT-BoldItalic Courier10PitchBT-Bold
+>>>>&0	regex		[A-Za-z0-9\-]+		(%s)
+# http://cd.textfiles.com/maxfonts/ATM/M/MIRROR__.PFB
+6	string		%PS-AdobeFont-1.	PostScript Type 1 font program data
+!:mime	font/x-postscript-pfb
+!:ext	pfb
+# font name like:  Times-Mirror
+>25	string		>\0			(%s)
 0	string		%!FontType1	PostScript Type 1 font program data
+#!:mime	font/x-postscript-pfb
+#!:ext	pfb
 6	string		%!FontType1	PostScript Type 1 font program data
+#!:mime	application/octet-stream
+!:mime	font/x-postscript-pfb
+!:ext	pfb
+# font name like: CaslonOpenFace FetteFraktur Kaufmann Linotext MesozoicGothic Old-Town
+>23	string		>\0			(%s)
+# http://cd.textfiles.com/maxfonts/ATM/P/PLAYBI.PFB
+230	string		%!FontType1	PostScript Type 1 font program data
+!:mime	font/x-postscript-pfb
+!:ext	pfb
+# font name like: Playbill
+>247	string		>\0			(%s)
 0	string		%!PS-Adobe-3.0\ Resource-Font	PostScript Type 1 font text
+#!:mime	font/x-postscript-pfb
+#!:ext	pfb
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: file-5.41-fonts-pfb.diff.sig
Type: application/octet-stream
Size: 1160 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/file/attachments/20211119/5d069df1/attachment.obj>


More information about the File mailing list