xref: /freebsd/contrib/file/magic/Magdir/fonts (revision a2dfb722)
1b6cee71dSXin LI
2b6cee71dSXin LI#------------------------------------------------------------------------------
3*a2dfb722SXin LI# $File: fonts,v 1.51 2022/08/16 11:16:39 christos Exp $
4b6cee71dSXin LI# fonts:  file(1) magic for font data
5b6cee71dSXin LI#
6b6cee71dSXin LI0	search/1	FONT		ASCII vfont text
7b6cee71dSXin LI0	short		0436		Berkeley vfont data
8b6cee71dSXin LI0	short		017001		byte-swapped Berkeley vfont data
9b6cee71dSXin LI
10b6cee71dSXin LI# PostScript fonts (must precede "printer" entries), quinlan@yggdrasil.com
11a4d6d3b8SXin LI# Modified by:	Joerg Jenderek
12a4d6d3b8SXin LI# URL:		https://en.wikipedia.org/wiki/PostScript_fonts
13a4d6d3b8SXin LI#		http://fileformats.archiveteam.org/wiki/Adobe_Type_1
14a4d6d3b8SXin LI# Reference:	http://mark0.net/download/triddefs_xml.7z
15a4d6d3b8SXin LI#		defs/p/pfb.trid.xml
16a4d6d3b8SXin LI# Note:		PFB stands for Printer Font Binary
17b6cee71dSXin LI0	string		%!PS-AdobeFont-1.	PostScript Type 1 font text
18a4d6d3b8SXin LI#!:mime	font/x-postscript-pfb
19a4d6d3b8SXin LI#!:ext	pfb
20b6cee71dSXin LI>20	string		>\0			(%s)
21a4d6d3b8SXin LI# http://www.nationalarchives.gov.uk/pronom/fmt/525
22a4d6d3b8SXin LI6	string		%!PS-AdobeFont-1.
23a4d6d3b8SXin LI# skip DROID fmt-525-signature-id-816.pfb by checking for content after header
24a4d6d3b8SXin LI>24	ubyte		x			PostScript Type 1 font program data
25a4d6d3b8SXin LI#!:mime	application/octet-stream
26a4d6d3b8SXin LI!:mime	font/x-postscript-pfb
27a4d6d3b8SXin LI!:ext	pfb
28a4d6d3b8SXin LI# often followed by colon (3Ah) and space (20h) and font name like: DarkGardenMK LetterGothic
29a4d6d3b8SXin LI>>24	ubyte		=0x3A
30a4d6d3b8SXin LI>>>26	string		>\0			(%s)
31a4d6d3b8SXin LI# some times instead of colon %%CreationDate: and "font name" later
32a4d6d3b8SXin LI>>24	ubyte		!0x3A
33a4d6d3b8SXin LI# font name directive followed by def like: c0633bt_.pfb
34a4d6d3b8SXin LI>>>25	search/1247	/FontName\040/
35a4d6d3b8SXin LI# show font name in parentheses like: Frankfurt Lithos CharterBT-BoldItalic Courier10PitchBT-Bold
36a4d6d3b8SXin LI>>>>&0	regex		[A-Za-z0-9-]+		(%s)
37a4d6d3b8SXin LI# http://cd.textfiles.com/maxfonts/ATM/M/MIRROR__.PFB
38a4d6d3b8SXin LI6	string		%PS-AdobeFont-1.	PostScript Type 1 font program data
39a4d6d3b8SXin LI!:mime	font/x-postscript-pfb
40a4d6d3b8SXin LI!:ext	pfb
41a4d6d3b8SXin LI# font name like:  Times-Mirror
42a4d6d3b8SXin LI>25	string		>\0			(%s)
43b6cee71dSXin LI0	string		%!FontType1	PostScript Type 1 font program data
44a4d6d3b8SXin LI#!:mime	font/x-postscript-pfb
45a4d6d3b8SXin LI#!:ext	pfb
46b6cee71dSXin LI6	string		%!FontType1	PostScript Type 1 font program data
47a4d6d3b8SXin LI#!:mime	application/octet-stream
48a4d6d3b8SXin LI!:mime	font/x-postscript-pfb
49a4d6d3b8SXin LI!:ext	pfb
50a4d6d3b8SXin LI# font name like: CaslonOpenFace FetteFraktur Kaufmann Linotext MesozoicGothic Old-Town
51a4d6d3b8SXin LI>23	string		>\0			(%s)
52a4d6d3b8SXin LI# http://cd.textfiles.com/maxfonts/ATM/P/PLAYBI.PFB
53a4d6d3b8SXin LI230	string		%!FontType1	PostScript Type 1 font program data
54a4d6d3b8SXin LI!:mime	font/x-postscript-pfb
55a4d6d3b8SXin LI!:ext	pfb
56a4d6d3b8SXin LI# font name like: Playbill
57a4d6d3b8SXin LI>247	string		>\0			(%s)
58b6cee71dSXin LI0	string		%!PS-Adobe-3.0\ Resource-Font	PostScript Type 1 font text
59a4d6d3b8SXin LI#!:mime	font/x-postscript-pfb
60a4d6d3b8SXin LI#!:ext	pfb
61b6cee71dSXin LI
62a5d223e6SXin LI# Summary:	PostScript Type 1 Printer Font Metrics
63a5d223e6SXin LI# URL:		https://en.wikipedia.org/wiki/PostScript_fonts
6448c779cdSXin LI# Reference:	https://partners.adobe.com/public/developer/en/font/5178.PFM.pdf
65a5d223e6SXin LI# Modified by:	Joerg Jenderek
66a5d223e6SXin LI# Note:		moved from ./msdos magic
67a5d223e6SXin LI# dfVersion 256=0100h
68a5d223e6SXin LI0		uleshort	0x0100
69a5d223e6SXin LI# GRR: line above is too general as it catches also TrueType font,
70a5d223e6SXin LI# raw G3 data FAX, WhatsApp encrypted and Panorama database
71a5d223e6SXin LI# dfType 129=0081h
72a5d223e6SXin LI>66		uleshort	0x0081
73a5d223e6SXin LI# dfVertRes 300=012Ch not needed as additional test
74a5d223e6SXin LI#>>70		uleshort	0x012c
75a5d223e6SXin LI# dfHorizRes 300=012Ch
76a5d223e6SXin LI#>>>72		uleshort	0x012c
77a5d223e6SXin LI# dfDriverInfo points to postscript information section
78a5d223e6SXin LI>>(101.l)	string/c	Postscript	Printer Font Metrics
79a5d223e6SXin LI# above labeled "PFM data" by ./msdos (version 5.28) or "Adobe Printer Font Metrics" by TrID
80a5d223e6SXin LI!:mime	application/x-font-pfm
81a5d223e6SXin LI# AppleShare Print Server
82a5d223e6SXin LI#!:apple	ASPS????
83a5d223e6SXin LI!:ext	pfm
84a5d223e6SXin LI# dfCopyright 60 byte null padded Copyright string. uncomment it to get old looking
85a5d223e6SXin LI#>>>6		string		>\060		- %-.60s
86a5d223e6SXin LI# dfDriverInfo
87a5d223e6SXin LI>>>139		ulelong		>0
88a5d223e6SXin LI# often abbreviated and same as filename
89a5d223e6SXin LI>>>>(139.l)	string		x		%s
90a5d223e6SXin LI# dfSize
91a5d223e6SXin LI>>>2		ulelong		x		\b, %d bytes
92a5d223e6SXin LI# dfFace 210=D2h 9Eh
93a5d223e6SXin LI>>>105		ulelong		>0
94a5d223e6SXin LI# Windows font name
95a5d223e6SXin LI>>>>(105.l)	string		x		\b, %s
96a5d223e6SXin LI# dfItalic
97a5d223e6SXin LI>>>80		ubyte		1		italic
98a5d223e6SXin LI# dfUnderline
99a5d223e6SXin LI>>>81		ubyte		1		underline
100a5d223e6SXin LI# dfStrikeOut
101a5d223e6SXin LI>>>82		ubyte		1		strikeout
102a5d223e6SXin LI# dfWeight 400=0x0190 300=0x012c 500=0x01f4 600=0x0258 700=0x02bc
103a5d223e6SXin LI>>>83		uleshort	>699		bold
104a5d223e6SXin LI# dfPitchAndFamily 16 17 48 49 64 65
105a5d223e6SXin LI>>>90		ubyte		16		serif
106a5d223e6SXin LI>>>90		ubyte		17		serif proportional
107a5d223e6SXin LI#>>>90		ubyte		48		other
108a5d223e6SXin LI>>>90		ubyte		49		proportional
109a5d223e6SXin LI>>>90		ubyte		64		script
110a5d223e6SXin LI>>>90		ubyte		65		script proportional
111a5d223e6SXin LI
112b6cee71dSXin LI# X11 font files in SNF (Server Natural Format) format
113a4d6d3b8SXin LI# updated by Joerg Jenderek at Feb 2013 and Nov 2021
114b6cee71dSXin LI# http://computer-programming-forum.com/51-perl/8f22fb96d2e34bab.htm
115a4d6d3b8SXin LI# URL:		http://fileformats.archiveteam.org/wiki/SNF
116a4d6d3b8SXin LI# Reference:	https://cgit.freedesktop.org/xorg/lib/libXfont/tree/src/bitmap/snfstr.h
117a4d6d3b8SXin LI0	belong		00000004
118a4d6d3b8SXin LI# version2 same as version1 in struct _snfFontInfo
119a4d6d3b8SXin LI>104	belong		00000004		X11 SNF font data, MSB first
120a4d6d3b8SXin LI# GRR: line above is too general as it catches also DEGAS low-res bitmap like:
121a4d6d3b8SXin LI# http://cd.textfiles.com/geminiatari/FILES/GRAPHICS/ANIMAT/SPID_PAT/BIGSPID.PI1
122b6cee71dSXin LI!:mime	application/x-font-sfn
123a4d6d3b8SXin LI!:ext	snf
124a4d6d3b8SXin LI# GRR: line below is too general as it catches also Xbase index file t3-CHAR.NDX
125b6cee71dSXin LI0	lelong		00000004
126b6cee71dSXin LI>104	lelong		00000004		X11 SNF font data, LSB first
127b6cee71dSXin LI!:mime	application/x-font-sfn
128a4d6d3b8SXin LI# Reference:    http://mark0.net/download/triddefs_xml.7z/defs/s/snf-x11-lsb.trid.xml
129a4d6d3b8SXin LI!:ext	snf
130b6cee71dSXin LI
131b6cee71dSXin LI# X11 Bitmap Distribution Format, from Daniel Quinlan (quinlan@yggdrasil.com)
132b6cee71dSXin LI0	search/1	STARTFONT\ 		X11 BDF font text
133b6cee71dSXin LI
1343e41d09dSXin LI# From: Joerg Jenderek
13548c779cdSXin LI# URL: https://grub.gibibit.com/New_font_format
1363e41d09dSXin LI# Reference: util/grub-mkfont.c
1373e41d09dSXin LI#		include/grub/fontformat.h
1383e41d09dSXin LI# FONT_FORMAT_SECTION_NAMES_FILE
1393e41d09dSXin LI0			string		FILE
1403e41d09dSXin LI# FONT_FORMAT_PFF2_MAGIC
1413e41d09dSXin LI>8			string		PFF2
1423e41d09dSXin LI# leng 4 only at the moment
1433e41d09dSXin LI>>4			ubelong		4
1443e41d09dSXin LI# FONT_FORMAT_SECTION_NAMES_FONT_NAME
1453e41d09dSXin LI>>>12			string		NAME		GRUB2 font
1463e41d09dSXin LI!:mime			application/x-font-pf2
1473e41d09dSXin LI!:ext			pf2
1483e41d09dSXin LI# length of font_name
1493e41d09dSXin LI>>>>16			ubelong		>0
1503e41d09dSXin LI# font_name
1513e41d09dSXin LI>>>>>20			string		>\0		"%-s"
1523e41d09dSXin LI
153b6cee71dSXin LI# X11 fonts, from Daniel Quinlan (quinlan@yggdrasil.com)
154b6cee71dSXin LI# PCF must come before SGI additions ("MIPSEL MIPS-II COFF" collides)
15540427ccaSGordon Tetlow0	string		\001fcp			X11 Portable Compiled Font data,
15640427ccaSGordon Tetlow>12	lelong		^0x08			bit: LSB,
15740427ccaSGordon Tetlow>12	lelong		&0x08			bit: MSB,
15840427ccaSGordon Tetlow>12	lelong		^0x04			byte: LSB first
15940427ccaSGordon Tetlow>12	lelong		&0x04			byte: MSB first
160b6cee71dSXin LI0	string		D1.0\015		X11 Speedo font data
161b6cee71dSXin LI
162b6cee71dSXin LI#------------------------------------------------------------------------------
163b6cee71dSXin LI# FIGlet fonts and controlfiles
164b6cee71dSXin LI# From figmagic supplied with Figlet version 2.2
165b6cee71dSXin LI# "David E. O'Brien" <obrien@FreeBSD.ORG>
166b6cee71dSXin LI0	string		flf		FIGlet font
167b6cee71dSXin LI>3	string		>2a		version %-2.2s
168b6cee71dSXin LI0	string		flc		FIGlet controlfile
169b6cee71dSXin LI>3	string		>2a		version %-2.2s
170b6cee71dSXin LI
171b6cee71dSXin LI# libGrx graphics lib fonts, from Albert Cahalan (acahalan@cs.uml.edu)
172b6cee71dSXin LI# Used with djgpp (DOS Gnu C++), sometimes Linux or Turbo C++
173b6cee71dSXin LI0	belong		0x14025919	libGrx font data,
174b6cee71dSXin LI>8	leshort		x		%dx
175b6cee71dSXin LI>10	leshort		x		\b%d
176b6cee71dSXin LI>40	string		x		%s
177b6cee71dSXin LI# Misc. DOS VGA fonts, from Albert Cahalan (acahalan@cs.uml.edu)
17843a5ec4eSXin LI# Update:	Joerg Jenderek
17943a5ec4eSXin LI# URL:		http://fileformats.archiveteam.org/wiki/CPI
18043a5ec4eSXin LI# Reference:	http://www.delorie.com/djgpp/doc/rbinter/it/58/17.html
181b6cee71dSXin LI0	belong		0xff464f4e	DOS code page font data collection
18243a5ec4eSXin LI!:mime	font/x-dos-cpi
18343a5ec4eSXin LI!:ext	cpi
18443a5ec4eSXin LI0	string		\x7fDRFONT	DR-DOS code page font data collection
18543a5ec4eSXin LI!:mime	font/x-drdos-cpi
18643a5ec4eSXin LI!:ext	cpi
187b6cee71dSXin LI7	belong		0x00454741	DOS code page font data
188b6cee71dSXin LI7	belong		0x00564944	DOS code page font data (from Linux?)
189b6cee71dSXin LI4098	string		DOSFONT		DOSFONT2 encrypted font data
190b6cee71dSXin LI
19148c779cdSXin LI# From: Joerg Jenderek
19248c779cdSXin LI# URL: http://fileformats.archiveteam.org/wiki/GEM_bitmap_font
19348c779cdSXin LI# Reference: http://cd.textfiles.com/ataricompendium/BOOK/HTML/APPENDC.HTM#cnt
19448c779cdSXin LI#
19548c779cdSXin LI# usual case with lightening mask and skewing mask 5555h~UU
196d38c30c0SXin LI#62	ulelong		0x55555555
197d38c30c0SXin LI# skip cl8m8ocofedso.testfile by looking for face size lower/equal 72
198d38c30c0SXin LI#>2	uleshort	<73
199d38c30c0SXin LI#>>0	use		gdos-font
20048c779cdSXin LI# BOX18.GFT COWBOY30.GFT ROYALK30.GFT
201d38c30c0SXin LI#62	ulelong		0
20248c779cdSXin LI# skip ISO 9660 CD-ROM ./filesystem by looking for low positive face size
203d38c30c0SXin LI#>2	uleshort	>2
204d38c30c0SXin LI# skip DOS 2.0 backup id file ./msdos by looking for face size lower/equal 72
205d38c30c0SXin LI#>>2	uleshort	<73
206d38c30c0SXin LI# skip MS oem.hlp, some Windows ICO ./msdos by looking for valid long name like WYE
207d38c30c0SXin LI#>>>4	ulelong		>0x001F1f1F
208d38c30c0SXin LI# skip Microsoft WinWord 2.0 ./msdos by looking for positive offset to font data
209d38c30c0SXin LI#>>>>76	ulelong		>83
210d38c30c0SXin LI#>>>>>0	use		gdos-font
21148c779cdSXin LI0	name		gdos-font
21248c779cdSXin LI>0	uleshort	x		GEM GDOS font
21348c779cdSXin LI!:mime	application/x-font-gdos
21448c779cdSXin LI# also .eps found like AA070GEP.EPS AI360GEP.EPS
21548c779cdSXin LI!:ext	fnt/gtf
216d38c30c0SXin LI# font name like Big&Tall, Celtic #s, Courier, University Bold, WYE
21748c779cdSXin LI>4	string		x		%.32s
218d38c30c0SXin LI# face size in points 3-72 SLSS03CG.FNT H1CELT72.FNT
21948c779cdSXin LI>2	uleshort	x		%u
22048c779cdSXin LI# face ID (must be unique)
22143a5ec4eSXin LI>0	uleshort	x		\b, ID %#4.4x
222d38c30c0SXin LI# lowest character index in face (4 but usually 32 for disk-loaded fonts)
223d38c30c0SXin LI#>36	uleshort	!32		\b, unusual character index %u
224d38c30c0SXin LI# width of the widest character like 0 8 10 12 16 24 32
22548c779cdSXin LI#>50	uleshort	x		\b, %u char width
226d38c30c0SXin LI# width of the widest character cell like 8 11 12 14 15 16 33 67
22748c779cdSXin LI#>52	uleshort	x		\b, %u cell width
228d38c30c0SXin LI# thickening size in pixel like 0 1 2 3 4 5 6 7 8
22948c779cdSXin LI#>58	uleshort	x		\b, %u thick
23048c779cdSXin LI# lightening mask to eliminate pixels, usually 5555h
23143a5ec4eSXin LI>62	uleshort	!0x5555		\b, lightening mask %#x
23248c779cdSXin LI# skewing mask to determine when to perform additional rotation when skewing, usually 5555h
23343a5ec4eSXin LI>64	uleshort	!0x5555		\b, skewing mask %#x
234d38c30c0SXin LI# offset to optional horizontal offset table 0 58h~88 5eh 252h
23543a5ec4eSXin LI#>68	ulelong		x		\b, %#x horizontal table offset
236d38c30c0SXin LI# offset of character offset table 54h for many *.GFT 55h 58h 5Eh 120h 1D4h 202h 220h
23743a5ec4eSXin LI#>72	ulelong		x		\b, %#x coffset
238d38c30c0SXin LI# offset to font data like 116h 118h 158 20Ah 20Eh
23943a5ec4eSXin LI>76	ulelong		x		\b, %#x foffset
240d38c30c0SXin LI# form width in bytes like 58 67 156 190 227 317 345
24148c779cdSXin LI#>80	uleshort	x		\b, %u fwidth
242d38c30c0SXin LI# form height in bytes like 4 8 11 17 26 56 70 90 120 146 150
243d38c30c0SXin LI#>82	uleshort	x		\b, %u fheight
244d38c30c0SXin LI# pointer to the next font like 0 10000h 20000h 30000h 40000h 60000h 80000h E0000h D0000h
24543a5ec4eSXin LI#>84	ulelong		x		\b, %#x noffset
24648c779cdSXin LI
247b6cee71dSXin LI# downloadable fonts for browser (prints type) anthon@mnt.org
2483e41d09dSXin LI# https://tools.ietf.org/html/rfc3073
2493e41d09dSXin LI0	string		PFR1		Portable Font Resource font data (new)
250b6cee71dSXin LI>102	string		>0		\b: %s
2513e41d09dSXin LI0	string		PFR0		Portable Font Resource font data (old)
2523e41d09dSXin LI>4	beshort		>0		version %d
253b6cee71dSXin LI
254b6cee71dSXin LI# True Type fonts
25540427ccaSGordon Tetlow# Modified by: Joerg Jenderek
25640427ccaSGordon Tetlow# URL: https://en.wikipedia.org/wiki/TrueType
25740427ccaSGordon Tetlow# Reference: https://developer.apple.com/fonts/TrueType-Reference-Manual/
25840427ccaSGordon Tetlow#
25940427ccaSGordon Tetlow# sfnt version "typ1" used by some Apple, but no example found
26040427ccaSGordon Tetlow0	string	typ1
26140427ccaSGordon Tetlow>0	use		sfnt-font
26240427ccaSGordon Tetlow>0	use		sfnt-names
26340427ccaSGordon Tetlow# sfnt version "true" used by some Apple
26440427ccaSGordon Tetlow0	string	true
26540427ccaSGordon Tetlow>0	use		sfnt-font
26640427ccaSGordon Tetlow>0	use		sfnt-names
26740427ccaSGordon Tetlow# GRR: below test is too general
26840427ccaSGordon Tetlow# sfnt version often 0x00010000
26940427ccaSGordon Tetlow0	string	\000\001\000\000
27040427ccaSGordon Tetlow>0	use		sfnt-font
27140427ccaSGordon Tetlow>0	use		sfnt-names
27240427ccaSGordon Tetlow#	validate and display sfnt font data like number of tables
27340427ccaSGordon Tetlow0	name		sfnt-font
27440427ccaSGordon Tetlow# file 5.30 version assumes 00FFh as maximal number of tables
27540427ccaSGordon Tetlow#>4	ubeshort	<0x0100
27640427ccaSGordon Tetlow# maximal 27 tables found like in Skia.ttf
27740427ccaSGordon Tetlow# 46 different table names mentioned on Apple specification
27840427ccaSGordon Tetlow# skip 1st sequence of DOS 2 backup with path separator (\~92 or /~47) misinterpreted as table number
27940427ccaSGordon Tetlow>4	ubeshort	<47
28040427ccaSGordon Tetlow# skip bad examples with garbage table names like in a5.show HYPERC MAC
28140427ccaSGordon Tetlow# tag names consist of up to four characters padded with spaces at end like
28240427ccaSGordon Tetlow# BASE DSIG OS/2 Zapf acnt glyf cvt vmtx xref ...
28340427ccaSGordon Tetlow>>12	regex/4l	\^[A-Za-z][A-Za-z][A-Za-z/][A-Za-z2\ ]
28443a5ec4eSXin LI#>>>0	ubelong	x	\b, sfnt version %#x
28540427ccaSGordon Tetlow>>>0	ubelong	!0x4f54544f	TrueType
28648c779cdSXin LI!:mime	font/sfnt
28740427ccaSGordon Tetlow!:apple	????tfil
28840427ccaSGordon Tetlow# .ttf for TrueType font
28940427ccaSGordon Tetlow# EUDC.tte created by privat character editor %WINDIR%\system32\eudcedit.exe
29040427ccaSGordon Tetlow!:ext	ttf/tte
29140427ccaSGordon Tetlow# sfnt version 4F54544Fh~OTTO
29240427ccaSGordon Tetlow>>>0	ubelong	=0x4f54544f	OpenType
29348c779cdSXin LI!:mime	font/otf
29440427ccaSGordon Tetlow!:apple	????OTTO
29540427ccaSGordon Tetlow!:ext	otf
29640427ccaSGordon Tetlow>>>0	ubelong	x		Font data
29740427ccaSGordon Tetlow# DSIG=44454947h table name implies a digitally signed font
29840427ccaSGordon Tetlow# search range = number of tables * 16 =< maximal number of tables * 16 = 27 * 16 = 432
29940427ccaSGordon Tetlow>>>12	search/432	DSIG		\b, digitally signed
30040427ccaSGordon Tetlow>>>4	ubeshort	x		\b, %d tables
30140427ccaSGordon Tetlow# minimal 9 tables found like in NISC18030.ttf
30240427ccaSGordon Tetlow#>>>4	ubeshort	<10		TMIN
30340427ccaSGordon Tetlow#>>>4	ubeshort	>24		TBIG
30440427ccaSGordon Tetlow# table directory entries
30540427ccaSGordon Tetlow>>>12	string		x		\b, 1st "%4.4s"
30640427ccaSGordon Tetlow
30740427ccaSGordon Tetlow#	search and display 1st name in sfnt font which is often copyright text
30840427ccaSGordon Tetlow#	does not work inside font collections
30940427ccaSGordon Tetlow0	name		sfnt-names
31040427ccaSGordon Tetlow# search for naming table
31140427ccaSGordon Tetlow>12	search/432/s	name
31240427ccaSGordon Tetlow# biggest offset 0x0100bd28 like Windows10 Fonts\simsunb.ttf
31340427ccaSGordon Tetlow#>>>>&8	ubelong		>0x0100bd27	BIGGEST OFFSET
31440427ccaSGordon Tetlow>>&8	ubelong		>0x00100000
31540427ccaSGordon Tetlow# offset of name table
31643a5ec4eSXin LI>>>&-4	ubelong		x		\b, name offset %#x
31740427ccaSGordon Tetlow# GRR: pointer to name table only works if offset ~< FILE_BYTES_MAX = 100000h defined in src\file.h
31840427ccaSGordon Tetlow>>&8	ubelong		<0x00100000
31940427ccaSGordon Tetlow>>>&-16	ubelong		x
32040427ccaSGordon Tetlow# name table
32140427ccaSGordon Tetlow>>>>(&8.L)	ubequad	x
32240427ccaSGordon Tetlow# invalid format selector
32340427ccaSGordon Tetlow#>>>>>&-8	ubeshort	!0	\b, invalid selector %x
32440427ccaSGordon Tetlow# minimal 3 name records found like in c:\Program Files (x86)\Tesseract-OCR\tessdata\pdf.ttf
32540427ccaSGordon Tetlow# maximal 1227 name records found like in Apple Chancery.ttf
32640427ccaSGordon Tetlow#>>>>>&-6	ubeshort	<0x4	mincount
32740427ccaSGordon Tetlow#>>>>>&-6	ubeshort	>130	maxcount
32840427ccaSGordon Tetlow>>>>>&-6	ubeshort	x	\b, %d names
32940427ccaSGordon Tetlow# offset to start of string storage from start of table
33040427ccaSGordon Tetlow#>>>>>&-4	ubeshort	x	\b, record offset %d
33140427ccaSGordon Tetlow# 1st name record
33240427ccaSGordon Tetlow# string offset from start of storage area
33340427ccaSGordon Tetlow#>>>>>&8		ubeshort	x	\b, string offset %d
33440427ccaSGordon Tetlow# string length
33540427ccaSGordon Tetlow#>>>>>&6		ubeshort	x	\b, string length %d
33640427ccaSGordon Tetlow# minimal name string 7 like in c:\Program Files (x86)\Kodi\addons\webinterface.default\lib\video-js\font\VideoJS.ttf
33740427ccaSGordon Tetlow# also found 0 like in SWZCONLN.TTF
33840427ccaSGordon Tetlow#>>>>>&6		ubeshort	<8	MIN STRING
33940427ccaSGordon Tetlow# maximal name string 806 like in c:\Windows\Fonts\palabi.ttf
34040427ccaSGordon Tetlow#>>>>>&6		ubeshort	>805	MAX STRING
34140427ccaSGordon Tetlow# platform identifier: 0~Apple Unicode, 1~Macintosh, 3~Microsoft
34240427ccaSGordon Tetlow#>>>>>&-2	ubeshort	>3	BAD PLATFORM
34340427ccaSGordon Tetlow>>>>>&-2	ubeshort	0	\b, Unicode
34440427ccaSGordon Tetlow>>>>>&-2	ubeshort	1	\b, Macintosh
34540427ccaSGordon Tetlow>>>>>&-2	ubeshort	3	\b, Microsoft
34640427ccaSGordon Tetlow# languageID (0~english Macintosh, 0409h~english Microsoft, ...)
34743a5ec4eSXin LI>>>>>&2		ubeshort	>0	\b, language %#x
34840427ccaSGordon Tetlow# name identifiers
34940427ccaSGordon Tetlow# often 0~copyright, 1~font, 2~font subfamily, 5~version, 13~license, 19~sample, ...
35040427ccaSGordon Tetlow>>>>>&4		ubeshort	>0	\b, type %d string
35140427ccaSGordon Tetlow# platform specific encoding:
35240427ccaSGordon Tetlow# 0~undefined character set, 1~UGL set with Unicode, 3~Unicode 2.0 BMP only, 4~Unicode 2.0
35340427ccaSGordon Tetlow#>>>>>&0		ubeshort	x	\b, %d encoding
35440427ccaSGordon Tetlow>>>>>&0		ubeshort	0
35540427ccaSGordon Tetlow# handle only name string offset 0 because do not know how to add 2 relative offsets
35640427ccaSGordon Tetlow>>>>>>&6		ubeshort	0
35740427ccaSGordon Tetlow>>>>>>>&(&-14.S-18)	ubyte		!0
35840427ccaSGordon Tetlow# GRR: instead 806 only first MAXstring = 96 characters are displayed as defined in src\file.h
35940427ccaSGordon Tetlow# often copyright string that starts like \251 2006 The Monotype Corporation
36040427ccaSGordon Tetlow>>>>>>>>&-1		string		x	\b, %-11.96s
36140427ccaSGordon Tetlow# test for unicode string
36240427ccaSGordon Tetlow>>>>>>>&(&-14.S-18)	ubyte		0
36340427ccaSGordon Tetlow>>>>>>>>&0		lestring16	x	\b, %-11.96s
36440427ccaSGordon Tetlow# unicode encoding
36540427ccaSGordon Tetlow>>>>>&0		ubeshort	>0
36640427ccaSGordon Tetlow>>>>>>&6		ubeshort	0
36740427ccaSGordon Tetlow>>>>>>>&(&-14.S-17)	lestring16	x	\b, %-11.96s
368b6cee71dSXin LI
369b6cee71dSXin LI0	string		\007\001\001\000Copyright\ (c)\ 199	Adobe Multiple Master font
370b6cee71dSXin LI0	string		\012\001\001\000Copyright\ (c)\ 199	Adobe Multiple Master font
371b6cee71dSXin LI
372b6cee71dSXin LI# TrueType/OpenType font collections (.ttc)
37340427ccaSGordon Tetlow# URL: https://en.wikipedia.org/wiki/OpenType
37448c779cdSXin LI# https://www.microsoft.com/typography/otspec/otff.htm
37540427ccaSGordon Tetlow# Modified by: Joerg Jenderek
37640427ccaSGordon Tetlow# Note:	container for TrueType, OpenType font
37740427ccaSGordon Tetlow0	string		ttcf
37840427ccaSGordon Tetlow# skip ASCII text
37940427ccaSGordon Tetlow>4	ubyte		0
38040427ccaSGordon Tetlow# sfnt version often 0x00010000 of 1st table is TrueType
38140427ccaSGordon Tetlow>>(12.L)	ubelong	!0x4f54544f	TrueType
38248c779cdSXin LI!:mime	font/ttf
38340427ccaSGordon Tetlow!:apple	????tfil
38440427ccaSGordon Tetlow!:ext	ttc
38540427ccaSGordon Tetlow# sfnt version 4F54544Fh~OTTO of 1st table is OpenType font
38640427ccaSGordon Tetlow>>(12.L)	ubelong	=0x4f54544f	OpenType
38748c779cdSXin LI!:mime	font/otf
38840427ccaSGordon Tetlow!:apple	????OTTO
38940427ccaSGordon Tetlow# no example found for otc
39040427ccaSGordon Tetlow!:ext	ttc/otc
39140427ccaSGordon Tetlow>>4	ubyte		x		font collection data
39240427ccaSGordon Tetlow#!:mime	font/collection
39340427ccaSGordon Tetlow# TCC version
39440427ccaSGordon Tetlow>>4	belong		0x00010000	\b, 1.0
39540427ccaSGordon Tetlow>>4	belong		0x00020000	\b, 2.0
39640427ccaSGordon Tetlow>>8	ubelong		>0		\b, %d fonts
39740427ccaSGordon Tetlow# array offset size = fonts * offsetsize = fonts * 4
39840427ccaSGordon Tetlow>>(8.L*4) ubequad	x
399b6cee71dSXin LI# 0x44454947 = 'DSIG'
40040427ccaSGordon Tetlow>>>&4	belong		0x44534947	\b, digitally signed
40140427ccaSGordon Tetlow# offset to 1st font
40243a5ec4eSXin LI>>12	ubelong		x		\b, at %#x
40340427ccaSGordon Tetlow# point to 1st font that starts with sfnt version
40440427ccaSGordon Tetlow>>(12.L) use		sfnt-font
405b6cee71dSXin LI
406b6cee71dSXin LI# Opentype font data from Avi Bercovich
407b6cee71dSXin LI0	string		OTTO		OpenType font data
408b6cee71dSXin LI!:mime application/vnd.ms-opentype
409b6cee71dSXin LI
41058a0f0d0SEitan Adler# From: Alex Myczko <alex@aiei.ch>
411b6cee71dSXin LI0	string		SplineFontDB:	Spline Font Database
412b6cee71dSXin LI!:mime application/vnd.font-fontforge-sfd
413b6cee71dSXin LI>14	string		x		version %s
414b6cee71dSXin LI
415b6cee71dSXin LI# EOT
416a5d223e6SXin LI0x40	string		\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0
417a5d223e6SXin LI>0x22	string		LP		Embedded OpenType (EOT)
418a5d223e6SXin LI# workaround until there's lepstring16
419a5d223e6SXin LI# >>0x52	lepstring16/h	>\0		\b, %s family
420a5d223e6SXin LI>>0x52	short	!0
421a5d223e6SXin LI>>>0x54	lestring16	x		\b, %s family
422b6cee71dSXin LI!:mime application/vnd.ms-fontobject
423b6cee71dSXin LI
424b6cee71dSXin LI# Web Open Font Format (.woff)
4253e41d09dSXin LI0	name		woff
4263e41d09dSXin LI>4	belong		0x00010000	\b, TrueType
4273e41d09dSXin LI>4	belong		0x4F54544F	\b, CFF
4283e41d09dSXin LI>4	belong		0x74727565	\b, TrueType
4293e41d09dSXin LI>4	default		x
4303e41d09dSXin LI>>4	belong		x		\b, flavor %d
4313e41d09dSXin LI>8	belong		x		\b, length %d
4323e41d09dSXin LI#>12	beshort		x		\b, numTables %d
4333e41d09dSXin LI#>14	beshort		x		\b, reserved %d
4343e41d09dSXin LI#>16	belong		x		\b, totalSfntSize %d
4353e41d09dSXin LI
43648c779cdSXin LI# https://www.w3.org/TR/WOFF/
437b6cee71dSXin LI0	string		wOFF	Web Open Font Format
438a4d6d3b8SXin LI!:mime font/woff
4393e41d09dSXin LI>0	use		woff
440b6cee71dSXin LI>20	beshort		x	\b, version %d
441b6cee71dSXin LI>22	beshort		x	\b.%d
44248c779cdSXin LI# https://www.w3.org/TR/WOFF2/
4433e41d09dSXin LI0	string		wOF2	Web Open Font Format (Version 2)
444a4d6d3b8SXin LI!:mime font/woff2
445*a2dfb722SXin LI!:ext	woff2
4463e41d09dSXin LI>0	use		woff
4473e41d09dSXin LI#>20	belong		x	\b, totalCompressedSize %d
4483e41d09dSXin LI>24	beshort		x	\b, version %d
4493e41d09dSXin LI>26	beshort		x	\b.%d
450