fonts 13 KB

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