xref: /freebsd/contrib/file/magic/Magdir/fonts (revision 95eb4b873b6a8b527c5bd78d7191975dfca38998)
1
2#------------------------------------------------------------------------------
3# $File: fonts,v 1.51 2022/08/16 11:16:39 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
11# Modified by:	Joerg Jenderek
12# URL:		https://en.wikipedia.org/wiki/PostScript_fonts
13#		http://fileformats.archiveteam.org/wiki/Adobe_Type_1
14# Reference:	http://mark0.net/download/triddefs_xml.7z
15#		defs/p/pfb.trid.xml
16# Note:		PFB stands for Printer Font Binary
170	string		%!PS-AdobeFont-1.	PostScript Type 1 font text
18#!:mime	font/x-postscript-pfb
19#!:ext	pfb
20>20	string		>\0			(%s)
21# http://www.nationalarchives.gov.uk/pronom/fmt/525
226	string		%!PS-AdobeFont-1.
23# skip DROID fmt-525-signature-id-816.pfb by checking for content after header
24>24	ubyte		x			PostScript Type 1 font program data
25#!:mime	application/octet-stream
26!:mime	font/x-postscript-pfb
27!:ext	pfb
28# often followed by colon (3Ah) and space (20h) and font name like: DarkGardenMK LetterGothic
29>>24	ubyte		=0x3A
30>>>26	string		>\0			(%s)
31# some times instead of colon %%CreationDate: and "font name" later
32>>24	ubyte		!0x3A
33# font name directive followed by def like: c0633bt_.pfb
34>>>25	search/1247	/FontName\040/
35# show font name in parentheses like: Frankfurt Lithos CharterBT-BoldItalic Courier10PitchBT-Bold
36>>>>&0	regex		[A-Za-z0-9-]+		(%s)
37# http://cd.textfiles.com/maxfonts/ATM/M/MIRROR__.PFB
386	string		%PS-AdobeFont-1.	PostScript Type 1 font program data
39!:mime	font/x-postscript-pfb
40!:ext	pfb
41# font name like:  Times-Mirror
42>25	string		>\0			(%s)
430	string		%!FontType1	PostScript Type 1 font program data
44#!:mime	font/x-postscript-pfb
45#!:ext	pfb
466	string		%!FontType1	PostScript Type 1 font program data
47#!:mime	application/octet-stream
48!:mime	font/x-postscript-pfb
49!:ext	pfb
50# font name like: CaslonOpenFace FetteFraktur Kaufmann Linotext MesozoicGothic Old-Town
51>23	string		>\0			(%s)
52# http://cd.textfiles.com/maxfonts/ATM/P/PLAYBI.PFB
53230	string		%!FontType1	PostScript Type 1 font program data
54!:mime	font/x-postscript-pfb
55!:ext	pfb
56# font name like: Playbill
57>247	string		>\0			(%s)
580	string		%!PS-Adobe-3.0\ Resource-Font	PostScript Type 1 font text
59#!:mime	font/x-postscript-pfb
60#!:ext	pfb
61
62# Summary:	PostScript Type 1 Printer Font Metrics
63# URL:		https://en.wikipedia.org/wiki/PostScript_fonts
64# Reference:	https://partners.adobe.com/public/developer/en/font/5178.PFM.pdf
65# Modified by:	Joerg Jenderek
66# Note:		moved from ./msdos magic
67# dfVersion 256=0100h
680		uleshort	0x0100
69# GRR: line above is too general as it catches also TrueType font,
70# raw G3 data FAX, WhatsApp encrypted and Panorama database
71# dfType 129=0081h
72>66		uleshort	0x0081
73# dfVertRes 300=012Ch not needed as additional test
74#>>70		uleshort	0x012c
75# dfHorizRes 300=012Ch
76#>>>72		uleshort	0x012c
77# dfDriverInfo points to postscript information section
78>>(101.l)	string/c	Postscript	Printer Font Metrics
79# above labeled "PFM data" by ./msdos (version 5.28) or "Adobe Printer Font Metrics" by TrID
80!:mime	application/x-font-pfm
81# AppleShare Print Server
82#!:apple	ASPS????
83!:ext	pfm
84# dfCopyright 60 byte null padded Copyright string. uncomment it to get old looking
85#>>>6		string		>\060		- %-.60s
86# dfDriverInfo
87>>>139		ulelong		>0
88# often abbreviated and same as filename
89>>>>(139.l)	string		x		%s
90# dfSize
91>>>2		ulelong		x		\b, %d bytes
92# dfFace 210=D2h 9Eh
93>>>105		ulelong		>0
94# Windows font name
95>>>>(105.l)	string		x		\b, %s
96# dfItalic
97>>>80		ubyte		1		italic
98# dfUnderline
99>>>81		ubyte		1		underline
100# dfStrikeOut
101>>>82		ubyte		1		strikeout
102# dfWeight 400=0x0190 300=0x012c 500=0x01f4 600=0x0258 700=0x02bc
103>>>83		uleshort	>699		bold
104# dfPitchAndFamily 16 17 48 49 64 65
105>>>90		ubyte		16		serif
106>>>90		ubyte		17		serif proportional
107#>>>90		ubyte		48		other
108>>>90		ubyte		49		proportional
109>>>90		ubyte		64		script
110>>>90		ubyte		65		script proportional
111
112# X11 font files in SNF (Server Natural Format) format
113# updated by Joerg Jenderek at Feb 2013 and Nov 2021
114# http://computer-programming-forum.com/51-perl/8f22fb96d2e34bab.htm
115# URL:		http://fileformats.archiveteam.org/wiki/SNF
116# Reference:	https://cgit.freedesktop.org/xorg/lib/libXfont/tree/src/bitmap/snfstr.h
1170	belong		00000004
118# version2 same as version1 in struct _snfFontInfo
119>104	belong		00000004		X11 SNF font data, MSB first
120# GRR: line above is too general as it catches also DEGAS low-res bitmap like:
121# http://cd.textfiles.com/geminiatari/FILES/GRAPHICS/ANIMAT/SPID_PAT/BIGSPID.PI1
122!:mime	application/x-font-sfn
123!:ext	snf
124# GRR: line below is too general as it catches also Xbase index file t3-CHAR.NDX
1250	lelong		00000004
126>104	lelong		00000004		X11 SNF font data, LSB first
127!:mime	application/x-font-sfn
128# Reference:    http://mark0.net/download/triddefs_xml.7z/defs/s/snf-x11-lsb.trid.xml
129!:ext	snf
130
131# X11 Bitmap Distribution Format, from Daniel Quinlan (quinlan@yggdrasil.com)
1320	search/1	STARTFONT\ 		X11 BDF font text
133
134# From: Joerg Jenderek
135# URL: https://grub.gibibit.com/New_font_format
136# Reference: util/grub-mkfont.c
137#		include/grub/fontformat.h
138# FONT_FORMAT_SECTION_NAMES_FILE
1390			string		FILE
140# FONT_FORMAT_PFF2_MAGIC
141>8			string		PFF2
142# leng 4 only at the moment
143>>4			ubelong		4
144# FONT_FORMAT_SECTION_NAMES_FONT_NAME
145>>>12			string		NAME		GRUB2 font
146!:mime			application/x-font-pf2
147!:ext			pf2
148# length of font_name
149>>>>16			ubelong		>0
150# font_name
151>>>>>20			string		>\0		"%-s"
152
153# X11 fonts, from Daniel Quinlan (quinlan@yggdrasil.com)
154# PCF must come before SGI additions ("MIPSEL MIPS-II COFF" collides)
1550	string		\001fcp			X11 Portable Compiled Font data,
156>12	lelong		^0x08			bit: LSB,
157>12	lelong		&0x08			bit: MSB,
158>12	lelong		^0x04			byte: LSB first
159>12	lelong		&0x04			byte: MSB first
1600	string		D1.0\015		X11 Speedo font data
161
162#------------------------------------------------------------------------------
163# FIGlet fonts and controlfiles
164# From figmagic supplied with Figlet version 2.2
165# "David E. O'Brien" <obrien@FreeBSD.ORG>
1660	string		flf		FIGlet font
167>3	string		>2a		version %-2.2s
1680	string		flc		FIGlet controlfile
169>3	string		>2a		version %-2.2s
170
171# libGrx graphics lib fonts, from Albert Cahalan (acahalan@cs.uml.edu)
172# Used with djgpp (DOS Gnu C++), sometimes Linux or Turbo C++
1730	belong		0x14025919	libGrx font data,
174>8	leshort		x		%dx
175>10	leshort		x		\b%d
176>40	string		x		%s
177# Misc. DOS VGA fonts, from Albert Cahalan (acahalan@cs.uml.edu)
178# Update:	Joerg Jenderek
179# URL:		http://fileformats.archiveteam.org/wiki/CPI
180# Reference:	http://www.delorie.com/djgpp/doc/rbinter/it/58/17.html
1810	belong		0xff464f4e	DOS code page font data collection
182!:mime	font/x-dos-cpi
183!:ext	cpi
1840	string		\x7fDRFONT	DR-DOS code page font data collection
185!:mime	font/x-drdos-cpi
186!:ext	cpi
1877	belong		0x00454741	DOS code page font data
1887	belong		0x00564944	DOS code page font data (from Linux?)
1894098	string		DOSFONT		DOSFONT2 encrypted font data
190
191# From: Joerg Jenderek
192# URL: http://fileformats.archiveteam.org/wiki/GEM_bitmap_font
193# Reference: http://cd.textfiles.com/ataricompendium/BOOK/HTML/APPENDC.HTM#cnt
194#
195# usual case with lightening mask and skewing mask 5555h~UU
196#62	ulelong		0x55555555
197# skip cl8m8ocofedso.testfile by looking for face size lower/equal 72
198#>2	uleshort	<73
199#>>0	use		gdos-font
200# BOX18.GFT COWBOY30.GFT ROYALK30.GFT
201#62	ulelong		0
202# skip ISO 9660 CD-ROM ./filesystem by looking for low positive face size
203#>2	uleshort	>2
204# skip DOS 2.0 backup id file ./msdos by looking for face size lower/equal 72
205#>>2	uleshort	<73
206# skip MS oem.hlp, some Windows ICO ./msdos by looking for valid long name like WYE
207#>>>4	ulelong		>0x001F1f1F
208# skip Microsoft WinWord 2.0 ./msdos by looking for positive offset to font data
209#>>>>76	ulelong		>83
210#>>>>>0	use		gdos-font
2110	name		gdos-font
212>0	uleshort	x		GEM GDOS font
213!:mime	application/x-font-gdos
214# also .eps found like AA070GEP.EPS AI360GEP.EPS
215!:ext	fnt/gtf
216# font name like Big&Tall, Celtic #s, Courier, University Bold, WYE
217>4	string		x		%.32s
218# face size in points 3-72 SLSS03CG.FNT H1CELT72.FNT
219>2	uleshort	x		%u
220# face ID (must be unique)
221>0	uleshort	x		\b, ID %#4.4x
222# lowest character index in face (4 but usually 32 for disk-loaded fonts)
223#>36	uleshort	!32		\b, unusual character index %u
224# width of the widest character like 0 8 10 12 16 24 32
225#>50	uleshort	x		\b, %u char width
226# width of the widest character cell like 8 11 12 14 15 16 33 67
227#>52	uleshort	x		\b, %u cell width
228# thickening size in pixel like 0 1 2 3 4 5 6 7 8
229#>58	uleshort	x		\b, %u thick
230# lightening mask to eliminate pixels, usually 5555h
231>62	uleshort	!0x5555		\b, lightening mask %#x
232# skewing mask to determine when to perform additional rotation when skewing, usually 5555h
233>64	uleshort	!0x5555		\b, skewing mask %#x
234# offset to optional horizontal offset table 0 58h~88 5eh 252h
235#>68	ulelong		x		\b, %#x horizontal table offset
236# offset of character offset table 54h for many *.GFT 55h 58h 5Eh 120h 1D4h 202h 220h
237#>72	ulelong		x		\b, %#x coffset
238# offset to font data like 116h 118h 158 20Ah 20Eh
239>76	ulelong		x		\b, %#x foffset
240# form width in bytes like 58 67 156 190 227 317 345
241#>80	uleshort	x		\b, %u fwidth
242# form height in bytes like 4 8 11 17 26 56 70 90 120 146 150
243#>82	uleshort	x		\b, %u fheight
244# pointer to the next font like 0 10000h 20000h 30000h 40000h 60000h 80000h E0000h D0000h
245#>84	ulelong		x		\b, %#x noffset
246
247# downloadable fonts for browser (prints type) anthon@mnt.org
248# https://tools.ietf.org/html/rfc3073
2490	string		PFR1		Portable Font Resource font data (new)
250>102	string		>0		\b: %s
2510	string		PFR0		Portable Font Resource font data (old)
252>4	beshort		>0		version %d
253
254# True Type fonts
255# Modified by: Joerg Jenderek
256# URL: https://en.wikipedia.org/wiki/TrueType
257# Reference: https://developer.apple.com/fonts/TrueType-Reference-Manual/
258#
259# sfnt version "typ1" used by some Apple, but no example found
2600	string	typ1
261>0	use		sfnt-font
262>0	use		sfnt-names
263# sfnt version "true" used by some Apple
2640	string	true
265>0	use		sfnt-font
266>0	use		sfnt-names
267# GRR: below test is too general
268# sfnt version often 0x00010000
2690	string	\000\001\000\000
270>0	use		sfnt-font
271>0	use		sfnt-names
272#	validate and display sfnt font data like number of tables
2730	name		sfnt-font
274# file 5.30 version assumes 00FFh as maximal number of tables
275#>4	ubeshort	<0x0100
276# maximal 27 tables found like in Skia.ttf
277# 46 different table names mentioned on Apple specification
278# skip 1st sequence of DOS 2 backup with path separator (\~92 or /~47) misinterpreted as table number
279>4	ubeshort	<47
280# skip bad examples with garbage table names like in a5.show HYPERC MAC
281# tag names consist of up to four characters padded with spaces at end like
282# BASE DSIG OS/2 Zapf acnt glyf cvt vmtx xref ...
283>>12	regex/4l	\^[A-Za-z][A-Za-z][A-Za-z/][A-Za-z2\ ]
284#>>>0	ubelong	x	\b, sfnt version %#x
285>>>0	ubelong	!0x4f54544f	TrueType
286!:mime	font/sfnt
287!:apple	????tfil
288# .ttf for TrueType font
289# EUDC.tte created by privat character editor %WINDIR%\system32\eudcedit.exe
290!:ext	ttf/tte
291# sfnt version 4F54544Fh~OTTO
292>>>0	ubelong	=0x4f54544f	OpenType
293!:mime	font/otf
294!:apple	????OTTO
295!:ext	otf
296>>>0	ubelong	x		Font data
297# DSIG=44454947h table name implies a digitally signed font
298# search range = number of tables * 16 =< maximal number of tables * 16 = 27 * 16 = 432
299>>>12	search/432	DSIG		\b, digitally signed
300>>>4	ubeshort	x		\b, %d tables
301# minimal 9 tables found like in NISC18030.ttf
302#>>>4	ubeshort	<10		TMIN
303#>>>4	ubeshort	>24		TBIG
304# table directory entries
305>>>12	string		x		\b, 1st "%4.4s"
306
307#	search and display 1st name in sfnt font which is often copyright text
308#	does not work inside font collections
3090	name		sfnt-names
310# search for naming table
311>12	search/432/s	name
312# biggest offset 0x0100bd28 like Windows10 Fonts\simsunb.ttf
313#>>>>&8	ubelong		>0x0100bd27	BIGGEST OFFSET
314>>&8	ubelong		>0x00100000
315# offset of name table
316>>>&-4	ubelong		x		\b, name offset %#x
317# GRR: pointer to name table only works if offset ~< FILE_BYTES_MAX = 100000h defined in src\file.h
318>>&8	ubelong		<0x00100000
319>>>&-16	ubelong		x
320# name table
321>>>>(&8.L)	ubequad	x
322# invalid format selector
323#>>>>>&-8	ubeshort	!0	\b, invalid selector %x
324# minimal 3 name records found like in c:\Program Files (x86)\Tesseract-OCR\tessdata\pdf.ttf
325# maximal 1227 name records found like in Apple Chancery.ttf
326#>>>>>&-6	ubeshort	<0x4	mincount
327#>>>>>&-6	ubeshort	>130	maxcount
328>>>>>&-6	ubeshort	x	\b, %d names
329# offset to start of string storage from start of table
330#>>>>>&-4	ubeshort	x	\b, record offset %d
331# 1st name record
332# string offset from start of storage area
333#>>>>>&8		ubeshort	x	\b, string offset %d
334# string length
335#>>>>>&6		ubeshort	x	\b, string length %d
336# minimal name string 7 like in c:\Program Files (x86)\Kodi\addons\webinterface.default\lib\video-js\font\VideoJS.ttf
337# also found 0 like in SWZCONLN.TTF
338#>>>>>&6		ubeshort	<8	MIN STRING
339# maximal name string 806 like in c:\Windows\Fonts\palabi.ttf
340#>>>>>&6		ubeshort	>805	MAX STRING
341# platform identifier: 0~Apple Unicode, 1~Macintosh, 3~Microsoft
342#>>>>>&-2	ubeshort	>3	BAD PLATFORM
343>>>>>&-2	ubeshort	0	\b, Unicode
344>>>>>&-2	ubeshort	1	\b, Macintosh
345>>>>>&-2	ubeshort	3	\b, Microsoft
346# languageID (0~english Macintosh, 0409h~english Microsoft, ...)
347>>>>>&2		ubeshort	>0	\b, language %#x
348# name identifiers
349# often 0~copyright, 1~font, 2~font subfamily, 5~version, 13~license, 19~sample, ...
350>>>>>&4		ubeshort	>0	\b, type %d string
351# platform specific encoding:
352# 0~undefined character set, 1~UGL set with Unicode, 3~Unicode 2.0 BMP only, 4~Unicode 2.0
353#>>>>>&0		ubeshort	x	\b, %d encoding
354>>>>>&0		ubeshort	0
355# handle only name string offset 0 because do not know how to add 2 relative offsets
356>>>>>>&6		ubeshort	0
357>>>>>>>&(&-14.S-18)	ubyte		!0
358# GRR: instead 806 only first MAXstring = 96 characters are displayed as defined in src\file.h
359# often copyright string that starts like \251 2006 The Monotype Corporation
360>>>>>>>>&-1		string		x	\b, %-11.96s
361# test for unicode string
362>>>>>>>&(&-14.S-18)	ubyte		0
363>>>>>>>>&0		lestring16	x	\b, %-11.96s
364# unicode encoding
365>>>>>&0		ubeshort	>0
366>>>>>>&6		ubeshort	0
367>>>>>>>&(&-14.S-17)	lestring16	x	\b, %-11.96s
368
3690	string		\007\001\001\000Copyright\ (c)\ 199	Adobe Multiple Master font
3700	string		\012\001\001\000Copyright\ (c)\ 199	Adobe Multiple Master font
371
372# TrueType/OpenType font collections (.ttc)
373# URL: https://en.wikipedia.org/wiki/OpenType
374# https://www.microsoft.com/typography/otspec/otff.htm
375# Modified by: Joerg Jenderek
376# Note:	container for TrueType, OpenType font
3770	string		ttcf
378# skip ASCII text
379>4	ubyte		0
380# sfnt version often 0x00010000 of 1st table is TrueType
381>>(12.L)	ubelong	!0x4f54544f	TrueType
382!:mime	font/ttf
383!:apple	????tfil
384!:ext	ttc
385# sfnt version 4F54544Fh~OTTO of 1st table is OpenType font
386>>(12.L)	ubelong	=0x4f54544f	OpenType
387!:mime	font/otf
388!:apple	????OTTO
389# no example found for otc
390!:ext	ttc/otc
391>>4	ubyte		x		font collection data
392#!:mime	font/collection
393# TCC version
394>>4	belong		0x00010000	\b, 1.0
395>>4	belong		0x00020000	\b, 2.0
396>>8	ubelong		>0		\b, %d fonts
397# array offset size = fonts * offsetsize = fonts * 4
398>>(8.L*4) ubequad	x
399# 0x44454947 = 'DSIG'
400>>>&4	belong		0x44534947	\b, digitally signed
401# offset to 1st font
402>>12	ubelong		x		\b, at %#x
403# point to 1st font that starts with sfnt version
404>>(12.L) use		sfnt-font
405
406# Opentype font data from Avi Bercovich
4070	string		OTTO		OpenType font data
408!:mime application/vnd.ms-opentype
409
410# From: Alex Myczko <alex@aiei.ch>
4110	string		SplineFontDB:	Spline Font Database
412!:mime application/vnd.font-fontforge-sfd
413>14	string		x		version %s
414
415# EOT
4160x40	string		\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0
417>0x22	string		LP		Embedded OpenType (EOT)
418# workaround until there's lepstring16
419# >>0x52	lepstring16/h	>\0		\b, %s family
420>>0x52	short	!0
421>>>0x54	lestring16	x		\b, %s family
422!:mime application/vnd.ms-fontobject
423
424# Web Open Font Format (.woff)
4250	name		woff
426>4	belong		0x00010000	\b, TrueType
427>4	belong		0x4F54544F	\b, CFF
428>4	belong		0x74727565	\b, TrueType
429>4	default		x
430>>4	belong		x		\b, flavor %d
431>8	belong		x		\b, length %d
432#>12	beshort		x		\b, numTables %d
433#>14	beshort		x		\b, reserved %d
434#>16	belong		x		\b, totalSfntSize %d
435
436# https://www.w3.org/TR/WOFF/
4370	string		wOFF	Web Open Font Format
438!:mime font/woff
439>0	use		woff
440>20	beshort		x	\b, version %d
441>22	beshort		x	\b.%d
442# https://www.w3.org/TR/WOFF2/
4430	string		wOF2	Web Open Font Format (Version 2)
444!:mime font/woff2
445!:ext	woff2
446>0	use		woff
447#>20	belong		x	\b, totalCompressedSize %d
448>24	beshort		x	\b, version %d
449>26	beshort		x	\b.%d
450