[File] [PATCH] Magdir/amigaos bitmap *.font misidentifies AVM image

Jörg Jenderek joerg.jen.der.ek at gmx.net
Sun Sep 19 01:05:48 UTC 2021


Hello,

some days ago the update of my AVM power line adapter failed.
So i looked for manual update procedures. One step was to download
firmware like fritz.powerline_1000ET_01_05.image from avm.de download
server. These firmware has "image" file name extension.
When running running file command version 5.40 on few such images and
related files i get an output like:

abbey.font:                         data
bg.font:                            AmigaOS bitmap font
Bitstream Vera Sans.font:           AmigaOS bitmap font
Camp.font:                          AmigaOS bitmap font
Diamonds.font:                      AmigaOS bitmap font
EC36Small.font:                     AmigaOS bitmap font
emerald.font:                       AmigaOS bitmap font
Excel.font:                         AmigaOS bitmap font
fritz.powerline_1000ET_01_05.image: AmigaOS bitmap font
IconCondensed.font:                 AmigaOS bitmap font
mcoop.font:                         AmigaOS bitmap font
topazb.font:                        AmigaOS bitmap font
xscript.font:                       data


Furthermore with extension option only 3 byte sequences ??? is shown
and with -i option only generic mime type application/octet-stream is
displayed.

