The smallest valid font for Windows

Post general font related questions (e.g. how to install, convert and use fonts) and requests (looking for fonts, designers etc.) here.
Post Reply
Erwin Denissen
Moderator
Moderator
Posts: 11107
Joined: Fri Oct 04, 2002 12:41 am
Location: Bilthoven, The Netherlands
Contact:

The smallest valid font for Windows

Post by Erwin Denissen »

Most people don't care about the size of their fonts, but sometimes there is need for a small font.

FontCreator will try to keep the file size as low as possible, so to some extent it can be used for this purpose.

To really, really, make a font with the smallest file size, it will become a font which can't be used to actually display text, as we need to make it as bare as possible but still obey all requirements as found in the TrueType/OpenType specifications.

There are several specific parts that need attention:

The font naming values
Since a font needs to have a name, we will use a single character (s for small).

A glyph with an outline
We will keep the first glyph as the .notdef glyph, and will add another glyph mapped to the hyphen character. We avoid complexity as that would only increase the font file size, so the glyph will only have a single rectangle.

No advanced features
All things that are not required will be avoided, so we will not include kerning, hinting, or OpenType layout features.

The font generated by FontCreator 7.5 contains 696 bytes:
s696.otf
(696 Bytes) Downloaded 900 times
We can even reduces the size some more by using FontCreator 6.5 as that version allows you to further fine-tune platform specific data. That font file has 552 bytes and is still valid according to Windows. This file can both be downloaded here:
s552.ttf
(552 Bytes) Downloaded 1035 times
I'm sure there are some more ways to squeeze a byte or two (change the outline from a rectangle to a triangle), but 552 bytes is close to the limit for a valid Windows font. Excluding the internal OS/2 and post tables is another option, but then you end up with a legacy font which is beyond the limit in my opinion.

The main reason version 7.5 of our font editor produces slightly larger fonts, is the fact it is designed with the latest versions of the OpenType font specification in mind. However that is not the only reason. Since we continually improve our software, making it more intuitive, we also strive to simplify complex/technical parts of font design, which means you are less likely to make mistakes, and have more time to complete your fonts.
Erwin Denissen
High-Logic
Proven Font Technology
Erwin Denissen
Moderator
Moderator
Posts: 11107
Joined: Fri Oct 04, 2002 12:41 am
Location: Bilthoven, The Netherlands
Contact:

Re: The smallest valid font for Windows

Post by Erwin Denissen »

Due to recent insights (see the discusion at the Typophile forum), I've further reduced the font file size.

As mentioned in my first post, the size can be further reduced by changing the outline from a rectangle into a triangle.

jasonc has a good point, as you can indeed save some bytes if you can store positions, (actually offsets) of coordinates in a byte instead of a short (two bytes). I therefor changed the units per em from 2048 to 64, and then rescaled the triangle so it benefits from this.

The new font file is 544 bytes.
s544b.ttf
(544 Bytes) Downloaded 828 times
This file obeys to the official standard, and will work just fine on Windows .
smallestfont.png
smallestfont.png (9 KiB) Viewed 13003 times
Again you could save an additional 110 bytes by excluding the OS/2 and post tables, but you will end up with a "legacy font" which is not guaranteed to work for the next decade.
Erwin Denissen
High-Logic
Proven Font Technology
Bhikkhu Pesala
Top Typographer
Top Typographer
Posts: 9869
Joined: Tue Oct 29, 2002 5:28 am
Location: Seven Kings, London UK
Contact:

Re: The smallest valid font for Windows

Post by Bhikkhu Pesala »

I am not sure what the point of all this is, but presumably you could reduce the triangle to a single node by deleting two of the nodes.
My FontsReviews: MainTypeFont CreatorHelpFC15 + MT12.0 @ Win 10 64-bit build 19045.2486
Erwin Denissen
Moderator
Moderator
Posts: 11107
Joined: Fri Oct 04, 2002 12:41 am
Location: Bilthoven, The Netherlands
Contact:

Re: The smallest valid font for Windows

Post by Erwin Denissen »

For most people there is no use for this, so feel free to ignore this post.

Leaving just a single node would save another 4 bytes, reducing the file size to 540 byes.
s540.ttf
(540 Bytes) Downloaded 866 times
And without nodes the size would become 524 bytes, but then the font file in no longer valid according to Windows.
Erwin Denissen
High-Logic
Proven Font Technology
Erwin Denissen
Moderator
Moderator
Posts: 11107
Joined: Fri Oct 04, 2002 12:41 am
Location: Bilthoven, The Netherlands
Contact:

Re: The smallest valid font for Windows

Post by Erwin Denissen »

I've made an even smaller font, 440 bytes! It is still valid in Windows 10, but it will no longer work in a web browser (Firefox).
s440.ttf
(440 Bytes) Downloaded 673 times
So the above 540 bytes font is still the smallest font known today, that works in both Windows (Windows 10) and Web browsers (Microsoft Edge, Firefox).
Erwin Denissen
High-Logic
Proven Font Technology
the.legend
Posts: 4
Joined: Mon Sep 02, 2019 8:56 pm

Re: The smallest valid font for Windows

Post by the.legend »

Congrats, Erwin: you made history.

As someone said, "It is one small font for man..."

:wink:

--
Olivier Legendre
Post Reply