2 #------------------------------------------------------------------------------
3 # $File: fonts,v 1.46 2021/04/26 15:56:00 christos Exp $
4 # fonts: file(1) magic for font data
6 0 search/1 FONT ASCII vfont text
7 0 short 0436 Berkeley vfont data
8 0 short 017001 byte-swapped Berkeley vfont data
10 # PostScript fonts (must precede "printer" entries), quinlan@yggdrasil.com
11 0 string %!PS-AdobeFont-1. PostScript Type 1 font text
13 6 string %!PS-AdobeFont-1. PostScript Type 1 font program data
15 0 string %!FontType1 PostScript Type 1 font program data
16 6 string %!FontType1 PostScript Type 1 font program data
17 0 string %!PS-Adobe-3.0\ Resource-Font PostScript Type 1 font text
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
26 # GRR: line above is too general as it catches also TrueType font,
27 # raw G3 data FAX, WhatsApp encrypted and Panorama database
30 # dfVertRes 300=012Ch not needed as additional test
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
41 # dfCopyright 60 byte null padded Copyright string. uncomment it to get old looking
42 #>>>6 string >\060 - %-.60s
45 # often abbreviated and same as filename
46 >>>>(139.l) string x %s
48 >>>2 ulelong x \b, %d bytes
52 >>>>(105.l) string x \b, %s
56 >>>81 ubyte 1 underline
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
63 >>>90 ubyte 17 serif proportional
65 >>>90 ubyte 49 proportional
67 >>>90 ubyte 65 script proportional
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
72 0 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
77 >104 lelong 00000004 X11 SNF font data, LSB first
78 !:mime application/x-font-sfn
80 # X11 Bitmap Distribution Format, from Daniel Quinlan (quinlan@yggdrasil.com)
81 0 search/1 STARTFONT\ X11 BDF font text
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
89 # FONT_FORMAT_PFF2_MAGIC
91 # leng 4 only at the moment
93 # FONT_FORMAT_SECTION_NAMES_FONT_NAME
94 >>>12 string NAME GRUB2 font
95 !:mime application/x-font-pf2
100 >>>>>20 string >\0 "%-s"
102 # X11 fonts, from Daniel Quinlan (quinlan@yggdrasil.com)
103 # PCF must come before SGI additions ("MIPSEL MIPS-II COFF" collides)
104 0 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
109 0 string D1.0\015 X11 Speedo font data
111 #------------------------------------------------------------------------------
112 # FIGlet fonts and controlfiles
113 # From figmagic supplied with Figlet version 2.2
114 # "David E. O'Brien" <obrien@FreeBSD.ORG>
115 0 string flf FIGlet font
116 >3 string >2a version %-2.2s
117 0 string flc FIGlet controlfile
118 >3 string >2a version %-2.2s
120 # libGrx graphics lib fonts, from Albert Cahalan (acahalan@cs.uml.edu)
121 # Used with djgpp (DOS Gnu C++), sometimes Linux or Turbo C++
122 0 belong 0x14025919 libGrx font data,
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
130 0 belong 0xff464f4e DOS code page font data collection
131 !:mime font/x-dos-cpi
133 0 string \x7fDRFONT DR-DOS code page font data collection
134 !:mime font/x-drdos-cpi
136 7 belong 0x00454741 DOS code page font data
137 7 belong 0x00564944 DOS code page font data (from Linux?)
138 4098 string DOSFONT DOSFONT2 encrypted font data
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
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
149 # BOX18.GFT COWBOY30.GFT ROYALK30.GFT
151 # skip ISO 9660 CD-ROM ./filesystem by looking for low positive face size
153 # skip DOS 2.0 backup id file ./msdos by looking for face size lower/equal 72
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
159 #>>>>>0 use gdos-font
161 >0 uleshort x GEM GDOS font
162 !:mime application/x-font-gdos
163 # also .eps found like AA070GEP.EPS AI360GEP.EPS
165 # font name like Big&Tall, Celtic #s, Courier, University Bold, WYE
167 # face size in points 3-72 SLSS03CG.FNT H1CELT72.FNT
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
196 # downloadable fonts for browser (prints type) anthon@mnt.org
197 # https://tools.ietf.org/html/rfc3073
198 0 string PFR1 Portable Font Resource font data (new)
199 >102 string >0 \b: %s
200 0 string PFR0 Portable Font Resource font data (old)
201 >4 beshort >0 version %d
204 # Modified by: Joerg Jenderek
205 # URL: https://en.wikipedia.org/wiki/TrueType
206 # Reference: https://developer.apple.com/fonts/TrueType-Reference-Manual/
208 # sfnt version "typ1" used by some Apple, but no example found
212 # sfnt version "true" used by some Apple
216 # GRR: below test is too general
217 # sfnt version often 0x00010000
218 0 string \000\001\000\000
221 # validate and display sfnt font data like number of tables
223 # file 5.30 version assumes 00FFh as maximal number of tables
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
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
237 # .ttf for TrueType font
238 # EUDC.tte created by privat character editor %WINDIR%\system32\eudcedit.exe
240 # sfnt version 4F54544Fh~OTTO
241 >>>0 ubelong =0x4f54544f OpenType
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"
256 # search and display 1st name in sfnt font which is often copyright text
257 # does not work inside font collections
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
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
281 # string offset from start of storage area
282 #>>>>>&8 ubeshort x \b, string offset %d
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
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
304 # handle only name string offset 0 because do not know how to add 2 relative offsets
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
316 >>>>>>>&(&-14.S-17) lestring16 x \b, %-11.96s
318 0 string \007\001\001\000Copyright\ (c)\ 199 Adobe Multiple Master font
319 0 string \012\001\001\000Copyright\ (c)\ 199 Adobe Multiple Master font
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
329 # sfnt version often 0x00010000 of 1st table is TrueType
330 >>(12.L) ubelong !0x4f54544f TrueType
334 # sfnt version 4F54544Fh~OTTO of 1st table is OpenType font
335 >>(12.L) ubelong =0x4f54544f OpenType
338 # no example found for otc
340 >>4 ubyte x font collection data
341 #!:mime font/collection
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
348 # 0x44454947 = 'DSIG'
349 >>>&4 belong 0x44534947 \b, digitally signed
351 >>12 ubelong x \b, at %#x
352 # point to 1st font that starts with sfnt version
353 >>(12.L) use sfnt-font
355 # Opentype font data from Avi Bercovich
356 0 string OTTO OpenType font data
357 !:mime application/vnd.ms-opentype
359 # From: Alex Myczko <alex@aiei.ch>
360 0 string SplineFontDB: Spline Font Database
361 !:mime application/vnd.font-fontforge-sfd
362 >14 string x version %s
365 0x40 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
370 >>>0x54 lestring16 x \b, %s family
371 !:mime application/vnd.ms-fontobject
373 # Web Open Font Format (.woff)
375 >4 belong 0x00010000 \b, TrueType
376 >4 belong 0x4F54544F \b, CFF
377 >4 belong 0x74727565 \b, TrueType
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
385 # https://www.w3.org/TR/WOFF/
386 0 string wOFF Web Open Font Format
388 >20 beshort x \b, version %d
390 # https://www.w3.org/TR/WOFF2/
391 0 string wOF2 Web Open Font Format (Version 2)
393 #>20 belong x \b, totalCompressedSize %d
394 >24 beshort x \b, version %d