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