TrueType Font
TrueType Font (.ttf) stores scalable glyph outlines as quadratic Bezier curves with bytecode hinting for precise screen rendering. Developed by Apple in 1991 and adopted by Microsoft for Windows 3.1, TTF remains universally supported across desktop, mobile, and print workflows.
Font format conversion requires glyph table remapping and hinting recalculation not available in browser WASM.
Common questions
What is the difference between TTF and OTF?
Both are OpenType font containers. TTF uses quadratic Bezier curves for glyph outlines and TrueType bytecode hinting. OTF with CFF tables uses cubic Bezier curves and declarative stem hints. At screen sizes, the rendering is indistinguishable. TTF has wider legacy support; OTF handles complex curves with fewer control points.
Should I use TTF or WOFF2 for my website?
WOFF2 for web delivery, always. WOFF2 is a Brotli-compressed TTF wrapper that is 50-60% smaller with identical rendering quality. Serve WOFF2 via @font-face and keep the source TTF for desktop installation and font editing workflows.
How do I install a TTF font on Windows, macOS, and Linux?
Windows: double-click the .ttf file and click Install, or copy to C:\Windows\Fonts. macOS: double-click to open Font Book, then click Install Font. Linux: copy to ~/.fonts/ or ~/.local/share/fonts/ and run fc-cache -fv to update the font cache.
Can I convert TTF to WOFF2 without losing quality?
WOFF2 compression is lossless — the glyph outlines, hinting instructions, and all metadata are preserved exactly. woff2_compress produces a smaller file that decompresses to a byte-identical TTF. There is zero quality loss.
What makes .TTF special
What is a TTF file?
TrueType Font (TTF) is a scalable font format developed jointly by Apple and Microsoft in the late 1980s. It uses quadratic Bézier curves to define letter shapes, allowing fonts to scale to any size. TTF remains one of the most widely supported font formats.
Continue reading — full technical deep dive
How to open TTF files
- Font Viewer (Windows) — Built-in, double-click to preview
- Font Book (macOS) — Built-in font manager
- GNOME Fonts (Linux) — Font viewer
- FontForge (Windows, macOS, Linux) — Free font editor
Technical specifications
| Property | Value |
|---|---|
| Curves | Quadratic Bézier |
| Hinting | Full TrueType hinting |
| Embedding | Embeddable in documents |
| Unicode | Full Unicode support |
| OpenType | TTF is an OpenType variant |
Common use cases
- Desktop applications: System and application fonts
- Print design: Typography for printed materials
- Document embedding: Fonts embedded in PDFs
- Cross-platform: Universal font format
.TTF compared to alternatives
| Formats | Criteria | Winner |
|---|---|---|
| .TTF vs .OTF | Outline type TTF uses quadratic Bezier curves (on/off-curve control points). OTF with CFF uses cubic Bezier curves, which represent complex shapes with fewer points. Both produce identical rendering at screen sizes. | Draw |
| .TTF vs .OTF | Hinting TTF hinting uses bytecode instructions that explicitly control pixel placement at small sizes. CFF hinting in OTF uses declarative stem hints. TTF hinting produces sharper rendering on older Windows rasterizers (GDI/ClearType). | TTF wins |
| .TTF vs .WOFF2 | File size WOFF2 applies Brotli compression with font-specific byte transforms to TTF data, producing files 50-60% smaller. TTF is uncompressed. For web delivery, WOFF2 is the clear choice. | WOFF2 wins |
| .TTF vs .WOFF2 | Desktop installation All desktop OS font managers (Windows, macOS, Linux) install TTF directly. WOFF2 is designed for web use and must be decompressed to TTF/OTF before desktop installation. | TTF wins |
Technical reference
- MIME Type
font/ttf- Magic Bytes
00 01 00 00TrueType version 1.0 signature.- Developer
- Apple Inc. / Microsoft
- Year Introduced
- 1991
- Open Standard
- Yes
TrueType version 1.0 signature.
Binary Structure
A TrueType font file uses the sfnt (scalable font) container format. The file begins with a 12-byte Offset Table: sfnt version (4 bytes: 00 01 00 00 for TrueType outlines, 4F 54 54 4F / 'OTTO' for CFF/PostScript outlines), numTables (2 bytes), searchRange (2 bytes), entrySelector (2 bytes), and rangeShift (2 bytes). The searchRange, entrySelector, and rangeShift fields optimize binary search of the table directory. Following the Offset Table is the Table Directory: an array of 16-byte records, one per table, each containing a 4-byte ASCII tag, 4-byte checksum, 4-byte offset from the file start, and 4-byte length. Tables are padded to 4-byte boundaries. Core tables include: cmap (character code to glyph index mapping — platform/encoding subtables for Unicode, Windows, Macintosh), glyf (glyph outline data — contour points, on/off curve flags, TrueType instructions), loca (glyph offset index into glyf — short or long format based on head.indexToLocFormat), head (font header: unitsPerEm, created/modified dates, flags, bounding box, indexToLocFormat), hhea (horizontal metrics header: ascent, descent, line gap, max advance width), hmtx (per-glyph horizontal advance widths and left side bearings), maxp (maximum profile: numGlyphs, max points/contours/zones/storage), name (naming table: font family, subfamily, version, copyright, license — localized strings), post (PostScript names for glyphs), and OS/2 (Windows-specific metrics: weight class, width class, embedding flags, panose classification, Unicode ranges, codepage ranges, vertical metrics).
| Offset | Length | Field | Example | Description |
|---|---|---|---|---|
0x00 | 4 bytes | sfnt Version | 00 01 00 00 (TrueType) | Font container version. 00 01 00 00 = TrueType outlines. 4F 54 54 4F ('OTTO') = CFF/PostScript outlines (OTF). |
0x04 | 2 bytes | numTables | 00 11 (17 tables) | Number of table directory entries following this header. Typical TTF has 12-20 tables. |
0x06 | 2 bytes | searchRange | 00 80 (128) | Maximum power of 2 <= numTables, times 16. Optimizes binary search of the table directory. |
0x08 | 2 bytes | entrySelector | 00 03 (3) | Log2 of the maximum power of 2 <= numTables. Used with searchRange for table lookup. |
0x0A | 2 bytes | rangeShift | 00 30 (48) | numTables * 16 - searchRange. Remainder for binary search calculation. |
0x0C | 16 bytes each | Table Directory Entry | 636D6170 (cmap) + checksum + offset + length | Each entry: 4-byte ASCII tag, 4-byte checksum, 4-byte offset from file start, 4-byte table length. Tables padded to 4-byte boundaries. |
Attack Vectors
- Malformed TrueType hinting bytecode can trigger stack overflows or infinite loops in font rasterizers, allowing arbitrary code execution (CVE-2011-3402 — Windows kernel-level exploit via TTF hinting in win32k.sys)
- Crafted glyf table with oversized contour point counts causes heap buffer overflow during rasterization
- Embedded OpenType name table strings with excessive length can overflow fixed-size buffers in parsers that do not validate string lengths against table boundaries
Mitigation: FileDex does not rasterize or install TTF files server-side. All format analysis is reference-only. Modern operating systems sandbox font rasterization (Windows UMFD, macOS App Sandbox) to limit the impact of malformed font exploits.