[File] [PATCH] fonts: TrueType fonts lose their MIME type since the FontKit change

Nicolas Grekas nicolas.grekas at gmail.com
Wed Oct 21 10:33:34 EDT 2026


Hi,

Since fonts 1.55 ("Recognize FontKit"), plain TrueType fonts get no MIME
type and no extension. Here is DejaVuSans-Bold.ttf, with magic/Magdir/fonts
at 1.54 and then at 1.55:

  1.54: TrueType Font data, 19 tables, 1st "FFTM", 26 names, Macintosh
        --mime-type: font/ttf, --extension: ttf/tte, --apple: ????tfil
  1.55: TrueType Font data, 19 tables (FontKit), 1st "FFTM", 26 names,
Macintosh
        --mime-type: application/octet-stream, --extension: ???, --apple:
UNKNUNKN

The !:mime, !:apple and !:ext lines now follow the new FontKit test, so
they only apply to FontKit fonts. The new ">>>12 ubelong !0x464b2020" test
also prints "(FontKit)" for every font that is not a FontKit one.

The attached patch moves the FontKit test after the annotations of the
TrueType line, and removes the description of the second test. Plain
TrueType fonts get font/ttf back, and the output for a FontKit font doesn't
change. I checked that with a copy of DejaVuSans-Bold.ttf where the first
table tag is "FK  ".

PHP bundles libmagic in its fileinfo extension, and PHP 8.6 (in beta now)
ships 5.48. So PHP apps will see TrueType uploads as
application/octet-stream unless this is fixed before PHP 8.6.0.

Thanks,
Nicolas Grekas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.astron.com/pipermail/file/attachments/20261021/5efbdc3b/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fonts.patch
Type: application/octet-stream
Size: 823 bytes
Desc: not available
URL: <http://mailman.astron.com/pipermail/file/attachments/20261021/5efbdc3b/attachment.obj>


More information about the File mailing list