fonts 16 KB

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