On Mon, 2008-11-03 at 13:46, Ed Trager wrote:
> at the *nix "file" command source code, I bet you could fairly easily
> find a reference to the "magic" file header bytes that are used to
> detect TTF/OTF files and then add this to the getId3() stuff, assuming
> that getId3() is well-written.
OpenType fonts begin with the four bytes
   "OTTO"

TrueType fonts begin with either
   0x00010000
   "true"
   0x00020000        (I doubt this will occur in a user supplied font)

TTC fonts begin with
   "ttcf"

There are some ancient apple/adobe sfnt formats which start with
   "typ1"
   "CID "
 but these aren't likely to be generated any more.

PFB files begin with
   0x8001
PFA files begin with
   "%!PS-AdobeFont-1.0"
(Other adobe fonts probably also start with this, so it might just mean
PostScript font).
Bare CFF fonts (the thingies inside otf files) begin with
   0x010004

BDF fonts begin with
   "STARTFONT"

PCF fonts begin with
   0x01 "fcp"

sfd files begin with
   "SplineFontDB:"

Ikarus fonts begin with
   "IK" 0x0055

(There are some exceedingly complex rules for recognizing fonts in mac
resource forks, or mac dfont format (almost the same) but I doubt it's
worth implementing them).

On Tue, 2008-11-04 at 05:02, Brendan Ferguson wrote:
> Say, will any of the font source files read like a unix script file  
> with #!/ as the first bits of information in the file?
I am not aware of any font format which starts with "#!/"

On Tue, 2008-11-04 at 14:17, Dave Crossland wrote:
> I think with extensions and the "file" command we can reliably detect
> images as images and have them displayed instead of for download :-)
png images start with
  0x89 "PNG"
jpeg images contain "JFIF" in bytes 6,7,8,9
gif files start with
   "GIF87"
   "GIF89"


_______________________________________________
Openfontlibrary mailing list
Openfontlibrary@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/openfontlibrary

Reply via email to