DFONT
application/octet-stream
Magic Bytes
Offset: 0
00 01 00 00 00
Data Fork TrueType Font (DFONT) is a specialized font container format developed by Apple Inc. for storing font data within a file's data fork. This format enables macOS systems to manage and distribute TrueType font collections on file systems that lack support for classic Mac OS resource forks. Although natively supported by modern Apple operating systems, DFONT is a legacy format that has been widely replaced by cross-platform OpenType and standard TrueType specifications.
Validation Code
How to validate .dfont files in Python
Python
def is_dfont(file_path: str) -> bool:
"""Check if file is a valid DFONT by magic bytes."""
signature = bytes([0x00, 0x01, 0x00, 0x00, 0x00])
with open(file_path, "rb") as f:
return f.read(5) == signature
How to validate .dfont files in Node.js
Node.js
function isDFONT(buffer: Buffer): boolean {
const signature = Buffer.from([0x00, 0x01, 0x00, 0x00, 0x00]);
return buffer.subarray(0, 5).equals(signature);
}
Go
func IsDFONT(data []byte) bool {
signature := []byte{0x00, 0x01, 0x00, 0x00, 0x00}
if len(data) < 5 {
return false
}
return bytes.Equal(data[:5], signature)
}
API Endpoint
GET
/api/v1/dfont
curl https://filesignature.org/api/v1/dfont