For comparison reason i run the file format identification utility
TrID ( See https://mark0.net/soft-trid-e.html).
The detected examples are described by TrID as "Amiga bitmap Font" by
font-amiga.trid.xml (See appended font-trid-v.txt.gz). It also
displays related URL and used file name extension FONT.

The undetected examples like abbey.font and xscript.font are
described as "Amiga bitmap Font (var.2)" font-amiga-var2.trid.xml.

For the examples a page about Amiga bitmap font on file formats
archive team was mentioned by TrID as related URL. There a link to
specifications on AmigaOS Documentation Wiki and download links for
sample files are mentioned. So this information is now expressed by
additional comment lines inside Magdir/amigaos like:

# URL:	http://fileformats.archiveteam.org/wiki/Amiga_bitmap_font
# Ref.:	http://mark0.net/download/triddefs_xml.7z
#	defs/f/font-amiga.trid.xml
#	https://wiki.amigaos.net/wiki/Graphics_Library_and_Text


The detection of one font variant ( starting 2 byte magic fch_FileID
is equal to FCH_ID=0x0f00) happens by line inside Magdir/amigaos like:
0	beshort		0x0f00		AmigaOS bitmap font

According to specification show now also the number of FontContents
elements (fch_NumEntries) by line like:
  >>2	ubeshort	>1		\b, %u elements
This has often value 1, but i also found value like 2, 3 like in
examples IconCondensed.font and tempfont.font. Also value 4 occur
like in example Franklin.font. Highest value i seen was 6 like in
mcoop.font. I also use that information to skip AVM powerline
firmware images with invalid 0 value. So this now becomes like:
  0	beshort		0x0f00
  >2	ubeshort	>0		AmigaOS bitmap font
  !:mime	font/x-amiga-font
  !:ext	font
Instead of generic mime type application/octet-stream i choose a user
defined one.

Afterwards the font name fc_FileName with maximal length of 254
characters is displayed. Apparently this often consist of filename
appended by slash character and font size element fc_YSize ( with
values like 6 7 8 9 11 12 16 17 21 23 45 60). This looks like:
topazb/6 suits/8  Excel/9e emerald/17 Franklin/23 DIAMONDS/60.8C
This is done by magic lines like:
  >>4	string		x		"%.256s"
  >>260	beshort		x		\b, fc_YSize %u

Afterwards comes bytes for flags and style, but order and meaning is
not clear for me so i print nothing here like:
  #>>262	beshort		x		\b, FLAGS_STYLE

Afterward comes the next FontContents structure if font contain more
than 1 element. So print these possible next element names like
Franklin/36 and Franklin/18 by additional lines like:
  >>2	beshort		>1		\b, 2nd
  >>>264	string		x		"%.256s"
  >>2	beshort		>2		\b, 3rd
  >>>524	string		x		"%.256s"

The second font variant ( starting 2 byte magic fch_FileID is equal
to TFCH_ID=0x0f02) is now done by starting lines inside
Magdir/amigaos like:
  0	beshort		0x0f02
  >2	ubeshort	>0		AmigaOS bitmap font (TFCH)
  !:mime	font/x-amiga-font
  !:ext	font

The structure is nearly the same as in first variant. The difference
is that maximal font element name length is 254. In the 2 freed bytes
the tag count value is stored. So here this looks like:
  >>4	string		x		"%.254s"
  >>258	ubeshort	x		\b, tfc_TagCount %u

After applying the above mentioned modifications by patch
file-5.40-amigaos-font.diff then all my inspected  AmigaOS bitmap
fonts are still identified, described with more details and
misidentification of some AVM powerline firmware images vanished like:

abbey.font:                         AmigaOS bitmap font (TFCH)
				    "Abbey/45",
				    tfc_TagCount 4, tfc_YSize 45
bg.font:                            AmigaOS bitmap font
				    "bg/77",
				    fc_YSize 17
Bitstream Vera Sans.font:           AmigaOS bitmap font
	       			    "Bitstream Vera Sans/16",
				    fc_YSize 16
Camp.font:                          AmigaOS bitmap font
				    "Camp/21",
				    fc_YSize 21
Diamonds.font:                      AmigaOS bitmap font
				    "DIAMONDS/60.8C",
				    fc_YSize 60
EC36Small.font:                     AmigaOS bitmap font
				    "EC36Small/8",
				    fc_YSize 8
emerald.font:                       AmigaOS bitmap font
				    "emerald/17",
				    fc_YSize 17,
				    2 elements,
				    2nd "emerald/20"
Excel.font:                         AmigaOS bitmap font
				    "Excel/9e",
				    fc_YSize 9,
				    2 elements,
				    2nd "Excel/8"
fritz.powerline_1000ET_01_05.image: data
IconCondensed.font:                 AmigaOS bitmap font
				    "IconCondensed/7",
				    fc_YSize 7,
				    3 elements,
				    2nd "IconCondensed/8",
				    3rd "IconCondensed/7"
mcoop.font:                         AmigaOS bitmap font
				    "mCoop/60",
				    fc_YSize 60,
				    6 elements,
				    2nd "mCoop/44",
				    3rd "mCoop/39"
topazb.font:                        AmigaOS bitmap font
				    "topazb/6", fc_YSize 6
xscript.font:                       AmigaOS bitmap font (TFCH)
				    "XScript/75",
				    tfc_TagCount 4, tfc_YSize 75,
				    2 elements,
				    2nd "XScript/45"


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

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




























-------------- next part --------------
--- file-5.40/magic/Magdir/amigaos.old	2021-02-22 23:49:24 +0000
+++ file-5.40/magic/Magdir/amigaos	2021-09-18 23:10:29 +0000
@@ -41,5 +41,60 @@
 
 # The following are from: "Stefan A. Haubenthal" <polluks at web.de>
-0	beshort		0x0f00		AmigaOS bitmap font
+# Update:	Joerg Jenderek
+# URL:		http://fileformats.archiveteam.org/wiki/Amiga_bitmap_font
+# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/f/font-amiga.trid.xml
+#		https://wiki.amigaos.net/wiki/Graphics_Library_and_Text
+# fch_FileID=FCH_ID=0x0f00
+0	beshort		0x0f00
+# skip some AVM powerline firmware images by check for positive number of font elements
+# https://download.avm.de/fritzpowerline/fritzpowerline-1000e-t/other/fritz.os/fritz.powerline_1000ET_01_05.image
+>2	ubeshort	>0		AmigaOS bitmap font
+#!:mime	application/octet-stream
+!:mime	font/x-amiga-font
+!:ext	font
+# struct FontContents fch_FC; 1st fc_FileName [MAXFONTPATH=256]; ~ filename "/" fc_YSize
+# like: topazb/6 suits/8  Excel/9e emerald/17 Franklin/23 DIAMONDS/60.8C
+>>4	string		x		"%.256s"
+# fc_YSize ~number after slash in fc_FileName; like: 6 7 8 9 11 12 16 17 21 23 45 60
+>>260	beshort		x		\b, fc_YSize %u
+# fch_NumEntries; number of FontContents elements like:
+# 1 (often) 2 3 (IconCondensed.font tempfont.font) 4 (Franklin.font) 6 (mcoop.font)
+>>2	ubeshort	>1		\b, %u elements
+#>>2	beshort		x		\b, %u element
+# plural s
+#>>2	beshort		!1		\bs
+# like: 6 7 8 9 11 12 16 17 21 23 45 60
+#>>262	beshort		x		\b, FLAGS_STYLE
+>>2	beshort		>1		\b, 2nd
+# 2nd fc_FileName like: Franklin/36
+>>>264	string		x		"%.256s"
+>>2	beshort		>2		\b, 3rd
+# 3rd fc_FileName like: Franklin/18
+>>>524	string		x		"%.256s"
+# URL:		http://fileformats.archiveteam.org/wiki/Amiga_bitmap_font
+# Reference:	https://wiki.amigaos.net/wiki/Graphics_Library_and_Text
+#		http://mark0.net/download/triddefs_xml.7z/defs/f/font-amiga-var2.trid.xml
+# Note:		called by TrID "Amiga bitmap Font (var.2)"
+# fch_FileID=TFCH_ID=0x0f02
+0	beshort		0x0f02
+# skip possible misidentified foo by check for positive number of font elements
+>2	ubeshort	>0		AmigaOS bitmap font (TFCH)
+#!:mime	application/octet-stream
+!:mime	font/x-amiga-font
+!:ext	font
+# struct TFontContents fch_TFC[]; 1st tfc_FileName [254]; ~ filename "/" fc_YSize
+# like: Abbey/45 XScript/75 XTriumvirate/45
+>>4	string		x		"%.254s"
+# tfc_TagCount; including the TAG_END tag like: 4
+>>258	ubeshort	x		\b, tfc_TagCount %u
+# tfc_YSize ~number after slash in tfc_FileName; like: 45 75
+>>260	beshort		x		\b, tfc_YSize %u
+# tfc_Style; tfc_Flags like: 8022h 8222h
+#>>262	ubeshort	x		\b, FLAGS_STYLE %#x
+# fch_NumEntries; number of FontContents elements like: 1 (abbey.font) 2 (xscript.font xtriumvirate.font)
+>>2	ubeshort	>1		\b, %u elements
+>>2	beshort		>1		\b, 2nd
+# 2nd tfc_FileName like: XScript/45 XTriumvirate/30
+>>>264	string		x		"%.254s"
 0	beshort		0x0f03		AmigaOS outline font
 0	belong		0x80001001	AmigaOS outline tag
-------------- next part --------------
A non-text attachment was scrubbed...
Name: file-5.40-amigaos-font.diff.sig
Type: application/octet-stream
Size: 1373 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/file/attachments/20210919/370f1747/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: font-trid-v.txt.gz
Type: application/x-gzip
Size: 514 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/file/attachments/20210919/370f1747/attachment.bin>


More information about the File mailing list