xref: /freebsd/contrib/file/magic/Magdir/fonts (revision 0b37c1590418417c894529d371800dfac71ef887)
1
2#------------------------------------------------------------------------------
3# $File: fonts,v 1.41 2019/05/05 16:44:04 christos Exp $
4# fonts:  file(1) magic for font data
5#
60	search/1	FONT		ASCII vfont text
70	short		0436		Berkeley vfont data
80	short		017001		byte-swapped Berkeley vfont data
9
10# PostScript fonts (must precede "printer" entries), quinlan@yggdrasil.com
110	string		%!PS-AdobeFont-1.	PostScript Type 1 font text
12>20	string		>\0			(%s)
136	string		%!PS-AdobeFont-1.	PostScript Type 1 font program data
140	string		%!FontType1	PostScript Type 1 font program data
156	string		%!FontType1	PostScript Type 1 font program data
160	string		%!PS-Adobe-3.0\ Resource-Font	PostScript Type 1 font text
17
18# Summary:	PostScript Type 1 Printer Font Metrics
19# URL:		https://en.wikipedia.org/wiki/PostScript_fonts
20# Reference:	https://partners.adobe.com/public/developer/en/font/5178.PFM.pdf
21# Modified by:	Joerg Jenderek
22# Note:		moved from ./msdos magic
23# dfVersion 256=0100h
240		uleshort	0x0100
25# GRR: line above is too general as it catches also TrueType font,
26# raw G3 data FAX, WhatsApp encrypted and Panorama database
27# dfType 129=0081h
28>66		uleshort	0x0081
29# dfVertRes 300=012Ch not needed as additional test
30#>>70		uleshort	0x012c
31# dfHorizRes 300=012Ch
32#>>>72		uleshort	0x012c
33# dfDriverInfo points to postscript information section
34>>(101.l)	string/c	Postscript	Printer Font Metrics
35# above labeled "PFM data" by ./msdos (version 5.28) or "Adobe Printer Font Metrics" by TrID
36!:mime	application/x-font-pfm
37# AppleShare Print Server
38#!:apple	ASPS????
39!:ext	pfm
40# dfCopyright 60 byte null padded Copyright string. uncomment it to get old looking
41#>>>6		string		>\060		- %-.60s
42# dfDriverInfo
43>>>139		ulelong		>0
44# often abbreviated and same as filename
45>>>>(139.l)	string		x		%s
46# dfSize
47>>>2		ulelong		x		\b, %d bytes
48# dfFace 210=D2h 9Eh
49>>>105		ulelong		>0
50# Windows font name
51>>>>(105.l)	string		x		\b, %s
52# dfItalic
53>>>80		ubyte		1		italic
54# dfUnderline
55>>>81		ubyte		1		underline
56# dfStrikeOut
57>>>82		ubyte		1		strikeout
58# dfWeight 400=0x0190 300=0x012c 500=0x01f4 600=0x0258 700=0x02bc
59>>>83		uleshort	>699		bold
60# dfPitchAndFamily 16 17 48 49 64 65
61>>>90		ubyte		16		serif
62>>>90		ubyte		17		serif proportional
63#>>>90		ubyte		48		other
64>>>90		ubyte		49		proportional
65>>>90		ubyte		64		script
66>>>90		ubyte		65		script proportional
67
68# X11 font files in SNF (Server Natural Format) format
69# updated by Joerg Jenderek at Feb 2013
70# http://computer-programming-forum.com/51-perl/8f22fb96d2e34bab.htm
710	belong		00000004		X11 SNF font data, MSB first
72#>104	belong		00000004		X11 SNF font data, MSB first
73!:mime	application/x-font-sfn
74# GRR: line below too general as it catches also Xbase index file t3-CHAR.NDX
750	lelong		00000004
76>104	lelong		00000004		X11 SNF font data, LSB first
77!:mime	application/x-font-sfn
78
79# X11 Bitmap Distribution Format, from Daniel Quinlan (quinlan@yggdrasil.com)
800	search/1	STARTFONT\ 		X11 BDF font text
81
82# From: Joerg Jenderek
83# URL: https://grub.gibibit.com/New_font_format
84# Reference: util/grub-mkfont.c
85#		include/grub/fontformat.h
86# FONT_FORMAT_SECTION_NAMES_FILE
870			string		FILE
88# FONT_FORMAT_PFF2_MAGIC
89>8			string		PFF2
90# leng 4 only at the moment
91>>4			ubelong		4
92# FONT_FORMAT_SECTION_NAMES_FONT_NAME
93>>>12			string		NAME		GRUB2 font
94!:mime			application/x-font-pf2
95!:ext			pf2
96# length of font_name
97>>>>16			ubelong		>0
98# font_name
99>>>>>20			string		>\0		"%-s"
100
101# X11 fonts, from Daniel Quinlan (quinlan@yggdrasil.com)
102# PCF must come before SGI additions ("MIPSEL MIPS-II COFF" collides)
1030	string		\001fcp			X11 Portable Compiled Font data,
104>12	lelong		^0x08			bit: LSB,
105>12	lelong		&0x08			bit: MSB,
106>12	lelong		^0x04			byte: LSB first
107>12	lelong		&0x04			byte: MSB first
1080	string		D1.0\015		X11 Speedo font data
109
110#------------------------------------------------------------------------------
111# FIGlet fonts and controlfiles
112# From figmagic supplied with Figlet version 2.2
113# "David E. O'Brien" <obrien@FreeBSD.ORG>
1140	string		flf		FIGlet font
115>3	string		>2a		version %-2.2s
1160	string		flc		FIGlet controlfile
117>3	string		>2a		version %-2.2s
118
119# libGrx graphics lib fonts, from Albert Cahalan (acahalan@cs.uml.edu)
120# Used with djgpp (DOS Gnu C++), sometimes Linux or Turbo C++
1210	belong		0x14025919	libGrx font data,
122>8	leshort		x		%dx
123>10	leshort		x		\b%d
124>40	string		x		%s
125# Misc. DOS VGA fonts, from Albert Cahalan (acahalan@cs.uml.edu)
1260	belong		0xff464f4e	DOS code page font data collection
1277	belong		0x00454741	DOS code page font data
1287	belong		0x00564944	DOS code page font data (from Linux?)
1294098	string		DOSFONT		DOSFONT2 encrypted font data
130
131# From: Joerg Jenderek
132# URL: http://fileformats.archiveteam.org/wiki/GEM_bitmap_font
133# Reference: http://cd.textfiles.com/ataricompendium/BOOK/HTML/APPENDC.HTM#cnt
134#
135# usual case with lightening mask and skewing mask 5555h~UU
13662	ulelong		0x55555555
137>0	use		gdos-font
138# BOX18.GFT COWBOY30.GFT ROYALK30.GFT
13962	ulelong		0
140# skip ISO 9660 CD-ROM ./filesystem by looking for low positive face size
141>2	uleshort	>2
142# skip DOS 2.0 backup id file ./msdos by looking for face size lower/equal 48
143>>2	uleshort	<49
144# skip MS Windows ICO ./msdos by looking for valid face name
145>>>4	ubeshort	>0x1F00
146# skip DOS executable BACKM212.COM by looking for horizontal offset table after header
147#>>>>68	ulelong		>87		OFFSET_OK
148>>>>0	use		gdos-font
1490	name		gdos-font
150>0	uleshort	x		GEM GDOS font
151!:mime	application/x-font-gdos
152# also .eps found like AA070GEP.EPS AI360GEP.EPS
153!:ext	fnt/gtf
154# font name like University Bold
155>4	string		x		%.32s
156# face size in points 3-48
157>2	uleshort	x		%u
158# face ID (must be unique)
159>0	uleshort	x		\b, ID 0x%4.4x
160# lowest character index in face (usually 32 for disk-loaded fonts).
161#>36	uleshort	x		\b, low character index %u
162# width of the widest character
163#>50	uleshort	x		\b, %u char width
164# width of the widest character cell
165#>52	uleshort	x		\b, %u cell width
166# thickening size
167#>58	uleshort	x		\b, %u thick
168# lightening mask to eliminate pixels, usually 5555h
169>62	uleshort	!0x5555		\b, lightening mask 0x%x
170# skewing mask to determine when to perform additional rotation when skewing, usually 5555h
171>64	uleshort	!0x5555		\b, skewing mask 0x%x
172# offset to horizontal offset table 58h~88 5eh
173#>68	ulelong		>88		\b, 0x%x horizontal table offset
174# offset character offset table
175#>72	ulelong		x		\b, 0x%x coffset
176# offset to font data
177#>72	ulelong		x		\b, 0x%x foffset
178# form width in bytes
179#>80	uleshort	x		\b, %u fwidth
180# pointer to the next font, set by GDOS after loading
181#>84	ulelong		x		\b, 0x%x noffset
182
183# downloadable fonts for browser (prints type) anthon@mnt.org
184# https://tools.ietf.org/html/rfc3073
1850	string		PFR1		Portable Font Resource font data (new)
186>102	string		>0		\b: %s
1870	string		PFR0		Portable Font Resource font data (old)
188>4	beshort		>0		version %d
189
190# True Type fonts
191# Modified by: Joerg Jenderek
192# URL: https://en.wikipedia.org/wiki/TrueType
193# Reference: https://developer.apple.com/fonts/TrueType-Reference-Manual/
194#
195# sfnt version "typ1" used by some Apple, but no example found
1960	string	typ1
197>0	use		sfnt-font
198>0	use		sfnt-names
199# sfnt version "true" used by some Apple
2000	string	true
201>0	use		sfnt-font
202>0	use		sfnt-names
203# GRR: below test is too general
204# sfnt version often 0x00010000
2050	string	\000\001\000\000
206>0	use		sfnt-font
207>0	use		sfnt-names
208#	validate and display sfnt font data like number of tables
2090	name		sfnt-font
210# file 5.30 version assumes 00FFh as maximal number of tables
211#>4	ubeshort	<0x0100
212# maximal 27 tables found like in Skia.ttf
213# 46 different table names mentioned on Apple specification
214# skip 1st sequence of DOS 2 backup with path separator (\~92 or /~47) misinterpreted as table number
215>4	ubeshort	<47
216# skip bad examples with garbage table names like in a5.show HYPERC MAC
217# tag names consist of up to four characters padded with spaces at end like
218# BASE DSIG OS/2 Zapf acnt glyf cvt vmtx xref ...
219>>12	regex/4l	\^[A-Za-z][A-Za-z][A-Za-z/][A-Za-z2\ ]
220#>>>0	ubelong	x	\b, sfnt version 0x%x
221>>>0	ubelong	!0x4f54544f	TrueType
222!:mime	font/sfnt
223!:apple	????tfil
224# .ttf for TrueType font
225# EUDC.tte created by privat character editor %WINDIR%\system32\eudcedit.exe
226!:ext	ttf/tte
227# sfnt version 4F54544Fh~OTTO
228>>>0	ubelong	=0x4f54544f	OpenType
229!:mime	font/otf
230!:apple	????OTTO
231!:ext	otf
232>>>0	ubelong	x		Font data
233# DSIG=44454947h table name implies a digitally signed font
234# search range = number of tables * 16 =< maximal number of tables * 16 = 27 * 16 = 432
235>>>12	search/432	DSIG		\b, digitally signed
236>>>4	ubeshort	x		\b, %d tables
237# minimal 9 tables found like in NISC18030.ttf
238#>>>4	ubeshort	<10		TMIN
239#>>>4	ubeshort	>24		TBIG
240# table directory entries
241>>>12	string		x		\b, 1st "%4.4s"
242
243#	search and display 1st name in sfnt font which is often copyright text
244#	does not work inside font collections
2450	name		sfnt-names
246# search for naming table
247>12	search/432/s	name
248# biggest offset 0x0100bd28 like Windows10 Fonts\simsunb.ttf
249#>>>>&8	ubelong		>0x0100bd27	BIGGEST OFFSET
250>>&8	ubelong		>0x00100000
251# offset of name table
252>>>&-4	ubelong		x		\b, name offset 0x%x
253# GRR: pointer to name table only works if offset ~< FILE_BYTES_MAX = 100000h defined in src\file.h
254>>&8	ubelong		<0x00100000
255>>>&-16	ubelong		x
256# name table
257>>>>(&8.L)	ubequad	x
258# invalid format selector
259#>>>>>&-8	ubeshort	!0	\b, invalid selector %x
260# minimal 3 name records found like in c:\Program Files (x86)\Tesseract-OCR\tessdata\pdf.ttf
261# maximal 1227 name records found like in Apple Chancery.ttf
262#>>>>>&-6	ubeshort	<0x4	mincount
263#>>>>>&-6	ubeshort	>130	maxcount
264>>>>>&-6	ubeshort	x	\b, %d names
265# offset to start of string storage from start of table
266#>>>>>&-4	ubeshort	x	\b, record offset %d
267# 1st name record
268# string offset from start of storage area
269#>>>>>&8		ubeshort	x	\b, string offset %d
270# string length
271#>>>>>&6		ubeshort	x	\b, string length %d
272# minimal name string 7 like in c:\Program Files (x86)\Kodi\addons\webinterface.default\lib\video-js\font\VideoJS.ttf
273# also found 0 like in SWZCONLN.TTF
274#>>>>>&6		ubeshort	<8	MIN STRING
275# maximal name string 806 like in c:\Windows\Fonts\palabi.ttf
276#>>>>>&6		ubeshort	>805	MAX STRING
277# platform identifier: 0~Apple Unicode, 1~Macintosh, 3~Microsoft
278#>>>>>&-2	ubeshort	>3	BAD PLATFORM
279>>>>>&-2	ubeshort	0	\b, Unicode
280>>>>>&-2	ubeshort	1	\b, Macintosh
281>>>>>&-2	ubeshort	3	\b, Microsoft
282# languageID (0~english Macintosh, 0409h~english Microsoft, ...)
283>>>>>&2		ubeshort	>0	\b, language 0x%x
284# name identifiers
285# often 0~copyright, 1~font, 2~font subfamily, 5~version, 13~license, 19~sample, ...
286>>>>>&4		ubeshort	>0	\b, type %d string
287# platform specific encoding:
288# 0~undefined character set, 1~UGL set with Unicode, 3~Unicode 2.0 BMP only, 4~Unicode 2.0
289#>>>>>&0		ubeshort	x	\b, %d encoding
290>>>>>&0		ubeshort	0
291# handle only name string offset 0 because do not know how to add 2 relative offsets
292>>>>>>&6		ubeshort	0
293>>>>>>>&(&-14.S-18)	ubyte		!0
294# GRR: instead 806 only first MAXstring = 96 characters are displayed as defined in src\file.h
295# often copyright string that starts like \251 2006 The Monotype Corporation
296>>>>>>>>&-1		string		x	\b, %-11.96s
297# test for unicode string
298>>>>>>>&(&-14.S-18)	ubyte		0
299>>>>>>>>&0		lestring16	x	\b, %-11.96s
300# unicode encoding
301>>>>>&0		ubeshort	>0
302>>>>>>&6		ubeshort	0
303>>>>>>>&(&-14.S-17)	lestring16	x	\b, %-11.96s
304
3050	string		\007\001\001\000Copyright\ (c)\ 199	Adobe Multiple Master font
3060	string		\012\001\001\000Copyright\ (c)\ 199	Adobe Multiple Master font
307
308# TrueType/OpenType font collections (.ttc)
309# URL: https://en.wikipedia.org/wiki/OpenType
310# https://www.microsoft.com/typography/otspec/otff.htm
311# Modified by: Joerg Jenderek
312# Note:	container for TrueType, OpenType font
3130	string		ttcf
314# skip ASCII text
315>4	ubyte		0
316# sfnt version often 0x00010000 of 1st table is TrueType
317>>(12.L)	ubelong	!0x4f54544f	TrueType
318!:mime	font/ttf
319!:apple	????tfil
320!:ext	ttc
321# sfnt version 4F54544Fh~OTTO of 1st table is OpenType font
322>>(12.L)	ubelong	=0x4f54544f	OpenType
323!:mime	font/otf
324!:apple	????OTTO
325# no example found for otc
326!:ext	ttc/otc
327>>4	ubyte		x		font collection data
328#!:mime	font/collection
329# TCC version
330>>4	belong		0x00010000	\b, 1.0
331>>4	belong		0x00020000	\b, 2.0
332>>8	ubelong		>0		\b, %d fonts
333# array offset size = fonts * offsetsize = fonts * 4
334>>(8.L*4) ubequad	x
335# 0x44454947 = 'DSIG'
336>>>&4	belong		0x44534947	\b, digitally signed
337# offset to 1st font
338>>12	ubelong		x		\b, at 0x%x
339# point to 1st font that starts with sfnt version
340>>(12.L) use		sfnt-font
341
342# Opentype font data from Avi Bercovich
3430	string		OTTO		OpenType font data
344!:mime application/vnd.ms-opentype
345
346# From: Alex Myczko <alex@aiei.ch>
3470	string		SplineFontDB:	Spline Font Database
348!:mime application/vnd.font-fontforge-sfd
349>14	string		x		version %s
350
351# EOT
3520x40	string		\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0
353>0x22	string		LP		Embedded OpenType (EOT)
354# workaround until there's lepstring16
355# >>0x52	lepstring16/h	>\0		\b, %s family
356>>0x52	short	!0
357>>>0x54	lestring16	x		\b, %s family
358!:mime application/vnd.ms-fontobject
359
360# Web Open Font Format (.woff)
3610	name		woff
362>4	belong		0x00010000	\b, TrueType
363>4	belong		0x4F54544F	\b, CFF
364>4	belong		0x74727565	\b, TrueType
365>4	default		x
366>>4	belong		x		\b, flavor %d
367>8	belong		x		\b, length %d
368#>12	beshort		x		\b, numTables %d
369#>14	beshort		x		\b, reserved %d
370#>16	belong		x		\b, totalSfntSize %d
371
372# https://www.w3.org/TR/WOFF/
3730	string		wOFF	Web Open Font Format
374>0	use		woff
375>20	beshort		x	\b, version %d
376>22	beshort		x	\b.%d
377# https://www.w3.org/TR/WOFF2/
3780	string		wOF2	Web Open Font Format (Version 2)
379>0	use		woff
380#>20	belong		x	\b, totalCompressedSize %d
381>24	beshort		x	\b, version %d
382>26	beshort		x	\b.%d
383