vendor/file: upgrade from 5.32 to 5.38
[dragonfly.git] / contrib / file / magic / Magdir / fonts
1
2 #------------------------------------------------------------------------------
3 # $File: fonts,v 1.43 2019/07/16 11:11:31 christos Exp $
4 # fonts:  file(1) magic for font data
5 #
6 0       search/1        FONT            ASCII vfont text
7 0       short           0436            Berkeley vfont data
8 0       short           017001          byte-swapped Berkeley vfont data
9
10 # PostScript fonts (must precede "printer" entries), quinlan@yggdrasil.com
11 0       string          %!PS-AdobeFont-1.       PostScript Type 1 font text
12 >20     string          >\0                     (%s)
13 6       string          %!PS-AdobeFont-1.       PostScript Type 1 font program data
14 0       string          %!FontType1     PostScript Type 1 font program data
15 6       string          %!FontType1     PostScript Type 1 font program data
16 0       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
24 0               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
71 0       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
75 0       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)
80 0       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
87 0                       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)
103 0       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
108 0       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>
114 0       string          flf             FIGlet font
115 >3      string          >2a             version %-2.2s
116 0       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++
121 0       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)
126 0       belong          0xff464f4e      DOS code page font data collection
127 7       belong          0x00454741      DOS code page font data
128 7       belong          0x00564944      DOS code page font data (from Linux?)
129 4098    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
136 #62     ulelong         0x55555555
137 # skip cl8m8ocofedso.testfile by looking for face size lower/equal 72
138 #>2     uleshort        <73
139 #>>0    use             gdos-font
140 # BOX18.GFT COWBOY30.GFT ROYALK30.GFT
141 #62     ulelong         0
142 # skip ISO 9660 CD-ROM ./filesystem by looking for low positive face size
143 #>2     uleshort        >2
144 # skip DOS 2.0 backup id file ./msdos by looking for face size lower/equal 72
145 #>>2    uleshort        <73
146 # skip MS oem.hlp, some Windows ICO ./msdos by looking for valid long name like WYE
147 #>>>4   ulelong         >0x001F1f1F
148 # skip Microsoft WinWord 2.0 ./msdos by looking for positive offset to font data
149 #>>>>76 ulelong         >83
150 #>>>>>0 use             gdos-font
151 0       name            gdos-font
152 >0      uleshort        x               GEM GDOS font
153 !:mime  application/x-font-gdos
154 # also .eps found like AA070GEP.EPS AI360GEP.EPS
155 !:ext   fnt/gtf
156 # font name like Big&Tall, Celtic #s, Courier, University Bold, WYE
157 >4      string          x               %.32s
158 # face size in points 3-72 SLSS03CG.FNT H1CELT72.FNT
159 >2      uleshort        x               %u
160 # face ID (must be unique)
161 >0      uleshort        x               \b, ID 0x%4.4x
162 # lowest character index in face (4 but usually 32 for disk-loaded fonts)
163 #>36    uleshort        !32             \b, unusual character index %u
164 # width of the widest character like 0 8 10 12 16 24 32
165 #>50    uleshort        x               \b, %u char width
166 # width of the widest character cell like 8 11 12 14 15 16 33 67
167 #>52    uleshort        x               \b, %u cell width
168 # thickening size in pixel like 0 1 2 3 4 5 6 7 8
169 #>58    uleshort        x               \b, %u thick
170 # lightening mask to eliminate pixels, usually 5555h
171 >62     uleshort        !0x5555         \b, lightening mask 0x%x
172 # skewing mask to determine when to perform additional rotation when skewing, usually 5555h
173 >64     uleshort        !0x5555         \b, skewing mask 0x%x
174 # offset to optional horizontal offset table 0 58h~88 5eh 252h
175 #>68    ulelong         x               \b, 0x%x horizontal table offset
176 # offset of character offset table 54h for many *.GFT 55h 58h 5Eh 120h 1D4h 202h 220h
177 #>72    ulelong         x               \b, 0x%x coffset
178 # offset to font data like 116h 118h 158 20Ah 20Eh
179 >76     ulelong         x               \b, 0x%x foffset
180 # form width in bytes like 58 67 156 190 227 317 345
181 #>80    uleshort        x               \b, %u fwidth
182 # form height in bytes like 4 8 11 17 26 56 70 90 120 146 150
183 #>82    uleshort        x               \b, %u fheight
184 # pointer to the next font like 0 10000h 20000h 30000h 40000h 60000h 80000h E0000h D0000h 
185 #>84    ulelong         x               \b, 0x%x noffset
186
187 # downloadable fonts for browser (prints type) anthon@mnt.org
188 # https://tools.ietf.org/html/rfc3073
189 0       string          PFR1            Portable Font Resource font data (new)
190 >102    string          >0              \b: %s
191 0       string          PFR0            Portable Font Resource font data (old)
192 >4      beshort         >0              version %d
193
194 # True Type fonts
195 # Modified by: Joerg Jenderek
196 # URL: https://en.wikipedia.org/wiki/TrueType
197 # Reference: https://developer.apple.com/fonts/TrueType-Reference-Manual/
198 #
199 # sfnt version "typ1" used by some Apple, but no example found
200 0       string  typ1
201 >0      use             sfnt-font
202 >0      use             sfnt-names
203 # sfnt version "true" used by some Apple
204 0       string  true
205 >0      use             sfnt-font
206 >0      use             sfnt-names
207 # GRR: below test is too general
208 # sfnt version often 0x00010000
209 0       string  \000\001\000\000
210 >0      use             sfnt-font
211 >0      use             sfnt-names
212 #       validate and display sfnt font data like number of tables
213 0       name            sfnt-font
214 # file 5.30 version assumes 00FFh as maximal number of tables
215 #>4     ubeshort        <0x0100         
216 # maximal 27 tables found like in Skia.ttf
217 # 46 different table names mentioned on Apple specification
218 # skip 1st sequence of DOS 2 backup with path separator (\~92 or /~47) misinterpreted as table number
219 >4      ubeshort        <47             
220 # skip bad examples with garbage table names like in a5.show HYPERC MAC
221 # tag names consist of up to four characters padded with spaces at end like
222 # BASE DSIG OS/2 Zapf acnt glyf cvt vmtx xref ...
223 >>12    regex/4l        \^[A-Za-z][A-Za-z][A-Za-z/][A-Za-z2\ ]  
224 #>>>0   ubelong x       \b, sfnt version 0x%x
225 >>>0    ubelong !0x4f54544f     TrueType
226 !:mime  font/sfnt
227 !:apple ????tfil
228 # .ttf for TrueType font
229 # EUDC.tte created by privat character editor %WINDIR%\system32\eudcedit.exe
230 !:ext   ttf/tte
231 # sfnt version 4F54544Fh~OTTO
232 >>>0    ubelong =0x4f54544f     OpenType
233 !:mime  font/otf
234 !:apple ????OTTO
235 !:ext   otf
236 >>>0    ubelong x               Font data
237 # DSIG=44454947h table name implies a digitally signed font
238 # search range = number of tables * 16 =< maximal number of tables * 16 = 27 * 16 = 432
239 >>>12   search/432      DSIG            \b, digitally signed
240 >>>4    ubeshort        x               \b, %d tables
241 # minimal 9 tables found like in NISC18030.ttf
242 #>>>4   ubeshort        <10             TMIN
243 #>>>4   ubeshort        >24             TBIG
244 # table directory entries
245 >>>12   string          x               \b, 1st "%4.4s"
246
247 #       search and display 1st name in sfnt font which is often copyright text
248 #       does not work inside font collections
249 0       name            sfnt-names
250 # search for naming table
251 >12     search/432/s    name            
252 # biggest offset 0x0100bd28 like Windows10 Fonts\simsunb.ttf
253 #>>>>&8 ubelong         >0x0100bd27     BIGGEST OFFSET
254 >>&8    ubelong         >0x00100000     
255 # offset of name table
256 >>>&-4  ubelong         x               \b, name offset 0x%x
257 # GRR: pointer to name table only works if offset ~< FILE_BYTES_MAX = 100000h defined in src\file.h
258 >>&8    ubelong         <0x00100000     
259 >>>&-16 ubelong         x               
260 # name table
261 >>>>(&8.L)      ubequad x               
262 # invalid format selector 
263 #>>>>>&-8       ubeshort        !0      \b, invalid selector %x
264 # minimal 3 name records found like in c:\Program Files (x86)\Tesseract-OCR\tessdata\pdf.ttf
265 # maximal 1227 name records found like in Apple Chancery.ttf
266 #>>>>>&-6       ubeshort        <0x4    mincount
267 #>>>>>&-6       ubeshort        >130    maxcount
268 >>>>>&-6        ubeshort        x       \b, %d names
269 # offset to start of string storage from start of table
270 #>>>>>&-4       ubeshort        x       \b, record offset %d
271 # 1st name record
272 # string offset from start of storage area 
273 #>>>>>&8                ubeshort        x       \b, string offset %d
274 # string length
275 #>>>>>&6                ubeshort        x       \b, string length %d
276 # minimal name string 7 like in c:\Program Files (x86)\Kodi\addons\webinterface.default\lib\video-js\font\VideoJS.ttf
277 # also found 0 like in SWZCONLN.TTF
278 #>>>>>&6                ubeshort        <8      MIN STRING
279 # maximal name string 806 like in c:\Windows\Fonts\palabi.ttf
280 #>>>>>&6                ubeshort        >805    MAX STRING
281 # platform identifier: 0~Apple Unicode, 1~Macintosh, 3~Microsoft
282 #>>>>>&-2       ubeshort        >3      BAD PLATFORM
283 >>>>>&-2        ubeshort        0       \b, Unicode
284 >>>>>&-2        ubeshort        1       \b, Macintosh
285 >>>>>&-2        ubeshort        3       \b, Microsoft
286 # languageID (0~english Macintosh, 0409h~english Microsoft, ...)
287 >>>>>&2         ubeshort        >0      \b, language 0x%x
288 # name identifiers
289 # often 0~copyright, 1~font, 2~font subfamily, 5~version, 13~license, 19~sample, ...
290 >>>>>&4         ubeshort        >0      \b, type %d string
291 # platform specific encoding:
292 # 0~undefined character set, 1~UGL set with Unicode, 3~Unicode 2.0 BMP only, 4~Unicode 2.0
293 #>>>>>&0                ubeshort        x       \b, %d encoding
294 >>>>>&0         ubeshort        0       
295 # handle only name string offset 0 because do not know how to add 2 relative offsets
296 >>>>>>&6                ubeshort        0       
297 >>>>>>>&(&-14.S-18)     ubyte           !0      
298 # GRR: instead 806 only first MAXstring = 96 characters are displayed as defined in src\file.h
299 # often copyright string that starts like \251 2006 The Monotype Corporation
300 >>>>>>>>&-1             string          x       \b, %-11.96s
301 # test for unicode string
302 >>>>>>>&(&-14.S-18)     ubyte           0       
303 >>>>>>>>&0              lestring16      x       \b, %-11.96s
304 # unicode encoding
305 >>>>>&0         ubeshort        >0      
306 >>>>>>&6                ubeshort        0       
307 >>>>>>>&(&-14.S-17)     lestring16      x       \b, %-11.96s
308
309 0       string          \007\001\001\000Copyright\ (c)\ 199     Adobe Multiple Master font
310 0       string          \012\001\001\000Copyright\ (c)\ 199     Adobe Multiple Master font
311
312 # TrueType/OpenType font collections (.ttc)
313 # URL: https://en.wikipedia.org/wiki/OpenType
314 # https://www.microsoft.com/typography/otspec/otff.htm
315 # Modified by: Joerg Jenderek
316 # Note: container for TrueType, OpenType font
317 0       string          ttcf
318 # skip ASCII text
319 >4      ubyte           0               
320 # sfnt version often 0x00010000 of 1st table is TrueType
321 >>(12.L)        ubelong !0x4f54544f     TrueType
322 !:mime  font/ttf
323 !:apple ????tfil
324 !:ext   ttc
325 # sfnt version 4F54544Fh~OTTO of 1st table is OpenType font 
326 >>(12.L)        ubelong =0x4f54544f     OpenType
327 !:mime  font/otf
328 !:apple ????OTTO
329 # no example found for otc
330 !:ext   ttc/otc
331 >>4     ubyte           x               font collection data
332 #!:mime font/collection
333 # TCC version
334 >>4     belong          0x00010000      \b, 1.0
335 >>4     belong          0x00020000      \b, 2.0
336 >>8     ubelong         >0              \b, %d fonts
337 # array offset size = fonts * offsetsize = fonts * 4
338 >>(8.L*4) ubequad       x               
339 # 0x44454947 = 'DSIG'
340 >>>&4   belong          0x44534947      \b, digitally signed
341 # offset to 1st font
342 >>12    ubelong         x               \b, at 0x%x
343 # point to 1st font that starts with sfnt version
344 >>(12.L) use            sfnt-font
345
346 # Opentype font data from Avi Bercovich
347 0       string          OTTO            OpenType font data
348 !:mime application/vnd.ms-opentype
349
350 # From: Alex Myczko <alex@aiei.ch>
351 0       string          SplineFontDB:   Spline Font Database
352 !:mime application/vnd.font-fontforge-sfd
353 >14     string          x               version %s
354
355 # EOT
356 0x40    string          \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0
357 >0x22   string          LP              Embedded OpenType (EOT)
358 # workaround until there's lepstring16
359 # >>0x52        lepstring16/h   >\0             \b, %s family
360 >>0x52  short   !0
361 >>>0x54 lestring16      x               \b, %s family
362 !:mime application/vnd.ms-fontobject
363
364 # Web Open Font Format (.woff)
365 0       name            woff
366 >4      belong          0x00010000      \b, TrueType
367 >4      belong          0x4F54544F      \b, CFF
368 >4      belong          0x74727565      \b, TrueType
369 >4      default         x
370 >>4     belong          x               \b, flavor %d
371 >8      belong          x               \b, length %d
372 #>12    beshort         x               \b, numTables %d
373 #>14    beshort         x               \b, reserved %d
374 #>16    belong          x               \b, totalSfntSize %d
375
376 # https://www.w3.org/TR/WOFF/
377 0       string          wOFF    Web Open Font Format
378 >0      use             woff
379 >20     beshort         x       \b, version %d
380 >22     beshort         x       \b.%d
381 # https://www.w3.org/TR/WOFF2/
382 0       string          wOF2    Web Open Font Format (Version 2)
383 >0      use             woff
384 #>20    belong          x       \b, totalCompressedSize %d
385 >24     beshort         x       \b, version %d
386 >26     beshort         x       \b.%d