1 2#------------------------------------------------------------------------------ 3# $File: fonts,v 1.37 2017/06/24 00:39:00 christos Exp $ 4# fonts: file(1) magic for font data 5# 60 search/1 FONT ASCII vfont text 70 short 0436 Berkeley vfont data 80 short 017001 byte-swapped Berkeley vfont data 9 10# PostScript fonts (must precede "printer" entries), quinlan@yggdrasil.com 110 string %!PS-AdobeFont-1. PostScript Type 1 font text 12>20 string >\0 (%s) 136 string %!PS-AdobeFont-1. PostScript Type 1 font program data 140 string %!FontType1 PostScript Type 1 font program data 156 string %!FontType1 PostScript Type 1 font program data 160 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: http://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 240 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 710 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 750 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) 800 search/1 STARTFONT\ X11 BDF font text 81 82# From: Joerg Jenderek 83# URL: http://grub.gibibit.com/New_font_format 84# Reference: util/grub-mkfont.c 85# include/grub/fontformat.h 86# FONT_FORMAT_SECTION_NAMES_FILE 870 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) 1030 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 1080 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> 1140 string flf FIGlet font 115>3 string >2a version %-2.2s 1160 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++ 1210 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) 1260 belong 0xff464f4e DOS code page font data collection 1277 belong 0x00454741 DOS code page font data 1287 belong 0x00564944 DOS code page font data (from Linux?) 1294098 string DOSFONT DOSFONT2 encrypted font data 130 131# downloadable fonts for browser (prints type) anthon@mnt.org 132# https://tools.ietf.org/html/rfc3073 1330 string PFR1 Portable Font Resource font data (new) 134>102 string >0 \b: %s 1350 string PFR0 Portable Font Resource font data (old) 136>4 beshort >0 version %d 137 138# True Type fonts 139# Modified by: Joerg Jenderek 140# URL: https://en.wikipedia.org/wiki/TrueType 141# Reference: https://developer.apple.com/fonts/TrueType-Reference-Manual/ 142# 143# sfnt version "typ1" used by some Apple, but no example found 1440 string typ1 145>0 use sfnt-font 146>0 use sfnt-names 147# sfnt version "true" used by some Apple 1480 string true 149>0 use sfnt-font 150>0 use sfnt-names 151# GRR: below test is too general 152# sfnt version often 0x00010000 1530 string \000\001\000\000 154>0 use sfnt-font 155>0 use sfnt-names 156# validate and display sfnt font data like number of tables 1570 name sfnt-font 158# file 5.30 version assumes 00FFh as maximal number of tables 159#>4 ubeshort <0x0100 160# maximal 27 tables found like in Skia.ttf 161# 46 different table names mentioned on Apple specification 162# skip 1st sequence of DOS 2 backup with path separator (\~92 or /~47) misinterpreted as table number 163>4 ubeshort <47 164# skip bad examples with garbage table names like in a5.show HYPERC MAC 165# tag names consist of up to four characters padded with spaces at end like 166# BASE DSIG OS/2 Zapf acnt glyf cvt vmtx xref ... 167>>12 regex/4l \^[A-Za-z][A-Za-z][A-Za-z/][A-Za-z2\ ] 168#>>>0 ubelong x \b, sfnt version 0x%x 169>>>0 ubelong !0x4f54544f TrueType 170!:mime application/font-sfnt 171#!:mime font/ttf 172!:apple ????tfil 173# .ttf for TrueType font 174# EUDC.tte created by privat character editor %WINDIR%\system32\eudcedit.exe 175!:ext ttf/tte 176# sfnt version 4F54544Fh~OTTO 177>>>0 ubelong =0x4f54544f OpenType 178!:mime application/font-sfnt 179#!:mime font/otf 180!:apple ????OTTO 181!:ext otf 182>>>0 ubelong x Font data 183# DSIG=44454947h table name implies a digitally signed font 184# search range = number of tables * 16 =< maximal number of tables * 16 = 27 * 16 = 432 185>>>12 search/432 DSIG \b, digitally signed 186>>>4 ubeshort x \b, %d tables 187# minimal 9 tables found like in NISC18030.ttf 188#>>>4 ubeshort <10 TMIN 189#>>>4 ubeshort >24 TBIG 190# table directory entries 191>>>12 string x \b, 1st "%4.4s" 192 193# search and display 1st name in sfnt font which is often copyright text 194# does not work inside font collections 1950 name sfnt-names 196# search for naming table 197>12 search/432/s name 198# biggest offset 0x0100bd28 like Windows10 Fonts\simsunb.ttf 199#>>>>&8 ubelong >0x0100bd27 BIGGEST OFFSET 200>>&8 ubelong >0x00100000 201# offset of name table 202>>>&-4 ubelong x \b, name offset 0x%x 203# GRR: pointer to name table only works if offset ~< FILE_BYTES_MAX = 100000h defined in src\file.h 204>>&8 ubelong <0x00100000 205>>>&-16 ubelong x 206# name table 207>>>>(&8.L) ubequad x 208# invalid format selector 209#>>>>>&-8 ubeshort !0 \b, invalid selector %x 210# minimal 3 name records found like in c:\Program Files (x86)\Tesseract-OCR\tessdata\pdf.ttf 211# maximal 1227 name records found like in Apple Chancery.ttf 212#>>>>>&-6 ubeshort <0x4 mincount 213#>>>>>&-6 ubeshort >130 maxcount 214>>>>>&-6 ubeshort x \b, %d names 215# offset to start of string storage from start of table 216#>>>>>&-4 ubeshort x \b, record offset %d 217# 1st name record 218# string offset from start of storage area 219#>>>>>&8 ubeshort x \b, string offset %d 220# string length 221#>>>>>&6 ubeshort x \b, string length %d 222# minimal name string 7 like in c:\Program Files (x86)\Kodi\addons\webinterface.default\lib\video-js\font\VideoJS.ttf 223# also found 0 like in SWZCONLN.TTF 224#>>>>>&6 ubeshort <8 MIN STRING 225# maximal name string 806 like in c:\Windows\Fonts\palabi.ttf 226#>>>>>&6 ubeshort >805 MAX STRING 227# platform identifier: 0~Apple Unicode, 1~Macintosh, 3~Microsoft 228#>>>>>&-2 ubeshort >3 BAD PLATFORM 229>>>>>&-2 ubeshort 0 \b, Unicode 230>>>>>&-2 ubeshort 1 \b, Macintosh 231>>>>>&-2 ubeshort 3 \b, Microsoft 232# languageID (0~english Macintosh, 0409h~english Microsoft, ...) 233>>>>>&2 ubeshort >0 \b, language 0x%x 234# name identifiers 235# often 0~copyright, 1~font, 2~font subfamily, 5~version, 13~license, 19~sample, ... 236>>>>>&4 ubeshort >0 \b, type %d string 237# platform specific encoding: 238# 0~undefined character set, 1~UGL set with Unicode, 3~Unicode 2.0 BMP only, 4~Unicode 2.0 239#>>>>>&0 ubeshort x \b, %d encoding 240>>>>>&0 ubeshort 0 241# handle only name string offset 0 because do not know how to add 2 relative offsets 242>>>>>>&6 ubeshort 0 243>>>>>>>&(&-14.S-18) ubyte !0 244# GRR: instead 806 only first MAXstring = 96 characters are displayed as defined in src\file.h 245# often copyright string that starts like \251 2006 The Monotype Corporation 246>>>>>>>>&-1 string x \b, %-11.96s 247# test for unicode string 248>>>>>>>&(&-14.S-18) ubyte 0 249>>>>>>>>&0 lestring16 x \b, %-11.96s 250# unicode encoding 251>>>>>&0 ubeshort >0 252>>>>>>&6 ubeshort 0 253>>>>>>>&(&-14.S-17) lestring16 x \b, %-11.96s 254 2550 string \007\001\001\000Copyright\ (c)\ 199 Adobe Multiple Master font 2560 string \012\001\001\000Copyright\ (c)\ 199 Adobe Multiple Master font 257 258# TrueType/OpenType font collections (.ttc) 259# URL: https://en.wikipedia.org/wiki/OpenType 260# http://www.microsoft.com/typography/otspec/otff.htm 261# Modified by: Joerg Jenderek 262# Note: container for TrueType, OpenType font 2630 string ttcf 264# skip ASCII text 265>4 ubyte 0 266# sfnt version often 0x00010000 of 1st table is TrueType 267>>(12.L) ubelong !0x4f54544f TrueType 268#!:mime font/ttf 269!:apple ????tfil 270!:ext ttc 271# sfnt version 4F54544Fh~OTTO of 1st table is OpenType font 272>>(12.L) ubelong =0x4f54544f OpenType 273#!:mime font/otf 274!:apple ????OTTO 275# no example found for otc 276!:ext ttc/otc 277>>4 ubyte x font collection data 278!:mime application/font-sfnt 279#!:mime font/collection 280# TCC version 281>>4 belong 0x00010000 \b, 1.0 282>>4 belong 0x00020000 \b, 2.0 283>>8 ubelong >0 \b, %d fonts 284# array offset size = fonts * offsetsize = fonts * 4 285>>(8.L*4) ubequad x 286# 0x44454947 = 'DSIG' 287>>>&4 belong 0x44534947 \b, digitally signed 288# offset to 1st font 289>>12 ubelong x \b, at 0x%x 290# point to 1st font that starts with sfnt version 291>>(12.L) use sfnt-font 292 293# Opentype font data from Avi Bercovich 2940 string OTTO OpenType font data 295!:mime application/vnd.ms-opentype 296 297# Gurkan Sengun <gurkan@linuks.mine.nu>, www.linuks.mine.nu 2980 string SplineFontDB: Spline Font Database 299!:mime application/vnd.font-fontforge-sfd 300>14 string x version %s 301 302# EOT 3030x40 string \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 304>0x22 string LP Embedded OpenType (EOT) 305# workaround until there's lepstring16 306# >>0x52 lepstring16/h >\0 \b, %s family 307>>0x52 short !0 308>>>0x54 lestring16 x \b, %s family 309!:mime application/vnd.ms-fontobject 310 311# Web Open Font Format (.woff) 3120 name woff 313>4 belong 0x00010000 \b, TrueType 314>4 belong 0x4F54544F \b, CFF 315>4 belong 0x74727565 \b, TrueType 316>4 default x 317>>4 belong x \b, flavor %d 318>8 belong x \b, length %d 319#>12 beshort x \b, numTables %d 320#>14 beshort x \b, reserved %d 321#>16 belong x \b, totalSfntSize %d 322 323# http://www.w3.org/TR/WOFF/ 3240 string wOFF Web Open Font Format 325>0 use woff 326>20 beshort x \b, version %d 327>22 beshort x \b.%d 328# http://www.w3.org/TR/WOFF2/ 3290 string wOF2 Web Open Font Format (Version 2) 330>0 use woff 331#>20 belong x \b, totalCompressedSize %d 332>24 beshort x \b, version %d 333>26 beshort x \b.%d 334